mobile: fix headline ordering

mobile: fix htmlpurifier cache being included from wrong directory
mobile: implement ability to mark article as unread (closes #367)
This commit is contained in:
Andrew Dolgov 2011-09-09 14:24:14 +04:00
parent 97e5dbb2e7
commit b9fca8678b
4 changed files with 41 additions and 4 deletions

View File

@ -120,7 +120,11 @@
@$config->set('HTML', 'Allowed', $allowed); @$config->set('HTML', 'Allowed', $allowed);
$config->set('Output.FlashCompat', true); $config->set('Output.FlashCompat', true);
$config->set('Attr.EnableID', 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); $purifier = new HTMLPurifier($config);

View File

@ -7,11 +7,11 @@
require_once "../config.php"; require_once "../config.php";
require_once "functions.php"; require_once "functions.php";
require_once "../functions.php"; require_once "../functions.php";
require_once "../sessions.php"; require_once "../sessions.php";
require_once "../version.php"; require_once "../version.php";
require_once "../db-prefs.php"; require_once "../db-prefs.php";
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
@ -35,6 +35,13 @@
publishArticlesById($link, array($id), $cmode); publishArticlesById($link, array($id), $cmode);
break; break;
case "toggleUnread":
$cmode = db_escape_string($_REQUEST["unread"]);
$id = db_escape_string($_REQUEST["id"]);
catchupArticlesById($link, array($id), $cmode);
break;
case "setPref": case "setPref":
$id = db_escape_string($_REQUEST["id"]); $id = db_escape_string($_REQUEST["id"]);
$value = db_escape_string($_REQUEST["to"]); $value = db_escape_string($_REQUEST["to"]);

View File

@ -339,7 +339,7 @@
$qfh_ret = queryFeedHeadlines($link, $feed_id, $limit, $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit,
$view_mode, $is_cat, $search, $search_mode, $match_on, $view_mode, $is_cat, $search, $search_mode, $match_on,
"unread DESC, updated, score", $offset); "score DESC, date_entered DESC", $offset);
$result = $qfh_ret[0]; $result = $qfh_ret[0];
$feed_title = $qfh_ret[1]; $feed_title = $qfh_ret[1];
@ -523,6 +523,12 @@
<div class=\"toggle\" onclick=\"togglePublished($id, this)\" toggled=\"$is_published\"><span class=\"thumb\"></span><span class=\"toggleOn\">ON</span><span class=\"toggleOff\">OFF</span></div> <div class=\"toggle\" onclick=\"togglePublished($id, this)\" toggled=\"$is_published\"><span class=\"thumb\"></span><span class=\"toggleOn\">ON</span><span class=\"toggleOff\">OFF</span></div>
</div>"; </div>";
print "<div class=\"row\">
<label>Unread</label>
<div class=\"toggle\" onclick=\"toggleUnread($id, this)\" toggled=\"$is_unread\"><span class=\"thumb\"></span><span class=\"toggleOn\">ON</span><span class=\"toggleOff\">OFF</span></div>
</div>";
print "</fieldset>"; print "</fieldset>";
print "</div>"; print "</div>";

View File

@ -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) { function setPref(elem) {
var toggled = false; var toggled = false;
var id = elem.id; var id = elem.id;