]> git.wh0rd.org Git - tt-rss.git/commitdiff
add quick action to edit current feed
authorAndrew Dolgov <fox@madoka.spb.ru>
Wed, 22 Nov 2006 10:11:41 +0000 (11:11 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Wed, 22 Nov 2006 10:11:41 +0000 (11:11 +0100)
feedlist.js
tt-rss.js
tt-rss.php

index 954215fe8ccb60920c51a819b167dbabd527bbc8..53fc4c6e4d9e61f750903d9bc07dae7b81c73e2e 100644 (file)
@@ -176,6 +176,11 @@ function feedlist_init() {
                        correctPNG();
                }
 
+               if (getActiveFeedId()) {
+                       debug("some feed is open on feedlist refresh, reloading");
+                       setTimeout("viewCurrentFeed()", 100);
+               }
+
        } catch (e) {
                exception_error("feedlist/init", e);
        }
index bf673174fc9d6529b9e798b8196bcbdecc204dd0..472c90a6b0fad1c8779b013363decf2b5f479774 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -453,6 +453,10 @@ function quickMenuGo(opid) {
                        displayDlg("quickAddFeed");
                        return;
                }
+
+               if (opid == "qmcEditFeed") {
+                       editFeedDlg(getActiveFeedId());
+               }
        
                if (opid == "qmcRemoveFeed") {
                        var actid = getActiveFeedId();
@@ -596,4 +600,57 @@ function userSwitch() {
        window.location = "tt-rss.php?swu=" + user;
 }
 
+function editFeedDlg(feed) {
+
+       if (!feed) {
+               alert("Please select some feed first.");
+               return;
+       }
+
+       if (xmlhttp_ready(xmlhttp)) {
+               xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=editfeed&id=" +
+                       param_escape(feed), true);
+               xmlhttp.onreadystatechange=infobox_callback;
+               xmlhttp.send(null);
+       } else {
+               printLockingError();
+       }
+}
+
+/* this functions duplicate those of prefs.js feed editor, with
+       some differences because there is no feedlist */
+
+function feedEditCancel() {
+       closeInfoBox();
+       return false;
+}
+
+function feedEditSave() {
+
+       try {
+       
+               if (!xmlhttp_ready(xmlhttp)) {
+                       printLockingError();
+                       return
+               }
+
+               // FIXME: add parameter validation
+
+               var query = Form.serialize("edit_feed_form");
+
+               notify("Saving feed...");
+
+               xmlhttp.open("POST", "backend.php", true);
+               xmlhttp.onreadystatechange=dlg_frefresh_callback;
+               xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+               xmlhttp.send(query);
+
+               closeInfoBox();
+
+               return false;
+
+       } catch (e) {
+               exception_error("feedEditSave (main)", e);
+       } 
+}
 
index 8531c4ca1935b559d49614f6eca0af51fdec3b33..5ad9c00450d88be9bc08f06d790e45552a8c1586 100644 (file)
@@ -134,6 +134,7 @@ window.onload = init;
                                        <option disabled>--------</option>
                                        <option style="color : #5050aa" disabled>Feed actions:</option>
                                        <option value="qmcAddFeed">&nbsp;&nbsp;Subscribe to feed</option>
+                                       <option value="qmcEditFeed">&nbsp;&nbsp;Edit this feed</option>
                                        <option value="qmcRemoveFeed">&nbsp;&nbsp;Unsubscribe</option>
                                        <!-- <option>Edit this feed</option> -->
                                        <option disabled>--------</option>