forked from extern/egroupware
make local storage more robust (deal with gaps)
This commit is contained in:
parent
192bde119b
commit
58e13743fc
@ -139,13 +139,18 @@ egw.extend('debug', egw.MODULE_GLOBAL, function(_app, _wnd) {
|
|||||||
if (window.localStorage && typeof window.localStorage[LASTLOG] != 'undefined')
|
if (window.localStorage && typeof window.localStorage[LASTLOG] != 'undefined')
|
||||||
{
|
{
|
||||||
var lastlog = parseInt(window.localStorage[LASTLOG]);
|
var lastlog = parseInt(window.localStorage[LASTLOG]);
|
||||||
for(var i=lastlog; i < MAX_LOGS && typeof window.localStorage[LOG_PREFIX+i] != 'undefined'; ++i)
|
for(var i=lastlog; i < lastlog+MAX_LOGS; ++i)
|
||||||
{
|
{
|
||||||
logs.push(JSON.parse(window.localStorage[LOG_PREFIX+i]));
|
var log = window.localStorage[LOG_PREFIX+(i%MAX_LOGS)];
|
||||||
|
if (typeof log != 'undefined')
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
logs.push(JSON.parse(log));
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
// ignore not existing log entries
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (var i=0; i < lastlog; ++i)
|
|
||||||
{
|
|
||||||
logs.push(JSON.parse(window.localStorage[LOG_PREFIX+i]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return logs;
|
return logs;
|
||||||
|
@ -228,7 +228,7 @@ function egw_getAppName()
|
|||||||
function egw_refresh(_msg, _app, _id, _type, _targetapp, _replace, _with, _msg_type)
|
function egw_refresh(_msg, _app, _id, _type, _targetapp, _replace, _with, _msg_type)
|
||||||
{
|
{
|
||||||
// Log for debugging purposes
|
// Log for debugging purposes
|
||||||
egw.debug("log", "egw_refresh(%s, %s, %s, %o, %s, %s)",_msg,_app,_id,_type,_target_app,_replace,_with,_msg_type);
|
egw.debug("log", "egw_refresh(%s, %s, %s, %o, %s, %s)", _msg, _app, _id, _type, _targetapp, _replace, _with, _msg_type);
|
||||||
|
|
||||||
//alert("egw_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')");
|
//alert("egw_refresh(\'"+_msg+"\',\'"+_app+"\',\'"+_id+"\',\'"+_type+"\')");
|
||||||
var win = typeof _targetapp != 'undefined' ? egw_appWindow(_targetapp) : window;
|
var win = typeof _targetapp != 'undefined' ? egw_appWindow(_targetapp) : window;
|
||||||
|
Loading…
Reference in New Issue
Block a user