]> git.wh0rd.org - tt-rss.git/blobdiff - functions.php
add function to open article summary in a popup window
[tt-rss.git] / functions.php
index 8367dcaa1266576f6e756b1923111c9fcfee9584..701d3ec57f59140aa0182a47d9e4b78915925806 100644 (file)
 
                if (CHECK_FOR_NEW_VERSION && $_SESSION["access_level"] >= 10) {
                        
-                       if ($_SESSION["last_version_check"] + 7200 < time()) {
+                       if ($_SESSION["last_version_check"] + 86400 < time()) {
                                $new_version_details = check_for_update($link);
 
                                print "<param key=\"new_version_available\" value=\"".
                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 {
+                               $browse_cat_link = "";
+                               $inner_title_class = "catTitleNL";
+                       }
+
+                       if ($cat_id > 0) {
+                               $cat_class = "feedCat";
                        } else {
-                               print "<span id=\"FCAP-$cat_id\">";
+                               $cat_class = "virtCat";
                        }
 
+                       print "<li class=\"$cat_class\" 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'>";
 
                        "images/pub_set.gif", $link);
 
                if (get_pref($link, 'ENABLE_FEED_CATS')) {
-                       print "</ul>";
+                       print "</ul></li>";
                }
 
                if (!$tags) {
 
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
                                if (get_pref($link, "FEEDS_SORT_BY_UNREAD")) {
-                                       $order_by_qpart = "category,unread DESC,title";
+                                       $order_by_qpart = "order_id,category,unread DESC,title";
                                } else {
-                                       $order_by_qpart = "category,title";
+                                       $order_by_qpart = "order_id,category,title";
                                }
                        } else {
                                if (get_pref($link, "FEEDS_SORT_BY_UNREAD")) {
                                if ($category != $tmp_category && get_pref($link, 'ENABLE_FEED_CATS')) {
                                
                                        if ($category) {
-                                               print "</ul>";
+                                               print "</ul></li>";
                                        }
                                
                                        $category = $tmp_category;
                return vsprintf(__(array_shift($args)), $args);
        }
 
-       function outputArticleXML($link, $id, $feed_id, $mark_as_read = true) {
+       function outputArticleXML($link, $id, $feed_id, $mark_as_read = true,
+               $zoom_mode = false) {
 
                /* we can figure out feed_id from article id anyway, why do we
                 * pass feed_id here? */
 
                $feed_id = db_fetch_result($result, 0, "feed_id");
 
-               print "<article id='$id'><![CDATA[";
+               if (!$zoom_mode) { print "<article id='$id'><![CDATA["; };
 
                $result = db_query($link, "SELECT rtl_content FROM ttrss_feeds
                        WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
                                }                               
                        }
 
+                       if ($zoom_mode) {
+                               header("Content-Type: text/html");
+                               print "<html><head>
+                                               <title>Tiny Tiny RSS - ".$line["title"]."</title>
+                                               <link rel=\"stylesheet\" type=\"text/css\" href=\"tt-rss.css\">
+                                       </head><body>";
+                       }
+
+
                        print "<div class=\"postReply\">";
 
                        print "<div class=\"postHeader\" onmouseover=\"enable_resize(true)\" 
                        $tags = get_article_tags($link, $id);
        
                        $tags_str = "";
+                       $tags_nolinks_str = "";
                        $f_tags_str = "";
 
                        $num_tags = 0;
                                
                                if ($num_tags == $tag_limit) {
                                        $tags_str .= "&hellip;";
+                                       $tags_nolinks_str .= "&hellip;";
 
                                } else if ($num_tags < $tag_limit) {
                                        $tags_str .= $tag_str;
+                                       $tags_nolinks_str .= "$tag, ";
                                }
                                $f_tags_str .= $tag_str;
                        }
 
                        $tags_str = preg_replace("/, $/", "", $tags_str);
+                       $tags_nolinks_str = preg_replace("/, $/", "", $tags_nolinks_str);
                        $f_tags_str = preg_replace("/, $/", "", $f_tags_str);
 
                        $all_tags_div = "<span class='cdmAllTagsCtr'>&hellip;<div class='cdmAllTags'>All Tags: $f_tags_str</div></span>";
                        if (!$entry_comments) $entry_comments = "&nbsp;"; # placeholder
 
                        if (!$tags_str) $tags_str = '<span class="tagList">'.__('no tags').'</span>';
+                       if (!$tags_nolinks_str) $tags_nolinks_str = '<span class="tagList">'.__('no tags').'</span>';
 
                        print "<div style='float : right'>
-                               <img src='images/tag.png' class='tagsPic' alt='Tags' title='Tags'>
-                               $tags_str 
-                               <a title=\"Edit tags for this article\" 
-                                       href=\"javascript:editArticleTags($id, $feed_id)\">(+)</a></div>
-                               <div clear='both'>$entry_comments</div>";
+                                       <img src='images/tag.png' class='tagsPic' alt='Tags' title='Tags'>";
+
+                       if (!$zoom_mode) {
+                               print "$tags_str 
+                                       <a title=\"".__('Edit tags for this article')."\" 
+                                               href=\"javascript:editArticleTags($id, $feed_id)\">(+)</a>                              
+                                       <img src=\"images/art-zoom.png\" class='tagsPic' 
+                                               style=\"cursor : pointer\"
+                                               onclick=\"zoomToArticle($id)\"
+                                               alt='Zoom' title='".__('Show article summary in new window')."'>";
+                       } else {
+                               print "$tags_nolinks_str";
+                       }
+                       print "</div>";
+                       print "<div clear='both'>$entry_comments</div>";
 
                        print "</div>";
 
 
                }
 
-               print "]]></article>";
+               if (!$zoom_mode) { 
+                       print "]]></article>"; 
+               } else {
+                       print "
+                               <div style=\"text-align : center\">
+                               <input type=\"submit\" onclick=\"return window.close()\" 
+                               value=\"".__("Close this window")."\"></div>";
+                       print "</body></html>";
+
+               }
 
        }
 
                                                        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>";
                                                }
                                        }
 
 
                                        print "<div class=\"cdmHeader\">";
 
-                                       print "<div class=\"articleUpdated\">$updated_fmt $score_pic
-                                               <span style=\"cursor : pointer\" onclick=\"viewfeed($feed_id)\">$feed_icon_img</span>
+                                       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\" 
 
                                        print "</span><span class='s1'>$marked_pic</span> ";
                                        print "<span class='s1'>$published_pic</span> ";
+                                       print "<span class='s1'><img src=\"images/art-zoom.png\" class='tagsPic' 
+                                               onclick=\"zoomToArticle($id)\"
+                                               style=\"cursor : pointer\"
+                                               alt='Zoom' 
+                                               title='".__('Show article summary in new window')."'></span>";
 
                                        $tags = get_article_tags($link, $id);