From: friendica Date: Wed, 24 Apr 2013 01:58:52 +0000 (-0700) Subject: issue546 via Tobias X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=115c8a53bf89d0a6531bb81d5608f3f9be30fb31;p=friendica.git issue546 via Tobias --- diff --git a/mod/network.php b/mod/network.php index 51f3d22327..624169511a 100644 --- a/mod/network.php +++ b/mod/network.php @@ -740,8 +740,17 @@ function network_content(&$a, $update = 0) { } } - $itemspage_network = get_pconfig(local_user(),'system','itemspage_network'); - $itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 40); + // check if we serve a mobile device and get the user settings + // accordingly + if ($a->is_mobile) { + $itemspage_network = get_pconfig(local_user(),'system','itemspage_mobile_network'); + $itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20); + } else { + $itemspage_network = get_pconfig(local_user(),'system','itemspage_network'); + $itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 40); + } + // now that we have the user settings, see if the theme forces + // a maximum item number which is lower then the user choice if(($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network)) $itemspage_network = $a->force_max_items; diff --git a/mod/profile.php b/mod/profile.php index eea5dc7e4b..a7b576488e 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -258,8 +258,17 @@ function profile_content(&$a, $update = 0) { } } - $itemspage_network = get_pconfig(local_user(),'system','itemspage_network'); - $itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 40); + // check if we serve a mobile device and get the user settings + // accordingly + if ($a->is_mobile) { + $itemspage_network = get_pconfig(local_user(),'system','itemspage_mobile_network'); + $itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20); + } else { + $itemspage_network = get_pconfig(local_user(),'system','itemspage_network'); + $itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 40); + } + // now that we have the user settings, see if the theme forces + // a maximum item number which is lower then the user choice if(($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network)) $itemspage_network = $a->force_max_items; diff --git a/mod/settings.php b/mod/settings.php index ca688d1a9f..f9d5b712ca 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -263,6 +263,9 @@ function settings_post(&$a) { $itemspage_network = ((x($_POST,'itemspage_network')) ? intval($_POST['itemspage_network']) : 40); if($itemspage_network > 100) $itemspage_network = 100; + $itemspage_mobile_network = ((x($_POST,'itemspage_mobile_network')) ? intval($_POST['itemspage_mobile_network']) : 20); + if($itemspage_mobile_network > 100) + $itemspage_mobile_network = 100; if($mobile_theme !== '') { @@ -271,6 +274,7 @@ function settings_post(&$a) { set_pconfig(local_user(),'system','update_interval', $browser_update); set_pconfig(local_user(),'system','itemspage_network', $itemspage_network); + set_pconfig(local_user(),'system','itemspage_mobile_network', $itemspage_mobile_network); set_pconfig(local_user(),'system','no_smilies',$nosmile); @@ -813,6 +817,8 @@ function settings_content(&$a) { $itemspage_network = intval(get_pconfig(local_user(), 'system','itemspage_network')); $itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : 40); // default if not set: 40 items + $itemspage_mobile_network = intval(get_pconfig(local_user(), 'system','itemspage_mobile_network')); + $itemspage_mobile_network = (($itemspage_mobile_network > 0 && $itemspage_mobile_network < 101) ? $itemspage_mobile_network : 20); // default if not set: 20 items $nosmile = get_pconfig(local_user(),'system','no_smilies'); $nosmile = (($nosmile===false)? '0': $nosmile); // default if not set: 0 @@ -836,6 +842,7 @@ function settings_content(&$a) { '$mobile_theme' => array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, false), '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')), '$itemspage_network' => array('itemspage_network', t("Number of items to display per page:"), $itemspage_network, t('Maximum of 100 items')), + '$itemspage_mobile_network' => array('itemspage_mobile_network', t("Number of items to display per page when viewed from mobile device:"), $itemspage_mobile_network, t('Maximum of 100 items')), '$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''), '$theme_config' => $theme_config, diff --git a/view/templates/settings_display.tpl b/view/templates/settings_display.tpl index a8826aada1..9107512965 100644 --- a/view/templates/settings_display.tpl +++ b/view/templates/settings_display.tpl @@ -9,9 +9,10 @@ {{include file="field_themeselect.tpl" field=$theme}} +{{include file="field_input.tpl" field=$itemspage_network}} {{include file="field_themeselect.tpl" field=$mobile_theme}} +{{include file="field_input.tpl" field=$itemspage_mobile_network}} {{include file="field_input.tpl" field=$ajaxint}} -{{include file="field_input.tpl" field=$itemspage_network}} {{include file="field_checkbox.tpl" field=$nosmile}}