[open-ils-commits] r13369 - in trunk/Open-ILS/web: js/ui/default/actor/user templates/default/actor/user (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jun 11 11:15:59 EDT 2009


Author: erickson
Date: 2009-06-11 11:15:57 -0400 (Thu, 11 Jun 2009)
New Revision: 13369

Modified:
   trunk/Open-ILS/web/js/ui/default/actor/user/register.js
   trunk/Open-ILS/web/templates/default/actor/user/register.tt2
Log:
finished dupe patron search plugin

Modified: trunk/Open-ILS/web/js/ui/default/actor/user/register.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/actor/user/register.js	2009-06-11 13:50:39 UTC (rev 13368)
+++ trunk/Open-ILS/web/js/ui/default/actor/user/register.js	2009-06-11 15:15:57 UTC (rev 13369)
@@ -367,6 +367,7 @@
     switch(type) {
 
         case 'name':
+            openils.Util.hide('uedit-dupe-names-link');
             var fname = findWidget('au', 'first_given_name').widget.attr('value');
             var lname = findWidget('au', 'family_name').widget.attr('value');
             if( !(fname && lname) ) return;
@@ -377,10 +378,12 @@
             break;
 
         case 'email':
+            openils.Util.hide('uedit-dupe-email-link');
             search = {email : {value : value, group : 0}};
             break;
 
         case 'ident':
+            openils.Util.hide('uedit-dupe-ident-link');
             search = {ident : {value : value, group : 2}};
             break;
     }
@@ -391,7 +394,34 @@
             params: [openils.User.authtoken, search],
             oncomplete : function(r) {
                 var resp = openils.Util.readResponse(r);
-                console.log(js2JSON(resp));
+
+                if(resp && resp.length > 0) {
+                    openils.Util.hide('uedit-help-div');
+                    openils.Util.show('uedit-dupe-div');
+                    var link;
+                    switch(type) {
+                        case 'name':
+                            link = dojo.byId('uedit-dupe-names-link');
+                            link.innerHTML = 'Found ' + resp.length + ' patrons with the same name';
+                            break;
+                        case 'email':
+                            link = dojo.byId('uedit-dupe-email-link');
+                            link.innerHTML = 'Found ' + resp.length + ' patrons with the same email';
+                            break;
+                        case 'ident':
+                            link = dojo.byId('uedit-dupe-ident-link');
+                            link.innerHTML = 'Found ' + resp.length + ' patrosn with the same identification';
+                            break;
+                    }
+
+                    openils.Util.show(link);
+                    link.onclick = function() {
+                        if(window.xulG)
+                            window.xulG.spawn_search(search);
+                        else
+                            console.log("running XUL patron search " + js2JSON(search));
+                    }
+                }
             }
         }
     );
@@ -403,7 +433,8 @@
 
 
 function ueLoadContextHelp(fmcls, fmfield) {
-    openils.Util.removeCSSClass(dojo.byId('uedit-help-div'), 'hidden');
+    openils.Util.hide('uedit-dupe-div');
+    openils.Util.show('uedit-help-div');
     dojo.byId('uedit-help-field').innerHTML = fieldmapper.IDL.fmclasses[fmcls].field_map[fmfield].label;
     dojo.byId('uedit-help-text').innerHTML = fieldDoc[fmcls][fmfield].string();
 }

Modified: trunk/Open-ILS/web/templates/default/actor/user/register.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/actor/user/register.tt2	2009-06-11 13:50:39 UTC (rev 13368)
+++ trunk/Open-ILS/web/templates/default/actor/user/register.tt2	2009-06-11 15:15:57 UTC (rev 13369)
@@ -35,6 +35,18 @@
         font-weight: bold;
         padding: 20px;
     }
+
+    #uedit-dupe-div {
+        position: fixed;
+        top:124px;
+        right:30px;
+        width:300px;
+        border:2px dashed #d9e8f9;
+        -moz-border-radius: 10px;
+        font-weight: bold;
+        padding: 20px;
+    }
+
     .uedit-help {
         width: 25px;
         border:1px solid #e0e0e0;
@@ -167,5 +179,12 @@
     <div id='uedit-help-text'/>
 </fieldset>
 
+<!-- duplicate patron search results -->
+<div id='uedit-dupe-div' class='hidden'>
+    <div><a href='javascript:void(0);' id='uedit-dupe-names-link'></a></div>
+    <div><a href='javascript:void(0);' id='uedit-dupe-email-link'></a></div>
+    <div><a href='javascript:void(0);' id='uedit-dupe-ident-link'></a></div>
+</div>
+
 [% END %]
 



More information about the open-ils-commits mailing list