get rid of vf_hreadf cookie, move data to init-param

This commit is contained in:
Andrew Dolgov 2006-05-23 07:32:22 +01:00
parent 33d13e72e2
commit e8bd0da952
5 changed files with 22 additions and 45 deletions

View file

@ -102,11 +102,6 @@
}
if ($_SESSION["uid"]) {
if (get_pref($link, "HIDE_READ_FEEDS") == "true") {
setcookie("ttrss_vf_hreadf", 1);
} else {
setcookie("ttrss_vf_hreadf", 0);
}
// setcookie('ttrss_vf_refresh', FEEDS_FRAME_REFRESH);
// setcookie('ttrss_vf_daemon', ENABLE_UPDATE_DAEMON);

View file

@ -189,10 +189,8 @@ function toggleCollapseCat(cat) {
}
}
xmlhttp_rpc.open("GET", "backend.php?op=feeds&subop=collapse&cid=" +
param_escape(cat), true);
xmlhttp_rpc.onreadystatechange=rpc_pnotify_callback;
xmlhttp_rpc.send(null);
new Ajax.Request("backend.php?op=feeds&subop=collapse&cid=" +
param_escape(cat));
} catch (e) {
exception_error("toggleCollapseCat", e);
@ -206,7 +204,7 @@ function init() {
parent.debug("in feedlist init");
hideOrShowFeeds(document, getCookie("ttrss_vf_hreadf") == 1);
hideOrShowFeeds(document, getInitParam("hide_read_feeds") == 1);
document.onkeydown = hotkey_handler;
parent.setTimeout("timeout()", 0);

View file

@ -783,7 +783,7 @@ function getRelativeFeedId(list, id, direction, unread_only) {
}
} else if (child.id.match("FEEDR-")) {
if (getCookie("ttrss_vf_hreadf") == 1) {
if (getInitParam("hide_read_feeds") == 1) {
if (child.className != "feed") {
alert(child.className);
return child.id.replace('FEEDR-', '');
@ -798,7 +798,7 @@ function getRelativeFeedId(list, id, direction, unread_only) {
var feed = list.ownerDocument.getElementById("FEEDR-" + getActiveFeedId());
if (getCookie("ttrss_vf_hreadf") == 1) {
if (getInitParam("hide_read_feeds") == 1) {
unread_only = true;
}
@ -1098,11 +1098,13 @@ function getInitParam(key) {
}
// TODO: batch mode
function storeInitParam(key, value) {
function storeInitParam(key, value, is_client) {
try {
getMainContext().init_params[key] = value;
new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" +
param_escape(key) + "&value=" + param_escape(value));
if (!is_client) {
new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" +
param_escape(key) + "&value=" + param_escape(value));
}
} catch (e) {
exception_error("storeInitParam", e);
}

View file

@ -1713,6 +1713,9 @@
print "<param key=\"on_catchup_show_next_feed\" value=\"" .
get_pref($link, "ON_CATCHUP_SHOW_NEXT_FEED") . "\"/>";
print "<param key=\"hide_read_feeds\" value=\"" .
sprintf("%d", get_pref($link, "HIDE_READ_FEEDS")) . "\"/>";
print "</init-params>";
}
?>

View file

@ -44,31 +44,6 @@ function dlg_frefresh_callback() {
}
}
function hide_unread_callback() {
if (xmlhttp.readyState == 4) {
try {
var reply = xmlhttp.responseXML.firstChild.firstChild;
var value = reply.getAttribute("value");
var hide_read_feeds = (value != "false")
var feeds_doc = window.frames["feeds-frame"].document;
hideOrShowFeeds(feeds_doc, hide_read_feeds);
if (hide_read_feeds) {
setCookie("ttrss_vf_hreadf", 1);
} else {
setCookie("ttrss_vf_hreadf", 0);
}
} catch (e) {
exception_error("hide_unread_callback", e);
}
}
}
function refetch_callback() {
if (xmlhttp.readyState == 4) {
try {
@ -563,16 +538,20 @@ function toggleDispRead() {
return
}
var hide_read_feeds = (getCookie("ttrss_vf_hreadf") == 1);
var hide_read_feeds = (getInitParam("hide_read_feeds") == "1");
hide_read_feeds = !hide_read_feeds;
debug("toggle_disp_read => " + hide_read_feeds);
hideOrShowFeeds(getFeedsContext().document, hide_read_feeds);
var query = "backend.php?op=rpc&subop=setpref" +
"&key=HIDE_READ_FEEDS&value=" + param_escape(hide_read_feeds);
xmlhttp.open("GET", query);
xmlhttp.onreadystatechange=hide_unread_callback;
xmlhttp.send(null);
storeInitParam("hide_read_feeds", hide_read_feeds, true);
new Ajax.Request(query);
} catch (e) {
exception_error("toggleDispRead", e);