obsolete cookie storage for collapsed status of feedlist and special categories (bump schema)

This commit is contained in:
Andrew Dolgov 2009-12-24 15:25:06 +03:00
parent 44258fa967
commit 57937c42b9
12 changed files with 120 additions and 107 deletions

View File

@ -174,9 +174,33 @@
case "collapse":
$cat_id = db_escape_string($_GET["cid"]);
if ($cat_id > 0) {
db_query($link, "UPDATE ttrss_feed_categories SET
collapsed = NOT collapsed WHERE id = '$cat_id' AND owner_uid = " .
$_SESSION["uid"]);
} else {
$pref_name = '';
switch ($cat_id) {
case -1:
$pref_name = '_COLLAPSED_SPECIAL';
break;
case -2:
$pref_name = '_COLLAPSED_LABELS';
break;
case 0:
$pref_name = '_COLLAPSED_UNCAT';
break;
}
if ($pref_name) {
if (get_pref($link, $pref_name)) {
set_pref($link, $pref_name, 'false');
} else {
set_pref($link, $pref_name, 'true');
}
}
}
return;
break;

View File

@ -389,45 +389,6 @@ function toggleCollapseCat(cat) {
var cat_list = $("FCATLIST-" + cat).parentNode;
var caption = $("FCAP-" + cat);
/* if (cat_list.className.match("invisible")) {
cat_list.className = "";
caption.innerHTML = caption.innerHTML.replace("...", "");
if (cat == 0) {
setCookie("ttrss_vf_uclps", "0");
}
} else {
cat_list.className = "invisible";
caption.innerHTML = caption.innerHTML + "...";
if (cat == 0) {
setCookie("ttrss_vf_uclps", "1");
}
} */
if (cat == 0) {
if (Element.visible("FCATLIST-" + cat)) {
setCookie("ttrss_vf_uclps", "1");
} else {
setCookie("ttrss_vf_uclps", "0");
}
}
if (cat == -2) {
if (Element.visible("FCATLIST-" + cat)) {
setCookie("ttrss_vf_lclps", "1");
} else {
setCookie("ttrss_vf_lclps", "0");
}
}
if (cat == -1) {
if (Element.visible("FCATLIST-" + cat)) {
setCookie("ttrss_vf_vclps", "1");
} else {
setCookie("ttrss_vf_vclps", "0");
}
}
Effect.toggle('FCATLIST-' + cat, 'blind', { duration: 0.5,
afterFinish: toggleCollapseCat_af });
@ -602,7 +563,7 @@ function init_collapsable_feedlist(theme) {
if (fbtn) Element.show(fbtn);
if (getCookie("ttrss_vf_fclps") == 1) {
if (getInitParam("collapsed_feedlist") == 1) {
collapse_feedlist();
}

View File

@ -3080,6 +3080,9 @@
print "<param key=\"num_feeds\" value=\"".
(int)$num_feeds. "\"/>";
print "<param key=\"collapsed_feedlist\" value=\"" .
(int) get_pref($link, "_COLLAPSED_FEEDLIST") . "\"/>";
print "</init-params>";
}
@ -4162,11 +4165,7 @@
if (get_pref($link, 'ENABLE_FEED_CATS')) {
if ($_COOKIE["ttrss_vf_vclps"] == 1) {
$cat_hidden = true;
} else {
$cat_hidden = false;
}
$cat_hidden = get_pref($link, "_COLLAPSED_SPECIAL");
printCategoryHeader($link, -1, $cat_hidden, false);
}
@ -4225,11 +4224,7 @@
if (db_num_rows($result) > 0) {
if (get_pref($link, 'ENABLE_FEED_CATS')) {
if ($_COOKIE["ttrss_vf_lclps"] == 1) {
$cat_hidden = true;
} else {
$cat_hidden = false;
}
$cat_hidden = get_pref($link, "_COLLAPSED_LABELS");
printCategoryHeader($link, -2, $cat_hidden, true);
@ -4381,9 +4376,7 @@
// workaround for NULL category
if ($category == __("Uncategorized")) {
if ($_COOKIE["ttrss_vf_uclps"] == 1) {
$collapsed = "t";
}
$collapsed = get_pref($link, "_COLLAPSED_UNCAT");
}
$cat_id = sprintf("%d", $cat_id);

View File

@ -30,11 +30,8 @@
/* virtual feeds */
if (get_pref($link, 'ENABLE_FEED_CATS')) {
if ($_COOKIE["ttrss_vf_vclps"] == 1) {
$collapsed = true;
} else {
$collapsed = false;
}
$collapsed = get_pref($link, "_COLLAPSED_SPECIAL");
if ($collapsed == "t" || $collapsed == "1") {
$holder_class = "invisible";
@ -100,11 +97,7 @@
if (db_num_rows($result) > 0) {
if (get_pref($link, 'ENABLE_FEED_CATS')) {
if ($_COOKIE["ttrss_vf_lclps"] == 1) {
$collapsed = true;
} else {
$collapsed = false;
}
$collapsed = get_pref($link, "_COLLAPSED_LABELS");
if ($collapsed == "t" || $collapsed == "1") {
$holder_class = "invisible";
@ -250,9 +243,7 @@
// workaround for NULL category
if ($category == "Uncategorized") {
if ($_COOKIE["ttrss_vf_uclps"] == 1) {
$collapsed = "t";
}
$collapsed = get_pref($link, "_COLLAPSED_UNCAT");
}
if ($collapsed == "t" || $collapsed == "1") {

View File

@ -27,33 +27,32 @@
$cat_id = db_escape_string($_GET["id"]);
switch ($cat_id) {
case 0:
if ($_COOKIE["ttrss_vf_uclps"] != 1) {
setcookie("ttrss_vf_uclps", 1);
} else {
setcookie("ttrss_vf_uclps", 0);
}
break;
case -1:
if ($_COOKIE["ttrss_vf_vclps"] != 1) {
setcookie("ttrss_vf_vclps", 1);
} else {
setcookie("ttrss_vf_vclps", 0);
}
break;
case -2:
if ($_COOKIE["ttrss_vf_lclps"] != 1) {
setcookie("ttrss_vf_lclps", 1);
} else {
setcookie("ttrss_vf_lclps", 0);
}
break;
default:
if ($cat_id > 0) {
db_query($link, "UPDATE ttrss_feed_categories SET
collapsed = NOT collapsed WHERE id = '$cat_id' AND owner_uid = " .
$_SESSION["uid"]);
} else {
$pref_name = '';
switch ($cat_id) {
case -1:
$pref_name = '_COLLAPSED_SPECIAL';
break;
case -2:
$pref_name = '_COLLAPSED_LABELS';
break;
case 0:
$pref_name = '_COLLAPSED_UNCAT';
break;
}
if ($pref_name) {
if (get_pref($link, $pref_name)) {
set_pref($link, $pref_name, 'false');
} else {
set_pref($link, $pref_name, 'true');
}
}
}
header("Location: index.php");

View File

@ -633,17 +633,17 @@
ttrss_feed_categories WHERE owner_uid = ".$_SESSION["uid"]);
print "<category id=\"0\" collapsed=\"".
(int)$_COOKIE["ttrss_vf_uclps"]."\"><![CDATA[";
(int)get_pref($link, "_COLLAPSED_UNCAT")."\"><![CDATA[";
print __("Uncategorized");
print "]]></category>";
print "<category id=\"-1\" collapsed=\"".
(int)$_COOKIE["ttrss_vf_vclps"]."\"><![CDATA[";
(int)get_pref($link, "_COLLAPSED_SPECIAL")."\"><![CDATA[";
print __("Special");
print "]]></category>";
print "<category id=\"-2\" collapsed=\"".
(int)$_COOKIE["ttrss_vf_lclps"]."\"><![CDATA[";
(int)get_pref($link, "_COLLAPSED_LABELS")."\"><![CDATA[";
print __("Labels");
print "]]></category>";

View File

@ -2,7 +2,7 @@
require_once "functions.php";
define('EXPECTED_CONFIG_VERSION', 18);
define('SCHEMA_VERSION', 58);
define('SCHEMA_VERSION', 59);
if (!file_exists("config.php")) {
print "<b>Fatal Error</b>: You forgot to copy

View File

@ -226,7 +226,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 (58);
insert into ttrss_version values (59);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
@ -361,6 +361,14 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_API_ACCESS', 1, 'false', 'Enable external API', 3);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_SPECIAL', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_LABELS', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_UNCAT', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_FEEDLIST', 1, 'false', '', 1);
create table ttrss_user_prefs (
owner_uid integer not null,
pref_name varchar(250),

View File

@ -202,7 +202,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 (58);
insert into ttrss_version values (59);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
@ -331,6 +331,14 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('ENABLE_API_ACCESS', 1, 'false', 'Enable external API', 3);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_SPECIAL', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_LABELS', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_UNCAT', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_FEEDLIST', 1, 'false', '', 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,

View File

@ -0,0 +1,13 @@
begin;
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_SPECIAL', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_LABELS', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_FEEDLIST', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_UNCAT', 1, 'false', '', 1);
update ttrss_version set schema_version = 59;
commit;

View File

@ -0,0 +1,13 @@
begin;
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_SPECIAL', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_LABELS', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_FEEDLIST', 1, 'false', '', 1);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('_COLLAPSED_UNCAT', 1, 'false', '', 1);
update ttrss_version set schema_version = 59;
commit;

View File

@ -27,7 +27,6 @@ function activeFeedIsCat() {
}
function getActiveFeedId() {
// return getCookie("ttrss_vf_actfeed");
try {
debug("gAFID: " + _active_feed_id);
return _active_feed_id;
@ -37,7 +36,6 @@ function getActiveFeedId() {
}
function setActiveFeedId(id, is_cat) {
// return setCookie("ttrss_vf_actfeed", id);
try {
debug("sAFID(" + id + ", " + is_cat + ")");
_active_feed_id = id;
@ -372,9 +370,9 @@ function genericSanityCheck() {
// if (!Ajax.getTransport()) fatalError(1);
setCookie("ttrss_vf_test", "TEST");
setCookie("ttrss_test", "TEST");
if (getCookie("ttrss_vf_test") != "TEST") {
if (getCookie("ttrss_test") != "TEST") {
fatalError(2);
}
@ -504,7 +502,7 @@ function init_second_stage() {
try {
delCookie("ttrss_vf_test");
delCookie("ttrss_test");
// document.onresize = resize_headlines;
window.onresize=resize_headlines;
@ -943,7 +941,9 @@ function collapse_feedlist() {
if (fc) fc.style.left = fl.offsetWidth + 40 + "px";
}
setCookie("ttrss_vf_fclps", "0");
query = "backend.php?op=rpc&subop=setpref&key=_COLLAPSED_FEEDLIST&value=false";
new Ajax.Request(query);
} else {
Element.hide(fl);
@ -965,7 +965,10 @@ function collapse_feedlist() {
}
setCookie("ttrss_vf_fclps", "1");
query = "backend.php?op=rpc&subop=setpref&key=_COLLAPSED_FEEDLIST&value=true";
new Ajax.Request(query);
}
} catch (e) {
exception_error("toggle_feedlist", e);