smalltalk
/
osmo-st-all
Archived
1
0
Fork 0

Fixed bug when session is expired

This commit is contained in:
Nicolas Petton 2009-06-19 04:41:31 +00:00
parent ad37073fd8
commit f0cef17ac9
1 changed files with 18 additions and 4 deletions

View File

@ -59,18 +59,24 @@ var Iliad = {
_processUpdates:function(json) {
/* handle redirect if any */
if(json["redirect"]) {
window.location.href = json["redirect"]
if(json.redirect) {
return window.location.href = json.redirect
}
/* Refresh if there is no widget to update
(session expired or the action is invalid) */
if(this.sizeOf(json.widgets) == 0) {
return location.reload()
}
/* else update dirty widgets */
var dirtyWidgets = json['widgets'];
var dirtyWidgets = json.widgets;
for(var i in dirtyWidgets) {
this._updateWidget(i, dirtyWidgets[i]);
}
/* evaluate scripts */
var scripts = json['scripts'];
var scripts = json.scripts;
for(var i in scripts) {
this._evalScript(scripts[i]);
}
@ -95,5 +101,13 @@ var Iliad = {
_removeAjaxLoader:function() {
jQuery(".ajax_loader").replaceWith("");
},
sizeOf:function(obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
}
}