\r
private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view,\r
$next_unread_feed, $offset, $vgr_last_feed = false,\r
- $override_order = false) {\r
+ $override_order = false, $include_children = false) {\r
\r
$disable_cache = false;\r
\r
}\r
// error_log("search_mode: " . $search_mode);\r
$qfh_ret = queryFeedHeadlines($this->link, $feed, $limit, $view_mode, $cat_view,\r
- $search, $search_mode, $match_on, $override_order, $offset);\r
+ $search, $search_mode, $match_on, $override_order, $offset, 0,\r
+ false, 0, $include_children);\r
\r
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H1", $timing_info);\r
\r
$method = db_escape_string($_REQUEST["m"]);\r
$view_mode = db_escape_string($_REQUEST["view_mode"]);\r
$limit = (int) get_pref($this->link, "DEFAULT_ARTICLE_LIMIT");\r
- @$cat_view = db_escape_string($_REQUEST["cat"]) == "true";\r
+ @$cat_view = $_REQUEST["cat"] == "true";\r
@$next_unread_feed = db_escape_string($_REQUEST["nuf"]);\r
@$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
\r
if (is_numeric($feed)) $feed = (int) $feed;\r
\r
\r
$ret = $this->format_headlines_list($feed, $method,\r
$view_mode, $limit, $cat_view, $next_unread_feed, $offset,\r
- $vgroup_last_feed, $override_order);\r
+ $vgroup_last_feed, $override_order, $include_children);\r
\r
$topmost_article_ids = $ret[0];\r
$headlines_count = $ret[1];\r
return $rv;
}
- function queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view, $search, $search_mode, $match_on, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0) {
+ function queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view, $search, $search_mode, $match_on, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false) {
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
} else if ($feed != -1) {
$unread = getFeedUnread($link, $feed, $cat_view);
- if ($cat_view && $feed > 0)
+ if ($cat_view && $feed > 0 && $include_children)
$unread += getCategoryChildrenUnread($link, $feed);
if ($unread > 0) {
if ($cat_view) {
if ($feed > 0) {
- # sub-cats
- $subcats = getChildCategories($link, $feed, $owner_uid);
-
- if (count($subcats) == 0) {
- $query_strategy_part = "cat_id = '$feed'";
+ if ($include_children) {
+ # sub-cats
+ $subcats = getChildCategories($link, $feed, $owner_uid);
+
+ if (count($subcats) == 0) {
+ $query_strategy_part = "cat_id = '$feed'";
+ } else {
+ array_push($subcats, $feed);
+ $query_strategy_part = "cat_id IN (".
+ implode(",", $subcats).")";
+ }
} else {
- array_push($subcats, $feed);
- $query_strategy_part = "cat_id IN (".
- implode(",", $subcats).")";
+ $query_strategy_part = "cat_id = '$feed'";
}
} else {
<option value="score"><?php echo __('Score') ?></option>
</select>
+
+
+ <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>
+
<button dojoType="dijit.form.Button" name="update"
onclick="scheduleFeedUpdate()">
<?php echo __('Update') ?></button>
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");
+ }
+
} catch (e) {
exception_error("setActiveFeedId", e);
}