prefs: some async work

This commit is contained in:
Andrew Dolgov 2009-01-24 07:11:42 +01:00
parent 163723c4e6
commit 350468d018
3 changed files with 106 additions and 135 deletions

View File

@ -2086,4 +2086,23 @@ function updateFeedBrowser() {
}
}
function browseFeeds(limit) {
try {
var query = "backend.php?op=pref-feeds&subop=browse";
notify_progress("Loading, please wait...", true);
new Ajax.Request(query, {
onComplete: function(transport) {
infobox_callback2(transport);
} });
return false;
} catch (e) {
exception_error("browseFeeds", e);
}
}

123
prefs.js
View File

@ -245,16 +245,12 @@ function init_cat_inline_editor() {
}
}
function infobox_feed_cat_callback() {
if (xmlhttp.readyState == 4) {
function infobox_feed_cat_callback2(transport) {
try {
infobox_callback();
infobox_callback2(transport);
init_cat_inline_editor();
} catch (e) {
exception_error("infobox_feed_cat_callback", e);
}
exception_error("infobox_feed_cat_callback2", e);
}
}
@ -379,10 +375,13 @@ function addFeedCat() {
} else {
notify_progress("Adding feed category...");
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=add&cat=" +
param_escape(cat.value), true);
xmlhttp.onreadystatechange=infobox_feed_cat_callback;
xmlhttp.send(null);
var query = "backend.php?op=pref-feeds&subop=editCats&action=add&cat=" +
param_escape(cat.value);
new Ajax.Request(query, {
onComplete: function(transport) {
infobox_feed_cat_callback2(transport);
} });
link.value = "";
@ -716,10 +715,14 @@ function removeSelectedFeedCats() {
if (ok) {
notify_progress("Removing selected categories...");
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=remove&ids="+
param_escape(sel_rows.toString()), true);
xmlhttp.onreadystatechange=infobox_feed_cat_callback;
xmlhttp.send(null);
var query = "backend.php?op=pref-feeds&subop=editCats&action=remove&ids="+
param_escape(sel_rows.toString());
new Ajax.Request(query, {
onComplete: function(transport) {
infobox_feed_cat_callback2(transport);
} });
}
} else {
@ -918,10 +921,7 @@ function resetSelectedUserPass() {
function selectedUserDetails() {
if (!xmlhttp_ready(xmlhttp)) {
printLockingError();
return
}
try {
var rows = getSelectedUsers();
@ -939,41 +939,17 @@ function selectedUserDetails() {
var id = rows[0];
xmlhttp.open("GET", "backend.php?op=pref-users&subop=user-details&id=" + id, true);
xmlhttp.onreadystatechange=infobox_callback;
xmlhttp.send(null);
var query = "backend.php?op=pref-users&subop=user-details&id=" + id;
new Ajax.Request(query, {
onComplete: function(transport) {
infobox_callback2(transport);
} });
} catch (e) {
exception_error("selectedUserDetails", e);
}
}
function selectedFeedDetails() {
if (!xmlhttp_ready(xmlhttp)) {
printLockingError();
return
}
var rows = getSelectedFeeds();
if (rows.length == 0) {
alert(__("No feeds are selected."));
return;
}
if (rows.length > 1) {
alert(__("Please select only one feed."));
return;
}
// var id = rows[0];
notify("");
xmlhttp.open("GET", "backend.php?op=feed-details&id=" +
param_escape(rows.toString()), true);
xmlhttp.onreadystatechange=infobox_callback;
xmlhttp.send(null);
}
function editSelectedFilter() {
var rows = getSelectedFilters();
@ -1016,11 +992,7 @@ function editSelectedFeed() {
function editSelectedFeeds() {
if (!xmlhttp_ready(xmlhttp)) {
printLockingError();
return
}
try {
var rows = getSelectedFeeds();
if (rows.length == 0) {
@ -1034,12 +1006,17 @@ function editSelectedFeeds() {
notify_progress("Loading, please wait...");
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeeds&ids=" +
param_escape(rows.toString()), true);
var query = "backend.php?op=pref-feeds&subop=editfeeds&ids=" +
param_escape(rows.toString());
xmlhttp.onreadystatechange=infobox_callback;
xmlhttp.send(null);
new Ajax.Request(query, {
onComplete: function(transport) {
infobox_callback2(transport);
} });
} catch (e) {
exception_error("editSelectedFeeds", e);
}
}
function piggie(enable) {
@ -1369,14 +1346,6 @@ function validatePrefsReset() {
}
function browseFeeds(limit) {
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
xmlhttp.onreadystatechange=infobox_callback;
xmlhttp.send(null);
}
function feedBrowserSubscribe() {
try {
@ -1669,11 +1638,7 @@ function pref_hotkey_handler(e) {
}
function editFeedCats() {
if (!xmlhttp_ready(xmlhttp)) {
printLockingError();
return
}
try {
document.getElementById("subscribe_to_feed_btn").disabled = true;
try {
@ -1682,9 +1647,15 @@ function editFeedCats() {
// this button is not always available, no-op if not found
}
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats", true);
xmlhttp.onreadystatechange=infobox_feed_cat_callback;
xmlhttp.send(null);
var query = "backend.php?op=pref-feeds&subop=editCats";
new Ajax.Request(query, {
onComplete: function(transport) {
infobox_feed_cat_callback2(transport);
} });
} catch (e) {
exception_error("editFeedCats", e);
}
}
function showFeedsWithErrors() {

View File

@ -1423,25 +1423,6 @@ function visitOfficialSite() {
window.open("http://tt-rss.org/");
}
function browseFeeds(limit) {
try {
var query = "backend.php?op=pref-feeds&subop=browse";
notify_progress("Loading, please wait...", true);
new Ajax.Request(query, {
onComplete: function(transport) {
infobox_callback2(transport);
} });
return false;
} catch (e) {
exception_error("browseFeeds", e);
}
}
function feedBrowserSubscribe() {
try {