]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/chrome/content/cat/opac.xul
we changed RemoteRequest.. local chrome needs XML_HTTP_SERVER set, always
[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( xulG.url_prefix( urls.XUL_MARC_EDIT ) + '?session=' + window.escape(session) 
94                                 + '&docid=' + window.escape(docid),{},xulG);
95                 }
96
97                 function set_copy_browser() {
98                         bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ) + '?session=' + window.escape(session) 
99                                 + '&docid=' + window.escape(docid),{},xulG);
100                 }
101
102                 function set_opac() {
103                         try {
104                                 dump('set_opac: session = ' + session + ' authtime = ' + authtime + '\n');
105                                 var content_params = { 
106                                         'show_nav_buttons' : true,
107                                         'show_print_button' : true,
108                                         'passthru_content_params' : { 'authtoken' : session, 'authtime' : authtime },
109                                         'on_url_load' : function(f) {
110                                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
111                                                 var win;
112                                                 try {
113                                                         if (typeof f.contentWindow.wrappedJSObject.attachEvt != 'undefined') {
114                                                                 win = f.contentWindow.wrappedJSObject;
115                                                         } else {
116                                                                 win = f.contentWindow;
117                                                         }
118                                                 } catch(E) {
119                                                         win = f.contentWindow;
120                                                 }
121                                                 win.attachEvt("rdetail", "recordRetrieved",
122                                                         function(id){
123                                                                 try {
124                                                                         var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid) 
125                                                                         dump('removing ' + url + '\n');
126                                                                         try { top_pane.remove_iframe( url ); } catch(E) { dump(E + '\n'); }
127                                                                         docid = id;
128                                                                         set_brief_view();
129                                                                         document.getElementById('nav').setAttribute('hidden','false');
130                                                                 } catch(E) {
131                                                                         alert(E);
132                                                                 }
133                                                         }
134                                                 );
135                                         },
136                                         'url_prefix' : xulG.url_prefix,
137                                 };
138                                 if (opac_url) content_params.url = opac_url;
139                                 browser_frame = bottom_pane.set_iframe( xulG.url_prefix(urls.XUL_BROWSER) + '?name=Catalog', {}, content_params);
140                         } catch(E) {
141                                 g.error.sdump('D_ERROR','set_opac: ' + E);
142                         }
143                 }
144
145                 function bib_in_new_tab() {
146                         try {
147                                 var url = browser_frame.contentWindow.g.browser.controller.view.browser_browser.contentWindow.wrappedJSObject.location.href;
148                                 var content_params = { 'session' : session, 'authtime' : authtime, 'opac_url' : url };
149                                 xulG.new_tab(xulG.url_prefix(urls.XUL_OPAC_WRAPPER), {}, content_params);
150                         } catch(E) {
151                                 g.error.sdump('D_ERROR',E);
152                         }
153                 }
154
155                 function remove_me() {
156                         var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid);
157                         dump('removing ' + url + '\n');
158                         try { top_pane.remove_iframe( url ); } catch(E) { dump(E + '\n'); }
159                         document.getElementById('nav').setAttribute('hidden','true');
160                 }
161
162         ]]>
163         </script>
164
165         <vbox flex="1">
166                 <deck id="top_pane"/>
167                 <hbox id="nav" hidden="true">
168                         <button label="OPAC View" id="opac_view" oncommand="set_opac();"/>
169                         <button label="MARC View" id="marc_view" oncommand="set_marc_view();"/>
170                         <button label="MARC Edit" id="marc_edit" oncommand="set_marc_edit();"/>
171                         <button label="Copy Browser" id="copy_browse" oncommand="set_copy_browser();"/>
172                         <button label="Open in New Tab" id="bib_in_new_tab" oncommand="bib_in_new_tab();"/>
173                         <button label="Remove this Frame" id="remove_me" oncommand="remove_me();"/>
174                 </hbox>
175                 <deck id="bottom_pane" flex="1"/>
176         </vbox>
177
178 </window>
179