[open-ils-commits] [GIT] Evergreen ILS branch master updated. 86c964aaa5790af1311022d6577fb148a8fb052b

Evergreen Git git at git.evergreen-ils.org
Tue Jul 12 10:42:17 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  86c964aaa5790af1311022d6577fb148a8fb052b (commit)
      from  d7ca3063e82919015a1692f3646351b0c7b79012 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 86c964aaa5790af1311022d6577fb148a8fb052b
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Tue Jul 12 10:42:08 2011 -0400

    "Mark Local Result as Overlay Target" action in z39.50 client
    
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd
index 7cbb97d..710abd0 100644
--- a/Open-ILS/web/opac/locale/en-US/lang.dtd
+++ b/Open-ILS/web/opac/locale/en-US/lang.dtd
@@ -2905,6 +2905,8 @@
 <!ENTITY staff.cat.z3950.page_next.accesskey "M">
 <!ENTITY staff.cat.z3950.list_actions.label "List Actions">
 <!ENTITY staff.cat.z3950.list_actions.accesskey "L">
+<!ENTITY staff.cat.z3950.mark_overlay.label "Mark Local Result as Overlay Target">
+<!ENTITY staff.cat.z3950.mark_overlay.accesskey "">
 <!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">
diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
index 228f92b..92a1ad5 100644
--- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
+++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
@@ -698,6 +698,8 @@ function add_to_bucket() {
     );
 }
 
+// FIXME: now duplicated in cat.util, which we can't import here, though maybe
+// we can do something at build time
 function mark_for_overlay() {
     g.data.marked_record = docid;
     g.data.stash('marked_record');
diff --git a/Open-ILS/xul/staff_client/server/cat/util.js b/Open-ILS/xul/staff_client/server/cat/util.js
index 19ee2ab..600f360 100644
--- a/Open-ILS/xul/staff_client/server/cat/util.js
+++ b/Open-ILS/xul/staff_client/server/cat/util.js
@@ -12,7 +12,7 @@ cat.util.EXPORT_OK    = [
     'render_loan_duration', 'mark_item_as_missing_pieces', 'render_callnumbers_for_bib_menu',
     'render_cn_prefix_menuitems', 'render_cn_suffix_menuitems', 'render_cn_class_menu',
     'render_cn_prefix_menu', 'render_cn_suffix_menu', 'transfer_specific_title_holds',
-    'request_items'
+    'request_items', 'mark_for_overlay'
 ];
 cat.util.EXPORT_TAGS    = { ':all' : cat.util.EXPORT_OK };
 
@@ -1146,4 +1146,106 @@ cat.util.request_items = function(copy_ids) {
     }
 }
 
+cat.util.mark_for_overlay = function(doc_id,doc_mvr) {
+
+    try {
+
+        JSAN.use('OpenILS.data'); var data = new OpenILS.data();
+        data.stash_retrieve();
+        JSAN.use('util.network'); var network = new util.network();
+
+        function gen_statusbar_click_handler(data_key) {
+            return function (ev) {
+
+                if (! data[data_key]) {
+                    return;
+                }
+
+                if (ev.button == 0 /* left click, spawn opac */) {
+                    var opac_url = xulG.url_prefix( urls.opac_rdetail )
+                        + '?r=' + data[data_key];
+                    var content_params = {
+                        'session' : ses(),
+                        'authtime' : ses('authtime'),
+                        'opac_url' : opac_url,
+                    };
+                    xulG.new_tab(
+                        xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
+                        {'tab_name':'Retrieving title...'},
+                        content_params
+                    );
+                }
+
+                if (ev.button == 2 /* right click, remove mark */) {
+                    if ( window.confirm( $('offlineStrings').getString(
+                            'cat.opac.clear_statusbar')
+                    ) ) {
+                        data[data_key] = null;
+                        data.stash(data_key);
+                        ev.target.setAttribute('label','');
+                        if (ev.target.hasAttribute('tooltiptext')) {
+                            ev.target.removeAttribute('tooltiptext');
+                        }
+                    }
+                }
+            }
+        }
+
+        data.marked_record = doc_id;
+        data.stash('marked_record');
+        if (!doc_mvr) {
+            var robj = network.simple_request(
+                'MODS_SLIM_RECORD_RETRIEVE.authoritative',[doc_id]);
+            if (typeof robj.ilsevent == 'undefined') {
+                data.marked_record_mvr = robj;
+            } else {
+                data.marked_record_mvr = null;
+                alert('Error in cat.util.mark_for_overlay #2: ', js2JSON(robj));
+            }
+        } else {
+            data.marked_record_mvr = doc_mvr;
+        }
+        data.stash('marked_record_mvr');
+        if (data.marked_record_mvr) {
+            alert(
+                $('offlineStrings').getFormattedString(
+                    'cat.opac.record_marked_for_overlay.tcn.alert',
+                    [ data.marked_record_mvr.tcn() ]
+                )
+            );
+            xulG.set_statusbar(
+                1,
+                $("offlineStrings").getFormattedString(
+                    'staff.cat.z3950.marked_record_for_overlay_indicator.tcn.label',
+                    [data.marked_record_mvr.tcn()]
+                ),
+                $("offlineStrings").getFormattedString(
+                    'staff.cat.z3950.marked_record_for_overlay_indicator.record_id.label',
+                    [data.marked_record]
+                ),
+                gen_statusbar_click_handler('marked_record')
+            );
+        } else {
+            alert(
+                $('offlineStrings').getFormattedString(
+                    'cat.opac.record_marked_for_overlay.record_id.alert',
+                    [ data.marked_record  ]
+                )
+            );
+            xulG.set_statusbar(
+                1,
+                $("offlineStrings").getFormattedString(
+                    'staff.cat.z3950.marked_record_for_overlay_indicator.record_id.label',
+                    [data.marked_record]
+                ),
+                '',
+                gen_statusbar_click_handler('marked_record')
+            );
+        }
+    } catch(E) {
+        alert('Error in cat.util.mark_for_overlay(): ' + E);
+    }
+}
+
+
 dump('exiting cat/util.js\n');
