Added et2_all.js which contains references to all widgets and can be included by egw to load the complete etemplate2 js module, fixed problem in 'et2_DOMWidget::set_disabled', interpreting 'type' attribute like the node name when creating the wigdets from XML

This commit is contained in:
Andreas Stöckel 2011-08-15 08:34:21 +00:00
parent 0a410a1e05
commit a28295db58
5 changed files with 23 additions and 15 deletions

Binary file not shown.

View File

@ -281,7 +281,7 @@ et2_IDOMNode::getDOMNode(_sender)
function, which has to be implemented by all widgets which have a representation in the HTML-DOM-Tree. \texttt{getDOMNode} should return the DOM-Node of the current widget. The return value has to be a plain DOM node, not a jQuery object. The \texttt{\_sender} parameter defines which widget is asking for the DOMNode. Depending on that, the widget may return different nodes. This is used in the grid or the tab. Normally the \_sender parameter can be omitted in most implementations of the getDOMNode function. However, you should always provide the \texttt{\_sender} parameter when calling \texttt{getDOMNode}!
\subsection*{et2\_DOMWidget}
The \textit{et2\_DOMWidget} class is derrived from \textit{et2\_IDOMNode} and \textit{et2\_widget} without implementing the \texttt{getDOMNode} funcition. It introduces an mechanism which automatically inserts the DOM-Node of this widget into the DOM-Node of the parent widget (if the parent widget implements \textit{et2\_IDOMWidget}. The two functions
The \textit{et2\_DOMWidget} class is derrived from \textit{et2\_IDOMNode} and \textit{et2\_widget} without implementing the \texttt{getDOMNode} funcition. It introduces an mechanism which automatically inserts the DOM-Node of this widget into the DOM-Node of the parent widget (if the parent widget implements \textit{et2\_IDOMNode}. The two functions
\begin{verbatim}
et2_DOMWidget::attachToDOM()
et2_DOMWidget::detatchFromDOM()

View File

@ -92,18 +92,8 @@ class etemplate_new
}
else // first call
*/ {
egw_framework::validate_file('.','et2_xml','etemplate');
egw_framework::validate_file('.','et2_baseWidget','etemplate');
egw_framework::validate_file('.','et2_contentArrayMgr','etemplate');
egw_framework::validate_file('.','et2_all','etemplate');
// it seems all widget have to be explicitly loaded, to be used ...
foreach(scandir(EGW_SERVER_ROOT.'/etemplate/js') as $file)
{
if (preg_match('/^(et2_.*)\.js$/',$file,$matches))
{
egw_framework::validate_file('.',$matches[1],'etemplate');
}
}
egw_framework::includeCSS('/etemplate/js/test/test.css');
common::egw_header();
if ($output_mode != 2)

View File

@ -192,17 +192,18 @@ var et2_DOMWidget = et2_widget.extend(et2_IDOMNode, {
},
set_disabled: function(_value) {
if (this.node)
var node = this.getDOMNode();
if (node)
{
this.diabled = _value;
if (_value)
{
$j(this.node).hide();
$j(node).hide();
}
else
{
$j(this.node).show();
$j(node).show();
}
}
}

View File

@ -16,6 +16,7 @@
et2_xml;
et2_common;
et2_inheritance;
et2_contentArrayMgr;
*/
/**
@ -65,6 +66,14 @@ var et2_widget = Class.extend({
*/
"span": {
"ignore": true
},
/**
* Ignore the "type" tag - it is read by the "createElementFromNode"
* function and passed as second parameter of the widget constructor
*/
"type": {
"ignore": true
}
},
@ -330,6 +339,14 @@ var et2_widget = Class.extend({
},
createElementFromNode: function(_node, _nodeName) {
// Check whether the type attribute exists - if yes pass it instead of
// the nodeName
if (_node.getAttribute("type"))
{
_nodeName = _node.getAttribute("type");
}
if (typeof _nodeName == "undefined")
{
_nodeName = _node.nodeName.toLowerCase();