]> git.wh0rd.org Git - tt-rss.git/commitdiff
mobile: add support for tagging/publishing articles from view mode
authorAndrew Dolgov <fox@madoka.spb.ru>
Wed, 5 Dec 2007 06:42:18 +0000 (07:42 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Wed, 5 Dec 2007 06:42:18 +0000 (07:42 +0100)
mobile/functions.php
mobile/mobile.css
mobile/tt-rss.php

index 0bd65082a01c6476aa1acae2900f70b932e24ed7..d2504e245cd9c56d94d711dd81c02c6b3a50ada0 100644 (file)
                        WHERE ref_id = '$id' AND feed_id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
 
                $result = db_query($link, "SELECT title,link,content,feed_id,comments,int_id,
+                       marked,published,
                        SUBSTRING(updated,1,16) as updated,
                        (SELECT icon_url FROM ttrss_feeds WHERE id = feed_id) as icon_url,
                        num_comments,
                                print "<div class=\"postTags\">Tags: $tags_str</div>";
                        }
 
+                       if ($line["marked"] == "t" || $line["marked"] == "1") {
+                               $marked_pic = "<img class='marked' src=\"../images/mark_set.png\">";
+                       } else {
+                               $marked_pic = "<img class='marked' src=\"../images/mark_unset.png\">";
+                       }
+
+                       if ($line["published"] == "t" || $line["published"] == "1") {
+                               $published_pic = "<img class='marked' src=\"../images/pub_set.gif\">";
+                       } else {
+                               $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 "</div>";
+
                        print sanitize_rss($link, $line["content"], true);; 
                
                }
                print "</div>";
        }
 
+       function toggleMarked($link, $ts_id) {
+               $result = db_query($link, "UPDATE ttrss_user_entries SET marked = NOT marked
+                       WHERE ref_id = '$ts_id' AND owner_uid = " . $_SESSION["uid"]);
+       }
+
+       function togglePublished($link, $tp_id) {
+               $result = db_query($link, "UPDATE ttrss_user_entries SET published = NOT published
+                       WHERE ref_id = '$tp_id' AND owner_uid = " . $_SESSION["uid"]);
+       }
 ?>
index 27a06d68a43d30cf44385cd5685871c7f91a82ef..6f7f89e935c1d3a35dede44c867495b3e65a0488 100644 (file)
@@ -183,3 +183,7 @@ div.footerAddon {
 form.searchForm {
        margin : 5px;
 }
+
+div.postStarOps {
+       float : right;
+}
index 0793ce497de0ababfadbc8d37a6493b904e0e05d..e08181905c31e0382d90aa3d6e07165622041095 100644 (file)
@@ -53,8 +53,9 @@
        $ts_id = db_escape_string($_GET["ts"]);
 
        if ($go == "vf" && $ts_id) {
-               $result = db_query($link, "UPDATE ttrss_user_entries SET marked = NOT marked
-                       WHERE ref_id = '$ts_id' AND owner_uid = " . $_SESSION["uid"]);
+
+               toggleMarked($link, $ts_id);
+
                $query_string = preg_replace("/&ts=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
                header("Location: tt-rss.php?$query_string");
                return;
        $tp_id = db_escape_string($_GET["tp"]);
 
        if ($go == "vf" && $tp_id) {
-               $result = db_query($link, "UPDATE ttrss_user_entries SET published = NOT published
-                       WHERE ref_id = '$tp_id' AND owner_uid = " . $_SESSION["uid"]);
+
+               togglePublished($link, $tp_id);
+
                $query_string = preg_replace("/&tp=[0-9]*/", "", $_SERVER["QUERY_STRING"]);
                header("Location: tt-rss.php?$query_string");
                return;
        }
 
+       $sop = db_escape_string($_GET["sop"]);
+
+       if ($sop && $go == "view") {
+               $a_id = db_escape_string($_GET["id"]);
+
+               if ($a_id) {
+
+                       if ($sop == "tp") {
+                               togglePublished($link, $a_id);
+                       }
+
+                       if ($sop == "ts") {
+                               toggleMarked($link, $a_id);
+                       }
+
+                       $query_string = preg_replace("/&sop=t[sp]/", "", $_SERVER["QUERY_STRING"]);
+                       header("Location: tt-rss.php?$query_string");
+               }
+       }
+
 ?>
 <html>
 <head>