From a4395a80007ee5eac56f654071b30ae2bd5c1d01 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 16 Apr 2013 18:42:53 +0000 Subject: [PATCH] If a specific template name is not provided, use the last template in the file --- etemplate/js/etemplate2.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index f5c43b6e89..74a08f5e2c 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -209,7 +209,7 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback) } // set app_header - if (window.opener) { // popup + if (window.opener && _data) { // popup document.title = _data.app_header; } else { // todo for idots or jdots framework @@ -223,10 +223,11 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback) var template = _xmldoc.childNodes[i]; if(template.nodeName.toLowerCase() != "template") continue; this.templates[template.getAttribute("id")] = template; + if(!_name) missing_name = template.getAttribute("id"); } // Read the XML structure of the requested template - this.widgetContainer.loadFromXML(this.templates[_name]); + this.widgetContainer.loadFromXML(this.templates[_name || missing_name]); // Inform the widget tree that it has been successfully loaded. this.widgetContainer.loadingFinished();