]> git.wh0rd.org Git - tt-rss.git/commitdiff
add dialogue to remove current feed, overall quick meny improvements (shamelessly...
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 28 Oct 2005 06:21:16 +0000 (07:21 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 28 Oct 2005 06:21:16 +0000 (07:21 +0100)
backend.php
tt-rss.js
tt-rss.php

index 6937a9af4608e9cc21b1cbb491ba0af08dae64d0..07f6028ed37ea2cc06b32e4ac3d81129fc08d1cf 100644 (file)
 
        if ($op == "dlg") {
                $id = $_GET["id"];
+               $param = $_GET["param"];
 
                if ($id == "quickAddFeed") {
                        print "Feed URL: <input id=\"qafInput\">
                                type=\"submit\" onclick=\"javascript:closeDlg()\" 
                                value=\"Cancel\">";
                }
+
+               if ($id == "quickDelFeed") {
+
+                       $param = db_escape_string($param);
+
+                       $result = db_query($link, "SELECT title FROM ttrss_feeds WHERE id = '$param'");
+
+                       if ($result) {
+
+                               $f_title = db_fetch_result($result, 0, "title");
+               
+                               print "Remove current feed ($f_title)?&nbsp;
+                               <input class=\"button\"
+                                       type=\"submit\" onclick=\"javascript:qfdDelete($param)\" value=\"Remove\">
+                               <input class=\"button\"
+                                       type=\"submit\" onclick=\"javascript:closeDlg()\" 
+                                       value=\"Cancel\">";
+                       } else {
+                               print "Error: Feed $param not found.&nbsp;
+                               <input class=\"button\"
+                                       type=\"submit\" onclick=\"javascript:closeDlg()\" 
+                                       value=\"Cancel\">";             
+                       }
+               }
+
        }
 
        db_close($link);
index c49a52c136a7ccdc847d33ca1b014e6ba3887a9b..80ca75e0266188ce0efaad8bbaf5b6a5de5d45d7 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -48,7 +48,7 @@ function toggleTags() {
        updateFeedList();
 }
 
-function qaf_add_callback() {
+function dlg_frefresh_callback() {
        if (xmlhttp.readyState == 4) {
                updateFeedList(false, false);
                closeDlg();
@@ -428,13 +428,27 @@ function quickMenuGo() {
 
        var opname = chooser[chooser.selectedIndex].text;
 
-       if (opname == "Preferences") {
+       if (opname.match("Preferences")) {
                gotoPreferences();
        }
 
-       if (opname == "Add new feed") {
+       if (opname.match("Add new feed")) {
                displayDlg("quickAddFeed");
+               return;
+       }
+
+       if (opname.match("Remove this feed")) {
+               var actid = getActiveFeedId();
+
+               if (!actid) {
+                       notify("Please select some feed first.");
+                       return;
+               }
+       
+               displayDlg("quickDelFeed", actid);
+               return;
        }
+
 }
 
 function qafAdd() {
@@ -457,7 +471,7 @@ function qafAdd() {
 
                xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=add&link=" +
                        param_escape(link.value), true);
-               xmlhttp.onreadystatechange=qaf_add_callback;
+               xmlhttp.onreadystatechange=dlg_frefresh_callback;
                xmlhttp.send(null);
 
                link.value = "";
@@ -465,10 +479,10 @@ function qafAdd() {
        }
 }
 
-function displayDlg(id) {
+function displayDlg(id, param) {
 
        xmlhttp.open("GET", "backend.php?op=dlg&id=" +
-               param_escape(id), true);
+               param_escape(id) + "&param=" + param_escape(param), true);
        xmlhttp.onreadystatechange=dialog_refresh_callback;
        xmlhttp.send(null);
 
@@ -479,3 +493,15 @@ function closeDlg() {
        dlg.style.display = "none";
 }
 
+function qfdDelete(feed_id) {
+
+       notify("Removing feed...");
+
+       var feeds_doc = window.frames["feeds-frame"].document;
+       feeds_doc.location.href = "backend.php?op=error&msg=Loading,%20please wait...";
+
+       xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=remove&ids=" + feed_id);
+       xmlhttp.onreadystatechange=dlg_frefresh_callback;
+       xmlhttp.send(null);
+
+}
index 6fc00c55615606c6c0e843ee2c18ef3223776688..52863c1457edbc6b400d94bfd115b71f1ce3f798 100644 (file)
 
                </td>
                <td align="right">
-                       <select id="quickMenuChooser">
+                       Actions: <select id="quickMenuChooser">
                                <option selected>Preferences</option>
-                               <option>Add new feed</option>
+                               <option disabled>-----</option>
+                               <option disabled>Feed actions:</option>
+                               <option>&nbsp;&nbsp;Add new feed</option>
+                               <option>&nbsp;&nbsp;Remove this feed</option>
                                <!-- <option>Edit this feed</option> -->
                        </select>
                        <input type="submit" class="button" onclick="quickMenuGo()" value="Go">