[open-ils-commits] r12756 - in trunk/Open-ILS/web: js/ui/default/conify/global/config templates/default templates/default/conify/global/config (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Apr 1 16:11:56 EDT 2009
Author: erickson
Date: 2009-04-01 16:11:51 -0400 (Wed, 01 Apr 2009)
New Revision: 12756
Modified:
trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_modifier.js
trunk/Open-ILS/web/templates/default/conify/global/config/circ_modifier.tt2
trunk/Open-ILS/web/templates/default/menu.tt2
Log:
autogrid the circ_modifier config ui
Modified: trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_modifier.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_modifier.js 2009-04-01 20:07:26 UTC (rev 12755)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_modifier.js 2009-04-01 20:11:51 UTC (rev 12756)
@@ -3,130 +3,18 @@
dojo.require('dojo.data.ItemFileWriteStore');
dojo.require('dijit.form.CheckBox');
dojo.require('dijit.form.FilteringSelect');
+dojo.require('openils.widget.AutoGrid');
var cmCache = {};
function buildCMGrid() {
- var store = new dojo.data.ItemFileWriteStore({data:ccm.initStoreData('code', {identifier:'code'})})
- cmGrid.setStore(store);
- cmGrid.render();
- dojo.connect(store, 'onSet', cmGridChanged);
- fieldmapper.standardRequest(
- ['open-ils.pcrud', 'open-ils.pcrud.search.ccm'],
- { async: true,
- params: [openils.User.authtoken, {code:{'!=':null}}],
- onresponse: function (r) {
- if(obj = openils.Util.readResponse(r)) {
- store.newItem(ccm.toStoreItem(obj));
- cmCache[obj.code()] = obj;
- }
- }
- }
- );
+ cmGrid.overrideEditWidgets.sip2_media_type = sip2Selector;
+ cmGrid.loadAll({order_by:{ccm : 'name'}});
}
-
-function cmGridChanged(item, attr, oldVal, newVal) {
- var cm = cmCache[cmGrid.store.getValue(item, 'code')];
- console.log("changing cm " + cm.code() + " object: " + attr + " = " + newVal);
- cm[attr](newVal);
- cm.ischanged(true);
- cmSaveButton.setDisabled(false);
-}
-function saveChanges() {
- cmGrid.doclick(0);
- var changedObjects = [];
- for(var i in cmCache){
- var cm = cmCache[i];
- if(cm.ischanged())
- changedObjects.push(cm);
- }
- _saveChanges(changedObjects, 0);
-}
-function _saveChanges(changedObjects, idx) {
-
- if(idx >= changedObjects.length) {
- // we've made it through the list
- cmSaveButton.setDisabled(true);
- return;
- }
-
- var item = changedObjects[idx];
-
- fieldmapper.standardRequest(
- ['open-ils.permacrud', 'open-ils.permacrud.update.ccm'],
- { async: true,
- params: [openils.User.authtoken, item],
- oncomplete: function(r) {
- if(stat = openils.Util.readResponse(r)) {
- _saveChanges(changedObjects, ++idx);
- }
- }
- }
- );
-}
-function formatMagneticMedia(inDatum) {
- switch (inDatum) {
- case 't':
- return "<span style='color:green;'>✓</span>";
- case 'f':
- return "<span style='color:red;'>✗</span>";
- }
-}
-
-function cmCreate(args) {
- if(! (args.code && args.name && args.description && args.sip2_media_type))
- return;
-
- var cmod = new ccm();
- cmod.code(args.code);
- cmod.name(args.name);
- cmod.description(args.description);
- cmod.sip2_media_type(args.sip2_media_type);
- if(args.magnetic_media[0] == 'on')
- cmod.magnetic_media('t')
- else
- cmod.magnetic_media('f');
-
- fieldmapper.standardRequest(
- ['open-ils.permacrud', 'open-ils.permacrud.create.ccm'],
- { async: true,
- params: [openils.User.authtoken, cmod],
- oncomplete: function(r) {
- if(cm = openils.Util.readResponse(r))
- cmGrid.store.newItem(ccm.toStoreItem(cm));
- }
- }
- );
-}
-
-function deleteFromGrid() {
- _deleteFromGrid(cmGrid.selection.getSelected(), 0);
-}
-
-function _deleteFromGrid(list, idx) {
- if(idx >= list.length) // we've made it through the list
- return;
-
- var item = list[idx];
- var code = cmGrid.store.getValue(item, 'code');
-
- fieldmapper.standardRequest(
- ['open-ils.permacrud', 'open-ils.permacrud.delete.ccm'],
- { async: true,
- params: [openils.User.authtoken, code],
- oncomplete: function(r) {
- if(stat = openils.Util.readResponse(r)) {
- // delete succeeded, remove it from the grid and the local cache
- cmGrid.store.deleteItem(item);
- delete cmCache[item.code];
- }
- _deleteFromGrid(list, ++idx);
- }
- }
- );
-}
-
+
openils.Util.addOnLoad(buildCMGrid);
+
+
\ No newline at end of file
Modified: trunk/Open-ILS/web/templates/default/conify/global/config/circ_modifier.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/config/circ_modifier.tt2 2009-04-01 20:07:26 UTC (rev 12755)
+++ trunk/Open-ILS/web/templates/default/conify/global/config/circ_modifier.tt2 2009-04-01 20:11:51 UTC (rev 12756)
@@ -3,104 +3,76 @@
<h1>Circulation Modifier</h1> <br/>
<div dojoType="dijit.layout.ContentPane" layoutAlign="top">
- <div dojoType="dijit.form.DropDownButton">
- <span>New Circulation Modifier</span>
- <div dojoType="dijit.TooltipDialog" execute="cmCreate(arguments[0]);">
- <table class='dijitTooltipTable'>
- <tr>
- <td><label for="code">Code: </label></td>
- <td><input dojoType="dijit.form.TextBox" name="code"/></td>
- </tr>
- <tr>
- <td><label for="name">Name: </label></td>
- <td><input dojoType="dijit.form.TextBox" name="name"/></td>
- </tr>
- <tr>
- <td><label for="description">Description: </label></td>
- <td><input dojoType="dijit.form.TextBox" name="description"/></td>
- </tr>
- <tr>
- <td><label for="sip2_media_type">SIP2 Media Type: </label></td>
- <td>
- <select dojoType="dijit.form.FilteringSelect" name="sip2_media_type">
- <option value='000'>Other</option>
- <option value='001'>Book</option>
- <option value='002'>Magazine</option>
- <option value='003'>Bound Journal</option>
- <option value='004'>Audio Tape</option>
- <option value='005'>Video Tape</option>
- <option value='006'>CD/CDROM</option>
- <option value='007'>Diskette</option>
- <option value='008'>Book with diskette</option>
- <option value='009'>Book with CD</option>
- <option value='010'>Book with audio tape</option>
- </select>
- </td>
- </tr>
- <tr>
- <td><label for="magnetic_media">Magnetic Media: </label></td>
- <td><input dojoType="dijit.form.CheckBox" name="magnetic_media"/>
- </tr>
- <tr>
- <td colspan='2' align='center'>
- <button dojoType='dijit.form.Button' type="submit">Create</button>
- </td>
- </tr>
- </table>
- </div>
- </div>
-
- <button dojoType='dijit.form.Button' onclick='deleteFromGrid();'>Delete Selected</button>
- <button dojoType='dijit.form.Button' onclick='saveChanges();' disabled='disabled' jsId='cmSaveButton'>Save Changes</button>
-
<script type ="text/javascript">
function formatSIPMediaType(inDatum) {
- switch (inDatum) {
- case '000':
- return 'Other';
- case '001':
- return 'Book';
- case '002':
- return 'Magazine';
- case '003':
- return 'Bound Journal';
- case '004':
- return 'Audio Tape';
- case '005':
- return 'Video Tape';
- case '006':
- return 'CD/CDROM';
- case '007':
- return 'Diskette';
- case '008':
- return 'Book with diskette';
- case '009':
- return 'Book with CD';
- case '010':
- return 'Book with audio tape';
- }
- }
+ switch (inDatum) {
+ case '000':
+ return 'Other';
+ case '001':
+ return 'Book';
+ case '002':
+ return 'Magazine';
+ case '003':
+ return 'Bound Journal';
+ case '004':
+ return 'Audio Tape';
+ case '005':
+ return 'Video Tape';
+ case '006':
+ return 'CD/CDROM';
+ case '007':
+ return 'Diskette';
+ case '008':
+ return 'Book with diskette';
+ case '009':
+ return 'Book with CD';
+ case '010':
+ return 'Book with audio tape';
+ }
+ }
+
</script>
- <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
- <table jsId="cmGrid" dojoType="dojox.grid.DataGrid" query="{name: '*'}" rowSelector='20px'>
+ <div class="hidden"> <select dojoType="dijit.form.FilteringSelect" jsId="sip2Selector">
+ <option value='000'>Other</option>
+ <option value='001' selected='selected'>Book</option>
+ <option value='002'>Magazine</option>
+ <option value='003'>Bound Journal</option>
+ <option value='004'>Audio Tape</option>
+ <option value='005'>Video Tape</option>
+ <option value='006'>CD/CDROM</option>
+ <option value='007'>Diskette</option>
+ <option value='008'>Book with diskette</option>
+ <option value='009'>Book with CD</option>
+ <option value='010'>Book with audio tape</option>
+ </select>
+ </div>
+
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
+ <div>Circulation Modifier</div>
+ <div>
+ <button dojoType='dijit.form.Button' onClick='cmGrid.showCreateDialog()'>New Circ Modifier</button>
+ </div>
+ </div>
+
+ <table jsId="cmGrid"
+ dojoType="openils.widget.AutoGrid"
+ fieldOrder="['code', 'name', 'description', 'sip2_media_type', 'magnetic_media']"
+ query="{name: '*'}"
+ defaultCellWidth='20'
+ fmClass='ccm'
+ editOnEnter='true'>
<thead>
<tr>
- <th field="code">Code</th>
- <th field="name" width='auto' editable='true'
- cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>Name</th>
- <th field="description" width='auto' editable='true'
- cellType='dojox.grid.cells._Widget' widgetClass='dijit.form.TextBox'>Description</th>
- <th field="sip2_media_type" width='auto' editable='true'
- cellType='dojox.grid.cells.Select'
- options='Other,Book,Magazine,Bound Journal,Audio Tape,Video Tape,CD/CDROM,Diskette,Book with Diskette,Book with CD,Book with Audio Tape'
- values='000,001,002,003,004,005,006,007,008,009,010'
- formatter='formatSIPMediaType'>SIP2 Media Type</th>
- <th field="magnetic_media" editable='true' cellType='dojox.grid.cells.Select'
- options='No,Yes' values='f,t' formatter='formatMagneticMedia'>Magnetic Media</th>
+ <th field="magnetic_media"
+ options='No,Yes' values='f,t'
+ formatter='formatMagneticMedia'/>
+ <th field="sip2_media_type" formatter='formatSIPMediaType'/>
+
</tr>
+
</thead>
- </table>
+ </table>
</div>
</div>
-
[% END %]
Modified: trunk/Open-ILS/web/templates/default/menu.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/menu.tt2 2009-04-01 20:07:26 UTC (rev 12755)
+++ trunk/Open-ILS/web/templates/default/menu.tt2 2009-04-01 20:11:51 UTC (rev 12756)
@@ -84,7 +84,7 @@
<div dojoType="dijit.MenuItem" iconClass="dijitEditorIcon dijitEditorIconCopy"
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>
+ onClick="location.href = '[% ctx.base_uri %]/conify/global/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>
More information about the open-ils-commits
mailing list