From ac53063ab9a0a2a13ea40cafd5e6e2b383976578 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 21 Aug 2005 17:16:41 +0100 Subject: [PATCH] basic functionality pass 4 --- backend.php | 29 +++++++++++++++++++++++++++-- button.png | Bin 0 -> 293 bytes functions.php | 12 ++++++++---- tt-rss.css | 26 ++++++++++++++++++++++---- tt-rss.js | 18 ++++++++++++++++-- tt-rss.php | 3 +++ 6 files changed, 76 insertions(+), 12 deletions(-) create mode 100644 button.png diff --git a/backend.php b/backend.php index e89163de..5386de0b 100644 --- a/backend.php +++ b/backend.php @@ -88,8 +88,12 @@ $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'"); @@ -113,11 +117,24 @@ } print ""; +/* print ""; + print ""; */ + + print ""; print ""; + 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; @@ -139,6 +156,11 @@ ++$lnum; } + if ($lnum == 0) { + print ""; + + } + print " +
+ Search: " . $line["title"] . "
+ Search:
" . $line["title"] . "
No entries found.
"; $next_skip = $skip + HEADLINES_PER_PAGE; @@ -150,7 +172,10 @@ print "Next Page"; print "   "; - + + print "Refresh"; + print "   "; print "Mark all as read"; diff --git a/button.png b/button.png new file mode 100644 index 0000000000000000000000000000000000000000..161606ea73b4867f9334c141195d890417233d91 GIT binary patch literal 293 zcmeAS@N?(olHy`uVBq!ia0vp^AT~b-6Oas=domJ8aTa()7Bet#3xhBt!>lB>dhV;BYW`i*n80I>&~0KjRoL>un5B zVshY`6C2`SYs9tWX0>uj6aP|a-r$M-+x>TJzI|_^-@EeuHmeK)vnc7QzH=__^Sw8r zd;ZUv#Z&iY-=B3r$93`4jN?t62Y0C0sugf1X-AqUR4o(D)6mg%vtJ~CtY2Bye%HTx k&irqoPeLynuKB>eWMzuR&j5+%KxZ;|y85}Sb4q9e0IEi49smFU literal 0 HcmV?d00001 diff --git a/functions.php b/functions.php index 76917935..3e501347 100644 --- a/functions.php +++ b/functions.php @@ -74,13 +74,17 @@ $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
"; +// print "$entry_guid - $entry_timestamp - $entry_title - +// $entry_link - $entry_id
"; } diff --git a/tt-rss.css b/tt-rss.css index 7b89286e..058cf05d 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -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 { diff --git a/tt-rss.js b/tt-rss.js index 7e669985..aeaac22c 100644 --- 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=' '; + + 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); } diff --git a/tt-rss.php b/tt-rss.php index f63369bd..9a8f5cca 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -15,6 +15,9 @@
Preferences -- 2.39.5