Copy Browser and MARC Editor buttons on staff client embedded OPAC MARC View window
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 27 Jul 2005 01:11:19 +0000 (01:11 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 27 Jul 2005 01:11:19 +0000 (01:11 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1531 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/opac/opac.js

index 2229cda..f7c0803 100644 (file)
@@ -108,13 +108,12 @@ function opac_build_callbacks(p) {
        }
 
        p.xulEvtViewMARC = function( node, record ) {
-               node.onclick = buildViewMARCWindow(record);
+               node.onclick = p.buildViewMARCWindow(record);
        }
 
-}
 
 
-function buildViewMARCWindow(record) {
+p.buildViewMARCWindow = function(record) {
 
    debug("Setting up view marc with record " + record.doc_id());
 
@@ -127,16 +126,43 @@ function buildViewMARCWindow(record) {
 
       req.send(true);
 
-      var html = req.getResultObject();
-      var id = record.doc_id();
-               var win = new_window("data:text/html," + html);
-      win.document.title = "View MARC";
-      win.focus();
-
+       var html = req.getResultObject();
+       html = html.replace( /<table/, '<div id="this_div"><input id="copy_btn" type="submit" value="Copy Browser" /><input id="marc_btn" type="submit" value="MARC Editor" /></div><table' );
+       dump( pretty_print( html ) );
+       var id = record.doc_id();
+       var win = new_window("data:text/html," + html);
+       setTimeout(
+               function() {
+                       win.document.title = "View MARC";
+                       win.focus();
+                       win.document.getElementById('marc_btn').addEventListener(
+                               'click',
+                               function(ev) {
+                                       spawn_marc_editor( 
+                                               p.w.app_shell, 'new_tab', 'main_tabbox', { 
+                                                       'find_this_id' : record.doc_id() 
+                                               } 
+                                       ).find_this_id = record.doc_id();
+                               },
+                               false
+                       );
+                       win.document.getElementById('copy_btn').addEventListener(
+                               'click',
+                               function(ev) {
+                                       spawn_copy_browser( 
+                                               p.w.app_shell, 'new_tab', 'main_tabbox', { 
+                                                       'find_this_id' : record.doc_id() 
+                                               } 
+                                       ).find_this_id = record.doc_id();
+                               },
+                               false
+                       );
+               }, 0
+       );
    }
 
    return func;
 }
 
 
-
+}