]> git.wh0rd.org - tt-rss.git/blobdiff - functions.php
implement (incomplete) sortable feedlist
[tt-rss.git] / functions.php
index 4ae5aa08e7ea09df093f6236c159ff47dbc68643..2401947310c69c4f9f0306b858b431b52c47ca40 100644 (file)
                print "<span $rtl_tag id=\"FEEDN-$feed_id\">$feed</span>";
 
                if ($unread != 0) {
-                       $fctr_class = "";
+                       $fctr_class = "class=\"feedCtrHasUnread\"";
                } else {
-                       $fctr_class = "class=\"invisible\"";
+                       $fctr_class = "class=\"feedCtrNoUnread\"";
                }
 
                print " <span $rtl_tag $fctr_class id=\"FEEDCTR-$feed_id\">
                if (get_pref($link, "STRIP_UNSAFE_TAGS") || $force_strip_tags) {
 
                        $res = strip_tags_long($res, 
-                               "<p><a><i><em><b><strong><blockquote><br><img><ul><ol><li>");
+                               "<p><a><i><em><b><strong><code><pre><blockquote><br><img><ul><ol><li>");
 
 //                     $res = preg_replace("/\r\n|\n|\r/", "", $res);
 //                     $res = strip_tags_long($res, "<p><a><i><em><b><strong><blockquote><br><img><div><span>");                       
                                $sel_all_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, '', true)";
                                $sel_unread_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', true, 'Unread', true)";
                                $sel_none_link = "javascript:selectTableRowsByIdPrefix('headlinesList', 'RROW-', 'RCHK-', false)";
+                               $sel_inv_link = "javascript:invertHeadlineSelection()";
 
                                $tog_unread_link = "javascript:selectionToggleUnread()";
                                $tog_marked_link = "javascript:selectionToggleMarked()";
                                $sel_unread_link = "javascript:cdmSelectArticles('unread')";
                                $sel_none_link = "javascript:cdmSelectArticles('none')";
 
+                               $sel_inv_link = "javascript:invertHeadlineSelection()";
+
                                $tog_unread_link = "javascript:selectionToggleUnread(true)";
                                $tog_marked_link = "javascript:selectionToggleMarked(true)";
                                $tog_published_link = "javascript:selectionTogglePublished(true)";
                                                ".__('Select:')."
                                                        <a href=\"$sel_all_link\">".__('All')."</a>,
                                                        <a href=\"$sel_unread_link\">".__('Unread')."</a>,
+                                                       <a href=\"$sel_inv_link\">".__('Invert')."</a>,
                                                        <a href=\"$sel_none_link\">".__('None')."</a></li>
                                                <li class=\"vsep\">&nbsp;</li>
                                                <li class=\"top\">".__('Actions...')."<ul>
 
                        $catctr_class = ($cat_unread > 0) ? "catCtrHasUnread" : "catCtrNoUnread";
 
-                       print "<li class=\"feedCat\" id=\"FCAT-$cat_id\">
-                               <a id=\"FCATN-$cat_id\" href=\"javascript:toggleCollapseCat($cat_id)\">$tmp_category</a>";
-
                        if ($can_browse) {
-                               print "<a href=\"#\" onclick=\"javascript:viewCategory($cat_id)\" id=\"FCAP-$cat_id\">";
+                               $browse_cat_link = "onclick=\"javascript:viewCategory($cat_id)\"";
+                               $inner_title_class = "catTitle";
                        } else {
-                               print "<span id=\"FCAP-$cat_id\">";
+                               $browse_cat_link = "";
+                               $inner_title_class = "catTitleNL";
                        }
 
+                       print "<li class=\"feedCat\" id=\"FCAT-$cat_id\">
+                               <img onclick=\"toggleCollapseCat($cat_id)\" class=\"catCollapse\"
+                                       title=\"".__('Click to collapse category')."\"
+                                       src=\"images/cat-collapse.png\"><span class=\"$inner_title_class\" 
+                                       id=\"FCATN-$cat_id\" $browse_cat_link
+                               \">$tmp_category</span>";
+
+                       print "<span id=\"FCAP-$cat_id\">";
+
                        print " <span id=\"FCATCTR-$cat_id\" 
                                class=\"$catctr_class\">($cat_unread)</span> $ellipsis";
 
