]> git.wh0rd.org Git - tt-rss.git/commitdiff
init param API is context-free
authorAndrew Dolgov <fox@madoka.spb.ru>
Tue, 23 May 2006 06:15:49 +0000 (07:15 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Tue, 23 May 2006 06:15:49 +0000 (07:15 +0100)
feedlist.js
functions.js
mobile/login.php
tt-rss.js

index 599c7e7c589abe12b4f595220af6414c6794f92b..6be3816c1531e47a17133bd833f948a3f35530c0 100644 (file)
@@ -45,10 +45,10 @@ function viewfeed(feed, skip, subop, doc, is_cat, subop_param) {
 //             setCookie("ttrss_vf_limit", toolbar_form.limit[toolbar_form.limit.selectedIndex].value);
 //             setCookie("ttrss_vf_vmode", toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value);
 
-               parent.storeInitParam("toolbar_limit", 
+               storeInitParam("toolbar_limit", 
                        toolbar_form.limit[toolbar_form.limit.selectedIndex].value);
 
-               parent.storeInitParam("toolbar_view_mode", 
+               storeInitParam("toolbar_view_mode", 
                        toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value);
 
                var query = "backend.php?op=viewfeed&feed=" + feed + "&" +
index 384f34827c8b20e12c90f6db297ca1c400e6d79b..da5d9514386463f71064acd9fa8efe1abc019989 100644 (file)
@@ -404,18 +404,29 @@ function gotoExportOpml() {
 }
 
 function getActiveFeedId() {
-       return getCookie("ttrss_vf_actfeed");
+//     return getCookie("ttrss_vf_actfeed");
+       try {
+               debug("gAFID: " + getMainContext().active_feed_id);
+               return getMainContext().active_feed_id;
+       } catch (e) {
+               exception_error("getActiveFeedId", e);
+       }
 }
 
 function setActiveFeedId(id) {
-       return setCookie("ttrss_vf_actfeed", id);
+//     return setCookie("ttrss_vf_actfeed", id);
+       try {
+               getMainContext().active_feed_id = id;
+       } catch (e) {
+               exception_error("setActiveFeedId", e);
+       }
 }
 
 var xmlhttp_rpc = Ajax.getTransport();
 
 function parse_counters(reply, scheduled_call) {
        try {
-               var f_document = getMainContext().frames["feeds-frame"].document;
+               var f_document = getFeedsContext().document;
                var title_obj = getMainContext();
 
                debug("F_DOC: " + f_document + ", T_OBJ: " + title_obj);
@@ -511,13 +522,7 @@ function all_counters_callback() {
                                return;
                        }
 
-                       if (!parent.frames["feeds-frame"]) {
-                               notify("[all_counters_callback] no parent feeds-frame");
-                               return;
-                       }
-
                        var reply = xmlhttp_rpc.responseXML.firstChild;
-//                     var f_document = parent.frames["feeds-frame"].document;
 
                        parse_counters(reply);
        
@@ -1030,7 +1035,7 @@ function qafAdd() {
 
        closeInfoBox();
 
-       var feeds_doc = window.frames["feeds-frame"].document;
+       var feeds_doc = getFeedsContext().document;
 
        feeds_doc.location.href = "backend.php?op=error&msg=Loading,%20please wait...";
        
@@ -1064,6 +1069,14 @@ function getMainContext() {
        }
 }
 
+function getFeedsContext() {
+       try {
+               return getMainContext().frames["feeds-frame"];
+       } catch (e) {
+               exception_error("getFeedsContext", e);
+       }
+}
+
 function debug(msg) {
        var ctx = getMainContext();
 
@@ -1080,4 +1093,17 @@ function debug(msg) {
        }
 }
 
+function getInitParam(key) {
+       return getMainContext().init_params[key];
+}
 
+// TODO: batch mode
+function storeInitParam(key, value) {
+       try {
+               getMainContext().init_params[key] = value;
+               new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" + 
+                       param_escape(key) + "&value=" + param_escape(value));           
+       } catch (e) {
+               exception_error("storeInitParam", e);
+       }
+}
index 418a04bd89bb66b71fee8681dd1fb8b02903cc2f..bcf151ee1d0d48e0022cc585f9040b854b482afd 100644 (file)
@@ -47,9 +47,6 @@
                                $_SESSION["cookie_lifetime"] = time() + SESSION_COOKIE_LIFETIME;
                        }
 
-                       setcookie("ttrss_cltime", $_SESSION["cookie_lifetime"], 
-                               $_SESSION["cookie_lifetime"]);
-
                        if (!$return_to) {
                                $return_to = "tt-rss.php";
                        }
index ed6cae91e5f274ae3452aa59d43916081ea53b4a..eefcd95faae6190c1d56fae6faccb36455a2911f 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -10,6 +10,7 @@ var _qfd_deleted_feed = 0;
 var firsttime_update = true;
 var last_refetch = 0;
 var cookie_lifetime = 0;
+var active_feed_id = 0;
 
 var xmlhttp = Ajax.getTransport();
 
@@ -430,8 +431,6 @@ function init_second_stage() {
                cookie_lifetime = getCookie("ttrss_cltime");
 
                delCookie("ttrss_vf_test");
-
-               setCookie("ttrss_vf_actfeed", "");
        
                updateFeedList(false, false);
                document.onkeydown = hotkey_handler;
@@ -594,16 +593,4 @@ function fatalError(code, message) {
        }
 }
 
-function getInitParam(key) {
-       return init_params[key];
-}
 
-function storeInitParam(key, value) {
-       try {
-               init_params[key] = value;
-               new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" + 
-                       param_escape(key) + "&value=" + param_escape(value));           
-       } catch (e) {
-               exception_error("storeInitParam", e);
-       }
-}