[open-ils-commits] r10975 - in branches/rel_1_4/Open-ILS/web: js/dojo/openils opac/locale/en-US vandelay vandelay/inc
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Oct 29 13:12:56 EDT 2008
Author: erickson
Date: 2008-10-29 13:12:53 -0400 (Wed, 29 Oct 2008)
New Revision: 10975
Modified:
branches/rel_1_4/Open-ILS/web/js/dojo/openils/Util.js
branches/rel_1_4/Open-ILS/web/opac/locale/en-US/vandelay.dtd
branches/rel_1_4/Open-ILS/web/vandelay/inc/queue.xml
branches/rel_1_4/Open-ILS/web/vandelay/vandelay.js
branches/rel_1_4/Open-ILS/web/vandelay/vandelay.xml
Log:
put vandelay queue actions into dropdown to clean up. queue filters auto-refresh. added some utility methods
Modified: branches/rel_1_4/Open-ILS/web/js/dojo/openils/Util.js
===================================================================
--- branches/rel_1_4/Open-ILS/web/js/dojo/openils/Util.js 2008-10-29 16:40:09 UTC (rev 10974)
+++ branches/rel_1_4/Open-ILS/web/js/dojo/openils/Util.js 2008-10-29 17:12:53 UTC (rev 10975)
@@ -54,6 +54,45 @@
};
/**
+ * Given a HTML select object, returns the currently selected value
+ */
+ openils.Util.selectorValue = function(sel) {
+ if(!sel) return null;
+ var idx = sel.selectedIndex;
+ if(idx < 0) return null;
+ var o = sel.options[idx];
+ var v = o.value;
+ if(v == null) v = o.innerHTML;
+ return v;
+ }
+
+ /**
+ * Returns the character code of the provided (or current window) event
+ */
+ openils.Util.getCharCode = function(evt) {
+ evt = (evt) ? evt : ((window.event) ? event : null);
+ if(evt) {
+ return (evt.charCode ? evt.charCode :
+ ((evt.which) ? evt.which : evt.keyCode ));
+ } else { return -1; }
+ }
+
+
+ /**
+ * Registers a handler for when the Enter key is pressed while
+ * the provided DOM node has focus.
+ */
+ openils.Util.registerEnterHandler = function(domNode, func) {
+ if(!(domNode && func)) return;
+ domNode.onkeydown = function(evt) {
+ var code = openils.Util.getCharCode(evt);
+ if(code == 13 || code == 3)
+ func();
+ }
+ }
+
+
+ /**
* Parses opensrf response objects to see if they contain
* data and/or an ILS event. This only calls request.recv()
* once, so in a streaming context, it's necessary to loop on
Modified: branches/rel_1_4/Open-ILS/web/opac/locale/en-US/vandelay.dtd
===================================================================
--- branches/rel_1_4/Open-ILS/web/opac/locale/en-US/vandelay.dtd 2008-10-29 16:40:09 UTC (rev 10974)
+++ branches/rel_1_4/Open-ILS/web/opac/locale/en-US/vandelay.dtd 2008-10-29 17:12:53 UTC (rev 10975)
@@ -100,3 +100,4 @@
<!ENTITY vandelay.export.retrieve "Retrieve Records">
<!ENTITY vandelay.export.field_no_hint "(starting from 0)">
<!ENTITY vandelay.export.bucket "Record Bucket ID">
+<!ENTITY vandelay.select_actions "-- Actions --">
Modified: branches/rel_1_4/Open-ILS/web/vandelay/inc/queue.xml
===================================================================
--- branches/rel_1_4/Open-ILS/web/vandelay/inc/queue.xml 2008-10-29 16:40:09 UTC (rev 10974)
+++ branches/rel_1_4/Open-ILS/web/vandelay/inc/queue.xml 2008-10-29 17:12:53 UTC (rev 10975)
@@ -54,47 +54,56 @@
<table width='100%' style='margin-bottom:0px;'>
<tr>
<td align='left' valign='bottom'>
- <button dojoType='dijit.form.Button' onclick='vlImportSelectedRecords();'>&vandelay.import.selected;</button>
- <button dojoType='dijit.form.Button' onclick='vlImportAllRecords();'>&vandelay.import.all;</button>
- <button dojoType='dijit.form.Button' onclick="
- if(confirm('&vandelay.sure.to.delete.queue;')) {
- vlDeleteQueue(currentType, currentQueueId,
- function() { displayGlobalDiv('vl-marc-upload-div'); });
- }">&vandelay.delete.queue;</button>
+ <select id='vl-queue-actions-selector'>
+ <option selected='selected' disabled='disabled' value='select-actions'>&vandelay.select_actions;</option>
+ <option value='import'>&vandelay.import.selected;</option>
+ <option value='import_all'>&vandelay.import.all;</option>
+ <option value='delete_queue'>&vandelay.delete.queue;</option>
+ </select>
+ <script>
+ var sel = dojo.byId('vl-queue-actions-selector');
+ sel.onchange = function(evt) {
+ switch(openils.Util.selectorValue(evt.target)) {
+ case 'import': vlImportSelectedRecords(); break;;
+ case 'import_all': vlImportAllRecords(); break;;
+ case 'delete_queue':
+ if(confirm('&vandelay.sure.to.delete.queue;')) {
+ vlDeleteQueue(currentType, currentQueueId,
+ function() { displayGlobalDiv('vl-marc-upload-div'); });
+ }
+ }
+ evt.target.selectedIndex = 0;
+ }
+ </script>
</td>
<td align='middle' valign='bottom'>
- <style>.filter_td { padding-right: 5px; border-right: 2px solid #e8e1cf; } </style>
+ <style>.filter_span { padding-right: 5px; border-right: 2px solid #e8e1cf; } </style>
<table><tr>
- <td class='filter_td'>
- <table class='small_form_table'><tr>
- <td>&vandelay.limit.to.collision.matches;</td>
- <td><input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowMatches'/></td>
- </tr><tr>
- <td>&vandelay.limit.to.non.imported;</td>
- <td><input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowNonImport' checked='checked'/></td>
- </tr></table>
- </td>
- <td class='filter_td' style='padding-left:5px;'>
- <div class='nav_row_div'>&vandelay.results.per.page;</div>
- <div class='nav_row_div'>
- <select style='width:68px;' jsId='vlQueueDisplayLimit' dojoType='dijit.form.FilteringSelect' value='10'>
+ <td>
+ <span>&vandelay.limit.to.collision.matches;</span>
+ <span class='filter_span'>
+ <input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowMatches' onchange='retrieveQueuedRecords();'/>
+ </span>
+
+ <span>&vandelay.limit.to.non.imported;</span>
+ <span class='filter_span'>
+ <input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowNonImport' checked='checked' onchange='retrieveQueuedRecords();'/>
+ </span>
+
+ <span>&vandelay.results.per.page;</span>
+ <span class='filter_span'>
+ <select jsId='vlQueueDisplayLimit' id='vl-queue-display-limit-selector'
+ value='10' onchange='retrieveQueuedRecords();'>
<option value='10'>10</option>
<option value='20'>20</option>
<option value='50'>50</option>
<option value='100'>100</option>
</select>
- </div>
+ </span>
+
+ <span style='padding-left:5px;'>&vandelay.page;</span>
+ <input style='width:36px;' dojoType='dijit.form.TextBox' jsId='vlQueueDisplayPage' value='1'/>
</td>
- <td class='filter_td' style='padding-left:5px;'>
- <div class='nav_row_div'>&vandelay.page;</div>
- <div class='nav_row_div'>
- <input style='width:36px;' dojoType='dijit.form.TextBox' jsId='vlQueueDisplayPage' value='1'/>
- </div>
- </td>
- <td style='padding-left:5px;'>
- <button dojoType='dijit.form.Button'
- onclick='retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords)'>&vandelay.refresh;</button>
- </td>
</tr></table>
</td>
<td align='right' valign='bottom'>
Modified: branches/rel_1_4/Open-ILS/web/vandelay/vandelay.js
===================================================================
--- branches/rel_1_4/Open-ILS/web/vandelay/vandelay.js 2008-10-29 16:40:09 UTC (rev 10974)
+++ branches/rel_1_4/Open-ILS/web/vandelay/vandelay.js 2008-10-29 17:12:53 UTC (rev 10975)
@@ -35,6 +35,7 @@
dojo.require('openils.CGI');
dojo.require('openils.User');
dojo.require('openils.Event');
+dojo.require('openils.Util');
dojo.require('openils.MarcXPathParser');
dojo.require('openils.GridColumnPicker');
@@ -84,6 +85,9 @@
var initNeeded = 4; // how many async responses do we need before we're init'd
var initCount = 0; // how many async reponses we've received
+ openils.Util.registerEnterHandler(
+ vlQueueDisplayPage.domNode, function(){retrieveQueuedRecords();});
+
function checkInitDone() {
initCount++;
if(initCount == initNeeded)
@@ -282,11 +286,17 @@
selectableGridRecords = {};
resetVlQueueGridLayout();
+ if(!type) type = currentType;
+ if(!queueId) queueId = currentQueueId;
+ if(!onload) onload = handleRetrieveRecords;
+
var method = 'open-ils.vandelay.'+type+'_queue.records.retrieve.atomic';
if(vlQueueGridShowMatches.checked)
method = method.replace('records', 'records.matches');
- var limit = parseInt(vlQueueDisplayLimit.getValue());
+ //var limit = parseInt(vlQueueDisplayLimit.getValue());
+ var sel = dojo.byId('vl-queue-display-limit-selector');
+ var limit = parseInt(sel.options[sel.selectedIndex].value);
var offset = limit * parseInt(vlQueueDisplayPage.getValue()-1);
var params = [authtoken, queueId, {clear_marc: 1, offset: offset, limit: limit}];
Modified: branches/rel_1_4/Open-ILS/web/vandelay/vandelay.xml
===================================================================
--- branches/rel_1_4/Open-ILS/web/vandelay/vandelay.xml 2008-10-29 16:40:09 UTC (rev 10974)
+++ branches/rel_1_4/Open-ILS/web/vandelay/vandelay.xml 2008-10-29 17:12:53 UTC (rev 10975)
@@ -22,7 +22,7 @@
<head>
<title>&vandelay.vandelay;</title>
<link type='text/css' rel='stylesheet' href="/vandelay/vandelay.css"/>
- <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:true" src="/js/dojo/dojo/dojo.js"></script>
+ <script type="text/javascript" djConfig="parseOnLoad: true,isDebug:false" src="/js/dojo/dojo/dojo.js"></script>
<script type="text/javascript" src='/js/dojo/openils/MarcXPathParser.js'></script>
<script type="text/javascript" src='/vandelay/vandelay.js'></script>
</head>
More information about the open-ils-commits
mailing list