add experimental support for feedlist popup menu

master
Andrew Dolgov 14 years ago
parent 7b5e74c75c
commit 997429c228

@ -2,6 +2,7 @@ dojo.provide("fox.FeedTree");
dojo.provide("fox.FeedStoreModel"); dojo.provide("fox.FeedStoreModel");
dojo.require("dijit.Tree"); dojo.require("dijit.Tree");
dojo.require("dijit.Menu");
dojo.declare("fox.FeedStoreModel", dijit.tree.ForestStoreModel, { dojo.declare("fox.FeedStoreModel", dijit.tree.ForestStoreModel, {
getItemById: function(id) { getItemById: function(id) {
@ -49,6 +50,29 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
if (args.item.icon) if (args.item.icon)
tnode.iconNode.src = args.item.icon[0]; tnode.iconNode.src = args.item.icon[0];
var id = args.item.id[0];
var bare_id = parseInt(id.substr(id.indexOf(':')+1));
if (id.match("FEED:") && bare_id > 0) {
var menu = new dijit.Menu();
menu.row_id = bare_id;
menu.addChild(new dijit.MenuItem({
label: __("Edit feed"),
onClick: function() {
editFeedDlg(this.getParent().row_id);
}}));
menu.addChild(new dijit.MenuItem({
label: __("Update feed"),
onClick: function() {
scheduleFeedUpdate(this.getParent().row_id, false);
}}));
menu.bindDomNode(tnode.domNode);
tnode._menu = menu;
}
//tnode.labelNode.innerHTML = args.label; //tnode.labelNode.innerHTML = args.label;
return tnode; return tnode;
}, },

@ -962,7 +962,7 @@
if ($subop == "scheduleFeedUpdate") { if ($subop == "scheduleFeedUpdate") {
$feed_id = db_escape_string($_REQUEST["id"]); $feed_id = db_escape_string($_REQUEST["id"]);
$is_cat = db_escape_string($_REQUEST['is_cat']); $is_cat = db_escape_string($_REQUEST['is_cat']) == 'true';
$message = __("Your request could not be completed."); $message = __("Your request could not be completed.");

@ -115,11 +115,28 @@ function updateFeedList() {
id: "feedTree", id: "feedTree",
}, "feedTree"); }, "feedTree");
/* var menu = new dijit.Menu({id: 'feedMenu'});
menu.addChild(new dijit.MenuItem({
label: "Simple menu item"
}));
// menu.bindDomNode(tree.domNode); */
var tmph = dojo.connect(dijit.byId('feedMenu'), '_openMyself', function (event) {
console.log(dijit.getEnclosingWidget(event.target));
dojo.disconnect(tmph);
});
$("feeds-holder").appendChild(tree.domNode); $("feeds-holder").appendChild(tree.domNode);
var tmph = dojo.connect(tree, 'onLoad', function() { var tmph = dojo.connect(tree, 'onLoad', function() {
dojo.disconnect(tmph); dojo.disconnect(tmph);
Element.hide("feedlistLoading"); Element.hide("feedlistLoading");
// var node = dijit.byId("feedTree")._itemNodesMap['FEED:-2'][0].domNode
// menu.bindDomNode(node);
loading_set_progress(25); loading_set_progress(25);
}); });
@ -1100,17 +1117,21 @@ function handle_rpc_reply(transport, scheduled_call) {
return true; return true;
} }
function scheduleFeedUpdate() { function scheduleFeedUpdate(id, is_cat) {
try { try {
if (!id) {
id = getActiveFeedId();
is_cat = activeFeedIsCat();
}
if (!getActiveFeedId()) { if (!id) {
alert(__("Please select some feed first.")); alert(__("Please select some feed first."));
return; return;
} }
var query = "?op=rpc&subop=scheduleFeedUpdate&id=" + var query = "?op=rpc&subop=scheduleFeedUpdate&id=" +
param_escape(getActiveFeedId()) + param_escape(id) +
"&is_cat=" + param_escape(activeFeedIsCat()); "&is_cat=" + param_escape(is_cat);
console.log(query); console.log(query);

Loading…
Cancel
Save