[open-ils-commits] r10978 - in trunk/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:35:45 EDT 2008


Author: erickson
Date: 2008-10-29 13:35:42 -0400 (Wed, 29 Oct 2008)
New Revision: 10978

Modified:
   trunk/Open-ILS/web/js/dojo/openils/Util.js
   trunk/Open-ILS/web/opac/locale/en-US/vandelay.dtd
   trunk/Open-ILS/web/vandelay/inc/queue.xml
   trunk/Open-ILS/web/vandelay/vandelay.css
   trunk/Open-ILS/web/vandelay/vandelay.js
   trunk/Open-ILS/web/vandelay/vandelay.xml
Log:
forward porting 10975 10977, vandelay goodies

Modified: trunk/Open-ILS/web/js/dojo/openils/Util.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/Util.js	2008-10-29 17:33:13 UTC (rev 10977)
+++ trunk/Open-ILS/web/js/dojo/openils/Util.js	2008-10-29 17:35:42 UTC (rev 10978)
@@ -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: trunk/Open-ILS/web/opac/locale/en-US/vandelay.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/vandelay.dtd	2008-10-29 17:33:13 UTC (rev 10977)
+++ trunk/Open-ILS/web/opac/locale/en-US/vandelay.dtd	2008-10-29 17:35:42 UTC (rev 10978)
@@ -100,3 +100,7 @@
 <!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 --">
+<!ENTITY vandelay.queue.total "Total:">
+<!ENTITY vandelay.queue.imported "Imported:">
+

Modified: trunk/Open-ILS/web/vandelay/inc/queue.xml
===================================================================
--- trunk/Open-ILS/web/vandelay/inc/queue.xml	2008-10-29 17:33:13 UTC (rev 10977)
+++ trunk/Open-ILS/web/vandelay/inc/queue.xml	2008-10-29 17:35:42 UTC (rev 10978)
@@ -1,8 +1,14 @@
-<h1>&vandelay.record.queue;</h1><br/>
-<div>
-    <span style='font-size:105%;' id='vl-queue-summary-name'/>
-    <span id='vl-queue-summary-import-count'/> / <span id='vl-queue-summary-total-count'/>
-</div>
+<table class='wide'>
+    <tr>
+        <td align='left'>
+            <h1>&vandelay.record.queue; <span style='font-style:italic;' id='vl-queue-summary-name'/></h1><br/>
+        </td>
+        <td align='right'>
+            &vandelay.queue.total; <span style='font-weight:bold;' id='vl-queue-summary-total-count'/>
+            &vandelay.queue.imported; <span style='font-weight:bold;' id='vl-queue-summary-import-count'/>
+        </td>
+    </tr>
+</table>
 <script>
     var vlQueueGridLayout;
     function resetVlQueueGridLayout() {
@@ -28,7 +34,7 @@
 <div id='vl-queue-div-grid' class='tall' dojoType="dijit.layout.ContentPane" layoutAlign='client'>
 
     <!-- column picker dialog -->
-    <div dojoType="dijit.Dialog" jsId='vlQueueGridColumePickerDialog' title="Column Picker" execute="alert(2);">
+    <div dojoType="dijit.Dialog" jsId='vlQueueGridColumePickerDialog' title="Column Picker">
         <table class='form_table'>
             <thead>
                 <tr><th width='33%'>&vandelay.column;</th>
@@ -54,47 +60,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'>
@@ -104,7 +119,7 @@
                     <span style='padding-right:10px;'>
                         <a href='javascript:void(0);' onclick='vlQueueGridNextPage();'>&vandelay.next.page; &#187;</a>
                     </span>
-                    <span style='background:#e8e1cf;padding:3px 0px 0px 6px;-moz-border-radius:6px 0px 0px 0px;'>
+                    <span style='background:#e8e1cf;padding:3px 2px 2px 6px;-moz-border-radius:6px 0px 0px 0px;'>
                         <a href='javascript:void(0);' onclick='vlQueueGridColumePickerDialog.show();'>&vandelay.select.cols;</a>
                     </span>
                 </td>

Modified: trunk/Open-ILS/web/vandelay/vandelay.css
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.css	2008-10-29 17:33:13 UTC (rev 10977)
+++ trunk/Open-ILS/web/vandelay/vandelay.css	2008-10-29 17:35:42 UTC (rev 10978)
@@ -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 {

Modified: trunk/Open-ILS/web/vandelay/vandelay.js
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.js	2008-10-29 17:33:13 UTC (rev 10977)
+++ trunk/Open-ILS/web/vandelay/vandelay.js	2008-10-29 17:35:42 UTC (rev 10978)
@@ -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: trunk/Open-ILS/web/vandelay/vandelay.xml
===================================================================
--- trunk/Open-ILS/web/vandelay/vandelay.xml	2008-10-29 17:33:13 UTC (rev 10977)
+++ trunk/Open-ILS/web/vandelay/vandelay.xml	2008-10-29 17:35:42 UTC (rev 10978)
@@ -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>
@@ -34,26 +34,26 @@
             <div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
                 <!--#include virtual="inc/progress.xml"-->
             </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-export-div' class='hidden'>
+            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-export-div' class='hidden content'>
                 <!--#include virtual="inc/export.xml"-->
             </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-upload-div' class='hidden'>
+            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-upload-div' class='hidden content'>
                 <!--#include virtual="inc/upload.xml"-->
             </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-queue-div' class='tall hidden'>
+            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-queue-div' class='tall hidden content'>
                 <!--#include virtual="inc/queue.xml"-->
             </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-match-div' class='tall hidden'>
+            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-match-div' class='tall hidden content'>
                 <!--#include virtual="inc/matches.xml"-->
             </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-html-div' class='tall hidden'>
+            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-marc-html-div' class='tall hidden content'>
                 <!--#include virtual="inc/marchtml.xml"-->
             </div>
-            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-queue-select-div' class='tall hidden'>
+            <div dojoType="dijit.layout.ContentPane" layoutAlign='client' id='vl-queue-select-div' class='tall hidden content'>
                 <!--#include virtual="inc/queueselect.xml"-->
             </div>
             <div dojoType="dijit.layout.ContentPane" layoutAlign="client"  id="vl-attr-editor-div" 
-                    class='hidden attr-editor-detail-content-pane' title='&vandelay.edit.attrs;'>
+                    class='hidden attr-editor-detail-content-pane content' title='&vandelay.edit.attrs;'>
                 <!--#include virtual="inc/attrs.xml"-->
             </div>
         </div>



More information about the open-ils-commits mailing list