fix typo in search, add view limiting dropbox, change default headlines height to 10%

This commit is contained in:
Andrew Dolgov 2005-09-05 07:04:02 +01:00
parent bdd69ee96c
commit f175937c78
4 changed files with 37 additions and 8 deletions

View File

@ -233,6 +233,7 @@
$feed = $_GET["feed"];
$skip = $_GET["skip"];
$subop = $_GET["subop"];
$view_mode = $_GET["view"];
if (!$skip) $skip = 0;
@ -270,17 +271,33 @@
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
@ -298,6 +315,7 @@
ttrss_entries
WHERE
$search_query_part
$view_query_part
feed_id = '$feed' ORDER BY updated DESC LIMIT ".HEADLINES_PER_PAGE." OFFSET $skip");
$lnum = 0;

View File

@ -297,8 +297,8 @@
}
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";

View 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;

View File

@ -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);