]> git.wh0rd.org Git - tt-rss.git/commitdiff
basic functionality pass 11
authorAndrew Dolgov <fox@madoka.spb.ru>
Mon, 22 Aug 2005 05:23:49 +0000 (06:23 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Mon, 22 Aug 2005 05:23:49 +0000 (06:23 +0100)
backend.php
prefs.js
prefs.php
tt-rss.css

index 6ea1355b9cf6824adbe6d4635f1a8f2e214af935..4a1d52ce752ec114c5d493678caf6084f262c686 100644 (file)
                                        pg_query("UPDATE ttrss_entries SET unread = false 
                                                WHERE feed_id = '$feed'");
                                }
+
+                               if ($ext == "MarkPageRead")  {
+
+//                                     pg_query("UPDATE ttrss_entries SET unread = false 
+//                                             WHERE feed_id = '$feed' ORDER BY updated OFFSET $skip LIMIT 1");
+                               }
+
                        }
                }
 
                print "<table class=\"headlines\" width=\"100%\">";
-/*             print "<tr><td class=\"search\">
-                       Search: <input onchange=\"javascript:search($feed,this);\"></td>";
-               print "<td class=\"title\">" . $line["title"] . "</td></tr>"; */
 
                print "<tr><td class=\"search\" colspan=\"2\">
-                       Search: <input onchange=\"javascript:search($feed,this);\"></td></tr>";
-               print "<tr><td colspan=\"2\" class=\"title\">" . $line["title"] . "</td></tr>";
+                       Search: <input onchange=\"javascript:search($feed,this);\"></td></tr>"; 
+               print "<tr><td colspan=\"2\" class=\"title\">" . $line["title"] . "</td></tr>"; 
 
                if ($ext == "SEARCH") {
                        $search = $_GET["search"];
 
                $next_skip = $skip + HEADLINES_PER_PAGE;
                $prev_skip = $skip - HEADLINES_PER_PAGE;
-
+       
+               print "Navigate: ";
                print "<a class=\"button\" 
                        href=\"javascript:viewfeed($feed, $prev_skip);\">Previous Page</a>";
                print "&nbsp;";
                print "<a class=\"button\" 
                        href=\"javascript:viewfeed($feed, $next_skip);\">Next Page</a>";
-               print "&nbsp;&nbsp;&nbsp;";
-
+               print "&nbsp;";
                print "<a class=\"button\" 
-                       href=\"javascript:viewfeed($feed, 0, '');\">Refresh</a>";
-               print "&nbsp;&nbsp;&nbsp;";
+                       href=\"javascript:viewfeed($feed, $skip, '');\">Refresh</a>";
+               print "&nbsp;&nbsp;Mark as read: ";
+               print "<a class=\"button\" 
+                       href=\"javascript:viewfeed($feed, $skip, 'MarkPageRead');\">This Page</a>";
+               print "&nbsp;";
                print "<a class=\"button\" 
-                       href=\"javascript:viewfeed($feed, 0, 'MarkAllRead');\">Mark all as read</a>";
+                       href=\"javascript:viewfeed($feed, $skip, 'MarkAllRead');\">All Posts</a>";
 
                print "</td></tr>";
                print "</table>";
                        print "<p>[Edit feed placeholder]</p>";
                }
 
+               if ($subop == "unread") {
+                       $ids = split(",", $_GET["ids"]);
+                       foreach ($ids as $id) {
+                               pg_query("UPDATE ttrss_entries SET unread = true WHERE feed_id = '$id'");
+                       }
+               }
+
+               if ($subop == "read") {
+                       $ids = split(",", $_GET["ids"]);
+                       foreach ($ids as $id) {
+                               pg_query("UPDATE ttrss_entries SET unread = false WHERE feed_id = '$id'");
+                       }
+               }
+
                if ($subop == "remove") {
                        $ids = split(",", $_GET["ids"]);
 
index 7fb4562f7d5a39c3b4a0407dd31b015e6a78026e..001d5b0a85de122388fb3cf05e23fae399da2825 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -60,8 +60,8 @@ function addFeed() {
 
        var link = document.getElementById("fadd_link");
 
-       if (link.length == 0) {
-               notify("Missing feed URL.");
+       if (link.value.length == 0) {
+               notify("Error: Missing feed URL.");
        } else {
                notify("Adding feed...");
 
@@ -87,8 +87,7 @@ function editFeed(feed) {
 
 }
 
-
-function removeSelectedFeeds() {
+function getSelectedFeeds() {
 
        var content = document.getElementById("prefFeedList");
 
@@ -101,6 +100,53 @@ function removeSelectedFeeds() {
                }
        }
 
+       return sel_rows;
+}
+
+function readSelectedFeeds() {
+
+       var sel_rows = getSelectedFeeds();
+
+       if (sel_rows.length > 0) {
+
+               notify("Marking selected feeds as read...");
+
+               xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=unread&ids="+
+                       param_escape(sel_rows.toString()), true);
+               xmlhttp.onreadystatechange=feedlist_callback;
+               xmlhttp.send(null);
+
+       } else {
+
+               notify("Error: Please select some feeds first.");
+
+       }
+}
+
+function unreadSelectedFeeds() {
+
+       var sel_rows = getSelectedFeeds();
+
+       if (sel_rows.length > 0) {
+
+               notify("Marking selected feeds as unread...");
+
+               xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=unread&ids="+
+                       param_escape(sel_rows.toString()), true);
+               xmlhttp.onreadystatechange=feedlist_callback;
+               xmlhttp.send(null);
+
+       } else {
+
+               notify("Error: Please select some feeds first.");
+
+       }
+}
+
+function removeSelectedFeeds() {
+
+       var sel_rows = getSelectedFeeds();
+
        if (sel_rows.length > 0) {
 
                notify("Removing selected feeds...");
@@ -112,7 +158,7 @@ function removeSelectedFeeds() {
 
        } else {
 
-               notify("Please select some feeds first.");
+               notify("Error: Please select some feeds first.");
 
        }
 
index 7f2a8cb3695dc18b5b7962b08c17a709b6cf0e48..79ffcf1115a380fc258539b00ad2fce6125eb3a7 100644 (file)
--- a/prefs.php
+++ b/prefs.php
 
                <div id="feeds">&nbsp;</div>
 
-               <p><a class="button" href="javascript:removeSelectedFeeds()">Remove Selected</a>&nbsp;
+               <p>Selection:&nbsp;
+                       <a class="buttonWarn" 
+                               href="javascript:removeSelectedFeeds()">Remove</a>&nbsp;
+                       <a class="button" 
+                               href="javascript:readSelectedFeeds()">Mark as read</a>&nbsp;
+                       <a class="button" 
+                               href="javascript:unreadSelectedFeeds()">Mark as unread</a>&nbsp;
 
                <hr>
 
index 38187380ef66a6615d1663755982315eb7dd9c3e..63a2fc26c84e850fffbb4959e5ca27b58ba4585c 100644 (file)
@@ -247,4 +247,19 @@ a.button:hover {
        color : black;
 }
 
+a.buttonWarn {
+       border : 1px solid #d0d0d0;
+       background-image : url("button.png");
+       background-position : top;
+       background-repeat : repeat-x;
+       background-color : white;
+       color : black;  
+       padding : 2px 10px 2px 10px;
+       font-size : small;
+}
 
+a.buttonWarn:hover {
+       background : #fff0f0;
+       text-decoration : none;
+       color : black;
+}