|
|
|
@ -241,131 +241,6 @@ const CommonDialogs = {
|
|
|
|
|
|
|
|
|
|
dialog.show();
|
|
|
|
|
},
|
|
|
|
|
feedBrowser: function() {
|
|
|
|
|
const query = {op: "feeds", method: "feedBrowser"};
|
|
|
|
|
|
|
|
|
|
if (dijit.byId("feedAddDlg"))
|
|
|
|
|
dijit.byId("feedAddDlg").hide();
|
|
|
|
|
|
|
|
|
|
if (dijit.byId("feedBrowserDlg"))
|
|
|
|
|
dijit.byId("feedBrowserDlg").destroyRecursive();
|
|
|
|
|
|
|
|
|
|
// noinspection JSUnusedGlobalSymbols
|
|
|
|
|
const dialog = new dijit.Dialog({
|
|
|
|
|
id: "feedBrowserDlg",
|
|
|
|
|
title: __("More Feeds"),
|
|
|
|
|
style: "width: 600px",
|
|
|
|
|
getSelectedFeedIds: function () {
|
|
|
|
|
const list = $$("#browseFeedList li[id*=FBROW]");
|
|
|
|
|
const selected = [];
|
|
|
|
|
|
|
|
|
|
list.each(function (child) {
|
|
|
|
|
const id = child.id.replace("FBROW-", "");
|
|
|
|
|
|
|
|
|
|
if (child.hasClassName('Selected')) {
|
|
|
|
|
selected.push(id);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return selected;
|
|
|
|
|
},
|
|
|
|
|
getSelectedFeeds: function () {
|
|
|
|
|
const list = $$("#browseFeedList li.Selected");
|
|
|
|
|
const selected = [];
|
|
|
|
|
|
|
|
|
|
list.each(function (child) {
|
|
|
|
|
const title = child.getElementsBySelector("span.fb_feedTitle")[0].innerHTML;
|
|
|
|
|
const url = child.getElementsBySelector("a.fb_feedUrl")[0].href;
|
|
|
|
|
|
|
|
|
|
selected.push([title, url]);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return selected;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
subscribe: function () {
|
|
|
|
|
const mode = this.attr('value').mode;
|
|
|
|
|
let selected = [];
|
|
|
|
|
|
|
|
|
|
if (mode == "1")
|
|
|
|
|
selected = this.getSelectedFeeds();
|
|
|
|
|
else
|
|
|
|
|
selected = this.getSelectedFeedIds();
|
|
|
|
|
|
|
|
|
|
if (selected.length > 0) {
|
|
|
|
|
dijit.byId("feedBrowserDlg").hide();
|
|
|
|
|
|
|
|
|
|
Notify.progress("Loading, please wait...", true);
|
|
|
|
|
|
|
|
|
|
const query = {
|
|
|
|
|
op: "rpc", method: "massSubscribe",
|
|
|
|
|
payload: JSON.stringify(selected), mode: mode
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", query, () => {
|
|
|
|
|
Notify.close();
|
|
|
|
|
|
|
|
|
|
if (App.isPrefs())
|
|
|
|
|
dijit.byId("feedTree").reload();
|
|
|
|
|
else
|
|
|
|
|
Feeds.reload();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
alert(__("No feeds selected."));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
update: function () {
|
|
|
|
|
Element.show('feed_browser_spinner');
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", dialog.attr("value"), (transport) => {
|
|
|
|
|
Notify.close();
|
|
|
|
|
|
|
|
|
|
Element.hide('feed_browser_spinner');
|
|
|
|
|
|
|
|
|
|
const reply = JSON.parse(transport.responseText);
|
|
|
|
|
const mode = reply['mode'];
|
|
|
|
|
|
|
|
|
|
if ($("browseFeedList") && reply['content']) {
|
|
|
|
|
$("browseFeedList").innerHTML = reply['content'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dojo.parser.parse("browseFeedList");
|
|
|
|
|
|
|
|
|
|
if (mode == 2) {
|
|
|
|
|
Element.show(dijit.byId('feed_archive_remove').domNode);
|
|
|
|
|
} else {
|
|
|
|
|
Element.hide(dijit.byId('feed_archive_remove').domNode);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
removeFromArchive: function () {
|
|
|
|
|
const selected = this.getSelectedFeedIds();
|
|
|
|
|
|
|
|
|
|
if (selected.length > 0) {
|
|
|
|
|
if (confirm(__("Remove selected feeds from the archive? Feeds with stored articles will not be removed."))) {
|
|
|
|
|
Element.show('feed_browser_spinner');
|
|
|
|
|
|
|
|
|
|
const query = {op: "rpc", method: "remarchive", ids: selected.toString()};
|
|
|
|
|
|
|
|
|
|
xhrPost("backend.php", query, () => {
|
|
|
|
|
dialog.update();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
execute: function () {
|
|
|
|
|
if (this.validate()) {
|
|
|
|
|
this.subscribe();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
href: "backend.php?" + dojo.objectToQuery(query)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
dialog.show();
|
|
|
|
|
},
|
|
|
|
|
addLabel: function(select, callback) {
|
|
|
|
|
const caption = prompt(__("Please enter label caption:"), "");
|
|
|
|
|
|
|
|
|
|