diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-10-04 21:38:39 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-10-04 21:38:39 +0200 |
commit | d4af745fc8000be9fcc198d3d0205a6b134e374c (patch) | |
tree | 9f3742fcf21e5d3ba48ec4922de43d07f1e97031 | |
parent | 6e03104e3ee785954b4f755240d1595f702522b2 (diff) | |
download | volse-hubzilla-d4af745fc8000be9fcc198d3d0205a6b134e374c.tar.gz volse-hubzilla-d4af745fc8000be9fcc198d3d0205a6b134e374c.tar.bz2 volse-hubzilla-d4af745fc8000be9fcc198d3d0205a6b134e374c.zip |
move *_divmore_height setting to the module extra_settings, and fix issue where feature settings were not synced if rpath was provided
-rw-r--r-- | Zotlabs/Module/Settings/Calendar.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Channel_home.php | 25 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Connections.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Directory.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Display.php | 11 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Editor.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Events.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Manage.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Network.php | 28 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Photos.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Profiles.php | 4 | ||||
-rw-r--r-- | include/features.php | 12 | ||||
-rwxr-xr-x | view/tpl/settings_display.tpl | 2 | ||||
-rwxr-xr-x | view/tpl/settings_module.tpl | 3 |
14 files changed, 95 insertions, 18 deletions
diff --git a/Zotlabs/Module/Settings/Calendar.php b/Zotlabs/Module/Settings/Calendar.php index b3a611cdf..a27bf0fa5 100644 --- a/Zotlabs/Module/Settings/Calendar.php +++ b/Zotlabs/Module/Settings/Calendar.php @@ -16,6 +16,10 @@ class Calendar { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } diff --git a/Zotlabs/Module/Settings/Channel_home.php b/Zotlabs/Module/Settings/Channel_home.php index 1d1cc370b..23c7ee1ab 100644 --- a/Zotlabs/Module/Settings/Channel_home.php +++ b/Zotlabs/Module/Settings/Channel_home.php @@ -14,8 +14,18 @@ class Channel_home { $features = get_module_features($module); 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') )); diff --git a/Zotlabs/Module/Settings/Connections.php b/Zotlabs/Module/Settings/Connections.php index 70b4daa42..cac357791 100644 --- a/Zotlabs/Module/Settings/Connections.php +++ b/Zotlabs/Module/Settings/Connections.php @@ -16,6 +16,10 @@ class Connections { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } diff --git a/Zotlabs/Module/Settings/Directory.php b/Zotlabs/Module/Settings/Directory.php index 6e24a2cfa..13fe6eb79 100644 --- a/Zotlabs/Module/Settings/Directory.php +++ b/Zotlabs/Module/Settings/Directory.php @@ -16,6 +16,10 @@ class Directory { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index b4f8928e0..45d80e011 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -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] )); diff --git a/Zotlabs/Module/Settings/Editor.php b/Zotlabs/Module/Settings/Editor.php index 93e3ce602..5e7a9473a 100644 --- a/Zotlabs/Module/Settings/Editor.php +++ b/Zotlabs/Module/Settings/Editor.php @@ -16,6 +16,10 @@ class Editor { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } diff --git a/Zotlabs/Module/Settings/Events.php b/Zotlabs/Module/Settings/Events.php index fcb4441e1..eb6dda99b 100644 --- a/Zotlabs/Module/Settings/Events.php +++ b/Zotlabs/Module/Settings/Events.php @@ -16,6 +16,10 @@ class Events { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } diff --git a/Zotlabs/Module/Settings/Manage.php b/Zotlabs/Module/Settings/Manage.php index 15d3216e9..9bae12022 100644 --- a/Zotlabs/Module/Settings/Manage.php +++ b/Zotlabs/Module/Settings/Manage.php @@ -16,6 +16,10 @@ class Manage { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } diff --git a/Zotlabs/Module/Settings/Network.php b/Zotlabs/Module/Settings/Network.php index c51b780f1..aaafe9255 100644 --- a/Zotlabs/Module/Settings/Network.php +++ b/Zotlabs/Module/Settings/Network.php @@ -14,8 +14,18 @@ class Network { $features = get_module_features($module); 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; diff --git a/Zotlabs/Module/Settings/Photos.php b/Zotlabs/Module/Settings/Photos.php index f403b4d38..9edbaa929 100644 --- a/Zotlabs/Module/Settings/Photos.php +++ b/Zotlabs/Module/Settings/Photos.php @@ -16,6 +16,10 @@ class Photos { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } diff --git a/Zotlabs/Module/Settings/Profiles.php b/Zotlabs/Module/Settings/Profiles.php index 78dc0160e..2dc037317 100644 --- a/Zotlabs/Module/Settings/Profiles.php +++ b/Zotlabs/Module/Settings/Profiles.php @@ -16,6 +16,10 @@ class Profiles { process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); + + if($_POST['rpath']) + goaway($_POST['rpath']); + return; } diff --git a/include/features.php b/include/features.php index fc4877424..05ce3db32 100644 --- a/include/features.php +++ b/include/features.php @@ -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)) { diff --git a/view/tpl/settings_display.tpl b/view/tpl/settings_display.tpl index 8267ab27c..c93efb4aa 100755 --- a/view/tpl/settings_display.tpl +++ b/view/tpl/settings_display.tpl @@ -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}} diff --git a/view/tpl/settings_module.tpl b/view/tpl/settings_module.tpl index a701ec364..03d16d1d7 100755 --- a/view/tpl/settings_module.tpl +++ b/view/tpl/settings_module.tpl @@ -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> |