[open-ils-commits] r11798 - trunk/Open-ILS/web/js/dojo/openils/widget
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jan 12 12:33:10 EST 2009
Author: erickson
Date: 2009-01-12 12:33:08 -0500 (Mon, 12 Jan 2009)
New Revision: 11798
Modified:
trunk/Open-ILS/web/js/dojo/openils/widget/AutoWidget.js
trunk/Open-ILS/web/js/dojo/openils/widget/EditDialog.js
trunk/Open-ILS/web/js/dojo/openils/widget/EditPane.js
Log:
added support for retrieving the formatted value from the widgets in a pane. all editdialog communication goes directly to the editpane
Modified: trunk/Open-ILS/web/js/dojo/openils/widget/AutoWidget.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/AutoWidget.js 2009-01-12 16:51:30 UTC (rev 11797)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/AutoWidget.js 2009-01-12 17:33:08 UTC (rev 11798)
@@ -36,6 +36,21 @@
}
},
+ /**
+ * Turn the value from the dojo widget into a value oils understands
+ */
+ getFormattedValue : function() {
+ var value = this.widget.attr('value');
+ switch(this.idlField.datatype) {
+ case 'bool':
+ return (value) ? 't' : 'f'
+ case 'timestamp':
+ return dojo.date.stamp.toISOString(value);
+ default:
+ return value;
+ }
+ },
+
build : function(onload) {
this.onload = onload;
this.widgetValue = (this.fmObject) ? this.fmObject[this.idlField.name]() : null;
Modified: trunk/Open-ILS/web/js/dojo/openils/widget/EditDialog.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/EditDialog.js 2009-01-12 16:51:30 UTC (rev 11797)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/EditDialog.js 2009-01-12 17:33:08 UTC (rev 11798)
@@ -16,20 +16,21 @@
fmObject : null,
mode : 'update',
fieldOrder : null, // ordered list of field names, optional.
+ editPane : null,
+ constructor : function() {
+ //this.inherited(arguments);
+ this.editPane = new openils.widget.EditPane();
+ },
+
/**
* Builds a basic table of key / value pairs. Keys are IDL display labels.
* Values are dijit's, when values set
*/
startup : function() {
this.inherited(arguments);
- var pane = new openils.widget.EditPane();
- pane.mode = this.mode;
- pane.fmClass = this.fmClass;
- pane.fmObject = this.fmObject;
- pane.fieldOrder = this.fieldOrder;
- pane.startup();
- this.domNode.appendChild(pane.domNode);
+ this.editPane.startup();
+ this.domNode.appendChild(this.editPane.domNode);
}
}
);
Modified: trunk/Open-ILS/web/js/dojo/openils/widget/EditPane.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/EditPane.js 2009-01-12 16:51:30 UTC (rev 11797)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/EditPane.js 2009-01-12 17:33:08 UTC (rev 11798)
@@ -15,6 +15,8 @@
fmObject : null,
mode : 'update',
fieldOrder : null, // ordered list of field names, optional.
+ fieldList : [], // holds the field name + associated widget
+ sortedFieldList : [], // holds the sorted IDL defs for our fields
/**
* Builds a basic table of key / value pairs. Keys are IDL display labels.
@@ -49,17 +51,30 @@
row.appendChild(valTd);
tbody.appendChild(row);
- new openils.widget.AutoWidget({
+ var widget = new openils.widget.AutoWidget({
idlField : field,
fmObject : this.fmObject,
parentNode : valTd,
orgLimitPerms : this.limitPerms
- }).build();
+ });
+ widget.build();
+ this.fieldList.push({name:field.name, widget:widget});
}
openils.Util.addCSSClass(table, 'oils-fm-edit-dialog');
},
+ getFields : function() {
+ return this.fieldList.map(function(a) { return a.name });
+ },
+
+ getFieldValue : function(field) {
+ for(var i in this.fieldList) {
+ if(field == this.fieldList[i].name)
+ return this.fieldList[i].widget.getFormattedValue();
+ }
+ },
+
_buildSortedFieldList : function() {
this.sortedFieldList = [];
More information about the open-ils-commits
mailing list