main toolbar: add dropbox to select headlines sort mode
This commit is contained in:
parent
d0bd9acb41
commit
7b4d02a834
24
backend.php
24
backend.php
|
@ -271,9 +271,11 @@
|
||||||
$offset = db_escape_string($_GET["skip"]);
|
$offset = db_escape_string($_GET["skip"]);
|
||||||
$vgroup_last_feed = db_escape_string($_GET["vgrlf"]);
|
$vgroup_last_feed = db_escape_string($_GET["vgrlf"]);
|
||||||
$csync = $_GET["csync"];
|
$csync = $_GET["csync"];
|
||||||
|
$order_by = db_escape_string($_GET["order_by"]);
|
||||||
|
|
||||||
set_pref($link, "_DEFAULT_VIEW_MODE", $view_mode);
|
set_pref($link, "_DEFAULT_VIEW_MODE", $view_mode);
|
||||||
set_pref($link, "_DEFAULT_VIEW_LIMIT", $limit);
|
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)) {
|
if (!$cat_view && preg_match("/^[0-9][0-9]*$/", $feed)) {
|
||||||
db_query($link, "UPDATE ttrss_feeds SET last_viewed = NOW()
|
db_query($link, "UPDATE ttrss_feeds SET last_viewed = NOW()
|
||||||
|
@ -287,10 +289,30 @@
|
||||||
generate_dashboard_feed($link);
|
generate_dashboard_feed($link);
|
||||||
|
|
||||||
} else {
|
} 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,
|
$ret = outputHeadlinesList($link, $feed, $subop,
|
||||||
$view_mode, $limit, $cat_view, $next_unread_feed, $offset,
|
$view_mode, $limit, $cat_view, $next_unread_feed, $offset,
|
||||||
$vgroup_last_feed);
|
$vgroup_last_feed, $override_order);
|
||||||
|
|
||||||
$topmost_article_ids = $ret[0];
|
$topmost_article_ids = $ret[0];
|
||||||
$headlines_count = $ret[1];
|
$headlines_count = $ret[1];
|
||||||
|
|
|
@ -3003,6 +3003,9 @@
|
||||||
print "<param key=\"default_view_limit\" value=\"" .
|
print "<param key=\"default_view_limit\" value=\"" .
|
||||||
(int) get_pref($link, "_DEFAULT_VIEW_LIMIT") . "\"/>";
|
(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=\"" .
|
print "<param key=\"prefs_active_tab\" value=\"" .
|
||||||
get_pref($link, "_PREFS_ACTIVE_TAB") . "\"/>";
|
get_pref($link, "_PREFS_ACTIVE_TAB") . "\"/>";
|
||||||
|
|
||||||
|
@ -3127,7 +3130,7 @@
|
||||||
|
|
||||||
$view_query_part = "";
|
$view_query_part = "";
|
||||||
|
|
||||||
if ($view_mode == "adaptive") {
|
if ($view_mode == "adaptive" || $view_query_part == "noscores") {
|
||||||
if ($search) {
|
if ($search) {
|
||||||
$view_query_part = " ";
|
$view_query_part = " ";
|
||||||
} else if ($feed != -1) {
|
} else if ($feed != -1) {
|
||||||
|
@ -3262,7 +3265,9 @@
|
||||||
$order_by = "updated DESC";
|
$order_by = "updated DESC";
|
||||||
}
|
}
|
||||||
|
|
||||||
$order_by = "score DESC, $order_by";
|
if ($view_mode != "noscores") {
|
||||||
|
$order_by = "score DESC, $order_by";
|
||||||
|
}
|
||||||
|
|
||||||
if ($override_order) {
|
if ($override_order) {
|
||||||
$order_by = $override_order;
|
$order_by = $override_order;
|
||||||
|
@ -4789,7 +4794,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputHeadlinesList($link, $feed, $subop, $view_mode, $limit, $cat_view,
|
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;
|
$disable_cache = false;
|
||||||
|
|
||||||
|
@ -4884,7 +4890,7 @@
|
||||||
if ($_GET["debug"]) $timing_info = print_checkpoint("H0", $timing_info);
|
if ($_GET["debug"]) $timing_info = print_checkpoint("H0", $timing_info);
|
||||||
|
|
||||||
$qfh_ret = queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view,
|
$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);
|
if ($_GET["debug"]) $timing_info = print_checkpoint("H1", $timing_info);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
require_once "functions.php";
|
require_once "functions.php";
|
||||||
|
|
||||||
define('EXPECTED_CONFIG_VERSION', 17);
|
define('EXPECTED_CONFIG_VERSION', 17);
|
||||||
define('SCHEMA_VERSION', 41);
|
define('SCHEMA_VERSION', 42);
|
||||||
|
|
||||||
if (!file_exists("config.php")) {
|
if (!file_exists("config.php")) {
|
||||||
print __("<b>Fatal Error</b>: You forgot to copy
|
print __("<b>Fatal Error</b>: You forgot to copy
|
||||||
|
|
|
@ -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;
|
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,
|
create table ttrss_enclosures (id serial not null primary key,
|
||||||
content_url text not null,
|
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,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 (
|
create table ttrss_user_prefs (
|
||||||
owner_uid integer not null,
|
owner_uid integer not null,
|
||||||
pref_name varchar(250),
|
pref_name varchar(250),
|
||||||
|
|
|
@ -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);
|
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,
|
create table ttrss_enclosures (id serial not null primary key,
|
||||||
content_url text not null,
|
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,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 (
|
create table ttrss_user_prefs (
|
||||||
owner_uid integer not null references ttrss_users(id) ON DELETE CASCADE,
|
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,
|
pref_name varchar(250) not null references ttrss_prefs(pref_name) ON DELETE CASCADE,
|
||||||
|
|
|
@ -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;
|
|
@ -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;
|
|
@ -464,6 +464,7 @@ function init_second_stage() {
|
||||||
|
|
||||||
dropboxSelect(toolbar.view_mode, getInitParam("default_view_mode"));
|
dropboxSelect(toolbar.view_mode, getInitParam("default_view_mode"));
|
||||||
dropboxSelect(toolbar.limit, getInitParam("default_view_limit"));
|
dropboxSelect(toolbar.limit, getInitParam("default_view_limit"));
|
||||||
|
dropboxSelect(toolbar.order_by, getInitParam("default_view_order_by"));
|
||||||
|
|
||||||
daemon_enabled = getInitParam("daemon_enabled") == 1;
|
daemon_enabled = getInitParam("daemon_enabled") == 1;
|
||||||
daemon_refresh_only = getInitParam("daemon_refresh_only") == 1;
|
daemon_refresh_only = getInitParam("daemon_refresh_only") == 1;
|
||||||
|
|
14
tt-rss.php
14
tt-rss.php
|
@ -184,14 +184,24 @@ window.onload = init;
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php echo __('View:') ?>
|
|
||||||
<select name="view_mode" onchange="viewModeChanged()">
|
<select name="view_mode" onchange="viewModeChanged()">
|
||||||
<option selected value="adaptive"><?php echo __('Adaptive') ?></option>
|
<option selected value="adaptive"><?php echo __('Adaptive') ?></option>
|
||||||
<option value="all_articles"><?php echo __('All Articles') ?></option>
|
<option value="all_articles"><?php echo __('All Articles') ?></option>
|
||||||
<option value="marked"><?php echo __('Starred') ?></option>
|
<option value="marked"><?php echo __('Starred') ?></option>
|
||||||
<option value="unread"><?php echo __('Unread') ?></option>
|
<option value="unread"><?php echo __('Unread') ?></option>
|
||||||
|
<!-- <option value="noscores"><?php echo __('Ignore Scoring') ?></option> -->
|
||||||
</select>
|
</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 echo __('Limit:') ?>
|
||||||
<?php
|
<?php
|
||||||
$limits = array(15 => 15, 30 => 30, 60 => 60, 0 => "All");
|
$limits = array(15 => 15, 30 => 30, 60 => 60, 0 => "All");
|
||||||
|
|
Loading…
Reference in New Issue