$script_dt_add = get_script_dt_add();
- print "<script type=\"text/javascript\" src=\"functions.js?$script_dt_add\"></script>
+ print "
+ <script type=\"text/javascript\" src=\"prototype.js\"></script>
+ <script type=\"text/javascript\" src=\"functions.js?$script_dt_add\"></script>
<script type=\"text/javascript\" src=\"feedlist.js?$script_dt_add\"></script>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
<!--[if gte IE 5.5000]>
$script_dt_add = get_script_dt_add();
- print "<script type=\"text/javascript\" src=\"functions.js?$script_dt_add\"></script>
+ print "
+ <script type=\"text/javascript\" src=\"prototype.js\"></script>
+ <script type=\"text/javascript\" src=\"functions.js?$script_dt_add\"></script>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
</head><body $rtl_tag>";
if ($op == "viewfeed") {
$feed = db_escape_string($_GET["feed"]);
- $skip = db_escape_string($_GET["skip"]);
$subop = db_escape_string($_GET["subop"]);
- $view_mode = db_escape_string($_GET["view"]);
+ $view_mode = db_escape_string($_GET["view_mode"]);
$limit = db_escape_string($_GET["limit"]);
$cat_view = db_escape_string($_GET["cat"]);
$next_unread_feed = db_escape_string($_GET["nuf"]);
- if (!$skip) $skip = 0;
-
if ($subop == "undefined") $subop = "";
print "<html><head>
$script_dt_add = get_script_dt_add();
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
+ <script type=\"text/javascript\" src=\"prototype.js\"></script>
<script type=\"text/javascript\" src=\"functions.js?$script_dt_add\"></script>
<script type=\"text/javascript\" src=\"viewfeed.js?$script_dt_add\"></script>
<!--[if gte IE 5.5000]>
window.onload = init;
</script>";
- $search = db_escape_string($_GET["search"]);
- $search_mode = db_escape_string($_GET["smode"]);
+// print_r($_GET);
+
+ $search = db_escape_string($_GET["query"]);
+ $search_mode = db_escape_string($_GET["search_mode"]);
+ $match_on = db_escape_string($_GET["match_on"]);
+ if (!$match_on) {
+ $match_on = "both";
+ }
+
if ($search) {
- $search_query_part = "(upper(ttrss_entries.title) LIKE upper('%$search%')
- OR ttrss_entries.content LIKE '%$search%') AND";
+ if ($match_on == "both") {
+ $search_query_part = "(upper(ttrss_entries.title) LIKE upper('%$search%')
+ OR upper(ttrss_entries.content) LIKE '%$search%') AND";
+ } else if ($match_on == "title") {
+ $search_query_part = "upper(ttrss_entries.title) LIKE upper('%$search%')
+ AND";
+ } else if ($match_on == "content") {
+ $search_query_part = "upper(ttrss_entries.content) LIKE upper('%$search%') AND";
+ }
} else {
$search_query_part = "";
}
$view_query_part = "";
- if ($view_mode == "Adaptive") {
+ if ($view_mode == "adaptive") {
if ($search) {
$view_query_part = " ";
} else if ($feed != -1) {
}
}
- if ($view_mode == "Starred") {
+ if ($view_mode == "marked") {
$view_query_part = " marked = true AND ";
}
- if ($view_mode == "Unread") {
+ if ($view_mode == "unread") {
$view_query_part = " unread = true AND ";
}
- if ($limit && $limit != "All") {
+ if ($limit > 0) {
$limit_query_part = "LIMIT " . $limit;
}
$vfeed_query_part = "";
// override query strategy and enable feed display when searching globally
- if ($search && $search_mode == "All feeds") {
+ if ($search && $search_mode == "all_feeds") {
$query_strategy_part = "ttrss_entries.id > 0";
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
} else if (preg_match("/^-?[0-9][0-9]*$/", $feed) == false) {
$query_strategy_part = "ttrss_entries.id > 0";
$vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
id = feed_id) as feed_title,";
- } else if ($feed >= 0 && $search && $search_mode == "This category") {
+ } else if ($feed >= 0 && $search && $search_mode == "this_cat") {
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
$feed_title = "";
- if ($search && $search_mode == "All feeds") {
+ if ($search && $search_mode == "all_feeds") {
$feed_title = "Global search results ($search)";
} else if ($search && preg_match('/^-?[0-9][0-9]*$/', $feed) == false) {
$feed_title = "Feed search results ($search, $feed)";
}
if ($subop == "editfeed") {
- $feed_id = db_escape_string($_GET["id"]);
+ $feed_id = db_escape_string($_REQUEST["id"]);
$result = db_query($link,
"SELECT * FROM ttrss_feeds WHERE id = '$feed_id' AND
print "<html><head>
<title>Tiny Tiny RSS : Help</title>
<link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">
+ <script type=\"text/javascript\" src=\"prototype.js\"></script>
<script type=\"text/javascript\" src=\"functions.js?$script_dt_add\"></script>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
</head><body>";
print "<div id=\"infoBoxTitle\">Search</div>";
print "<div class=\"infoBoxContents\">";
+ print "<form id='search_form'>";
+
$active_feed_id = db_escape_string($_GET["param"]);
print "<table width='100%'><tr><td>Search:</td><td>";
-
- print "<input id=\"searchbox\" class=\"extSearch\"
- onblur=\"javascript:enableHotkeys()\"
- onfocus=\"javascript:disableHotkeys()\"
+
+ print "<input name=\"query\" class=\"iedit\"
+ onkeypress=\"return filterCR(event)\"
onkeyup=\"toggleSubmitNotEmpty(this, 'search_submit_btn')\"
- onchange=\"javascript:search()\">
- </td></tr><tr><td>Where:</td><td>
- <select id=\"searchmodebox\">
- <option selected>All feeds</option>";
-
+ value=\"\">
+ </td></tr>";
+
+ print "<tr><td>Where:</td><td>";
+
+ print "<select name=\"search_mode\">
+ <option value=\"all_feeds\">All feeds</option>";
+
+ $feed_title = getFeedTitle($link, $active_feed_id);
+ $feed_cat_title = getFeedCatTitle($link, $active_feed_id);
+
if ($active_feed_id) {
- print "<option>This feed</option>";
+ print "<option selected value=\"this_feed\">This feed ($feed_title)</option>";
} else {
print "<option disabled>This feed</option>";
}
- if (get_pref($link, 'ENABLE_FEED_CATS')) {
- print "<option>This category</option>";
+ if (get_pref($link, 'ENABLE_FEED_CATS') && $active_feed_id && $active_feed_id > 0) {
+ print "<option value=\"this_cat\">This category ($feed_cat_title)</option>";
+ } else {
+ print "<option disabled>This category</option>";
}
- print "</select></td></tr>
+ print "</select></td></tr>";
+
+ print "<tr><td>Match on:</td><td>";
+
+ $search_fields = array(
+ "title" => "Title",
+ "content" => "Content",
+ "both" => "Title or content");
- <tr><td colspan='2' align='right'>
+ print_select_hash("match_on", 3, $search_fields);
+
+ print "</td></tr></table>";
+
+ print "</form>";
+
+ print "<div align=\"right\">
<input type=\"submit\"
class=\"button\" onclick=\"javascript:search()\"
id=\"search_submit_btn\" disabled=\"true\"
value=\"Search\">
<input class=\"button\"
- type=\"submit\" onclick=\"javascript:closeInfoBox()\"
- value=\"Cancel\"></td></tr></table>";
+ type=\"submit\" onclick=\"javascript:searchCancel()\"
+ value=\"Cancel\"></div>";
+
+ print "</div>";
}
print "<table width='100%'>";
print "<tr><td>Match:</td>
- <td><input onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
+ <td><input onkeypress=\"return filterCR(event)\"
+ onkeyup=\"toggleSubmitNotEmpty(this, 'infobox_submit')\"
name=\"reg_exp\" size=\"30\"> ";
print_select_hash("match_id", 1, $filter_types);
enableHotkeys();
- var searchbox = doc.getElementById("searchbox");
-
+/* var searchbox = doc.getElementById("searchbox");
+
+ var search_query = "";
+ var search_mode = "";
+
if (searchbox) {
search_query = searchbox.value;
- } else {
- search_query = "";
}
var searchmodebox = doc.getElementById("searchmodebox");
if (searchmodebox) {
search_mode = searchmodebox[searchmodebox.selectedIndex].text;
- } else {
- search_mode = "";
}
- setCookie("ttrss_vf_smode", search_mode);
-
var viewbox = doc.getElementById("viewbox");
var view_mode;
view_mode = viewbox[viewbox.selectedIndex].text;
} else {
view_mode = "All Posts";
- }
+ }
- setCookie("ttrss_vf_vmode", view_mode, getCookie("ttrss_cltime"));
+ setCookie("ttrss_vf_vmode", view_mode, getCookie("ttrss_cltime"));
var limitbox = doc.getElementById("limitbox");
limit = "All";
}
- // document.getElementById("ACTFEEDID").innerHTML = feed;
-
+ // document.getElementById("ACTFEEDID").innerHTML = feed; */
+
+ var toolbar_query = parent.Form.serialize("main_toolbar_form");
+
+ var query = "backend.php?op=viewfeed&feed=" + feed + "&" +
+ toolbar_query + "&subop=" + param_escape(subop);
+
+ if (parent.document.getElementById("search_form")) {
+ var search_query = parent.Form.serialize("search_form");
+ query = query + "&" + search_query;
+ parent.closeInfoBox(true);
+ }
+
if (getActiveFeedId() != feed) {
cat_view_mode = is_cat;
}
setActiveFeedId(feed);
- var query = "backend.php?op=viewfeed&feed=" + param_escape(feed) +
+/* var query = "backend.php?op=viewfeed&feed=" + param_escape(feed) +
"&skip=" + param_escape(skip) + "&subop=" + param_escape(subop) +
"&view=" + param_escape(view_mode) + "&limit=" + limit +
- "&smode=" + param_escape(search_mode);
+ "&smode=" + param_escape(search_mode); */
if (subop == "MarkAllRead") {
}
}
- if (search_query != "") {
- query = query + "&search=" + param_escape(search_query);
+// if (search_query != "") {
+// query = query + "&search=" + param_escape(search_query);
// searchbox.value = "";
- }
+// }
if (cat_view_mode) {
query = query + "&cat=1";
}
var headlines_frame = parent.frames["headlines-frame"];
-
- // alert(headlines_frame)
if (navigator.userAgent.match("Opera")) {
var date = new Date();
feedr.className = feedr.className + "Selected";
}
- disableContainerChildren("headlinesToolbar", false, doc);
-
- /* var btnMarkAsRead = doc.getElementById("btnMarkFeedAsRead");
-
- if (btnMarkAsRead && !isNumeric(feed)) {
- btnMarkAsRead.disabled = true;
- btnMarkAsRead.className = "disabledButton";
- } */
+ parent.disableContainerChildren("headlinesToolbar", false);
+ parent.Form.enable("main_toolbar_form");
+
// notify("");
} catch (e) {
return s;
}
-function closeInfoBox() {
+function closeInfoBox(cleanup) {
var box = document.getElementById('infoBox');
var shadow = document.getElementById('infoBoxShadow');
box.style.display = "none";
}
+ if (cleanup) box.innerHTML = " ";
+
enableHotkeys();
}
xmlhttp.send(null);
}
+function filterCR(e)
+{
+ var key;
+
+ if(window.event)
+ key = window.event.keyCode; //IE
+ else
+ key = e.which; //firefox
+
+ if(key == 13)
+ return false;
+ else
+ return true;
+}
+
function checkbox_to_sql_bool($val) {
return ($val == "on") ? "true" : "false";
}
+
+ function getFeedCatTitle($link, $id) {
+ if ($id == -1) {
+ return "Special";
+ } else if ($id < -10) {
+ return "Labels";
+ } else if ($id > 0) {
+ $result = db_query($link, "SELECT ttrss_feed_categories.title
+ FROM ttrss_feeds, ttrss_feed_categories WHERE ttrss_feeds.id = '$id' AND
+ cat_id = ttrss_feed_categories.id");
+ if (db_num_rows($result) == 1) {
+ return db_fetch_result($result, 0, "title");
+ } else {
+ return "Unknown category ($id)";
+ }
+ } else {
+ return "getFeedCatTitle($id) failed";
+ }
+
+ }
+
+ function getFeedTitle($link, $id) {
+ if ($id == -1) {
+ return "Starred articles";
+ } else if ($id < -10) {
+ $label_id = -10 - $id;
+ $result = db_query($link, "SELECT description FROM ttrss_labels WHERE id = '$label_id'");
+ if (db_num_rows($result) == 1) {
+ return db_fetch_result($result, 0, "description");
+ } else {
+ return "Unknown label ($label_id)";
+ }
+
+ } else if ($id > 0) {
+ $result = db_query($link, "SELECT title FROM ttrss_feeds WHERE id = '$id'");
+ if (db_num_rows($result) == 1) {
+ return db_fetch_result($result, 0, "title");
+ } else {
+ return "Unknown feed ($id)";
+ }
+ } else {
+ return "getFeedTitle($id) failed";
+ }
+
+ }
?>
margin : 0px;
padding : 0px;
}
+
+#main_toolbar_form {
+ display : inline;
+}
}
}
+function searchCancel() {
+ closeInfoBox(true);
+}
+
function search() {
closeInfoBox();
viewCurrentFeed(0, "");
disableContainerChildren("headlinesToolbar", true);
+ Form.disable("main_toolbar_form");
+
if (!genericSanityCheck())
return;
updateFeedList(false, false);
document.onkeydown = hotkey_handler;
- var viewbox = document.getElementById("viewbox");
+/* var viewbox = document.getElementById("viewbox");
var limitbox = document.getElementById("limitbox");
dropboxSelect(viewbox, getCookie("ttrss_vf_vmode"));
- dropboxSelect(limitbox, getCookie("ttrss_vf_limit"));
+ dropboxSelect(limitbox, getCookie("ttrss_vf_limit")); */
daemon_enabled = getCookie("ttrss_vf_daemon");
function quickMenuChange() {
var chooser = document.getElementById("quickMenuChooser");
- var opid = chooser[chooser.selectedIndex].id;
+ var opid = chooser[chooser.selectedIndex].value;
chooser.selectedIndex = 0;
quickMenuGo(opid);
<tr><td class="headlinesToolbar" id="headlinesToolbar">
- <? if (get_pref($link, 'ENABLE_SEARCH_TOOLBAR')) { ?>
+<!-- <? if (get_pref($link, 'ENABLE_SEARCH_TOOLBAR')) { ?>
<input id="searchbox"
onblur="javascript:enableHotkeys();" onfocus="javascript:disableHotkeys();">
<select id="searchmodebox">
- <option>This feed</option>
+ <option value="all_feeds">All feeds</option>
+ <option value="this_feed" selected>This feed</option>
<? if (get_pref($link, 'ENABLE_FEED_CATS')) { ?>
- <option>This category</option>
+ <option value="this_cat">This category</option>
<? } ?>
- <option>All feeds</option>
</select>
<input type="submit"
class="button" onclick="javascript:search()" value="Search">
-
+
- <? } ?>
-
- View:
+ <? } ?> -->
- <select id="viewbox" onchange="javascript:viewCurrentFeed(0, '')">
- <option selected>Adaptive</option>
- <option>All Articles</option>
- <option>Starred</option>
- <option>Unread</option>
+ <form id="main_toolbar_form">
+ View:
+ <select name="view_mode" onchange="viewCurrentFeed(0, '')">
+ <option selected value="adaptive">Adaptive</option>
+ <option value="all_articles">All Articles</option>
+ <option value="marked">Starred</option>
+ <option value="unread">Unread</option>
</select>
-
Limit:
-
- <select id="limitbox" onchange="javascript:viewCurrentFeed(0, '')">
-
<?
- $limits = array(15 => 15, 30 => 30, 60 => 60);
+ $limits = array(15 => 15, 30 => 30, 60 => 60, 0 => "All");
- $def_art_limit = get_pref($link, 'DEFAULT_ARTICLE_LIMIT');
-
- if ($def_art_limit >= 0 && !array_key_exists($def_art_limit, $limits)) {
- $limits[$def_art_limit] = $def_art_limit;
- }
-
- asort($limits);
- array_push($limits, 0);
-
- if (!$def_art_limit) {
- $def_art_limit = 30;
- }
-
- foreach ($limits as $key) {
- print "<option";
- if ($key == $def_art_limit) { print " selected"; }
- print ">";
-
- if ($limits[$key] == 0) { print "All"; } else { print $limits[$key]; }
-
- print "</option>";
- } ?>
-
- </select>
+ $def_art_limit = get_pref($link, 'DEFAULT_ARTICLE_LIMIT');
-<!-- Selection:
+ if ($def_art_limit >= 0 && !array_key_exists($def_art_limit, $limits)) {
+ $limits[$def_art_limit] = $def_art_limit;
+ }
- <select id="headopbox">
- <option id="hopToggleRead">Toggle (un)read</option>
- </select>
+ asort($limits);
+
+ if (!$def_art_limit) {
+ $def_art_limit = 30;
+ }
+
+ print_select_hash("limit", $def_art_limit, $limits,
+ 'onchange="viewCurrentFeed(0, \'\')"');
+
+ ?>
+ </form>
- <input class="button" type="submit" onclick="headopGo()" value="Go"> -->
+ <!-- <input class="button" type="submit"
+ onclick="quickMenuGo('qmcSearch')" value="Search (tmp)"> -->
- Feed: <input class="button" type="submit"
- onclick="javascript:viewCurrentFeed(0, 'ForceUpdate')" value="Update">
+ <input class="button" type="submit"
+ onclick="viewCurrentFeed(0, 'ForceUpdate')" value="Update">
- <input class="button" type="submit" id="btnMarkFeedAsRead"
- onclick="javascript:viewCurrentFeed(0, 'MarkAllRead')" value="Mark as read">
+ <input class="button" type="submit"
+ onclick="viewCurrentFeed(0, 'MarkAllRead')" value="Mark as read">
</td>
<td align="right">
<select id="quickMenuChooser" onchange="quickMenuChange()">
- <option id="qmcDefault" selected>Actions...</option>
- <option id="qmcPrefs">Preferences</option>
- <option id="qmcSearch">Search</option>
+ <option value="qmcDefault" selected>Actions...</option>
+ <option value="qmcPrefs">Preferences</option>
+ <option value="qmcSearch">Search</option>
<option disabled>--------</option>
<option style="color : #5050aa" disabled>Feed actions:</option>
- <option id="qmcAddFeed"> Subscribe to feed</option>
- <option id="qmcRemoveFeed"> Unsubscribe</option>
+ <option value="qmcAddFeed"> Subscribe to feed</option>
+ <option value="qmcRemoveFeed"> Unsubscribe</option>
<!-- <option>Edit this feed</option> -->
<option disabled>--------</option>
<option style="color : #5050aa" disabled>All feeds:</option>
<? if (!ENABLE_UPDATE_DAEMON) { ?>
- <option id="qmcUpdateFeeds"> Update</option>
+ <option value="qmcUpdateFeeds"> Update</option>
<? } ?>
- <option id="qmcCatchupAll"> Mark as read</option>
- <option id="qmcShowOnlyUnread"> Show only unread</option>
+ <option value="qmcCatchupAll"> Mark as read</option>
+ <option value="qmcShowOnlyUnread"> Show only unread</option>
<option disabled>--------</option>
<option style="color : #5050aa" disabled>Other actions:</option>
- <option id="qmcAddFilter"> Create filter</option>
+ <option value="qmcAddFilter"> Create filter</option>
</select>
</td>
</tr>