inputify buttons, store view modes in session cookies, disable headline toolbar initially

This commit is contained in:
Andrew Dolgov 2005-09-06 05:14:17 +01:00
parent 5f89f7803b
commit ac43eba1ab
5 changed files with 130 additions and 47 deletions

View File

@ -214,7 +214,7 @@
print "<table class=\"postTable\" width=\"100%\" cellspacing=\"0\" print "<table class=\"postTable\" width=\"100%\" cellspacing=\"0\"
cellpadding=\"0\">"; cellpadding=\"0\">";
/*
print "<tr class=\"titleTop\"><td align=\"right\"><b>Title:</b></td> print "<tr class=\"titleTop\"><td align=\"right\"><b>Title:</b></td>
<td width=\"100%\">".$line["title"]."</td> <td width=\"100%\">".$line["title"]."</td>
<td>&nbsp;</td></tr>"; <td>&nbsp;</td></tr>";
@ -225,19 +225,15 @@
print "<tr class=\"titleBottom\"><td align=\"right\"><b>Link:</b></td> print "<tr class=\"titleBottom\"><td align=\"right\"><b>Link:</b></td>
<td><a href=\"".$line["link"]."\">".$line["link"]."</a> $comments_prompt</td> <td><a href=\"".$line["link"]."\">".$line["link"]."</a> $comments_prompt</td>
<td>&nbsp;</td></tr>"; */ <td>&nbsp;</td></tr>";
print "<tr><td valign=\"top\" class=\"post\" print "<tr><td valign=\"top\" class=\"post\"
colspan=\"2\">" . $line["content"] . "</td> colspan=\"2\" width=\"100%\">" . $line["content"] . "</td>
<td valign=\"top\">$feed_icon</td> <td valign=\"top\">$feed_icon</td>
</tr>"; </tr>";
print "</table>"; print "</table>";
} }
/* print "<script type=\"text/javascript\">
p_notify(''); -- FLICKER
</script>"; */
if ($addheader) { if ($addheader) {
print "</body></html>"; print "</body></html>";
} }
@ -258,7 +254,7 @@
if ($addheader) { if ($addheader) {
print "<html><head> print "<html><head>
<title>Tiny Tiny RSS : Article $id</title> <title>Tiny Tiny RSS : Feed $feed</title>
<link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\"> <link rel=\"stylesheet\" href=\"tt-rss.css\" type=\"text/css\">
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
<script type=\"text/javascript\" src=\"functions.js\"></script> <script type=\"text/javascript\" src=\"functions.js\"></script>
@ -310,6 +306,10 @@
$view_query_part = " marked = true AND "; $view_query_part = " marked = true AND ";
} }
if ($view_mode == "Unread") {
$view_query_part = " unread = true AND ";
}
$result = pg_query("SELECT count(id) AS total_entries $result = pg_query("SELECT count(id) AS total_entries
FROM ttrss_entries WHERE FROM ttrss_entries WHERE
$search_query_part $search_query_part
@ -317,12 +317,23 @@
$total_entries = pg_fetch_result($result, 0, "total_entries"); $total_entries = pg_fetch_result($result, 0, "total_entries");
$result = pg_query("SELECT count(id) AS unread_entries
FROM ttrss_entries WHERE
$search_query_part
unread = true AND
feed_id = '$feed'");
$unread_entries = pg_fetch_result($result, 0, "unread_entries");
/* if ($limit < $unread_entries)
$limit = $unread_entries;
if ($limit != "All") { if ($limit != "All") {
$limit_query_part = "LIMIT " . $limit; $limit_query_part = "LIMIT " . $limit;
} } */
$result = pg_query("SELECT $result = pg_query("SELECT
id,title,updated,unread,feed_id,marked, id,title,updated,unread,feed_id,marked,link,
EXTRACT(EPOCH FROM last_read) AS last_read_ts, EXTRACT(EPOCH FROM last_read) AS last_read_ts,
EXTRACT(EPOCH FROM updated) AS updated_ts EXTRACT(EPOCH FROM updated) AS updated_ts
FROM FROM
@ -364,7 +375,7 @@
alt=\"Set mark\" onclick='javascript:toggleMark($id, true)'>"; alt=\"Set mark\" onclick='javascript:toggleMark($id, true)'>";
} }
$content_link = "<a href=\"javascript:view($id,$feed_id);\">" . $content_link = "<a id=\"FTITLE-$id\" href=\"javascript:view($id,$feed_id);\">" .
$line["title"] . "</a>"; $line["title"] . "</a>";
print "<tr class='$class' id='RROW-$id'"; print "<tr class='$class' id='RROW-$id'";
@ -380,6 +391,8 @@
<a href=\"javascript:view($id,$feed_id);\">".$line["updated"]."</a></td>"; <a href=\"javascript:view($id,$feed_id);\">".$line["updated"]."</a></td>";
print "<td class='headlineTitle'>$content_link</td>"; print "<td class='headlineTitle'>$content_link</td>";
print "<td class=\"invisible\" id=\"FLINK-$id\">".$line["link"]."</td>";
print "</tr>"; print "</tr>";
++$lnum; ++$lnum;

View File

@ -196,4 +196,51 @@ function getFeedIds() {
return rows; return rows;
} }
function setCookie(name, value, expires, path, domain, secure) {
document.cookie= name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
}
else {
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
if (end == -1) {
end = dc.length;
}
return unescape(dc.substring(begin + prefix.length, end));
}
function disableContainerChildren(id, disable) {
var container = document.getElementById(id);
for (var i = 0; i < container.childNodes.length; i++) {
var child = container.childNodes[i];
child.disabled = disable;
if (disable) {
if (child.className && child.className.match("button")) {
child.className = "disabledButton";
}
} else {
if (child.className && child.className.match("disabledButton")) {
child.className = "button";
}
}
}
}