diff --git a/Open-ILS/xul/staff_client/server/cat/z3950.js b/Open-ILS/xul/staff_client/server/cat/z3950.js
index dc8ad86..dc600e8 100644
--- a/Open-ILS/xul/staff_client/server/cat/z3950.js
+++ b/Open-ILS/xul/staff_client/server/cat/z3950.js
@@ -72,6 +72,12 @@ cat.z3950.prototype = {
                                             $('jacket_image').setAttribute('tooltiptext','');
                                         }
                                     }
+                                    if (o.getAttribute('service') == 'native-evergreen-catalog') {
+                                        $('mark_overlay_btn').disabled = false;
+                                        obj.controller.view.mark_overlay.setAttribute('doc_id',o.getAttribute('doc_id'));
+                                    } else {
+                                        $('mark_overlay_btn').disabled = true;
+                                    }
                                     return o.getAttribute('retrieve_id');
                                 }
                             );
@@ -158,6 +164,19 @@ cat.z3950.prototype = {
                                 }
                             },
                         ],
+                        'mark_overlay' : [
+                            ['command'],
+                            function() {
+                                try {
+                                    var doc_id = obj.controller.view.mark_overlay.getAttribute('doc_id');
+                                    if (doc_id) {
+                                        cat.util.mark_for_overlay(doc_id);
+                                    }
+                                } catch(E) {
+                                    alert('Error in z3950.js, mark_overlay: ' + E);
+                                }
+                            }
+                        ],
                         'marc_import' : [
                             ['command'],
                             function() {
@@ -662,13 +681,33 @@ cat.z3950.prototype = {
                                 'retrieve_id' : String( obj.number_of_result_sets ) + '-' + String( j ),
                                 'row' : {
                                     'my' : {
-                                        'mvr' : function(a){return a;}(obj.result_set[ obj.number_of_result_sets ].records[j].mvr),
+                                        'mvr' : function(a){
+                                            if (a.bibid) {
+                                                // We have col definitions, etc.
+                                                // expecting doc_id
+                                                a.mvr.doc_id( a.bibid );
+                                            }
+                                            return a.mvr;
+                                        }(obj.result_set[ obj.number_of_result_sets ].records[j]),
                                         'service' : results[i].service
                                     }
                                 }
                             }
                         );
                         n.my_node.setAttribute('isbn', function(a){return a;}(obj.result_set[ obj.number_of_result_sets ].records[j].mvr).isbn());
+                        n.my_node.setAttribute(
+                            'service',
+                            function(a){return a;}(
+                                results[i].service
+                            )
+                        );
+                        n.my_node.setAttribute(
+                            'doc_id',
+                            function(a){return a;}(
+                                (obj.result_set[ obj.number_of_result_sets ].records[j].mvr)
+                            ).doc_id()
+                        );
+
                         if (!f) { n.my_node.parentNode.focus(); f = n; } 
                     }
                 } else {
diff --git a/Open-ILS/xul/staff_client/server/cat/z3950.xul b/Open-ILS/xul/staff_client/server/cat/z3950.xul
index 029dab5..2a30095 100644
--- a/Open-ILS/xul/staff_client/server/cat/z3950.xul
+++ b/Open-ILS/xul/staff_client/server/cat/z3950.xul
@@ -85,6 +85,7 @@
         <command id="cmd_z3950_csv_to_clipboard" disabled="true" />
         <command id="cmd_z3950_csv_to_file" disabled="true" />
         <command id="save_columns" />
+        <command id="mark_overlay" />
         <command id="toggle_form" />
         <command id="marc_view" />
     </commandset>
@@ -181,6 +182,11 @@
                             <menuitem command="save_columns" label="&staff.cat.z3950.menuitem.save_columns.label;" />
                         </menupopup>
                     </button>
+                    <button id="mark_overlay_btn"
+                        command="mark_overlay"
+                        disabled="true"
+                        label="&staff.cat.z3950.mark_overlay.label;"
+                        accesskey="&staff.cat.z3950.mark_overlay.accesskey;"/>
                     <spacer flex="1"/>
                     <button id="marc_view_btn" command="marc_view" disabled="true"/>
                     <checkbox id="marc_editor" label="&staff.cat.z3950.marc_editor.label;" accesskey="&staff.cat.z3950.marc_editor.accesskey;" oils_persist="checked" checked="true"/> 

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/web/opac/locale/en-US/lang.dtd            |    2 +
 .../xul/staff_client/chrome/content/cat/opac.js    |    2 +
 Open-ILS/xul/staff_client/server/cat/util.js       |  104 +++++++++++++++++++-
 Open-ILS/xul/staff_client/server/cat/z3950.js      |   41 ++++++++-
 Open-ILS/xul/staff_client/server/cat/z3950.xul     |    6 +
 5 files changed, 153 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list