]> git.mxchange.org Git - friendica.git/commitdiff
issue546 via Tobias
authorfriendica <info@friendica.com>
Wed, 24 Apr 2013 01:58:52 +0000 (18:58 -0700)
committerfriendica <info@friendica.com>
Wed, 24 Apr 2013 01:58:52 +0000 (18:58 -0700)
mod/network.php
mod/profile.php
mod/settings.php
view/templates/settings_display.tpl

index 51f3d22327b160b3f6f1908a21598c32ad30c1d0..624169511a06a5c6e702bf4a37dcd6367a9df1ec 100644 (file)
@@ -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;
 
index eea5dc7e4b555bf558d7a3c77f7c10d3b05e894b..a7b576488e975429513ba5bcca4d1bb446d69d55 100644 (file)
@@ -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;
 
index ca688d1a9fefabc9c8618ec568d1a91e00c80982..f9d5b712ca016e9fab6cd50f2ed0c666524495a7 100644 (file)
@@ -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,
index a8826aada147898b7636ed4034b524a79e0b0278..91075129659a09f6ac01e1b5cec48f8a98935ce7 100644 (file)
@@ -9,9 +9,10 @@
 <input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
 
 {{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}}