From 27497ade326c9138225e9afb858cfe6ee1415074 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 11 Jun 2009 15:15:57 +0000 Subject: [PATCH] finished dupe patron search plugin git-svn-id: svn://svn.open-ils.org/ILS/trunk@13369 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/ui/default/actor/user/register.js | 35 ++++++++++++++++++++-- .../web/templates/default/actor/user/register.tt2 | 19 ++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index 5a434b03d5..bffd23e6f9 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -367,6 +367,7 @@ function uEditDupeSearch(type, value) { 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 @@ function uEditDupeSearch(type, value) { 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 @@ function uEditDupeSearch(type, value) { 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 getByName(node, name) { 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(); } diff --git a/Open-ILS/web/templates/default/actor/user/register.tt2 b/Open-ILS/web/templates/default/actor/user/register.tt2 index 99867c137f..101cddef70 100644 --- a/Open-ILS/web/templates/default/actor/user/register.tt2 +++ b/Open-ILS/web/templates/default/actor/user/register.tt2 @@ -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 @@
+ + + [% END %] -- 2.11.0