Instanciate the instance for the app based on template name when loading

This commit is contained in:
Nathan Gray 2012-03-20 21:42:25 +00:00
parent 6bffa0c3d6
commit 11fe571e65
2 changed files with 10 additions and 3 deletions

View File

@ -64,9 +64,12 @@ var et2_template = et2_DOMWidget.extend({
if (this.id != "")
{
// Set the api instance to the first part of the name of the
// template
// template, if it's in app.function.template format
var splitted = this.id.split('.');
this.setApiInstance(egw(splitted[0], this._parent.egw().window));
if(splitted.length == 3)
{
this.setApiInstance(egw(splitted[0], this._parent.egw().window));
}
// Check to see if XML is known
var xml = null;

View File

@ -159,6 +159,10 @@ etemplate2.prototype._createArrayManagers = function(_data)
*/
etemplate2.prototype.load = function(_name, _url, _data)
{
// Appname should be first part of the template name
var split = _name.split('.');
var appname = split[0];
// Create the document fragment into which the HTML will be injected
var frag = document.createDocumentFragment();
@ -191,7 +195,7 @@ etemplate2.prototype.load = function(_name, _url, _data)
// Create the basic widget container and attach it to the DOM
this.widgetContainer = new et2_container(null);
this.widgetContainer.setApiInstance(egw(egw.elemWindow(this.DOMContainer)));
this.widgetContainer.setApiInstance(egw(appname, egw.elemWindow(this.DOMContainer)));
this.widgetContainer.setInstanceManager(this);
this.widgetContainer.setParentDOMNode(this.DOMContainer);