basic functionality pass 4

This commit is contained in:
Andrew Dolgov 2005-08-21 17:16:41 +01:00
parent 40d13c2836
commit ac53063ab9
6 changed files with 76 additions and 12 deletions

View File

@ -88,8 +88,12 @@
$skip = $_GET["skip"]; $skip = $_GET["skip"];
$ext = $_GET["ext"]; $ext = $_GET["ext"];
if (!$skip) $skip = 0;
if ($ext == "undefined") $ext = ""; if ($ext == "undefined") $ext = "";
// FIXME: check for null value here
$result = pg_query("SELECT *, $result = pg_query("SELECT *,
EXTRACT(EPOCH FROM NOW()) - EXTRACT(EPOCH FROM last_updated) as update_timeout EXTRACT(EPOCH FROM NOW()) - EXTRACT(EPOCH FROM last_updated) as update_timeout
FROM ttrss_feeds WHERE id = '$feed'"); FROM ttrss_feeds WHERE id = '$feed'");
@ -113,11 +117,24 @@
} }
print "<table class=\"headlines\" width=\"100%\">"; 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>"; 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 $result = pg_query("SELECT id,title,updated,unread,feed_id FROM
ttrss_entries WHERE 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 = 0;
@ -139,6 +156,11 @@
++$lnum; ++$lnum;
} }
if ($lnum == 0) {
print "<tr><td align='center'>No entries found.</td></tr>";
}
print "<tr><td colspan=\"2\" class=\"headlineToolbar\">"; print "<tr><td colspan=\"2\" class=\"headlineToolbar\">";
$next_skip = $skip + HEADLINES_PER_PAGE; $next_skip = $skip + HEADLINES_PER_PAGE;
@ -150,7 +172,10 @@
print "<a class=\"button\" print "<a class=\"button\"
href=\"javascript:viewfeed($feed, $next_skip);\">Next Page</a>"; href=\"javascript:viewfeed($feed, $next_skip);\">Next Page</a>";
print "&nbsp;&nbsp;&nbsp;"; print "&nbsp;&nbsp;&nbsp;";
print "<a class=\"button\"
href=\"javascript:viewfeed($feed, 0, '');\">Refresh</a>";
print "&nbsp;&nbsp;&nbsp;";
print "<a class=\"button\" print "<a class=\"button\"
href=\"javascript:viewfeed($feed, 0, 'MarkAllRead');\">Mark all as read</a>"; href=\"javascript:viewfeed($feed, 0, 'MarkAllRead');\">Mark all as read</a>";

BIN
button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

View File

@ -74,13 +74,17 @@
$md5_hash = pg_fetch_result($result, 0, "md5_hash"); $md5_hash = pg_fetch_result($result, 0, "md5_hash");
if ($md5_hash != $content_md5) if ($md5_hash != $content_md5)
$unread = "false"; $unread = "true";
if ($unread) {
$updated_query_part = "updated = '$entry_timestamp',";
}
$query = "UPDATE ttrss_entries $query = "UPDATE ttrss_entries
SET SET
title ='$entry_title', title ='$entry_title',
link = '$entry_link', link = '$entry_link',
updated = '$entry_timestamp', $updated_query_part
content = '$entry_content', content = '$entry_content',
md5_hash = '$content_md5', md5_hash = '$content_md5',
unread = '$unread' unread = '$unread'
@ -90,8 +94,8 @@
$result = pg_query($link, $query); $result = pg_query($link, $query);
// print "$entry_guid - $entry_timestamp - $entry_title - // print "$entry_guid - $entry_timestamp - $entry_title -
// $entry_link - $entry_id<br>"; // $entry_link - $entry_id<br>";
} }

View File

@ -16,13 +16,17 @@ a:hover {
a.button { a.button {
border : 1px solid #d0d0d0; border : 1px solid #d0d0d0;
background : white; background-image : url("button.png");
color : black; background-position : top;
background-repeat : repeat-x;
background-color : white;
color : black;
padding : 2px 10px 2px 10px; padding : 2px 10px 2px 10px;
font-size : small;
} }
a.button:hover { a.button:hover {
background : #f0f0f0; background : white;
text-decoration : none; text-decoration : none;
} }
@ -48,6 +52,14 @@ table.feeds td.footer {
font-size : small; 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 { table.headlines td.title {
font-weight : bold; font-weight : bold;
font-size : large; font-size : large;
@ -55,6 +67,7 @@ table.headlines td.title {
border-color : #d0d0d0; border-color : #d0d0d0;
border-style : solid; border-style : solid;
text-align : right; text-align : right;
padding-bottom : 3px;
} }
table.headlines td.headlineUpdated { table.headlines td.headlineUpdated {
@ -62,11 +75,16 @@ table.headlines td.headlineUpdated {
} }
input {
border : 1px solid #a0a0a0;
}
table.main td.toolbar { table.main td.toolbar {
height : 40px; height : 40px;
text-align : right;
background : #f0f0f0; background : #f0f0f0;
padding-right : 5px; padding-right : 5px;
font-size : small;
text-align : right;
} }
table.main td.header { table.main td.header {

View File

@ -144,7 +144,21 @@ function timeout() {
update_feed_list(true); 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(); update_feed_list();
setTimeout("timeout()", 120*1000); setTimeout("timeout()", 1800*1000);
} }

View File

@ -15,6 +15,9 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<!-- <td class="toolbar" valign="middle" >
Search: <input name="q" onclick=\"javascript:search(this);\">
</td> -->
<td class="toolbar" valign="middle" colspan="2"> <td class="toolbar" valign="middle" colspan="2">
<a class="button">Preferences</a> <a class="button">Preferences</a>
<!-- <a class="button" href="javascript:refresh()">Refresh</a> --> <!-- <a class="button" href="javascript:refresh()">Refresh</a> -->