]> git.wh0rd.org Git - tt-rss.git/commitdiff
mobile: add support for marking selected articles as read
authorAndrew Dolgov <fox@madoka.spb.ru>
Wed, 5 Dec 2007 07:59:12 +0000 (08:59 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Wed, 5 Dec 2007 07:59:12 +0000 (08:59 +0100)
mobile/functions.php
mobile/mobile.css
mobile/tt-rss.js [new file with mode: 0644]
mobile/tt-rss.php

index 9f5dd7835703df83fe5a5766bda9cbee1d358bdc..99afe10c69ce556167e7af01b4d590c0851c6685 100644 (file)
                $view_mode = db_escape_string($_GET["viewmode"]);
                $cat_view = db_escape_string($_GET["cat"]);
                $subop = $_GET["subop"];
+               $catchup_op = $_GET["catchup_op"];
 
                if (!$view_mode) $view_mode = "Adaptive";
                if (!$limit) $limit = 30;
                        update_generic_feed($link, $feed, $cat_view, true);
                }
 
-               if ($subop == "MarkAllRead")  {
+               if ($subop == "MarkAllRead" || $catchup_op == "feed")  {
                        catchup_feed($link, $feed, $cat_view);
                }
 
-               if ($subop == "MarkPageRead") {
+               if ($catchup_op == "selection") {
+                       $ids_to_mark = array_keys($_GET["sel_ids"]);
+                       if ($ids_to_mark) {
+                               foreach ($ids_to_mark as $id) {
+                                       db_query($link, "UPDATE ttrss_user_entries SET 
+                                               unread = false,last_read = NOW()
+                                               WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
+                               }
+                       }
+               }
+
+               if ($subop == "MarkPageRead" || $catchup_op == "page") {
                        $ids_to_mark = $_SESSION["last_page_ids.$feed"];
 
                        if ($ids_to_mark) {
        
                if (db_num_rows($result) > 0) {
 
+                       print "<form method=\"GET\" action=\"tt-rss.php\">";
+                       print "<input type=\"hidden\" name=\"go\" value=\"vf\">";
+                       print "<input type=\"hidden\" name=\"id\" value=\"$feed\">";
+
                        print "<ul class=\"headlines\">";
 
                        $page_art_ids = array();
                                        $updated_fmt = date($short_date, strtotime($line["updated"]));
                                }                               
                                
-                               print "<li class='$class'>";
+                               print "<li class='$class' id=\"HROW-$id\">";
+
+                               print "<input type=\"checkbox\" name=\"sel_ids[$id]\" 
+                                       onchange=\"toggleSelectRow(this, $id)\">";
 
                                print "<a href=\"?go=vf&id=$feed&ts=$id\">$marked_pic</a>";
                                print "<a href=\"?go=vf&id=$feed&tp=$id\">$published_pic</a>";
 
                        print "</ul>";
 
-                       print "<div class='footerAddon'>Mark as read: ";
+                       print "<div class='footerAddon'>";
 
                        $_SESSION["last_page_ids.$feed"] = $page_art_ids;
 
-                       print "<a href=\"tt-rss.php?go=vf&id=$feed&subop=MarkPageRead\">Page</a>, ";
-                       print "<a href=\"tt-rss.php?go=vf&id=$feed&subop=MarkAllRead\">Feed</a></div>";
+/*                     print "<a href=\"tt-rss.php?go=vf&id=$feed&subop=MarkPageRead\">Page</a>, ";
+                       print "<a href=\"tt-rss.php?go=vf&id=$feed&subop=MarkAllRead\">Feed</a></div>"; */
+
+                       print "<select name=\"catchup_op\">
+                               <option value=\"selection\">Selection</option>
+                               <option value=\"page\">Page</option>
+                               <option value=\"feed\">Entire feed</option>
+                       </select>
+                       <input type=\"submit\" value=\"Mark as read\">";                                
+
+                       print "</form>";
 
                } else {
                        print "<div align='center'>No articles found.</div>";
index 50d842ad2194f2e170b17f5c7fccc081934eab5f..b0b3a79e9e199d2799208eaa613ea8ebd0ec9bbf 100644 (file)
@@ -127,17 +127,41 @@ ul.feedlist li.tagUnread {
 }
 
 .even {
-       background-color : #88b0ff;
+/*     background-color : #9bbdff; */
+       border-width : 0px 0px 1px 0px;
+       border-color : #88b0ff;
+       border-style : solid;
+}
+
+.odd {
+       border-width : 0px 0px 1px 0px;
+       border-color : #88b0ff;
+       border-style : solid;
 }
 
 .evenUnread {
-       border-width : 1px 0px 1px 0px;
+       border-width : 0px 0px 1px 0px;
        border-color : #88b0ff;
        border-style : solid;
+/*     background-color : #9bbdff; */
        font-weight : bold;
 }
 
 .oddUnread {
+       border-width : 0px 0px 1px 0px;
+       border-color : #88b0ff;
+       border-style : solid;
+       font-weight : bold;
+}
+
+.evenSelected, .oddSelected, .evenUnreadSelected, .oddUnreadSelected {
+       background-color : #fff7d5;
+       border-width : 0px 0px 1px 0px;
+       border-color : #88b0ff;
+       border-style : solid;
+}
+
+.evenUnreadSelected, .oddUnreadSelected {
        font-weight : bold;
 }
 
diff --git a/mobile/tt-rss.js b/mobile/tt-rss.js
new file mode 100644 (file)
index 0000000..942122c
--- /dev/null
@@ -0,0 +1,16 @@
+function toggleSelectRow(cb, id) {     
+       var row = document.getElementById("HROW-" + id);
+       var checked = cb.checked;
+       if (row) {
+               var unread = row.className.match("Unread");
+               var new_classname = row.className;
+
+               new_classname = new_classname.replace("Selected", "");
+               new_classname = new_classname.replace("Unread", "");
+
+               if (unread) new_classname = new_classname + "Unread";
+               if (checked) new_classname = new_classname + "Selected";
+
+               row.className = new_classname;
+       }
+}
index e08181905c31e0382d90aa3d6e07165622041095..1fcea79fc597874eb53f30bf6c432d15aa248411 100644 (file)
@@ -98,6 +98,7 @@
        <title>Tiny Tiny RSS - Mobile</title>
        <link rel="stylesheet" type="text/css" href="mobile.css">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+       <script type="text/javascript" src="tt-rss.js"></script>
 </head>
 <body>