]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix typo in search, add view limiting dropbox, change default headlines height to 10%
authorAndrew Dolgov <fox@madoka.spb.ru>
Mon, 5 Sep 2005 06:04:02 +0000 (07:04 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Mon, 5 Sep 2005 06:04:02 +0000 (07:04 +0100)
backend.php
functions.php
tt-rss.css
tt-rss.js

index 39f2e603347decb243fe655e16e6f98bf8bb5c0b..e35e7f6ee239a9c6aac6af55b9472be1622c8ffb 100644 (file)
                $feed = $_GET["feed"];
                $skip = $_GET["skip"];
                $subop = $_GET["subop"];
+               $view_mode = $_GET["view"];
 
                if (!$skip) $skip = 0;
 
                print "<tr><td class=\"search\" colspan=\"4\">
                        Search: <input id=\"searchbox\"
                        onblur=\"javascript:enableHotkeys()\" onfocus=\"javascript:disableHotkeys()\"
-                       onchange=\"javascript:search($feed);\">
-                       <a class=\"button\" href=\"javascript:resetSearch()\">Reset</a>
-                       </td></tr>"; 
+                       onchange=\"javascript:search($feed);\"> ";
+
+               print " <a class=\"button\" href=\"javascript:resetSearch()\">Reset</a>";
+       
+               print "&nbsp;&nbsp;View: ";
+       
+               print_select("viewbox", $view_mode, array("All Posts", "Starred"),
+                       "onchange=\"javascript:viewfeed('$feed', '$skip', '');\"");
+
+               print "</td></tr>"; 
+               
                print "<tr>
                <td colspan=\"4\" class=\"title\">" . $line["title"] . "</td></tr>"; 
 
                $search = $_GET["search"];
 
-               if (search) {
+               if ($search) {
                        $search_query_part = "(upper(title) LIKE upper('%$search%') 
                                OR content LIKE '%$search%') AND";
+               } else {
+                       $search_query_part = "";
+               }
+
+               $view_query_part = "";
+
+               if ($view_mode == "Starred") {
+                       $view_query_part = " marked = true AND ";
                }
 
                $result = pg_query("SELECT count(id) AS total_entries 
                                ttrss_entries 
                        WHERE
                        $search_query_part
+                       $view_query_part
                        feed_id = '$feed' ORDER BY updated DESC LIMIT ".HEADLINES_PER_PAGE." OFFSET $skip");
 
                $lnum = 0;
index d572ee78005b2532a5bca4e31ee2c54f5d4178fd..e6ef6589aecbc9fefc8f0bf96bbe776a524936db 100644 (file)
 
        }
 
-       function print_select($id, $default, $values) {
-               print "<select id=\"$id\">";
+       function print_select($id, $default, $values, $attributes = "") {
+               print "<select id=\"$id\" $attributes>";
                foreach ($values as $v) {
                        if ($v == $default)
                                $sel = " selected";
index de6051f4fa629dae55dcb67466d5612b6bf9618a..f2c15c64ce930a2fce6b075fe3e8746ec3599c85 100644 (file)
@@ -136,7 +136,7 @@ table.main td.feeds {
 }
 
 table.main td.headlines {
-       height : 25%;
+       height : 10%;
        padding : 10px;
        border-width : 1px 0px 0px 0px;
        border-color : #c0c0c0;
index e1cee7353b1f8b97f4a96adb0ac53b9fb2550111..53360f813465b9a59ea4244027c90239c7e59067 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -296,6 +296,16 @@ function viewfeed(feed, skip, subop) {
                search_query = "";
        } 
 
+       var viewbox = document.getElementById("viewbox");
+
+       var view_mode;
+
+       if (viewbox) {
+               view_mode = viewbox.value;
+       } else {
+               view_mode = "All Posts";
+       }
+
 /*     if (active_feed_id == feed && subop != "ForceUpdate") {
                notify("This feed is currently selected.");
                return;
@@ -318,7 +328,8 @@ function viewfeed(feed, skip, subop) {
        active_offset = skip;
 
        var query = "backend.php?op=viewfeed&feed=" + param_escape(feed) +
-               "&skip=" + param_escape(skip) + "&subop=" + param_escape(subop);
+               "&skip=" + param_escape(skip) + "&subop=" + param_escape(subop) +
+               "&view=" + param_escape(view_mode);
 
        if (search_query != "") {
                query = query + "&search=" + param_escape(search_query);