make storeInitParam actually work (move back to cookies)

This commit is contained in:
Andrew Dolgov 2007-03-21 16:36:24 +01:00
parent 441acab8ff
commit be0801a161
4 changed files with 31 additions and 7 deletions

View File

@ -57,11 +57,11 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
toolbar_form.query.value = "";
}
/* storeInitParam("toolbar_limit",
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); */
toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value);
var query = "backend.php?op=viewfeed&feed=" + feed + "&" +
toolbar_query + "&subop=" + param_escape(subop);

View File

@ -428,7 +428,7 @@ function setCookie(name, value, lifetime, path, domain, secure) {
if (lifetime) {
d = new Date();
d.setTime(lifetime * 1000);
d.setTime(d.getTime() + (lifetime * 1000));
}
int_setCookie(name, value, d, path, domain, secure);
@ -1500,9 +1500,31 @@ function debug(msg) {
}
function getInitParam(key) {
return getMainContext().init_params[key];
var c = getCookie("TTIP:" + key);
if (c) {
return c;
} else {
return getMainContext().init_params[key];
}
}
function storeInitParam(key, value) {
try {
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) {
@ -1519,7 +1541,7 @@ function storeInitParam(key, value, is_client) {
} catch (e) {
exception_error("storeInitParam", e);
}
}
} */
/*
function storeInitParams(params, is_client) {

View File

@ -2203,6 +2203,8 @@
print "<param key=\"icons_url\" value=\"" . ICONS_URL . "\"/>";
print "<param key=\"cookie_lifetime\" value=\"" . SESSION_COOKIE_LIFETIME . "\"/>";
print "</init-params>";
}

View File

@ -388,8 +388,8 @@ function init_second_stage() {
var tb = parent.document.forms["main_toolbar_form"];
// dropboxSelect(tb.view_mode, getInitParam("toolbar_view_mode"));
// dropboxSelect(tb.limit, getInitParam("toolbar_limit"));
dropboxSelect(tb.view_mode, getInitParam("toolbar_view_mode"));
dropboxSelect(tb.limit, getInitParam("toolbar_limit"));
daemon_enabled = getInitParam("daemon_enabled") == 1;
daemon_refresh_only = getInitParam("daemon_refresh_only") == 1;