mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-18 11:58:24 +01:00
fixing wired IE security errors "Permission denied", seems reload of opener caused references to egw and template cache in opener.top.etemplate2.prototype.templates becomming inaccessible, catching this errors and falling back to a window-local object
This commit is contained in:
parent
1f2c9e641a
commit
b18d373624
@ -952,7 +952,7 @@ var et2_widget = ClassWithAttributes.extend(
|
|||||||
* @param {string} _part name of array mgr to return
|
* @param {string} _part name of array mgr to return
|
||||||
*/
|
*/
|
||||||
getArrayMgr: function(_part) {
|
getArrayMgr: function(_part) {
|
||||||
if (typeof this._mgrs[_part] != "undefined")
|
if (this._mgrs && typeof this._mgrs[_part] != "undefined")
|
||||||
{
|
{
|
||||||
return this._mgrs[_part];
|
return this._mgrs[_part];
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ var et2_tabbox = et2_valueWidget.extend([et2_IInput,et2_IResizeable],
|
|||||||
if (entry.widget_options && typeof entry.widget_options.class != 'undefined')
|
if (entry.widget_options && typeof entry.widget_options.class != 'undefined')
|
||||||
{
|
{
|
||||||
entry.flagDiv.addClass(entry.widget_options.class);
|
entry.flagDiv.addClass(entry.widget_options.class);
|
||||||
}
|
}
|
||||||
entry.flagDiv.text(entry.label || "Tab");
|
entry.flagDiv.text(entry.label || "Tab");
|
||||||
if(entry.hidden)
|
if(entry.hidden)
|
||||||
{
|
{
|
||||||
@ -431,13 +431,13 @@ var et2_tabbox = et2_valueWidget.extend([et2_IInput,et2_IResizeable],
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
set_tab_height: function (_height)
|
set_tab_height: function (_height)
|
||||||
{
|
{
|
||||||
this.tab_height = _height;
|
this.tab_height = _height;
|
||||||
this.tabContainer.css("height", _height);
|
this.tabContainer.css("height", _height);
|
||||||
},
|
},
|
||||||
|
|
||||||
set_height: function(_value) {
|
set_height: function(_value) {
|
||||||
this.height = _value;
|
this.height = _value;
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ var et2_tabbox = et2_valueWidget.extend([et2_IInput,et2_IResizeable],
|
|||||||
isValid: function(messages) {
|
isValid: function(messages) {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
resize: function (_height)
|
resize: function (_height)
|
||||||
{
|
{
|
||||||
if(_height)
|
if(_height)
|
||||||
|
@ -205,7 +205,7 @@ var et2_taglist = et2_selectbox.extend(
|
|||||||
// Unbind change handler of widget's ancestor to stop it from bubbling
|
// Unbind change handler of widget's ancestor to stop it from bubbling
|
||||||
// taglist has its own onchange
|
// taglist has its own onchange
|
||||||
$j(this.getDOMNode()).unbind('change.et2_inputWidget');
|
$j(this.getDOMNode()).unbind('change.et2_inputWidget');
|
||||||
|
|
||||||
// onChange
|
// onChange
|
||||||
if(this.options.onchange && typeof this.options.onchange == 'function')
|
if(this.options.onchange && typeof this.options.onchange == 'function')
|
||||||
{
|
{
|
||||||
@ -278,7 +278,7 @@ var et2_taglist = et2_selectbox.extend(
|
|||||||
{
|
{
|
||||||
var label = jQuery('<span>').text(item.label);
|
var label = jQuery('<span>').text(item.label);
|
||||||
if (typeof item.title != 'undefined') label.attr('title', item.title);
|
if (typeof item.title != 'undefined') label.attr('title', item.title);
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -577,7 +577,7 @@ var et2_taglist_email = et2_taglist.extend(
|
|||||||
for(var i=0; i < parts.length; ++i)
|
for(var i=0; i < parts.length; ++i)
|
||||||
{
|
{
|
||||||
items.push({id: parts[i], label: parts[i]});
|
items.push({id: parts[i], label: parts[i]});
|
||||||
|
|
||||||
}
|
}
|
||||||
taglist.addToSelection(items);
|
taglist.addToSelection(items);
|
||||||
}, 10);
|
}, 10);
|
||||||
@ -627,4 +627,4 @@ et2_register_widget(et2_taglist_ro, ["taglist_ro","taglist_email_ro", "taglist_a
|
|||||||
|
|
||||||
// Require css
|
// Require css
|
||||||
// TODO: merge into etemplate2.css with all other widgets when done
|
// TODO: merge into etemplate2.css with all other widgets when done
|
||||||
if(typeof egw != 'undefined') egw(window).includeCSS(egw.webserverUrl + "/phpgwapi/js/jquery/magicsuggest/magicsuggest.css");
|
if(typeof egw == 'function') egw(window).includeCSS(egw.webserverUrl + "/phpgwapi/js/jquery/magicsuggest/magicsuggest.css");
|
||||||
|
@ -108,16 +108,20 @@ try {
|
|||||||
{
|
{
|
||||||
etemplate2.prototype.templates = opener.etemplate2.prototype.templates;
|
etemplate2.prototype.templates = opener.etemplate2.prototype.templates;
|
||||||
}
|
}
|
||||||
|
else if (top.etemplate2)
|
||||||
|
{
|
||||||
|
etemplate2.prototype.templates = top.etemplate2.prototype.templates;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
// catch security exception if opener is from a different domain
|
// catch security exception if opener is from a different domain
|
||||||
|
console.log('Security exception accessing etemplate2.prototype of opener or top!');
|
||||||
}
|
}
|
||||||
if (typeof etemplate2.prototype.templates == "undefined")
|
if (typeof etemplate2.prototype.templates == "undefined")
|
||||||
{
|
{
|
||||||
etemplate2.prototype.templates = top.etemplate2.prototype.templates || {};
|
etemplate2.prototype.templates = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calls the resize event of all widgets
|
* Calls the resize event of all widgets
|
||||||
*
|
*
|
||||||
@ -552,33 +556,38 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
|
|||||||
|
|
||||||
|
|
||||||
// Load & process
|
// Load & process
|
||||||
if(!this.templates[_name])
|
try {
|
||||||
{
|
if (this.templates[_name])
|
||||||
// Asynchronously load the XET file
|
{
|
||||||
et2_loadXMLFromURL(_url, function(_xmldoc) {
|
// Set array managers first, or errors will happen
|
||||||
|
this.widgetContainer.setArrayMgrs(this._createArrayManagers(_data));
|
||||||
|
|
||||||
// Scan for templates and store them
|
// Already have it
|
||||||
for(var i = 0; i < _xmldoc.childNodes.length; i++) {
|
|
||||||
var template = _xmldoc.childNodes[i];
|
|
||||||
if(template.nodeName.toLowerCase() != "template") continue;
|
|
||||||
this.templates[template.getAttribute("id")] = template;
|
|
||||||
if(!_name) this.name = template.getAttribute("id");
|
|
||||||
}
|
|
||||||
_load.apply(this,[]);
|
_load.apply(this,[]);
|
||||||
}, this);
|
return;
|
||||||
|
}
|
||||||
// Split the given data into array manager objects and pass those to the
|
|
||||||
// widget container - do this here because file is loaded async
|
|
||||||
this.widgetContainer.setArrayMgrs(this._createArrayManagers(_data));
|
|
||||||
}
|
}
|
||||||
else
|
catch (e) {
|
||||||
{
|
// wired security exception in IE denying access to template cache in opener
|
||||||
// Set array managers first, or errors will happen
|
//this.templates =
|
||||||
this.widgetContainer.setArrayMgrs(this._createArrayManagers(_data));
|
etemplate2.prototype.templates = {};
|
||||||
|
}
|
||||||
|
// Asynchronously load the XET file
|
||||||
|
et2_loadXMLFromURL(_url, function(_xmldoc) {
|
||||||
|
|
||||||
// Already have it
|
// Scan for templates and store them
|
||||||
|
for(var i = 0; i < _xmldoc.childNodes.length; i++) {
|
||||||
|
var template = _xmldoc.childNodes[i];
|
||||||
|
if(template.nodeName.toLowerCase() != "template") continue;
|
||||||
|
this.templates[template.getAttribute("id")] = template;
|
||||||
|
if(!_name) this.name = template.getAttribute("id");
|
||||||
|
}
|
||||||
_load.apply(this,[]);
|
_load.apply(this,[]);
|
||||||
}
|
}, this);
|
||||||
|
|
||||||
|
// Split the given data into array manager objects and pass those to the
|
||||||
|
// widget container - do this here because file is loaded async
|
||||||
|
this.widgetContainer.setArrayMgrs(this._createArrayManagers(_data));
|
||||||
}, this);
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -607,7 +616,7 @@ etemplate2.prototype.autocomplete_fixer = function ()
|
|||||||
{
|
{
|
||||||
var self = this;
|
var self = this;
|
||||||
var form = self.DOMContainer;
|
var form = self.DOMContainer;
|
||||||
|
|
||||||
// Safari always do the autofill for password field regardless of autocomplete = off
|
// Safari always do the autofill for password field regardless of autocomplete = off
|
||||||
// and since there's no other way to switch the autocomplete of, we should switch the
|
// and since there's no other way to switch the autocomplete of, we should switch the
|
||||||
// form autocomplete off (e.g. compose dialog, attachment password field)
|
// form autocomplete off (e.g. compose dialog, attachment password field)
|
||||||
@ -616,7 +625,7 @@ etemplate2.prototype.autocomplete_fixer = function ()
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (form)
|
if (form)
|
||||||
{
|
{
|
||||||
// Stop submit propagation in order to not fire other possible submit events
|
// Stop submit propagation in order to not fire other possible submit events
|
||||||
|
@ -17,10 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Need CSS, or it doesn't really work
|
// Need CSS, or it doesn't really work
|
||||||
if(typeof egw != 'undefined')
|
if(typeof egw == 'function') egw(window).includeCSS(egw.webserverUrl + "/phpgwapi/js/egw_action/test/skins/dhtmlxmenu_egw.css");
|
||||||
{
|
|
||||||
egw(window).includeCSS(egw.webserverUrl + "/phpgwapi/js/egw_action/test/skins/dhtmlxmenu_egw.css");
|
|
||||||
}
|
|
||||||
function egwMenuImpl(_structure)
|
function egwMenuImpl(_structure)
|
||||||
{
|
{
|
||||||
//Create a new dhtmlxmenu object
|
//Create a new dhtmlxmenu object
|
||||||
|
@ -129,6 +129,16 @@
|
|||||||
window.location.search += window.location.search ? "&cd=yes" : "?cd=yes";
|
window.location.search += window.location.search ? "&cd=yes" : "?cd=yes";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
egw(window).message;
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
console.log('Security exception accessing window specific egw object --> creating new one', e);
|
||||||
|
window.egw = {
|
||||||
|
prefsOnly: true,
|
||||||
|
webserverUrl: egw_webserverUrl
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// focus window / call window.focus(), if data-window-focus is specified
|
// focus window / call window.focus(), if data-window-focus is specified
|
||||||
var window_focus = egw_script.getAttribute('data-window-focus');
|
var window_focus = egw_script.getAttribute('data-window-focus');
|
||||||
|
Loading…
Reference in New Issue
Block a user