backporting some enhancements for z3950 client
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 3 Nov 2008 17:05:46 +0000 (17:05 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 3 Nov 2008 17:05:46 +0000 (17:05 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_4@11030 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 10bc0e0..37f7d5d 100644 (file)
 <!ENTITY staff.cat.z3950.search_form.accesskey "F">
 <!ENTITY staff.cat.z3950.page_next.label "Fetch More Results">
 <!ENTITY staff.cat.z3950.page_next.accesskey "M">
-<!ENTITY staff.cat.z3950.export.label "CSV to Clipboard">
-<!ENTITY staff.cat.z3950.clip_button.label "Copy to Clipboard">
-<!ENTITY staff.cat.z3950.save_cols_btn.label "Save Columns">
+<!ENTITY staff.cat.z3950.list_actions.label "List Actions">
+<!ENTITY staff.cat.z3950.list_actions.accesskey "L">
+<!ENTITY staff.cat.z3950.menuitem.csv_to_clipboard.label "Copy List CSV to Clipboard">
+<!ENTITY staff.cat.z3950.menuitem.csv_to_file.label "Save List CSV to File">
+<!ENTITY staff.cat.z3950.menuitem.csv_to_printer.label "Print List CSV">
+<!ENTITY staff.cat.z3950.menuitem.copy_to_clipboard.label "Copy Field from selected row to Clipboard">
+<!ENTITY staff.cat.z3950.menuitem.save_columns.label "Save List Configuration">
 <!ENTITY staff.cat.z3950.marc_view.label "MARC View">
 <!ENTITY staff.cat.z3950.marc_view.accesskey "V">
 <!ENTITY staff.cat.z3950.marc_import_overlay.label "MARC Editor for Overlay">
index be0b428..af48c41 100644 (file)
@@ -240,6 +240,19 @@ function add_to_bucket() {
 function mark_for_overlay() {
        g.data.marked_record = docid;
        g.data.stash('marked_record');
+       var robj = g.network.simple_request('MODS_SLIM_RECORD_RETRIEVE.authoritative',[docid]);
+    if (typeof robj.ilsevent == 'undefined') {
+        g.data.marked_record_mvr = robj;
+    } else {
+        g.data.marked_record_mvr = null;
+               g.error.standard_unexpected_error_alert('in mark_for_overlay',robj);
+    }
+    g.data.stash('marked_record_mvr');
+    if (g.data.marked_record_mvr) {
+        alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_marked_for_overlay.tcn.alert',[ g.data.marked_record_mvr.tcn() ]));
+    } else {
+        alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_marked_for_overlay.record_id.alert',[ g.data.marked_record  ]));
+    }
 }
 
 function delete_record() {
index f450135..8197b82 100644 (file)
@@ -28,6 +28,8 @@ cat.opac.record_undeleted=Record undeleted.
 cat.opac.record_undeleted.confirm=Check here to confirm this action.
 # variables: document ID, error code, error description
 cat.opac.record_delete.error=Error deleting record #%1$s : %2$s : %3$s
+cat.opac.record_marked_for_overlay.record_id.alert=Record with ID %1$s marked for overlay.
+cat.opac.record_marked_for_overlay.tcn.alert=Record with TCN %1$s marked for overlay.
 cat.save_record=Save Record
 cat.save.success=Record successfully saved.
 cat.save.failure=Record not likely updated.
index 8286779..64bc65d 100644 (file)
@@ -58,7 +58,7 @@ cat.z3950.prototype = {
                                                try {
                                                        JSAN.use('util.functional');
                                                        var sel = obj.list.retrieve_selection();
-                                                       document.getElementById('clip_button').disabled = sel.length < 1;
+                                                       document.getElementById('sel_clip').setAttribute('disabled', sel.length < 1);
                                                        var list = util.functional.map_list(
                                                                sel,
                                                                function(o) { return o.getAttribute('retrieve_id'); }
@@ -66,8 +66,13 @@ cat.z3950.prototype = {
                                                        obj.error.sdump('D_TRACE','cat/z3950: selection list = ' + js2JSON(list) );
                                                        obj.controller.view.marc_import.disabled = false;
                                                        obj.controller.view.marc_import.setAttribute('retrieve_id',list[0]);
-                                                       obj.controller.view.marc_import_overlay.disabled = false;
-                                                       obj.controller.view.marc_import_overlay.setAttribute('retrieve_id',list[0]);
+                                   obj.data.init({'via':'stash'});
+                               if (obj.data.marked_record) {
+                                                       obj.controller.view.marc_import_overlay.disabled = false;
+                            } else {
+                                                       obj.controller.view.marc_import_overlay.disabled = true;
+                            }
+                                               obj.controller.view.marc_import_overlay.setAttribute('retrieve_id',list[0]);
                                                        obj.controller.view.marc_view_btn.disabled = false;
                                                        obj.controller.view.marc_view_btn.setAttribute('retrieve_id',list[0]);
                                                } catch(E) {
@@ -82,16 +87,10 @@ cat.z3950.prototype = {
                                {
                                        control_map : {
                                                'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
-                                               'sel_clip' : [
-                                                       ['command'],
-                                                       function() { obj.list.clipboard(); }
-                                               ],
-                                               'cmd_export' : [
-                                                       ['command'],
-                                                       function() {
-                                                               obj.list.dump_csv_to_clipboard();
-                                                       }
-                                               ],
+                                               'sel_clip' : [ ['command'], function() { obj.list.clipboard(); } ],
+                                               'cmd_z3950_csv_to_clipboard' : [ ['command'], function() { obj.list.dump_csv_to_clipboard(); } ],
+                        'cmd_z3950_csv_to_printer' : [ ['command'], function() { obj.list.dump_csv_to_printer(); } ], 
+                        'cmd_z3950_csv_to_file' : [ ['command'], function() { obj.list.dump_csv_to_file( { 'defaultFileName' : 'z3950_results.txt' } ); } ],
                                                'cmd_broken' : [
                                                        ['command'],
                                                        function() { alert('Not Yet Implemented'); }
@@ -367,6 +366,28 @@ cat.z3950.prototype = {
 
             setTimeout( function() { obj.focus(); }, 0 );
 
+            setInterval( 
+                function() {
+                    obj.data.init({'via':'stash'});
+                    if (obj.data.marked_record) {
+                                               var sel = obj.list.retrieve_selection();
+                        if (sel.length > 0) { obj.controller.view.marc_import_overlay.disabled = false; }
+                        if ($("overlay_tcn_indicator")) {
+                            if (obj.data.marked_record_mvr) {
+                                $("overlay_tcn_indicator").setAttribute('value',$("catStrings").getFormattedString('staff.cat.z3950.marked_record_for_overlay_indicator.tcn.label',[obj.data.marked_record_mvr.tcn()]));
+                            } else {
+                                $("overlay_tcn_indicator").setAttribute('value',$("catStrings").getFormattedString('staff.cat.z3950.marked_record_for_overlay_indicator.record_id.label',[obj.data.marked_record]));
+                            }
+                        }
+                    } else {
+                        obj.controller.view.marc_import_overlay.disabled = true;
+                        if ($("overlay_tcn_indicator")) {
+                            $("overlay_tcn_indicator").setAttribute('value',$("catStrings").getString('staff.cat.z3950.marked_record_for_overlay_indicator.no_record.label'));
+                        }
+                    }
+                }, 2000
+            );
+
                } catch(E) {
                        this.error.sdump('D_ERROR','cat.z3950.init: ' + E + '\n');
                }
@@ -380,7 +401,7 @@ cat.z3950.prototype = {
                        var x = obj.creds.hosts[ obj.data.server_unadorned ].services[ obj.active_services[i] ].default_attr;
                 if (x) { focus_me = x; break; }
             }
-            if (ob.services[ obj.active_services[i] ]) for (var i in obj.services[ obj.active_services[i] ].attr) { or_focus_me = i; }
+            if (obj.services[ obj.active_services[i] ]) for (var i in obj.services[ obj.active_services[i] ].attr) { or_focus_me = i; }
         }
         if (! focus_me) focus_me = or_focus_me;
                var xx = document.getElementById(focus_me+'_input'); if (xx) xx.focus();
@@ -409,6 +430,9 @@ cat.z3950.prototype = {
                        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 = []; 
                        obj.search_params.username = [];
@@ -491,6 +515,9 @@ cat.z3950.prototype = {
                                x.appendChild( document.createTextNode($("catStrings").getFormattedString('staff.cat.z3950.handle_results.server_error', [results.textcode, results.desc])));
                                return;
                        }
+            obj.controller.view.cmd_z3950_csv_to_file.setAttribute('disabled','false');
+            obj.controller.view.cmd_z3950_csv_to_clipboard.setAttribute('disabled','false');
+            obj.controller.view.cmd_z3950_csv_to_printer.setAttribute('disabled','false');
             if (typeof results.length == 'undefined') results = [ results ];
             for (var i = 0; i < results.length; i++) {
                 if (results[i].query) {
index f18a107..d31b4a9 100644 (file)
 
        <commandset id="cat_z3950_cmds">
                <command id="cmd_broken" />
-               <command id="cmd_export" />
-               <command id="sel_clip" />
+               <command id="sel_clip" disabled="true" />
+        <command id="cmd_z3950_csv_to_printer" disabled="true" />
+        <command id="cmd_z3950_csv_to_clipboard" disabled="true" />
+        <command id="cmd_z3950_csv_to_file" disabled="true" />
                <command id="save_columns" />
                <command id="toggle_form" />
                <command id="marc_view" />
@@ -91,8 +93,8 @@
 
        <groupbox flex="1">
                <caption label="&staff.cat.z3950.marc_import.label;"/>
-            <hbox id="top_pane" flex="1">
-                <groupbox flex="1">
+            <hbox id="top_pane" persist="height" flex="1">
+                <groupbox id="x_splitter1" persist="width" flex="1">
                     <caption label="&staff.cat.z3950.query.label;"/>
                     <hbox>
                         <spacer flex="1"/>
                         </description>
                         <spacer flex="1"/>
                     </hbox>
-                    <grid>
+                    <grid flex="1">
                         <columns><column /><column flex="1" /></columns>
-                        <rows id="query_inputs">
+                        <rows id="query_inputs" class="my_overflow">
                             <row>
                                 <label id="item_type_label" value="&staff.z39_50.search_class.item_type;" control="item_type_input" onclick="g.z3950.default_attr = 'item_type'" style="-moz-user-focus: ignore"/>
                                 <menulist id="item_type_input" mytype="search_class" search_class="item_type">
                         <button id="search" label="&staff.cat.z3950.search.label;" accesskey="&staff.cat.z3950.search.accesskey;"/>
                     </hbox>
                 </groupbox>
-                <groupbox flex="1">
+                <splitter id="x_splitter" collapse="after" persist="state hidden"><grippy/></splitter>
+                <groupbox id="x_splitter2" persist="width" flex="1">
                     <caption label="&staff.cat.z3950.service_credentials.label;"/>
                     <grid flex="1">
                         <columns>
                     </hbox>
                 </groupbox>
             </hbox>
-            <splitter id="z_splitter" persist="height"/>
-            <groupbox flex="1">
+            <splitter id="z_splitter" collapse="before" persist="state hidden"><grippy/></splitter>
+            <groupbox id="z_splitter2" persist="height" flex="1">
                 <caption label="&staff.cat.z3950.results_caption.label;"/>
-                <hbox id="result_message" />
+                <hbox>
+                    <hbox id="result_message" />
+                    <spacer flex="1"/>
+                    <label id="overlay_tcn_indicator"/>
+                </hbox>
                 <hbox>
                     <button id="page_next" label="&staff.cat.z3950.page_next.label;" accesskey="&staff.cat.z3950.page_next.accesskey;" disabled="true"/>
-                    <button id="export" label="&staff.cat.z3950.export.label;" command="cmd_export" accesskey=""/>
-                    <button id="clip_button" command="sel_clip" label="&staff.cat.z3950.clip_button.label;" disabled="true"/>
-                    <button id="save_cols_btn" command="save_columns" label="&staff.cat.z3950.save_cols_btn.label;"/>
+                    <button id="z3950_list_actions" oncommand="this.firstChild.showPopup();"
+                        label="&staff.cat.z3950.list_actions.label;" 
+                        accesskey="&staff.cat.z3950.list_actions.accesskey;" 
+                        type="menu" allowevents="true">
+                        <menupopup id="z3950_list_actions_popup">
+                            <menuitem command="sel_clip" label="&staff.cat.z3950.menuitem.copy_to_clipboard.label;" disabled="true" />
+                            <menuitem command="cmd_z3950_csv_to_printer" label="&staff.cat.z3950.menuitem.csv_to_printer.label;" />
+                            <menuitem command="cmd_z3950_csv_to_clipboard" label="&staff.cat.z3950.menuitem.csv_to_clipboard.label;" />
+                            <menuitem command="cmd_z3950_csv_to_file" label="&staff.cat.z3950.menuitem.csv_to_file.label;" />
+                            <menuitem command="save_columns" label="&staff.cat.z3950.menuitem.save_columns.label;" />
+                        </menupopup>
+                    </button>
                     <spacer flex="1"/>
                     <button id="marc_view_btn" command="marc_view" disabled="true"/>
                     <button id="marc_import_overlay" label="&staff.cat.z3950.marc_import_overlay.label;" accesskey="&staff.cat.z3950.marc_import_overlay.accesskey;" disabled="true"/>