]> git.wh0rd.org Git - tt-rss.git/commitdiff
add context menu for cdmFeedTitle; change mark as read prompt for grouped headlines...
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 17 Oct 2013 09:38:48 +0000 (13:38 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 17 Oct 2013 09:38:48 +0000 (13:38 +0400)
classes/feeds.php
css/cdm.css
js/viewfeed.js

index e26318e7e2c2161a8436e865cf448deb516448b2..7f5fd10af3fa8996856b3de80bcf36d3abc26879 100644 (file)
@@ -430,12 +430,12 @@ class Feeds extends Handler_Protected {
 
                                                        $cur_feed_title = htmlspecialchars($cur_feed_title);
 
-                                                       $vf_catchup_link = "(<a class='catchup' onclick='catchupFeedInGroup($feed_id);' href='#'>".__('Mark as read')."</a>)";
+                                                       $vf_catchup_link = "<a class='catchup' onclick='catchupFeedInGroup($feed_id);' href='#'>".__('mark feed as read')."</a>";
 
-                                                       $reply['content'] .= "<div class='cdmFeedTitle'>".
-                                                               "<div style=\"float : right\">$feed_icon_img</div>".
-                                                               "<a class='title' href=\"#\" onclick=\"viewfeed($feed_id)\">".
-                                                               $line["feed_title"]."</a> $vf_catchup_link</div>";
+                                                       $reply['content'] .= "<div id='FTITLE-$feed_id' class='cdmFeedTitle'>".
+                                                               "<div style='float : right'>$feed_icon_img</div>".
+                                                               "<a class='title' href=\"#\" onclick=\"viewfeed($feed_id)\">".                                                          $line["feed_title"]."</a>
+                                                               $vf_catchup_link</div>";
 
                                                }
                                        }