-                       if ($can_browse) {
-                               print "</a>";
-                       } else {
-                               print "</span>";
-                       }
+                       print "</span>";
 
-                       print "</li>";
+                       //print "</li>";
 
                        print "<ul class=\"feedCatList\" id=\"FCATLIST-$cat_id\" style='$holder_style'>";
 
 
                                        $entry = ""; 
                                        
-                                       if (($ctype = __("audio/mpeg")) && 
+                                       if (($ctype == __("audio/mpeg")) && 
                                                (get_pref($link, "ENABLE_FLASH_PLAYER")) ) { 
                                        
                                                $entry .= "<object type=\"application/x-shockwave-flash\" data=\"extras/button/musicplayer.swf?song_url=$url\" width=\"17\" height=\"17\"> <param name=\"movie\" value=\"extras/button/musicplayer.swf?song_url=$url\" /> </object> ";
                                        $entry_author = " - $entry_author";
                                }
 
+                               $has_feed_icon = is_file(ICONS_DIR . "/$feed_id.ico");
+
+                               if ($has_feed_icon) {
+                                       $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";
+                               } else {
+                                       //$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\" alt=\"\">";
+                               }
+
                                if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
 
                                        if (get_pref($link, 'VFEED_GROUP_BY_FEED')) {
 
                                                        $cur_feed_title = htmlspecialchars($cur_feed_title);
 
-                                                       $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup($feed_id, \"$cur_feed_title\");' href='#'>mark as read</a>)";
+                                                       $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup($feed_id);' href='#'>mark as read</a>)";
 
                                                        print "<tr class='feedTitle'><td colspan='7'>".
+                                                               "<div style=\"float : right\">$feed_icon_img</div>".
                                                                "<a href=\"javascript:viewfeed($feed_id, '', false)\">".
-                                                               $line["feed_title"]."</a> $vf_catchup_link:</td></tr>";
+                                                               $line["feed_title"]."</a> $vf_catchup_link</td></tr>";
                                                }
                                        }
 
                                                        </span>";
                                                }
                                        }
-
-
                                        print "</td>";
-                                       
+
 #                                      }
                                        
-                                       print "<td class=\"hlUpdated\" onclick='javascript:view($id,$feed_id)'><nobr>$updated_fmt&nbsp;</nobr></td>";
+                                       print "<td class=\"hlUpdated\" onclick='view($id,$feed_id)'><nobr>$updated_fmt&nbsp;</nobr></td>";
 
                                        print "<td class='hlMarkedPic'>$score_pic</td>";
