move some more shared stuff to CommonDialogs, Filters, and Utils

This commit is contained in:
Andrew Dolgov 2018-12-01 22:39:29 +03:00
parent 4b492cc93e
commit 1e2d4410d3
12 changed files with 502 additions and 495 deletions

View File

@ -174,7 +174,7 @@ class Dlg extends Handler_Protected {
print "<div align='center'>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">".
print "<button dojoType=\"dijit.form.Button\" onclick=\"return CommonDialogs.genUrlChangeKey('$feed_id', '$is_cat')\">".
__('Generate new URL')."</button> ";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">".

View File

@ -765,7 +765,7 @@ class Pref_Feeds extends Handler_Protected {
print "<div class='dlgButtons'>
<div style=\"float : left\">
<button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick='return unsubscribeFeed($feed_id, \"$title\")'>".
<button class=\"btn-danger\" dojoType=\"dijit.form.Button\" onclick='return CommonDialogs.unsubscribeFeed($feed_id, \"$title\")'>".
__('Unsubscribe')."</button>";
print "</div>";
@ -1247,7 +1247,7 @@ class Pref_Feeds extends Handler_Protected {
var bare_id = id.substr(id.indexOf(':')+1);
if (id.match('FEED:')) {
editFeed(bare_id);
CommonDialogs.editFeed(bare_id);
} else if (id.match('CAT:')) {
editCat(bare_id, item);
}
@ -1441,7 +1441,7 @@ class Pref_Feeds extends Handler_Protected {
print "<a class=\"visibleLink\" href=\"#\" ".
"title=\"".__("Click to edit feed")."\" ".
"onclick=\"editFeed(".$line["id"].")\">".
"onclick=\"CommonDialogs.editFeed(".$line["id"].")\">".
htmlspecialchars($line["title"])."</a>";
print "</td><td class=\"insensitive\" align='right'>";
@ -1506,7 +1506,7 @@ class Pref_Feeds extends Handler_Protected {
print "<a class=\"visibleLink\" href=\"#\" ".
"title=\"".__("Click to edit feed")."\" ".
"onclick=\"editFeed(".$line["id"].")\">".
"onclick=\"CommonDialogs.editFeed(".$line["id"].")\">".
htmlspecialchars($line["title"])."</a>: ";
print "<span class=\"insensitive\">";

View File

@ -797,7 +797,7 @@ class Pref_Filters extends Handler_Protected {
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
print "</div></div>";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return quickAddFilter()\">".
print "<button dojoType=\"dijit.form.Button\" onclick=\"return Filters.quickAddFilter()\">".
__('Create filter')."</button> ";
print "<button dojoType=\"dijit.form.Button\" onclick=\"return joinSelectedFilters()\">".
@ -1044,7 +1044,7 @@ class Pref_Filters extends Handler_Protected {
print "<div class=\"dlgSecCont\">";
print "<select name=\"action_id\" dojoType=\"dijit.form.Select\"
onchange=\"filterDlgCheckAction(this)\">";
onchange=\"Filters.filterDlgCheckAction(this)\">";
$res = $this->pdo->query("SELECT id,description FROM ttrss_filter_actions
ORDER BY name");

View File

@ -48,7 +48,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"],
menu.addChild(new dijit.MenuItem({
label: __("Edit feed"),
onClick: function() {
editFeed(this.getParent().row_id, false);
CommonDialogs.editFeed(this.getParent().row_id, false);
}}));
/* menu.addChild(new dijit.MenuItem({

View File

@ -55,13 +55,13 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
menu.addChild(new dijit.MenuItem({
label: __("Edit feed"),
onClick: function() {
editFeed(this.getParent().row_id);
CommonDialogs.editFeed(this.getParent().row_id);
}}));
menu.addChild(new dijit.MenuItem({
label: __("Unsubscribe"),
onClick: function() {
unsubscribeFeed(this.getParent().row_id, this.getParent().item.name);
CommonDialogs.unsubscribeFeed(this.getParent().row_id, this.getParent().item.name);
}}));
menu.bindDomNode(tnode.domNode);

View File

@ -291,7 +291,7 @@ const Utils = {
}
if (k == "daemon_is_running" && v != 1) {
notify_error("<span onclick=\"explainError(1)\">Update daemon is not running.</span>", true);
notify_error("<span onclick=\"Utils.explainError(1)\">Update daemon is not running.</span>", true);
return;
}
@ -306,7 +306,7 @@ const Utils = {
}
if (k == "daemon_stamp_ok" && v != 1) {
notify_error("<span onclick=\"explainError(3)\">Update daemon is not updating feeds.</span>", true);
notify_error("<span onclick=\"Utils.explainError(3)\">Update daemon is not updating feeds.</span>", true);
return;
}
@ -376,7 +376,10 @@ const Utils = {
}
App.initSecondStage();
}
},
explainError: function(code) {
return this.displayDlg(__("Error explained"), "explainError", code);
},
};
const CommonDialogs = {
@ -674,6 +677,97 @@ const CommonDialogs = {
}
});
}
},
unsubscribeFeed: function(feed_id, title) {
const msg = __("Unsubscribe from %s?").replace("%s", title);
if (title == undefined || confirm(msg)) {
notify_progress("Removing feed...");
const query = {op: "pref-feeds", quiet: 1, method: "remove", ids: feed_id};
xhrPost("backend.php", query, (transport) => {
if (dijit.byId("feedEditDlg")) dijit.byId("feedEditDlg").hide();
if (App.isPrefs()) {
Feeds.reload();
} else {
if (feed_id == Feeds.getActiveFeedId())
setTimeout(() => {
Feeds.viewfeed({feed: -5})
},
100);
if (feed_id < 0) Feeds.reload();
}
});
}
return false;
},
editFeed: function (feed) {
if (feed <= 0)
return alert(__("You can't edit this kind of feed."));
const query = {op: "pref-feeds", method: "editfeed", id: feed};
console.log("editFeed", query);
if (dijit.byId("filterEditDlg"))
dijit.byId("filterEditDlg").destroyRecursive();
if (dijit.byId("feedEditDlg"))
dijit.byId("feedEditDlg").destroyRecursive();
const dialog = new dijit.Dialog({
id: "feedEditDlg",
title: __("Edit Feed"),
style: "width: 600px",
execute: function () {
if (this.validate()) {
notify_progress("Saving data...", true);
xhrPost("backend.php", dialog.attr('value'), () => {
dialog.hide();
notify('');
Feeds.reload();
});
}
},
href: "backend.php?" + dojo.objectToQuery(query)
});
dialog.show();
},
genUrlChangeKey: function(feed, is_cat) {
if (confirm(__("Generate new syndication address for this feed?"))) {
notify_progress("Trying to change address...", true);
const query = {op: "pref-feeds", method: "regenFeedKey", id: feed, is_cat: is_cat};
xhrJson("backend.php", query, (reply) => {
const new_link = reply.link;
const e = $('gen_feed_url');
if (new_link) {
e.innerHTML = e.innerHTML.replace(/\&amp;key=.*$/,
"&amp;key=" + new_link);
e.href = e.href.replace(/\&key=.*$/,
"&key=" + new_link);
new Effect.Highlight(e);
notify('');
} else {
notify_error("Could not change feed URL.");
}
});
}
return false;
}
};
@ -994,8 +1088,8 @@ function fatalError(code, msg, ext_info) {
}
// noinspection JSUnusedGlobalSymbols
function filterDlgCheckAction(sender) {
const Filters = {
filterDlgCheckAction: function(sender) {
const action = sender.value;
const action_param = $("filterDlg_paramBox");
@ -1007,7 +1101,7 @@ function filterDlgCheckAction(sender) {
// if selected action supports parameters, enable params field
if (action == 4 || action == 6 || action == 7 || action == 9) {
new Effect.Appear(action_param, {duration : 0.5});
new Effect.Appear(action_param, {duration: 0.5});
Element.hide(dijit.byId("filterDlg_actionParam").domNode);
Element.hide(dijit.byId("filterDlg_actionParamLabel").domNode);
@ -1024,96 +1118,35 @@ function filterDlgCheckAction(sender) {
} else {
Element.hide(action_param);
}
}
function explainError(code) {
return Utils.displayDlg(__("Error explained"), "explainError", code);
}
function strip_tags(s) {
return s.replace(/<\/?[^>]+(>|$)/g, "");
}
// noinspection JSUnusedGlobalSymbols
function uploadIconHandler(rc) {
switch (rc) {
case 0:
notify_info("Upload complete.");
if (App.isPrefs()) {
Feeds.reload();
} else {
setTimeout('Feeds.reload(false, false)', 50);
}
break;
case 1:
notify_error("Upload failed: icon is too big.");
break;
case 2:
notify_error("Upload failed.");
break;
}
}
// noinspection JSUnusedGlobalSymbols
function removeFeedIcon(id) {
if (confirm(__("Remove stored feed icon?"))) {
notify_progress("Removing feed icon...", true);
const query = { op: "pref-feeds", method: "removeicon", feed_id: id };
xhrPost("backend.php", query, (transport) => {
notify_info("Feed icon removed.");
if (App.isPrefs()) {
Feeds.reload();
} else {
setTimeout('Feeds.reload(false, false)', 50);
}
});
}
return false;
}
// noinspection JSUnusedGlobalSymbols
function uploadFeedIcon() {
const file = $("icon_file");
if (file.value.length == 0) {
alert(__("Please select an image file to upload."));
} else if (confirm(__("Upload new icon for this feed?"))) {
notify_progress("Uploading, please wait...", true);
return true;
}
return false;
}
function createNewRuleElement(parentNode, replaceNode) {
},
createNewRuleElement: function(parentNode, replaceNode) {
const form = document.forms["filter_new_rule_form"];
const query = { op: "pref-filters", method: "printrulename", rule: dojo.formToJson(form) };
const query = {op: "pref-filters", method: "printrulename", rule: dojo.formToJson(form)};
xhrPost("backend.php", query, (transport) => {
try {
const li = dojo.create("li");
const cb = dojo.create("input", { type: "checkbox" }, li);
const cb = dojo.create("input", {type: "checkbox"}, li);
new dijit.form.CheckBox({
onChange: function() {
toggleSelectListRow2(this) },
onChange: function () {
toggleSelectListRow2(this)
},
}, cb);
dojo.create("input", { type: "hidden",
dojo.create("input", {
type: "hidden",
name: "rule[]",
value: dojo.formToJson(form) }, li);
value: dojo.formToJson(form)
}, li);
dojo.create("span", {
onclick: function() {
onclick: function () {
dijit.byId('filterEditDlg').editRule(this);
},
innerHTML: transport.responseText }, li);
innerHTML: transport.responseText
}, li);
if (replaceNode) {
parentNode.replaceChild(li, replaceNode);
@ -1124,9 +1157,8 @@ function createNewRuleElement(parentNode, replaceNode) {
exception_error(e);
}
});
}
function createNewActionElement(parentNode, replaceNode) {
},
createNewActionElement: function(parentNode, replaceNode) {
const form = document.forms["filter_new_action_form"];
if (form.action_id.value == 7) {
@ -1135,29 +1167,35 @@ function createNewActionElement(parentNode, replaceNode) {
form.action_param.value = form.action_param_plugin.value;
}
const query = { op: "pref-filters", method: "printactionname",
action: dojo.formToJson(form) };
const query = {
op: "pref-filters", method: "printactionname",
action: dojo.formToJson(form)
};
xhrPost("backend.php", query, (transport) => {
try {
const li = dojo.create("li");
const cb = dojo.create("input", { type: "checkbox" }, li);
const cb = dojo.create("input", {type: "checkbox"}, li);
new dijit.form.CheckBox({
onChange: function() {
toggleSelectListRow2(this) },
onChange: function () {
toggleSelectListRow2(this)
},
}, cb);
dojo.create("input", { type: "hidden",
dojo.create("input", {
type: "hidden",
name: "action[]",
value: dojo.formToJson(form) }, li);
value: dojo.formToJson(form)
}, li);
dojo.create("span", {
onclick: function() {
onclick: function () {
dijit.byId('filterEditDlg').editAction(this);
},
innerHTML: transport.responseText }, li);
innerHTML: transport.responseText
}, li);
if (replaceNode) {
parentNode.replaceChild(li, replaceNode);
@ -1169,10 +1207,8 @@ function createNewActionElement(parentNode, replaceNode) {
exception_error(e);
}
});
}
function addFilterRule(replaceNode, ruleStr) {
},
addFilterRule: function(replaceNode, ruleStr) {
if (dijit.byId("filterNewRuleDlg"))
dijit.byId("filterNewRuleDlg").destroyRecursive();
@ -1183,18 +1219,18 @@ function addFilterRule(replaceNode, ruleStr) {
id: "filterNewRuleDlg",
title: ruleStr ? __("Edit rule") : __("Add rule"),
style: "width: 600px",
execute: function() {
execute: function () {
if (this.validate()) {
createNewRuleElement($("filterDlg_Matches"), replaceNode);
Filters.createNewRuleElement($("filterDlg_Matches"), replaceNode);
this.hide();
}
},
href: query});
href: query
});
rule_dlg.show();
}
function addFilterAction(replaceNode, actionStr) {
},
addFilterAction: function(replaceNode, actionStr) {
if (dijit.byId("filterNewActionDlg"))
dijit.byId("filterNewActionDlg").destroyRecursive();
@ -1205,18 +1241,18 @@ function addFilterAction(replaceNode, actionStr) {
id: "filterNewActionDlg",
title: actionStr ? __("Edit action") : __("Add action"),
style: "width: 600px",
execute: function() {
execute: function () {
if (this.validate()) {
createNewActionElement($("filterDlg_Actions"), replaceNode);
Filters.createNewActionElement($("filterDlg_Actions"), replaceNode);
this.hide();
}
},
href: query});
href: query
});
rule_dlg.show();
}
function editFilterTest(query) {
},
editFilterTest: function(query) {
if (dijit.byId("filterTestDlg"))
dijit.byId("filterTestDlg").destroyRecursive();
@ -1228,7 +1264,7 @@ function editFilterTest(query) {
results: 0,
limit: 100,
max_offset: 10000,
getTestResults: function(query, offset) {
getTestResults: function (query, offset) {
const updquery = query + "&offset=" + offset + "&limit=" + test_dlg.limit;
console.log("getTestResults:" + offset);
@ -1294,24 +1330,25 @@ function editFilterTest(query) {
});
},
href: query});
href: query
});
dojo.connect(test_dlg, "onLoad", null, function(e) {
dojo.connect(test_dlg, "onLoad", null, function (e) {
test_dlg.getTestResults(query, 0);
});
test_dlg.show();
}
function quickAddFilter() {
},
quickAddFilter: function() {
let query;
if (!App.isPrefs()) {
query = { op: "pref-filters", method: "newfilter",
feed: Feeds.getActiveFeedId(), is_cat: Feeds.activeFeedIsCat() };
query = {
op: "pref-filters", method: "newfilter",
feed: Feeds.getActiveFeedId(), is_cat: Feeds.activeFeedIsCat()
};
} else {
query = { op: "pref-filters", method: "newfilter" };
query = {op: "pref-filters", method: "newfilter"};
}
console.log('quickAddFilter', query);
@ -1326,13 +1363,13 @@ function quickAddFilter() {
id: "filterEditDlg",
title: __("Create Filter"),
style: "width: 600px",
test: function() {
test: function () {
const query = "backend.php?" + dojo.formToQuery("filter_new_form") + "&savemode=test";
editFilterTest(query);
Filters.editFilterTest(query);
},
selectRules: function(select) {
$$("#filterDlg_Matches input[type=checkbox]").each(function(e) {
selectRules: function (select) {
$$("#filterDlg_Matches input[type=checkbox]").each(function (e) {
e.checked = select;
if (select)
e.parentNode.addClassName("Selected");
@ -1340,8 +1377,8 @@ function quickAddFilter() {
e.parentNode.removeClassName("Selected");
});
},
selectActions: function(select) {
$$("#filterDlg_Actions input[type=checkbox]").each(function(e) {
selectActions: function (select) {
$$("#filterDlg_Actions input[type=checkbox]").each(function (e) {
e.checked = select;
if (select)
@ -1351,30 +1388,38 @@ function quickAddFilter() {
});
},
editRule: function(e) {
editRule: function (e) {
const li = e.parentNode;
const rule = li.getElementsByTagName("INPUT")[1].value;
addFilterRule(li, rule);
Filters.addFilterRule(li, rule);
},
editAction: function(e) {
editAction: function (e) {
const li = e.parentNode;
const action = li.getElementsByTagName("INPUT")[1].value;
addFilterAction(li, action);
Filters.addFilterAction(li, action);
},
addAction: function() { addFilterAction(); },
addRule: function() { addFilterRule(); },
deleteAction: function() {
$$("#filterDlg_Actions li[class*=Selected]").each(function(e) { e.parentNode.removeChild(e) });
addAction: function () {
Filters.addFilterAction();
},
deleteRule: function() {
$$("#filterDlg_Matches li[class*=Selected]").each(function(e) { e.parentNode.removeChild(e) });
addRule: function () {
Filters.addFilterRule();
},
execute: function() {
deleteAction: function () {
$$("#filterDlg_Actions li[class*=Selected]").each(function (e) {
e.parentNode.removeChild(e)
});
},
deleteRule: function () {
$$("#filterDlg_Matches li[class*=Selected]").each(function (e) {
e.parentNode.removeChild(e)
});
},
execute: function () {
if (this.validate()) {
const query = dojo.formToQuery("filter_new_form");
xhrPost("backend.php", query, (transport) => {
xhrPost("backend.php", query, () => {
if (App.isPrefs()) {
updateFilterList();
}
@ -1383,12 +1428,13 @@ function quickAddFilter() {
});
}
},
href: "backend.php?" + dojo.objectToQuery(query)});
href: "backend.php?" + dojo.objectToQuery(query)
});
if (!App.isPrefs()) {
const selectedText = getSelectionText();
const lh = dojo.connect(dialog, "onLoad", function(){
const lh = dojo.connect(dialog, "onLoad", function () {
dojo.disconnect(lh);
if (selectedText != "") {
@ -1396,13 +1442,13 @@ function quickAddFilter() {
const feed_id = Feeds.activeFeedIsCat() ? 'CAT:' + parseInt(Feeds.getActiveFeedId()) :
Feeds.getActiveFeedId();
const rule = { reg_exp: selectedText, feed_id: [feed_id], filter_type: 1 };
const rule = {reg_exp: selectedText, feed_id: [feed_id], filter_type: 1};
addFilterRule(null, dojo.toJson(rule));
Filters.addFilterRule(null, dojo.toJson(rule));
} else {
const query = { op: "rpc", method: "getlinktitlebyid", id: Article.getActiveArticleId() };
const query = {op: "rpc", method: "getlinktitlebyid", id: Article.getActiveArticleId()};
xhrPost("backend.php", query, (transport) => {
const reply = JSON.parse(transport.responseText);
@ -1418,9 +1464,9 @@ function quickAddFilter() {
const feed_id = Feeds.activeFeedIsCat() ? 'CAT:' + parseInt(Feeds.getActiveFeedId()) :
Feeds.getActiveFeedId();
const rule = { reg_exp: title, feed_id: [feed_id], filter_type: 1 };
const rule = {reg_exp: title, feed_id: [feed_id], filter_type: 1};
addFilterRule(null, dojo.toJson(rule));
Filters.addFilterRule(null, dojo.toJson(rule));
}
});
}
@ -1428,29 +1474,47 @@ function quickAddFilter() {
}
dialog.show();
},
};
}
function unsubscribeFeed(feed_id, title) {
const msg = __("Unsubscribe from %s?").replace("%s", title);
if (title == undefined || confirm(msg)) {
notify_progress("Removing feed...");
const query = { op: "pref-feeds", quiet: 1, method: "remove", ids: feed_id };
xhrPost("backend.php", query, (transport) => {
if (dijit.byId("feedEditDlg")) dijit.byId("feedEditDlg").hide();
/* function strip_tags(s) {
return s.replace(/<\/?[^>]+(>|$)/g, "");
} */
// noinspection JSUnusedGlobalSymbols
function uploadIconHandler(rc) {
switch (rc) {
case 0:
notify_info("Upload complete.");
if (App.isPrefs()) {
Feeds.reload();
} else {
if (feed_id == Feeds.getActiveFeedId())
setTimeout(() => { Feeds.viewfeed({feed:-5}) },
100);
setTimeout('Feeds.reload(false, false)', 50);
}
break;
case 1:
notify_error("Upload failed: icon is too big.");
break;
case 2:
notify_error("Upload failed.");
break;
}
}
if (feed_id < 0) Feeds.reload();
// noinspection JSUnusedGlobalSymbols
function removeFeedIcon(id) {
if (confirm(__("Remove stored feed icon?"))) {
notify_progress("Removing feed icon...", true);
const query = { op: "pref-feeds", method: "removeicon", feed_id: id };
xhrPost("backend.php", query, (transport) => {
notify_info("Feed icon removed.");
if (App.isPrefs()) {
Feeds.reload();
} else {
setTimeout('Feeds.reload(false, false)', 50);
}
});
}
@ -1459,33 +1523,16 @@ function unsubscribeFeed(feed_id, title) {
}
// noinspection JSUnusedGlobalSymbols
function genUrlChangeKey(feed, is_cat) {
if (confirm(__("Generate new syndication address for this feed?"))) {
function uploadFeedIcon() {
const file = $("icon_file");
notify_progress("Trying to change address...", true);
const query = { op: "pref-feeds", method: "regenFeedKey", id: feed, is_cat: is_cat };
xhrJson("backend.php", query, (reply) => {
const new_link = reply.link;
const e = $('gen_feed_url');
if (new_link) {
e.innerHTML = e.innerHTML.replace(/\&amp;key=.*$/,
"&amp;key=" + new_link);
e.href = e.href.replace(/\&key=.*$/,
"&key=" + new_link);
new Effect.Highlight(e);
notify('');
} else {
notify_error("Could not change feed URL.");
}
});
if (file.value.length == 0) {
alert(__("Please select an image file to upload."));
} else if (confirm(__("Upload new icon for this feed?"))) {
notify_progress("Uploading, please wait...", true);
return true;
}
return false;
}
@ -1541,7 +1588,6 @@ function selectTableRows(id, mode) {
}
}
}
}
function getSelectedTableRowIds(id) {
@ -1559,45 +1605,6 @@ function getSelectedTableRowIds(id) {
return rows;
}
function editFeed(feed) {
if (feed <= 0)
return alert(__("You can't edit this kind of feed."));
const query = { op: "pref-feeds", method: "editfeed", id: feed };
console.log("editFeed", query);
if (dijit.byId("filterEditDlg"))
dijit.byId("filterEditDlg").destroyRecursive();
if (dijit.byId("feedEditDlg"))
dijit.byId("feedEditDlg").destroyRecursive();
const dialog = new dijit.Dialog({
id: "feedEditDlg",
title: __("Edit Feed"),
style: "width: 600px",
execute: function() {
if (this.validate()) {
notify_progress("Saving data...", true);
xhrPost("backend.php", dialog.attr('value'), () => {
dialog.hide();
notify('');
Feeds.reload();
});
}
},
href: "backend.php?" + dojo.objectToQuery(query)});
dialog.show();
}
function get_timestamp() {
const date = new Date();
return Math.round(date.getTime() / 1000);
}
// noinspection JSUnusedGlobalSymbols
function label_to_feed_id(label) {
return _label_base_index - 1 - Math.abs(label);

View File

@ -82,7 +82,7 @@ const App = {
const param = getURLParam('methodparam');
window.setTimeout(function () {
editFeed(param)
CommonDialogs.editFeed(param)
}, 100);
}
},
@ -100,7 +100,7 @@ const App = {
CommonDialogs.addLabel();
return false;
case "create_filter":
quickAddFilter();
Filters.quickAddFilter();
return false;
case "help_dialog":
Utils.helpDialog("main");
@ -575,7 +575,7 @@ function editSelectedFeed() {
notify("");
editFeed(rows[0], {});
CommonDialogs.editFeed(rows[0], {});
}

View File

@ -360,7 +360,7 @@ const App = {
if (Feeds.activeFeedIsCat())
alert(__("You can't edit this kind of feed."));
else
editFeed(Feeds.getActiveFeedId());
CommonDialogs.editFeed(Feeds.getActiveFeedId());
};
this.hotkey_actions["feed_catchup"] = function () {
if (Feeds.getActiveFeedId() != undefined) {
@ -424,7 +424,7 @@ const App = {
CommonDialogs.addLabel();
};
this.hotkey_actions["create_filter"] = function () {
quickAddFilter();
Filters.quickAddFilter();
};
this.hotkey_actions["collapse_sidebar"] = function () {
Feeds.viewCurrentFeed();
@ -501,7 +501,7 @@ const App = {
if (Feeds.activeFeedIsCat())
alert(__("You can't edit this kind of feed."));
else
editFeed(Feeds.getActiveFeedId());
CommonDialogs.editFeed(Feeds.getActiveFeedId());
break;
case "qmcRemoveFeed":
var actid = Feeds.getActiveFeedId();
@ -521,7 +521,7 @@ const App = {
var pr = __("Unsubscribe from %s?").replace("%s", fn);
if (confirm(pr)) {
unsubscribeFeed(actid);
CommonDialogs.unsubscribeFeed(actid);
}
break;
case "qmcCatchupAll":

View File

@ -1560,7 +1560,7 @@ const Headlines = {
menu.addChild(new dijit.MenuItem({
label: __("Edit feed"),
onClick: function () {
editFeed(this.getParent().currentTarget.getAttribute("data-feed-id"));
CommonDialogs.editFeed(this.getParent().currentTarget.getAttribute("data-feed-id"));
}
}));

View File

@ -202,7 +202,7 @@ class Af_Psql_Trgm extends Plugin {
print "<li>" .
"<img src='images/pub_set.png'
style='vertical-align : middle'> <a href='#'
onclick='editFeed($f)'>" .
onclick='CommonDialogs.editFeed($f)'>" .
Feeds::getFeedTitle($f) . "</a></li>";
}
print "</ul>";

View File

@ -94,7 +94,7 @@ class Af_Readability extends Plugin {
print "<li>" .
"<img src='images/pub_set.png'
style='vertical-align : middle'> <a href='#'
onclick='editFeed($f)'>".
onclick='CommonDialogs.editFeed($f)'>".
Feeds::getFeedTitle($f) . "</a></li>";
}
print "</ul>";

View File

@ -25,7 +25,7 @@ class BasicTest extends PHPUnit_Extensions_Selenium2TestCase {
public function testBasicDialogs() {
$this->testLogin();
$this->execute(["script" => "quickAddFilter()", "args" => []]);
$this->execute(["script" => "Filters.quickAddFilter()", "args" => []]);
$this->byCssSelector("#filterEditDlg")->displayed();
$this->execute(["script" => "dijit.byId('filterEditDlg').hide();", "args" => []]);