]> git.wh0rd.org - tt-rss.git/commitdiff
basic functionality pass 4
authorAndrew Dolgov <fox@bah.spb.su>
Sun, 21 Aug 2005 16:16:41 +0000 (17:16 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sun, 21 Aug 2005 16:16:41 +0000 (17:16 +0100)
backend.php
button.png [new file with mode: 0644]
functions.php
tt-rss.css
tt-rss.js
tt-rss.php

index e89163dec954a3582ef80c158ad3fb822fd38cd5..5386de0b361f5817fb8d84e485cf844e0a02fe90 100644 (file)
                $skip = $_GET["skip"];
                $ext = $_GET["ext"];
 
+               if (!$skip) $skip = 0;
+
                if ($ext == "undefined") $ext = "";
 
+               // FIXME: check for null value here
+
                $result = pg_query("SELECT *,
                        EXTRACT(EPOCH FROM NOW()) - EXTRACT(EPOCH FROM last_updated) as update_timeout
                        FROM ttrss_feeds WHERE id = '$feed'");
                }
 
                print "<table class=\"headlines\" width=\"100%\">";
+/*             print "<tr><td class=\"search\">
+                       Search: <input onchange=\"javascript:search($feed,this);\"></td>";
+               print "<td class=\"title\">" . $line["title"] . "</td></tr>"; */
+
+               print "<tr><td class=\"search\" colspan=\"2\">
+                       Search: <input onchange=\"javascript:search($feed,this);\"></td></tr>";
                print "<tr><td colspan=\"2\" class=\"title\">" . $line["title"] . "</td></tr>";
 
+               if ($ext == "SEARCH") {
+                       $search = $_GET["search"];
+                       $search_query_part = "(upper(title) LIKE upper('%$search%') 
+                               OR content LIKE '%$search%') AND";
+               }
+
                $result = pg_query("SELECT id,title,updated,unread,feed_id FROM
                        ttrss_entries WHERE
-                       feed_id = '$feed' ORDER BY updated LIMIT ".HEADLINES_PER_PAGE." OFFSET $skip");
+                       $search_query_part
+                       feed_id = '$feed' ORDER BY updated DESC LIMIT ".HEADLINES_PER_PAGE." OFFSET $skip");
 
                $lnum = 0;
 
                        ++$lnum;
                }
 
+               if ($lnum == 0) {
+                       print "<tr><td align='center'>No entries found.</td></tr>";
+
+               }
+
                print "<tr><td colspan=\"2\" class=\"headlineToolbar\">";
 
                $next_skip = $skip + HEADLINES_PER_PAGE;
                print "<a class=\"button\" 
                        href=\"javascript:viewfeed($feed, $next_skip);\">Next Page</a>";
                print "&nbsp;&nbsp;&nbsp;";
-               
+
+               print "<a class=\"button\" 
+                       href=\"javascript:viewfeed($feed, 0, '');\">Refresh</a>";
+               print "&nbsp;&nbsp;&nbsp;";
                print "<a class=\"button\" 
                        href=\"javascript:viewfeed($feed, 0, 'MarkAllRead');\">Mark all as read</a>";
 
diff --git a/button.png b/button.png
new file mode 100644 (file)
index 0000000..161606e
Binary files /dev/null and b/button.png differ
index 76917935c0dc27b3de1410f574d0e0de8cee65dc..3e50134721cf9b96e35fc1135fefe985b37ab1d1 100644 (file)
                                        $md5_hash = pg_fetch_result($result, 0, "md5_hash");
                                
                                        if ($md5_hash != $content_md5) 
-                                               $unread = "false";
+                                               $unread = "true";
+                               
+                                       if ($unread) {
+                                               $updated_query_part = "updated = '$entry_timestamp',";
+                                       }
                                
                                        $query = "UPDATE ttrss_entries 
                                                SET 
                                                        title ='$entry_title', 
                                                        link = '$entry_link', 
