restore raw z39.50 PQN search feature
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 3 Aug 2009 20:48:33 +0000 (20:48 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 3 Aug 2009 20:48:33 +0000 (20:48 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13791 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/cat/z3950.js
Open-ILS/xul/staff_client/server/cat/z3950.xul
Open-ILS/xul/staff_client/server/locale/en-US/cat.properties

index daedd4c..ac503c0 100644 (file)
 <!ENTITY staff.cat.z3950.clear.accesskey "C">
 <!ENTITY staff.cat.z3950.search.label "Search">
 <!ENTITY staff.cat.z3950.search.accesskey "S">
+<!ENTITY staff.cat.z3950.raw_search.label "Raw Search">
+<!ENTITY staff.cat.z3950.raw_search.accesskey "w">
 <!ENTITY staff.cat.z3950.results_page.label "Results Page">
 <!ENTITY staff.cat.z3950.results_page.accesskey "P">
 <!ENTITY staff.cat.z3950.results_caption.label "Results">
index c4c00c2..e7c2471 100644 (file)
@@ -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,
index fbab62d..601e33a 100644 (file)
                         </rows>
                     </grid>
                     <hbox>
+                        <button id="raw_search" label="&staff.cat.z3950.raw_search.label;" accesskey="&staff.cat.z3950.raw_search.accesskey;" disabled="true"/> 
                         <spacer flex="1"/>
                         <button id="clear" label="&staff.cat.z3950.clear.label;" accesskey="&staff.cat.z3950.clear.accesskey;"/>
-                        <button id="search" label="&staff.cat.z3950.search.label;" accesskey="&staff.cat.z3950.search.accesskey;"/>
+                        <button id="search" label="&staff.cat.z3950.search.label;" accesskey="&staff.cat.z3950.search.accesskey;" disabled="true"/>
                     </hbox>
                 </groupbox>
                 <splitter id="x_splitter" collapse="after" persist="state hidden"><grippy id="splitter_grippy1"/></splitter>
index f853526..bfa269e 100644 (file)
@@ -402,8 +402,13 @@ staff.cat.z3950.obj_controller_init.marc_import_overlay_error=Failure during MAR
 staff.cat.z3950.obj_controller_init.search_fields_error=Error setting up search fields.
 staff.cat.z3950.obj_controller_init.z39_service_error=Z39.50 services not likely retrieved.
 staff.cat.z3950.initial_search.no_search_selection=No services selected to search.
+staff.cat.z3950.initial_search.too_many_selections=Only one service can be used with raw search at a time.
 staff.cat.z3950.initial_search.searching=Searching...
 staff.cat.z3950.initial_search.failed_search=Failure during initial search.
+staff.cat.z3950.initial_search.raw_prompt.title=Raw Z39.50 PQN Search
+staff.cat.z3950.initial_search.raw_prompt.msg=WARNING: This is not a simple keyword search.  Enter raw z39.50 PQN search string: 
+staff.cat.z3950.initial_search.raw_prompt.default_value=
+staff.cat.z3950.initial_search.raw_search_unsupported_for_native_catalog=Raw z39.50 PQN search not yet implemented for native catalog.
 staff.cat.z3950.page_next.more_results=Retrieving more results...
 staff.cat.z3950.page_next.subsequent_search_error=Failure during subsequent search.
 staff.cat.z3950.search.search_error=Failure during actual search.