implement conversation tools (settings/conversation), remove additional features from the settings menu and get rid of skill levels
This commit is contained in:
parent
bdf6289b32
commit
6b23c3e179
@ -259,7 +259,7 @@ class ThreadItem {
|
||||
$forged = ((($item['sig']) && (! intval($item['item_verified']))) ? t('Message signature incorrect') : '');
|
||||
$unverified = '' ; // (($this->is_wall_to_wall() && (! intval($item['item_verified']))) ? t('Message cannot be verified') : '');
|
||||
|
||||
|
||||
$settings = '';
|
||||
|
||||
// FIXME - check this permission
|
||||
if($conv->get_profile_owner() == local_channel()) {
|
||||
@ -267,6 +267,8 @@ class ThreadItem {
|
||||
'tagit' => t("Add Tag"),
|
||||
'classtagger' => "",
|
||||
);
|
||||
|
||||
$settings = t('Conversation Tools');
|
||||
}
|
||||
|
||||
$has_bookmarks = false;
|
||||
@ -436,7 +438,8 @@ class ThreadItem {
|
||||
'preview_lbl' => t('This is an unsaved preview'),
|
||||
'wait' => t('Please wait'),
|
||||
'submid' => str_replace(['+','='], ['',''], base64_encode($item['mid'])),
|
||||
'thread_level' => $thread_level
|
||||
'thread_level' => $thread_level,
|
||||
'settings' => $settings
|
||||
);
|
||||
|
||||
$arr = array('item' => $item, 'output' => $tmp_item);
|
||||
|
60
Zotlabs/Module/Settings/Conversation.php
Normal file
60
Zotlabs/Module/Settings/Conversation.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Zotlabs\Module\Settings;
|
||||
|
||||
|
||||
class Conversation {
|
||||
|
||||
function post() {
|
||||
|
||||
$module = substr(strrchr(strtolower(static::class), '\\'), 1);
|
||||
|
||||
check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module);
|
||||
|
||||
$features = get_module_features($module);
|
||||
|
||||
process_module_features_post(local_channel(), $features, $_POST);
|
||||
|
||||
build_sync_packet();
|
||||
|
||||
if($_POST['aj']) {
|
||||
if($_POST['auto_update'] == 1)
|
||||
info(t('Settings saved.') . EOL);
|
||||
else
|
||||
info(t('Settings saved. Reload page please.') . EOL);
|
||||
|
||||
killme();
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function get() {
|
||||
|
||||
$aj = ((isset($_GET['aj'])) ? true : false);
|
||||
|
||||
$module = substr(strrchr(strtolower(static::class), '\\'), 1);
|
||||
|
||||
$features = get_module_features($module);
|
||||
|
||||
$tpl = (($aj) ? get_markup_template("settings_module_ajax.tpl") : get_markup_template("settings_module.tpl"));
|
||||
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$action_url' => 'settings/' . $module,
|
||||
'$form_security_token' => get_form_security_token('settings_' . $module),
|
||||
'$title' => t('Conversation Settings'),
|
||||
'$features' => process_module_features_get(local_channel(), $features),
|
||||
'$submit' => t('Submit')
|
||||
));
|
||||
|
||||
if($aj) {
|
||||
echo $o;
|
||||
killme();
|
||||
}
|
||||
else {
|
||||
return $o;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -26,44 +26,14 @@ class Features {
|
||||
function get() {
|
||||
|
||||
$arr = [];
|
||||
$harr = [];
|
||||
|
||||
if(intval($_REQUEST['techlevel']))
|
||||
$level = intval($_REQUEST['techlevel']);
|
||||
else {
|
||||
$level = get_account_techlevel();
|
||||
}
|
||||
|
||||
if(! intval($level)) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
return;
|
||||
}
|
||||
|
||||
$techlevels = \Zotlabs\Lib\Techlevels::levels();
|
||||
|
||||
// This page isn't accessible at techlevel 0
|
||||
|
||||
unset($techlevels[0]);
|
||||
|
||||
$def_techlevel = (($level > 0) ? $level : 1);
|
||||
$techlock = get_config('system','techlevel_lock');
|
||||
|
||||
$all_features_raw = get_features(false);
|
||||
|
||||
foreach($all_features_raw as $fname => $fdata) {
|
||||
foreach(array_slice($fdata,1) as $f) {
|
||||
$harr[$f[0]] = ((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : '');
|
||||
}
|
||||
}
|
||||
|
||||
$features = get_features(true,$level);
|
||||
$features = get_features(false);
|
||||
|
||||
foreach($features as $fname => $fdata) {
|
||||
$arr[$fname] = array();
|
||||
$arr[$fname][0] = $fdata[0];
|
||||
foreach(array_slice($fdata,1) as $f) {
|
||||
$arr[$fname][1][] = array('feature_' . $f[0],$f[1],((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
|
||||
unset($harr[$f[0]]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,10 +41,7 @@ class Features {
|
||||
$o .= replace_macros($tpl, array(
|
||||
'$form_security_token' => get_form_security_token("settings_features"),
|
||||
'$title' => t('Additional Features'),
|
||||
'$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience and additional features consistent with your comfort level'), $techlevels ],
|
||||
'$techlock' => $techlock,
|
||||
'$features' => $arr,
|
||||
'$hiddens' => $harr,
|
||||
'$baseurl' => z_root(),
|
||||
'$submit' => t('Submit'),
|
||||
));
|
||||
|
@ -45,14 +45,6 @@ class Settings_menu {
|
||||
|
||||
);
|
||||
|
||||
if(get_account_techlevel() > 0 && get_features()) {
|
||||
$tabs[] = array(
|
||||
'label' => t('Additional features'),
|
||||
'url' => z_root().'/settings/features',
|
||||
'selected' => ((argv(1) === 'features') ? 'active' : ''),
|
||||
);
|
||||
}
|
||||
|
||||
$tabs[] = array(
|
||||
'label' => t('Addon settings'),
|
||||
'url' => z_root().'/settings/featured',
|
||||
|
@ -888,6 +888,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
|
||||
'$user' => App::$user,
|
||||
'$threads' => $threads,
|
||||
'$wait' => t('Loading...'),
|
||||
'$conversation_tools' => t('Conversation Tools'),
|
||||
'$dropping' => ($page_dropping?t('Delete Selected Items'):False),
|
||||
));
|
||||
|
||||
|
@ -71,69 +71,6 @@ function get_features($filtered = true, $level = (-1)) {
|
||||
|
||||
$arr = [
|
||||
|
||||
// Item tools
|
||||
'tools' => [
|
||||
|
||||
t('Post/Comment Tools'),
|
||||
|
||||
[
|
||||
'commtag',
|
||||
t('Community Tagging'),
|
||||
t('Ability to tag existing posts'),
|
||||
false,
|
||||
get_config('feature_lock','commtag'),
|
||||
feature_level('commtag',1),
|
||||
],
|
||||
|
||||
[
|
||||
'emojis',
|
||||
t('Emoji Reactions'),
|
||||
t('Add emoji reaction ability to posts'),
|
||||
true,
|
||||
get_config('feature_lock','emojis'),
|
||||
feature_level('emojis',1),
|
||||
],
|
||||
|
||||
[
|
||||
'filing',
|
||||
t('Saved Folders'),
|
||||
t('Ability to file posts under folders'),
|
||||
false,
|
||||
get_config('feature_lock','filing'),
|
||||
feature_level('filing',2),
|
||||
],
|
||||
|
||||
[
|
||||
'dislike',
|
||||
t('Dislike Posts'),
|
||||
t('Ability to dislike posts/comments'),
|
||||
false,
|
||||
get_config('feature_lock','dislike'),
|
||||
feature_level('dislike',1),
|
||||
],
|
||||
|
||||
[
|
||||
'star_posts',
|
||||
t('Star Posts'),
|
||||
t('Ability to mark special posts with a star indicator'),
|
||||
false,
|
||||
get_config('feature_lock','star_posts'),
|
||||
feature_level('star_posts',1),
|
||||
],
|
||||
|
||||
[
|
||||
'tagadelic',
|
||||
t('Tag Cloud'),
|
||||
t('Provide a personal tag cloud on your channel page'),
|
||||
false,
|
||||
get_config('feature_lock','tagadelic'),
|
||||
feature_level('tagadelic',2),
|
||||
],
|
||||
],
|
||||
|
||||
############################################
|
||||
############################################
|
||||
|
||||
'calendar' => [
|
||||
|
||||
t('CalDAV'),
|
||||
@ -161,6 +98,60 @@ function get_features($filtered = true, $level = (-1)) {
|
||||
]
|
||||
],
|
||||
|
||||
'conversation' => [
|
||||
|
||||
t('Conversation'),
|
||||
|
||||
[
|
||||
'commtag',
|
||||
t('Community Tagging'),
|
||||
t('Ability to tag existing posts'),
|
||||
false,
|
||||
get_config('feature_lock','commtag'),
|
||||
],
|
||||
|
||||
[
|
||||
'emojis',
|
||||
t('Emoji Reactions'),
|
||||
t('Add emoji reaction ability to posts'),
|
||||
true,
|
||||
get_config('feature_lock','emojis'),
|
||||
],
|
||||
|
||||
[
|
||||
'filing',
|
||||
t('Saved Folders'),
|
||||
t('Ability to file posts under folders'),
|
||||
false,
|
||||
get_config('feature_lock','filing'),
|
||||
],
|
||||
|
||||
[
|
||||
'dislike',
|
||||
t('Dislike Posts'),
|
||||
t('Ability to dislike posts/comments'),
|
||||
false,
|
||||
get_config('feature_lock','dislike'),
|
||||
],
|
||||
|
||||
[
|
||||
'star_posts',
|
||||
t('Star Posts'),
|
||||
t('Ability to mark special posts with a star indicator'),
|
||||
false,
|
||||
get_config('feature_lock','star_posts'),
|
||||
],
|
||||
|
||||
[
|
||||
'tagadelic',
|
||||
t('Tag Cloud'),
|
||||
t('Provide a personal tag cloud on your channel page'),
|
||||
false,
|
||||
get_config('feature_lock','tagadelic'),
|
||||
]
|
||||
|
||||
],
|
||||
|
||||
'directory' => [
|
||||
|
||||
t('Directory'),
|
||||
|
@ -41,6 +41,8 @@ $.ajaxSetup({cache: false});
|
||||
$(document).ready(function() {
|
||||
|
||||
$(document).on('click focus', '.comment-edit-form', handle_comment_form);
|
||||
$(document).on('click', '.conversation-settings-link', getConversationSettings);
|
||||
$(document).on('click', '#settings_module_ajax_submit', postConversationSettings);
|
||||
|
||||
jQuery.timeago.settings.strings = {
|
||||
prefixAgo : aStr['t01'],
|
||||
@ -122,6 +124,33 @@ $(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
function getConversationSettings() {
|
||||
$.get('settings/conversation/?f=&aj=1',function(data) {
|
||||
$('#conversation_settings_body').html(data);
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function postConversationSettings() {
|
||||
$.post(
|
||||
'settings/conversation',
|
||||
$('#settings_module_ajax_form').serialize() + "&auto_update=" + next_page
|
||||
);
|
||||
|
||||
if(next_page === 1) {
|
||||
page_load = true;
|
||||
}
|
||||
|
||||
$('#conversation_settings').modal('hide');
|
||||
|
||||
if(timer) clearTimeout(timer);
|
||||
timer = setTimeout(updateInit,100);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function datasrc2src(selector) {
|
||||
$(selector).each(function(i, el) {
|
||||
$(el).attr("src", $(el).data("src"));
|
||||
|
@ -4,5 +4,16 @@
|
||||
<div id="page-spinner" class="spinner-wrapper">
|
||||
<div class="spinner m"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal" id="conversation_settings" tabindex="-1" role="dialog" aria-labelledby="conversation_settings_label" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title" id="conversation_settings_label">{{$conversation_tools}}</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="conversation_settings_body">
|
||||
{{$wait}}
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
@ -183,6 +183,10 @@
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="dreport/{{$item.mid}}">{{$item.dreport}}</a>
|
||||
{{/if}}
|
||||
{{if $item.settings}}
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item conversation-settings-link" href="" data-toggle="modal" data-target="#conversation_settings">{{$item.settings}}</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -210,7 +214,7 @@
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">{{$response.count}} {{$response.button}}</h4>
|
||||
<h3 class="modal-title">{{$response.count}} {{$response.button}}</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body response-list">
|
||||
|
@ -212,7 +212,7 @@
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="expiryModalLabel">{{$jotnets_label}}</h4>
|
||||
<h3 class="modal-title" id="expiryModalLabel">{{$jotnets_label}}</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@ -239,7 +239,7 @@
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="expiryModalLabel">{{$expires}}</h4>
|
||||
<h3 class="modal-title" id="expiryModalLabel">{{$expires}}</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body form-group" style="width:90%">
|
||||
@ -266,7 +266,7 @@
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="createdModalLabel">{{$future_txt}}</h4>
|
||||
<h3 class="modal-title" id="createdModalLabel">{{$future_txt}}</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body form-group" style="width:90%">
|
||||
@ -293,7 +293,7 @@
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="embedPhotoModalLabel">{{$embedPhotosModalTitle}}</h4>
|
||||
<h3 class="modal-title" id="embedPhotoModalLabel">{{$embedPhotosModalTitle}}</h3>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="embedPhotoModalBody" >
|
||||
|
@ -1,31 +1,10 @@
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#id_techlevel').change(function() {
|
||||
var techlvl = $('#id_techlevel').val();
|
||||
window.location.href='{{$baseurl}}/settings/features?f=&techlevel=' + techlvl;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="generic-content-wrapper">
|
||||
<div class="section-title-wrapper">
|
||||
<h2>{{$title}}</h2>
|
||||
</div>
|
||||
<form action="settings/features" method="post" autocomplete="off">
|
||||
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
||||
{{if ! $techlock}}
|
||||
<div class="section-content-tools-wrapper">
|
||||
{{include file="field_select.tpl" field=$techlevel}}
|
||||
</div>
|
||||
{{else}}
|
||||
<input type="hidden" name="techlevel" value="{{$techlevel.2}}" />
|
||||
{{/if}}
|
||||
|
||||
{{if $hiddens}}
|
||||
{{foreach $hiddens as $k => $v}}
|
||||
<input type="hidden" name="feature_{{$k}}" value="{{$v}}" />
|
||||
{{/foreach}}
|
||||
{{/if}}
|
||||
<div class="panel-group" id="settings" role="tablist" aria-multiselectable="true">
|
||||
{{foreach $features as $g => $f}}
|
||||
<div class="panel">
|
||||
|
@ -4,15 +4,16 @@
|
||||
</div>
|
||||
<div class="section-content-wrapper">
|
||||
<form action="{{$action_url}}" method="post" autocomplete="off">
|
||||
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
||||
{{if $rpath}}
|
||||
<input type='hidden' name='rpath' value='{{$rpath}}'>
|
||||
{{/if}}
|
||||
{{foreach $features as $feature}}
|
||||
{{include file="field_checkbox.tpl" field=$feature}}
|
||||
{{/foreach}}
|
||||
<div class="settings-submit-wrapper" >
|
||||
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
|
||||
</div>
|
||||
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
||||
{{if $rpath}}
|
||||
<input type='hidden' name='rpath' value='{{$rpath}}'>
|
||||
{{/if}}
|
||||
{{foreach $features as $feature}}
|
||||
{{include file="field_checkbox.tpl" field=$feature}}
|
||||
{{/foreach}}
|
||||
<div class="settings-submit-wrapper" >
|
||||
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
11
view/tpl/settings_module_ajax.tpl
Normal file
11
view/tpl/settings_module_ajax.tpl
Normal file
@ -0,0 +1,11 @@
|
||||
<form id="settings_module_ajax_form" action="{{$action_url}}" method="post" autocomplete="off">
|
||||
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
|
||||
<input type='hidden' name='aj' value='1'>
|
||||
{{foreach $features as $feature}}
|
||||
{{include file="field_checkbox.tpl" field=$feature}}
|
||||
{{/foreach}}
|
||||
<div class="settings-submit-wrapper" >
|
||||
<button id="settings_module_ajax_submit" type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
|
||||
</div>
|
||||
</form>
|
||||
|
Reference in New Issue
Block a user