storeInitParam: only store changed params on server
This commit is contained in:
parent
1cb7492dc4
commit
1035fcecd8
|
@ -29,6 +29,11 @@ function viewfeed(feed, skip, subop, doc, is_cat, subop_param) {
|
||||||
storeInitParam("toolbar_view_mode",
|
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 sp = new Object();
|
||||||
|
sp["toolbar_limit"] = toolbar_form.limit[toolbar_form.limit.selectedIndex].value;
|
||||||
|
sp["toolbar_view_mode"] = toolbar_form.view_mode[toolbar_form.view_mode.selectedIndex].value;
|
||||||
|
storeInitParams(sp); */
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
|
28
functions.js
28
functions.js
|
@ -1162,19 +1162,43 @@ function getInitParam(key) {
|
||||||
return getMainContext().init_params[key];
|
return getMainContext().init_params[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: batch mode
|
|
||||||
function storeInitParam(key, value, is_client) {
|
function storeInitParam(key, value, is_client) {
|
||||||
try {
|
try {
|
||||||
getMainContext().init_params[key] = value;
|
|
||||||
if (!is_client) {
|
if (!is_client) {
|
||||||
|
if (getMainContext().init_params[key] != value) {
|
||||||
|
debug("storeInitParam: " + key + " => " + value);
|
||||||
new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" +
|
new Ajax.Request("backend.php?op=rpc&subop=storeParam&key=" +
|
||||||
param_escape(key) + "&value=" + param_escape(value));
|
param_escape(key) + "&value=" + param_escape(value));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
getMainContext().init_params[key] = value;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("storeInitParam", 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 {
|
||||||
var fe = document.getElementById("fatal_error");
|
var fe = document.getElementById("fatal_error");
|
||||||
|
|
|
@ -14,7 +14,7 @@ var active_feed_id = 0;
|
||||||
|
|
||||||
var xmlhttp = Ajax.getTransport();
|
var xmlhttp = Ajax.getTransport();
|
||||||
|
|
||||||
var init_params = new Array();
|
var init_params = new Object();
|
||||||
|
|
||||||
function toggleTags() {
|
function toggleTags() {
|
||||||
display_tags = !display_tags;
|
display_tags = !display_tags;
|
||||||
|
|
Loading…
Reference in New Issue