fix searching by date; add search help prompt

This commit is contained in:
Andrew Dolgov 2011-04-19 15:41:44 +04:00
parent 4a06f46dc7
commit 5300354848
2 changed files with 35 additions and 4 deletions

View file

@ -3349,13 +3349,37 @@
$not = "";
}
if (strpos($k, "@") === 0) {
$commandpair = split(":", mb_strtolower($k), 2);
if ($commandpair[0] == "note" && $commandpair[1]) {
if ($commandpair[1] == "true")
array_push($query_keywords, "($not (note IS NOT NULL AND note != ''))");
else
array_push($query_keywords, "($not (note IS NULL OR note = ''))");
} else if ($commandpair[0] == "star" && $commandpair[1]) {
if ($commandpair[1] == "true")
array_push($query_keywords, "($not (marked = true))");
else
array_push($query_keywords, "($not (marked = false))");
} else if ($commandpair[0] == "pub" && $commandpair[1]) {
if ($commandpair[1] == "true")
array_push($query_keywords, "($not (published = true))");
else
array_push($query_keywords, "($not (published = false))");
} else if (strpos($k, "@") === 0) {
$user_tz_string = get_pref($link, 'USER_TIMEZONE', $_SESSION['uid']);
$orig_ts = strtotime(substr($k, 1));
$k = date("Y-m-d", convert_timestamp($orig_ts, $user_tz_string, 'UTC'));
//$k = date("Y-m-d", strtotime(substr($k, 1)));
array_push($query_keywords, "(".SUBSTRING_FOR_DATE."(updated,1,LENGTH('$k')) $not = '$k')");
} else if ($match_on == "both") {
array_push($query_keywords, "(UPPER(ttrss_entries.title) $not LIKE UPPER('%$k%')

View file

@ -421,8 +421,15 @@
print "</div>";
print "<div class=\"dlgButtons\">
<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">".__('Search')."</button>
print "<div class=\"dlgButtons\">";
if (!SPHINX_ENABLED) {
print "<div style=\"float : left\">
<a class=\"visibleLink\" target=\"_blank\" href=\"http://tt-rss.org/redmine/wiki/tt-rss/SearchSyntax\">Search syntax</a>
</div>";
}
print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').execute()\">".__('Search')."</button>
<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('searchDlg').hide()\">".__('Cancel')."</button>
</div>";
}