From b9fca8678b2fc3603fc4e2d1b6da85b022f70381 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 9 Sep 2011 14:24:14 +0400 Subject: mobile: fix headline ordering mobile: fix htmlpurifier cache being included from wrong directory mobile: implement ability to mark article as unread (closes #367) --- functions.php | 6 +++++- mobile/backend.php | 11 +++++++++-- mobile/functions.php | 8 +++++++- mobile/mobile.js | 20 ++++++++++++++++++++ 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/functions.php b/functions.php index 48ab664c8..5ec459fa8 100644 --- a/functions.php +++ b/functions.php @@ -120,7 +120,11 @@ @$config->set('HTML', 'Allowed', $allowed); $config->set('Output.FlashCompat', true); $config->set('Attr.EnableID', true); - @$config->set('Cache', 'SerializerPath', CACHE_DIR . "/htmlpurifier"); + if (!defined('MOBILE_VERSION')) { + @$config->set('Cache', 'SerializerPath', CACHE_DIR . "/htmlpurifier"); + } else { + @$config->set('Cache', 'SerializerPath', "../" . CACHE_DIR . "/htmlpurifier"); + } $purifier = new HTMLPurifier($config); diff --git a/mobile/backend.php b/mobile/backend.php index 85018c580..2e473a375 100644 --- a/mobile/backend.php +++ b/mobile/backend.php @@ -7,11 +7,11 @@ require_once "../config.php"; require_once "functions.php"; - require_once "../functions.php"; + require_once "../functions.php"; require_once "../sessions.php"; - require_once "../version.php"; + require_once "../version.php"; require_once "../db-prefs.php"; $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); @@ -35,6 +35,13 @@ publishArticlesById($link, array($id), $cmode); break; + case "toggleUnread": + $cmode = db_escape_string($_REQUEST["unread"]); + $id = db_escape_string($_REQUEST["id"]); + + catchupArticlesById($link, array($id), $cmode); + break; + case "setPref": $id = db_escape_string($_REQUEST["id"]); $value = db_escape_string($_REQUEST["to"]); diff --git a/mobile/functions.php b/mobile/functions.php index eb523d710..e84be9342 100644 --- a/mobile/functions.php +++ b/mobile/functions.php @@ -339,7 +339,7 @@ $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit, $view_mode, $is_cat, $search, $search_mode, $match_on, - "unread DESC, updated, score", $offset); + "score DESC, date_entered DESC", $offset); $result = $qfh_ret[0]; $feed_title = $qfh_ret[1]; @@ -523,6 +523,12 @@
ONOFF
"; + print "
+ +
ONOFF
+
"; + + print ""; print ""; diff --git a/mobile/mobile.js b/mobile/mobile.js index 6b5736193..2a948ca4f 100644 --- a/mobile/mobile.js +++ b/mobile/mobile.js @@ -39,6 +39,26 @@ function togglePublished(id, elem) { } +function toggleUnread(id, elem) { + + var toggled = false; + + if (elem.getAttribute("toggled") == "true") { + toggled = 1; + } else { + toggled = 0; + } + + var query = "?op=toggleUnread&id=" + id + "&unread=" + toggled; + + new Ajax.Request(backend, { + parameters: query, + onComplete: function (transport) { + // + } }); + +} + function setPref(elem) { var toggled = false; var id = elem.id; -- cgit v1.2.3