From 973fe3c6faf777e72cade843c5cc3cf5227f2a0e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 21 Nov 2010 13:35:16 +0300 Subject: [PATCH] rework search dialog --- feedlist.js | 9 ++++----- modules/popup-dialog.php | 31 +++++++++---------------------- tt-rss.js | 32 ++++++++++++++++++++++---------- 3 files changed, 35 insertions(+), 37 deletions(-) diff --git a/feedlist.js b/feedlist.js index d694b9be..05a16d86 100644 --- a/feedlist.js +++ b/feedlist.js @@ -1,6 +1,7 @@ var _feed_cur_page = 0; var _infscroll_disable = 0; var _infscroll_request_sent = 0; +var _search_query = false; var counter_timeout_id = false; @@ -100,12 +101,10 @@ function viewfeed(feed, subop, is_cat, offset) { var query = "?op=viewfeed&feed=" + feed + "&" + toolbar_query + "&subop=" + param_escape(subop); - if ($("search_form")) { - var search_query = Form.serialize("search_form"); - query = query + "&" + search_query; - $("search_form").query.value = ""; - closeInfoBox(true); + if (_search_query) { force_nocache = true; + query = query + "&" + _search_query; + _search_query = false; } // console.log("IS_CAT_STORED: " + activeFeedIsCat() + ", IS_CAT: " + is_cat); diff --git a/modules/popup-dialog.php b/modules/popup-dialog.php index 1b90ecfd..5d225da5 100644 --- a/modules/popup-dialog.php +++ b/modules/popup-dialog.php @@ -376,13 +376,6 @@ if ($id == "search") { - print "".__('Search').""; - print ""; - - #$active_feed_id = db_escape_string($_REQUEST["param"]); - $params = explode(":", db_escape_string($_REQUEST["param"]), 2); $active_feed_id = sprintf("%d", $params[0]); @@ -406,14 +399,15 @@ print_select_hash("match_on", 3, $search_fields); } else { - print ""; + print ""; } print "
".__('Limit search to:')." "; - print " "; $feed_title = getFeedTitle($link, $active_feed_id); @@ -425,13 +419,13 @@ } if ($active_feed_id && !$is_cat) { - print ""; + print ""; } else { - print ""; + print ""; } if ($is_cat) { - $cat_preselected = "selected"; + $cat_preselected = "selected=\"1\""; } if (get_pref($link, 'ENABLE_FEED_CATS') && ($active_feed_id > 0 || $is_cat)) { @@ -444,17 +438,10 @@ print ""; - print ""; - print "
- - + +
"; - - print "]]>
"; - - //return; - } if ($id == "quickAddFilter") { diff --git a/tt-rss.js b/tt-rss.js index 08abbbe3..4386fe2e 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -231,8 +231,26 @@ function timeout() { } function search() { - closeInfoBox(); - viewCurrentFeed(); + var query = "backend.php?op=dlg&id=search¶m=" + + param_escape(getActiveFeedId() + ":" + activeFeedIsCat()); + + if (dijit.byId("searchDlg")) + dijit.byId("searchDlg").destroyRecursive(); + + dialog = new dijit.Dialog({ + id: "searchDlg", + title: __("Search"), + style: "width: 600px", + execute: function() { + if (this.validate()) { + _search_query = dojo.objectToQuery(this.attr('value')); + this.hide(); + viewCurrentFeed(); + } + }, + href: query}); + + dialog.show(); } function updateTitle() { @@ -365,10 +383,7 @@ function quickMenuGo(opid) { } if (opid == "qmcSearch") { - displayDlg("search", getActiveFeedId() + ":" + activeFeedIsCat(), - function() { - document.forms['search_form'].query.focus(); - }); + search(); return; } @@ -704,10 +719,7 @@ function hotkey_handler(e) { } if (keycode == 191 || keychar == '/') { // / - displayDlg("search", getActiveFeedId() + ":" + activeFeedIsCat(), - function() { - document.forms['search_form'].query.focus(); - }); + search(); return false; } -- 2.39.2