diff --git a/etemplate/js/et2_contentArrayMgr.js b/etemplate/js/et2_contentArrayMgr.js
new file mode 100644
index 0000000000..20ce93fd95
--- /dev/null
+++ b/etemplate/js/et2_contentArrayMgr.js
@@ -0,0 +1,44 @@
+/**
+ * eGroupWare eTemplate2 - JS content array manager
+ *
+ * @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$
+ */
+
+"use strict";
+
+function et2_contentArrayMgr(_data, _parentMgr)
+{
+ if (typeof _parentMgr == "undefined")
+ {
+ _parentMgr = null;
+ }
+
+ // Copy the parent manager which is needed to access relative data when
+ // being in a relative perspective of the manager
+ this.parentMgr = _parentMgr;
+
+ // Hold a reference to the data
+ this.data = _data;
+}
+
+et2_contentArrayMgr.prototype.getValueForID = function(_id)
+{
+ if (typeof this.data[_id] != "undefined")
+ {
+ return this.data[_id];
+ }
+
+ return null;
+}
+
+et2_contentArrayMgr.prototype.openPerspective = function(_rootId)
+{
+ return new et2_contentArrayMgr(this._data[_rootId], this);
+}
+
diff --git a/etemplate/js/et2_inputWidget.js b/etemplate/js/et2_inputWidget.js
index 14260f50b0..03e1c91ccd 100644
--- a/etemplate/js/et2_inputWidget.js
+++ b/etemplate/js/et2_inputWidget.js
@@ -69,6 +69,20 @@ var et2_inputWidget = et2_baseWidget.extend(et2_IInput, {
}
},
+ set_id: function(_value) {
+ this._super.apply(this, arguments);
+
+ var mgr = this.getContentMgr();
+ if (_value != '' && mgr != null)
+ {
+ var val = mgr.getValueForID(this.id);
+ if (val !== null)
+ {
+ this.set_value(val);
+ }
+ }
+ },
+
get_value: function() {
return this.getValue();
},
diff --git a/etemplate/js/et2_widget.js b/etemplate/js/et2_widget.js
index 3a26511694..bf6fa41d20 100644
--- a/etemplate/js/et2_widget.js
+++ b/etemplate/js/et2_widget.js
@@ -58,7 +58,7 @@ var et2_widget = Class.extend({
"id": {
"name": "ID",
"type": "string",
- "description": "Unique identifier of the widget",
+ "description": "Unique identifier of the widget"
},
/**
@@ -93,6 +93,7 @@ var et2_widget = Class.extend({
}
this.id = "";
+ this._mgr = null;
// Copy the parent parameter and add this widget to its parent children
// list.
@@ -426,6 +427,23 @@ var et2_widget = Class.extend({
{
this._children[i].update();
}
+ },
+
+ setContentMgr: function(_mgr) {
+ this._mgr = _mgr;
+ },
+
+ getContentMgr: function() {
+ if (this._mgr != null)
+ {
+ return this._mgr;
+ }
+ else if (this._parent)
+ {
+ return this._parent.getContentMgr();
+ }
+
+ return null;
}
});
diff --git a/etemplate/js/test/et2_test_timesheet_edit.json b/etemplate/js/test/et2_test_timesheet_edit.json
new file mode 100644
index 0000000000..1c1762df3e
--- /dev/null
+++ b/etemplate/js/test/et2_test_timesheet_edit.json
@@ -0,0 +1,95 @@
+var timesheet_data = {
+ "content":{
+ "ts_id":"1",
+ "ts_project":null,
+ "ts_title":"Test geschrieben",
+ "ts_description":null,
+ "ts_start":1307030400,
+ "ts_duration":"150",
+ "ts_quantity":"2.5",
+ "ts_unitprice":null,
+ "cat_id":null,
+ "ts_owner":"5",
+ "ts_modified":1307039479,
+ "ts_modifier":"5",
+ "pl_id":null,
+ "ts_status":null,
+ "user_timezone_read":"Europe/Berlin",
+ "msg":null,
+ "view":false,
+ "tabs":null,
+ "link_to":{
+ "to_id":"1",
+ "to_app":"timesheet"
+ },
+ "js":"\u000a",
+ "ts_quantity_blur":2.5,
+ "start_time":"18:00",
+ "pm_integration":null,
+ "no_ts_status":true,
+ "all_pm_ids":[],
+ "history":{
+ "id":"1",
+ "app":"timesheet",
+ "status-widgets":{
+ "ts_status":[],
+ "ts_modifier":"select-account",
+ "cat_id":"select-cat"
+ }
+ },
+ "ts_title_blur":null
+ },
+ "sel_options":{
+ "status":{
+ "ts_project":"Project",
+ "ts_title":"Title",
+ "cat_id":"Category",
+ "ts_description":"Description",
+ "ts_start":"Start",
+ "ts_duration":"Duration",
+ "ts_quantity":"Quantity",
+ "ts_unitprice":"Unitprice",
+ "ts_owner":"Owner",
+ "ts_modifier":"Modifier",
+ "ts_status":"Status",
+ "pm_id":"Projectid",
+ "customfields":"Custom fields"
+ },
+ "ts_owner":{
+ "5":"User, admin"
+ },
+ "ts_status":[]
+ },
+ "readonlys":{
+ "button[delete]":false,
+ "button[edit]":true,
+ "button[save]":false,
+ "button[save_new]":false,
+ "button[apply]":false,
+ "ts_owner":true,
+ "tabs":{
+ "customfields":true
+ }
+ },
+ "preserv":{
+ "ts_id":"1",
+ "ts_project":null,
+ "ts_title":"Test geschrieben",
+ "ts_description":null,
+ "ts_start":1307030400,
+ "ts_duration":"150",
+ "ts_quantity":"2.5",
+ "ts_unitprice":null,
+ "cat_id":null,
+ "ts_owner":"5",
+ "ts_modified":1307039479,
+ "ts_modifier":"5",
+ "pl_id":null,
+ "ts_status":null,
+ "user_timezone_read":"Europe/Berlin",
+ "view":false,
+ "referer":"timesheet.timesheet_ui.index",
+ "ts_title_blur":null
+ }
+}
+
diff --git a/etemplate/js/test/test_xml.html b/etemplate/js/test/test_xml.html
index d274130069..c499baaffd 100644
--- a/etemplate/js/test/test_xml.html
+++ b/etemplate/js/test/test_xml.html
@@ -15,8 +15,12 @@
+
+
+
+