]> git.wh0rd.org - tt-rss.git/blobdiff - classes/feeds.php
add a %d articles selected element
[tt-rss.git] / classes / feeds.php
index d2df9410813feaf05a75c96a461ff13066cc3bfa..c7b7a83e6acefe67d7e08221ec8fa2a0f792fe93 100644 (file)
@@ -9,18 +9,6 @@ class Feeds extends Handler_Protected {
                return array_search($method, $csrf_ignored) !== false;
        }
 
-       private function make_gradient($end, $class) {
-               $start = $class == "even" ? "#f0f0f0" : "#ffffff";
-
-               return "style='background: linear-gradient(left , $start 6%, $end 100%);
-                       background: -o-linear-gradient(left , $start 6%, $end 100%);
-                       background: -moz-linear-gradient(left , $start 6%, $end 100%);
-                       background: -webkit-linear-gradient(left , $start 6%, $end 100%);
-                       background: -ms-linear-gradient(left , $start 6%, $end 100%);
-                       background: -webkit-gradient(linear, left top, right top,
-                               color-stop(0.06, $start), color-stop(1, $end));'";
-       }
-
        private function format_headline_subtoolbar($feed_site_url, $feed_title,
                        $feed_id, $is_cat, $search,
                        $search_mode, $view_mode, $error) {
@@ -61,6 +49,7 @@ class Feeds extends Handler_Protected {
                // right part
 
                $reply .= "<span class='r'>";
+               $reply .= "<span id='selected_prompt'></span>";
                $reply .= "<span id='feed_title'>";
 
                if ($feed_site_url) {
@@ -143,6 +132,10 @@ class Feeds extends Handler_Protected {
 
                //$reply .= "</h2";
 
+               foreach ($pluginhost->get_hooks($pluginhost::HOOK_HEADLINE_TOOLBAR_BUTTON) as $p) {
+                        echo $p->hook_headline_toolbar_button($feed_id, $is_cat);
+               }
+
                return $reply;
        }
 
@@ -300,7 +293,6 @@ class Feeds extends Handler_Protected {
                                $feed_id = $line["feed_id"];
                                $label_cache = $line["label_cache"];
                                $labels = false;
-                               $label_row_style = "";
 
                                if ($label_cache) {
                                        $label_cache = json_decode($label_cache, true);
@@ -315,22 +307,6 @@ class Feeds extends Handler_Protected {
 
                                if (!is_array($labels)) $labels = get_article_labels($this->link, $id);
 
-                               if (count($labels) > 0) {
-                                       for ($i = 0; $i < min(4, count($labels)); $i++) {
-                                               $bg = rgb2hsl(_color_unpack($labels[$i][3]));
-
-                                               if ($bg && $bg[1] > 0) {
-                                                       $bg[1] = 0.1;
-                                                       $bg[2] = 1;
-
-                                                       $bg = _color_pack(hsl2rgb($bg));
-                                                       $label_row_style = $this->make_gradient($bg, $class);;
-
-                                                       break;
-                                               }
-                                       }
-                               }
-
                                $labels_str = "<span id=\"HLLCTR-$id\">";
                                $labels_str .= format_article_labels($labels, $id);
                                $labels_str .= "</span>";
@@ -339,34 +315,33 @@ class Feeds extends Handler_Protected {
                                        array_push($topmost_article_ids, $id);
                                }
 
-                               if ($line["unread"] == "t" || $line["unread"] == "1") {
+                               if (sql_bool_to_bool($line["unread"])) {
                                        $class .= " Unread";
                                        ++$num_unread;
-                                       $is_unread = true;
-                               } else {
-                                       $is_unread = false;
                                }
 
-                               if ($line["marked"] == "t" || $line["marked"] == "1") {
-                                       $marked_pic = "<img id=\"FMPIC-$id\"
+                               if (sql_bool_to_bool($line["marked"])) {
+                                       $marked_pic = "<img
                                                src=\"images/mark_set.svg\"
                                                class=\"markedPic\" alt=\"Unstar article\"
-                                               onclick='javascript:toggleMark($id)'>";
+                                               onclick='toggleMark($id)'>";
+                                       $class .= " marked";
                                } else {
-                                       $marked_pic = "<img id=\"FMPIC-$id\"
+                                       $marked_pic = "<img
                                                src=\"images/mark_unset.svg\"
                                                class=\"markedPic\" alt=\"Star article\"
-                                               onclick='javascript:toggleMark($id)'>";
+                                               onclick='toggleMark($id)'>";
                                }
 
-                               if ($line["published"] == "t" || $line["published"] == "1") {
-                                       $published_pic = "<img id=\"FPPIC-$id\" src=\"images/pub_set.svg\"
-                                               class=\"markedPic\"
-                                               alt=\"Unpublish article\" onclick='javascript:togglePub($id)'>";
+                               if (sql_bool_to_bool($line["published"])) {
+                                       $published_pic = "<img src=\"images/pub_set.svg\"
+                                               class=\"pubPic\"
+                                                       alt=\"Unpublish article\" onclick='togglePub($id)'>";
+                                       $class .= " published";
                                } else {
-                                       $published_pic = "<img id=\"FPPIC-$id\" src=\"images/pub_unset.svg\"
-                                               class=\"markedPic\"
-                                               alt=\"Publish article\" onclick='javascript:togglePub($id)'>";
+                                       $published_pic = "<img src=\"images/pub_unset.svg\"
+                                               class=\"pubPic\"
+                                               alt=\"Publish article\" onclick='togglePub($id)'>";
                                }
 
 #                              $content_link = "<a target=\"_blank\" href=\"".$line["link"]."\">" .
@@ -411,7 +386,7 @@ class Feeds extends Handler_Protected {
                                $entry_author = $line["author"];
 
                                if ($entry_author) {
-                                       $entry_author = " - $entry_author";
+                                       $entry_author = " &mdash; $entry_author";
                                }
 
                                $has_feed_icon = feed_has_icon($feed_id);
@@ -447,13 +422,13 @@ class Feeds extends Handler_Protected {
                                        $mouseover_attrs = "onmouseover='postMouseIn(event, $id)'
                                                onmouseout='postMouseOut($id)'";
 
-                                       $reply['content'] .= "<div class='hl $class' id='RROW-$id' $label_row_style $mouseover_attrs>";
+                                       $reply['content'] .= "<div class='hl $class' id='RROW-$id' $mouseover_attrs>";
 
                                        $reply['content'] .= "<div class='hlLeft'>";
 
                                        $reply['content'] .= "<input dojoType=\"dijit.form.CheckBox\"
                                                        type=\"checkbox\" onclick=\"toggleSelectRow2(this)\"
-                                                       id=\"RCHK-$id\">";
+                                                       class='rchk'>";
 
                                        $reply['content'] .= "$marked_pic";
                                        $reply['content'] .= "$published_pic";
@@ -559,7 +534,7 @@ class Feeds extends Handler_Protected {
 
                                        $reply['content'] .= "<input dojoType=\"dijit.form.CheckBox\"
                                                        type=\"checkbox\" onclick=\"toggleSelectRow2(this, false, true)\"
-                                                       id=\"RCHK-$id\">";
+                                                       class='rchk'>";
 
                                        $reply['content'] .= "$marked_pic";
                                        $reply['content'] .= "$published_pic";
@@ -675,6 +650,10 @@ class Feeds extends Handler_Protected {
 
                                        $reply['content'] .= "<div class=\"cdmFooter\">";
 
+                                       foreach ($pluginhost->get_hooks($pluginhost::HOOK_ARTICLE_LEFT_BUTTON) as $p) {
+                                               $reply['content'] .= $p->hook_article_left_button($line);
+                                       }
+
                                        $tags_str = format_tags_string($line["tags"], $id);
 
                                        $reply['content'] .= "<img src='images/tag.png' alt='Tags' title='Tags'>
@@ -702,6 +681,9 @@ class Feeds extends Handler_Protected {
 
                                        $reply['content'] .= "<div style=\"float : right\">";
 
+//                                     $reply['content'] .= "$marked_pic";
+//                                     $reply['content'] .= "$published_pic";
+
                                        foreach ($pluginhost->get_hooks($pluginhost::HOOK_ARTICLE_BUTTON) as $p) {
                                                $reply['content'] .= $p->hook_article_button($line);
                                        }
@@ -735,7 +717,7 @@ class Feeds extends Handler_Protected {
                                        break;
                                default:
                                        if ($feed < LABEL_BASE_INDEX) {
-                                               $message = __("No articles found to display. You can assign articles to labels manually (see the Actions menu above) or use a filter.");
+                                               $message = __("No articles found to display. You can assign articles to labels manually from article header context menu (applies to all selected articles) or use a filter.");
                                        } else {
                                                $message = __("No articles found to display.");
                                        }
@@ -792,7 +774,7 @@ class Feeds extends Handler_Protected {
                $feed = db_escape_string($this->link, $_REQUEST["feed"]);
                $method = db_escape_string($this->link, $_REQUEST["m"]);
                $view_mode = db_escape_string($this->link, $_REQUEST["view_mode"]);
-               $limit = (int) get_pref($this->link, "DEFAULT_ARTICLE_LIMIT");
+               $limit = 30;
                @$cat_view = $_REQUEST["cat"] == "true";
                @$next_unread_feed = db_escape_string($this->link, $_REQUEST["nuf"]);
                @$offset = db_escape_string($this->link, $_REQUEST["skip"]);
@@ -835,19 +817,6 @@ class Feeds extends Handler_Protected {
                        ccache_update($this->link, $feed, $_SESSION["uid"], $cat_view);
                }
 
-/*             if (is_numeric($feed) && $feed > 0) {
-                       $view_settings = db_escape_string($this->link, json_encode(array(
-                               "view_mode" => $view_mode, "order_by" => $order_by)));
-
-                       $table = $cat_view ? "ttrss_feed_categories" : "ttrss_feeds";
-
-                       db_query($this->link, "UPDATE $table SET view_settings = '$view_settings'
-                               WHERE id = '$feed' AND owner_uid = " . $_SESSION["uid"]);
-               } else {
-                       set_pref($this->link, "_DEFAULT_VIEW_MODE", $view_mode);
-                       set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);
-               } */
-
                set_pref($this->link, "_DEFAULT_VIEW_MODE", $view_mode);
                set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);
 
@@ -875,12 +844,15 @@ class Feeds extends Handler_Protected {
                $override_order = false;
 
                switch ($order_by) {
-                       case "date_reverse":
-                               $override_order = "date_entered, updated";
-                               break;
-                       case "feed_dates":
-                               $override_order = "updated DESC";
-                               break;
+               case "title":
+                       $override_order = "ttrss_entries.title";
+                       break;
+               case "date_reverse":
+                       $override_order = "date_entered, updated";
+                       break;
+               case "feed_dates":
+                       $override_order = "updated DESC";
+                       break;
                }
 
                if ($_REQUEST["debug"]) $timing_info = print_checkpoint("04", $timing_info);