[open-ils-commits] r10090 - in
branches/acq-experiment/Open-ILS/web: js/dojo/openils
js/dojo/openils/acq js/dojo/openils/widget
oilsweb/oilsweb/templates/oils/default/acq/picklist
oilsweb/oilsweb/templates/oils/default/common
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jul 22 20:52:28 EDT 2008
Author: djfiander
Date: 2008-07-22 20:52:27 -0400 (Tue, 22 Jul 2008)
New Revision: 10090
Added:
branches/acq-experiment/Open-ILS/web/js/dojo/openils/widget/ProviderSelector.js
Modified:
branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Picklist.js
branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Provider.js
branches/acq-experiment/Open-ILS/web/js/dojo/openils/editors.js
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html
Log:
Provider editing works
Modified: branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Picklist.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Picklist.js 2008-07-22 22:21:03 UTC (rev 10089)
+++ branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Picklist.js 2008-07-23 00:52:27 UTC (rev 10090)
@@ -95,6 +95,36 @@
}
return '';
},
+ onJUBSet: function (griditem, attr, oldVal,newVal) {
+ var item;
+ var updateDone = function(r) {
+ var stat = r.recv().content();
+ var evt = openils.Event.parse(stat);
+
+ if (evt) {
+ alert("Error: "+evt.desc);
+ console.dir(evt);
+ }
+ };
+
+ if (oldVal == newVal) {
+ return;
+ }
+
+ item = this._data[griditem.id];
+ if (attr = "provider") {
+ item.provider(newVal);
+ } else {
+ alert("Unexpected attr in Picklist.onSet: '"+attr+"'");
+ return;
+ }
+
+ fieldmapper.standardRequest(
+ ["open-ils.acq", "open-ils.acq.lineitem.update"],
+ {params: [openils.User.authtoken, item],
+ oncomplete: updateDone
+ });
+ },
});
/** Creates a new picklist. fields.name is required */
Modified: branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Provider.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Provider.js 2008-07-22 22:21:03 UTC (rev 10089)
+++ branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Provider.js 2008-07-23 00:52:27 UTC (rev 10090)
@@ -134,4 +134,41 @@
);
}
+openils.acq.Provider.storeCache = [];
+
+openils.acq.Provider.buildPermProviderSelector = function(perm, selector) {
+ dojo.require('dojo.data.ItemFileReadStore');
+
+ function hookupStore(store) {
+ selector.store = store;
+ selector.startup();
+ }
+
+ function buildPicker(r) {
+ var msg;
+ var providerList = [];
+ while (msg = r.recv()) {
+ var provider = msg.content();
+ providerList.push(provider);
+ }
+
+ var store = new dojo.data.ItemFileReadStore({data:acqpro.toStoreData(providerList)});
+
+ hookupStore(store);
+ openils.acq.Provider.storeCache[perm] = store;
+ }
+
+ if (openils.acq.Provider.storeCache[perm]) {
+ hookupStore(openils.acq.Provider.storeCache[perm]);
+ } else {
+ fieldmapper.standardRequest(
+ ['open-ils.acq', 'open-ils.acq.provider.org.retrieve'],
+ { params: [openils.User.authtoken, null,
+ {flesh_summary:1, limit_perm:perm}],
+ oncomplete: buildPicker,
+ async: true
+ }
+ )
+ }
}
+}
Modified: branches/acq-experiment/Open-ILS/web/js/dojo/openils/editors.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/js/dojo/openils/editors.js 2008-07-22 22:21:03 UTC (rev 10089)
+++ branches/acq-experiment/Open-ILS/web/js/dojo/openils/editors.js 2008-07-23 00:52:27 UTC (rev 10090)
@@ -8,6 +8,7 @@
dojo.require('dijit.form.FilteringSelect');
dojo.require("openils.widget.FundSelector");
+dojo.require("openils.widget.ProviderSelector");
dojo.require("openils.widget.OrgUnitFilteringSelect");
dojo.require("openils.acq.Fund");
@@ -40,6 +41,17 @@
},
});
+dojo.declare('openils.editors.ProviderSelectEditor', dojox.grid.editors.Dijit, {
+ editorClass: "openils.widget.ProviderSelector",
+ createEditor: function(inNode, inDatum, inRowIndex) {
+ console.log("openils.widget.ProviderSelectEditor");
+ var editor = new this.editorClass(this.getEditorProps(inDatum), inNode);
+ openils.acq.Provider.buildPermProviderSelector(this.cell.perm || this.perm,
+ editor);
+ return editor;
+ },
+});
+
dojo.declare('openils.editors.OrgUnitSelectEditor', dojox.grid.editors.Dijit, {
editorClass: "openils.widget.OrgUnitFilteringSelect",
createEditor: function(inNode, inDatum, inRowIndex) {
Added: branches/acq-experiment/Open-ILS/web/js/dojo/openils/widget/ProviderSelector.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/js/dojo/openils/widget/ProviderSelector.js (rev 0)
+++ branches/acq-experiment/Open-ILS/web/js/dojo/openils/widget/ProviderSelector.js 2008-07-23 00:52:27 UTC (rev 10090)
@@ -0,0 +1,18 @@
+if(!dojo._hasResource["openils.widget.ProviderSelector"]){
+ dojo._hasResource["openils.widget.ProviderSelector"] = true;
+ dojo.provide("openils.widget.ProviderSelector");
+
+ dojo.require('openils.acq.Provider');
+ dojo.require('fieldmapper.Fieldmapper');
+ dojo.require('fieldmapper.dojoData');
+
+ /**
+ * This widget provides a specific selector for selecting
+ * a provider.
+ */
+
+ dojo.declare(
+ "openils.widget.ProviderSelector", [dijit.form.FilteringSelect],
+ {
+ });
+}
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html 2008-07-22 22:21:03 UTC (rev 10089)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/picklist/view.html 2008-07-23 00:52:27 UTC (rev 10090)
@@ -37,7 +37,20 @@
dojo.byId("oils-acq-picklist-attr-cdate").innerHTML = plist.create_time();
dojo.byId("oils-acq-picklist-attr-edate").innerHTML = plist.edit_time();
dojo.byId("oils-acq-picklist-attr-owner").innerHTML = plist.owner();
- JUBGrid.populate(pickListGrid, model, plist._items);
+ JUBGrid.populate(pickListGrid,
+ model,
+ plist._items);
+ dojo.connect(model.store,
+ "onSet",
+ function(griditem,
+ attr,
+ oldVal,
+ newVal) {
+ plist.onJUBSet(griditem,
+ attr,
+ oldVal,
+ newVal);
+ });
});
}
dojo.addOnLoad(loadPL);
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html 2008-07-22 22:21:03 UTC (rev 10089)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html 2008-07-23 00:52:27 UTC (rev 10090)
@@ -59,7 +59,10 @@
{name: '${_("ISBN")}', get:JUBGrid.getJUBIsbn},
{name: '${_("Pubdate")}', get:JUBGrid.getJUBPubdate},
{name: '${_("Price")}', get:JUBGrid.getJUBPrice},
- {name: '${_("Vendor")}', get:JUBGrid.getProvider},
+ {name: '${_("Vendor")}',
+ field: 'provider', width:'auto', get:JUBGrid.getProvider,
+ editor:openils.editors.ProviderSelectEditor,
+ },
{name: '${_("No. Copies")}', field: 'item_count'},
{name: '${_("State")}', field: 'state'},
{name: '${_("PO")}', get:JUBGrid.getPO}
@@ -78,8 +81,7 @@
editor: openils.editors.OrgUnitSelectEditor
},
{name:"Barcode", field:"barcode", width:'auto',
- editor:dojox.grid.editors.Dijit,
- editorClass: "dijit.form.TextBox"
+ editor:dojox.grid.editors.TextBox,
},
{name:"Call Number", field:"cn_label", width:'auto',
editor:dojox.grid.editors.Dijit,
More information about the open-ils-commits
mailing list