move *_divmore_height setting to the module extra_settings, and fix issue where feature settings were not synced if rpath was provided

This commit is contained in:
Mario Vavti 2018-10-04 21:38:39 +02:00
parent 6e03104e3e
commit d4af745fc8
14 changed files with 95 additions and 18 deletions

View File

@ -16,6 +16,10 @@ class Calendar {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -15,7 +15,17 @@ class Channel_home {
process_module_features_post(local_channel(), $features, $_POST);
$channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400);
if($channel_divmore_height < 50)
$channel_divmore_height = 50;
set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}
@ -26,6 +36,20 @@ class Channel_home {
$features = get_module_features($module);
$rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
$channel_divmore_height = [
'channel_divmore_height',
t('Max height of content (in pixels)'),
((get_pconfig(local_channel(),'system','channel_divmore_height')) ? get_pconfig(local_channel(),'system','channel_divmore_height') : 400),
t('Click to expand content exceeding this height')
];
$extra_settings_html = replace_macros(get_markup_template('field_input.tpl'),
[
'$field' => $channel_divmore_height
]
);
$tpl = get_markup_template("settings_module.tpl");
$o .= replace_macros($tpl, array(
@ -34,6 +58,7 @@ class Channel_home {
'$form_security_token' => get_form_security_token('settings_' . $module),
'$title' => t('Channel Home Settings'),
'$features' => process_module_features_get(local_channel(), $features),
'$extra_settings_html' => $extra_settings_html,
'$submit' => t('Submit')
));

View File

@ -16,6 +16,10 @@ class Connections {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -16,6 +16,10 @@ class Directory {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -30,13 +30,6 @@ class Display {
$manual_update = ((array_key_exists('manual_update',$_POST)) ? intval($_POST['manual_update']) : 0);
$start_menu = ((x($_POST,'start_menu')) ? intval($_POST['start_menu']) : 0);
$channel_divmore_height = ((x($_POST,'channel_divmore_height')) ? intval($_POST['channel_divmore_height']) : 400);
if($channel_divmore_height < 50)
$channel_divmore_height = 50;
$network_divmore_height = ((x($_POST,'network_divmore_height')) ? intval($_POST['network_divmore_height']) : 400);
if($network_divmore_height < 50)
$network_divmore_height = 50;
$browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0);
$browser_update = $browser_update * 1000;
if($browser_update < 10000)
@ -53,8 +46,6 @@ class Display {
set_pconfig(local_channel(),'system','itemspage', $itemspage);
set_pconfig(local_channel(),'system','no_smilies',1-intval($nosmile));
set_pconfig(local_channel(),'system','title_tosource',$title_tosource);
set_pconfig(local_channel(),'system','channel_divmore_height', $channel_divmore_height);
set_pconfig(local_channel(),'system','network_divmore_height', $network_divmore_height);
set_pconfig(local_channel(),'system','manual_conversation_update', $manual_update);
set_pconfig(local_channel(),'system','channel_menu', $channel_menu);
set_pconfig(local_channel(),'system','start_menu', $start_menu);
@ -211,8 +202,6 @@ class Display {
'$manual_update' => array('manual_update', t('Manual conversation updates'), channel_manual_conv_update(local_channel()), t('Default is on, turning this off may increase screen jumping'), $yes_no),
'$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no),
'$theme_config' => $theme_config,
'$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','channel_divmore_height')) ? get_pconfig(local_channel(),'system','channel_divmore_height') : 400), t('click to expand content exceeding this height')),
'$network_divmore_height' => array('network_divmore_height', t('Grid page max height of content (in pixels)'), ((get_pconfig(local_channel(),'system','network_divmore_height')) ? get_pconfig(local_channel(),'system','network_divmore_height') : 400) , t('click to expand content exceeding this height')),
'$start_menu' => ['start_menu', t('New Member Links'), $start_menu, t('Display new member quick links menu'), $yes_no]
));

View File

@ -16,6 +16,10 @@ class Editor {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -16,6 +16,10 @@ class Events {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -16,6 +16,10 @@ class Manage {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -15,7 +15,17 @@ class Network {
process_module_features_post(local_channel(), $features, $_POST);
$network_divmore_height = ((x($_POST,'network_divmore_height')) ? intval($_POST['network_divmore_height']) : 400);
if($network_divmore_height < 50)
$network_divmore_height = 50;
set_pconfig(local_channel(),'system','network_divmore_height', $network_divmore_height);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}
@ -26,6 +36,19 @@ class Network {
$features = get_module_features($module);
$rpath = (($_GET['rpath']) ? $_GET['rpath'] : '');
$network_divmore_height = [
'network_divmore_height',
t('Max height of content (in pixels)'),
((get_pconfig(local_channel(),'system','network_divmore_height')) ? get_pconfig(local_channel(),'system','network_divmore_height') : 400),
t('Click to expand content exceeding this height')
];
$extra_settings_html = replace_macros(get_markup_template('field_input.tpl'),
[
'$field' => $network_divmore_height
]
);
$tpl = get_markup_template("settings_module.tpl");
$o .= replace_macros($tpl, array(
@ -33,8 +56,9 @@ class Network {
'$action_url' => 'settings/' . $module,
'$form_security_token' => get_form_security_token('settings_' . $module),
'$title' => t('Activity Settings'),
'$features' => process_module_features_get(local_channel(), $features),
'$submit' => t('Submit')
'$features' => process_module_features_get(local_channel(), $features),
'$extra_settings_html' => $extra_settings_html,
'$submit' => t('Submit')
));
return $o;

View File

@ -16,6 +16,10 @@ class Photos {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -16,6 +16,10 @@ class Profiles {
process_module_features_post(local_channel(), $features, $_POST);
build_sync_packet();
if($_POST['rpath'])
goaway($_POST['rpath']);
return;
}

View File

@ -47,7 +47,15 @@ function feature_level($feature,$def) {
function process_module_features_get($uid, $features) {
unset($features[0]);
foreach($features as $f) {
$arr[] = array('feature_' . $f[0],$f[1],((intval(feature_enabled($uid, $f[0]))) ? "1" : ''),$f[2], array(t('Off'),t('On')), (($f[4] === false) ? '' : 'disabled'));
$arr[] = [
'feature_' . $f[0],
$f[1],
((intval(feature_enabled($uid, $f[0]))) ? "1" : ''),
$f[2],
[t('Off'),t('On')],
(($f[4] === false) ? '' : 'disabled'),
$f[5]
];
}
return $arr;
}
@ -61,8 +69,6 @@ function process_module_features_post($uid, $features, $post_arr) {
else
set_pconfig($uid,'feature', $k, '');
}
if($post_arr['rpath'])
goaway($post_arr['rpath']);
}
function get_features($filtered = true, $level = (-1)) {

View File

@ -58,8 +58,6 @@
<div class="section-content-wrapper">
{{include file="field_input.tpl" field=$ajaxint}}
{{include file="field_input.tpl" field=$itemspage}}
{{include file="field_input.tpl" field=$channel_divmore_height}}
{{include file="field_input.tpl" field=$network_divmore_height}}
{{include file="field_checkbox.tpl" field=$nosmile}}
{{include file="field_checkbox.tpl" field=$channel_menu}}
{{include file="field_checkbox.tpl" field=$title_tosource}}

View File

@ -11,6 +11,9 @@
{{foreach $features as $feature}}
{{include file="field_checkbox.tpl" field=$feature}}
{{/foreach}}
{{if $extra_settings_html}}
{{$extra_settings_html}}
{{/if}}
<div class="settings-submit-wrapper" >
<button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
</div>