var sanity_check_done = false;
+function infobox_callback() {
+ if (xmlhttp.readyState == 4) {
+ infobox_callback2(xmlhttp);
+ }
+}
+
+function infobox_submit_callback() {
+ if (xmlhttp.readyState == 4) {
+ infobox_submit_callback2(xmlhttp);
+ }
+}
+
+
function replace_pubkey_callback() {
if (xmlhttp.readyState == 4) {
try {
var container = document.getElementById("BRDET-" + feed_to_expand);
container.innerHTML=xmlhttp.responseText;
// container.style.display = "block";
-// p_notify("");
Effect.Appear(container, {duration : 0.5});
} catch (e) {
exception_error("expand_feed_callback", e);
/* stub for subscription dialog */
-function dlg_frefresh_callback() {
- if (xmlhttp.readyState == 4) {
- // setTimeout("updateFeedList()", 500);
+function dlg_frefresh_callback(transport) {
- try {
- var container = document.getElementById('prefContent');
- container.innerHTML=xmlhttp.responseText;
- selectTab("feedConfig", true);
+ try {
+ var container = document.getElementById('prefContent');
+ container.innerHTML=transport.responseText;
+ selectTab("feedConfig", true);
- if (caller_subop) {
- var tuple = caller_subop.split(":");
- if (tuple[0] == 'editFeed') {
- window.setTimeout('editFeed('+tuple[1]+')', 100);
- }
+ 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("");
- } catch (e) {
- exception_error("feedlist_callback", e);
+ caller_subop = false;
}
+ if (typeof correctPNG != 'undefined') {
+ correctPNG();
+ }
+ notify("");
+ } catch (e) {
+ exception_error("feedlist_callback", e);
}
+
}
function filterlist_callback() {
}
}
-function recat_onChange(elem) {
- debug(elem);
-
-}
-
-function recat_onUpdate(ctr) {
- debug(ctr);
-
-}
-
-function infobox_recategorize_callback() {
- if (xmlhttp.readyState == 4) {
- try {
-
- infobox_callback();
-
- var ctr = document.getElementById("prefFeedCatList2");
-
- if (ctr) {
- var elems = ctr.getElementsByTagName("SPAN");
-
- for (var i = 0; i < elems.length; i++) {
- if (elems[i].id && elems[i].id.match("FCATT-")) {
- var cat_id = elems[i].id.replace("FCATT-", "");
-
- new Ajax.InPlaceEditor(elems[i],
- 'backend.php?op=pref-feeds&subop=editCats&action=save&cid=' + cat_id);
- }
- }
-
- elems = ctr.getElementsByTagName("UL");
-
- ctrs = new Array();
- ctr_ids = new Array();
-
- for (var i = 0; i < elems.length; i++) {
- if (elems[i].id.match("FCNTR-")) {
- ctrs.push(elems[i]);
- ctr_ids.push(elems[i].id);
- }
- }
-
- Position.includeScrollOffsets = true;
-
- for (var i = 0; i < ctrs.length; i++) {
- Sortable.create(elems[i], { scroll: ctr, ghosting: false,
- containment: ctrs, dropOnEmpty: true, onChange: recat_onChange, onUpdate: recat_onUpdate });
- }
-
- }
-
- } catch (e) {
- exception_error("infobox_recategorize_callback", e);
- }
- }
-}
-
function updateFeedList(sort_key) {
if (!xmlhttp_ready(xmlhttp)) {
return
}
-// document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
-
-// p_notify("Loading, please wait...");
-
var feed_search = document.getElementById("feed_search");
var search = "";
if (feed_search) { search = feed_search.value; }
return
}
-// document.getElementById("prefContent").innerHTML = "Loading feeds, please wait...";
-
-// p_notify("Loading, please wait...");
-
xmlhttp.open("GET", "backend.php?op=pref-users&sort="
+ param_escape(sort_key), true);
xmlhttp.onreadystatechange=userlist_callback;
return false;
}
+function clearSelectedFeeds() {
+
+ if (!xmlhttp_ready(xmlhttp)) {
+ printLockingError();
+ return
+ }
+
+ var sel_rows = getSelectedFeeds();
+
+ if (sel_rows.length > 1) {
+ alert(__("Please select only one feed."));
+ return;
+ }
+
+ if (sel_rows.length > 0) {
+
+ var ok = confirm(__("Erase all non-starred articles in selected feed?"));
+
+ if (ok) {
+ notify_progress("Clearing selected feed...");
+ clearFeedArticles(sel_rows[0]);
+ }
+
+ } else {
+
+ alert(__("No feeds are selected."));
+
+ }
+
+ return false;
+}
+
+function purgeSelectedFeeds() {
+
+ if (!xmlhttp_ready(xmlhttp)) {
+ printLockingError();
+ return
+ }
+
+ var sel_rows = getSelectedFeeds();
+
+ if (sel_rows.length > 0) {
+
+ var pr = prompt(__("How many days of articles to keep (0 - use default)?"), "0");
+
+ if (pr != undefined) {
+ notify_progress("Purging selected feed...");
+
+ var query = "backend.php?op=rpc&subop=purge&ids="+
+ param_escape(sel_rows.toString()) + "&days=" + pr;
+
+ debug(query);
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ notify('');
+ } });
+ }
+
+ } else {
+
+ alert(__("No feeds are selected."));
+
+ }
+
+ return false;
+}
+
function removeSelectedFeedCats() {
if (!xmlhttp_ready(xmlhttp)) {
return false;
}
-
-
-function displayHelpInfobox(topic_id) {
-
-/* if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
- notify_progress("Loading help...");
-
- xmlhttp.open("GET", "backend.php?op=help&tid=" +
- param_escape(topic_id), true);
-
- xmlhttp.onreadystatechange=helpbox_callback;
- xmlhttp.send(null); */
-
- var url = "backend.php?op=help&tid=" + param_escape(topic_id);
-
- var w = window.open(url, "ttrss_help",
- "status=0,toolbar=0,location=0,width=400,height=450,menubar=0");
-
-}
-
function labelEditCancel() {
if (!xmlhttp_ready(xmlhttp)) {
return
}
-// document.getElementById("prefContent").innerHTML = "Loading filters, please wait...";
-
-// p_notify("Loading, please wait...");
-
xmlhttp.open("GET", "backend.php?op=pref-filters&sort=" +
param_escape(sort_key), true);
xmlhttp.onreadystatechange=filterlist_callback;
return
}
-// p_notify("Loading, please wait...");
-
-// document.getElementById("prefContent").innerHTML = "Loading labels, please wait...";
-
xmlhttp.open("GET", "backend.php?op=pref-labels&sort=" +
param_escape(sort_key), true);
xmlhttp.onreadystatechange=labellist_callback;
return
}
-// p_notify("Loading, please wait...");
-
xmlhttp.open("GET", "backend.php?op=pref-prefs", true);
xmlhttp.onreadystatechange=prefslist_callback;
xmlhttp.send(null);
// clean up all current selections, just in case
active_feed_cat = false;
active_label = false;
-
+
+// Effect.Fade("prefContent", {duration: 1, to: 0.01,
+// queue: { position:'end', scope: 'FEED_TAB', limit: 1 } } );
+
if (id == "feedConfig") {
updateFeedList();
} else if (id == "filterConfig") {
return
}
-// p_notify("Loading, please wait...");
-
var query = "backend.php?op=pref-feed-browser";
var limit_sel = document.getElementById("feedBrowserLimit");
}
}
-function userSwitch() {
- var chooser = document.getElementById("userSwitch");
- var user = chooser[chooser.selectedIndex].value;
- window.location = "prefs.php?swu=" + user;
-}
-
function editFeedCats() {
if (!xmlhttp_ready(xmlhttp)) {
printLockingError();
xmlhttp.send(null);
}
-function recategorizeFeeds() {
- if (!xmlhttp_ready(xmlhttp)) {
- printLockingError();
- return
- }
-
- 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
- }
-
- xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=categorizeDlg", true);
- xmlhttp.onreadystatechange=infobox_recategorize_callback;
- xmlhttp.send(null);
-}
-
function showFeedsWithErrors() {
displayDlg('feedUpdateErrors');
}
return false;
}
+
+function feedActionChange() {
+ try {
+ var chooser = document.getElementById("feedActionChooser");
+ var opid = chooser[chooser.selectedIndex].value;
+
+ chooser.selectedIndex = 0;
+ feedActionGo(opid);
+ } catch (e) {
+ exception_error("feedActionChange", e);
+ }
+}
+
+function feedActionGo(op) {
+ try {
+ if (op == "facEdit") {
+ editSelectedFeed();
+ }
+
+ if (op == "facClear") {
+ clearSelectedFeeds();
+ }
+
+ if (op == "facPurge") {
+ purgeSelectedFeeds();
+ }
+
+ if (op == "facEditCats") {
+ editFeedCats();
+ }
+
+ if (op == "facUnsubscribe") {
+ removeSelectedFeeds();
+ }
+
+ } catch (e) {
+ exception_error("feedActionGo", e);
+
+ }
+}
+
+function clearFeedArticles(feed_id) {
+
+ notify_progress("Clearing feed...");
+
+ var query = "backend.php?op=pref-feeds&quiet=1&subop=clear&id=" + feed_id;
+
+ new Ajax.Request(query, {
+ onComplete: function(transport) {
+ notify('');
+ } });
+
+ return false;
+}
+
+