From 5e78b0c253d56d85b0339636c8793f93c835b792 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 30 Jul 2017 11:55:30 +0300 Subject: [PATCH] do not base headlines label context submenu on feed tree labels category --- classes/labels.php | 2 +- include/functions.php | 3 +++ js/viewfeed.js | 9 +++------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/classes/labels.php b/classes/labels.php index 2ca623a32..e19a2967e 100644 --- a/classes/labels.php +++ b/classes/labels.php @@ -36,7 +36,7 @@ class Labels static function get_all_labels($owner_uid) { $rv = array(); - $result = db_query("SELECT fg_color, bg_color, caption FROM ttrss_labels2 WHERE owner_uid = " . $owner_uid); + $result = db_query("SELECT id, fg_color, bg_color, caption FROM ttrss_labels2 WHERE owner_uid = " . $owner_uid); while ($line = db_fetch_assoc($result)) { array_push($rv, $line); diff --git a/include/functions.php b/include/functions.php index ba5a699b9..dc2e9f64d 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1123,6 +1123,8 @@ $params["icon_cross"] = base64_img("images/cross.png"); $params["icon_indicator_white"] = base64_img("images/indicator_white.gif"); + $params["labels"] = Labels::get_all_labels($_SESSION["uid"]); + return $params; } @@ -1320,6 +1322,7 @@ $data['dep_ts'] = calculate_dep_timestamp(); $data['reload_on_ts_change'] = !defined('_NO_RELOAD_ON_TS_CHANGE'); + $data["labels"] = Labels::get_all_labels($_SESSION["uid"]); if (CHECK_FOR_UPDATES && !$disable_update_check && $_SESSION["last_version_check"] + 86400 + rand(-1000, 1000) < time()) { $update_result = @check_for_update(); diff --git a/js/viewfeed.js b/js/viewfeed.js index 3e2f97751..6a1e15c33 100755 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -1738,7 +1738,7 @@ function headlinesMenuCommon(menu) { })); - var labels = dijit.byId("feedTree").model.getItemsInCategory(-2); + var labels = getInitParam("labels"); if (labels) { @@ -1748,11 +1748,8 @@ function headlinesMenuCommon(menu) { var labelDelMenu = new dijit.Menu({ownerMenu: menu}); labels.each(function (label) { - var id = label.id[0]; - var bare_id = id.substr(id.indexOf(":") + 1); - var name = label.name[0]; - - bare_id = feed_to_label_id(bare_id); + var bare_id = label.id; + var name = label.caption; labelAddMenu.addChild(new dijit.MenuItem({ label: name,