]> git.mxchange.org Git - friendica.git/commitdiff
system support for personal configurable ajax update interval
authorfriendica <info@friendica.com>
Mon, 12 Dec 2011 04:32:43 +0000 (20:32 -0800)
committerfriendica <info@friendica.com>
Mon, 12 Dec 2011 04:32:43 +0000 (20:32 -0800)
boot.php
index.php
js/main.js
view/head.tpl

index 8452108ff1f5224d67bb121b8a918f83601a9bb4..60cdd326a4740520d38efdd2ba2e15c509933c46 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -422,6 +422,10 @@ class App {
        } 
 
        function init_pagehead() {
+               $interval = ((local_user()) ? get_pconfig(local_user(),'system','update_interval') : 30000);
+               if($interval < 10000)
+                       $interval = 30000;
+
                $this->page['title'] = $this->config['sitename'];
                $tpl = file_get_contents('view/head.tpl');
                $this->page['htmlhead'] = replace_macros($tpl,array(
@@ -430,7 +434,8 @@ class App {
                        '$delitem' => t('Delete this item?'),
                        '$comment' => t('Comment'),
                        '$showmore' => t('show more'),
-                       '$showfewer' => t('show fewer')
+                       '$showfewer' => t('show fewer'),
+                       '$update_interval' => $interval
                ));
        }
 
index e43d7332de65c1eba55eb66e0fc5a193eaab4a19..5f6d74adb9be383a62e917542f1103f186273d81 100644 (file)
--- a/index.php
+++ b/index.php
@@ -93,12 +93,6 @@ if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
        load_translation_table($lang);
 }
 
-/*
- * Create the page head after setting the language
- *
- */
-
-$a->init_pagehead();
 
 /**
  *
@@ -119,6 +113,16 @@ if((x($_SESSION,'authenticated')) || (x($_POST,'auth-params')) || ($a->module ==
 if(! x($_SESSION,'authenticated'))
        header('X-Account-Management-Status: none');
 
+
+/*
+ * Create the page head after setting the language
+ * and getting any auth credentials
+ */
+
+$a->init_pagehead();
+
+
+
 if(! x($_SESSION,'sysmsg'))
        $_SESSION['sysmsg'] = array();
 
index 829af2258f03bae1591be2f09f431e48f9664534..3428886e70cc59072d40d3fdd283f5040eb22c5e 100644 (file)
                                });
                        }) ;
                }
-               timer = setTimeout(NavUpdate,30000);
+               timer = setTimeout(NavUpdate,updateInterval);
        }
 
        function liveUpdate() {
index 055c3cef58e325be076cb6b936dc5f58e1b1a9b3..9fe5a63b3b0ac24d78bb02010ef5e49f48c6035a 100644 (file)
@@ -28,6 +28,8 @@
 <script type="text/javascript" src="$baseurl/js/main.js" ></script>
 <script>
 
+       var updateInterval = $update_interval;
+
        function confirmDelete() { return confirm("$delitem"); }
        function commentOpen(obj,id) {
                if(obj.value == '$comment') {