case "collapse":
$cat_id = db_escape_string($_GET["cid"]);
- db_query($link, "UPDATE ttrss_feed_categories SET
- collapsed = NOT collapsed WHERE id = '$cat_id' AND owner_uid = " .
- $_SESSION["uid"]);
+ 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;
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 });
if (fbtn) Element.show(fbtn);
- if (getCookie("ttrss_vf_fclps") == 1) {
+ if (getInitParam("collapsed_feedlist") == 1) {
collapse_feedlist();
}
print "<param key=\"num_feeds\" value=\"".
(int)$num_feeds. "\"/>";
+ print "<param key=\"collapsed_feedlist\" value=\"" .
+ (int) get_pref($link, "_COLLAPSED_FEEDLIST") . "\"/>";
+
print "</init-params>";
}
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);
}
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);
// 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);
/* 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";
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";
// 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") {
$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"]);
- break;
+ } 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");
return;
}
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>";
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
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,
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),
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,
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,
--- /dev/null
+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;
--- /dev/null
+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;
}
function getActiveFeedId() {
-// return getCookie("ttrss_vf_actfeed");
try {
debug("gAFID: " + _active_feed_id);
return _active_feed_id;
}
function setActiveFeedId(id, is_cat) {
-// return setCookie("ttrss_vf_actfeed", id);
try {
debug("sAFID(" + id + ", " + is_cat + ")");
_active_feed_id = id;
// 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);
}
try {
- delCookie("ttrss_vf_test");
+ delCookie("ttrss_test");
// document.onresize = resize_headlines;
window.onresize=resize_headlines;
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);
}
- 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);