]> git.wh0rd.org - tt-rss.git/commitdiff
dynamically show new label markers in headlines buffer w/o reload
authorAndrew Dolgov <fox@bah.spb.su>
Sun, 18 Jan 2009 15:07:31 +0000 (16:07 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sun, 18 Jan 2009 15:07:31 +0000 (16:07 +0100)
functions.php
modules/backend-rpc.php
tt-rss.css
viewfeed.js

index 1d5210677d7bd3e4dfb24ad49ed94e926b7aea87..984365e73200fa4daf0712b18c790dfb4f33593c 100644 (file)
                                $feed_id = $line["feed_id"];
 
                                $labels = get_article_labels($link, $id);
-                               $labels_str = "";
+                               $labels_str = "<span id=\"HLLCTR-$id\">";
 
                                foreach ($labels as $l) {
                                        $labels_str .= "<span 
                                                $l[1]."</span>";
                                }
 
+                               $labels_str .= "</span>";
+
                                if (count($topmost_article_ids) < 5) {
                                        array_push($topmost_article_ids, $id);
                                }
index 918f8ca9084c6248c79b00eefc3bb43de2c12549..22a926412fb1b8559d809fc12653d227f54b6511 100644 (file)
 
                        $label = label_find_caption($link, $label_id, $_SESSION["uid"]);
 
+                       print "<rpc-reply>";                    
+
+                       print "<info-for-headlines>";
+
                        if ($label) {
 
                                foreach ($ids as $id) {
                                        label_add_article($link, $id, $label, $_SESSION["uid"]);
+
+                                       print "<entry id=\"$id\"><![CDATA[";
+
+                                       $labels = get_article_labels($link, $id, $_SESSION["uid"]);
+
+                                       foreach ($labels as $l) {
+                                               print  "<span class='hlLabelRef'>".$l[1]."</span>";
+                                       }
+
+                                       print "]]></entry>";
+
                                }
                        }
 
-                       print "<rpc-reply>OK</rpc-reply>";
+                       print "</info-for-headlines>";
+
+                       print "<counters>";
+                       getAllCounters($link, $omode);
+                       print "</counters>";
+                       print "</rpc-reply>";
 
                        return;
                }
index 69516b8f1ca5dd954908d15ff53c0675366c9d12..a852121f6bbd66fbba92c656ef48db76dc4b555e 100644 (file)
@@ -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 {
index 8ac79a870ad15d7b57137d180fb779a27fd1d166..09b149ae8d32290f36721d0c84135d67aedeff00 100644 (file)
@@ -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);
+
+       }
+}