add persistent storage for toolbar view options, bump schema
This commit is contained in:
parent
cdbb6dc626
commit
4049672041
12 changed files with 37 additions and 77 deletions
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
error_reporting(DEFAULT_ERROR_LEVEL); */
|
error_reporting(DEFAULT_ERROR_LEVEL); */
|
||||||
|
|
||||||
define('SCHEMA_VERSION', 14);
|
define('SCHEMA_VERSION', 15);
|
||||||
|
|
||||||
require_once "sanity_check.php";
|
require_once "sanity_check.php";
|
||||||
require_once "config.php";
|
require_once "config.php";
|
||||||
|
@ -305,6 +305,9 @@
|
||||||
|
|
||||||
if (!$offset) $offset = 0;
|
if (!$offset) $offset = 0;
|
||||||
|
|
||||||
|
set_pref($link, "_DEFAULT_VIEW_MODE", $view_mode);
|
||||||
|
set_pref($link, "_DEFAULT_VIEW_LIMIT", $limit);
|
||||||
|
|
||||||
if ($subop == "undefined") $subop = "";
|
if ($subop == "undefined") $subop = "";
|
||||||
|
|
||||||
if ($subop == "CatchupSelected") {
|
if ($subop == "CatchupSelected") {
|
||||||
|
|
|
@ -57,12 +57,6 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
|
||||||
toolbar_form.query.value = "";
|
toolbar_form.query.value = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
storeInitParam("toolbar_limit",
|
|
||||||
toolbar_form.limit[toolbar_form.limit.selectedIndex].value);
|
|
||||||
|
|
||||||
storeInitParam("toolbar_view_mode",
|
|
||||||
toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value);
|
|
||||||
|
|
||||||
var query = "backend.php?op=viewfeed&feed=" + feed + "&" +
|
var query = "backend.php?op=viewfeed&feed=" + feed + "&" +
|
||||||
toolbar_query + "&subop=" + param_escape(subop);
|
toolbar_query + "&subop=" + param_escape(subop);
|
||||||
|
|
||||||
|
|
62
functions.js
62
functions.js
|
@ -1502,71 +1502,13 @@ function debug(msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getInitParam(key) {
|
function getInitParam(key) {
|
||||||
var c = getCookie("TTIP:" + key);
|
return init_params[key];
|
||||||
if (c) {
|
|
||||||
return c;
|
|
||||||
} else {
|
|
||||||
return getMainContext().init_params[key];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function storeInitParam(key, value) {
|
function storeInitParam(key, value) {
|
||||||
try {
|
debug("<b>storeInitParam is OBSOLETE: " + key + " => " + value + "</b>");
|
||||||
init_params[key] = value;
|
|
||||||
debug("storeInitParam: " + key + " => " + value +
|
|
||||||
" (" + getInitParam("cookie_lifetime") + ")");
|
|
||||||
if (getInitParam("cookie_lifetime") > 0) {
|
|
||||||
setCookie("TTIP:" + key, value, getInitParam("cookie_lifetime"));
|
|
||||||
} else {
|
|
||||||
setCookie("TTIP:" + key, value);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
exception_error("storeInitParam", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
function storeInitParam(key, value, is_client) {
|
|
||||||
try {
|
|
||||||
if (!is_client) {
|
|
||||||
if (getMainContext().init_params[key] != value) {
|
|
||||||
debug("storeInitParam: " + key + " => " + value);
|
|
||||||
//new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" +
|
|
||||||
// param_escape(key) + "&value=" + param_escape(value));
|
|
||||||
var f = getMainContext().document.getElementById("backReqBox");
|
|
||||||
f.src = "backend.php?op=rpc&subop=storeParam&key=" +
|
|
||||||
param_escape(key) + "&value=" + param_escape(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
getMainContext().init_params[key] = value;
|
|
||||||
} catch (e) {
|
|
||||||
exception_error("storeInitParam", e);
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
|
|
||||||
/*
|
|
||||||
function storeInitParams(params, is_client) {
|
|
||||||
try {
|
|
||||||
var s = "";
|
|
||||||
|
|
||||||
for (k in params) {
|
|
||||||
if (getMainContext().init_params[k] != params[k]) {
|
|
||||||
s += k + "=" + params[k] + ";";
|
|
||||||
getMainContext().init_params[k] = params[k];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
debug("storeInitParams: " + s);
|
|
||||||
|
|
||||||
if (!is_client) {
|
|
||||||
new Ajax.Request("backend.php?op=rpc&subop=storeParams&str=" + s);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
exception_error("storeInitParams", e);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
function fatalError(code, message) {
|
function fatalError(code, message) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
|
@ -2205,6 +2205,12 @@
|
||||||
|
|
||||||
print "<param key=\"cookie_lifetime\" value=\"" . SESSION_COOKIE_LIFETIME . "\"/>";
|
print "<param key=\"cookie_lifetime\" value=\"" . SESSION_COOKIE_LIFETIME . "\"/>";
|
||||||
|
|
||||||
|
print "<param key=\"default_view_mode\" value=\"" .
|
||||||
|
get_pref($link, "_DEFAULT_VIEW_MODE") . "\"/>";
|
||||||
|
|
||||||
|
print "<param key=\"default_view_limit\" value=\"" .
|
||||||
|
sprintf("%d", get_pref($link, "_DEFAULT_VIEW_LIMIT")) . "\"/>";
|
||||||
|
|
||||||
print "</init-params>";
|
print "</init-params>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,6 +308,7 @@
|
||||||
WHERE type_id = ttrss_prefs_types.id AND
|
WHERE type_id = ttrss_prefs_types.id AND
|
||||||
section_id = ttrss_prefs_sections.id AND
|
section_id = ttrss_prefs_sections.id AND
|
||||||
ttrss_user_prefs.pref_name = ttrss_prefs.pref_name AND
|
ttrss_user_prefs.pref_name = ttrss_prefs.pref_name AND
|
||||||
|
short_desc != '' AND
|
||||||
owner_uid = ".$_SESSION["uid"]."
|
owner_uid = ".$_SESSION["uid"]."
|
||||||
ORDER BY section_id,short_desc");
|
ORDER BY section_id,short_desc");
|
||||||
|
|
||||||
|
|
4
prefs.js
4
prefs.js
|
@ -1219,10 +1219,6 @@ function selectTab(id, noupdate, subop) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active_tab != id) {
|
|
||||||
storeInitParam("prefs_active_tab", id);
|
|
||||||
}
|
|
||||||
|
|
||||||
active_tab = id;
|
active_tab = id;
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -188,7 +188,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 (14);
|
insert into ttrss_version values (15);
|
||||||
|
|
||||||
create table ttrss_prefs_types (id integer not null primary key,
|
create table ttrss_prefs_types (id integer not null primary key,
|
||||||
type_name varchar(100) not null) TYPE=InnoDB;
|
type_name varchar(100) not null) TYPE=InnoDB;
|
||||||
|
@ -267,6 +267,10 @@ 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('CDM_AUTO_CATCHUP', 1, 'false', 'Mark articles as read automatically',2,
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('CDM_AUTO_CATCHUP', 1, 'false', 'Mark articles as read automatically',2,
|
||||||
'This option enables marking articles as read automatically in combined mode while you scroll article list.');
|
'This option enables marking articles as read automatically in combined mode while you scroll article list.');
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_MODE', 2, 'adaptive', '', 1);
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_LIMIT', 3, '30', '', 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),
|
||||||
|
|
|
@ -172,7 +172,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 (14);
|
insert into ttrss_version values (15);
|
||||||
|
|
||||||
create table ttrss_prefs_types (id integer not null primary key,
|
create table ttrss_prefs_types (id integer not null primary key,
|
||||||
type_name varchar(100) not null);
|
type_name varchar(100) not null);
|
||||||
|
@ -247,6 +247,10 @@ 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('CDM_AUTO_CATCHUP', 1, 'false', 'Mark articles as read automatically',2,
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('CDM_AUTO_CATCHUP', 1, 'false', 'Mark articles as read automatically',2,
|
||||||
'This option enables marking articles as read automatically in combined mode while you scroll article list.');
|
'This option enables marking articles as read automatically in combined mode while you scroll article list.');
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_MODE', 2, 'adaptive', '', 1);
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_LIMIT', 3, '30', '', 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,
|
||||||
|
|
5
schema/versions/mysql/15.sql
Normal file
5
schema/versions/mysql/15.sql
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_MODE', 2, 'adaptive', '', 1);
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_LIMIT', 3, '30', '', 1);
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 15;
|
5
schema/versions/pgsql/15.sql
Normal file
5
schema/versions/pgsql/15.sql
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_MODE', 2, 'adaptive', '', 1);
|
||||||
|
|
||||||
|
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_DEFAULT_VIEW_LIMIT', 3, '30', '', 1);
|
||||||
|
|
||||||
|
update ttrss_version set schema_version = 15;
|
|
@ -386,10 +386,10 @@ function init_second_stage() {
|
||||||
|
|
||||||
document.onkeydown = hotkey_handler;
|
document.onkeydown = hotkey_handler;
|
||||||
|
|
||||||
var tb = parent.document.forms["main_toolbar_form"];
|
var toolbar = document.forms["main_toolbar_form"];
|
||||||
|
|
||||||
dropboxSelect(tb.view_mode, getInitParam("toolbar_view_mode"));
|
dropboxSelect(toolbar.view_mode, getInitParam("default_view_mode"));
|
||||||
dropboxSelect(tb.limit, getInitParam("toolbar_limit"));
|
dropboxSelect(toolbar.limit, getInitParam("default_view_limit"));
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
define('SCHEMA_VERSION', 14);
|
define('SCHEMA_VERSION', 15);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue