From d2799245844ac4f22041be4b7ada8d3cf6a03559 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 26 Jun 2008 22:11:16 +0000 Subject: [PATCH] added copy location display and editing for lineitem details. still need to find a way to pass runtime info to the editor object -- to test, it is currently loading all copy locations git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9944 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/openils/editors.js | 18 +++++++++++++++ .../media/ui_js/oils/default/common/jubgrid.js | 26 +++++++++++++--------- .../templates/oils/default/common/jubgrid.html | 8 +++++-- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/editors.js b/Open-ILS/web/js/dojo/openils/editors.js index 7f9846bb1f..e7ecd5fbfd 100644 --- a/Open-ILS/web/js/dojo/openils/editors.js +++ b/Open-ILS/web/js/dojo/openils/editors.js @@ -50,4 +50,22 @@ dojo.declare('openils.editors.OrgUnitSelectEditor', dojox.grid.editors.Dijit, { }, }); +dojo.declare('openils.editors.CopyLocationSelectEditor', dojox.grid.editors.Dijit, { + editorClass: "dijit.form.FilteringSelect", + createEditor: function(inNode, inDatum, inRowIndex) { + dojo.require('openils.CopyLocation'); + var editor = new this.editorClass(this.getEditorProps(inDatum), inNode); + openils.CopyLocation.createStore(1, /* XXX how do we propagate arguments to the editor?? */ + function(store) { + editor.store = new dojo.data.ItemFileReadStore({data:store}); + editor.startup(); + if(inDatum) + editor.setValue(inDatum); + } + ); + return editor; + }, +}); + } + diff --git a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js index 03c6f398ca..4ae3e31b69 100644 --- a/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js +++ b/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js @@ -55,6 +55,11 @@ var JUBGrid = { if(!data || !data.provider) return; return openils.acq.Provider.retrieve(data.provider).code(); }, + getCopyLocation : function(rowIndex) { + var data = JUBGrid.jubDetailGrid.model.getRow(rowIndex); + if(!data || !data.location) return ''; + return openils.CopyLocation.retrieve(data.location).name(); + }, getLIDFundName : function(rowIndex) { var data = JUBGrid.jubDetailGrid.model.getRow(rowIndex); if (!data || !data.fund) return; @@ -78,20 +83,21 @@ var JUBGrid = { if(JUBGrid.showDetails) { dojo.connect(gridWidget, "onRowClick", function(evt) { - var jub = model.getRow(evt.rowIndex); - var grid; + var jub = model.getRow(evt.rowIndex); + var grid; - JUBGrid.jubDetailGrid.lineitemID = jub.id; + JUBGrid.jubDetailGrid.lineitemID = jub.id; - if (jub.state == "approved") { - grid = JUBGrid.jubDetailGridLayoutReadOnly; - } else { - grid = JUBGrid.jubDetailGridLayout; - } - openils.acq.Lineitems.loadGrid( + if (jub.state == "approved") { + grid = JUBGrid.jubDetailGridLayoutReadOnly; + } else { + grid = JUBGrid.jubDetailGridLayout; + } + openils.acq.Lineitems.loadGrid( JUBGrid.jubDetailGrid, JUBGrid.jubGrid.model.getRow(evt.rowIndex).id, grid); - }); + } + ); } gridWidget.update(); }, diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html index eeaed9f8fb..e55482a631 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html @@ -44,6 +44,7 @@ pointing to the JUB model (and store) that you have created. % endif +