var active_feed_cat = false;
var active_tab = false;
-var feed_to_expand = false;
var xmlhttp = Ajax.getTransport();
}
}
-function expand_feed_callback() {
- if (xmlhttp.readyState == 4) {
- try {
- var container = document.getElementById("BRDET-" + feed_to_expand);
- container.innerHTML=xmlhttp.responseText;
-// container.style.display = "block";
- Effect.Appear(container, {duration : 0.5});
- notify('');
- } catch (e) {
- exception_error("expand_feed_callback", e);
- }
- }
-}
-
function feedlist_callback() {
if (xmlhttp.readyState == 4) {
- try {
- var container = document.getElementById('prefContent');
- container.innerHTML=xmlhttp.responseText;
- selectTab("feedConfig", true);
-
- if (caller_subop) {
- var tuple = caller_subop.split(":");
- if (tuple[0] == 'editFeed') {
- window.setTimeout('editFeed('+tuple[1]+')', 100);
- }
-
- caller_subop = false;
- }
- if (typeof correctPNG != 'undefined') {
- correctPNG();
- }
- notify("");
- remove_splash();
-
- } catch (e) {
- exception_error("feedlist_callback", e);
- }
+ return feedlist_callback2(xmlhttp);
}
}
-/* stub for subscription dialog */
-
-function dlg_frefresh_callback(transport) {
-
- try {
+function feedlist_callback2(transport) {
+ try {
var container = document.getElementById('prefContent');
container.innerHTML=transport.responseText;
selectTab("feedConfig", true);
correctPNG();
}
notify("");
+ remove_splash();
+
} catch (e) {
- exception_error("feedlist_callback", e);
+ exception_error("feedlist_callback2", e);
}
+}
+
+/* stub for subscription dialog */
+function dlg_frefresh_callback(transport) {
+ return feedlist_callback2(transport);
}
function filterlist_callback() {
}
}
-function labellist_callback() {
+function labellist_callback2(transport) {
try {
var container = document.getElementById('prefContent');
- if (xmlhttp.readyState == 4) {
closeInfoBox();
- container.innerHTML=xmlhttp.responseText;
+ container.innerHTML=transport.responseText;
if (document.getElementById("prefLabelList")) {
var elems = document.getElementById("prefLabelList").getElementsByTagName("SPAN");
}
notify("");
remove_splash();
- }
} catch (e) {
- exception_error("labellist_callback", e);
+ exception_error("labellist_callback2", e);
}
}
}
}
-function infobox_feed_cat_callback() {
- if (xmlhttp.readyState == 4) {
- try {
-
- infobox_callback();
- init_cat_inline_editor();
-
- } catch (e) {
- exception_error("infobox_feed_cat_callback", e);
- }
+function infobox_feed_cat_callback2(transport) {
+ try {
+ infobox_callback2(transport);
+ init_cat_inline_editor();
+ } catch (e) {
+ exception_error("infobox_feed_cat_callback2", e);
}
}
try {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
- var caption = prompt(__("Please enter label caption:"), "");
-
- if (caption == null) {
- return false;
- }
-
- if (caption == "") {
- alert(__("Can't create label: missing caption."));
- return false;
- }
-
- // we can be called from some other tab
- active_tab = "labelConfig";
-
- var query = "caption=" + param_escape(caption);
-
- xmlhttp.open("GET", "backend.php?op=pref-labels&subop=add&" + query, true);
- xmlhttp.onreadystatechange=infobox_submit_callback;
- xmlhttp.send(null);
+ var caption = prompt(__("Please enter label caption:"), "");
+
+ if (caption == null) {
+ return false;
+ }
+
+ if (caption == "") {
+ alert(__("Can't create label: missing caption."));
+ return false;
+ }
+
+ // we can be called from some other tab
+ active_tab = "labelConfig";
+
+ query = "backend.php?op=pref-labels&subop=add&caption=" +
+ param_escape(caption);
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ infobox_submit_callback2(transport);
+ } });
} catch (e) {
exception_error("addLabel", e);
function addFeed() {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
- var link = document.getElementById("fadd_link");
-
- if (link.value.length == 0) {
- alert(__("Error: No feed URL given."));
- } else if (!isValidURL(link.value)) {
- alert(__("Error: Invalid feed URL."));
- } else {
- notify_progress("Adding feed...");
-
- xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&from=tt-rss&feed_url=" +
- param_escape(link.value), true);
- xmlhttp.onreadystatechange=feedlist_callback;
- xmlhttp.send(null);
+ try {
- link.value = "";
+ var link = document.getElementById("fadd_link");
+
+ if (link.value.length == 0) {
+ alert(__("Error: No feed URL given."));
+ } else if (!isValidURL(link.value)) {
+ alert(__("Error: Invalid feed URL."));
+ } else {
+ notify_progress("Adding feed...");
+
+ var query = "backend.php?op=pref-feeds&subop=add&from=tt-rss&feed_url=" +
+ param_escape(link.value);
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ feedlist_callback2(transport);
+ } });
+
+ link.value = "";
+
+ }
+ } catch (e) {
+ exception_error("addFeed", e);
}
}
} 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 = "";
function editUser(id) {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
+ try {
- disableHotkeys();
+ disableHotkeys();
- notify_progress("Loading, please wait...");
+ notify_progress("Loading, please wait...");
- selectTableRowsByIdPrefix('prefUserList', 'UMRR-', 'UMCHK-', false);
- selectTableRowById('UMRR-'+id, 'UMCHK-'+id, true);
+ selectTableRowsByIdPrefix('prefUserList', 'UMRR-', 'UMCHK-', false);
+ selectTableRowById('UMRR-'+id, 'UMCHK-'+id, true);
- disableContainerChildren("userOpToolbar", false);
+ disableContainerChildren("userOpToolbar", false);
- xmlhttp.open("GET", "backend.php?op=pref-users&subop=edit&id=" +
- param_escape(id), true);
- xmlhttp.onreadystatechange=infobox_callback;
- xmlhttp.send(null);
+ var query = "backend.php?op=pref-users&subop=edit&id=" +
+ param_escape(id);
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ infobox_callback2(transport);
+ } });
+ } catch (e) {
+ exception_error("editUser", e);
+ }
+
}
function editFilter(id) {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
+ try {
- disableHotkeys();
+ disableHotkeys();
- notify_progress("Loading, please wait...");
+ notify_progress("Loading, please wait...");
-// document.getElementById("create_filter_btn").disabled = true;
+ disableContainerChildren("filterOpToolbar", false);
- disableContainerChildren("filterOpToolbar", false);
+ selectTableRowsByIdPrefix('prefFilterList', 'FILRR-', 'FICHK-', false);
+ selectTableRowById('FILRR-'+id, 'FICHK-'+id, true);
- selectTableRowsByIdPrefix('prefFilterList', 'FILRR-', 'FICHK-', false);
- selectTableRowById('FILRR-'+id, 'FICHK-'+id, true);
+ var query = "backend.php?op=pref-filters&subop=edit&id=" +
+ param_escape(id);
- xmlhttp.open("GET", "backend.php?op=pref-filters&subop=edit&id=" + param_escape(id), true);
- xmlhttp.onreadystatechange=infobox_callback;
- xmlhttp.send(null);
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ infobox_callback2(transport);
+ } });
+ } catch (e) {
+ exception_error("editFilter", e);
+ }
}
function editFeed(feed) {
-// notify("Editing feed...");
-
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
- disableHotkeys();
-
- notify_progress("Loading, please wait...");
-
-/* document.getElementById("subscribe_to_feed_btn").disabled = true;
-
try {
- document.getElementById("top25_feeds_btn").disabled = true;
- } catch (e) {
- // this button is not always available, no-op if not found
- } */
-
- // clean selection from all rows & select row being edited
- selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
- selectTableRowById('FEEDR-'+feed, 'FRCHK-'+feed, true);
- disableContainerChildren("feedOpToolbar", false);
-
- xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
- param_escape(feed), true);
-
- xmlhttp.onreadystatechange=infobox_callback;
- xmlhttp.send(null);
-
-}
-
-function editFeedCat(cat) {
+ disableHotkeys();
+
+ notify_progress("Loading, please wait...");
+
+ // clean selection from all rows & select row being edited
+ selectTableRowsByIdPrefix('prefFeedList', 'FEEDR-', 'FRCHK-', false);
+ selectTableRowById('FEEDR-'+feed, 'FRCHK-'+feed, true);
+
+ disableContainerChildren("feedOpToolbar", false);
+
+ var query = "backend.php?op=pref-feeds&subop=editfeed&id=" +
+ param_escape(feed);
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ infobox_callback2(transport);
+ } });
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
+ } catch (e) {
+ exception_error("editFeed", e);
}
-
- disableHotkeys();
-
- notify_progress("Loading, please wait...");
-
- active_feed_cat = cat;
-
- xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats&action=edit&id=" +
- param_escape(cat), true);
- xmlhttp.onreadystatechange=infobox_callback;
- xmlhttp.send(null);
-
}
function getSelectedLabels() {
function removeSelectedLabels() {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
var sel_rows = getSelectedLabels();
if (sel_rows.length > 0) {
if (ok) {
notify_progress("Removing selected labels...");
- xmlhttp.open("GET", "backend.php?op=pref-labels&subop=remove&ids="+
- param_escape(sel_rows.toString()), true);
- xmlhttp.onreadystatechange=labellist_callback;
- xmlhttp.send(null);
+ var query = "backend.php?op=pref-labels&subop=remove&ids="+
+ param_escape(sel_rows.toString());
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ labellist_callback2(transport);
+ } });
+
}
} else {
alert(__("No labels are selected."));
function removeSelectedFeeds() {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
- var sel_rows = getSelectedFeeds();
-
- if (sel_rows.length > 0) {
-
- var ok = confirm(__("Unsubscribe from selected feeds?"));
-
- if (ok) {
+ try {
- notify_progress("Unsubscribing from selected feeds...");
+ var sel_rows = getSelectedFeeds();
- xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids="+
- param_escape(sel_rows.toString()), true);
- xmlhttp.onreadystatechange=feedlist_callback;
- xmlhttp.send(null);
+ if (sel_rows.length > 0) {
+
+ var ok = confirm(__("Unsubscribe from selected feeds?"));
+
+ if (ok) {
+
+ notify_progress("Unsubscribing from selected feeds...");
+
+ var query = "backend.php?op=pref-feeds&subop=remove&ids="+
+ param_escape(sel_rows.toString());
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ feedlist_callback2(transport);
+ } });
+ }
+
+ } else {
+ alert(__("No feeds are selected."));
}
- } else {
-
- alert(__("No feeds are selected."));
-
+ } catch (e) {
+ exception_error("removeSelectedFeeds", e);
}
return false;
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 {
return false;
}
-function feedCatEditCancel() {
-
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
- active_feed_cat = false;
-
- try {
- document.getElementById("subscribe_to_feed_btn").disabled = false;
- document.getElementById("top25_feeds_btn").disabled = false;
- } catch (e) {
- // 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_callback;
- xmlhttp.send(null);
-
- return false;
-}
-
function feedEditSave() {
try {
function selectedUserDetails() {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
- var rows = getSelectedUsers();
+ try {
- if (rows.length == 0) {
- alert(__("No users are selected."));
- return;
- }
+ var rows = getSelectedUsers();
+
+ if (rows.length == 0) {
+ alert(__("No users are selected."));
+ return;
+ }
+
+ if (rows.length > 1) {
+ alert(__("Please select only one user."));
+ return;
+ }
+
+ notify_progress("Loading, please wait...");
+
+ var id = rows[0];
+
+ var query = "backend.php?op=pref-users&subop=user-details&id=" + id;
- if (rows.length > 1) {
- alert(__("Please select only one user."));
- return;
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ infobox_callback2(transport);
+ } });
+ } catch (e) {
+ exception_error("selectedUserDetails", e);
}
-
- notify_progress("Loading, please wait...");
-
- 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);
-
}
-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();
function editSelectedFeeds() {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
- var rows = getSelectedFeeds();
-
- if (rows.length == 0) {
- alert(__("No feeds are selected."));
- return;
- }
-
- notify("");
-
- disableHotkeys();
-
- notify_progress("Loading, please wait...");
-
- xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeeds&ids=" +
- param_escape(rows.toString()), true);
-
- xmlhttp.onreadystatechange=infobox_callback;
- xmlhttp.send(null);
-
-}
-
-function editSelectedFeedCat() {
- var rows = getSelectedFeedCats();
+ try {
+ var rows = getSelectedFeeds();
+
+ if (rows.length == 0) {
+ alert(__("No feeds are selected."));
+ return;
+ }
+
+ notify("");
+
+ disableHotkeys();
+
+ notify_progress("Loading, please wait...");
+
+ var query = "backend.php?op=pref-feeds&subop=editfeeds&ids=" +
+ param_escape(rows.toString());
- if (rows.length == 0) {
- alert(__("No categories are selected."));
- return;
- }
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ infobox_callback2(transport);
+ } });
- if (rows.length > 1) {
- alert(__("Please select only one category."));
- return;
+ } catch (e) {
+ exception_error("editSelectedFeeds", e);
}
-
- notify("");
-
- editFeedCat(rows[0]);
-
}
function piggie(enable) {
function updateLabelList(sort_key) {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
+ try {
- var label_search = document.getElementById("label_search");
- var search = "";
- if (label_search) { search = label_search.value; }
+ var label_search = document.getElementById("label_search");
+ var search = "";
+ if (label_search) { search = label_search.value; }
+
+ var query = "backend.php?op=pref-labels&sort=" +
+ param_escape(sort_key) +
+ "&search=" + param_escape(search);
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ labellist_callback2(transport);
+ } });
- xmlhttp.open("GET", "backend.php?op=pref-labels&sort=" +
- param_escape(sort_key) +
- "&search=" + param_escape(search), true);
- xmlhttp.onreadystatechange=labellist_callback;
- xmlhttp.send(null);
+ } catch (e) {
+ exception_error("updateLabelList", e);
+ }
}
function updatePrefsList() {
updatePrefsList();
} else if (id == "userConfig") {
updateUsersList();
- } else if (id == "feedBrowser") {
- updateBigFeedBrowser();
}
}
}
if (!xmlhttp.responseXML) {
- fatalError(3, "[D001, Received reply is not XML]: " + xmlhttp.responseText);
+ fatalError(3, "Sanity Check: Received reply is not XML",
+ xmlhttp.responseText);
return;
}
var reply = xmlhttp.responseXML.firstChild.firstChild;
if (!reply) {
- fatalError(3, "[D002, Invalid RPC reply]: " + xmlhttp.responseText);
+ fatalError(3, "Sanity Check: Invalid RPC reply", xmlhttp.responseText);
return;
}
try {
active_tab = getInitParam("prefs_active_tab");
+ if (!document.getElementById(active_tab+"Tab")) active_tab = "genConfig";
if (!active_tab || active_tab == '0') active_tab = "genConfig";
document.onkeydown = pref_hotkey_handler;
}
-function browseFeeds(limit) {
-
- xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
- xmlhttp.onreadystatechange=infobox_callback;
- xmlhttp.send(null);
-
-}
-
function feedBrowserSubscribe() {
try {
return updateBigFeedBrowser();
}
-function updateBigFeedBrowser(limit, from_button) {
-
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
- var query = "backend.php?op=pref-feed-browser";
-
- var limit_sel = document.getElementById("feedBrowserLimit");
-
- if (limit_sel) {
- var limit = limit_sel[limit_sel.selectedIndex].value;
- query = query + "&limit=" + param_escape(limit);
- }
-
- var search = document.getElementById("feed_browser_search");
-
- if (search) {
- query = query + "&search=" + param_escape(search.value);
- }
-
- xmlhttp.open("GET", query, true);
- xmlhttp.onreadystatechange=feed_browser_callback;
- xmlhttp.send(null);
-}
-
-function browserToggleExpand(id) {
- try {
-/* if (feed_to_expand && feed_to_expand != id) {
- var d = document.getElementById("BRDET-" + feed_to_expand);
- d.style.display = "none";
- } */
-
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
-/* if (feed_to_expand && id != feed_to_expand) {
- Effect.Fade('BRDET-' + feed_to_expand, {duration : 0.5});
- } */
-
- var d = document.getElementById("BRDET-" + id);
-
- notify_progress("Loading, please wait...");
-
- if (Element.visible(d)) {
- Effect.Fade(d, {duration : 0.5});
- } else {
- feed_to_expand = id;
-
- xmlhttp.open("GET", "backend.php?op=pref-feed-browser&subop=details&id="
- + param_escape(id), true);
- xmlhttp.onreadystatechange=expand_feed_callback;
- xmlhttp.send(null);
- }
-
- } catch (e) {
- exception_error("browserToggleExpand", e);
- }
-}
-
function selectPrefRows(kind, select) {
if (kind) {
return false;
}
- if (keycode == 51 && document.getElementById("feedBrowserTab")) { // 3
- selectTab("feedBrowser");
- return false;
- }
-
- if (keycode == 52 && document.getElementById("filterConfigTab")) { // 4
+ if (keycode == 51 && document.getElementById("filterConfigTab")) { // 4
selectTab("filterConfig");
return false;
}
- if (keycode == 53 && document.getElementById("labelConfigTab")) { // 5
+ if (keycode == 52 && document.getElementById("labelConfigTab")) { // 5
selectTab("labelConfig");
return false;
}
- if (keycode == 54 && document.getElementById("userConfigTab")) { // 6
+ if (keycode == 53 && document.getElementById("userConfigTab")) { // 6
selectTab("userConfig");
return false;
}
}
function editFeedCats() {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
- document.getElementById("subscribe_to_feed_btn").disabled = true;
-
try {
- document.getElementById("top25_feeds_btn").disabled = true;
+ document.getElementById("subscribe_to_feed_btn").disabled = true;
+
+ try {
+ document.getElementById("top25_feeds_btn").disabled = true;
+ } catch (e) {
+ // this button is not always available, no-op if not found
+ }
+
+ var query = "backend.php?op=pref-feeds&subop=editCats";
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ infobox_feed_cat_callback2(transport);
+ } });
} catch (e) {
- // this button is not always available, no-op if not found
+ exception_error("editFeedCats", e);
}
-
- xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editCats", true);
- xmlhttp.onreadystatechange=infobox_feed_cat_callback;
- xmlhttp.send(null);
}
function showFeedsWithErrors() {
}
}
-function updateFeedBrowser() {
- alert("FIXME");
-}
-