View File

@ -281,16 +281,16 @@ table.prefFeedList tr.title td, table.prefFilterList tr.title td,
background-color : #e0e0ff; background-color : #e0e0ff;
} }
a.disabledButton { .disabledButton {
font-family : tahoma, sans-serif; font-family : tahoma, sans-serif;
border : 1px solid #d0d0d0; border : 1px solid #d0d0d0;
background-color : white; background : white;
color : #909090; color : #909090;
padding : 2px 10px 2px 10px; padding : 1px 10px 1px 10px;
font-size : small; font-size : small;
} }
a.disabledButton:hover { .disabledButton:hover {
background : white; background : white;
text-decoration : none; text-decoration : none;
color : #909090; color : #909090;
@ -304,16 +304,20 @@ a.disabledButton:hover {
background-repeat : repeat-x; background-repeat : repeat-x;
background-color : white; background-color : white;
color : black; color : black;
padding : 2px 10px 2px 10px; padding : 1px 10px 1px 10px;
font-size : small;
} }
.button:hover { /* .button:hover {
background : white; background : white;
text-decoration : none; text-decoration : none;
color : black; color : black;
} */
a.button {
padding : 2px 10px 2px 10px;
} }
.buttonWarn { .buttonWarn {
font-family : tahoma, sans-serif; font-family : tahoma, sans-serif;
border : 1px solid #d0d0d0; border : 1px solid #d0d0d0;
@ -344,7 +348,7 @@ div.errorBox {
background : #f0f0f0; background : #f0f0f0;
} }
tr.titleTop, tr.titleBottom { tr.titleTop, tr.titleBottom, tr.titleTopBottom {
background : #f0f0f0; background : #f0f0f0;
} }
@ -363,7 +367,13 @@ tr.titleBottom td {
border-width : 0px 0px 1px 0px; border-width : 0px 0px 1px 0px;
border-color : #d0d0d0; border-color : #d0d0d0;
border-style : solid; border-style : solid;
}
tr.titleTopBottom td {
padding : 3px 10px 5px 10px;
border-width : 1px 0px 1px 0px;
border-color : #d0d0d0;
border-style : solid;
} }
td.post { td.post {

View File

@ -231,12 +231,15 @@ function viewfeed(feed, skip, subop) {
view_mode = "All Posts"; view_mode = "All Posts";
} }
setCookie("ttrss_vf_vmode", view_mode);
var limitbox = document.getElementById("limitbox"); var limitbox = document.getElementById("limitbox");
var limit; var limit;
if (limitbox) { if (limitbox) {
limit = limitbox.value; limit = limitbox.value;
setCookie("ttrss_vf_limit", limit);
} else { } else {
limit = "All"; limit = "All";
} }
@ -257,6 +260,8 @@ function viewfeed(feed, skip, subop) {
active_feed_id = feed; active_feed_id = feed;
active_offset = skip; active_offset = skip;
setCookie("ttrss_vf_actfeed", feed);
if (subop == "MarkAllRead") { if (subop == "MarkAllRead") {
var feedr = document.getElementById("FEEDR-" + feed); var feedr = document.getElementById("FEEDR-" + feed);
@ -287,10 +292,7 @@ function viewfeed(feed, skip, subop) {
cleanSelected("feedsList"); cleanSelected("feedsList");
feedr.className = feedr.className + "Selected"; feedr.className = feedr.className + "Selected";
var ftitle_d = document.getElementById("headlinesTitle"); disableContainerChildren("headlinesToolbar", false);
var ftitle_s = document.getElementById("FEEDN-" + feed);
ftitle_d.innerHTML = ftitle_s.innerHTML;
// notify(""); // notify("");
@ -303,8 +305,10 @@ function timeout() {
function resetSearch() { function resetSearch() {
document.getElementById("searchbox").value = ""; document.getElementById("searchbox").value = "";
if (active_feed_id) {
viewfeed(active_feed_id, 0, ""); viewfeed(active_feed_id, 0, "");
} }
}
function search() { function search() {
if (active_feed_id) { if (active_feed_id) {
@ -392,6 +396,8 @@ function localHotkeyHandler(keycode) {
function init() { function init() {
disableContainerChildren("headlinesToolbar", true);
// IE kludge // IE kludge
if (xmlhttp && !xmlhttp_rpc) { if (xmlhttp && !xmlhttp_rpc) {
@ -411,4 +417,16 @@ function init() {
setTimeout("timeout()", 1800*1000); setTimeout("timeout()", 1800*1000);
var content = document.getElementById("content"); var content = document.getElementById("content");
// active_feed_id = getCookie("ttrss_vf_actfeed");
var limitbox = document.getElementById("limitbox");
if (getCookie("ttrss_vf_vmode")) {
var viewbox = document.getElementById("viewbox");
viewbox.value = getCookie("ttrss_vf_vmode");
} }
}

View File

@ -38,45 +38,48 @@
<p align="center">All feeds: <p align="center">All feeds:
<a class="button" <input class="button" type="submit"
href="javascript:scheduleFeedUpdate(true)">Update</a> onclick="javascript:scheduleFeedUpdate(true)" value="Update">
<a class="button" <input class="button" type="submit"
href="javascript:catchupAllFeeds()">Mark as read</a></p> onclick="javascript:catchupAllFeeds()" value="Mark as read">
</td> </td>
<td valign="top" class="headlinesToolbarBox"> <td valign="top" class="headlinesToolbarBox">
<table width="100%"> <table width="100%">
<!-- <tr><td id="headlinesTitle" class="headlinesTitle"> <!-- <tr><td id="headlinesTitle" class="headlinesTitle">
&nbsp; &nbsp;
</td></tr> --> </td></tr> -->
<tr><td class="headlinesToolbar"> <tr><td class="headlinesToolbar" id="headlinesToolbar">
Search: <input id="searchbox" Search: <input id="searchbox"
onblur="javascript:enableHotkeys()" onfocus="javascript:disableHotkeys()" onblur="javascript:enableHotkeys()" onfocus="javascript:disableHotkeys()"
onchange="javascript:search()"> onchange="javascript:search()">
<a class="button" href="javascript:resetSearch()">Reset</a> <input type="submit"
class="button" onclick="javascript:resetSearch()" value="Reset">
&nbsp;View: &nbsp;View:
<select id="viewbox" onchange="javascript:viewCurrentFeed(0, '')"> <select id="viewbox" onchange="javascript:viewCurrentFeed(0, '')">
<option>All Posts</option> <option>All Posts</option>
<option>Starred</option> <option>Starred</option>
<option selected>Unread</option>
</select> </select>
&nbsp;Limit: &nbsp;Limit:
<select id="limitbox" onchange="javascript:viewCurrentFeed(0, '')"> <select id="limitbox" onchange="javascript:viewCurrentFeed(0, '')">
<option>15</option> <option>15</option>
<option>30</option> <option selected>30</option>
<option>60</option> <option>60</option>
<option>All</option> <option>All</option>
</select> </select>
&nbsp;Feed: <a class="button" &nbsp;Feed: <input class="button" type="submit"
href="javascript:viewCurrentFeed(0, 'ForceUpdate')">Update</a> onclick="javascript:viewCurrentFeed(0, 'ForceUpdate')" value="Update">
<a class="button" <input class="button" type="submit"
href="javascript:viewCurrentFeed(0, 'MarkAllRead')">Mark as read</a> onclick="javascript:viewCurrentFeed(0, 'MarkAllRead')" value="Mark as read">
</td></tr> </td></tr>
</table> </table>
@ -88,15 +91,7 @@
</td> </td>
</tr><tr> </tr><tr>
<td class="content" id="content" valign="top"> <td class="content" id="content" valign="top">
<table width="100%" height="100%" cellspacing="0" cellpadding="0">
<tr>
<tr class="titleTop"><td align="right"><b>Title:</b></td>
<td width="100%">-FIXME-</td></tr>
<tr class="titleBottom"><td align="right"><b>Link:</b></td>
<td>-FIXME-</td></tr>
<tr><td height="100%" colspan="2">
<iframe name="content-frame" id="content-frame" class="contentFrame"> </iframe> <iframe name="content-frame" id="content-frame" class="contentFrame"> </iframe>
</td></tr></table>
</td> </td>
</tr> </tr>
<tr> <tr>