prefs: some async work (3)
This commit is contained in:
parent
a796bfc18a
commit
60715b53d5
169
prefs.js
169
prefs.js
|
@ -60,7 +60,9 @@ function feedlist_callback() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function feedlist_callback2(transport) {
|
function feedlist_callback2(transport) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
var container = document.getElementById('prefContent');
|
var container = document.getElementById('prefContent');
|
||||||
container.innerHTML=transport.responseText;
|
container.innerHTML=transport.responseText;
|
||||||
selectTab("feedConfig", true);
|
selectTab("feedConfig", true);
|
||||||
|
@ -90,15 +92,20 @@ function dlg_frefresh_callback(transport) {
|
||||||
return feedlist_callback2(transport);
|
return feedlist_callback2(transport);
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterlist_callback() {
|
function filterlist_callback2(transport) {
|
||||||
var container = document.getElementById('prefContent');
|
var container = document.getElementById('prefContent');
|
||||||
|
container.innerHTML=transport.responseText;
|
||||||
|
if (typeof correctPNG != 'undefined') {
|
||||||
|
correctPNG();
|
||||||
|
}
|
||||||
|
notify("");
|
||||||
|
remove_splash();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function filterlist_callback() {
|
||||||
if (xmlhttp.readyState == 4) {
|
if (xmlhttp.readyState == 4) {
|
||||||
container.innerHTML=xmlhttp.responseText;
|
filterlist_callback2(xmlhttp);
|
||||||
if (typeof correctPNG != 'undefined') {
|
|
||||||
correctPNG();
|
|
||||||
}
|
|
||||||
notify("");
|
|
||||||
remove_splash();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,10 +181,14 @@ function gethelp_callback() {
|
||||||
|
|
||||||
function notify_callback() {
|
function notify_callback() {
|
||||||
if (xmlhttp.readyState == 4) {
|
if (xmlhttp.readyState == 4) {
|
||||||
notify_info(xmlhttp.responseText);
|
notify_callback2(xmlhttp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function notify_callback2(transport) {
|
||||||
|
notify_info(transport.responseText);
|
||||||
|
}
|
||||||
|
|
||||||
function prefs_reset_callback() {
|
function prefs_reset_callback() {
|
||||||
if (xmlhttp.readyState == 4) {
|
if (xmlhttp.readyState == 4) {
|
||||||
notify_info(xmlhttp.responseText);
|
notify_info(xmlhttp.responseText);
|
||||||
|
@ -237,10 +248,7 @@ function infobox_feed_cat_callback2(transport) {
|
||||||
|
|
||||||
function updateFeedList(sort_key) {
|
function updateFeedList(sort_key) {
|
||||||
|
|
||||||
if (!xmlhttp_ready(xmlhttp)) {
|
try {
|
||||||
printLockingError();
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var feed_search = document.getElementById("feed_search");
|
var feed_search = document.getElementById("feed_search");
|
||||||
var search = "";
|
var search = "";
|
||||||
|
@ -253,13 +261,18 @@ function updateFeedList(sort_key) {
|
||||||
slat_checked = slat.checked;
|
slat_checked = slat.checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlhttp.open("GET", "backend.php?op=pref-feeds" +
|
var query = "backend.php?op=pref-feeds" +
|
||||||
"&sort=" + param_escape(sort_key) +
|
"&sort=" + param_escape(sort_key) +
|
||||||
"&slat=" + param_escape(slat_checked) +
|
"&slat=" + param_escape(slat_checked) +
|
||||||
"&search=" + param_escape(search), true);
|
"&search=" + param_escape(search);
|
||||||
xmlhttp.onreadystatechange=feedlist_callback;
|
|
||||||
xmlhttp.send(null);
|
|
||||||
|
|
||||||
|
new Ajax.Request(query, {
|
||||||
|
onComplete: function(transport) {
|
||||||
|
feedlist_callback2(transport);
|
||||||
|
} });
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("updateFeedList", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateUsersList(sort_key) {
|
function updateUsersList(sort_key) {
|
||||||
|
@ -616,11 +629,6 @@ function removeSelectedFeeds() {
|
||||||
|
|
||||||
function clearSelectedFeeds() {
|
function clearSelectedFeeds() {
|
||||||
|
|
||||||
if (!xmlhttp_ready(xmlhttp)) {
|
|
||||||
printLockingError();
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var sel_rows = getSelectedFeeds();
|
var sel_rows = getSelectedFeeds();
|
||||||
|
|
||||||
if (sel_rows.length > 1) {
|
if (sel_rows.length > 1) {
|
||||||
|
@ -742,21 +750,17 @@ function feedEditSave() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (!xmlhttp_ready(xmlhttp)) {
|
|
||||||
printLockingError();
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: add parameter validation
|
// FIXME: add parameter validation
|
||||||
|
|
||||||
var query = Form.serialize("edit_feed_form");
|
var query = Form.serialize("edit_feed_form");
|
||||||
|
|
||||||
notify_progress("Saving feed...");
|
notify_progress("Saving feed...");
|
||||||
|
|
||||||
xmlhttp.open("POST", "backend.php", true);
|
new Ajax.Request("backend.php", {
|
||||||
xmlhttp.onreadystatechange=feedlist_callback;
|
parameters: query,
|
||||||
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
onComplete: function(transport) {
|
||||||
xmlhttp.send(query);
|
feedlist_callback2(transport);
|
||||||
|
} });
|
||||||
|
|
||||||
closeInfoBox();
|
closeInfoBox();
|
||||||
|
|
||||||
|
@ -1296,10 +1300,13 @@ function categorizeSelectedFeeds() {
|
||||||
|
|
||||||
notify_progress("Changing category of selected feeds...");
|
notify_progress("Changing category of selected feeds...");
|
||||||
|
|
||||||
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=categorize&ids="+
|
var query = "backend.php?op=pref-feeds&subop=categorize&ids="+
|
||||||
param_escape(sel_rows.toString()) + "&cat_id=" + param_escape(cat_id), true);
|
param_escape(sel_rows.toString()) + "&cat_id=" + param_escape(cat_id);
|
||||||
xmlhttp.onreadystatechange=feedlist_callback;
|
|
||||||
xmlhttp.send(null);
|
new Ajax.Request(query, {
|
||||||
|
onComplete: function(transport) {
|
||||||
|
feedlist_callback2(transport);
|
||||||
|
} });
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -1340,10 +1347,15 @@ function feedBrowserSubscribe() {
|
||||||
|
|
||||||
if (selected.length > 0) {
|
if (selected.length > 0) {
|
||||||
closeInfoBox();
|
closeInfoBox();
|
||||||
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
|
|
||||||
param_escape(selected.toString()), true);
|
var query = "backend.php?op=pref-feeds&subop=massSubscribe&ids="+
|
||||||
xmlhttp.onreadystatechange=feedlist_callback;
|
param_escape(selected.toString());
|
||||||
xmlhttp.send(null);
|
|
||||||
|
new Ajax.Request(query, {
|
||||||
|
onComplete: function(transport) {
|
||||||
|
feedlist_callback2(transport);
|
||||||
|
} });
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
alert(__("No feeds are selected."));
|
alert(__("No feeds are selected."));
|
||||||
}
|
}
|
||||||
|
@ -1866,11 +1878,6 @@ function clearFeedArticles(feed_id) {
|
||||||
|
|
||||||
function rescoreSelectedFeeds() {
|
function rescoreSelectedFeeds() {
|
||||||
|
|
||||||
if (!xmlhttp_ready(xmlhttp)) {
|
|
||||||
printLockingError();
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var sel_rows = getSelectedFeeds();
|
var sel_rows = getSelectedFeeds();
|
||||||
|
|
||||||
if (sel_rows.length > 0) {
|
if (sel_rows.length > 0) {
|
||||||
|
@ -1881,10 +1888,14 @@ function rescoreSelectedFeeds() {
|
||||||
if (ok) {
|
if (ok) {
|
||||||
notify_progress("Rescoring selected feeds...", true);
|
notify_progress("Rescoring selected feeds...", true);
|
||||||
|
|
||||||
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=rescore&quiet=1&ids="+
|
var query = "backend.php?op=pref-feeds&subop=rescore&quiet=1&ids="+
|
||||||
param_escape(sel_rows.toString()), true);
|
param_escape(sel_rows.toString());
|
||||||
xmlhttp.onreadystatechange=notify_callback;
|
|
||||||
xmlhttp.send(null);
|
new Ajax.Request(query, {
|
||||||
|
onComplete: function(transport) {
|
||||||
|
notify_callback2(transport);
|
||||||
|
} });
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
alert(__("No feeds are selected."));
|
alert(__("No feeds are selected."));
|
||||||
|
@ -1894,37 +1905,45 @@ function rescoreSelectedFeeds() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function rescore_all_feeds() {
|
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) {
|
if (ok) {
|
||||||
notify_progress("Rescoring feeds...", true);
|
notify_progress("Rescoring feeds...", true);
|
||||||
|
|
||||||
xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=rescoreAll&quiet=1", true);
|
var query = "backend.php?op=pref-feeds&subop=rescoreAll&quiet=1";
|
||||||
xmlhttp.onreadystatechange=notify_callback;
|
|
||||||
xmlhttp.send(null);
|
new Ajax.Request(query, {
|
||||||
}
|
onComplete: function(transport) {
|
||||||
|
notify_callback2(transport);
|
||||||
|
} });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeFilter(id, title) {
|
function removeFilter(id, title) {
|
||||||
|
|
||||||
if (!xmlhttp_ready(xmlhttp)) {
|
try {
|
||||||
printLockingError();
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
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...");
|
|
||||||
|
|
||||||
xmlhttp.open("GET", "backend.php?op=pref-filters&subop=remove&ids="+
|
var ok = confirm(msg);
|
||||||
param_escape(id), true);
|
|
||||||
xmlhttp.onreadystatechange=filterlist_callback;
|
if (ok) {
|
||||||
xmlhttp.send(null);
|
closeInfoBox();
|
||||||
|
|
||||||
|
notify_progress("Removing filter...");
|
||||||
|
|
||||||
|
var query = "backend.php?op=pref-filters&subop=remove&ids="+
|
||||||
|
param_escape(id);
|
||||||
|
|
||||||
|
new Ajax.Request(query, {
|
||||||
|
onComplete: function(transport) {
|
||||||
|
filterlist_callback2(transport);
|
||||||
|
} });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("removeFilter", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -2005,10 +2024,12 @@ function feedsEditSave() {
|
||||||
|
|
||||||
notify_progress("Saving feeds...");
|
notify_progress("Saving feeds...");
|
||||||
|
|
||||||
xmlhttp.open("POST", "backend.php", true);
|
new Ajax.Request("backend.php", {
|
||||||
xmlhttp.onreadystatechange=feedlist_callback;
|
parameters: query,
|
||||||
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
onComplete: function(transport) {
|
||||||
xmlhttp.send(query);
|
feedlist_callback2(transport);
|
||||||
|
} });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue