diff --git a/backend.php b/backend.php index 92230996..492141b9 100644 --- a/backend.php +++ b/backend.php @@ -214,7 +214,7 @@ print ""; -/* + print ""; @@ -225,19 +225,15 @@ print " - "; */ + "; print " + colspan=\"2\" width=\"100%\">" . $line["content"] . ""; print "
Title: ".$line["title"]."  
Link: ".$line["link"]." $comments_prompt 
 
" . $line["content"] . " $feed_icon
"; } -/* print ""; */ - if ($addheader) { print ""; } @@ -258,7 +254,7 @@ if ($addheader) { print " - Tiny Tiny RSS : Article $id + Tiny Tiny RSS : Feed $feed @@ -310,6 +306,10 @@ $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 FROM ttrss_entries WHERE $search_query_part @@ -317,12 +317,23 @@ $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") { $limit_query_part = "LIMIT " . $limit; - } + } */ $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 updated) AS updated_ts FROM @@ -364,7 +375,7 @@ alt=\"Set mark\" onclick='javascript:toggleMark($id, true)'>"; } - $content_link = "" . + $content_link = "" . $line["title"] . ""; print "".$line["updated"].""; print "$content_link"; + print "".$line["link"].""; + print ""; ++$lnum; diff --git a/functions.js b/functions.js index 90245a19..d1f445ec 100644 --- a/functions.js +++ b/functions.js @@ -196,4 +196,51 @@ function getFeedIds() { 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"; + } + } + } + +} diff --git a/tt-rss.css b/tt-rss.css index 8be48a6b..62eba0ed 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -281,16 +281,16 @@ table.prefFeedList tr.title td, table.prefFilterList tr.title td, background-color : #e0e0ff; } -a.disabledButton { +.disabledButton { font-family : tahoma, sans-serif; border : 1px solid #d0d0d0; - background-color : white; + background : white; color : #909090; - padding : 2px 10px 2px 10px; + padding : 1px 10px 1px 10px; font-size : small; } -a.disabledButton:hover { +.disabledButton:hover { background : white; text-decoration : none; color : #909090; @@ -304,16 +304,20 @@ a.disabledButton:hover { background-repeat : repeat-x; background-color : white; color : black; - padding : 2px 10px 2px 10px; - font-size : small; + padding : 1px 10px 1px 10px; } -.button:hover { +/* .button:hover { background : white; text-decoration : none; color : black; +} */ + +a.button { + padding : 2px 10px 2px 10px; } + .buttonWarn { font-family : tahoma, sans-serif; border : 1px solid #d0d0d0; @@ -344,7 +348,7 @@ div.errorBox { background : #f0f0f0; } -tr.titleTop, tr.titleBottom { +tr.titleTop, tr.titleBottom, tr.titleTopBottom { background : #f0f0f0; } @@ -363,7 +367,13 @@ tr.titleBottom td { border-width : 0px 0px 1px 0px; border-color : #d0d0d0; 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 { diff --git a/tt-rss.js b/tt-rss.js index 37150ba7..34ab7102 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -202,7 +202,7 @@ function catchupAllFeeds() { } function viewCurrentFeed(skip, subop) { - if (active_feed_id) { + if (active_feed_id ) { viewfeed(active_feed_id, skip, subop); } } @@ -231,12 +231,15 @@ function viewfeed(feed, skip, subop) { view_mode = "All Posts"; } + setCookie("ttrss_vf_vmode", view_mode); + var limitbox = document.getElementById("limitbox"); var limit; if (limitbox) { limit = limitbox.value; + setCookie("ttrss_vf_limit", limit); } else { limit = "All"; } @@ -257,6 +260,8 @@ function viewfeed(feed, skip, subop) { active_feed_id = feed; active_offset = skip; + setCookie("ttrss_vf_actfeed", feed); + if (subop == "MarkAllRead") { var feedr = document.getElementById("FEEDR-" + feed); @@ -286,12 +291,9 @@ function viewfeed(feed, skip, subop) { cleanSelected("feedsList"); feedr.className = feedr.className + "Selected"; - - var ftitle_d = document.getElementById("headlinesTitle"); - var ftitle_s = document.getElementById("FEEDN-" + feed); - - ftitle_d.innerHTML = ftitle_s.innerHTML; + disableContainerChildren("headlinesToolbar", false); + // notify(""); } @@ -303,7 +305,9 @@ function timeout() { function resetSearch() { document.getElementById("searchbox").value = ""; - viewfeed(active_feed_id, 0, ""); + if (active_feed_id) { + viewfeed(active_feed_id, 0, ""); + } } function search() { @@ -392,6 +396,8 @@ function localHotkeyHandler(keycode) { function init() { + disableContainerChildren("headlinesToolbar", true); + // IE kludge if (xmlhttp && !xmlhttp_rpc) { @@ -411,4 +417,16 @@ function init() { setTimeout("timeout()", 1800*1000); 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"); + } + } + + diff --git a/tt-rss.php b/tt-rss.php index 8be41276..cdde0fd5 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -38,45 +38,48 @@

All feeds: - Update - - Mark as read

+ + + + -
+
Search: - Reset +  View:  Limit: -  Feed: Update +  Feed: - Mark as read +
@@ -88,15 +91,7 @@ - - - - - - -
Title:-FIXME-
Link:-FIXME-
- -
+