]> git.wh0rd.org - tt-rss.git/commitdiff
inputify buttons, store view modes in session cookies, disable headline toolbar initially
authorAndrew Dolgov <fox@madoka.spb.ru>
Tue, 6 Sep 2005 04:14:17 +0000 (05:14 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Tue, 6 Sep 2005 04:14:17 +0000 (05:14 +0100)
backend.php
functions.js
tt-rss.css
tt-rss.js
tt-rss.php

index 922309968d88ed44a8663eb14aa572e6b41bdaa8..492141b934365b2463d63b592e1d261217b23875 100644 (file)
 
                        print "<table class=\"postTable\" width=\"100%\" cellspacing=\"0\" 
                                cellpadding=\"0\">";
-/*                             
+                               
                        print "<tr class=\"titleTop\"><td align=\"right\"><b>Title:</b></td>
                                <td width=\"100%\">".$line["title"]."</td>
                                <td>&nbsp;</td></tr>";
                        
                        print "<tr class=\"titleBottom\"><td align=\"right\"><b>Link:</b></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\" 
-                               colspan=\"2\">" . $line["content"] . "</td>
+                               colspan=\"2\" width=\"100%\">" . $line["content"] . "</td>
                                <td valign=\"top\">$feed_icon</td>
                        </tr>";
                        print "</table>";        
 
                }
 
-/*             print "<script type=\"text/javascript\">
-                       p_notify(''); -- FLICKER
-               </script>"; */
-
                if ($addheader) {
                        print "</body></html>";
                }
 
                if ($addheader) {
                        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\">
                                <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
                                <script type=\"text/javascript\" src=\"functions.js\"></script>
                        $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
 
                $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
                                        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>";
                                
                        print "<tr class='$class' id='RROW-$id'";
                                <a href=\"javascript:view($id,$feed_id);\">".$line["updated"]."</a></td>";
                        print "<td class='headlineTitle'>$content_link</td>";
 
+                       print "<td class=\"invisible\" id=\"FLINK-$id\">".$line["link"]."</td>";
+
                        print "</tr>";
 
                        ++$lnum;
index 90245a19282207377ad87a0b93716ad6c6368c14..d1f445ec2ba948573974e3b7090ebfde650b7e5e 100644 (file)
@@ -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";
+                       }
+               }
+       }
+
+}
 
index 8be48a6b3be0c2c2ad330c5ee624c05dabe557bf..62eba0ed0cdc7621da5137306b11a1df6325ba68 100644 (file)
@@ -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 {
index 37150ba7a5df6e1c2fe182a520bc959a3d9fc0f4..34ab7102c0c3ae5e330b142899dd8a8233cfaa0c 100644 (file)
--- 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");
+       }
+               
 }
+
+
index 8be41276f4601105e69cb7edff2e0680bdd43f16..cdde0fd5052c435ee71a930c4139e31d0717a78e 100644 (file)
        
                <p align="center">All feeds:
                
-               <a class="button" 
-                               href="javascript:scheduleFeedUpdate(true)">Update</a>
-
-               <a class="button" 
-                               href="javascript:catchupAllFeeds()">Mark as read</a></p>
+               <input class="button" type="submit"     
+                       onclick="javascript:scheduleFeedUpdate(true)" value="Update">
+                               
+               <input class="button" type="submit"     
+                       onclick="javascript:catchupAllFeeds()" value="Mark as read"> 
 
        </td>
        <td valign="top" class="headlinesToolbarBox">
                <table width="100%">
+               
                <!-- <tr><td id="headlinesTitle" class="headlinesTitle">
                        &nbsp;
                </td></tr> -->
-               <tr><td class="headlinesToolbar">
+               <tr><td class="headlinesToolbar" id="headlinesToolbar">
                        Search: <input id="searchbox"
                        onblur="javascript:enableHotkeys()" onfocus="javascript:disableHotkeys()"
                        onchange="javascript:search()">
-               <a class="button" href="javascript:resetSearch()">Reset</a>
+               <input type="submit" 
+                       class="button" onclick="javascript:resetSearch()" value="Reset">
 
                &nbsp;View: 
                
                <select id="viewbox" onchange="javascript:viewCurrentFeed(0, '')">
                        <option>All Posts</option>
                        <option>Starred</option>
+                       <option selected>Unread</option>
                </select>
 
                &nbsp;Limit:
 
                <select id="limitbox" onchange="javascript:viewCurrentFeed(0, '')">
                        <option>15</option>
-                       <option>30</option>
+                       <option selected>30</option>
                        <option>60</option>
                        <option>All</option>
                </select>
 
-               &nbsp;Feed: <a class="button" 
-                       href="javascript:viewCurrentFeed(0, 'ForceUpdate')">Update</a>
+               &nbsp;Feed: <input class="button" type="submit"
+                       onclick="javascript:viewCurrentFeed(0, 'ForceUpdate')" value="Update">
 
-               <a class="button" 
-                       href="javascript:viewCurrentFeed(0, 'MarkAllRead')">Mark as read</a>
+               <input class="button" type="submit"
+                       onclick="javascript:viewCurrentFeed(0, 'MarkAllRead')" value="Mark as read">
 
                </td></tr>
                </table>
        </td>
 </tr><tr>
        <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>
-               </td></tr></table>
+               <iframe name="content-frame" id="content-frame" class="contentFrame"> </iframe>
        </td>
 </tr>
 <tr>