]> git.wh0rd.org Git - tt-rss.git/commitdiff
change include_children to a togglebutton; add placeholder setting save in a session
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 13 Aug 2012 17:39:40 +0000 (21:39 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 13 Aug 2012 17:39:40 +0000 (21:39 +0400)
classes/feeds.php
include/functions.php
index.php
js/feedlist.js
js/tt-rss.js

index 502efd40142dcaac0cb34ec731cbae7dffeb6d0e..be7886472a5a9d163cccb3af432f7ba78048afa8 100644 (file)
@@ -764,7 +764,7 @@ class Feeds extends Protected_Handler {
                @$offset = db_escape_string($_REQUEST["skip"]);\r
                @$vgroup_last_feed = db_escape_string($_REQUEST["vgrlf"]);\r
                $order_by = db_escape_string($_REQUEST["order_by"]);\r
-               $include_children = $_REQUEST["include_children"] == "on";\r
+               $include_children = $_REQUEST["include_children"] == "true";\r
 \r
                if (is_numeric($feed)) $feed = (int) $feed;\r
 \r
@@ -806,6 +806,8 @@ class Feeds extends Protected_Handler {
                set_pref($this->link, "_DEFAULT_VIEW_LIMIT", $limit);\r
                set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);\r
 \r
+               $_SESSION["_DEFAULT_INCLUDE_CHILDREN"] = $include_children;\r
+\r
                if (!$cat_view && preg_match("/^[0-9][0-9]*$/", $feed)) {\r
                        db_query($this->link, "UPDATE ttrss_feeds SET last_viewed = NOW()\r
                                                        WHERE id = '$feed' AND owner_uid = ".$_SESSION["uid"]);\r
index 3cb503fd865861d7c51d0b9c301390764427b5a5..cb24cb877782066a87466ac4e8dff28fc0da10b4 100644 (file)
 
                $params["icons_url"] = ICONS_URL;
                $params["cookie_lifetime"] = SESSION_COOKIE_LIFETIME;
+               $params["default_include_children"] = $_SESSION["_DEFAULT_INCLUDE_CHILDREN"];
                $params["default_view_mode"] = get_pref($link, "_DEFAULT_VIEW_MODE");
                $params["default_view_limit"] = (int) get_pref($link, "_DEFAULT_VIEW_LIMIT");
                $params["default_view_order_by"] = get_pref($link, "_DEFAULT_VIEW_ORDER_BY");
index 96d13558d1f9e678eadc0296a31f43a452890441..3a68c90f67b202d1f68af8e814e8e5fa476f2041 100644 (file)
--- a/index.php
+++ b/index.php
 
                &nbsp;
 
-               <input dojoType="dijit.form.CheckBox" type="checkbox"
+               <!-- <input dojoType="dijit.form.CheckBox" type="checkbox"
                        onchange="viewCurrentFeed()"
                        name="include_children" id="include_children">
                <label id="include_children_label" for="include_children">
-                       <?php echo __('With subcategories') ?></label>
+                       <?php echo __('With subcategories') ?></label> -->
+
+               <button dojoType="dijit.form.ToggleButton" name="include_children"
+                       id="include_children"
+                       onchange="viewCurrentFeed()">
+                       <?php echo __('With subcategories') ?></button>
 
                <button dojoType="dijit.form.Button" name="update"
                        onclick="scheduleFeedUpdate()">
index 18d4a97704e7fc47031618e5636940d6a94c523c..aef4bbe1677508f823bcd9ea866e8c1c98efbf52 100644 (file)
@@ -170,6 +170,7 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req) {
                }
 
                query += "&cat=" + is_cat;
+               query += "&include_children=" + dijit.byId("include_children").attr("checked");
 
                console.log(query);
 
index 11d5ef9c1b1ac055a2b8255794652f63abb27e71..8a82e4c7d03f61d589efc2af9d3c747b0a19d674 100644 (file)
@@ -42,13 +42,8 @@ function setActiveFeedId(id, is_cat) {
 
                selectFeed(id, is_cat);
 
-               if (is_cat && id > 0) {
-                       document.forms["main_toolbar_form"].include_children.disabled = false;
-                       $("include_children_label").removeClassName("insensitive");
-               } else {
-                       document.forms["main_toolbar_form"].include_children.disabled = true;
-                       $("include_children_label").addClassName("insensitive");
-               }
+               dijit.byId("include_children").attr("disabled", !(is_cat && id > 0));
+
 
        } catch (e) {
                exception_error("setActiveFeedId", e);
@@ -74,7 +69,7 @@ function updateFeedList() {
                var treeModel = new fox.FeedStoreModel({
                        store: store,
                        query: {
-                               "type": init_params['enable_feed_cats'] == 1 ? "category" : "feed"
+                               "type": getInitParam('enable_feed_cats') == 1 ? "category" : "feed"
                        },
                        rootId: "root",
                        rootLabel: "Feeds",
@@ -334,6 +329,13 @@ function init_second_stage() {
                dijit.getEnclosingWidget(toolbar.order_by).attr('value',
                        getInitParam("default_view_order_by"));
 
+
+               if (getInitParam("enable_feed_cats") == 0)
+                       Element.hide(dijit.byId("include_children").domNode);
+
+               dijit.byId("include_children").attr("checked",
+                       getInitParam("default_include_children"));
+
                feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1;
 
                loading_set_progress(30);