]> git.wh0rd.org Git - tt-rss.git/commitdiff
retire frankly ridiculous sorting by score/title/date/default
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 28 Mar 2013 16:44:43 +0000 (20:44 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 28 Mar 2013 16:44:43 +0000 (20:44 +0400)
keep defaul and oldest first instead of REVERSE_HEADLINES

classes/feeds.php
classes/pref/prefs.php
classes/rpc.php
include/functions.php
index.php
js/feedlist.js
js/tt-rss.js

index 1086dc493dfd062509c3678b84b77baa32fccaff..6aca206a2f6c8e8985ba8d6fa7a5fd4559fc30f8 100644 (file)
@@ -869,28 +869,8 @@ class Feeds extends Handler_Protected {
                }
 
                switch ($order_by) {
-                       case "date":
-                               if (get_pref($this->link, 'REVERSE_HEADLINES', $owner_uid)) {
-                                       $override_order = "$date_sort_field, updated";
-                               } else {
-                                       $override_order = "$date_sort_field DESC, updated DESC";
-                               }
-                               break;
-
-                       case "title":
-                               if (get_pref($this->link, 'REVERSE_HEADLINES', $owner_uid)) {
-                                       $override_order = "title DESC, $date_sort_field, updated";
-                               } else {
-                                       $override_order = "title, $date_sort_field DESC, updated DESC";
-                               }
-                               break;
-
-                       case "score":
-                               if (get_pref($this->link, 'REVERSE_HEADLINES', $owner_uid)) {
-                                       $override_order = "score, $date_sort_field, updated";
-                               } else {
-                                       $override_order = "score DESC, $date_sort_field DESC, updated DESC";
-                               }
+                       case "date_reverse":
+                               $override_order = "$date_sort_field, updated";
                                break;
                }
 
index 3226ccde9a88570ca1fd5233cc42e682f9c39d2d..be8b94447800b0120793ce587ce7d8439c8acfd3 100644 (file)
@@ -121,7 +121,7 @@ class Pref_Prefs extends Handler_Protected {
 
                global $access_level_names;
 
-               $prefs_blacklist = array("STRIP_UNSAFE_TAGS");
+               $prefs_blacklist = array("STRIP_UNSAFE_TAGS", "REVERSE_HEADLINES");
 
                /* "FEEDS_SORT_BY_UNREAD", "HIDE_READ_FEEDS", "REVERSE_HEADLINES" */
 
index 72028759e7286fe69d6090d0a4563be4b88e989b..66bdb86b03a80052cef084919947af1cc238206c 100644 (file)
@@ -544,9 +544,8 @@ class RPC extends Handler_Protected {
        function catchupFeed() {
                $feed_id = db_escape_string($this->link, $_REQUEST['feed_id']);
                $is_cat = db_escape_string($this->link, $_REQUEST['is_cat']) == "true";
-               $max_id = (int) db_escape_string($this->link, $_REQUEST['max_id']);
 
-               catchup_feed($this->link, $feed_id, $is_cat, false, $max_id);
+               catchup_feed($this->link, $feed_id, $is_cat, false);
 
                print json_encode(array("message" => "UPDATE_COUNTERS"));
        }
index be90b15b4db26bb923b13a2c089eb493bef9b4b9..4f8eb057400dd475a478908ea27aa04ae17bd449 100644 (file)
 
                        //if (preg_match("/^-?[0-9][0-9]*$/", $feed) != false) {
 
-                       $ref_check_qpart = ($max_id &&
-                               !get_pref($link, 'REVERSE_HEADLINES')) ? "ref_id <= '$max_id'" : "true";
-
                        if (is_numeric($feed)) {
                                if ($cat_view) {
 
                                                db_query($link, "UPDATE ttrss_user_entries
                                                        SET unread = false,last_read = NOW()
                                                        WHERE feed_id IN (SELECT id FROM ttrss_feeds WHERE $cat_qpart)
-                                                       AND $ref_check_qpart AND unread = true
+                                                       AND unread = true
                                                        AND owner_uid = $owner_uid");
 
                                        } else if ($feed == -2) {
                                                db_query($link, "UPDATE ttrss_user_entries
                                                        SET unread = false,last_read = NOW() WHERE (SELECT COUNT(*)
                                                                FROM ttrss_user_labels2 WHERE article_id = ref_id) > 0
-                                                               AND $ref_check_qpart
                                                                AND unread = true AND owner_uid = $owner_uid");
                                        }
 
                                        db_query($link, "UPDATE ttrss_user_entries
                                                        SET unread = false,last_read = NOW()
                                                        WHERE feed_id = '$feed'
-                                                       AND $ref_check_qpart AND unread = true
+                                                       AND unread = true
                                                        AND owner_uid = $owner_uid");
 
                                } else if ($feed < 0 && $feed > LABEL_BASE_INDEX) { // special, like starred
                                                db_query($link, "UPDATE ttrss_user_entries
                                                        SET unread = false,last_read = NOW()
                                                        WHERE marked = true
-                                                       AND $ref_check_qpart AND unread = true
+                                                       AND unread = true
                                                        AND owner_uid = $owner_uid");
                                        }
 
                                                db_query($link, "UPDATE ttrss_user_entries
                                                        SET unread = false,last_read = NOW()
                                                        WHERE published = true
-                                                       AND $ref_check_qpart AND unread = true
+                                                       AND unread = true
                                                        AND owner_uid = $owner_uid");
                                        }
 
                                        if ($feed == -4) {
                                                db_query($link, "UPDATE ttrss_user_entries
                                                        SET unread = false,last_read = NOW()
-                                                       WHERE $ref_check_qpart AND unread = true AND
+                                                       WHERE unread = true AND
                                                        owner_uid = $owner_uid");
                                        }
 
                                        db_query($link, "UPDATE ttrss_user_entries, ttrss_user_labels2
                                                SET unread = false, last_read = NOW()
                                                        WHERE label_id = '$label_id' AND unread = true
-                                                       AND $ref_check_qpart
                                                        AND owner_uid = '$owner_uid' AND ref_id = article_id");
 
                                }
                                while ($line = db_fetch_assoc($result)) {
                                        db_query($link, "UPDATE ttrss_user_entries SET
                                                unread = false, last_read = NOW()
-                                               WHERE $ref_check_qpart AND unread = true
+                                               WHERE unread = true
                                                AND int_id = " . $line["post_int_id"]);
                                }
                                db_query($link, "COMMIT");
                                $allow_archived = true;
 
                                if (!$override_order) {
-                                       if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) {
-                                               $override_order = "date_entered, updated";
-                                       } else {
-                                               $override_order = "last_marked DESC, date_entered DESC, updated DESC";
-                                       }
+                                       $override_order = "last_marked DESC, date_entered DESC, updated DESC";
                                }
 
                        } else if ($feed == -2) { // published virtual feed OR labels category
                                        $allow_archived = true;
 
                                        if (!$override_order) {
-                                               if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) {
-                                                       $override_order = "date_entered, updated";
-                                               } else {
-                                                       $override_order = "last_published DESC, date_entered DESC, updated DESC";
-                                               }
+                                               $override_order = "last_published DESC, date_entered DESC, updated DESC";
                                        }
 
                                } else {
                                $date_sort_field = "date_entered";
                        }
 
-                       if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) {
-                               $order_by = "$date_sort_field, updated";
-                       } else {
-                               $order_by = "$date_sort_field DESC, updated DESC";
-                       }
+                       $order_by = "$date_sort_field DESC, updated DESC";
 
                        if ($view_mode != "noscores") {
                                $order_by = "score DESC, $order_by";
index 2aa4891eff0be65f3dd3d009e48657eebbce2910..963e5940cf2bcde2d237711da48705c406a85994 100644 (file)
--- a/index.php
+++ b/index.php
                        onchange="viewModeChanged()"
                        dojoType="dijit.form.Select" name="order_by">
                        <option selected="selected" value="default"><?php echo __('Default') ?></option>
-                       <option value="date"><?php echo __('Date') ?></option>
-                       <option value="title"><?php echo __('Title') ?></option>
-                       <option value="score"><?php echo __('Score') ?></option>
+                       <option value="date_reverse"><?php echo __('Oldest first') ?></option>
                </select>
 
                <!-- deprecated -->
index ec3b09dabb24552a34a8e9a588b9900527996be6..28fadc0b02b51497ddc0a73e16c6bc0a3d65e68f 100644 (file)
@@ -413,20 +413,8 @@ function catchupFeed(feed, is_cat) {
                        return;
                }
 
-               var max_id = 0;
-
-               if (feed == getActiveFeedId() && is_cat == activeFeedIsCat()) {
-                       $$("#headlines-frame > div[id*=RROW]").each(
-                               function(child) {
-                                       var id = parseInt(child.id.replace("RROW-", ""));
-
-                                       if (id > max_id) max_id = id;
-                               }
-                       );
-               }
-
                var catchup_query = "?op=rpc&method=catchupFeed&feed_id=" +
-                       feed + "&is_cat=" + is_cat + "&max_id=" + max_id;
+                       feed + "&is_cat=" + is_cat;
 
                console.log(catchup_query);
 
index ae5815b68de0f41f6054184e969804660af92344..d38b203c1b6fefb40e10e9825dbfcf6a0b64e44e 100644 (file)
@@ -854,13 +854,27 @@ function inPreferences() {
 function reverseHeadlineOrder() {
        try {
 
-               var query_str = "?op=rpc&method=togglepref&key=REVERSE_HEADLINES";
+               /* var query_str = "?op=rpc&method=togglepref&key=REVERSE_HEADLINES";
 
                new Ajax.Request("backend.php", {
                        parameters: query_str,
                        onComplete: function(transport) {
                                        viewCurrentFeed();
-                               } });
+                               } }); */
+
+               var toolbar = document.forms["main_toolbar_form"];
+               var order_by = dijit.getEnclosingWidget(toolbar.order_by);
+
+               var value = order_by.attr('value');
+
+               if (value == "date_reverse")
+                       value = "default";
+               else
+                       value = "date_reverse";
+
+               order_by.attr('value', value);
+
+               viewCurrentFeed();
 
        } catch (e) {
                exception_error("reverseHeadlineOrder", e);