From: phasefx Date: Mon, 3 Aug 2009 20:48:33 +0000 (+0000) Subject: restore raw z39.50 PQN search feature X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=18fc4a738bd5458efa2c5af73d0aa0f80b1fbac5;p=evergreen%2Fbjwebb.git restore raw z39.50 PQN search feature git-svn-id: svn://svn.open-ils.org/ILS/trunk@13791 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index daedd4c0d..ac503c027 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -2299,6 +2299,8 @@ + + diff --git a/Open-ILS/xul/staff_client/server/cat/z3950.js b/Open-ILS/xul/staff_client/server/cat/z3950.js index c4c00c2b3..e7c2471fe 100644 --- a/Open-ILS/xul/staff_client/server/cat/z3950.js +++ b/Open-ILS/xul/staff_client/server/cat/z3950.js @@ -184,6 +184,17 @@ cat.z3950.prototype = { obj.initial_search(); }, ], + 'raw_search' : [ + ['command'], + function() { + var raw = window.prompt( + $("catStrings").getString('staff.cat.z3950.initial_search.raw_prompt.msg'), + $("catStrings").getString('staff.cat.z3950.initial_search.raw_prompt.default_value'), + $("catStrings").getString('staff.cat.z3950.initial_search.raw_prompt.title') + ); + if (raw) obj.initial_raw_search(raw); + } + ], 'page_next' : [ ['command'], function() { @@ -239,6 +250,7 @@ cat.z3950.prototype = { function handle_switch(node) { try { + $('search').setAttribute('disabled','true'); $('raw_search').setAttribute('disabled','true'); obj.active_services = []; var snl = document.getElementsByAttribute('mytype','service_class'); for (var i = 0; i < snl.length; i++) { @@ -247,6 +259,14 @@ cat.z3950.prototype = { if (n.checked) obj.active_services.push( n.getAttribute('service') ); } } + if (obj.active_services.length > 0) { + $('search').setAttribute('disabled','false'); + } + if (obj.active_services.length == 1) { + if (obj.active_services[0] != 'native-evergreen-catalog') { + $('raw_search').setAttribute('disabled','false'); + } + } var nl = document.getElementsByAttribute('mytype','search_class'); for (var i = 0; i < nl.length; i++) { nl[i].disabled = true; } var attrs = {}; @@ -450,13 +470,13 @@ cat.z3950.prototype = { obj.controller.view.cmd_z3950_csv_to_clipboard.setAttribute('disabled','true'); obj.controller.view.cmd_z3950_csv_to_printer.setAttribute('disabled','true'); - obj.search_params.service = []; - obj.search_params.username = []; - obj.search_params.password = []; + obj.search_params.service_array = []; + obj.search_params.username_array = []; + obj.search_params.password_array = []; for (var i = 0; i < obj.active_services.length; i++) { - obj.search_params.service.push( obj.active_services[i] ); - obj.search_params.username.push( document.getElementById( obj.active_services[i]+'_username' ).value ); - obj.search_params.password.push( document.getElementById( obj.active_services[i]+'_password' ).value ); + obj.search_params.service_array.push( obj.active_services[i] ); + obj.search_params.username_array.push( document.getElementById( obj.active_services[i]+'_username' ).value ); + obj.search_params.password_array.push( document.getElementById( obj.active_services[i]+'_password' ).value ); } obj.search_params.limit = Math.ceil( obj.limit / obj.active_services.length ); obj.search_params.offset = 0; @@ -480,6 +500,51 @@ cat.z3950.prototype = { } }, + 'initial_raw_search' : function(raw) { + try { + var obj = this; + obj.result_set = []; obj.number_of_result_sets = 0; + JSAN.use('util.widgets'); + util.widgets.remove_children( obj.controller.view.result_message ); + var x = document.createElement('description'); obj.controller.view.result_message.appendChild(x); + if (obj.active_services.length < 1) { + x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.no_search_selection'))); + return; + } + if (obj.active_services.length > 1) { + x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.too_many_selections'))); + return; + } + if (obj.active_services[0] == 'native-evergreen-catalog') { + x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.raw_search_unsupported_for_native_catalog'))); + return; + } + x.appendChild( document.createTextNode($("catStrings").getString('staff.cat.z3950.initial_search.searching'))); + obj.search_params = {}; obj.list.clear(); + obj.controller.view.page_next.disabled = true; + obj.controller.view.cmd_z3950_csv_to_file.setAttribute('disabled','true'); + obj.controller.view.cmd_z3950_csv_to_clipboard.setAttribute('disabled','true'); + obj.controller.view.cmd_z3950_csv_to_printer.setAttribute('disabled','true'); + + obj.search_params.service_array = []; + obj.search_params.username_array = []; + obj.search_params.password_array = []; + for (var i = 0; i < obj.active_services.length; i++) { + obj.search_params.service_array.push( obj.active_services[i] ); + obj.search_params.username_array.push( document.getElementById( obj.active_services[i]+'_username' ).value ); + obj.search_params.password_array.push( document.getElementById( obj.active_services[i]+'_password' ).value ); + } + obj.search_params.limit = Math.ceil( obj.limit / obj.active_services.length ); + obj.search_params.offset = 0; + + obj.search_params.query = raw; + + obj.search(); + } catch(E) { + this.error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.z3950.initial_search.failed_search'),E); + } + }, + 'page_next' : function() { try { var obj = this; @@ -500,8 +565,14 @@ cat.z3950.prototype = { var method; if (typeof obj.search_params.query == 'undefined') { method = 'FM_BLOB_RETRIEVE_VIA_Z3950_SEARCH'; + obj.search_params.service = obj.search_params.service_array; + obj.search_params.username = obj.search_params.username_array; + obj.search_params.password = obj.search_params.password_array; } else { method = 'FM_BLOB_RETRIEVE_VIA_Z3950_RAW_SEARCH'; + obj.search_params.service = obj.search_params.service_array[0]; + obj.search_params.username = obj.search_params.username_array[0]; + obj.search_params.password = obj.search_params.password_array[0]; } obj.network.simple_request( method, diff --git a/Open-ILS/xul/staff_client/server/cat/z3950.xul b/Open-ILS/xul/staff_client/server/cat/z3950.xul index fbab62d6d..601e33abc 100644 --- a/Open-ILS/xul/staff_client/server/cat/z3950.xul +++ b/Open-ILS/xul/staff_client/server/cat/z3950.xul @@ -126,9 +126,10 @@ +