]> git.wh0rd.org Git - tt-rss.git/commitdiff
simplify update/purge interval selection
authorAndrew Dolgov <fox@bah.spb.su>
Mon, 20 Mar 2006 14:30:51 +0000 (15:30 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Mon, 20 Mar 2006 14:30:51 +0000 (15:30 +0100)
backend.php
prefs.js

index ba73e1a0f7f8dd4f4d52de2a7138d4a9325ed6e0..b83ea44966ccf328ef566e8de412bf78af657162 100644 (file)
        require_once "functions.php";
        require_once "magpierss/rss_fetch.inc";
 
+       $purge_intervals = array(
+               0  => "Default",
+               -1 => "Never purge",
+               5  => "1 week",
+               14 => "2 weeks",
+               31 => "1 month",
+               60 => "2 months",
+               90 => "3 months");
+
+       $update_intervals = array(
+               0   => "Default",
+               -1  => "Disable updates",
+               30  => "30 minutes",
+               60  => "1 hour",
+               240 => "4 hours",
+               720 => "12 hours",
+               1440 => "Daily",
+               10080 => "Weekly");
+
        $script_started = getmicrotime();
 
        $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
 
                        print "<tr class='$row_class'><td>Feed URL:</td>";
                        print "<td><input id=\"iedit_link\" value=\"$feed_url\"></td></tr>";
-       
+
                        if (get_pref($link, 'ENABLE_FEED_CATS')) {
 
                                $cat_id = db_fetch_result($result, 0, "cat_id");
                        $row_class = toggleEvenOdd($row_class);
 
                        print "<tr class='$row_class'><td>Update Interval:</td>";
-                       print "<td><input id=\"iedit_updintl\" 
-                               value=\"$update_interval\"></td></tr>";
+//                     print "<td><input id=\"iedit_updintl\" 
+//                             value=\"$update_interval\"></td></tr>";
+
+                       print "<td>";
+
+                       print "<select id=\"iedit_updintl\">";
+                       
+                       foreach (array_keys($update_intervals) as $i) {
+                       
+                               if ($i == $update_interval) {
+                                       $selected = "selected";
+                               } else {
+                                       $selected = "";
+                               }                                       
+                               print "<option $selected id=\"$i\">" . $update_intervals[$i] . "</option>";
+                       }
+                               
+                       print "</select>";
+
+                       print "</td>";
 
                        $row_class = toggleEvenOdd($row_class);
                        print "<tr class='$row_class'><td>Link to:</td>";
                        $row_class = toggleEvenOdd($row_class);
 
                        print "<tr class='$row_class'><td>Purge Days:</td>";
-                       print "<td><input id=\"iedit_purgintl\" 
-                               value=\"$purge_interval\"></td></tr>";
+//                     print "<td><input id=\"iedit_purgintl\" 
+//                             value=\"$purge_interval\"></td></tr>";
+
+                       print "<td>";
+
+                       print "<select id=\"iedit_purgintl\">";
+                       
+                       foreach (array_keys($purge_intervals) as $i) {
+                       
+                               if ($i == $purge_interval) {
+                                       $selected = "selected";
+                               } else {
+                                       $selected = "";
+                               }                                       
+                               print "<option $selected id=\"$i\">" . $purge_intervals[$i] . "</option>";
+                       }
+                               
+                       print "</select>";
+
+                       print "</td>";
 
 //                     print "<tr><td colspan=\"2\"><b>Authentication</b></td></tr>";
 
                                        <td width='30%'><a href=\"javascript:updateFeedList('title')\">Title</a></td>
                                        <td width='30%'><a href=\"javascript:updateFeedList('feed_url')\">Feed</a></td>
                                        <td width='15%'><a href=\"javascript:updateFeedList('update_interval')\">Update Interval</a></td>
-                                       <td width='15%'><a href=\"javascript:updateFeedList('purge_interval')\">Purge Days</a></td></tr>";
+                                       <td width='15%'><a href=\"javascript:updateFeedList('purge_interval')\">Purge Interval</a></td></tr>";
                        }
                        
                        $lnum = 0;
                                $edit_link = htmlspecialchars(db_unescape_string($line["feed_url"]));
                                $edit_cat = htmlspecialchars(db_unescape_string($line["category"]));
        
-                               if ($line["update_interval"] == "0") $line["update_interval"] = "Default";
-                               if ($line["update_interval"] == "-1") $line["update_interval"] = "Disabled";
-                               if ($line["purge_interval"] == "0") $line["purge_interval"] = "Default";
-                               if ($line["purge_interval"] < 0)        $line["purge_interval"] = "Disabled";
+//                             if ($line["update_interval"] == "0") $line["update_interval"] = "Default";
+//                             if ($line["update_interval"] == "-1") $line["update_interval"] = "Disabled";
+//                             if ($line["purge_interval"] == "0") $line["purge_interval"] = "Default";
+//                             if ($line["purge_interval"] < 0)        $line["purge_interval"] = "Disabled";
 
                                if (!$edit_cat) $edit_cat = "Uncategorized";
 
-
                                if (get_pref($link, 'ENABLE_FEED_CATS') && $cur_cat_id != $cat_id) {
                                        $lnum = 0;
                                
                                                <td width='30%'><a href=\"javascript:updateFeedList('title')\">Title</a></td>
                                                <td width='30%'><a href=\"javascript:updateFeedList('feed_url')\">Feed</a></td>
                                                <td width='15%'><a href=\"javascript:updateFeedList('update_interval')\">Update Interval</a></td>
-                                               <td width='15%'><a href=\"javascript:updateFeedList('purge_interval')\">Purge Days</a></td></tr>";
+                                               <td width='15%'><a href=\"javascript:updateFeedList('purge_interval')\">Purge Interval</a></td></tr>";
 
                                        $cur_cat_id = $cat_id;
                                }
                                } */
 
                                print "<td><a href=\"javascript:editFeed($feed_id);\">" . 
-                                       $line["update_interval"] . "</a></td>";
+                                       $update_intervals[$line["update_interval"]] . "</a></td>";
 
                                print "<td><a href=\"javascript:editFeed($feed_id);\">" . 
-                                       $line["purge_interval"] . "</a></td>";
+                                       $purge_intervals[$line["purge_interval"]] . "</a></td>";
        
                                print "</tr>";
        
index 8d15d5c22439f4efda902880f204ed50130169ba..ce9e8289c0717880e480a99170e6bf8444d7b4b8 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -697,8 +697,14 @@ function feedEditSave() {
        
                var link = document.getElementById("iedit_link").value;
                var title = document.getElementById("iedit_title").value;
-               var upd_intl = document.getElementById("iedit_updintl").value;
-               var purge_intl = document.getElementById("iedit_purgintl").value;
+               var upd_intl = document.getElementById("iedit_updintl");
+
+               upd_intl = upd_intl[upd_intl.selectedIndex].id;
+                       
+               var purge_intl = document.getElementById("iedit_purgintl");
+
+               purge_intl = purge_intl[purge_intl.selectedIndex].id;
+               
                var fcat = document.getElementById("iedit_fcat");
 
                var is_pvt = document.getElementById("iedit_private");