$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()
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];
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") . "\"/>";
$view_query_part = "";
- if ($view_mode == "adaptive") {
+ if ($view_mode == "adaptive" || $view_query_part == "noscores") {
if ($search) {
$view_query_part = " ";
} else if ($feed != -1) {
$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;
}
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;
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);
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
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,
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),
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,
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,
--- /dev/null
+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;
--- /dev/null
+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;
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;
<?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");