From fc46ab83bb735904c92dea8722e0784b64b0d8fb Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 5 Dec 2007 08:59:12 +0100 Subject: [PATCH] mobile: add support for marking selected articles as read --- mobile/functions.php | 40 ++++++++++++++++++++++++++++++++++------ mobile/mobile.css | 28 ++++++++++++++++++++++++++-- mobile/tt-rss.js | 16 ++++++++++++++++ mobile/tt-rss.php | 1 + 4 files changed, 77 insertions(+), 8 deletions(-) create mode 100644 mobile/tt-rss.js diff --git a/mobile/functions.php b/mobile/functions.php index 9f5dd7835..99afe10c6 100644 --- a/mobile/functions.php +++ b/mobile/functions.php @@ -315,6 +315,7 @@ $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; @@ -347,11 +348,22 @@ 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) { @@ -416,6 +428,10 @@ if (db_num_rows($result) > 0) { + print "
"; + print ""; + print ""; + print ""; - print "
Mark as read: "; + print "
"; $_SESSION["last_page_ids.$feed"] = $page_art_ids; - print "Page, "; - print "Feed
"; +/* print "Page, "; + print "Feed
"; */ + + print " + "; + + print "
"; } else { print "
No articles found.
"; diff --git a/mobile/mobile.css b/mobile/mobile.css index 50d842ad2..b0b3a79e9 100644 --- a/mobile/mobile.css +++ b/mobile/mobile.css @@ -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 index 000000000..942122c7a --- /dev/null +++ b/mobile/tt-rss.js @@ -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; + } +} diff --git a/mobile/tt-rss.php b/mobile/tt-rss.php index e08181905..1fcea79fc 100644 --- a/mobile/tt-rss.php +++ b/mobile/tt-rss.php @@ -98,6 +98,7 @@ Tiny Tiny RSS - Mobile +