]> git.wh0rd.org - tt-rss.git/blobdiff - prefs.js
_debug: mention current PID
[tt-rss.git] / prefs.js
index ac07e8f048741bf27d4b8d2fdc1eac87adb96453..56de40ad3dee02512107264fc632f378f46c2b33 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -668,6 +668,74 @@ function removeSelectedFeeds() {
        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)) {
@@ -788,17 +856,6 @@ function feedCatEditSave() {
        return false;
 }
 
-
-
-function displayHelpInfobox(topic_id) {
-
-       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)) {
@@ -1781,3 +1838,59 @@ function validatePrefsSave() {
 
        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;
+}
+
+