[open-ils-commits] r18572 - trunk/Open-ILS/web/js/dojo/openils/widget (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Nov 1 23:00:59 EDT 2010
Author: erickson
Date: 2010-11-01 23:00:57 -0400 (Mon, 01 Nov 2010)
New Revision: 18572
Modified:
trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
Log:
AutoFieldWidget linked class autoloaders, etc.
* leave linked selector disabled until entries are fetched;
* added support for applying default linked class object loaders;
* added default loader for acq providers, since large sets of
providers can take an excessive amount of time w/ direct pcrud call.
Modified: trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js 2010-11-02 03:00:56 UTC (rev 18571)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js 2010-11-02 03:00:57 UTC (rev 18572)
@@ -413,8 +413,10 @@
this.widget = new dijit.form.FilteringSelect(this.dijitArgs, this.parentNode);
this.widget.searchAttr = this.widget.labelAttr = vfield.selector || vfield.name;
this.widget.valueAttr = vfield.name;
+ this.widget.attr('disabled', true);
var oncomplete = function(list) {
+ self.widget.attr('disabled', false);
if(self.labelFormat)
self.widget.labelAttr = '_label';
@@ -477,6 +479,9 @@
} else {
+ if(!this.dataLoader && openils.widget.AutoFieldWidget.defaultLinkedDataLoader[linkClass])
+ this.dataLoader = openils.widget.AutoFieldWidget.defaultLinkedDataLoader[linkClass];
+
if(this.dataLoader) {
// caller provided an external function for retrieving the data
@@ -651,5 +656,30 @@
openils.widget.AutoFieldWidget.localeStrings = dojo.i18n.getLocalization("openils.widget", "AutoFieldWidget");
openils.widget.AutoFieldWidget.cache = {};
+ openils.widget.AutoFieldWidget.defaultLinkedDataLoader = {};
+
+ /* Custom provider-as-link-class fetcher. Fitler is ignored.
+ * All viewable providers are retrieved.
+ */
+ openils.widget.AutoFieldWidget.defaultLinkedDataLoader.acqpro =
+ function(linkClass, fitler, oncomplete) {
+
+ fieldmapper.standardRequest(
+ ['open-ils.acq', 'open-ils.acq.provider.org.retrieve'],
+ {
+ async : true,
+ params : [openils.User.authtoken],
+ oncomplete : function(r) {
+ var resp;
+ var list = [];
+ while(resp = r.recv()) {
+ var pro = resp.content();
+ if(pro) list.push(pro);
+ }
+ oncomplete(list);
+ }
+ }
+ );
+ }
}
More information about the open-ils-commits
mailing list