let search = "";
if (user_search) { search = user_search.value; }
- new Ajax.Request("backend.php", {
- parameters: "?op=pref-feeds&search=" + param_escape(search),
- onComplete: function(transport) {
- dijit.byId('feedConfigTab').attr('content', transport.responseText);
- selectTab("feedConfig", true);
- notify("");
- } });
+ xhrPost("backend.php", { op: "pref-feeds", search: search }, (transport) => {
+ dijit.byId('feedConfigTab').attr('content', transport.responseText);
+ selectTab("feedConfig", true);
+ notify("");
+ });
}
function checkInactiveFeeds() {
- new Ajax.Request("backend.php", {
- parameters: "?op=pref-feeds&method=getinactivefeeds",
- onComplete: function (transport) {
- if (parseInt(transport.responseText) > 0) {
- Element.show(dijit.byId("pref_feeds_inactive_btn").domNode);
- }
+ xhrPost("backend.php", { op: "pref-feeds", method: "getinactivefeeds" }, (transport) => {
+ if (parseInt(transport.responseText) > 0) {
+ Element.show(dijit.byId("pref_feeds_inactive_btn").domNode);
}
});
}
function updateUsersList(sort_key) {
const user_search = $("user_search");
- let search = "";
- if (user_search) {
- search = user_search.value;
- }
+ const search = user_search ? user_search.value : "";
- const query = "?op=pref-users&sort=" +
- param_escape(sort_key) +
- "&search=" + param_escape(search);
+ const query = { op: "pref-users", sort: sort_key, search: search };
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- dijit.byId('userConfigTab').attr('content', transport.responseText);
- selectTab("userConfig", true)
- notify("");
- }
+ xhrPost("backend.php", query, (transport) => {
+ dijit.byId('userConfigTab').attr('content', transport.responseText);
+ selectTab("userConfig", true)
+ notify("");
});
}
notify_progress("Adding user...");
- const query = "?op=pref-users&method=add&login=" +
- param_escape(login);
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- notify_callback2(transport);
- updateUsersList();
- }
- });
+ xhrPost("backend.php", { op: "pref-users", method: "add", login: login }, (transport) => {
+ notify_callback2(transport);
+ updateUsersList();
+ });
}
if (this.validate()) {
notify_progress("Saving data...", true);
- const query = dojo.formToQuery("user_edit_form");
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- dialog.hide();
- updateUsersList();
- }
- });
+ xhrPost("backend.php", dojo.formToObject("user_edit_form"), (transport) => {
+ dialog.hide();
+ updateUsersList();
+ });
}
},
href: query
notify_progress("Removing filter...");
- const id = this.attr('value').id;
-
- const query = "?op=pref-filters&method=remove&ids=" +
- param_escape(id);
+ const query = { op: "pref-filters", method: "remove", ids: this.attr('value').id };
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- updateFilterList();
- }
+ xhrPost("backend.php", query, () => {
+ updateFilterList();
});
}
},
notify_progress("Saving data...", true);
- const query = dojo.formToQuery("filter_edit_form");
-
- console.log(query);
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- dialog.hide();
- updateFilterList();
- }
+ xhrPost("backend.php", dojo.formToObject("filter_edit_form"), () => {
+ dialog.hide();
+ updateFilterList();
});
}
},
if (ok) {
notify_progress("Removing selected labels...");
- const query = "?op=pref-labels&method=remove&ids="+
- param_escape(sel_rows.toString());
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function(transport) {
- updateLabelList();
- } });
+ const query = { op: "pref-labels", method: "remove",
+ ids: sel_rows.toString() };
+ xhrPost("backend.php", query, () => {
+ updateLabelList();
+ });
}
} else {
alert(__("No labels are selected."));
if (ok) {
notify_progress("Removing selected users...");
- const query = "?op=pref-users&method=remove&ids=" +
- param_escape(sel_rows.toString());
+ const query = { op: "pref-users", method: "remove",
+ ids: sel_rows.toString() };
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- updateUsersList();
- }
+ xhrPost("backend.php", query, () => {
+ updateUsersList();
});
-
}
} else {
if (ok) {
notify_progress("Removing selected filters...");
- const query = "?op=pref-filters&method=remove&ids=" +
- param_escape(sel_rows.toString());
+ const query = { op: "pref-filters", method: "remove",
+ ids: sel_rows.toString() };
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- updateFilterList();
- }
+ xhrPost("backend.php", query, () => {
+ updateFilterList();
});
}
} else {
notify_progress("Unsubscribing from selected feeds...", true);
- const query = "?op=pref-feeds&method=remove&ids=" +
- param_escape(sel_rows.toString());
-
- console.log(query);
+ const query = { op: "pref-feeds", method: "remove",
+ ids: sel_rows.toString() };
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- updateFeedList();
- }
+ xhrPost("backend.php", query, () => {
+ updateFeedList();
});
}
const id = rows[0];
- const query = "?op=pref-users&method=resetPass&id=" +
- param_escape(id);
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- notify_info(transport.responseText, true);
- }
+ xhrPost("backend.php", { op: "pref-users", method: "resetPass", id: id }, (transport) => {
+ notify_info(transport.responseText, true);
});
}
return;
}
- const id = rows[0];
-
- const query = "backend.php?op=pref-users&method=userdetails&id=" + id;
+ const query = "backend.php?op=pref-users&method=userdetails&id=" + param_escape(rows[0]);
if (dijit.byId("userDetailsDlg"))
dijit.byId("userDetailsDlg").destroyRecursive();
if (ok) {
notify_progress("Joining filters...");
- const query = "?op=pref-filters&method=join&ids="+
- param_escape(rows.toString());
-
- console.log(query);
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function(transport) {
- updateFilterList();
- } });
+ xhrPost("backend.php", { op: "pref-filters", method: "join", ids: rows.toString() }, () => {
+ updateFilterList();
+ });
}
}
},
execute: function () {
if (this.validate() && confirm(__("Save changes to selected feeds?"))) {
- let query = dojo.objectToQuery(this.attr('value'));
+ const query = this.attr('value');
+
+ //console.log(query); return;
/* Form.serialize ignores unchecked checkboxes */
- if (!query.match("&private=") &&
+ /*if (!query.match("&private=") &&
this.getChildByName('private').attr('disabled') == false) {
- query = query + "&private=false";
+ query.private = "false";
}
try {
if (!query.match("&cache_images=") &&
this.getChildByName('cache_images').attr('disabled') == false) {
- query = query + "&cache_images=false";
+ query.cache_images = "false";
}
} catch (e) {
}
try {
if (!query.match("&hide_images=") &&
this.getChildByName('hide_images').attr('disabled') == false) {
- query = query + "&hide_images=false";
+ query.hide_images = "false";
}
} catch (e) {
}
if (!query.match("&include_in_digest=") &&
this.getChildByName('include_in_digest').attr('disabled') == false) {
- query = query + "&include_in_digest=false";
+ query.include_in_digest = "false";
}
if (!query.match("&always_display_enclosures=") &&
this.getChildByName('always_display_enclosures').attr('disabled') == false) {
- query = query + "&always_display_enclosures=false";
+ query.always_display_enclosures = "false";
}
if (!query.match("&mark_unread_on_update=") &&
this.getChildByName('mark_unread_on_update').attr('disabled') == false) {
- query = query + "&mark_unread_on_update=false";
- }
-
- console.log(query);
+ query.mark_unread_on_update = "false";
+ }*/
notify_progress("Saving data...", true);
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- dialog.hide();
- updateFeedList();
- }
+ xhrPost("backend.php", query, () => {
+ dialog.hide();
+ updateFeedList();
});
}
},
if (ok) {
notify_progress("Removing selected profiles...", true);
- const query = "?op=rpc&method=remprofiles&ids=" +
- param_escape(sel_rows.toString());
+ const query = { op: "rpc", method: "remprofiles",
+ ids: sel_rows.toString() };
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- notify('');
- editProfiles();
- }
+ xhrPost("backend.php", query, () => {
+ notify('');
+ editProfiles();
});
-
}
} else {
if (ok) {
notify_progress("Loading, please wait...");
- const query = "?op=rpc&method=setprofile&id=" +
- param_escape(sel_rows.toString());
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- window.location.reload();
- }
- });
+ xhrPost("backend.php", { op: "rpc", method: "setprofile", id: sel_rows.toString() }, () => {
+ window.location.reload();
+ });
}
} else {
if (this.validate()) {
notify_progress("Creating profile...", true);
- const query = "?op=rpc&method=addprofile&title=" +
- param_escape(dialog.attr('value').newprofile);
+ const query = { op: "rpc", method: "addprofile", title: dialog.attr('value').newprofile };
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- notify('');
- editProfiles();
- }
+ xhrPost("backend.php", query, () => {
+ notify('');
+ editProfiles();
});
}
dialog.show();
}
+/*
function activatePrefProfile() {
const sel_rows = getSelectedFeedCats();
if (ok) {
notify_progress("Loading, please wait...");
- const query = "?op=rpc&method=setprofile&id="+
- param_escape(sel_rows.toString());
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function(transport) {
- window.location.reload();
- } });
+ xhrPost("backend.php", { op: "rpc", method: "setprofile", id: sel_rows.toString() }, () => {
+ window.location.reload();
+ });
}
} else {
}
return false;
-}
+} */
function clearFeedAccessKeys() {
if (ok) {
notify_progress("Clearing URLs...");
- const query = "?op=pref-feeds&method=clearKeys";
-
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function(transport) {
- notify_info("Generated URLs cleared.");
- } });
+ xhrPost("backend.php", { op: "pref-feeds", method: "clearKeys" }, () => {
+ notify_info("Generated URLs cleared.");
+ });
}
return false;
function resetFilterOrder() {
notify_progress("Loading, please wait...");
- new Ajax.Request("backend.php", {
- parameters: "?op=pref-filters&method=filtersortreset",
- onComplete: function (transport) {
- updateFilterList();
- }
- });
+ xhrPost("backend.php", { op: "pref-filters", method: "filtersortreset" }, () => {
+ updateFilterList();
+ });
}
function resetFeedOrder() {
notify_progress("Loading, please wait...");
- new Ajax.Request("backend.php", {
- parameters: "?op=pref-feeds&method=feedsortreset",
- onComplete: function (transport) {
- updateFeedList();
- }
- });
+ xhrPost("backend.php", { op: "pref-feeds", method: "feedsortreset" }, () => {
+ updateFeedList();
+ });
}
function resetCatOrder() {
notify_progress("Loading, please wait...");
- new Ajax.Request("backend.php", {
- parameters: "?op=pref-feeds&method=catsortreset",
- onComplete: function (transport) {
- updateFeedList();
- }
+ xhrPost("backend.php", { op: "pref-feeds", method: "catsortreset" }, () => {
+ updateFeedList();
});
}
notify_progress("Loading, please wait...");
- new Ajax.Request("backend.php", {
- parameters: {
- op: 'pref-feeds',
- method: 'renamecat',
- id: id,
- title: new_name,
- },
- onComplete: function (transport) {
- updateFeedList();
- }
+ xhrPost("backend.php", { op: 'pref-feeds', method: 'renamecat', id: id, title: new_name }, () => {
+ updateFeedList();
});
}
}
color = bg;
}
- const query = "?op=pref-labels&method=colorset&kind=" + kind +
- "&ids=" + param_escape(id) + "&fg=" + param_escape(fg) +
- "&bg=" + param_escape(bg) + "&color=" + param_escape(color);
-
- // console.log(query);
-
const e = $("LICID-" + id);
if (e) {
if (bg) e.style.backgroundColor = bg;
}
- new Ajax.Request("backend.php", {parameters: query});
+ const query = { op: "pref-labels", method: "colorset", kind: kind,
+ ids: id, fg: fg, bg: bg, color: color };
+
+ xhrPost("backend.php", query, () => {
+ updateFilterList(); // maybe there's labels in there
+ });
- updateFilterList();
},
execute: function () {
if (this.validate()) {
const caption = this.attr('value').caption;
const fg_color = this.attr('value').fg_color;
const bg_color = this.attr('value').bg_color;
- const query = dojo.objectToQuery(this.attr('value'));
dijit.byId('labelTree').setNameById(id, caption);
this.setLabelColor(id, fg_color, bg_color);
this.hide();
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function (transport) {
- updateFilterList();
- }
+ xhrPost("backend.php", this.attr('value'), () => {
+ updateFilterList(); // maybe there's labels in there
});
}
},
style: "width: 600px",
execute: function () {
notify_progress('Saving data...', true);
- new Ajax.Request("backend.php", {
- parameters: dojo.objectToQuery(this.attr('value')),
- onComplete: function (transport) {
- notify('');
- window.location.reload();
- }
+
+ xhrPost("backend.php", this.attr('value'), () => {
+ window.location.reload();
});
},
style: "width: 600px",
execute: function () {
if (this.validate()) {
- console.log(dojo.objectToQuery(this.attr('value')));
-
notify_progress(__("Subscribing to feeds..."), true);
- new Ajax.Request("backend.php", {
- parameters: dojo.objectToQuery(this.attr('value')),
- onComplete: function (transport) {
- notify("");
- updateFeedList();
- dialog.hide();
- }
+ xhrPost("backend.php", this.attr('value'), () => {
+ notify("");
+ updateFeedList();
+ dialog.hide();
});
}
},
if (confirm(__("Clear stored data for this plugin?"))) {
notify_progress("Loading, please wait...");
- new Ajax.Request("backend.php", {
- parameters: "?op=pref-prefs&method=clearplugindata&name=" + param_escape(name),
- onComplete: function(transport) {
- notify('');
- updatePrefsList();
- } });
+ xhrPost("backend.php", { op: "pref-prefs", method: "clearplugindata", name: name }, () => {
+ notify('');
+ updatePrefsList();
+ });
}
}
if (confirm(__("Clear all messages in the error log?"))) {
notify_progress("Loading, please wait...");
- const query = "?op=pref-system&method=clearLog";
- new Ajax.Request("backend.php", {
- parameters: query,
- onComplete: function(transport) {
- updateSystemList();
- } });
+ xhrPost("backend.php", { op: "pref-system", method: "clearLog" }, () => {
+ updateSystemList();
+ });
}
}