]> git.wh0rd.org - tt-rss.git/commitdiff
implemented filter editor, piggified default filter
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 3 Sep 2005 07:50:18 +0000 (08:50 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 3 Sep 2005 07:50:18 +0000 (08:50 +0100)
backend.php
prefs.php
ttrss_schema.sql

index 3b07bd38de79eed01131b9796856a1c73002ccb4..2c87cb7c690510132b6c8be0597fc619ad3b8687 100644 (file)
                print "<p><table width=\"100%\" class=\"prefFeedList\" id=\"prefFeedList\">";
                print "<tr class=\"title\">
                                        <td>&nbsp;</td><td>Select</td><td width=\"40%\">Title</td>
-                                       <td width=\"40%\">Link</td><td>Last Updated</td></tr>";
+                                       <td width=\"40%\">Link</td><td>Last updated</td></tr>";
                
                $lnum = 0;
                
                                print "<td><input id=\"iedit_link\" value=\"".$line["feed_url"]."\"></td>";
                                                
                        }
-                               
+
+                       if (!$line["last_updated"]) $line["last_updated"] = "Never";
+
                        print "<td>" . $line["last_updated"] . "</td>";
                        
                        print "</tr>";
                        ++$lnum;
                }
 
+               if ($lnum == 0) {
+                       print "<tr><td colspan=\"5\" align=\"center\">No feeds defined.</td></tr>";
+               }
+
                print "</table>";
 
                print "<p>";
                $subop = $_GET["subop"];
 
                if ($subop == "editSave") {
-/*                     $feed_title = pg_escape_string($_GET["t"]);
-                       $feed_link = pg_escape_string($_GET["l"]);
-                       $feed_id = $_GET["id"];
-
-                       $result = pg_query("UPDATE ttrss_feeds SET 
-                               title = '$feed_title', feed_url = '$feed_link' WHERE id = '$feed_id'"); */
 
+                       $regexp = pg_escape_string($_GET["r"]);
+                       $descr = pg_escape_string($_GET["d"]);
+                       $match = pg_escape_string($_GET["m"]);
+                       $filter_id = pg_escape_string($_GET["id"]);
+                       
+                       $result = pg_query("UPDATE ttrss_filters SET 
+                               regexp = '$regexp', 
+                               description = '$descr',
+                               filter_type = (SELECT id FROM ttrss_filter_types WHERE
+                                       description = '$match')
+                               WHERE id = '$filter_id'");
                }
 
                if ($subop == "remove") {
                print "<p><table width=\"100%\" class=\"prefFilterList\" id=\"prefFilterList\">";
 
                print "<tr class=\"title\">
-                                       <td>Select</td><td width=\"40%\">Filter Expression</td>
-                                       <td width=\"40%\">Description</td><td>Match</td></tr>";
+                                       <td width=\"5%\">Select</td><td width=\"40%\">Filter expression</td>
+                                       <td width=\"40%\">Description</td><td width=\"10%\">Match</td></tr>";
                
                $lnum = 0;
                
 
                        if (!$edit_filter_id || $subop != "edit") {
 
+                               if (!$line["description"]) $line["description"] = "[No description]";
+
                                print "<td><input onclick='toggleSelectRow(this);' 
                                type=\"checkbox\" id=\"FICHK-".$line["id"]."\"></td>";
 
 
                        } else if ($filter_id != $edit_filter_id) {
 
+                               if (!$line["description"]) $line["description"] = "[No description]";
+
                                print "<td><input disabled=\"true\" type=\"checkbox\" 
                                        id=\"FICHK-".$line["id"]."\"></td>";
 
                        ++$lnum;
                }
 
+               if ($lnum == 0) {
+                       print "<tr><td colspan=\"4\" align=\"center\">No filters defined.</td></tr>";
+               }
+
                print "</table>";
 
                print "<p>";
index 5a3afb1f356a5283ac6b063359ba6dec4e89416b..735263553135d4da92e58f758dd9cafde47b75c2 100644 (file)
--- a/prefs.php
+++ b/prefs.php
@@ -28,8 +28,8 @@
 </tr>
 </tr>
        <td id="prefContent" class="prefContent" valign="top" colspan="2">
+               <h2>Feed Configuration</h2>             <div id="piggie">&nbsp;</div>
 
-               <h2>Feed Configuration</h2>
 
                <div class="expPane" id="feedConfPane">
                        <a href="javascript:expandPane('feedConfPane')">Click to expand &gt;&gt;</a>
index 79a58677c28985e8c517657cffce81aa537ce503..d78e0b16c0cf4efc3e04da18af02a04a7b61bcfb 100644 (file)
@@ -59,3 +59,7 @@ create table ttrss_filters (id serial primary key,
        regexp varchar(250) not null,
        description varchar(250) not null default '');
 
+COPY ttrss_filters (id, filter_type, regexp, description) FROM stdin;
+1      3       PIGGIES MOORE! MOOOOORE PIGGIES!
+\.
+