From 2f4152be651fc7226c744cbcb247bafd25e02aa8 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 29 Oct 2008 17:35:42 +0000 Subject: [PATCH] forward porting 10975 10977, vandelay goodies git-svn-id: svn://svn.open-ils.org/ILS/trunk@10978 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/dojo/openils/Util.js | 39 ++++++++++++ Open-ILS/web/opac/locale/en-US/vandelay.dtd | 4 ++ Open-ILS/web/vandelay/inc/queue.xml | 93 +++++++++++++++++------------ Open-ILS/web/vandelay/vandelay.css | 1 + Open-ILS/web/vandelay/vandelay.js | 12 +++- Open-ILS/web/vandelay/vandelay.xml | 16 ++--- 6 files changed, 117 insertions(+), 48 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/Util.js b/Open-ILS/web/js/dojo/openils/Util.js index 4ce9cffa71..904caa5f1a 100644 --- a/Open-ILS/web/js/dojo/openils/Util.js +++ b/Open-ILS/web/js/dojo/openils/Util.js @@ -54,6 +54,45 @@ if(!dojo._hasResource["openils.Util"]) { }; /** + * 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 diff --git a/Open-ILS/web/opac/locale/en-US/vandelay.dtd b/Open-ILS/web/opac/locale/en-US/vandelay.dtd index fd266416d3..a2017fe5f4 100644 --- a/Open-ILS/web/opac/locale/en-US/vandelay.dtd +++ b/Open-ILS/web/opac/locale/en-US/vandelay.dtd @@ -100,3 +100,7 @@ + + + + diff --git a/Open-ILS/web/vandelay/inc/queue.xml b/Open-ILS/web/vandelay/inc/queue.xml index 00e5722492..563a650da4 100644 --- a/Open-ILS/web/vandelay/inc/queue.xml +++ b/Open-ILS/web/vandelay/inc/queue.xml @@ -1,8 +1,14 @@ -

&vandelay.record.queue;


-
- - / -
+ + + + + +
+

&vandelay.record.queue;


+
+ &vandelay.queue.total; + &vandelay.queue.imported; +
- + - - - -
- - - - - - -
&vandelay.limit.to.collision.matches;
&vandelay.limit.to.non.imported;
-
- - + &vandelay.limit.to.collision.matches; + + + + + &vandelay.limit.to.non.imported; + + + + + &vandelay.results.per.page; + + - - - - - - + + + &vandelay.page; +
@@ -104,7 +119,7 @@ &vandelay.next.page; » - + &vandelay.select.cols; diff --git a/Open-ILS/web/vandelay/vandelay.css b/Open-ILS/web/vandelay/vandelay.css index f42d9f4fa7..27831fb46a 100644 --- a/Open-ILS/web/vandelay/vandelay.css +++ b/Open-ILS/web/vandelay/vandelay.css @@ -5,6 +5,7 @@ html,body { width:100%; height:100%; border:0; margin:0; padding:0; } table { border-collapse: collapse; } table.dijitTooltipTable { border-collapse: separate; } +.content { padding: 5px; } .form_table td { padding: 6px; } .small_form_table td { padding: 1px; } .match_div { diff --git a/Open-ILS/web/vandelay/vandelay.js b/Open-ILS/web/vandelay/vandelay.js index b7a32f7536..14b0636468 100644 --- a/Open-ILS/web/vandelay/vandelay.js +++ b/Open-ILS/web/vandelay/vandelay.js @@ -35,6 +35,7 @@ dojo.require("fieldmapper.dojoData"); 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 @@ function vlInit() { 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 @@ function retrieveQueuedRecords(type, queueId, onload) { 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}]; diff --git a/Open-ILS/web/vandelay/vandelay.xml b/Open-ILS/web/vandelay/vandelay.xml index dbbfa63f2b..10aac24576 100644 --- a/Open-ILS/web/vandelay/vandelay.xml +++ b/Open-ILS/web/vandelay/vandelay.xml @@ -22,7 +22,7 @@ &vandelay.vandelay; - + @@ -34,26 +34,26 @@
-