[open-ils-commits] r9810 - in branches/acq-experiment/Open-ILS/web:
js/dojo/openils/acq
oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common
oilsweb/oilsweb/templates/oils/default/common
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jun 10 21:46:26 EDT 2008
Author: djfiander
Date: 2008-06-10 21:46:24 -0400 (Tue, 10 Jun 2008)
New Revision: 9810
Modified:
branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Lineitems.js
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html
Log:
Draft code for approving lineitems (untested because of proxy bug),
Disable editing lineitem details when lineitem as been approved.
TODO: disable creating and deleting lineitem details when lineitem has
been approved
Modified: branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Lineitems.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Lineitems.js 2008-06-10 17:20:36 UTC (rev 9809)
+++ branches/acq-experiment/Open-ILS/web/js/dojo/openils/acq/Lineitems.js 2008-06-11 01:46:24 UTC (rev 9810)
@@ -52,7 +52,12 @@
}
}
);
- }
+ },
+
+ setState: function(newState, oncomplete) {
+ this.lineitem.state(newState);
+ this.update(oncomplete);
+ },
});
openils.acq.Lineitems.ModelCache = {};
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js 2008-06-10 17:20:36 UTC (rev 9809)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/ui_js/oils/default/common/jubgrid.js 2008-06-11 01:46:24 UTC (rev 9810)
@@ -70,18 +70,53 @@
return fieldmapper.aou.findOrgUnit(data.owning_lib).shortname();
},
populate : function(gridWidget, model, lineitems) {
- JUBGrid.lineitems = lineitems;
+ for (var i in lineitems) {
+ JUBGrid.lineitems[lineitems[i].id()] = lineitems[i];
+ }
JUBGrid.jubGrid = gridWidget;
JUBGrid.jubGrid.setModel(model);
dojo.connect(gridWidget, "onRowClick",
function(evt) {
- JUBGrid.jubDetailGrid.lineitemID = model.getRow(evt.rowIndex).id;
+ var jub = model.getRow(evt.rowIndex);
+ var grid;
+
+ JUBGrid.jubDetailGrid.lineitemID = jub.id;
+
+ if (jub.state == "approved") {
+ grid = JUBGrid.jubDetailGridLayoutReadOnly;
+ } else {
+ grid = JUBGrid.jubDetailGridLayout;
+ }
openils.acq.Lineitems.loadGrid(
JUBGrid.jubDetailGrid,
- JUBGrid.jubGrid.model.getRow(evt.rowIndex).id, JUBGrid.jubDetailGridLayout);
+ JUBGrid.jubGrid.model.getRow(evt.rowIndex).id, grid);
});
gridWidget.update();
},
+
+ approveJUB: function(evt) {
+ var list = [];
+ var selected = JUBGrid.jubGrid.selection.getSelected();
+
+ for (var idx = 0; idx < selected.length; idx++) {
+ var rowIdx = selected[idx];
+ var jub = JUBGrid.jubGrid.model.getRow(rowIdx);
+ var li = new openils.acq.Lineitems({lineitem:JUBGrid.getLi(jub.id)});
+ var approveStore = function() {
+ var approveACQLI = function(jub, rq) {
+ JUBGrid.jubGrid.model.store.setValue(jub,
+ "state", "approved");
+ };
+ JUBGrid.jubGrid.model.store.fetch({query:{id:jub.id},
+ onItem: approveACQLI});
+ };
+
+ li.setState("approved", approveStore);
+ }
+
+ JUBGrid.jubGrid.update();
+ },
+
deleteLID: function(evt) {
var list =[];
var selected = JUBGrid.jubDetailGrid.selection.getSelected();
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-06-10 17:20:36 UTC (rev 9809)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/common/jubgrid.html 2008-06-11 01:46:24 UTC (rev 9810)
@@ -70,15 +70,34 @@
},
]]
}];
+
+ JUBGrid.jubDetailGridLayoutReadOnly = [{
+ cells: [[
+ {name:"ID", field:"id"},
+ {name:"Fund", field:"fund",
+ get:JUBGrid.getLIDFundName,
+ },
+ {name:"Branch", field:"owning_lib",
+ get:JUBGrid.getLIDLibName,
+ },
+ ]]
+ }];
</script>
<div id="${domprefix + '-container'}"
dojoType="dijit.layout.ContentPane" sizeMin="20" sizeShare="50">
+ <div dojoType="dijit.layout.ContentPane"
+ id=${domprefix+"-jub-buttonbar"}>
+ <button dojoType="dijit.form.Button" onclick="JUBGrid.approveJUB">
+ ${_('Approve Selected Titles')}
+ </button>
+ </div>
<div structure='JUBGrid.jubGridLayout' jsid='${grid_jsid}'
- dojoType='dojox.Grid' id="${domprefix + '-JUB-grid'}"> </div>
+ dojoType='dojox.Grid' id="${domprefix + '-JUB-grid'}">
+ </div>
</div>
<div dojoType="dijit.layout.ContentPane" sizeMin="20" sizeShare="50">
- <div jsid="lineItemButtonbar" dojoType="dijit.layout.ContentPane"
+ <div dojoType="dijit.layout.ContentPane"
id=${domprefix+"-details-buttonbar"}>
<div dojoType="dijit.form.DropDownButton">
<span>${_('New Copy')}</span>
@@ -117,7 +136,7 @@
</table>
</div>
</div>
- <button dojotype='dijit.form.Button' onclick='JUBGrid.deleteLID'>
+ <button dojoType='dijit.form.Button' onclick='JUBGrid.deleteLID'>
${_('Delete Selected Copy')}
</button>
</div>
More information about the open-ils-commits
mailing list