[open-ils-commits] r16482 - in branches/rel_1_6/Open-ILS/web/js: dojo/openils dojo/openils/widget dojo/openils/widget/nls ui/default/conify/global/action ui/default/conify/global/action/survey ui/default/conify/global/config (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri May 21 16:03:25 EDT 2010
Author: erickson
Date: 2010-05-21 16:03:20 -0400 (Fri, 21 May 2010)
New Revision: 16482
Modified:
branches/rel_1_6/Open-ILS/web/js/dojo/openils/Event.js
branches/rel_1_6/Open-ILS/web/js/dojo/openils/PermaCrud.js
branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoWidget.js
branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/EditDialog.js
branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/EditPane.js
branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/nls/AutoFieldWidget.js
branches/rel_1_6/Open-ILS/web/js/ui/default/conify/global/action/survey.js
branches/rel_1_6/Open-ILS/web/js/ui/default/conify/global/action/survey/edit.js
branches/rel_1_6/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js
Log:
back-porting a number of local dojo library fixes and enhancements. of note, autogrid caching and paging for faster paged grid display. (turning on the pager in some config interfaces to follow).
Modified: branches/rel_1_6/Open-ILS/web/js/dojo/openils/Event.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/dojo/openils/Event.js 2010-05-21 19:31:22 UTC (rev 16481)
+++ branches/rel_1_6/Open-ILS/web/js/dojo/openils/Event.js 2010-05-21 20:03:20 UTC (rev 16482)
@@ -29,12 +29,15 @@
this.servertime = kwargs.servertime;
this.ilsperm = kwargs.ilsperm;
this.ilspermloc = kwargs.ilspermloc;
+ this.note = kwargs.note;
},
toString : function() {
var s = 'Event: ' + (this.code || '') + ':' + this.textcode + ' -> ' + new String(this.desc);
if(this.ilsperm)
s += ' ' + this.ilsperm + '@' + this.ilspermloc;
+ if(this.note)
+ s += '\n' + this.note;
return s;
}
});
Modified: branches/rel_1_6/Open-ILS/web/js/dojo/openils/PermaCrud.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/dojo/openils/PermaCrud.js 2010-05-21 19:31:22 UTC (rev 16481)
+++ branches/rel_1_6/Open-ILS/web/js/dojo/openils/PermaCrud.js 2010-05-21 20:03:20 UTC (rev 16482)
@@ -111,6 +111,7 @@
if (opts.select) order_by.select = opts.select;
if (opts.limit) order_by.limit = opts.limit;
if (opts.offset) order_by.offset = opts.offset;
+ if (opts.join) order_by.join = opts.join;
var method = 'open-ils.pcrud.search.' + fm_class;
if(!opts.streaming) method += '.atomic';
@@ -151,14 +152,17 @@
},
search : function ( fm_class /* Fieldmapper class hint */, search /* Fieldmapper query object */, opts /* Option hash */) {
+ var return_type = 'search';
if(!opts) opts = {};
var order_by = {};
if (opts.order_by) order_by.order_by = opts.order_by;
if (opts.select) order_by.select = opts.select;
if (opts.limit) order_by.limit = opts.limit;
if (opts.offset) order_by.offset = opts.offset;
+ if (opts.join) order_by.join = opts.join;
+ if (opts.id_list) return_type = 'id_list';
- var method = 'open-ils.pcrud.search.' + fm_class;
+ var method = 'open-ils.pcrud.' + return_type + '.' + fm_class;
if(!opts.streaming) method += '.atomic';
var req_hash = dojo.mixin(
@@ -323,13 +327,15 @@
return obj_list;
},
+ /*
+ * 'delete' is a reserved keyword in JavaScript and can't be used
+ * in browsers like IE or Chrome, so we define a safe synonym
+ * NOTE: delete() is now removed -- use eliminate instead
+
delete : function ( list, opts ) {
return this._CUD( 'delete', list, opts );
},
- /*
- * 'delete' is a reserved keyword in JavaScript and can't be used
- * in browsers like IE or Chrome, so we define a safe synonym
*/
eliminate: function ( list, opts ) {
return this._CUD( 'delete', list, opts );
Modified: branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js 2010-05-21 19:31:22 UTC (rev 16481)
+++ branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js 2010-05-21 20:03:20 UTC (rev 16482)
@@ -22,6 +22,28 @@
* orgLimitPerms -- If this field defines a set of org units and an orgLimitPerms
* is defined, the code will limit the org units in the set to those
* allowed by the permission
+ * orgDefaultsToWs -- If this is an org unit field and the widget has no value,
+ * set the value equal to the users's workstation org unit. Othwerwise, leave it null
+ * selfReference -- The primary purpose of an AutoFieldWidget is to render the value
+ * or widget for a field on an object (that may or may not link to another object).
+ * selfReference allows you to sidestep the indirection and create a selector widget
+ * based purely on an fmClass. To get a dropdown of all of the 'abc'
+ * objects, pass in {selfReference : true, fmClass : 'abc'}.
+ * labelFormat -- For widgets that are displayed as remote object filtering selects,
+ * this provides a mechanism for overriding the label format in the filtering select.
+ * It must be an array, whose first value is a format string, compliant with
+ * dojo.string.substitute. The remaining array items are the arguments to the format
+ * represented as field names on the remote linked object.
+ * E.g.
+ * labelFormat : [ '${0} (${1})', 'obj_field_1', 'obj_field_2' ]
+ * Note: this does not control the final display value. Only values in the drop-down.
+ * See searchFormat for controlling the display value
+ * searchFormat -- This format controls the structure of the search attribute which
+ * controls the text used during type-ahead searching and the displayed value in
+ * the filtering select. See labelFormat for the structure.
+ * dataLoader : Bypass the default PermaCrud linked data fetcher and use this function instead.
+ * Function arguments are (link class name, search filter, callback)
+ * The fetched objects should be passed to the callback as an array
*/
constructor : function(args) {
for(var k in args)
@@ -33,16 +55,32 @@
this.fmIDL = fieldmapper.IDL.fmclasses[this.fmClass];
this.suppressLinkedFields = args.suppressLinkedFields || [];
- if(!this.idlField) {
- this.fmIDL = fieldmapper.IDL.fmclasses[this.fmClass];
- var fields = this.fmIDL.fields;
- for(var f in fields)
- if(fields[f].name == this.fmField)
- this.idlField = fields[f];
+ if(this.selfReference) {
+ this.fmField = fieldmapper.IDL.fmclasses[this.fmClass].pkey;
+
+ // create a mock-up of the idlField object.
+ this.idlField = {
+ datatype : 'link',
+ 'class' : this.fmClass,
+ reltype : 'has_a',
+ key : this.fmField,
+ name : this.fmField
+ };
+
+ } else {
+
+ if(!this.idlField) {
+ this.fmIDL = fieldmapper.IDL.fmclasses[this.fmClass];
+ var fields = this.fmIDL.fields;
+ for(var f in fields)
+ if(fields[f].name == this.fmField)
+ this.idlField = fields[f];
+ }
}
if(!this.idlField)
- throw new Error("AutoFieldWidget could not determine which field to render. We need more information. fmClass=" +
+ throw new Error("AutoFieldWidget could not determine which " +
+ "field to render. We need more information. fmClass=" +
this.fmClass + ' fmField=' + this.fmField + ' fmObject=' + js2JSON(this.fmObject));
this.auth = openils.User.authtoken;
@@ -59,14 +97,21 @@
var value = this.baseWidgetValue();
switch(this.idlField.datatype) {
case 'bool':
- return (value) ? 't' : 'f'
+ switch(value) {
+ case 'true': return 't';
+ case 'on': return 't';
+ case 'false' : return 'f';
+ case 'unset' : return null;
+ case true : return 't';
+ default: return 'f';
+ }
case 'timestamp':
if(!value) return null;
return dojo.date.stamp.toISOString(value);
case 'int':
case 'float':
case 'money':
- if(isNaN(value)) value = 0;
+ if(isNaN(value)) value = null;
default:
return (value === '') ? null : value;
}
@@ -85,9 +130,17 @@
var value = this.widgetValue;
switch(this.idlField.datatype) {
case 'bool':
- return (openils.Util.isTrue(value)) ?
- openils.widget.AutoFieldWidget.localeStrings.TRUE :
- openils.widget.AutoFieldWidget.localeStrings.FALSE;
+ switch(value) {
+ case 't':
+ case 'true':
+ return openils.widget.AutoFieldWidget.localeStrings.TRUE;
+ case 'f' :
+ case 'false' :
+ return openils.widget.AutoFieldWidget.localeStrings.FALSE;
+ case 'unset' : return openils.widget.AutoFieldWidget.localeStrings.UNSET;
+ case true : return openils.widget.AutoFieldWidget.localeStrings.TRUE;
+ default: return openils.widget.AutoFieldWidget.localeStrings.FALSE;
+ }
case 'timestamp':
if (!value) return '';
dojo.require('dojo.date.locale');
@@ -109,10 +162,15 @@
build : function(onload) {
+ if(this.widgetValue == null)
+ this.widgetValue = (this.fmObject) ? this.fmObject[this.idlField.name]() : null;
+
if(this.widget) {
// core widget provided for us, attach and move on
if(this.parentNode) // may already be in the "right" place
this.parentNode.appendChild(this.widget.domNode);
+ if(this.widget.attr('value') == null)
+ this._widgetLoaded();
return;
}
@@ -120,8 +178,6 @@
this.parentNode = dojo.create('div');
this.onload = onload;
- if(this.widgetValue == null)
- this.widgetValue = (this.fmObject) ? this.fmObject[this.idlField.name]() : null;
if(this.readOnly) {
dojo.require('dijit.layout.ContentPane');
@@ -171,9 +227,30 @@
break;
case 'bool':
- dojo.require('dijit.form.CheckBox');
- this.widget = new dijit.form.CheckBox(this.dijitArgs, this.parentNode);
- this.widgetValue = openils.Util.isTrue(this.widgetValue);
+ if(this.ternary) {
+ dojo.require('dijit.form.FilteringSelect');
+ var store = new dojo.data.ItemFileReadStore({
+ data:{
+ identifier : 'value',
+ items:[
+ {label : openils.widget.AutoFieldWidget.localeStrings.UNSET, value : 'unset'},
+ {label : openils.widget.AutoFieldWidget.localeStrings.TRUE, value : 'true'},
+ {label : openils.widget.AutoFieldWidget.localeStrings.FALSE, value : 'false'}
+ ]
+ }
+ });
+ this.widget = new dijit.form.FilteringSelect(this.dijitArgs, this.parentNode);
+ this.widget.searchAttr = this.widget.labelAttr = 'label';
+ this.widget.valueAttr = 'value';
+ this.widget.store = store;
+ this.widget.startup();
+ this.widgetValue = (this.widgetValue === null) ? 'unset' :
+ (openils.Util.isTrue(this.widgetValue)) ? 'true' : 'false';
+ } else {
+ dojo.require('dijit.form.CheckBox');
+ this.widget = new dijit.form.CheckBox(this.dijitArgs, this.parentNode);
+ this.widgetValue = openils.Util.isTrue(this.widgetValue);
+ }
break;
case 'link':
@@ -211,10 +288,8 @@
return false;
var lclass = linkInfo.linkClass;
- if(lclass == 'aou') {
- this.widgetValue = fieldmapper.aou.findOrgUnit(this.widgetValue).shortname();
- return;
- }
+ if(lclass == 'aou')
+ return false;
// first try the store cache
var self = this;
@@ -222,12 +297,17 @@
var store = this.cache[this.auth].list[lclass];
var query = {};
query[linkInfo.vfield.name] = ''+this.widgetValue;
+ var found = false;
store.fetch({query:query, onComplete:
function(list) {
- self.widgetValue = store.getValue(list[0], linkInfo.vfield.selector);
+ if(list[0]) {
+ self.widgetValue = store.getValue(list[0], linkInfo.vfield.selector);
+ found = true;
+ }
}
});
- return;
+
+ if(found) return;
}
// then try the single object cache
@@ -284,6 +364,7 @@
},
_buildLinkSelector : function() {
+ var self = this;
var selectorInfo = this._getLinkSelector();
if(!selectorInfo) return false;
@@ -307,30 +388,90 @@
this.widget.searchAttr = this.widget.labelAttr = vfield.selector || vfield.name;
this.widget.valueAttr = vfield.name;
- var self = this;
var oncomplete = function(list) {
+
+ if(self.labelFormat)
+ self.widget.labelAttr = '_label';
+
+ if(self.searchFormat)
+ self.widget.searchAttr = '_search';
+
+ function formatString(item, formatList) {
+
+ try {
+
+ // formatList[1..*] are names of fields. Pull the field
+ // values from each object to determine the values for string substitution
+ var values = [];
+ var format = formatList[0];
+ for(var i = 1; i< formatList.length; i++)
+ values.push(item[formatList[i]]);
+
+ return dojo.string.substitute(format, values);
+
+ } catch(E) {
+ throw new Error(
+ "openils.widget.AutoFieldWidget: Invalid formatList ["+formatList+"] : "+E);
+ }
+
+ }
+
if(list) {
- self.widget.store =
- new dojo.data.ItemFileReadStore({data:fieldmapper[linkClass].toStoreData(list)});
+ var storeData = {data:fieldmapper[linkClass].toStoreData(list)};
+
+ if(self.labelFormat) {
+ dojo.forEach(storeData.data.items,
+ function(item) {
+ item._label = formatString(item, self.labelFormat);
+ }
+ );
+ }
+
+ if(self.searchFormat) {
+ dojo.forEach(storeData.data.items,
+ function(item) {
+ item._search = formatString(item, self.searchFormat);
+ }
+ );
+ }
+
+ self.widget.store = new dojo.data.ItemFileReadStore(storeData);
self.cache[self.auth].list[linkClass] = self.widget.store;
+
} else {
self.widget.store = self.cache[self.auth].list[linkClass];
}
+
self.widget.startup();
self._widgetLoaded();
};
- if(this.cache[self.auth].list[linkClass]) {
+ if(!this.noCache && this.cache[self.auth].list[linkClass]) {
oncomplete();
} else {
- new openils.PermaCrud().retrieveAll(linkClass, {
- async : !this.forceSync,
- oncomplete : function(r) {
- var list = openils.Util.readResponse(r, false, true);
- oncomplete(list);
+
+ if(this.dataLoader) {
+
+ // caller provided an external function for retrieving the data
+ this.dataLoader(linkClass, this.searchFilter, oncomplete);
+
+ } else {
+
+ var _cb = function(r) {
+ oncomplete(openils.Util.readResponse(r, false, true));
+ };
+
+ if (this.searchFilter) {
+ new openils.PermaCrud().search(linkClass, this.searchFilter, {
+ async : !this.forceSync, oncomplete : _cb
+ });
+ } else {
+ new openils.PermaCrud().retrieveAll(linkClass, {
+ async : !this.forceSync, oncomplete : _cb
+ });
}
- });
+ }
}
return true;
@@ -356,13 +497,22 @@
} else {
this.baseWidgetValue(this.widgetValue);
- if(this.idlField.name == this.fmIDL.pkey && this.fmIDL.pkey_sequence)
+ if(this.idlField.name == this.fmIDL.pkey && this.fmIDL.pkey_sequence && (!this.selfReference && !this.noDisablePkey))
this.widget.attr('disabled', true);
if(this.disableWidgetTest && this.disableWidgetTest(this.idlField.name, this.fmObject))
this.widget.attr('disabled', true);
}
if(this.onload)
this.onload(this.widget, this);
+
+ if(!this.readOnly && this.dijitArgs && this.dijitArgs.required) {
+ // a required dijit is not given any styling to indicate the value
+ // is invalid until the user has focused the widget then left it with
+ // invalid data. This change tells dojo to pretend this focusing has
+ // already happened so we can style required widgets during page render.
+ this.widget._hasBeenBlurred = true;
+ this.widget.validate();
+ }
},
_buildOrgSelector : function() {
@@ -374,7 +524,7 @@
this.widget.parentField = 'parent_ou';
var user = new openils.User();
- if(this.widgetValue == null)
+ if(this.widgetValue == null && this.orgDefaultsToWs)
this.widgetValue = user.user.ws_ou();
// if we have a limit perm, find the relevent orgs (async)
Modified: branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js 2010-05-21 19:31:22 UTC (rev 16481)
+++ branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js 2010-05-21 20:03:20 UTC (rev 16482)
@@ -18,6 +18,7 @@
editOnEnter : false,
defaultCellWidth : null,
editStyle : 'dialog',
+ editReadOnly : false,
suppressFields : null,
hideSelector : false,
selectorWidth : '1.5',
@@ -25,6 +26,7 @@
columnPickerPrefix : null,
displayLimit : 15,
displayOffset : 0,
+ requiredFields : null,
showPaginator : false,
showLoadFilter : false,
suppressLinkedFields : null, // list of fields whose linked display data should not be fetched from the server
@@ -58,6 +60,7 @@
this.overrideEditWidgets = {};
this.overrideEditWidgetClass = {};
+ this.overrideWidgetArgs = {};
if(this.editOnEnter)
this._applyEditOnEnter();
@@ -317,7 +320,7 @@
dojo.forEach(items,
function(item) {
var fmObject = new fieldmapper[self.fmClass]().fromStoreItem(item);
- new openils.PermaCrud()['delete'](fmObject, {oncomplete : function(r) { self.store.deleteItem(item) }});
+ new openils.PermaCrud()['eliminate'](fmObject, {oncomplete : function(r) { self.store.deleteItem(item) }});
}
);
},
@@ -370,12 +373,17 @@
var grid = this;
var fmObject = new fieldmapper[this.fmClass]().fromStoreItem(storeItem);
var idents = grid.store.getIdentityAttributes();
+ var self = this;
var pane = new openils.widget.EditPane({
fmObject:fmObject,
+ hideSaveButton : this.editReadOnly,
+ readOnly : this.editReadOnly,
overrideWidgets : this.overrideEditWidgets,
overrideWidgetClass : this.overrideEditWidgetClass,
+ overrideWidgetArgs : this.overrideWidgetArgs,
disableWidgetTest : this.disableWidgetTest,
+ requiredFields : this.requiredFields,
onPostSubmit : function() {
for(var i in fmObject._fields) {
var field = fmObject._fields[i];
@@ -413,9 +421,11 @@
fmClass : this.fmClass,
overrideWidgets : this.overrideEditWidgets,
overrideWidgetClass : this.overrideEditWidgetClass,
+ overrideWidgetArgs : this.overrideWidgetArgs,
disableWidgetTest : this.disableWidgetTest,
- onPostSubmit : function(r) {
- var fmObject = openils.Util.readResponse(r);
+ requiredFields : this.requiredFields,
+ onPostSubmit : function(req, cudResults) {
+ var fmObject = cudResults[0];
if(grid.onPostCreate)
grid.onPostCreate(fmObject);
if(fmObject)
Modified: branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoWidget.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoWidget.js 2010-05-21 19:31:22 UTC (rev 16481)
+++ branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoWidget.js 2010-05-21 20:03:20 UTC (rev 16482)
@@ -48,7 +48,7 @@
self.sortedFieldList.push(field)
} else {
// non-IDL field
- self.sortedFieldList.push({name : name, virtual:true});
+ self.sortedFieldList.push({name : name, nonIdl:true});
}
}
);
Modified: branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/EditDialog.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/EditDialog.js 2010-05-21 19:31:22 UTC (rev 16481)
+++ branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/EditDialog.js 2010-05-21 20:03:20 UTC (rev 16482)
@@ -38,9 +38,9 @@
self.hide();
}
- this.editPane.onPostSubmit = function(r) {
+ this.editPane.onPostSubmit = function(r, cudResults) {
self.hide();
- if(onSubmit) onSubmit(r);
+ if(onSubmit) onSubmit(r, cudResults);
}
},
Modified: branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/EditPane.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/EditPane.js 2010-05-21 19:31:22 UTC (rev 16481)
+++ branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/EditPane.js 2010-05-21 20:03:20 UTC (rev 16482)
@@ -16,6 +16,11 @@
onPostSubmit : null, // apply callback
onCancel : null, // cancel callback
hideActionButtons : false,
+ fieldDocs : null,
+ existingTable : null,
+ suppressFields : null,
+ requiredFields : null,
+ paneStackCount : 1, // how many fields to add to each row, for compressing display
constructor : function(args) {
this.fieldList = [];
@@ -31,11 +36,20 @@
this.inherited(arguments);
this.initAutoEnv();
if(this.readOnly)
- this.hideActionButtons = true;
+ this.hideSaveButton = true;
- var table = this.table = document.createElement('table');
+ // grab any field-level docs
+ /*
+ var pcrud = new openils.PermaCrud();
+ this.fieldDocs = pcrud.search('fdoc', {fm_class:this.fmClass});
+ */
+
+ var table = this.existingTable;
+ if(!table) {
+ var table = this.table = document.createElement('table');
+ this.domNode.appendChild(table);
+ }
var tbody = document.createElement('tbody');
- this.domNode.appendChild(table);
table.appendChild(tbody);
this.limitPerms = [];
@@ -48,38 +62,81 @@
if(!this.overrideWidgetClass)
this.overrideWidgetClass = {};
+ if(!this.overrideWidgetArgs)
+ this.overrideWidgetArgs = {};
+
+ var idx = 0;
+ var currentRow;
for(var f in this.sortedFieldList) {
var field = this.sortedFieldList[f];
- if(!field || field.virtual) continue;
+ if(!field || field.virtual || field.nonIdl) continue;
+ if(this.suppressFields && this.suppressFields.indexOf(field.name) > -1)
+ continue;
+
if(field.name == this.fmIDL.pkey && this.mode == 'create' && this.fmIDL.pkey_sequence)
continue; /* don't show auto-generated fields on create */
- var row = document.createElement('tr');
+ if((idx++ % this.paneStackCount) == 0 || !currentRow) {
+ // time to start a new row
+ currentRow = document.createElement('tr');
+ tbody.appendChild(currentRow);
+ }
+
+ //var docTd = document.createElement('td');
var nameTd = document.createElement('td');
var valTd = document.createElement('td');
var valSpan = document.createElement('span');
valTd.appendChild(valSpan);
+ dojo.addClass(nameTd, 'openils-widget-editpane-name-cell');
+ dojo.addClass(valTd, 'openils-widget-editpane-value-cell');
+ if(this.readOnly) {
+ dojo.addClass(nameTd, 'openils-widget-editpane-ro-name-cell');
+ dojo.addClass(valTd, 'openils-widget-editpane-ro-value-cell');
+ }
+
+ /*
+ if(this.fieldDocs[field]) {
+ var helpLink = dojo.create('a');
+ var helpImg = dojo.create('img', {src:'/opac/images/advancedsearch-icon.png'}); // TODO Config
+ helpLink.appendChild(helpImg);
+ docTd.appendChild(helpLink);
+ }
+ */
+
nameTd.appendChild(document.createTextNode(field.label));
- row.setAttribute('fmfield', field.name);
- row.appendChild(nameTd);
- row.appendChild(valTd);
- tbody.appendChild(row);
+ currentRow.setAttribute('fmfield', field.name);
+ //currentRow.appendChild(docTd);
+ currentRow.appendChild(nameTd);
+ currentRow.appendChild(valTd);
+ //dojo.addClass(docTd, 'oils-fm-edit-pane-help');
- var widget = new openils.widget.AutoFieldWidget({
- idlField : field,
- fmObject : this.fmObject,
- fmClass : this.fmClass,
- parentNode : valSpan,
- orgLimitPerms : this.limitPerms,
- readOnly : this.readOnly,
- widget : this.overrideWidgets[field.name],
- widgetClass : this.overrideWidgetClass[field.name],
- disableWidgetTest : this.disableWidgetTest
- });
+ if(!this.overrideWidgetArgs[field.name])
+ this.overrideWidgetArgs[field.name] = {};
+ var args = dojo.mixin(
+ this.overrideWidgetArgs[field.name], {
+ idlField : field,
+ fmObject : this.fmObject,
+ fmClass : this.fmClass,
+ parentNode : valSpan,
+ orgLimitPerms : this.limitPerms,
+ readOnly : this.readOnly,
+ widget : this.overrideWidgets[field.name],
+ widgetClass : this.overrideWidgetClass[field.name],
+ disableWidgetTest : this.disableWidgetTest
+ }
+ );
+
+ if(this.requiredFields && this.requiredFields.indexOf(field.name) >= 0) {
+ if(!args.dijitArgs) args.dijitArgs = {};
+ args.dijitArgs.required = true;
+ }
+
+ var widget = new openils.widget.AutoFieldWidget(args);
+
widget.build();
this.fieldList.push({name:field.name, widget:widget});
}
@@ -117,6 +174,8 @@
onClick : this.onCancel
}, cancelSpan);
+ if(this.hideSaveButton) return;
+
new dijit.form.Button({
label:'Save', // XXX
onClick: function() {self.performAutoEditAction();}
@@ -137,9 +196,9 @@
performAutoEditAction : function() {
var self = this;
self.performEditAction({
- oncomplete:function(r) {
+ oncomplete:function(req, cudResults) {
if(self.onPostSubmit)
- self.onPostSubmit(r);
+ self.onPostSubmit(req, cudResults);
}
});
},
Modified: branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/nls/AutoFieldWidget.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/nls/AutoFieldWidget.js 2010-05-21 19:31:22 UTC (rev 16481)
+++ branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/nls/AutoFieldWidget.js 2010-05-21 20:03:20 UTC (rev 16482)
@@ -1,4 +1,5 @@
{
'TRUE' : 'True',
- 'FALSE' : 'False'
+ 'FALSE' : 'False',
+ 'UNSET' : 'Unset'
}
Modified: branches/rel_1_6/Open-ILS/web/js/ui/default/conify/global/action/survey/edit.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/ui/default/conify/global/action/survey/edit.js 2010-05-21 19:31:22 UTC (rev 16481)
+++ branches/rel_1_6/Open-ILS/web/js/ui/default/conify/global/action/survey/edit.js 2010-05-21 20:03:20 UTC (rev 16482)
@@ -123,8 +123,8 @@
question.question(questionText);
question.isnew(true);
pcrud.create(question,
- {oncomplete: function(r)
- { var q = openils.Util.readResponse(r);
+ {oncomplete: function(r, qs)
+ { var q = qs[0];
questionRow.parentNode.removeChild(questionRow);
drawQuestionBody(q, null);
newQuestionBody(svyId);
Modified: branches/rel_1_6/Open-ILS/web/js/ui/default/conify/global/action/survey.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/ui/default/conify/global/action/survey.js 2010-05-21 19:31:22 UTC (rev 16481)
+++ branches/rel_1_6/Open-ILS/web/js/ui/default/conify/global/action/survey.js 2010-05-21 20:03:20 UTC (rev 16482)
@@ -145,8 +145,8 @@
var pcrud = new openils.PermaCrud();
pcrud.create(sv,
{
- oncomplete: function(r) {
- var obj = openils.Util.readResponse(r);
+ oncomplete: function(r, objs) {
+ var obj = objs[0];
if(!obj) return '';
svGrid.store.newItem(asv.toStoreItem(obj));
svSurveyDialog.hide();
Modified: branches/rel_1_6/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js 2010-05-21 19:31:22 UTC (rev 16481)
+++ branches/rel_1_6/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js 2010-05-21 20:03:20 UTC (rev 16482)
@@ -12,6 +12,7 @@
var matchPoint;
function load(){
+ cmGrid.overrideWidgetArgs.is_renewal = {ternary : true};
cmGrid.loadAll({order_by:{ccmm:'circ_modifier'}});
cmGrid.onEditPane = buildEditPaneAdditions;
circModEditor = dojo.byId('circ-mod-editor').parentNode.removeChild(dojo.byId('circ-mod-editor'));
@@ -22,6 +23,7 @@
}
function buildEditPaneAdditions(editPane) {
+ if(!editPane.fmObject) return;
var node = circModEditor.cloneNode(true);
var tableTmpl = node.removeChild(byName('circ-mod-group-table', node));
circModGroupTables = [];
@@ -143,8 +145,8 @@
if(group.isnew()) {
pcrud.create(group, {
- oncomplete : function(r) {
- var group = openils.Util.readResponse(r);
+ oncomplete : function(r, cudResults) {
+ var group = cudResults[0];
dojo.forEach(entries, function(e) { e.circ_mod_test(group.id()) } );
pcrud.create(entries, {
oncomplete : function() {
@@ -157,8 +159,7 @@
} else {
pcrud.update(group, {
- oncomplete : function(r) {
- openils.Util.readResponse(r);
+ oncomplete : function(r, cudResults) {
var newOnes = entries.filter(function(e) { return e.isnew() });
var delOnes = entries.filter(function(e) { return e.isdeleted() });
if(!delOnes.length && !newOnes.length) {
@@ -169,7 +170,7 @@
pcrud.create(newOnes, {
oncomplete : function() {
if(delOnes.length) {
- pcrud.delete(delOnes, {
+ pcrud.eliminate(delOnes, {
oncomplete : function() {
progressDialog.hide();
}
@@ -180,7 +181,7 @@
}
});
} else {
- pcrud.delete(delOnes, {
+ pcrud.eliminate(delOnes, {
oncomplete : function() {
progressDialog.hide();
}
More information about the open-ils-commits
mailing list