added some rough exchange rate editing code using auto widgets. essentially function...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 4 Feb 2009 04:49:23 +0000 (04:49 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 4 Feb 2009 04:49:23 +0000 (04:49 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12060 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/templates/default/conify/global/acq/exchange_rate.tt2 [new file with mode: 0644]

diff --git a/Open-ILS/web/templates/default/conify/global/acq/exchange_rate.tt2 b/Open-ILS/web/templates/default/conify/global/acq/exchange_rate.tt2
new file mode 100644 (file)
index 0000000..5a179f0
--- /dev/null
@@ -0,0 +1,65 @@
+[% WRAPPER default/base.tt2 %]
+<!--
+<script src='[% ctx.media_prefix %]/js/ui/default/conify/global/config/billing_type.js'> </script>
+-->
+<h1>Exchange Rates</h1><br/>
+
+<script>
+    dojo.require('dojo.data.ItemFileWriteStore');
+    dojo.require('openils.widget.EditDialog');
+    dojo.require('openils.widget.AutoGrid');
+    dojo.require('openils.PermaCrud');
+    dojo.require('openils.Util');
+    dojo.require('dojox.grid.DataGrid');
+
+    var cache = {};
+    function renderGrid() {
+        var pcrud = new openils.PermaCrud();
+        pcrud.retrieveAll('acqexr', 
+            {   async : true,
+                oncomplete : function(r) {
+                    var list = openils.Util.readResponse(r);
+                    erGrid.fmObjectList = list;
+                    for(var i in list) {
+                        cache[list[i].id()] = list[i];
+                        erGrid.store.newItem(list[i].toStoreItem());
+                    }
+                    erGrid.update();
+                }
+            }
+        );
+    }
+    openils.Util.addOnLoad(renderGrid);
+
+    openils.Util.addOnLoad(function() {
+        dojo.connect(erGrid, 'onKeyDown',
+            function(e) {
+                if(e.keyCode == dojo.keys.ENTER) {
+                    this.selection.deselectAll();
+                    this.selection.select(this.focus.rowIndex);
+                    var item = this.selection.getFirstSelected();
+                    var dialog = new openils.widget.EditDialog({
+                        fmObject:cache[item.id],
+                        onPostApply : function() {
+                            // update grid item object
+                        }
+                    });
+                    dialog.editPane.fieldOrder = erGrid.fieldOrder;
+                    dialog.startup();
+                    dialog.show();
+                }
+            }
+        );
+    });
+
+</script>
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign="top" style='height:600px;'>
+    <table jsId="erGrid" dojoType="openils.widget.AutoGrid" 
+            fieldOrder="['id', 'from_currency', 'to_currency', 'ratio']"
+            query="{id: '*'}" rowSelector='20px' fmClass='acqexr'>
+    </table>
+</div>
+[% END %]
+
+