]> git.wh0rd.org Git - tt-rss.git/commitdiff
move labels subtoolbar section into a function
authorAndrew Dolgov <fox@bah.spb.su>
Fri, 23 Jan 2009 06:39:29 +0000 (07:39 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Fri, 23 Jan 2009 06:39:29 +0000 (07:39 +0100)
functions.php

index 23144f535b12ad4b59aa66a96c39e15b8688e17b..0fb1fc287dd0906184c68ac555f928cfa49f0084 100644 (file)
                        //print "<li><span class=\"insensitive\">--------</span></li>";
                        print "<li class=\"insensitive\">".__('Assign label:')."</li>";
 
-                       print "<li onclick=\"javascript:addLabel()\">
-                               &nbsp;&nbsp;".__("Create label...")."</li>";
-
-                       $result = db_query($link, "SELECT id, caption FROM ttrss_labels2 WHERE
-                               owner_uid = '".$_SESSION["uid"]."' ORDER BY caption");
-
-                       while ($line = db_fetch_assoc($result)) {
-
-                               $label_id = $line["id"];
-                               $label_caption = $line["caption"];
-
-                               if ($feed_id < -10 && $feed_id == -11-$label_id) {
-                                       print "<li onclick=\"javascript:selectionRemoveLabel($label_id)\">
-                                               &nbsp;&nbsp;$label_caption ".__('(remove)')."</li>";
-                               } else {                                        
-                                       print "<li onclick=\"javascript:selectionAssignLabel($label_id)\">
-                                               &nbsp;&nbsp;$label_caption</li>";
-                               }
-                       }
+                       print_labels_headlines_dropdown($link, $feed_id);
 
                        print "</ul>";
                        print "</td>"; 
 
                db_query($link, "COMMIT");
        }
+
+       function print_labels_headlines_dropdown($link, $feed_id) {
+               print "<li onclick=\"javascript:addLabel()\">
+                       &nbsp;&nbsp;".__("Create label...")."</li>";
+
+               $result = db_query($link, "SELECT id, caption FROM ttrss_labels2 WHERE
+                       owner_uid = '".$_SESSION["uid"]."' ORDER BY caption");
+
+               while ($line = db_fetch_assoc($result)) {
+
+                       $label_id = $line["id"];
+                       $label_caption = $line["caption"];
+
+                       if ($feed_id < -10 && $feed_id == -11-$label_id) {
+                               print "<li id=\"LHDL-$id\" 
+                                       onclick=\"javascript:selectionRemoveLabel($label_id)\">
+                                       &nbsp;&nbsp;$label_caption ".__('(remove)')."</li>";
+                       } else {                                        
+                               print "<li id=\"LHDL-$id\" 
+                                       onclick=\"javascript:selectionAssignLabel($label_id)\">
+                                       &nbsp;&nbsp;$label_caption</li>";
+                       }
+               }
+       }
 ?>