2011-08-16 14:31:18 +02:00
|
|
|
/**
|
|
|
|
* eGroupWare eTemplate2 - JS widget class with value attribute and auto loading
|
|
|
|
*
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @package etemplate
|
|
|
|
* @subpackage api
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @author Andreas Stöckel
|
|
|
|
* @copyright Stylite 2011
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
|
|
|
|
2011-08-16 14:56:55 +02:00
|
|
|
"use strict";
|
|
|
|
|
2011-08-16 14:31:18 +02:00
|
|
|
/*egw:uses
|
|
|
|
jquery.jquery;
|
|
|
|
et2_baseWidget;
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* et2_valueWidget is the base class for et2_inputWidget - valueWidget introduces
|
|
|
|
* the "value" attribute and automatically loads it from the "content" array
|
|
|
|
* after loading from XML.
|
|
|
|
*/
|
|
|
|
var et2_valueWidget = et2_baseWidget.extend({
|
|
|
|
|
|
|
|
attributes: {
|
|
|
|
"value": {
|
|
|
|
"name": "Value",
|
|
|
|
"description": "The value of the widget",
|
|
|
|
"type": "string",
|
|
|
|
"default": et2_no_init
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2011-08-21 17:22:00 +02:00
|
|
|
transformAttributes: function(_attrs) {
|
2011-08-23 17:27:34 +02:00
|
|
|
this._super.apply(this, arguments);
|
2011-08-16 14:31:18 +02:00
|
|
|
|
2011-08-23 19:05:05 +02:00
|
|
|
if (this.id)
|
2011-08-16 14:31:18 +02:00
|
|
|
{
|
|
|
|
// Set the value for this element
|
|
|
|
var contentMgr = this.getArrayMgr("content");
|
2011-08-19 18:00:44 +02:00
|
|
|
if (contentMgr != null) {
|
2011-08-16 23:18:26 +02:00
|
|
|
var val = contentMgr.getValueForID(this.id);
|
|
|
|
if (val !== null)
|
|
|
|
{
|
2011-08-19 18:00:44 +02:00
|
|
|
_attrs["value"] = val;
|
2011-08-16 23:18:26 +02:00
|
|
|
}
|
2011-08-16 14:31:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|