summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend.php24
-rw-r--r--functions.php14
-rw-r--r--sanity_check.php2
-rw-r--r--schema/ttrss_schema_mysql.sql4
-rw-r--r--schema/ttrss_schema_pgsql.sql4
-rw-r--r--schema/versions/mysql/42.sql3
-rw-r--r--schema/versions/pgsql/42.sql3
-rw-r--r--tt-rss.js1
-rw-r--r--tt-rss.php14
9 files changed, 59 insertions, 10 deletions
diff --git a/backend.php b/backend.php
index a632fafad..d5f9741a2 100644
--- a/backend.php
+++ b/backend.php
@@ -271,9 +271,11 @@
$offset = db_escape_string($_GET["skip"]);
$vgroup_last_feed = db_escape_string($_GET["vgrlf"]);
$csync = $_GET["csync"];
+ $order_by = db_escape_string($_GET["order_by"]);
set_pref($link, "_DEFAULT_VIEW_MODE", $view_mode);
set_pref($link, "_DEFAULT_VIEW_LIMIT", $limit);
+ set_pref($link, "_DEFAULT_VIEW_ORDER_BY", $order_by);
if (!$cat_view && preg_match("/^[0-9][0-9]*$/", $feed)) {
db_query($link, "UPDATE ttrss_feeds SET last_viewed = NOW()
@@ -287,10 +289,30 @@
generate_dashboard_feed($link);
} else {
+
+ $override_order = false;
+
+ switch ($order_by) {
+ case "date":
+ if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) {
+ $override_order = "updated";
+ } else {
+ $override_order = "updated DESC";
+ }
+ break;
+
+ case "title":
+ $override_order = "updated DESC";
+ break;
+
+ case "score":
+ $override_order = "score DESC";
+ break;
+ }
$ret = outputHeadlinesList($link, $feed, $subop,
$view_mode, $limit, $cat_view, $next_unread_feed, $offset,
- $vgroup_last_feed);
+ $vgroup_last_feed, $override_order);
$topmost_article_ids = $ret[0];
$headlines_count = $ret[1];
diff --git a/functions.php b/functions.php
index 701d3ec57..34778e375 100644
--- a/functions.php
+++ b/functions.php
@@ -3003,6 +3003,9 @@
print "<param key=\"default_view_limit\" value=\"" .
(int) get_pref($link, "_DEFAULT_VIEW_LIMIT") . "\"/>";
+ print "<param key=\"default_view_order_by\" value=\"" .
+ get_pref($link, "_DEFAULT_VIEW_ORDER_BY") . "\"/>";
+
print "<param key=\"prefs_active_tab\" value=\"" .
get_pref($link, "_PREFS_ACTIVE_TAB") . "\"/>";
@@ -3127,7 +3130,7 @@
$view_query_part = "";
- if ($view_mode == "adaptive") {
+ if ($view_mode == "adaptive" || $view_query_part == "noscores") {
if ($search) {
$view_query_part = " ";
} else if ($feed != -1) {
@@ -3262,7 +3265,9 @@
$order_by = "updated DESC";
}
- $order_by = "score DESC, $order_by";
+ if ($view_mode != "noscores") {
+ $order_by = "score DESC, $order_by";
+ }
if ($override_order) {
$order_by = $override_order;
@@ -4789,7 +4794,8 @@
}
function outputHeadlinesList($link, $feed, $subop, $view_mode, $limit, $cat_view,
- $next_unread_feed, $offset, $vgr_last_feed = false) {
+ $next_unread_feed, $offset, $vgr_last_feed = false,
+ $override_order = false) {
$disable_cache = false;
@@ -4884,7 +4890,7 @@
if ($_GET["debug"]) $timing_info = print_checkpoint("H0", $timing_info);
$qfh_ret = queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view,
- $search, $search_mode, $match_on, false, $real_offset);
+ $search, $search_mode, $match_on, $override_order, $real_offset);
if ($_GET["debug"]) $timing_info = print_checkpoint("H1", $timing_info);
diff --git a/sanity_check.php b/sanity_check.php
index 814a673c2..82605fd67 100644
--- a/sanity_check.php
+++ b/sanity_check.php
@@ -2,7 +2,7 @@
require_once "functions.php";
define('EXPECTED_CONFIG_VERSION', 17);
- define('SCHEMA_VERSION', 41);
+ define('SCHEMA_VERSION', 42);
if (!file_exists("config.php")) {
print __("<b>Fatal Error</b>: You forgot to copy
diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql
index 6b003439f..f8c919e55 100644
--- a/schema/ttrss_schema_mysql.sql
+++ b/schema/ttrss_schema_mysql.sql
@@ -210,7 +210,7 @@ create table ttrss_tags (id integer primary key auto_increment,
create table ttrss_version (schema_version int not null) TYPE=InnoDB;
-insert into ttrss_version values (41);
+insert into ttrss_version values (42);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
@@ -339,6 +339,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ENABLE_FLASH_PLAYER', 1, 'true', 'Enable inline MP3 player', 3, 'Enable the Flash-based XSPF Player to play MP3-format podcast enclosures.');
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', '', 1);
+
create table ttrss_user_prefs (
owner_uid integer not null,
pref_name varchar(250),
diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql
index 5ba024d03..8801b6957 100644
--- a/schema/ttrss_schema_pgsql.sql
+++ b/schema/ttrss_schema_pgsql.sql
@@ -190,7 +190,7 @@ create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid);
create table ttrss_version (schema_version int not null);
-insert into ttrss_version values (41);
+insert into ttrss_version values (42);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
@@ -313,6 +313,8 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('ENABLE_FLASH_PLAYER', 1, 'true', 'Enable inline MP3 player', 3, 'Enable the Flash-based XSPF Player to play MP3-format podcast enclosures.');
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', '', 1);
+
create table ttrss_user_prefs (
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE,
diff --git a/schema/versions/mysql/42.sql b/schema/versions/mysql/42.sql
new file mode 100644
index 000000000..3ae211d07
--- /dev/null
+++ b/schema/versions/mysql/42.sql
@@ -0,0 +1,3 @@
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', '', 1);
+
+update ttrss_version set schema_version = 42;
diff --git a/schema/versions/pgsql/42.sql b/schema/versions/pgsql/42.sql
new file mode 100644
index 000000000..3ae211d07
--- /dev/null
+++ b/schema/versions/pgsql/42.sql
@@ -0,0 +1,3 @@
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_ORDER_BY', 2, 'default', '', 1);
+
+update ttrss_version set schema_version = 42;
diff --git a/tt-rss.js b/tt-rss.js
index a63ccacb5..9a5235497 100644
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -464,6 +464,7 @@ function init_second_stage() {
dropboxSelect(toolbar.view_mode, getInitParam("default_view_mode"));
dropboxSelect(toolbar.limit, getInitParam("default_view_limit"));
+ dropboxSelect(toolbar.order_by, getInitParam("default_view_order_by"));
daemon_enabled = getInitParam("daemon_enabled") == 1;
daemon_refresh_only = getInitParam("daemon_refresh_only") == 1;
diff --git a/tt-rss.php b/tt-rss.php
index dd6edef99..6bbec6784 100644
--- a/tt-rss.php
+++ b/tt-rss.php
@@ -184,14 +184,24 @@ window.onload = init;
<?php } ?>
- <?php echo __('View:') ?>
<select name="view_mode" onchange="viewModeChanged()">
<option selected value="adaptive"><?php echo __('Adaptive') ?></option>
<option value="all_articles"><?php echo __('All Articles') ?></option>
<option value="marked"><?php echo __('Starred') ?></option>
<option value="unread"><?php echo __('Unread') ?></option>
+ <!-- <option value="noscores"><?php echo __('Ignore Scoring') ?></option> -->
</select>
-
+
+ <?php echo __('Order by:') ?>
+
+ <select name="order_by" onchange="viewModeChanged()">
+ <option 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>
+ </select>
+
+
<?php echo __('Limit:') ?>
<?php
$limits = array(15 => 15, 30 => 30, 60 => 60, 0 => "All");