}
function feedlist_callback2(transport) {
+
try {
+
var container = document.getElementById('prefContent');
container.innerHTML=transport.responseText;
selectTab("feedConfig", true);
return feedlist_callback2(transport);
}
-function filterlist_callback() {
+function filterlist_callback2(transport) {
var container = document.getElementById('prefContent');
+ container.innerHTML=transport.responseText;
+ if (typeof correctPNG != 'undefined') {
+ correctPNG();
+ }
+ notify("");
+ remove_splash();
+}
+
+
+function filterlist_callback() {
if (xmlhttp.readyState == 4) {
- container.innerHTML=xmlhttp.responseText;
- if (typeof correctPNG != 'undefined') {
- correctPNG();
- }
- notify("");
- remove_splash();
+ filterlist_callback2(xmlhttp);
}
}
function notify_callback() {
if (xmlhttp.readyState == 4) {
- notify_info(xmlhttp.responseText);
+ notify_callback2(xmlhttp);
}
}
+function notify_callback2(transport) {
+ notify_info(transport.responseText);
+}
+
function prefs_reset_callback() {
if (xmlhttp.readyState == 4) {
notify_info(xmlhttp.responseText);
function updateFeedList(sort_key) {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
+ try {
var feed_search = document.getElementById("feed_search");
var search = "";
slat_checked = slat.checked;
}
- xmlhttp.open("GET", "backend.php?op=pref-feeds" +
+ var query = "backend.php?op=pref-feeds" +
"&sort=" + param_escape(sort_key) +
"&slat=" + param_escape(slat_checked) +
- "&search=" + param_escape(search), true);
- xmlhttp.onreadystatechange=feedlist_callback;
- xmlhttp.send(null);
+ "&search=" + param_escape(search);
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ feedlist_callback2(transport);
+ } });
+ } catch (e) {
+ exception_error("updateFeedList", e);
+ }
}
function updateUsersList(sort_key) {
function clearSelectedFeeds() {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
var sel_rows = getSelectedFeeds();
if (sel_rows.length > 1) {
try {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
// FIXME: add parameter validation
var query = Form.serialize("edit_feed_form");
notify_progress("Saving feed...");
- xmlhttp.open("POST", "backend.php", true);
- xmlhttp.onreadystatechange=feedlist_callback;
- xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- xmlhttp.send(query);
+ new Ajax.Request("backend.php", {
+ parameters: query,
+ onComplete: function(transport) {
+ feedlist_callback2(transport);
+ } });
closeInfoBox();
notify_progress("Changing category of selected feeds...");
- xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
- param_escape(sel_rows.toString()) + "&cat_id=" + param_escape(cat_id), true);
- xmlhttp.onreadystatechange=feedlist_callback;
- xmlhttp.send(null);
+ var query = "backend.php?op=pref-feeds&subop=categorize&ids="+
+ param_escape(sel_rows.toString()) + "&cat_id=" + param_escape(cat_id);
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ feedlist_callback2(transport);
+ } });
} else {
if (selected.length > 0) {
closeInfoBox();
- xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
- param_escape(selected.toString()), true);
- xmlhttp.onreadystatechange=feedlist_callback;
- xmlhttp.send(null);
+
+ var query = "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
+ param_escape(selected.toString());
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ feedlist_callback2(transport);
+ } });
+
} else {
alert(__("No feeds are selected."));
}
function rescoreSelectedFeeds() {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
var sel_rows = getSelectedFeeds();
if (sel_rows.length > 0) {
if (ok) {
notify_progress("Rescoring selected feeds...", true);
- xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=rescore&quiet=1&ids="+
- param_escape(sel_rows.toString()), true);
- xmlhttp.onreadystatechange=notify_callback;
- xmlhttp.send(null);
+ var query = "backend.php?op=pref-feeds&subop=rescore&quiet=1&ids="+
+ param_escape(sel_rows.toString());
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ notify_callback2(transport);
+ } });
+
}
} else {
alert(__("No feeds are selected."));
}
function rescore_all_feeds() {
- var ok = confirm(__("Rescore all articles? This operation may take a lot of time."));
+ var ok = confirm(__("Rescore all articles? This operation may take a lot of time."));
- if (ok) {
- notify_progress("Rescoring feeds...", true);
+ if (ok) {
+ notify_progress("Rescoring feeds...", true);
- xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=rescoreAll&quiet=1", true);
- xmlhttp.onreadystatechange=notify_callback;
- xmlhttp.send(null);
- }
+ var query = "backend.php?op=pref-feeds&subop=rescoreAll&quiet=1";
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ notify_callback2(transport);
+ } });
+ }
}
function removeFilter(id, title) {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
+ try {
- var msg = __("Remove filter %s?").replace("%s", title);
+ var msg = __("Remove filter %s?").replace("%s", title);
+
+ var ok = confirm(msg);
+
+ if (ok) {
+ closeInfoBox();
+
+ notify_progress("Removing filter...");
+
+ var query = "backend.php?op=pref-filters&subop=remove&ids="+
+ param_escape(id);
- var ok = confirm(msg);
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ filterlist_callback2(transport);
+ } });
- if (ok) {
- closeInfoBox();
+ }
- notify_progress("Removing filter...");
-
- xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
- param_escape(id), true);
- xmlhttp.onreadystatechange=filterlist_callback;
- xmlhttp.send(null);
+ } catch (e) {
+ exception_error("removeFilter", e);
}
return false;
notify_progress("Saving feeds...");
- xmlhttp.open("POST", "backend.php", true);
- xmlhttp.onreadystatechange=feedlist_callback;
- xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- xmlhttp.send(query);
+ new Ajax.Request("backend.php", {
+ parameters: query,
+ onComplete: function(transport) {
+ feedlist_callback2(transport);
+ } });
+
}
return false;