]> git.wh0rd.org - tt-rss.git/blobdiff - functions.php
rework label editor to use dijit.form validation
[tt-rss.git] / functions.php
index 1d1b2440d6b59791f05d252415bcfd21cc84e3d1..fe42ea43bc7cc181202e96b70fc1a33b38f17940 100644 (file)
                                "</option>";
 
 #                      print "<optgroup label=\"".__("Assign label:")."\">";
-                       print "<option>----------</option>";
-
-                       print_labels_headlines_dropdown($link, $feed_id);
+                       //print "<option>----------</option>";
+                       //print_labels_headlines_dropdown($link, $feed_id);
 
                        print "<option>----------</option>";
 
                                $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
                        }
                }
-
        
 /*             if (get_pref($link, 'ENABLE_FEED_CATS')) {
                        if (get_pref($link, "FEEDS_SORT_BY_UNREAD")) {
                        }
                } */
 
+               /* real feeds */
+
                if ($enable_cats)
                        $order_by_qpart = "ttrss_feed_categories.order_id,category,
                                ttrss_feeds.order_id,title";
 
                $actid = $_REQUEST["actid"];
 
-               /* real feeds */
-
-               $category = "";
-
-               if (!$enable_cats) 
-                       $cat['items'] = array();
-               else
-                       $cat = false;
+               if (db_num_rows($result) > 0) {
 
-               while ($line = db_fetch_assoc($result)) {
+                       $category = "";
+       
+                       if (!$enable_cats) 
+                               $cat['items'] = array();
+                       else
+                               $cat = false;
+       
+                       while ($line = db_fetch_assoc($result)) {
+                       
+                               $feed = htmlspecialchars(trim($line["title"]));
+       
+                               if (!$feed) $feed = "[Untitled]";
+       
+                               $feed_id = $line["id"];   
+                               $unread = $line["unread"];
+       
+                               $cat_id = $line["cat_id"];
+                               $tmp_category = $line["category"];
+                               if (!$tmp_category) $tmp_category = __("Uncategorized");
+       
+                               if ($category != $tmp_category && $enable_cats) {
                
-                       $feed = htmlspecialchars(trim($line["title"]));
-
-                       if (!$feed) $feed = "[Untitled]";
-
-                       $feed_id = $line["id"];   
-                       $unread = $line["unread"];
-
-                       $cat_id = $line["cat_id"];
-                       $tmp_category = $line["category"];
-                       if (!$tmp_category) $tmp_category = __("Uncategorized");
-
-                       if ($category != $tmp_category && $enable_cats) {
+                                       $category = $tmp_category;
        
-                               $category = $tmp_category;
-
-                               $collapsed = sql_bool_to_bool($line["collapsed"]);
-
-                               // workaround for NULL category
-                               if ($category == __("Uncategorized")) {
-                                       $collapsed = get_pref($link, "_COLLAPSED_UNCAT");
+                                       $collapsed = sql_bool_to_bool($line["collapsed"]);
+       
+                                       // workaround for NULL category
+                                       if ($category == __("Uncategorized")) {
+                                               $collapsed = get_pref($link, "_COLLAPSED_UNCAT");
+                                       }
+       
+                                       if ($cat) array_push($feedlist['items'], $cat);
+       
+                                       $cat = feedlist_init_cat($link, $cat_id, $collapsed);
                                }
-
-                               if ($cat) array_push($feedlist['items'], $cat);
-
-                               $cat = feedlist_init_cat($link, $cat_id, $collapsed);
+       
+                               $updated = make_local_datetime($link, $line["updated_noms"], false);    
+       
+                               array_push($cat['items'], feedlist_init_feed($link, $feed_id, 
+                                       $feed, $unread, $line['last_error'], $updated));
+                       }
+       
+                       if ($enable_cats) {
+                               array_push($feedlist['items'], $cat);
+                       } else { 
+                               $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
                        }
 
-                       $updated = make_local_datetime($link, $line["updated_noms"], false);    
-
-                       array_push($cat['items'], feedlist_init_feed($link, $feed_id, 
-                               $feed, $unread, $line['last_error'], $updated));
-               }
-
-               if ($enable_cats) {
-                       array_push($feedlist['items'], $cat);
-               } else { 
-                       $feedlist['items'] = array_merge($feedlist['items'], $cat['items']);
                }
 
                return $feedlist;
                                truncate_string(strip_tags($line['title']), 15) . "</div>";
 
                        print "<div class=\"postReply\" id=\"POST-$id\">";
-                       print "<div 
-                               onclick=\"return postClicked(event, $id)\"
-                               class=\"postHeader\">";
+
+                       print "<div dojoType=\"dijit.Menu\" style=\"display: none;\" 
+                               targetNodeIds=\"POSTHDR-$id\">";
+                       print "<div onclick=\"postOpenInNewTab(event, $id)\" 
+                               dojoType=\"dijit.MenuItem\">".__('View in a new tab')."</div>";
+                       print "<div dojoType=\"dijit.MenuSeparator\"></div>";
+                       print "<div onclick=\"openArticleInNewWindow($id)\" 
+                               dojoType=\"dijit.MenuItem\">".__('Open original article')."</div>";
+                       print "</div>";
+
+                       print "<div onclick=\"return postClicked(event, $id)\"
+                               class=\"postHeader\" id=\"POSTHDR-$id\">";
 
                        $entry_author = $line["author"];
 
 
                                print "<img src=\"".theme_image($link, 'images/art-zoom.png')."\" 
                                                class='tagsPic' style=\"cursor : pointer\"
-                                               onclick=\"zoomToArticle(event, $id)\"
+                                               onclick=\"postOpenInNewTab(event, $id)\"
                                                alt='Zoom' title='".__('Open article in new tab')."'>";
 
                                $note_escaped = htmlspecialchars($line['note'], ENT_QUOTES);
 
                                        print "</div>";
 
+
+
                                        print "<div class=\"hlRight\">";                                        
                                        print "<span class=\"hlUpdated\">$updated_fmt</span>";
                                        print $score_pic;
                                                onclick=\"return cdmClicked(event, $id);\"
                                                class=\"titleWrap$hlc_suffix\">
                                                <a class=\"title\"
-                                               target=\"_blank\" href=\"".$line["link"]."\">".$line["title"]."</a>
-                                               $entry_author";
+                                               target=\"_blank\" href=\"".$line["link"]."\">".$line["title"].
+                                               " $entry_author</a>";
 
                                        print $labels_str;
 
                if (!$title) 
                        $title = getFeedTitle($link, $feed_id, false);
 
-               if (!$unread)
+               if ($unread === false)
                        $unread = getFeedUnread($link, $feed_id, false);
 
                $obj['id'] = 'FEED:' . $feed_id;