From f70f7e285564a361f6881fd5957ccd0760733270 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 5 Dec 2007 07:42:18 +0100 Subject: [PATCH] mobile: add support for tagging/publishing articles from view mode --- mobile/functions.php | 27 +++++++++++++++++++++++++++ mobile/mobile.css | 4 ++++ mobile/tt-rss.php | 30 ++++++++++++++++++++++++++---- 3 files changed, 57 insertions(+), 4 deletions(-) diff --git a/mobile/functions.php b/mobile/functions.php index 0bd65082a..d2504e245 100644 --- a/mobile/functions.php +++ b/mobile/functions.php @@ -538,6 +538,7 @@ 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, @@ -603,6 +604,23 @@ print "
Tags: $tags_str
"; } + if ($line["marked"] == "t" || $line["marked"] == "1") { + $marked_pic = ""; + } else { + $marked_pic = ""; + } + + if ($line["published"] == "t" || $line["published"] == "1") { + $published_pic = ""; + } else { + $published_pic = ""; + } + + print "
"; + print "$marked_pic"; + print "$published_pic"; + print "
"; + print sanitize_rss($link, $line["content"], true);; } @@ -675,4 +693,13 @@ print ""; } + 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"]); + } ?> diff --git a/mobile/mobile.css b/mobile/mobile.css index 27a06d68a..6f7f89e93 100644 --- a/mobile/mobile.css +++ b/mobile/mobile.css @@ -183,3 +183,7 @@ div.footerAddon { form.searchForm { margin : 5px; } + +div.postStarOps { + float : right; +} diff --git a/mobile/tt-rss.php b/mobile/tt-rss.php index 0793ce497..e08181905 100644 --- a/mobile/tt-rss.php +++ b/mobile/tt-rss.php @@ -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; @@ -63,13 +64,34 @@ $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"); + } + } + ?>