]> git.wh0rd.org Git - tt-rss.git/commitdiff
quick add feed now has category dropbox, quick feed delete resets headlines view...
authorAndrew Dolgov <fox@madoka.spb.ru>
Tue, 20 Dec 2005 08:00:11 +0000 (09:00 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Tue, 20 Dec 2005 08:00:11 +0000 (09:00 +0100)
backend.php
tt-rss.css
tt-rss.js

index 40a59afcb567e4cb478eabf4e33a960647d4197a..ea5b6a0bb8f97fc191944281179bcf9090e6e412 100644 (file)
                        if (!WEB_DEMO_MODE) {
 
                                $feed_link = db_escape_string(trim($_GET["link"]));
+                               $cat_id = db_escape_string($_GET["cid"]);
+
+                               if ($cat_id == "0") {
+                                       $cat_qpart = "NULL";
+                               } else {
+                                       $cat_qpart = "'$cat_id'";
+                               }
 
                                $result = db_query($link,
                                        "SELECT id FROM ttrss_feeds 
                                if (db_num_rows($result) == 0) {
                                        
                                        $result = db_query($link,
-                                               "INSERT INTO ttrss_feeds (owner_uid,feed_url,title) 
-                                               VALUES ('".$_SESSION["uid"]."', '$feed_link', '')");
+                                               "INSERT INTO ttrss_feeds (owner_uid,feed_url,title,cat_id
+                                               VALUES ('".$_SESSION["uid"]."', '$feed_link', '', $cat_qpart)");
 
                                        $result = db_query($link,
                                        "SELECT id FROM ttrss_feeds WHERE feed_url = '$feed_link' 
                        print "
                        Feed URL: <input 
                        onblur=\"javascript:enableHotkeys()\" onfocus=\"javascript:disableHotkeys()\"
-                       id=\"qafInput\">
-                       <input class=\"button\"
+                       id=\"qafInput\">";
+               
+                       if (get_pref($link, 'ENABLE_FEED_CATS')) {
+                               $result = db_query($link, "SELECT title,id FROM ttrss_feed_categories
+                                       WHERE owner_uid = ".$_SESSION["uid"]."
+                                       ORDER BY title");
+
+                               print " <select id=\"qafCat\">";
+                               print "<option id=\"0\">Uncategorized</option>";
+
+                               if (db_num_rows($result) != 0) {
+       
+                                       print "<option disabled>--------</option>";
+
+                                       while ($line = db_fetch_assoc($result)) {
+                                               printf("<option id='%d'>%s</option>", 
+                                                       $line["id"], $line["title"]);
+                                       }               
+                               }
+
+                               print "</select>";
+                       }
+                       
+                       print "&nbsp;<input class=\"button\"
                                type=\"submit\" onclick=\"javascript:qafAdd()\" value=\"Add feed\">
                        <input class=\"button\"
                                type=\"submit\" onclick=\"javascript:closeDlg()\" 
index 93d04ae73b28780d133d5bf9d450409513e70503..7ae71d9468edfe9932fe2cb6510ac50475256724 100644 (file)
@@ -528,6 +528,9 @@ div.helpResponse {
        bottom : 2px;
        right : 2px;
        background-color : white;
+       background-image : url("images/vgrad_light_rev2.png");
+       background-position : top left;
+       background-repeat : repeat-x;
 }
 
 #qafInput {
index 7a776a2359a10535457d5f5fb5233ca1d6aca4f8..45da03396d65eb8cc0f701841e815c1ba53d9915 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -1,16 +1,13 @@
 var xmlhttp = false;
-
 var total_unread = 0;
 var first_run = true;
-
 var display_tags = false;
-
 var global_unread = -1;
-
 var active_title_text = "";
-
 var current_subtitle = "";
 
+var _qfd_deleted_feed = 0;
+
 /*@cc_on @*/
 /*@if (@_jscript_version >= 5)
 // JScript gives us Conditional compilation, we can cope with old IE versions.
@@ -48,6 +45,12 @@ function dlg_frefresh_callback() {
        if (xmlhttp.readyState == 4) {
                notify(xmlhttp.responseText);
                updateFeedList(false, false);
+               if (_qfd_deleted_feed) {
+                       var hframe = document.getElementById("headlines-frame");
+                       if (hframe) {
+                               hframe.src = "backend.php?op=error&msg=No%20feed%20selected.";
+                       }
+               }
                closeDlg();
        } 
 }
@@ -453,13 +456,22 @@ function qafAdd() {
                notify("Missing feed URL.");
        } else {
                notify("Adding feed...");
+       
+               var cat = document.getElementById("qafCat");
+               var cat_id = "";
                
+               if (cat) {
+                       cat_id = cat[cat.selectedIndex].id;
+               } else {
+                       cat_id = 0;
+               }
+
                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&quiet=1&subop=add&link=" +
-                       param_escape(link.value), true);
+                       param_escape(link.value) + "&cid=" + param_escape(cat_id), true);
                xmlhttp.onreadystatechange=dlg_frefresh_callback;
                xmlhttp.send(null);
 
@@ -527,6 +539,8 @@ function qfdDelete(feed_id) {
 //     var feeds_doc = window.frames["feeds-frame"].document;
 //     feeds_doc.location.href = "backend.php?op=error&msg=Loading,%20please wait...";
 
+       _qfd_deleted_feed = feed_id;
+
        xmlhttp.open("GET", "backend.php?op=pref-feeds&quiet=1&subop=remove&ids=" + feed_id);
        xmlhttp.onreadystatechange=dlg_frefresh_callback;
        xmlhttp.send(null);