-                                                       updated = '$entry_timestamp', 
+                                                       $updated_query_part
                                                        content = '$entry_content',
                                                        md5_hash = '$content_md5',
                                                        unread = '$unread'
@@ -90,8 +94,8 @@
                                        $result = pg_query($link, $query);
        
 
-       //                                              print "$entry_guid - $entry_timestamp - $entry_title - 
-       //                                                      $entry_link - $entry_id<br>";
+//                                             print "$entry_guid - $entry_timestamp - $entry_title - 
+//                                                     $entry_link - $entry_id<br>";
        
                                }
        
index 7b89286e2add8c16d73f8b379b3d210041283bdb..058cf05deb956157b476d452942a81fb70b8d24b 100644 (file)
@@ -16,13 +16,17 @@ a:hover {
 
 a.button {
        border : 1px solid #d0d0d0;
-       background : white;
-       color : black;
+       background-image : url("button.png");
+       background-position : top;
+       background-repeat : repeat-x;
+       background-color : white;
+       color : black;  
        padding : 2px 10px 2px 10px;
+       font-size : small;
 }
 
 a.button:hover {
-       background : #f0f0f0;
+       background : white;
        text-decoration : none;
 }
 
@@ -48,6 +52,14 @@ table.feeds td.footer {
        font-size : small;
 }
 
+table.headlines td.search {
+       font-size : small;
+/*     border-width : 0px 0px 1px 0px;
+       border-color : #d0d0d0;
+       border-style : solid;
+       padding-bottom : 3px; */
+}
+
 table.headlines td.title {
        font-weight : bold;
        font-size : large;
@@ -55,6 +67,7 @@ table.headlines td.title {
        border-color : #d0d0d0;
        border-style : solid;
        text-align : right;
+       padding-bottom : 3px;
 }
 
 table.headlines td.headlineUpdated {
@@ -62,11 +75,16 @@ table.headlines td.headlineUpdated {
 
 }
 
+input {
+       border : 1px solid #a0a0a0;
+}
+
 table.main td.toolbar {
        height : 40px;
-       text-align : right;
        background : #f0f0f0;
        padding-right : 5px;
+       font-size : small;
+       text-align : right;
 }
 
 table.main td.header {
index 7e66998566ba7394bf7414e862e86696d2f600b9..aeaac22cce562ab5a1bf27279359f8178ac7ac8c 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -144,7 +144,21 @@ function timeout() {
 
        update_feed_list(true);
 
-       setTimeout("timeout()", 120*1000);
+       setTimeout("timeout()", 1800*1000);
+
+}
+
+function search(feed, sender) {
+
+       notify("Search: " + feed + ", " + sender.value)
+
+       document.getElementById('headlines').innerHTML='Loading headlines, please wait...';             
+       document.getElementById('content').innerHTML='&nbsp;';          
+
+       xmlhttp.open("GET", "backend.php?op=viewfeed&feed=" + param_escape(feed) +
+               "&search=" + param_escape(sender.value) + "&ext=SEARCH", true);
+       xmlhttp.onreadystatechange=viewfeed_callback;
+       xmlhttp.send(null);
 
 }
 
@@ -154,6 +168,6 @@ function init() {
 
        update_feed_list();
 
-       setTimeout("timeout()", 120*1000);
+       setTimeout("timeout()", 1800*1000);
 
 }
index f63369bda251c9be222108487a099580a47a95ff..9a8f5ccac2642883e06b844ec502f61f704e6c7f 100644 (file)
@@ -15,6 +15,9 @@
        </td>
 </tr>
 <tr>
+       <!-- <td class="toolbar" valign="middle" >      
+               Search: <input name="q" onclick=\"javascript:search(this);\">
+       </td> -->
        <td class="toolbar" valign="middle" colspan="2">        
                <a class="button">Preferences</a>
                <!-- <a class="button" href="javascript:refresh()">Refresh</a> -->