From 87065739cdc569bbcfe92ad6f0b6ebef3c72f3ec Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 17 Oct 2013 13:38:48 +0400 Subject: [PATCH] add context menu for cdmFeedTitle; change mark as read prompt for grouped headlines more clear --- classes/feeds.php | 18 ++++++------ css/cdm.css | 20 +++++++++++++ js/viewfeed.js | 71 +++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 98 insertions(+), 11 deletions(-) diff --git a/classes/feeds.php b/classes/feeds.php index e26318e7e..7f5fd10af 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -430,12 +430,12 @@ class Feeds extends Handler_Protected { $cur_feed_title = htmlspecialchars($cur_feed_title); - $vf_catchup_link = "(".__('Mark as read').")"; + $vf_catchup_link = "".__('mark feed as read').""; - $reply['content'] .= "
". - "
$feed_icon_img
". - "". - $line["feed_title"]." $vf_catchup_link
"; + $reply['content'] .= "
". + "
$feed_icon_img
". + "". $line["feed_title"]." + $vf_catchup_link
"; } } @@ -443,7 +443,7 @@ class Feeds extends Handler_Protected { $mouseover_attrs = "onmouseover='postMouseIn(event, $id)' onmouseout='postMouseOut($id)'"; - $reply['content'] .= "
"; + $reply['content'] .= "
"; $reply['content'] .= "
"; @@ -524,7 +524,7 @@ class Feeds extends Handler_Protected { $cur_feed_title = htmlspecialchars($cur_feed_title); - $vf_catchup_link = "(".__('mark as read').")"; + $vf_catchup_link = "".__('mark feed as read').""; $has_feed_icon = feed_has_icon($feed_id); @@ -534,7 +534,7 @@ class Feeds extends Handler_Protected { //$feed_icon_img = "\"\""; } - $reply['content'] .= "
". + $reply['content'] .= "
". "
$feed_icon_img
". "". $line["feed_title"]." $vf_catchup_link
"; @@ -547,7 +547,7 @@ class Feeds extends Handler_Protected { $expanded_class = $expand_cdm ? "expanded" : "expandable"; $reply['content'] .= "
"; + id=\"RROW-$id\" orig-feed-id='$feed_id' $mouseover_attrs>"; $reply['content'] .= "
"; $reply['content'] .= "
"; diff --git a/css/cdm.css b/css/cdm.css index c91f09927..dd4346e4c 100644 --- a/css/cdm.css +++ b/css/cdm.css @@ -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; +} diff --git a/js/viewfeed.js b/js/viewfeed.js index cb9a3c646..3c02d4626 100644 --- a/js/viewfeed.js +++ b/js/viewfeed.js @@ -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); }