From dc017ed889bcd57668d36fa7a8b07a1cf72338dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20St=C3=B6ckel?= Date: Mon, 12 Mar 2012 12:05:14 +0000 Subject: [PATCH] Now again using a local etemplate2 instance on the client --- etemplate/inc/class.etemplate.inc.php | 3 ++- etemplate/inc/class.etemplate_new.inc.php | 16 +++++++++++++--- etemplate/js/et2_extension_nextmatch.js | 10 +++++++--- .../js/et2_extension_nextmatch_dynheight.js | 13 ++++--------- etemplate/js/etemplate2.js | 10 ++-------- phpgwapi/inc/class.egw_framework.inc.php | 2 +- phpgwapi/js/jsapi/egw.js | 2 +- phpgwapi/js/jsapi/egw_calendar.js | 4 +++- .../idots/class.idots_framework.inc.php | 17 ----------------- 9 files changed, 33 insertions(+), 44 deletions(-) diff --git a/etemplate/inc/class.etemplate.inc.php b/etemplate/inc/class.etemplate.inc.php index 79c426db69..e55d67b412 100644 --- a/etemplate/inc/class.etemplate.inc.php +++ b/etemplate/inc/class.etemplate.inc.php @@ -25,7 +25,8 @@ * * etemplate or uietemplate extends boetemplate, all vars and public functions are inherited */ -class etemplate extends boetemplate +class etemplate extends etemplate_new {} +class etemplate_old extends boetemplate { /** * integer debug-level or template-name or cell-type or '' = off diff --git a/etemplate/inc/class.etemplate_new.inc.php b/etemplate/inc/class.etemplate_new.inc.php index cffff5846f..5e85c13287 100644 --- a/etemplate/inc/class.etemplate_new.inc.php +++ b/etemplate/inc/class.etemplate_new.inc.php @@ -102,8 +102,18 @@ class etemplate_new extends etemplate_widget_template function exec($method,$content,$sel_options='',$readonlys='',$preserv='',$output_mode=0,$ignore_validation='',$changes='') { - // Overwrite "nonavbar" is the output_mode is two - $GLOBALS['egw_info']['flags']['nonavbar'] = ($output_mode == 2); + // Include the etemplate2 javascript code + egw_framework::validate_file('.', 'etemplate2', 'etemplate'); + + // load translations + translation::add_app('etemplate'); + foreach(translation::$loaded_apps as $app => $lang) + { + egw_framework::validate_file('/phpgwapi/lang.php', array( + 'app' => $app, + 'lang' => $lang, + )); + } if (!$this->rel_path) throw new egw_exception_assertion_failed('No (valid) template read!'); @@ -157,7 +167,7 @@ class etemplate_new extends etemplate_widget_template
diff --git a/etemplate/js/et2_extension_nextmatch.js b/etemplate/js/et2_extension_nextmatch.js index 52a48edba7..fbc7931bca 100644 --- a/etemplate/js/et2_extension_nextmatch.js +++ b/etemplate/js/et2_extension_nextmatch.js @@ -90,9 +90,13 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, { this.header = new et2_nextmatch_header_bar(this, this.div); + this.innerDiv = $j(document.createElement("div")) + .appendTo(this.div); + // Create the dynheight component which dynamically scales the inner // container. - this.dynheight = new et2_dynheight(null, this.div, 150); + this.dynheight = new et2_dynheight(this.egw().window, + this.innerDiv, 150); // Create the action manager this.actionManager = new egwActionManager(); @@ -111,7 +115,7 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, { } // Create the outer grid container - this.dataviewContainer = new et2_dataview_gridContainer(this.div, + this.dataviewContainer = new et2_dataview_gridContainer(this.innerDiv, this.dataProvider, this.egw()); this.activeFilters = {}; @@ -631,7 +635,7 @@ var et2_nextmatch = et2_DOMWidget.extend(et2_IResizeable, { .append(select.getDOMNode()) .append(okButton.getDOMNode()) .append(cancelButton.getDOMNode()) - .appendTo(this.div); + .appendTo(this.innerDiv); // Add default checkbox for admins var apps = this.egw().user('apps'); diff --git a/etemplate/js/et2_extension_nextmatch_dynheight.js b/etemplate/js/et2_extension_nextmatch_dynheight.js index 8f4db66c4c..39a712ff39 100644 --- a/etemplate/js/et2_extension_nextmatch_dynheight.js +++ b/etemplate/js/et2_extension_nextmatch_dynheight.js @@ -30,13 +30,12 @@ var et2_dynheight = Class.extend({ * @param _outerNode is the node which surrounds the _innerNode and to * which extend the innerNode should be expanded without creating a * scrollbar. Note: The outer node must be a parent of the inner node. - * If "null" is passed, the outer node is set to "window". * @param _innerNode is the node which should be scaled. Call update to * scale the node. * @param _minHeight is the minimum height the inner node should have */ init: function(_outerNode, _innerNode, _minHeight) { - this.outerNode = _outerNode ? $j(_outerNode) : $j(window); + this.outerNode = $j(_outerNode); this.innerNode = $j(_innerNode); this.minHeight = _minHeight; @@ -58,6 +57,9 @@ var et2_dynheight = Class.extend({ // Initialize the height calculation this._initialize(); + console.log(this.outerNode); + console.log(this.innerNode); + // Get the outer container height var oh = this.outerNode.height(); @@ -158,13 +160,6 @@ var et2_dynheight = Class.extend({ var ih = this.innerNode.height(); this.innerMargin = ioh - ih; - // Calculate the outer margin - var node = this.outerNode; - if (node[0] == window) - { - node = $j("body"); - } - this.initialized = true; } } diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index 7a3bb174c0..645cb60cbf 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -50,8 +50,6 @@ jsapi.egw_json; */ -egw.extend('etemplate2', egw.MODULE_GLOBAL, function() { - /** * The etemplate2 class manages a certain etemplate2 instance. * @@ -161,6 +159,7 @@ etemplate2.prototype.load = function(_url, _data) // Asynchronously load the XET file (code below is executed ahead of the // code in the callback function) et2_loadXMLFromURL(_url, function(_xmldoc) { + // Read the XML structure this.widgetContainer.loadFromXML(_xmldoc); @@ -181,7 +180,7 @@ etemplate2.prototype.load = function(_url, _data) this.widgetContainer = new et2_container(null); this.widgetContainer.setApiInstance(egw(egw.elemWindow(this.DOMContainer))); this.widgetContainer.setInstanceManager(this); - this.widgetContainer.setParentDOMNode(frag); + this.widgetContainer.setParentDOMNode(this.DOMContainer); // store the id to submit it back to server if(_data) { @@ -378,8 +377,3 @@ function etemplate2_handle_validation_error(_type, _response) egw(window).registerJSONPlugin(etemplate2_handle_load, null, 'et2_load'); egw(window).registerJSONPlugin(etemplate2_handle_validation_error, null, 'et2_validation_error'); -// Return the etemplate2 constructor -return {'etemplate2': etemplate2}; - -}); - diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index dc5d003433..f8fa97acf9 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -94,7 +94,7 @@ abstract class egw_framework '/phpgwapi/js/./egw_json.js', // always include javascript helper functions '/phpgwapi/js/jsapi/jsapi.js', -// '/phpgwapi/js/jsapi/egw.js', + '/phpgwapi/js/jsapi/egw.js', )); } diff --git a/phpgwapi/js/jsapi/egw.js b/phpgwapi/js/jsapi/egw.js index dd48d3a7c0..98e02b7140 100644 --- a/phpgwapi/js/jsapi/egw.js +++ b/phpgwapi/js/jsapi/egw.js @@ -28,6 +28,6 @@ egw_css; egw_calendar; egw_ready; - egw_jquery; +// egw_jquery; */ diff --git a/phpgwapi/js/jsapi/egw_calendar.js b/phpgwapi/js/jsapi/egw_calendar.js index 013aa00f7c..f79edeeee7 100644 --- a/phpgwapi/js/jsapi/egw_calendar.js +++ b/phpgwapi/js/jsapi/egw_calendar.js @@ -13,6 +13,8 @@ "use strict"; /*egw:uses + jquery.jquery_ui; + egw_core; egw_preferences; egw_jquery; @@ -58,7 +60,7 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) { } // Get the preferences - _egw.$j(_input).datepicker(params); + $j(_input).datepicker(params); /* onClose: function(date_text, picker) { // Only update if there's a change - "" if no date selected diff --git a/phpgwapi/templates/idots/class.idots_framework.inc.php b/phpgwapi/templates/idots/class.idots_framework.inc.php index 2b4c098088..5295f1ada9 100644 --- a/phpgwapi/templates/idots/class.idots_framework.inc.php +++ b/phpgwapi/templates/idots/class.idots_framework.inc.php @@ -89,23 +89,6 @@ class idots_framework extends egw_framework if (self::$header_done) return ''; self::$header_done = true; - // load translations - self::validate_file('jsapi', 'egw', 'phpgwapi'); - - translation::add_app('etemplate'); - foreach(translation::$loaded_apps as $app => $lang) - { - egw_framework::validate_file('/phpgwapi/lang.php', array( - 'app' => $app, - 'lang' => $lang, - )); - } - - if ($this->isTop(false)) - { - self::validate_file('.', 'etemplate2', 'etemplate'); - } - // add a content-type header to overwrite an existing default charset in apache (AddDefaultCharset directiv) header('Content-type: text/html; charset='.translation::charset());