]> git.wh0rd.org Git - tt-rss.git/commitdiff
CDM: implement scoring display
authorAndrew Dolgov <fox@bah.spb.su>
Wed, 30 Apr 2008 10:39:05 +0000 (11:39 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Wed, 30 Apr 2008 10:39:05 +0000 (11:39 +0100)
functions.php
tt-rss.css

index cda69bb74f75bb94a3fc0bb0847bc84b8e6b8a4e..180d021bf8c52eb24a0d815ebef6b551022ed346 100644 (file)
                                _debug("update_rss_feed: loading filters...");
                        }
 
-                       $filters = array();
-
-                       $result = db_query($link, "SELECT reg_exp,
-                               ttrss_filter_types.name AS name,
-                               ttrss_filter_actions.name AS action,
-                               inverse,
-                               action_param
-                               FROM ttrss_filters,ttrss_filter_types,ttrss_filter_actions WHERE                                        
-                                       enabled = true AND
-                                       owner_uid = $owner_uid AND
-                                       ttrss_filter_types.id = filter_type AND
-                                       ttrss_filter_actions.id = action_id AND
-                               (feed_id IS NULL OR feed_id = '$feed') ORDER BY reg_exp");
-
-                       while ($line = db_fetch_assoc($result)) {
-                               if (!$filters[$line["name"]]) $filters[$line["name"]] = array();
-
-                               $filter["reg_exp"] = $line["reg_exp"];
-                               $filter["action"] = $line["action"];
-                               $filter["action_param"] = $line["action_param"];
-                               $filter["inverse"] = sql_bool_to_bool($line["inverse"]);
-                       
-                               array_push($filters[$line["name"]], $filter);
-                       }
+                       $filters = load_filters($link, $feed, $owner_uid);
 
                        if ($use_simplepie) {
                                $iterator = $rss->get_items();
 
                                $score_title = __("(Click to change)");
 
-                               $score_pic = "<img src=\"images/$score_pic\" 
+                               $score_pic = "<img class='hlScorePic' src=\"images/$score_pic\" 
                                        onclick=\"adjustArticleScore($id, $score)\" title=\"$score $score_title\">";
 
+                               if ($score > 500) {
+                                       $hlc_suffix = "H";
+                               } else if ($score < -100) {
+                                       $hlc_suffix = "L";
+                               } else {
+                                       $hlc_suffix = "";
+                               }
+
                                $entry_author = $line["author"];
 
                                if ($entry_author) {
 #                                                              truncate_string($line["feed_title"],30)."</a>&nbsp;</td>";
 #                                      } else {                        
 
-
-                                       if ($score > 500) {
-                                               $hlc_suffix = "H";
-                                       } else if ($score < -100) {
-                                               $hlc_suffix = "L";
-                                       } else {
-                                               $hlc_suffix = "";
-                                       }
-
                                        print "<td class='hlContent$hlc_suffix' valign='middle'>";
 
                                        print "<a href=\"javascript:view($id,$feed_id);\">" .
 
                                        $expand_cdm = get_pref($link, 'CDM_EXPANDED');
 
-                                       if ($expand_cdm) {
+                                       if ($expand_cdm && $score >= -100) {
                                                $cdm_cstyle = "";
                                        } else {
                                                $cdm_cstyle = "style=\"display : none\"";
 
                                        print "<div class=\"cdmHeader\">";
 
-                                       print "<div class=\"articleUpdated\">$updated_fmt</div>";
-                                       
-                                       print "<a class=\"title\" 
+                                       print "<div class=\"articleUpdated\">$updated_fmt $score_pic</div>";
+
+                                       print "<span class=\"titleWrap$hlc_suffix\"><a class=\"title\" 
                                                onclick=\"javascript:toggleUnread($id, 0)\"
-                                               target=\"_new\" href=\"".$line["link"]."\">".$line["title"]."</a>";
+                                               target=\"_blank\" href=\"".$line["link"]."\">".$line["title"]."</a>
+                                               ";
 
                                        print $entry_author;
 
-                                       if (!$expand_cdm) {
+                                       if (!$expand_cdm || $score < -100) {
                                                print "&nbsp;<a id=\"CICH-$id\" 
                                                        href=\"javascript:cdmExpandArticle($id)\">
                                                        (".__('Show article').")</a>";
                                                }
                                        }
 
-                                       print "</div>";
+                                       print "</span></div>";
 
                                        if (get_pref($link, 'OPEN_LINKS_IN_NEW_WINDOW')) {
                                                $line["content_preview"] = preg_replace("/href=/i", 
index 65c93175b24a2e7e3f21ae197ee0dd0887cdd147..abed34564c8658d4b76a9116077687a395246528 100644 (file)
@@ -925,7 +925,7 @@ div.cdmHeader {
        padding : 5px 5px 10px 5px;
 }
 
-div.cdmArticleUnread div.cdmHeader a {
+div.cdmArticleUnread div.cdmHeader span.titleWrap a {
        color : black;
 }
 
@@ -995,7 +995,6 @@ div.cdmHeader a:hover {
 
 div.cdmContent {
        margin : 5px 15px 0px 15px;
-
 }
 
 div.cdmEnclosures {
@@ -1768,3 +1767,19 @@ td.hlContentL a, td.hlContentL span {
        color : #909090;
        text-decoration : line-through;
 }
+
+span.titleWrapH, span.titleWrapH a {
+       color : #00cc00;
+}
+
+span.titleWrapL, span.titleWrapL a {
+       color : #909090;
+       text-decoration : line-through;
+}
+
+img.hlScorePic {
+       vertical-align : middle;
+       width : 16px;
+       height : 16px;
+}
+