@@ -443,7 +443,7 @@ class Feeds extends Handler_Protected {
                                        $mouseover_attrs = "onmouseover='postMouseIn(event, $id)'
                                                onmouseout='postMouseOut($id)'";
 
-                                       $reply['content'] .= "<div class='hl $class' id='RROW-$id' $mouseover_attrs>";
+                                       $reply['content'] .= "<div class='hl $class' orig-feed-id='$feed_id' id='RROW-$id' $mouseover_attrs>";
 
                                        $reply['content'] .= "<div class='hlLeft'>";
 
@@ -524,7 +524,7 @@ class Feeds extends Handler_Protected {
 
                                                        $cur_feed_title = htmlspecialchars($cur_feed_title);
 
-                                                       $vf_catchup_link = "(<a class='catchup' onclick='javascript:catchupFeedInGroup($feed_id);' href='#'>".__('mark as read')."</a>)";
+                                                       $vf_catchup_link = "<a class='catchup' onclick='catchupFeedInGroup($feed_id);' href='#'>".__('mark feed as read')."</a>";
 
                                                        $has_feed_icon = feed_has_icon($feed_id);
 
@@ -534,7 +534,7 @@ class Feeds extends Handler_Protected {
                                                                //$feed_icon_img = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\" alt=\"\">";
                                                        }
 
-                                                       $reply['content'] .= "<div class='cdmFeedTitle'>".
+                                                       $reply['content'] .= "<div id='FTITLE-$feed_id' class='cdmFeedTitle'>".
                                                                "<div style=\"float : right\">$feed_icon_img</div>".
                                                                "<a href=\"#\" class='title' onclick=\"viewfeed($feed_id)\">".
                                                                $line["feed_title"]."</a> $vf_catchup_link</div>";
@@ -547,7 +547,7 @@ class Feeds extends Handler_Protected {
                                        $expanded_class = $expand_cdm ? "expanded" : "expandable";
 
                                        $reply['content'] .= "<div class=\"cdm $hlc_suffix $expanded_class $class\"
-                                               id=\"RROW-$id\" $mouseover_attrs>";
+                                               id=\"RROW-$id\" orig-feed-id='$feed_id' $mouseover_attrs>";
 
                                        $reply['content'] .= "<div class=\"cdmHeader\" style=\"$row_background\">";
                                        $reply['content'] .= "<div style=\"vertical-align : middle\">";
index c91f09927df4858c929d62f8a0a465b415b820f8..dd4346e4cdcde73afd18446e19e87b3f523ce129 100644 (file)
@@ -341,4 +341,24 @@ div#floatingTitle img.hlScorePic {
        text-decoration : line-through;
 }
 
+div.cdmFeedTitle > * {
+       display : table-cell;
+       vertical-align : middle;
+}
+
+div.cdmFeedTitle a.title {
+       width : 100%;
+}
+
+div.cdmFeedTitle a.catchup {
+       text-align : right;
+       color : #555;
+       padding-right : 10px;
+       font-size : 11px;
+       white-space : nowrap;
+}
+
+div.cdmFeedTitle a.catchup:hover {
+       color : #4684ff;
+}
 
index cb9a3c646ef4fdb7b74421743aaf025c41239f0a..3c02d462640e7cf8b681767b5db77163208e1ac7 100644 (file)
@@ -961,10 +961,12 @@ function getLoadedArticleIds() {
 }
 
 // mode = all,none,unread,invert,marked,published
-function selectArticles(mode) {
+function selectArticles(mode, query) {
        try {
 
-               var children = $$("#headlines-frame > div[id*=RROW]");
+               if (!query) query = "#headlines-frame > div[id*=RROW]";
+
+               var children = $$(query);
 
                children.each(function(child) {
                        var id = child.id.replace("RROW-", "");
@@ -2107,6 +2109,71 @@ function initHeadlinesMenu() {
 
                menu.startup();
 
+               /* vgroup feed title menu */
+
+               var nodes = $$("#headlines-frame > div[class='cdmFeedTitle']");
+               var ids = [];
+
+               nodes.each(function(node) {
+                       ids.push(node.id);
+               });
+
+               if (ids.length > 0) {
+                       if (dijit.byId("headlinesFeedTitleMenu"))
+                               dijit.byId("headlinesFeedTitleMenu").destroyRecursive();
+
+                       var menu = new dijit.Menu({
+                               id: "headlinesFeedTitleMenu",
+                               targetNodeIds: ids,
+                       });
+
+                       var tmph = dojo.connect(menu, '_openMyself', function (event) {
+                               var callerNode = event.target, match = null, tries = 0;
+
+                               while (match == null && callerNode && tries <= 3) {
+                                       console.log(callerNode.id);
+
+                                       match = callerNode.id.match("^[A-Z]+[-]([0-9]+)$");
+                                       callerNode = callerNode.parentNode;
+                                       ++tries;
+
+                                       console.log(match[1]);
+                               }
+
+                               if (match) this.callerRowId = parseInt(match[1]);
+
+                       });
+
+                       menu.addChild(new dijit.MenuItem({
+                               label: __("Select articles in group"),
+                               onClick: function(event) {
+                                       selectArticles("all",
+                                               "#headlines-frame > div[id*=RROW]"+
+                                               "[orig-feed-id='"+menu.callerRowId+"']");
+
+                               }}));
+
+                       menu.addChild(new dijit.MenuItem({
+                               label: __("Mark group as read"),
+                               onClick: function(event) {
+                                       selectArticles("all",
+                                               "#headlines-frame > div[id*=RROW]"+
+                                               "[orig-feed-id='"+menu.callerRowId+"']");
+
+                                       catchupSelection();
+                               }}));
+
+
+                       menu.addChild(new dijit.MenuItem({
+                               label: __("Mark feed as read"),
+                               onClick: function(event) {
+                                       catchupFeedInGroup(menu.callerRowId);
+                               }}));
+
+                       menu.startup();
+
+               }
+
        } catch (e) {
                exception_error("initHeadlinesMenu", e);
        }