}
},
+ /**
+ * 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;
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.
*/
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);
}
}
);
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.
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 = [];