bug #11, more entry points for marc editor and copy browser
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 5 Aug 2005 17:34:05 +0000 (17:34 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 5 Aug 2005 17:34:05 +0000 (17:34 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1619 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/cat/copy_edit.js
Evergreen/staff_client/chrome/content/evergreen/cat/copy_edit_overlay.xul
Evergreen/staff_client/chrome/content/evergreen/opac/opac.js
Evergreen/staff_client/chrome/content/evergreen/util/spawn_win.js

index af9bdb1..3c5b278 100644 (file)
@@ -103,3 +103,17 @@ function refresh_spawning_browse_list() {
                mw.sdump('D_CAT','refresh_spawning_browse_list error: ' + js2JSON(E) + '\n');
        }
 }
+
+function spawn_marc_from_copy_editor() {
+       try {
+               var record_id = user_request(
+                       'open-ils.search',
+                       'open-ils.search.biblio.find_by_barcode',
+                       [ cn_list[0].copies()[0].barcode() ]
+               )[0].ids[0];
+               marc_view(app_shell,record_id);
+       } catch(E) {
+               handle_error(E);
+       }
+}
+
index 8e9d987..8d83c1d 100644 (file)
        <command id="cmd_edit_save" oncommand="
                save_edited_copies();
        "/>
+       <command id="cmd_edit_close" oncommand="
+               mw.close_tab(app_shell,'main_tabbox');
+       "/>
+       <command id="cmd_view_marc" oncommand="
+               spawn_marc_from_copy_editor();
+       "/>
        <command id="cmd_refresh_parent" oncommand="
                refresh_spawning_browse_list();
        "/>
@@ -27,6 +33,8 @@
 <vbox id="copy_edit_vbox" flex="1">
        <iframe id="copy_edit_frame" flex="1"/>
        <hbox id="copy_edit_hbox" flex="0">
+               <button id="copy_edit_close" label="Close Editor" command="cmd_edit_close"/>
+               <button id="copy_edit_marc" label="View MARC" command="cmd_view_marc"/>
                <spacer id="copy_edit_spacer" flex="1"/>
                <button id="copy_edit_save" label="Save Changes" command="cmd_edit_save"/>
        </hbox>
index f7c0803..fccd68c 100644 (file)
@@ -117,50 +117,7 @@ p.buildViewMARCWindow = function(record) {
 
    debug("Setting up view marc with record " + record.doc_id());
 
-   var func = function() {
-
-      var req = new RemoteRequest(
-            "open-ils.search",
-            "open-ils.search.biblio.record.html",
-            record.doc_id());
-
-      req.send(true);
-
-       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
-       );
-   }
-
+   var func = function() { marc_view(p.w.app_shell,record.doc_id()); }
    return func;
 }
 
index 23a8062..a98cf7b 100644 (file)
@@ -197,6 +197,49 @@ function spawn_new_marc_creation(d,placement,place,passthru_params,clone) {
        }
 }
 
+function marc_view(app_shell,record_id) {
+       try {
+               var html = user_request(
+                       "open-ils.search",
+                       "open-ils.search.biblio.record.html",
+                       [ record_id ]
+               )[0];
+               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' );
+               var id = record_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( 
+                                                       app_shell, 'new_tab', 'main_tabbox', { 
+                                                               'find_this_id' : record_id 
+                                                       } 
+                                               ).find_this_id = record_id;
+                                       },
+                                       false
+                               );
+                               win.document.getElementById('copy_btn').addEventListener(
+                                       'click',
+                                       function(ev) {
+                                               spawn_copy_browser( 
+                                                       app_shell, 'new_tab', 'main_tabbox', { 
+                                                               'find_this_id' : record_id 
+                                                       } 
+                                               ).find_this_id = record_id;
+                                       },
+                                       false
+                               );
+                       }, 0
+               );
+       } catch(E) {
+               handle_error(E);
+       }
+}
+
 function spawn_patron_edit(d,placement,place,passthru_params,clone) {
        var chrome = 'chrome://evergreen/content/patron/patron_edit.xul';
        return spawn_interface(d,placement,place,chrome,getString('patron_editor_interface_label'),passthru_params,clone);