[open-ils-commits] r12670 - in trunk/Open-ILS/web: js/ui/default/conify/global/acq templates/default templates/default/conify/global/acq (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Mar 25 15:10:02 EDT 2009
Author: erickson
Date: 2009-03-25 15:09:58 -0400 (Wed, 25 Mar 2009)
New Revision: 12670
Added:
trunk/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js
trunk/Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2
Modified:
trunk/Open-ILS/web/templates/default/menu.tt2
Log:
added distribution formula admin UI
Added: trunk/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js (rev 0)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js 2009-03-25 19:09:58 UTC (rev 12670)
@@ -0,0 +1,68 @@
+dojo.require('openils.widget.AutoGrid');
+dojo.require('dijit.form.FilteringSelect');
+dojo.require('openils.PermaCrud');
+var formula;
+var formCache = [];
+function draw() {
+ if(formulaId) {
+ openils.Util.hide('formula-list-div');
+ drawFormulaSummary();
+ } else {
+ openils.Util.hide('formula-entry-div');
+ fListGrid.onPostCreate = function(fmObject) {
+ location.href = location.href + '/' + fmObject.id();
+ }
+ fieldmapper.standardRequest(
+ ['open-ils.acq', 'open-ils.acq.distribution_formula.ranged.retrieve'],
+ { async: true,
+ params: [openils.User.authtoken],
+ onresponse: function (r) {
+ var form = openils.Util.readResponse(r);
+ formCache[form.id()] = form;
+ fListGrid.store.newItem(form.toStoreItem());
+ }
+ }
+ );
+
+ }
+}
+openils.Util.addOnLoad(draw);
+
+/*function getFormulaId (rowIndex, item) {
+ if(!item) return '';
+ var pcrud = new openils.PermaCrud;
+ var formulaName = pcrud.retrieve('acqdf', formulaId);
+ return formulaName.name();
+
+
+}
+*/
+function drawFormulaSummary() {
+ openils.Util.show('formula-entry-div');
+ dfeListGrid.overrideEditWidgets.formula = new
+ dijit.form.TextBox({style:'display:none', value: formulaId});
+ dfeListGrid.loadAll({order_by:{acqdfe : 'formula'}}, {formula : formulaId});
+ var pcrud = new openils.PermaCrud;
+ var formulaName = pcrud.retrieve('acqdf', formulaId);
+ dojo.byId('formula_head').innerHTML = formulaName.name();
+}
+
+function getItemCount(rowIndex, item) {
+ if(!item) return '';
+ var form = formCache[this.grid.store.getValue(item, "id")];
+ var count = 0;
+ dojo.forEach(form.entries(),
+ function(e) {
+ count = count + e.item_count();
+ }
+ );
+ return count;
+}
+
+function getFormulaName(rowIndex, item) {
+ if(!item) return '';
+ return '<a href="' + location.href + '/' +
+ this.grid.store.getValue(item, 'id') + '">' +
+ this.grid.store.getValue(item, 'name') + '</a>';
+}
+
Added: trunk/Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2 (rev 0)
+++ trunk/Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2 2009-03-25 19:09:58 UTC (rev 12670)
@@ -0,0 +1,57 @@
+[% WRAPPER default/base.tt2 %]
+<script src='[% ctx.media_prefix %]/js/ui/default/conify/global/acq/distribution_formula.js'> </script>
+<script> var formulaId = '[% ctx.page_args.0 %]';</script>
+
+
+<div id='formula-list-div'>
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+ <div>Distribution Formulas</div>
+ <div><button dojoType='dijit.form.Button' onClick='fListGrid.showCreateDialog()'>New Formula</button></div>
+ </div>
+ <table jsId="fListGrid"
+ dojoType="openils.widget.AutoGrid"
+ fieldOrder="['id', 'name', 'owner', 'item_count', 'skip_count']"
+ query="{id: '*'}"
+ defaultCellWidth='12'
+ fmClass='acqdf'
+ editOnEnter='true'>
+ <thead>
+ <tr><th field='name' get='getFormulaName'/>
+
+ <th field='item_count' get='getItemCount'/
+ </tr>
+ </thead>
+ </table>
+ </div>
+</div>
+
+
+
+<div id='formula-entry-div'>
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="top">
+ <div id='formula-summary-pane'/>
+ </div>
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+ <div id="formula_head"></div>
+ <div> <button dojoType='dijit.form.Button' onClick='dfeListGrid.showCreateDialog()'>New Formula Entry</button></div>
+ </div>
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:400px'>
+ <table jsId="dfeListGrid"
+ dojoType="openils.widget.AutoGrid"
+ fieldOrder="['id','formula', 'owning_lib', 'location', 'item_count', 'position']"
+ suppressFields="['formula']"
+ query="{id: '*'}"
+ defaultCellWidth='12'
+ fmClass='acqdfe'
+ editOnEnter='true'>
+ <thead>
+ <tr> <th field='formula' get='getFormulaId'/>
+ </tr>
+ </thead>
+ </table>
+ </div>
+ </div>
+</div>
+[% END %]
+
Modified: trunk/Open-ILS/web/templates/default/menu.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/menu.tt2 2009-03-25 17:55:25 UTC (rev 12669)
+++ trunk/Open-ILS/web/templates/default/menu.tt2 2009-03-25 19:09:58 UTC (rev 12670)
@@ -85,6 +85,8 @@
onClick="location.href = '[% ctx.base_uri %]/acq/currency_type/list';">Currency Types</div>
<div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconCopy"
onClick="location.href = '[% ctx.base_uri %]/acq/exchange_rate';">Exchange Rates</div>
+ <div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconCopy"
+ onClick="location.href = '[% ctx.base_uri %]/conify/global/acq/distribution_formula';">Distribution Formulas</div>
</div>
</div>
<div dojoType="dijit.PopupMenuItem" iconClass="dijitEditorIcon dijitEditorIconCopy">
More information about the open-ils-commits
mailing list