]> git.wh0rd.org Git - tt-rss.git/commitdiff
some initial feed-linking work
authorAndrew Dolgov <fox@bah.spb.su>
Wed, 28 Dec 2005 19:17:26 +0000 (20:17 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Wed, 28 Dec 2005 19:17:26 +0000 (20:17 +0100)
backend.php
prefs.js
tt-rss.css

index 2b527cc1747790a2f02b5995bc5166f9ba3cdbe4..e929e59a41bb6fe2d1d02358ddde974314fc9320 100644 (file)
                        print "<td><input id=\"iedit_updintl\" 
                                value=\"$update_interval\"></td></tr>";
 
+                       $row_class = toggleEvenOdd($row_class);
+                       print "<tr class='$row_class'><td>Link to:</td>";
+
+                       $parent_feed = db_fetch_result($result, 0, "parent_feed");
+               
+                       print "<select id=\"iedit_parent_feed\">";
+                       print "<option id=\"0\">None</option>";
+
+                       $tmp_result = db_query($link, "SELECT id,title FROM ttrss_feeds
+                               WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY title");
+
+                               if (db_num_rows($tmp_result) > 0) {
+                                       print "<option disabled>--------</option>";
+                               }
+
+                               while ($tmp_line = db_fetch_assoc($tmp_result)) {
+                                       if ($tmp_line["id"] == $parent_feed) {
+                                               $is_selected = "selected";
+                                       } else {
+                                               $is_selected = "";
+                                       }
+                                       printf("<option $is_selected id='%d'>%s</option>", 
+                                               $tmp_line["id"], $tmp_line["title"]);
+                               }
+
+                               print "</select></td>";
+                               print "</td></tr>";
+
                        $purge_interval = db_fetch_result($result, 0, "purge_interval");
                        $row_class = toggleEvenOdd($row_class);
 
                        $cat_id = db_escape_string($_POST["catid"]);
                        $auth_login = db_escape_string($_POST["login"]);
                        $auth_pass = db_escape_string($_POST["pass"]);
+                       $parent_feed = db_escape_string($_POST["pfeed"]);
 
                        if (strtoupper($upd_intl) == "DEFAULT")
                                $upd_intl = 0;
                                $category_qpart = 'cat_id = NULL';
                        }
 
+                       if ($parent_feed != 0) {
+                               $parent_qpart = "parent_feed = '$parent_feed'";
+                       } else {
+                               $parent_qpart = 'parent_feed = NULL';
+                       }
+
                        $result = db_query($link, "UPDATE ttrss_feeds SET 
                                $category_qpart,
+                               $parent_qpart,
                                title = '$feed_title', feed_url = '$feed_link',
                                update_interval = '$upd_intl',
                                purge_interval = '$purge_intl',
                $result = db_query($link, "SELECT 
                                id,title,feed_url,substring(last_updated,1,16) as last_updated,
                                update_interval,purge_interval,cat_id,
+                               parent_feed AS parent_feed_id,
                                (SELECT title FROM ttrss_feed_categories 
-                                       WHERE id = cat_id) AS category
+                                       WHERE id = cat_id) AS category,
+                               (SELECT title FROM ttrss_feeds 
+                                       WHERE id = parent_feed_id) AS parent_title                              
                        FROM 
                                ttrss_feeds 
                        WHERE 
                                $edit_title = truncate_string($edit_title, 40);
                                $edit_link = truncate_string($edit_link, 60);
 
+                               $parent_title = $line["parent_title"];
+                               if ($parent_title) {
+                                       $parent_title = "<span class='groupPrompt'>(linked to 
+                                               $parent_title)</span>";
+                               }
+
                                print "<td><a href=\"javascript:editFeed($feed_id);\">" . 
-                                       "$feed_icon $edit_title" . "</a></td>";         
+                                       "$feed_icon $edit_title $parent_title" . "</a></td>";           
                                        
                                print "<td><a href=\"javascript:editFeed($feed_id);\">" . 
                                        $edit_link . "</a></td>";               
index 89ad81d38c13ed823820a54f78ccd51a48c6c538..82d897c97036037f01ae90bf2877c603cdf172c3 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -677,18 +677,9 @@ function feedEditSave() {
                var fcat = document.getElementById("iedit_fcat");
        
                var fcat_id = fcat[fcat.selectedIndex].id;
-       
-       //      notify("Saving feed.");
-       
-       /*      if (upd_intl < 0) {
-                       notify("Update interval must be &gt;= 0 (0 = default)");
-                       return;
-               }
-       
-               if (purge_intl < 0) {
-                       notify("Purge days must be &gt;= 0 (0 = default)");
-                       return;
-               } */
+
+               var pfeed = document.getElementById("iedit_parent_feed");
+               var parent_feed_id = pfeed[pfeed.selectedIndex].id;
        
                if (link.length == 0) {
                        notify("Feed link cannot be blank.");
@@ -711,7 +702,7 @@ function feedEditSave() {
                        feed + "&l=" + param_escape(link) + "&t=" + param_escape(title) +
                        "&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl) +
                        "&catid=" + param_escape(fcat_id) + "&login=" + param_escape(auth_login) +
-                       "&pass=" + param_escape(auth_pass);
+                       "&pfeed=" + param_escape(parent_feed_id) + "&pass=" + param_escape(auth_pass);
 
                xmlhttp.open("POST", "backend.php", true);
                xmlhttp.onreadystatechange=feedlist_callback;
index fd50263bcb1618888f20e01d61d27d807c24aca7..bffbe0e23f25fe23c9ac38b5f536595a5d875645 100644 (file)
@@ -320,7 +320,8 @@ a:hover {
 
 #iedit_title, #iedit_link, #iedit_regexp, #iedit_descr, #iedit_expr, #iedit_updintl,
 #iedit_purgintl, #iedit_ulogin, #iedit_ulevel, #iedit_match, #iedit_feed,
-#iedit_fcat, #iedit_filter_action, #iedit_login, #iedit_pass, #iedit_email {
+#iedit_fcat, #iedit_filter_action, #iedit_login, #iedit_pass, #iedit_email,
+#iedit_parent_feed {
        width : 100%;
        padding-left : 2px;
 }
@@ -910,3 +911,8 @@ img.closeButton {
        border-width : 0px;
        float : right;
 }
+
+span.groupPrompt {
+       font-size : x-small;
+       color : #505050;
+}