$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 " 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;
}
- 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";
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;
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);