Precautions for iframes + sidebox

- Unbind any existing events on existing sidebox, if _init_sidebox() is called again
- Only call _init_sidebox() on top-level window's app.js, fixes some iframe issues with admin
This commit is contained in:
Nathan Gray 2014-04-29 16:51:57 +00:00
parent 5c19f99d9d
commit 4d016169e7

View File

@ -99,7 +99,15 @@ var AppJS = Class.extend(
var egw_fw = egw_getFramework();
sidebox= $j('#favorite_sidebox_'+this.appname,egw_fw.sidemenuDiv);
}
this._init_sidebox(sidebox);
// Make sure we're running in the top window when we init sidebox
if(window.top.app[this.appname] !== this)
{
window.top.app[this.appname]._init_sidebox(sidebox);
}
else
{
this._init_sidebox(sidebox);
}
},
/**
@ -302,6 +310,7 @@ var AppJS = Class.extend(
if(sidebox.length)
{
var self = this;
if(this.sidebox) this.sidebox.off();
this.sidebox = sidebox;
sidebox
.off()
@ -319,7 +328,7 @@ var AppJS = Class.extend(
}
})
.addClass("ui-helper-clearfix");
//Add Sortable handler to sideBox fav. menu
jQuery('ul','#favorite_sidebox_'+this.appname).sortable({
@ -330,10 +339,10 @@ var AppJS = Class.extend(
var favSortedList = jQuery(this).sortable('toArray', {attribute:'data-id'});
self.egw.set_preference(self.appname,'fav_sort_pref',favSortedList);
self._refresh_fav_nm();
}
});
});
return true;
}
return false;