From f175937c783eb55371fd7aee2ff338ce2aff5aa8 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 5 Sep 2005 07:04:02 +0100 Subject: [PATCH] fix typo in search, add view limiting dropbox, change default headlines height to 10% --- backend.php | 26 ++++++++++++++++++++++---- functions.php | 4 ++-- tt-rss.css | 2 +- tt-rss.js | 13 ++++++++++++- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/backend.php b/backend.php index 39f2e6033..e35e7f6ee 100644 --- a/backend.php +++ b/backend.php @@ -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 " Search: - Reset - "; + onchange=\"javascript:search($feed);\"> "; + + print " Reset"; + + print "  View: "; + + print_select("viewbox", $view_mode, array("All Posts", "Starred"), + "onchange=\"javascript:viewfeed('$feed', '$skip', '');\""); + + print ""; + print " " . $line["title"] . ""; $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; diff --git a/functions.php b/functions.php index d572ee780..e6ef6589a 100644 --- a/functions.php +++ b/functions.php @@ -297,8 +297,8 @@ } - function print_select($id, $default, $values) { - print ""; foreach ($values as $v) { if ($v == $default) $sel = " selected"; diff --git a/tt-rss.css b/tt-rss.css index de6051f4f..f2c15c64c 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -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; diff --git a/tt-rss.js b/tt-rss.js index e1cee7353..53360f813 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -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);