1 dojo.require('dojox.grid.DataGrid');
2 dojo.require('openils.widget.AutoGrid');
3 dojo.require('dojox.grid.cells.dijit');
4 dojo.require('dojo.data.ItemFileWriteStore');
5 dojo.require('dijit.form.CurrencyTextBox');
6 dojo.require('dijit.Dialog');
7 dojo.require('dojox.widget.PlaceholderMenuItem');
8 dojo.require('fieldmapper.OrgUtils');
9 dojo.require('dijit.form.FilteringSelect');
10 dojo.require('openils.PermaCrud');
11 dojo.require('openils.widget.OrgUnitFilteringSelect');
16 /** really need to put this in a shared location... */
17 function getOrgInfo(rowIndex, item) {
19 var orgId = this.grid.store.getValue(item, this.field);
20 return fieldmapper.aou.findOrgUnit(orgId).shortname();
23 function thingInit() {
25 thingGrid.disableSelectorForRow = function(rowIdx) {
26 var item = thingGrid.getItem(rowIdx);
27 return (thingGrid.store.getValue(item, 'id') < 0);
31 var connect = function() {
32 dojo.connect(thingContextOrgSelect, 'onChange',
34 thingContextOrg = this.getValue();
35 thingGrid.resetStore();
40 // go ahead and let staff see everything
41 new openils.User().buildPermOrgSelector('STAFF_LOGIN', thingContextOrgSelect, null, connect);
44 function buildGrid() {
45 if(thingContextOrg == null)
46 thingContextOrg = openils.User.user.ws_ou();
48 fieldmapper.standardRequest(
49 ['open-ils.pcrud', 'open-ils.pcrud.search.acns.atomic'],
52 openils.User.authtoken,
53 {"owning_lib":fieldmapper.aou.descendantNodeList(thingContextOrg,true)},
54 {"order_by":{"acns":"label_sortkey"}}
56 oncomplete: function(r) {
57 if(thingList = openils.Util.readResponse(r)) {
58 thingList = openils.Util.objectSort(thingList);
59 dojo.forEach(thingList,
61 thingGrid.store.newItem(acns.toStoreItem(e));
70 openils.Util.addOnLoad(thingInit);