]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/chrome/content/cat/opac.xul
move toward new marc editor
[Evergreen.git] / Open-ILS / xul / staff_client / chrome / content / cat / opac.xul
1 <?xml version="1.0"?>
2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Cataloger's Search Result Screen -->
4
5 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
6 <!-- STYLESHEETS -->
7 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
8 <?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
9
10 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
11 <!-- LOCALIZATION -->
12 <!DOCTYPE window SYSTEM "chrome://open_ils_staff_client/locale/lang.dtd">
13
14 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
15 <!-- OVERLAYS -->
16 <?xul-overlay href="chrome://open_ils_staff_client/content/OpenILS/util_overlay.xul"?>
17
18 <window id="opac_win"
19         onload="try { my_init(); } catch(E) { alert(E); }"
20         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
21
22         <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
23         <!-- BEHAVIOR -->
24         <script type="text/javascript">
25                 var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};
26                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
27         </script>
28         <scripts id="openils_util_scripts"/>
29
30         <script type="text/javascript" src="chrome://open_ils_staff_client/content/main/JSAN.js"/>
31         <script>
32         <![CDATA[
33
34                 var session; var authtime; var docid; var marc_html; var top_pane; var bottom_pane; var opac_frame;
35
36                 function my_init() {
37                         try {
38                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
39                                 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
40                                 JSAN.errorLevel = "die"; // none, warn, or die
41                                 JSAN.addRepository('..');
42                                 JSAN.use('util.error'); g.error = new util.error();
43                                 g.error.sdump('D_TRACE','my_init() for cat/opac.xul');
44
45                                 JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
46                                 XML_HTTP_SERVER = data.server_unadorned;
47
48                                 JSAN.use('util.network'); g.network = new util.network();
49
50                                 g.cgi = new CGI();
51                                 try { session = g.cgi.param('session') || xulG.session; } catch(E) { g.error.sdump('D_ERROR',E); }
52                                 try { authtime = g.cgi.param('authtime') || xulG.authtime; } catch(E) { g.error.sdump('D_ERROR',E); }
53                                 try { docid = g.cgi.param('docid') || xulG.docid; } catch(E) { g.error.sdump('D_ERROR',E); }
54                                 try { opac_url = g.cgi.param('opac_url') || xulG.opac_url; } catch(E) { g.error.sdump('D_ERROR',E); }
55
56                                 JSAN.use('util.deck');
57                                 top_pane = new util.deck('top_pane');
58                                 bottom_pane = new util.deck('bottom_pane');
59
60                                 set_opac();
61
62                         } catch(E) {
63                                 var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
64                                         "system administrator or software developer the following:\ncat/opac.xul\n" + E + '\n';
65                                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
66                                 alert(err_msg);
67                         }
68                 }
69
70                 function set_brief_view() {
71                         var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid); 
72                         dump('spawning ' + url + '\n');
73                         top_pane.set_iframe( 
74                                 url,
75                                 {}, 
76                                 { 
77                                         'set_tab_name' : function(n) { 
78                                                 if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
79                                                         try { window.xulG.set_tab_name('Bib Record: ' + n); } catch(E) { alert(E); }
80                                                 } else {
81                                                         dump('no set_tab_name\n');
82                                                 }
83                                         }
84                                 }  
85                         );
86                 }
87
88                 function set_marc_view() {
89                         bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_MARC_VIEW ) + '?docid=' + window.escape(docid),{},xulG);
90                 }
91
92                 function set_marc_edit() {
93                         bottom_pane.set_iframe( 
94                                 xulG.url_prefix( urls.XUL_MARC_EDIT ),
95                                 {},
96                                 {
97                                         'record' : { 'url' : '/opac/extras/supercat/retrieve/marcxml/record/' + docid },
98                                         'save' : {
99                                                 'label' : 'Save Record',
100                                                 'func' : function (new_marcxml) {
101                                                         alert('We got MARC!  Put network call to save here.');
102                                                 }
103                                         }
104                                 }
105                         );
106                 }
107
108                 function set_copy_browser() {
109                         bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ) + '?session=' + window.escape(session) 
110                                 + '&docid=' + window.escape(docid),{},xulG);
111                 }
112
113                 function set_opac() {
114                         try {
115                                 dump('set_opac: session = ' + session + ' authtime = ' + authtime + '\n');
116                                 var content_params = { 
117                                         'show_nav_buttons' : true,
118                                         'show_print_button' : true,
119                                         'passthru_content_params' : { 'authtoken' : session, 'authtime' : authtime },
120                                         'on_url_load' : function(f) {
121                                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
122                                                 var win;
123                                                 try {
124                                                         if (typeof f.contentWindow.wrappedJSObject.attachEvt != 'undefined') {
125                                                                 win = f.contentWindow.wrappedJSObject;
126                                                         } else {
127                                                                 win = f.contentWindow;
128                                                         }
129                                                 } catch(E) {
130                                                         win = f.contentWindow;
131                                                 }
132                                                 win.attachEvt("rdetail", "recordRetrieved",
133                                                         function(id){
134                                                                 try {
135                                                                         var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid) 
136                                                                         dump('removing ' + url + '\n');
137                                                                         try { top_pane.remove_iframe( url ); } catch(E) { dump(E + '\n'); }
138                                                                         docid = id;
139                                                                         set_brief_view();
140                                                                         document.getElementById('nav').setAttribute('hidden','false');
141                                                                 } catch(E) {
142                                                                         alert(E);
143                                                                 }
144                                                         }
145                                                 );
146                                         },
147                                         'url_prefix' : xulG.url_prefix,
148                                 };
149                                 if (opac_url) content_params.url = opac_url;
150                                 browser_frame = bottom_pane.set_iframe( xulG.url_prefix(urls.XUL_BROWSER) + '?name=Catalog', {}, content_params);
151                         } catch(E) {
152                                 g.error.sdump('D_ERROR','set_opac: ' + E);
153                         }
154                 }
155
156                 function bib_in_new_tab() {
157                         try {
158                                 var url = browser_frame.contentWindow.g.browser.controller.view.browser_browser.contentWindow.wrappedJSObject.location.href;
159                                 var content_params = { 'session' : session, 'authtime' : authtime, 'opac_url' : url };
160                                 xulG.new_tab(xulG.url_prefix(urls.XUL_OPAC_WRAPPER), {}, content_params);
161                         } catch(E) {
162                                 g.error.sdump('D_ERROR',E);
163                         }
164                 }
165
166                 function remove_me() {
167                         var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid);
168                         dump('removing ' + url + '\n');
169                         try { top_pane.remove_iframe( url ); } catch(E) { dump(E + '\n'); }
170                         document.getElementById('nav').setAttribute('hidden','true');
171                 }
172
173         ]]>
174         </script>
175
176         <vbox flex="1">
177                 <deck id="top_pane"/>
178                 <hbox id="nav" hidden="true">
179                         <button label="OPAC View" id="opac_view" oncommand="set_opac();"/>
180                         <button label="MARC View" id="marc_view" oncommand="set_marc_view();"/>
181                         <button label="MARC Edit" id="marc_edit" oncommand="set_marc_edit();"/>
182                         <button label="Copy Browser" id="copy_browse" oncommand="set_copy_browser();"/>
183                         <button label="Open in New Tab" id="bib_in_new_tab" oncommand="bib_in_new_tab();"/>
184                         <button label="Remove this Frame" id="remove_me" oncommand="remove_me();"/>
185                 </hbox>
186                 <deck id="bottom_pane" flex="1"/>
187         </vbox>
188
189 </window>
190