support headlines context menu in floating title
This commit is contained in:
parent
abb04b76a5
commit
65f0eb01aa
|
@ -316,7 +316,7 @@ class Feeds extends Handler_Protected {
|
||||||
|
|
||||||
if (!is_array($labels)) $labels = get_article_labels($id);
|
if (!is_array($labels)) $labels = get_article_labels($id);
|
||||||
|
|
||||||
$labels_str = "<span id=\"HLLCTR-$id\">";
|
$labels_str = "<span class=\"HLLCTR-$id\">";
|
||||||
$labels_str .= format_article_labels($labels, $id);
|
$labels_str .= format_article_labels($labels, $id);
|
||||||
$labels_str .= "</span>";
|
$labels_str .= "</span>";
|
||||||
|
|
||||||
|
|
280
js/viewfeed.js
280
js/viewfeed.js
|
@ -1599,9 +1599,9 @@ function show_labels_in_headlines(transport) {
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
data['info-for-headlines'].each(function(elem) {
|
data['info-for-headlines'].each(function(elem) {
|
||||||
var ctr = $("HLLCTR-" + elem.id);
|
$$(".HLLCTR-" + elem.id).each(function(ctr) {
|
||||||
|
ctr.innerHTML = elem.labels;
|
||||||
if (ctr) ctr.innerHTML = elem.labels;
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -1916,6 +1916,153 @@ function closeArticlePanel() {
|
||||||
dijit.byId("content-insert"));
|
dijit.byId("content-insert"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initFloatingMenu() {
|
||||||
|
try {
|
||||||
|
if (dijit.byId("floatingMenu"))
|
||||||
|
dijit.byId("floatingMenu").destroyRecursive();
|
||||||
|
|
||||||
|
var menu = new dijit.Menu({
|
||||||
|
id: "floatingMenu",
|
||||||
|
targetNodeIds: ["floatingTitle"]
|
||||||
|
});
|
||||||
|
|
||||||
|
var id = $("floatingTitle").getAttribute("rowid").replace("RROW-", "");
|
||||||
|
|
||||||
|
headlinesMenuCommon(menu, id);
|
||||||
|
|
||||||
|
menu.startup();
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("initFloatingMenu", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function headlinesMenuCommon(menu, base_id) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuItem({
|
||||||
|
label: __("Open original article"),
|
||||||
|
onClick: function(event) {
|
||||||
|
openArticleInNewWindow(base_id ? base_id : this.getParent().callerRowId);
|
||||||
|
}}));
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuItem({
|
||||||
|
label: __("Display article URL"),
|
||||||
|
onClick: function(event) {
|
||||||
|
displayArticleUrl(base_id ? base_id : this.getParent().callerRowId);
|
||||||
|
}}));
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuSeparator());
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuItem({
|
||||||
|
label: __("Toggle unread"),
|
||||||
|
onClick: function(event) {
|
||||||
|
var ids = getSelectedArticleIds2();
|
||||||
|
// cast to string
|
||||||
|
var id = (base_id ? base_id : this.getParent().callerRowId) + "";
|
||||||
|
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||||
|
|
||||||
|
selectionToggleUnread(undefined, false, true, ids);
|
||||||
|
}}));
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuItem({
|
||||||
|
label: __("Toggle starred"),
|
||||||
|
onClick: function(event) {
|
||||||
|
var ids = getSelectedArticleIds2();
|
||||||
|
// cast to string
|
||||||
|
var id = (base_id ? base_id : this.getParent().callerRowId) + "";
|
||||||
|
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||||
|
|
||||||
|
selectionToggleMarked(undefined, false, true, ids);
|
||||||
|
}}));
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuItem({
|
||||||
|
label: __("Toggle published"),
|
||||||
|
onClick: function(event) {
|
||||||
|
var ids = getSelectedArticleIds2();
|
||||||
|
// cast to string
|
||||||
|
var id = (base_id ? base_id : this.getParent().callerRowId) + "";
|
||||||
|
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||||
|
|
||||||
|
selectionTogglePublished(undefined, false, true, ids);
|
||||||
|
}}));
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuSeparator());
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuItem({
|
||||||
|
label: __("Mark above as read"),
|
||||||
|
onClick: function(event) {
|
||||||
|
catchupRelativeToArticle(0, base_id ? base_id : this.getParent().callerRowId);
|
||||||
|
}}));
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuItem({
|
||||||
|
label: __("Mark below as read"),
|
||||||
|
onClick: function(event) {
|
||||||
|
catchupRelativeToArticle(1, base_id ? base_id : this.getParent().callerRowId);
|
||||||
|
}}));
|
||||||
|
|
||||||
|
|
||||||
|
var labels = dijit.byId("feedTree").model.getItemsInCategory(-2);
|
||||||
|
|
||||||
|
if (labels) {
|
||||||
|
|
||||||
|
menu.addChild(new dijit.MenuSeparator());
|
||||||
|
|
||||||
|
var labelAddMenu = new dijit.Menu({ownerMenu: menu});
|
||||||
|
var labelDelMenu = new dijit.Menu({ownerMenu: menu});
|
||||||
|
|
||||||
|
labels.each(function(label) {
|
||||||
|
var id = label.id[0];
|
||||||
|
var bare_id = id.substr(id.indexOf(":")+1);
|
||||||
|
var name = label.name[0];
|
||||||
|
|
||||||
|
bare_id = feed_to_label_id(bare_id);
|
||||||
|
|
||||||
|
labelAddMenu.addChild(new dijit.MenuItem({
|
||||||
|
label: name,
|
||||||
|
labelId: bare_id,
|
||||||
|
onClick: function(event) {
|
||||||
|
var ids = getSelectedArticleIds2();
|
||||||
|
// cast to string
|
||||||
|
var id = (base_id ? base_id : this.getParent().ownerMenu.callerRowId) + "";
|
||||||
|
|
||||||
|
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||||
|
|
||||||
|
selectionAssignLabel(this.labelId, ids);
|
||||||
|
}}));
|
||||||
|
|
||||||
|
labelDelMenu.addChild(new dijit.MenuItem({
|
||||||
|
label: name,
|
||||||
|
labelId: bare_id,
|
||||||
|
onClick: function(event) {
|
||||||
|
var ids = getSelectedArticleIds2();
|
||||||
|
// cast to string
|
||||||
|
var id = (base_id ? base_id : this.getParent().ownerMenu.callerRowId) + "";
|
||||||
|
|
||||||
|
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
||||||
|
|
||||||
|
selectionRemoveLabel(this.labelId, ids);
|
||||||
|
}}));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
menu.addChild(new dijit.PopupMenuItem({
|
||||||
|
label: __("Assign label"),
|
||||||
|
popup: labelAddMenu,
|
||||||
|
}));
|
||||||
|
|
||||||
|
menu.addChild(new dijit.PopupMenuItem({
|
||||||
|
label: __("Remove label"),
|
||||||
|
popup: labelDelMenu,
|
||||||
|
}));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("headlinesMenuCommon", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function initHeadlinesMenu() {
|
function initHeadlinesMenu() {
|
||||||
try {
|
try {
|
||||||
if (dijit.byId("headlinesMenu"))
|
if (dijit.byId("headlinesMenu"))
|
||||||
|
@ -1951,130 +2098,7 @@ function initHeadlinesMenu() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/* if (!isCdmMode())
|
headlinesMenuCommon(menu, false);
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("View article"),
|
|
||||||
onClick: function(event) {
|
|
||||||
view(this.getParent().callerRowId);
|
|
||||||
}})); */
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Open original article"),
|
|
||||||
onClick: function(event) {
|
|
||||||
openArticleInNewWindow(this.getParent().callerRowId);
|
|
||||||
}}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Display article URL"),
|
|
||||||
onClick: function(event) {
|
|
||||||
displayArticleUrl(this.getParent().callerRowId);
|
|
||||||
}}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuSeparator());
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Toggle unread"),
|
|
||||||
onClick: function(event) {
|
|
||||||
var ids = getSelectedArticleIds2();
|
|
||||||
// cast to string
|
|
||||||
var id = this.getParent().callerRowId + "";
|
|
||||||
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
|
||||||
|
|
||||||
selectionToggleUnread(undefined, false, true, ids);
|
|
||||||
}}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Toggle starred"),
|
|
||||||
onClick: function(event) {
|
|
||||||
var ids = getSelectedArticleIds2();
|
|
||||||
// cast to string
|
|
||||||
var id = this.getParent().callerRowId + "";
|
|
||||||
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
|
||||||
|
|
||||||
selectionToggleMarked(undefined, false, true, ids);
|
|
||||||
}}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Toggle published"),
|
|
||||||
onClick: function(event) {
|
|
||||||
var ids = getSelectedArticleIds2();
|
|
||||||
// cast to string
|
|
||||||
var id = this.getParent().callerRowId + "";
|
|
||||||
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
|
||||||
|
|
||||||
selectionTogglePublished(undefined, false, true, ids);
|
|
||||||
}}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuSeparator());
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Mark above as read"),
|
|
||||||
onClick: function(event) {
|
|
||||||
catchupRelativeToArticle(0, this.getParent().callerRowId);
|
|
||||||
}}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuItem({
|
|
||||||
label: __("Mark below as read"),
|
|
||||||
onClick: function(event) {
|
|
||||||
catchupRelativeToArticle(1, this.getParent().callerRowId);
|
|
||||||
}}));
|
|
||||||
|
|
||||||
|
|
||||||
var labels = dijit.byId("feedTree").model.getItemsInCategory(-2);
|
|
||||||
|
|
||||||
if (labels) {
|
|
||||||
|
|
||||||
menu.addChild(new dijit.MenuSeparator());
|
|
||||||
|
|
||||||
var labelAddMenu = new dijit.Menu({ownerMenu: menu});
|
|
||||||
var labelDelMenu = new dijit.Menu({ownerMenu: menu});
|
|
||||||
|
|
||||||
labels.each(function(label) {
|
|
||||||
var id = label.id[0];
|
|
||||||
var bare_id = id.substr(id.indexOf(":")+1);
|
|
||||||
var name = label.name[0];
|
|
||||||
|
|
||||||
bare_id = feed_to_label_id(bare_id);
|
|
||||||
|
|
||||||
labelAddMenu.addChild(new dijit.MenuItem({
|
|
||||||
label: name,
|
|
||||||
labelId: bare_id,
|
|
||||||
onClick: function(event) {
|
|
||||||
var ids = getSelectedArticleIds2();
|
|
||||||
// cast to string
|
|
||||||
var id = this.getParent().ownerMenu.callerRowId + "";
|
|
||||||
|
|
||||||
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
|
||||||
|
|
||||||
selectionAssignLabel(this.labelId, ids);
|
|
||||||
}}));
|
|
||||||
|
|
||||||
labelDelMenu.addChild(new dijit.MenuItem({
|
|
||||||
label: name,
|
|
||||||
labelId: bare_id,
|
|
||||||
onClick: function(event) {
|
|
||||||
var ids = getSelectedArticleIds2();
|
|
||||||
// cast to string
|
|
||||||
var id = this.getParent().ownerMenu.callerRowId + "";
|
|
||||||
|
|
||||||
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
|
|
||||||
|
|
||||||
selectionRemoveLabel(this.labelId, ids);
|
|
||||||
}}));
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
menu.addChild(new dijit.PopupMenuItem({
|
|
||||||
label: __("Assign label"),
|
|
||||||
popup: labelAddMenu,
|
|
||||||
}));
|
|
||||||
|
|
||||||
menu.addChild(new dijit.PopupMenuItem({
|
|
||||||
label: __("Remove label"),
|
|
||||||
popup: labelDelMenu,
|
|
||||||
}));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
menu.startup();
|
menu.startup();
|
||||||
|
|
||||||
|
@ -2252,6 +2276,8 @@ function updateFloatingTitle() {
|
||||||
$("floatingTitle").innerHTML = header.innerHTML;
|
$("floatingTitle").innerHTML = header.innerHTML;
|
||||||
$("floatingTitle").firstChild.innerHTML = "<img class='anchor markedPic' src='images/page_white_go.png' onclick=\"scrollToRowId('"+child.id+"')\">" + $("floatingTitle").firstChild.innerHTML;
|
$("floatingTitle").firstChild.innerHTML = "<img class='anchor markedPic' src='images/page_white_go.png' onclick=\"scrollToRowId('"+child.id+"')\">" + $("floatingTitle").firstChild.innerHTML;
|
||||||
|
|
||||||
|
initFloatingMenu();
|
||||||
|
|
||||||
PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, child);
|
PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue