]> git.wh0rd.org Git - tt-rss.git/commitdiff
mobile: fix headline ordering
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 9 Sep 2011 10:24:14 +0000 (14:24 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 9 Sep 2011 10:25:05 +0000 (14:25 +0400)
mobile: fix htmlpurifier cache being included from wrong directory
mobile: implement ability to mark article as unread (closes #367)

functions.php
mobile/backend.php
mobile/functions.php
mobile/mobile.js

index 48ab664c896212ca165bbb104caef39d3d50d99f..5ec459fa8ccb20f96b92755dc4a990eb2b3ea2c8 100644 (file)
        @$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);
 
index 85018c58048db12769a79fc7c8da38a892898899..2e473a37533f6701502b35435074d6597d1c4c33 100644 (file)
@@ -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);
 
                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"]);
index eb523d710e6d653205e56099ad55f115d001713c..e84be93429137afea429a0039c44d6d59860d11c 100644 (file)
 
                $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];
                        <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>";
 
+                       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 "</div>";
index 6b5736193feaa758ff4a7f2309c8bc1b0b1bf6b6..2a948ca4f46704eab739ea20d18223695b284d58 100644 (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) {
        var toggled = false;
        var id = elem.id;