From f92471951b6bf7f3e11a7c9e584cb6eff5d8c233 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 18 Jan 2009 16:07:31 +0100 Subject: [PATCH] dynamically show new label markers in headlines buffer w/o reload --- functions.php | 4 +++- modules/backend-rpc.php | 22 +++++++++++++++++++++- tt-rss.css | 2 ++ viewfeed.js | 31 ++++++++++++++++++++++++++++++- 4 files changed, 56 insertions(+), 3 deletions(-) diff --git a/functions.php b/functions.php index 1d5210677..984365e73 100644 --- a/functions.php +++ b/functions.php @@ -5019,7 +5019,7 @@ $feed_id = $line["feed_id"]; $labels = get_article_labels($link, $id); - $labels_str = ""; + $labels_str = ""; foreach ($labels as $l) { $labels_str .= ""; } + $labels_str .= ""; + if (count($topmost_article_ids) < 5) { array_push($topmost_article_ids, $id); } diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index 918f8ca90..22a926412 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -450,14 +450,34 @@ $label = label_find_caption($link, $label_id, $_SESSION["uid"]); + print ""; + + print ""; + if ($label) { foreach ($ids as $id) { label_add_article($link, $id, $label, $_SESSION["uid"]); + + print "".$l[1].""; + } + + print "]]>"; + } } - print "OK"; + print ""; + + print ""; + getAllCounters($link, $omode); + print ""; + print ""; return; } diff --git a/tt-rss.css b/tt-rss.css index 69516b8f1..a852121f6 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -1794,6 +1794,8 @@ ul.headlineDropdownMenu ul { border-color : #c0c0c0; border-style : solid; margin-left : -1px; + max-height : 300px; + overflow : auto; } ul.headlineDropdownMenu ul li { diff --git a/viewfeed.js b/viewfeed.js index 8ac79a870..09b149ae8 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -907,7 +907,8 @@ function selectionAssignLabel(id) { new Ajax.Request(query, { onComplete: function(transport) { - viewCurrentFeed(); + show_labels_in_headlines(transport); + all_counters_callback2(transport); } }); } @@ -2008,3 +2009,31 @@ function scrollArticle(offset) { exception_error("scrollArticle", e); } } + +function show_labels_in_headlines(transport) { + try { + if (transport.responseXML) { + var info = transport.responseXML.getElementsByTagName("info-for-headlines")[0]; + + var elems = info.getElementsByTagName("entry"); + + for (var l = 0; l < elems.length; l++) { + var e_id = elems[l].getAttribute("id"); + + if (e_id) { + + var ctr = document.getElementById("HLLCTR-" + e_id); + + if (ctr) { + ctr.innerHTML = elems[l].firstChild.nodeValue; + } + } + + } + + } + } catch (e) { + exception_error("show_labels_in_headlines", e); + + } +}