]> git.wh0rd.org Git - tt-rss.git/commitdiff
add function to open article summary in a popup window
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 5 Sep 2008 07:36:57 +0000 (08:36 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 5 Sep 2008 07:36:57 +0000 (08:36 +0100)
backend.php
functions.php
images/art-zoom.png [new file with mode: 0644]
viewfeed.js

index 116b04b5435471aaa95886e23934c71242ac81a9..a632fafad7da724d721bb0895719c2648dde45e0 100644 (file)
 
                        if ($mode == "") {
                                outputArticleXML($link, $id, $feed_id);
+                       } else if ($mode == "zoom") {
+                               outputArticleXML($link, $id, $feed_id, true, true);
                        } else {
                                catchupArticleById($link, $id, 0);
                        }
index 0e34af34e867003f943ca3f55cc8ee6db6cae90c..701d3ec57f59140aa0182a47d9e4b78915925806 100644 (file)
                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 "</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);
 
diff --git a/images/art-zoom.png b/images/art-zoom.png
new file mode 100644 (file)
index 0000000..5f7c809
Binary files /dev/null and b/images/art-zoom.png differ
index e14911a2cb0359bb5d1d89a01bd7edc733673159..5813f413556a53fc229cc0c569370208dcf30a33 100644 (file)
@@ -1892,3 +1892,14 @@ function invertHeadlineSelection() {
 function getArticleUnderPointer() {
        return post_under_pointer;
 }
+
+function zoomToArticle(id) {
+       try {
+               var w = window.open("backend.php?op=view&mode=zoom&id=" + param_escape(id), 
+                       "ttrss_zoom_" + id,
+                       "status=0,toolbar=0,location=0,width=450,height=300,scrollbars=1,menubar=0");
+
+       } catch (e) {
+               exception_error("zoomToArticle", e);
+       }
+}