[open-ils-commits] r13794 - in branches/rel_1_4/Open-ILS: web/opac/locale/en-US xul/staff_client/server/cat xul/staff_client/server/locale/en-US (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Aug 3 16:55:37 EDT 2009


Author: phasefx
Date: 2009-08-03 16:55:31 -0400 (Mon, 03 Aug 2009)
New Revision: 13794

Modified:
   branches/rel_1_4/Open-ILS/web/opac/locale/en-US/lang.dtd
   branches/rel_1_4/Open-ILS/xul/staff_client/server/cat/z3950.js
   branches/rel_1_4/Open-ILS/xul/staff_client/server/cat/z3950.xul
   branches/rel_1_4/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
Log:
Backport changeset 13791 from trunk: restore raw z39.50 PQN search feature

Modified: branches/rel_1_4/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- branches/rel_1_4/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-08-03 20:55:20 UTC (rev 13793)
+++ branches/rel_1_4/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-08-03 20:55:31 UTC (rev 13794)
@@ -2117,6 +2117,8 @@
 <!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">

Modified: branches/rel_1_4/Open-ILS/xul/staff_client/server/cat/z3950.js
===================================================================
--- branches/rel_1_4/Open-ILS/xul/staff_client/server/cat/z3950.js	2009-08-03 20:55:20 UTC (rev 13793)
+++ branches/rel_1_4/Open-ILS/xul/staff_client/server/cat/z3950.js	2009-08-03 20:55:31 UTC (rev 13794)
@@ -184,6 +184,17 @@
 								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() {
@@ -223,6 +234,7 @@
 
 										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++) {
@@ -231,6 +243,14 @@
                                                         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 = {};
@@ -434,13 +454,13 @@
 			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;
@@ -464,6 +484,51 @@
 		}
 	},
 
+    '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;
@@ -484,8 +549,14 @@
 			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,

Modified: branches/rel_1_4/Open-ILS/xul/staff_client/server/cat/z3950.xul
===================================================================
--- branches/rel_1_4/Open-ILS/xul/staff_client/server/cat/z3950.xul	2009-08-03 20:55:20 UTC (rev 13793)
+++ branches/rel_1_4/Open-ILS/xul/staff_client/server/cat/z3950.xul	2009-08-03 20:55:31 UTC (rev 13794)
@@ -127,9 +127,10 @@
                         </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/></splitter>

Modified: branches/rel_1_4/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
===================================================================
--- branches/rel_1_4/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties	2009-08-03 20:55:20 UTC (rev 13793)
+++ branches/rel_1_4/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties	2009-08-03 20:55:31 UTC (rev 13794)
@@ -387,8 +387,13 @@
 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.



More information about the open-ils-commits mailing list