dijit.byId("headlines-frame").attr('content',
reply['headlines']['content']);
- dijit.byId("headlines-toolbar").attr('content',
- reply['headlines']['toolbar']);
+ //dijit.byId("headlines-toolbar").attr('content',
+ // reply['headlines']['toolbar']);
+
+ dojo.html.set($("headlines-toolbar"),
+ reply['headlines']['toolbar'],
+ {parseContent: true});
$$("#headlines-frame > div[id*=RROW]").each(function(row) {
if (loaded_article_ids.indexOf(row.id) != -1) {
else
request_counters(true);
- } else if (transport.responseText) {
+ } else {
console.error("Invalid object received: " + transport.responseText);
dijit.byId("headlines-frame").attr('content', "<div class='whiteBox'>" +
__('Could not update headlines (invalid object received - see error console for details)') +
"</div>");
- } else {
- //notify_error("Error communicating with server.");
- Element.show(dijit.byId("net-alert").domNode);
}
_infscroll_request_sent = 0;
// return;
// }
- } else if (transport.responseText) {
+ } else {
console.error("Invalid object received: " + transport.responseText);
render_article("<div class='whiteBox'>" +
__('Could not display article (invalid object received - see error console for details)') + "</div>");
- } else {
- Element.show(dijit.byId("net-alert").domNode);
}
var unread_in_buffer = $$("#headlines-frame > div[id*=RROW][class*=Unread]").length
}
}
+ updateFloatingTitle(true);
+
if (rows.length > 0) {
var cmode = "";
}
// 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-", "");
function unpackVisibleHeadlines() {
try {
- if (!isCdmMode()) return;
+ if (!isCdmMode() || !getInitParam("cdm_expanded")) return;
$$("#headlines-frame > div[id*=RROW]").each(
function(child) {
unpackVisibleHeadlines();
// set topmost child in the buffer as active
- if (getInitParam("cdm_auto_catchup") == 1 &&
+ if (isCdmMode() && getInitParam("cdm_auto_catchup") == 1 &&
getSelectedArticleIds2().length <= 1 &&
- (!isCdmMode() || getInitParam("cdm_expanded"))) {
+ getInitParam("cdm_expanded")) {
var rows = $$("#headlines-frame > div[id*=RROW]");
for (var i = 0; i < rows.length; i++) {
var child = rows[i];
- if ($("headlines-frame").scrollTop < child.offsetTop &&
+ if ($("headlines-frame").scrollTop <= child.offsetTop &&
child.offsetTop - $("headlines-frame").scrollTop < 100 &&
child.id.replace("RROW-", "") != _active_article_id) {
if (hsp) hsp.innerHTML = "";
}
- if (getInitParam("cdm_expanded") && isCdmMode()) {
+ if (isCdmMode()) {
updateFloatingTitle();
}
catchup_id_batch.remove(id);
});
+ updateFloatingTitle(true);
+
} });
}
if (event) Event.stop(event);
PluginHost.run(PluginHost.HOOK_ARTICLE_COLLAPSED, id);
+
+ if (row.offsetTop < $("headlines-frame").scrollTop)
+ scrollToRowId(row.id);
+
+ Element.hide("floatingTitle");
+ $("floatingTitle").setAttribute("rowid", false);
}
} catch (e) {
if (data) {
data['info-for-headlines'].each(function(elem) {
- var ctr = $("HLLCTR-" + elem.id);
-
- if (ctr) ctr.innerHTML = elem.labels;
+ $$(".HLLCTR-" + elem.id).each(function(ctr) {
+ ctr.innerHTML = elem.labels;
+ });
});
}
} catch (e) {
if (article_is_unread) {
decrementFeedCounter(getActiveFeedId(), activeFeedIsCat());
+ updateFloatingTitle(true);
}
var query = "?op=rpc&method=catchupSelected" +
dijit.byId("content-insert"));
}
-function initHeadlinesMenu() {
+function initFloatingMenu() {
try {
- if (dijit.byId("headlinesMenu"))
- dijit.byId("headlinesMenu").destroyRecursive();
-
- var ids = [];
+ if (dijit.byId("floatingMenu"))
+ dijit.byId("floatingMenu").destroyRecursive();
- if (!isCdmMode()) {
- nodes = $$("#headlines-frame > div[id*=RROW]");
- } else {
- nodes = $$("#headlines-frame span[id*=RTITLE]");
- }
-
- nodes.each(function(node) {
- ids.push(node.id);
- });
-
- var menu = new dijit.Menu({
- id: "headlinesMenu",
- targetNodeIds: ids,
- });
-
- var tmph = dojo.connect(menu, '_openMyself', function (event) {
- var callerNode = event.target, match = null, tries = 0;
+ var menu = new dijit.Menu({
+ id: "floatingMenu",
+ targetNodeIds: ["floatingTitle"]
+ });
- while (match == null && callerNode && tries <= 3) {
- match = callerNode.id.match("^[A-Z]+[-]([0-9]+)$");
- callerNode = callerNode.parentNode;
- ++tries;
- }
+ var id = $("floatingTitle").getAttribute("rowid").replace("RROW-", "");
- if (match) this.callerRowId = parseInt(match[1]);
+ headlinesMenuCommon(menu, id);
- });
+ menu.startup();
+ } catch (e) {
+ exception_error("initFloatingMenu", e);
+ }
+}
-/* if (!isCdmMode())
- menu.addChild(new dijit.MenuItem({
- label: __("View article"),
- onClick: function(event) {
- view(this.getParent().callerRowId);
- }})); */
+function headlinesMenuCommon(menu, base_id) {
+ try {
menu.addChild(new dijit.MenuItem({
label: __("Open original article"),
onClick: function(event) {
- openArticleInNewWindow(this.getParent().callerRowId);
+ openArticleInNewWindow(base_id ? base_id : this.getParent().callerRowId);
}}));
menu.addChild(new dijit.MenuItem({
label: __("Display article URL"),
onClick: function(event) {
- displayArticleUrl(this.getParent().callerRowId);
+ displayArticleUrl(base_id ? base_id : this.getParent().callerRowId);
}}));
menu.addChild(new dijit.MenuSeparator());
onClick: function(event) {
var ids = getSelectedArticleIds2();
// cast to string
- var id = this.getParent().callerRowId + "";
+ var id = (base_id ? base_id : this.getParent().callerRowId) + "";
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
selectionToggleUnread(undefined, false, true, ids);
onClick: function(event) {
var ids = getSelectedArticleIds2();
// cast to string
- var id = this.getParent().callerRowId + "";
+ var id = (base_id ? base_id : this.getParent().callerRowId) + "";
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
selectionToggleMarked(undefined, false, true, ids);
onClick: function(event) {
var ids = getSelectedArticleIds2();
// cast to string
- var id = this.getParent().callerRowId + "";
+ 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.MenuItem({
label: __("Mark above as read"),
onClick: function(event) {
- catchupRelativeToArticle(0, this.getParent().callerRowId);
+ catchupRelativeToArticle(0, base_id ? base_id : this.getParent().callerRowId);
}}));
menu.addChild(new dijit.MenuItem({
label: __("Mark below as read"),
onClick: function(event) {
- catchupRelativeToArticle(1, this.getParent().callerRowId);
+ catchupRelativeToArticle(1, base_id ? base_id : this.getParent().callerRowId);
}}));
onClick: function(event) {
var ids = getSelectedArticleIds2();
// cast to string
- var id = this.getParent().ownerMenu.callerRowId + "";
+ var id = (base_id ? base_id : this.getParent().ownerMenu.callerRowId) + "";
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
onClick: function(event) {
var ids = getSelectedArticleIds2();
// cast to string
- var id = this.getParent().ownerMenu.callerRowId + "";
+ var id = (base_id ? base_id : this.getParent().ownerMenu.callerRowId) + "";
ids = ids.size() != 0 && ids.indexOf(id) != -1 ? ids : [id];
}
+
+ } catch (e) {
+ exception_error("headlinesMenuCommon", e);
+ }
+}
+
+function initHeadlinesMenu() {
+ try {
+ if (dijit.byId("headlinesMenu"))
+ dijit.byId("headlinesMenu").destroyRecursive();
+
+ var ids = [];
+
+ if (!isCdmMode()) {
+ nodes = $$("#headlines-frame > div[id*=RROW]");
+ } else {
+ nodes = $$("#headlines-frame span[id*=RTITLE]");
+ }
+
+ nodes.each(function(node) {
+ ids.push(node.id);
+ });
+
+ var menu = new dijit.Menu({
+ id: "headlinesMenu",
+ targetNodeIds: ids,
+ });
+
+ var tmph = dojo.connect(menu, '_openMyself', function (event) {
+ var callerNode = event.target, match = null, tries = 0;
+
+ while (match == null && callerNode && tries <= 3) {
+ match = callerNode.id.match("^[A-Z]+[-]([0-9]+)$");
+ callerNode = callerNode.parentNode;
+ ++tries;
+ }
+
+ if (match) this.callerRowId = parseInt(match[1]);
+
+ });
+
+ headlinesMenuCommon(menu, false);
+
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("none");
+ 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);
}
}
}
-function updateFloatingTitle() {
+function updateFloatingTitle(unread_only) {
try {
+ if (!isCdmMode()) return;
+
var hf = $("headlines-frame");
- var child = $("RROW-" + _active_article_id);
var elems = $$("#headlines-frame > div[id*=RROW]");
var header = child.getElementsByClassName("cdmHeader")[0];
- if (child.id != $("floatingTitle").getAttribute("rowid")) {
- $("floatingTitle").setAttribute("rowid", child.id);
- $("floatingTitle").innerHTML = header.innerHTML;
- $("floatingTitle").firstChild.innerHTML = "<img class='anchor markedPic' src='images/page_white_go.png' onclick=\"scrollToRowId('"+child.id+"')\">" + $("floatingTitle").firstChild.innerHTML;
+ if (unread_only || child.id != $("floatingTitle").getAttribute("rowid")) {
+ if (child.id != $("floatingTitle").getAttribute("rowid")) {
+ $("floatingTitle").setAttribute("rowid", child.id);
+ $("floatingTitle").innerHTML = header.innerHTML;
+ $("floatingTitle").firstChild.innerHTML = "<img class='anchor markedPic' src='images/page_white_go.png' onclick=\"scrollToRowId('"+child.id+"')\">" + $("floatingTitle").firstChild.innerHTML;
+
+ initFloatingMenu();
+
+ var cb = $$("#floatingTitle .dijitCheckBox")[0];
+
+ if (cb)
+ cb.parentNode.removeChild(cb);
+ }
+
+ if (child.hasClassName("Unread"))
+ $("floatingTitle").addClassName("Unread");
+ else
+ $("floatingTitle").removeClassName("Unread");
PluginHost.run(PluginHost.HOOK_FLOATING_TITLE, child);
}
- if (child.offsetTop < hf.scrollTop - header.offsetHeight)
+ if (child.offsetTop < hf.scrollTop - header.offsetHeight &&
+ child.offsetTop + child.offsetHeight - hf.scrollTop > header.offsetHeight)
Element.show("floatingTitle");
else
Element.hide("floatingTitle");