add context menu for cdmFeedTitle; change mark as read prompt for grouped headlines more clear

This commit is contained in:
Andrew Dolgov 2013-10-17 13:38:48 +04:00
parent 788cf0a1b1
commit 87065739cd
3 changed files with 98 additions and 11 deletions

View 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\">";

View 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;
}

View 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);
}