-       
+
+                                       if ($line["feed_title"] && !get_pref($link, 'VFEED_GROUP_BY_FEED')) {
+                                               print "<td onclick=\"viewfeed($feed_id)\" class=\"hlFeedIcon\">$feed_icon_img</td>";
+                                       }
+
                                        print "</tr>";
 
                                } else {
 
                                                        $cur_feed_title = htmlspecialchars($cur_feed_title);
 
-                                                       $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup($feed_id, \"$cur_feed_title\");' href='#'>mark as read</a>)";
+                                                       $vf_catchup_link = "(<a onclick='javascript:catchupFeedInGroup($feed_id);' href='#'>mark as read</a>)";
+
+                                                       $has_feed_icon = is_file(ICONS_DIR . "/$feed_id.ico");
+
+                                                       if ($has_feed_icon) {
+                                                               $feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"".ICONS_URL."/$feed_id.ico\" alt=\"\">";
+                                                       } else {
+                                                               //$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\" alt=\"\">";
+                                                       }
 
                                                        print "<div class='cdmFeedTitle'>".
+                                                               "<div style=\"float : right\">$feed_icon_img</div>".
                                                                "<a href=\"javascript:viewfeed($feed_id, '', false)\">".
                                                                $line["feed_title"]."</a> $vf_catchup_link</div>";
                                                }
 
                                        print "<div class=\"cdmHeader\">";
 
-                                       print "<div class=\"articleUpdated\">$updated_fmt $score_pic</div>";
+                                       if (!get_pref($link, "VFEED_GROUP_BY_FEED") || !$line["feed_title"]) {
+                                               $cdm_feed_icon = "<span style=\"cursor : pointer\" onclick=\"viewfeed($feed_id)\">$feed_icon_img</span>";
+                                       }
+
+                                       print "<div class=\"articleUpdated\">$updated_fmt $score_pic $cdm_feed_icon
+                                               </div>";
 
                                        print "<span id=\"RTITLE-$id\" class=\"titleWrap$hlc_suffix\"><a class=\"title\" 
                                                onclick=\"javascript:toggleUnread($id, 0)\"
 
                                        $entry = ""; 
                                        
-                                       if (($ctype = __("audio/mpeg")) && 
+                                       if (($ctype == __("audio/mpeg")) && 
                                                (get_pref($link, "ENABLE_FLASH_PLAYER")) ) { 
                                                
                                                $entry .= "<object type=\"application/x-shockwave-flash\" data=\"extras/button/musicplayer.swf?song_url=$url\" width=\"17\" height=\"17\"> <param name=\"movie\" value=\"extras/button/musicplayer.swf?song_url=$url\" /> </object> "; 
 
        function article_publish_url($link) {
 
-               $url_path = ($_SERVER['HTTPS'] != "on" ? 'http://' :  'https://') . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
+               $url_path = "";
+               
+
+               if ($_SERVER['HTTPS'] != "on") {
+                       $url_path = "http://";
+               } else {
+                       $url_path = "https://";
+               }
 
-               $url_path .= "?op=publish&key=" . get_pref($link, "_PREFS_PUBLISH_KEY");
+               $url_path .= $_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
+               $url_path .= "/backend.php?op=publish&key=" . get_pref($link, "_PREFS_PUBLISH_KEY");
 
                return $url_path;
        }
        }
 
        function get_score_pic($score) {
-               if ($score > 0) { 
+               if ($score > 100) { 
                        return "score_high.png"; 
-               } else if ($score < 0) {
+               } else if ($score > 0) { 
+                       return "score_half_high.png"; 
+               } else if ($score < -100) {
                        return "score_low.png"; 
+               } else if ($score < 0) {
+                       return "score_half_low.png"; 
                } else { 
                        return "score_neutral.png"; 
                }
                print "</table>";
        }
 
+       function print_label_dlg_common_examples() {
+
+               print __("Match ") . " ";
+
+/*             print "<select name=\"label_andor\">";
+               print "<option value=\"and\">AND</option>";
+               print "<option value=\"or\">OR</option>";
+               print "</select>"; */
+
+               print "<select name=\"label_fields\" onchange=\"labelFieldsCheck(this)\">";
+               print "<option value=\"unread\">".__("Unread articles")."</option>";
+               print "<option value=\"updated\">".__("Updated articles")."</option>";
+               print "<option value=\"kw_title\">".__("Title contains")."</option>";
+               print "<option value=\"kw_content\">".__("Content contains")."</option>";
+               print "<option value=\"scoreE\">".__("Score equals")."</option>";
+               print "<option value=\"scoreG\">".__("Score is greater than")."</option>";
+               print "<option value=\"scoreL\">".__("Score is less than")."</option>";
+               print "<option value=\"newerH\">".__("Articles newer than X hours")."</option>";
+               print "<option value=\"newerD\">".__("Articles newer than X days")."</option>";
+
+               print "</select>";
+
+               print "<input style=\"display : none\" name=\"label_fields_param\"
+                       size=\"10\">";
+
+               print " <input type=\"submit\" 
+                       onclick=\"return addLabelExample()\"
+                       value=\"".__("Add")."\">";
+       }
 ?>