Browse Source

do not base headlines label context submenu on feed tree labels category

Andrew Dolgov 6 years ago
parent
commit
5e78b0c253
3 changed files with 7 additions and 7 deletions
  1. 1 1
      classes/labels.php
  2. 3 0
      include/functions.php
  3. 3 6
      js/viewfeed.js

+ 1 - 1
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);

+ 3 - 0
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();

+ 3 - 6
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,