prefs: some async work (4)

master
Andrew Dolgov 16 years ago
parent 60715b53d5
commit 23e51f4092

@ -53,12 +53,6 @@ function replace_pubkey_callback() {
} }
} }
function feedlist_callback() {
if (xmlhttp.readyState == 4) {
return feedlist_callback2(xmlhttp);
}
}
function feedlist_callback2(transport) { function feedlist_callback2(transport) {
try { try {
@ -102,13 +96,6 @@ function filterlist_callback2(transport) {
remove_splash(); remove_splash();
} }
function filterlist_callback() {
if (xmlhttp.readyState == 4) {
filterlist_callback2(xmlhttp);
}
}
function labellist_callback2(transport) { function labellist_callback2(transport) {
try { try {
@ -566,10 +553,7 @@ function removeSelectedUsers() {
function removeSelectedFilters() { function removeSelectedFilters() {
if (!xmlhttp_ready(xmlhttp)) { try {
printLockingError();
return
}
var sel_rows = getSelectedFilters(); var sel_rows = getSelectedFilters();
@ -580,15 +564,23 @@ function removeSelectedFilters() {
if (ok) { if (ok) {
notify_progress("Removing selected filters..."); notify_progress("Removing selected filters...");
xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+ var query = "backend.php?op=pref-filters&subop=remove&ids="+
param_escape(sel_rows.toString()), true); param_escape(sel_rows.toString());
xmlhttp.onreadystatechange=filterlist_callback;
xmlhttp.send(null); new Ajax.Request(query, {
onComplete: function(transport) {
filterlist_callback2(transport);
} });
} }
} else { } else {
alert(__("No filters are selected.")); alert(__("No filters are selected."));
} }
} catch (e) {
exception_error("removeSelectedFilters", e);
}
return false; return false;
} }
@ -831,31 +823,24 @@ function userEditSave() {
function filterEditSave() { function filterEditSave() {
if (!xmlhttp_ready(xmlhttp)) { try {
printLockingError();
return
}
/* if (!is_opera()) {
var reg_exp = document.forms["filter_edit_form"].reg_exp.value;
if (reg_exp.length == 0) {
alert("Filter expression field cannot be blank.");
return;
}
} */
notify_progress("Saving filter..."); notify_progress("Saving filter...");
var query = Form.serialize("filter_edit_form"); var query = "backend.php?" + Form.serialize("filter_edit_form");
closeInfoBox(); closeInfoBox();
document.getElementById("create_filter_btn").disabled = false; document.getElementById("create_filter_btn").disabled = false;
xmlhttp.open("GET", "backend.php?" + query, true); new Ajax.Request(query, {
xmlhttp.onreadystatechange=filterlist_callback; onComplete: function(transport) {
xmlhttp.send(null); filterlist_callback2(transport);
} });
} catch (e) {
exception_error("filterEditSave", e);
}
return false; return false;
} }
@ -1031,21 +1016,24 @@ function validateOpmlImport() {
} }
function updateFilterList(sort_key) { function updateFilterList(sort_key) {
try {
if (!xmlhttp_ready(xmlhttp)) {
printLockingError();
return
}
var filter_search = document.getElementById("filter_search"); var filter_search = document.getElementById("filter_search");
var search = ""; var search = "";
if (filter_search) { search = filter_search.value; } if (filter_search) { search = filter_search.value; }
xmlhttp.open("GET", "backend.php?op=pref-filters&sort=" + var query = "backend.php?op=pref-filters&sort=" +
param_escape(sort_key) + param_escape(sort_key) +
"&search=" + param_escape(search), true); "&search=" + param_escape(search);
xmlhttp.onreadystatechange=filterlist_callback;
xmlhttp.send(null); new Ajax.Request(query, {
onComplete: function(transport) {
filterlist_callback2(transport);
} });
} catch (e) {
exception_error("updateFilterList", e);
}
} }
@ -1951,10 +1939,7 @@ function removeFilter(id, title) {
function unsubscribeFeed(id, title) { function unsubscribeFeed(id, title) {
if (!xmlhttp_ready(xmlhttp)) { try {
printLockingError();
return
}
var msg = __("Unsubscribe from %s?").replace("%s", title); var msg = __("Unsubscribe from %s?").replace("%s", title);
@ -1965,13 +1950,18 @@ function unsubscribeFeed(id, title) {
notify_progress("Removing feed..."); notify_progress("Removing feed...");
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+ var query = "backend.php?op=pref-feeds&subop=remove&ids="+
param_escape(id), true); param_escape(id);
xmlhttp.onreadystatechange=filterlist_callback;
xmlhttp.send(null); new Ajax.Request(query, {
onComplete: function(transport) {
feedlist_callback2(transport);
} });
} }
return false; } catch (e) {
exception_error("unsubscribeFeed", e);
}
return false; return false;

Loading…
Cancel
Save