]> git.wh0rd.org - tt-rss.git/commitdiff
mobile: allow marking articles as unread (clses #240)
authorAndrew Dolgov <fox@bah.org.ru>
Thu, 30 Apr 2009 07:23:38 +0000 (11:23 +0400)
committerAndrew Dolgov <fox@bah.org.ru>
Thu, 30 Apr 2009 07:23:38 +0000 (11:23 +0400)
images/art-set-unread.png [new file with mode: 0755]
mobile/functions.php
mobile/mobile.css
mobile/tt-rss.php

diff --git a/images/art-set-unread.png b/images/art-set-unread.png
new file mode 100755 (executable)
index 0000000..611dd95
Binary files /dev/null and b/images/art-set-unread.png differ
index b5148bad8ed22dbf962dcedbd8d64af05914c394..7c57cfc574706dacca3d01a1b05655f2a9eb65fe 100644 (file)
                                $published_pic = "<img class='marked' src=\"../images/pub_unset.gif\">";
                        }
 
+
                        print "<div class=\"postStarOps\">";
-                       print "<a href=\"?go=view&id=$id&ret_feed=$ret_feed_id&feed=$feed_id&sop=ts\">$marked_pic</a>";
-                       print "<a href=\"?go=view&id=$id&ret_feed=$ret_feed_id&feed=$feed_id&sop=tp\">$published_pic</a>";
+                       print "<a title=\"".__('Toggle starred')."\"href=\"?go=view&id=$id&ret_feed=$ret_feed_id&feed=$feed_id&sop=ts\">$marked_pic</a>";
+                       print "<a title=\"".__('Toggle published')."\" href=\"?go=view&id=$id&ret_feed=$ret_feed_id&feed=$feed_id&sop=tp\">$published_pic</a>";
+                       // Mark unread
+                       print "<a title=\"".__('Mark as unread')."\" href=\"?go=vf&id=$ret_feed_id&feed=$feed_id&sop=mu&aid=$id";
+                       if ($cat_view) { print "&cat=$cat_view"; }
+                       print "\"><img class='marked' src=\"../images/art-set-unread.png\"></a>";
                        print "</div>";
 
                        print sanitize_rss($link, $line["content"], true);; 
                $result = db_query($link, "UPDATE ttrss_user_entries SET published = NOT published
                        WHERE ref_id = '$tp_id' AND owner_uid = " . $_SESSION["uid"]);
        }
+
+       function markUnread($link, $mu_id) {
+               $result = db_query($link, "UPDATE ttrss_user_entries SET unread = true 
+                       WHERE ref_id = '$mu_id' AND owner_uid = " . $_SESSION["uid"]);
+       }
+
 ?>
index b50da5875e8c3c8cca6d9e01e39b584bcc4bc0f7..8161340cce29e1eff4582d57e3160d940ad4b362 100644 (file)
@@ -200,6 +200,11 @@ ul.headlines img.feedIcon {
 ul.headlines img.marked {
        border-width : 0px;
 }
+
+div.postStarOps img.marked {
+       border-width : 0px;
+}
+
 div.postTags {
        color : gray;
        font-size : small;
index db7129042b858615431771cdce0c6ec7d065f889..b291f46dd3686a7fb40b7ef29d129eb8650c732a 100644 (file)
 
        $sop = db_escape_string($_GET["sop"]);
 
-       if ($sop && $go == "view") {
-               $a_id = db_escape_string($_GET["id"]);
+       if ($sop) {
+               if ($go == "view") {
+                       $a_id = db_escape_string($_GET["id"]);
+               } elseif ($go == "vf") {
+                       $a_id = db_escape_string($_GET["aid"]);
+               }
 
                if ($a_id) {
 
                                toggleMarked($link, $a_id);
                        }
 
-                       $query_string = preg_replace("/&sop=t[sp]/", "", $_SERVER["QUERY_STRING"]);
+                       if ($sop == "mu") {
+                               markUnread($link, $a_id);
+                       }
+
+                       $query_string = str_replace("&sop=$sop", "", $_SERVER["QUERY_STRING"]);
                        header("Location: tt-rss.php?$query_string");
                }
        }