]> git.wh0rd.org Git - tt-rss.git/commitdiff
make storeInitParam actually work (move back to cookies)
authorAndrew Dolgov <fox@bah.spb.su>
Wed, 21 Mar 2007 15:36:24 +0000 (16:36 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Wed, 21 Mar 2007 15:36:24 +0000 (16:36 +0100)
feedlist.js
functions.js
functions.php
tt-rss.js

index 79a39f347fdb8b87a0e662b2c9f227f9c15152bd..ddf12f2913cc057a90970265c2e8be07e3078026 100644 (file)
@@ -57,11 +57,11 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
                        toolbar_form.query.value = "";
                }
 
-/*             storeInitParam("toolbar_limit", 
+               storeInitParam("toolbar_limit", 
                        toolbar_form.limit[toolbar_form.limit.selectedIndex].value);
 
                storeInitParam("toolbar_view_mode", 
-                       toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value);  */
+                       toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value); 
 
                var query = "backend.php?op=viewfeed&feed=" + feed + "&" +
                        toolbar_query + "&subop=" + param_escape(subop);
index b7e633ea9727b59e6035ee0b58391915b8f1cea3..b6c656b6a2ec8a9c59c72c2d0c78c5d4eab57ee1 100644 (file)
@@ -428,7 +428,7 @@ function setCookie(name, value, lifetime, path, domain, secure) {
        
        if (lifetime) {
                d = new Date();
-               d.setTime(lifetime * 1000);
+               d.setTime(d.getTime() + (lifetime * 1000));
        }
        
        int_setCookie(name, value, d, path, domain, secure);
@@ -1500,9 +1500,31 @@ function debug(msg) {
 }
 
 function getInitParam(key) {
-       return getMainContext().init_params[key];
+       var c = getCookie("TTIP:" + key);
+       if (c) {
+               return c;
+       } else {
+               return getMainContext().init_params[key];
+       }
 }
 
+function storeInitParam(key, value) {
+       try {
+               init_params[key] = value;
+               debug("storeInitParam: " + key + " => " + value + 
+                       " (" + getInitParam("cookie_lifetime") + ")");
+               if (getInitParam("cookie_lifetime") > 0) {
+                       setCookie("TTIP:" + key, value, getInitParam("cookie_lifetime"));
+               } else {
+                       setCookie("TTIP:" + key, value);
+               }
+       } catch (e) {
+               exception_error("storeInitParam", e);
+       }
+}
+
+
+/*
 function storeInitParam(key, value, is_client) {
        try {
                if (!is_client) {
@@ -1519,7 +1541,7 @@ function storeInitParam(key, value, is_client) {
        } catch (e) {
                exception_error("storeInitParam", e);
        }
-}
+} */
 
 /*
 function storeInitParams(params, is_client) {
index 275efb1c755cf51efc52ed67e618bb06f2b72519..05ac12dd304b044a3eaeff8f98246a647ed9750e 100644 (file)
 
                print "<param key=\"icons_url\" value=\"" . ICONS_URL . "\"/>";
 
+               print "<param key=\"cookie_lifetime\" value=\"" . SESSION_COOKIE_LIFETIME . "\"/>";
+
                print "</init-params>";
        }
 
index eefc90e7f4ead282ccbc85dc4347d3e386ba0f80..bc5bc8205c06f36a7c9f87dd283849f35324084c 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -388,8 +388,8 @@ function init_second_stage() {
 
                var tb = parent.document.forms["main_toolbar_form"];
 
-//             dropboxSelect(tb.view_mode, getInitParam("toolbar_view_mode"));
-//             dropboxSelect(tb.limit, getInitParam("toolbar_limit"));
+               dropboxSelect(tb.view_mode, getInitParam("toolbar_view_mode"));
+               dropboxSelect(tb.limit, getInitParam("toolbar_limit"));
 
                daemon_enabled = getInitParam("daemon_enabled") == 1;
                daemon_refresh_only = getInitParam("daemon_refresh_only") == 1;