implement search in pref-feeds (closes #332)
This commit is contained in:
parent
373266eb03
commit
16270276cf
|
@ -36,6 +36,10 @@
|
||||||
|
|
||||||
if ($subop == "getfeedtree") {
|
if ($subop == "getfeedtree") {
|
||||||
|
|
||||||
|
$search = $_SESSION["prefs_feed_search"];
|
||||||
|
|
||||||
|
if ($search) $search_qpart = " AND LOWER(title) LIKE LOWER('%$search%')";
|
||||||
|
|
||||||
$root = array();
|
$root = array();
|
||||||
$root['id'] = 'root';
|
$root['id'] = 'root';
|
||||||
$root['name'] = __('Feeds');
|
$root['name'] = __('Feeds');
|
||||||
|
@ -59,7 +63,7 @@
|
||||||
".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
|
".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
|
||||||
FROM ttrss_feeds
|
FROM ttrss_feeds
|
||||||
WHERE cat_id = '".$line['id']."' AND owner_uid = ".$_SESSION["uid"].
|
WHERE cat_id = '".$line['id']."' AND owner_uid = ".$_SESSION["uid"].
|
||||||
" ORDER BY order_id, title");
|
"$search_qpart ORDER BY order_id, title");
|
||||||
|
|
||||||
while ($feed_line = db_fetch_assoc($feed_result)) {
|
while ($feed_line = db_fetch_assoc($feed_result)) {
|
||||||
$feed = array();
|
$feed = array();
|
||||||
|
@ -75,7 +79,8 @@
|
||||||
array_push($cat['items'], $feed);
|
array_push($cat['items'], $feed);
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push($root['items'], $cat);
|
if (count($cat['items']) > 0)
|
||||||
|
array_push($root['items'], $cat);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Uncategorized is a special case */
|
/* Uncategorized is a special case */
|
||||||
|
@ -91,7 +96,7 @@
|
||||||
".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
|
".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
|
||||||
FROM ttrss_feeds
|
FROM ttrss_feeds
|
||||||
WHERE cat_id IS NULL AND owner_uid = ".$_SESSION["uid"].
|
WHERE cat_id IS NULL AND owner_uid = ".$_SESSION["uid"].
|
||||||
" ORDER BY order_id, title");
|
"$search_qpart ORDER BY order_id, title");
|
||||||
|
|
||||||
while ($feed_line = db_fetch_assoc($feed_result)) {
|
while ($feed_line = db_fetch_assoc($feed_result)) {
|
||||||
$feed = array();
|
$feed = array();
|
||||||
|
@ -107,13 +112,15 @@
|
||||||
array_push($cat['items'], $feed);
|
array_push($cat['items'], $feed);
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push($root['items'], $cat);
|
if (count($cat['items']) > 0)
|
||||||
|
array_push($root['items'], $cat);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$feed_result = db_query($link, "SELECT id, title, last_error,
|
$feed_result = db_query($link, "SELECT id, title, last_error,
|
||||||
".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
|
".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
|
||||||
FROM ttrss_feeds
|
FROM ttrss_feeds
|
||||||
WHERE owner_uid = ".$_SESSION["uid"].
|
WHERE owner_uid = ".$_SESSION["uid"].
|
||||||
" ORDER BY order_id, title");
|
"$search_qpart ORDER BY order_id, title");
|
||||||
|
|
||||||
while ($feed_line = db_fetch_assoc($feed_result)) {
|
while ($feed_line = db_fetch_assoc($feed_result)) {
|
||||||
$feed = array();
|
$feed = array();
|
||||||
|
@ -1304,6 +1311,13 @@
|
||||||
|
|
||||||
print "<div dojoType=\"dijit.Toolbar\">";
|
print "<div dojoType=\"dijit.Toolbar\">";
|
||||||
|
|
||||||
|
print "<div style='float : right; padding-right : 4px;'>
|
||||||
|
<input dojoType=\"dijit.form.TextBox\" id=\"feed_search\" size=\"20\" type=\"search\"
|
||||||
|
onchange=\"updateFeedList()\" value=\"$feed_search\">
|
||||||
|
<button dojoType=\"dijit.form.Button\" onclick=\"updateFeedList()\">".
|
||||||
|
__('Search')."</button>
|
||||||
|
</div>";
|
||||||
|
|
||||||
print "<div dojoType=\"dijit.form.DropDownButton\">".
|
print "<div dojoType=\"dijit.form.DropDownButton\">".
|
||||||
"<span>" . __('Select')."</span>";
|
"<span>" . __('Select')."</span>";
|
||||||
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
|
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
|
||||||
|
|
7
prefs.js
7
prefs.js
|
@ -64,8 +64,13 @@ function notify_callback2(transport) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFeedList(sort_key) {
|
function updateFeedList(sort_key) {
|
||||||
|
|
||||||
|
var user_search = $("feed_search");
|
||||||
|
var search = "";
|
||||||
|
if (user_search) { search = user_search.value; }
|
||||||
|
|
||||||
new Ajax.Request("backend.php", {
|
new Ajax.Request("backend.php", {
|
||||||
parameters: "?op=pref-feeds",
|
parameters: "?op=pref-feeds&search=" + param_escape(search),
|
||||||
onComplete: function(transport) {
|
onComplete: function(transport) {
|
||||||
feedlist_callback2(transport);
|
feedlist_callback2(transport);
|
||||||
} });
|
} });
|
||||||
|
|
Loading…
Reference in New Issue