change include_children to a togglebutton; add placeholder setting save in a session
This commit is contained in:
parent
09101297ee
commit
854a2ace86
|
@ -764,7 +764,7 @@ class Feeds extends Protected_Handler {
|
|||
@$offset = db_escape_string($_REQUEST["skip"]);
|
||||
@$vgroup_last_feed = db_escape_string($_REQUEST["vgrlf"]);
|
||||
$order_by = db_escape_string($_REQUEST["order_by"]);
|
||||
$include_children = $_REQUEST["include_children"] == "on";
|
||||
$include_children = $_REQUEST["include_children"] == "true";
|
||||
|
||||
if (is_numeric($feed)) $feed = (int) $feed;
|
||||
|
||||
|
@ -806,6 +806,8 @@ class Feeds extends Protected_Handler {
|
|||
set_pref($this->link, "_DEFAULT_VIEW_LIMIT", $limit);
|
||||
set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);
|
||||
|
||||
$_SESSION["_DEFAULT_INCLUDE_CHILDREN"] = $include_children;
|
||||
|
||||
if (!$cat_view && preg_match("/^[0-9][0-9]*$/", $feed)) {
|
||||
db_query($this->link, "UPDATE ttrss_feeds SET last_viewed = NOW()
|
||||
WHERE id = '$feed' AND owner_uid = ".$_SESSION["uid"]);
|
||||
|
|
|
@ -2137,6 +2137,7 @@
|
|||
|
||||
$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");
|
||||
|
|
|
@ -185,11 +185,16 @@
|
|||
|
||||
|
||||
|
||||
<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()">
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
18
js/tt-rss.js
18
js/tt-rss.js
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue