retire frankly ridiculous sorting by score/title/date/default
keep defaul and oldest first instead of REVERSE_HEADLINES
This commit is contained in:
parent
699e3cfc65
commit
b9a06a0e39
7 changed files with 31 additions and 69 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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" */
|
||||
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
|
|
@ -996,9 +996,6 @@
|
|||
|
||||
//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) {
|
||||
|
||||
|
@ -1018,7 +1015,7 @@
|
|||
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) {
|
||||
|
@ -1026,7 +1023,6 @@
|
|||
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");
|
||||
}
|
||||
|
||||
|
@ -1035,7 +1031,7 @@
|
|||
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
|
||||
|
@ -1044,7 +1040,7 @@
|
|||
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");
|
||||
}
|
||||
|
||||
|
@ -1052,7 +1048,7 @@
|
|||
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");
|
||||
}
|
||||
|
||||
|
@ -1085,7 +1081,7 @@
|
|||
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");
|
||||
}
|
||||
|
||||
|
@ -1096,7 +1092,6 @@
|
|||
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");
|
||||
|
||||
}
|
||||
|
@ -1114,7 +1109,7 @@
|
|||
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");
|
||||
|
@ -2361,11 +2356,7 @@
|
|||
$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
|
||||
|
@ -2376,11 +2367,7 @@
|
|||
$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 {
|
||||
|
@ -2434,11 +2421,7 @@
|
|||
$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";
|
||||
|
|
|
@ -177,9 +177,7 @@
|
|||
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 -->
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
18
js/tt-rss.js
18
js/tt-rss.js
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue