]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xul/staff_client/server/patron/summary.xul
Except in certain cases (like chrome://global/skin/), we can no longer reference...
[working/Evergreen.git] / Open-ILS / xul / staff_client / server / patron / summary.xul
1 <?xml version="1.0"?>
2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Patron Display -->
4
5 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
6 <!-- STYLESHEETS -->
7 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
8 <?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
9 <?xml-stylesheet href="/xul/server/skin/patron_display.css" type="text/css"?>
10 <?xml-stylesheet href="/xul/server/skin/patron_summary.css" type="text/css"?>
11
12 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
13 <!-- LOCALIZATION -->
14 <!DOCTYPE window PUBLIC "" ""[
15         <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
16 ]>
17
18 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
19 <!-- OVERLAYS -->
20 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
21
22 <window id="patron_summary_win" 
23         onload="try { my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }" onunload="try { observer.unregister(); } catch(E) { alert(E); }"
24         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
25
26         <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
27         <!-- BEHAVIOR -->
28         <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};</script>
29         <scripts id="openils_util_scripts"/>
30
31         <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
32         <script>
33         <![CDATA[
34                 function $(id) { return document.getElementById(id); }
35                 
36                 var observer;
37                 function myObserver() { this.register(); }
38                 myObserver.prototype = {
39                         register: function() {
40                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
41                                 var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
42                                 observerService.addObserver(this, "xul-overlay-merged", false);
43                         },
44                         unregister: function() {
45                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
46                                 var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
47                                 observerService.removeObserver(this, "xul-overlay-merged");
48                         },
49                         observe: function(subject,topic,data) {
50                                 dump('observe: <'+subject+','+topic+','+data+'>\n');
51                                 // setTimeout is needed here for xulrunner 1.8
52                                 setTimeout( function() { try { post_overlay(); } catch(E) { alert(E); } }, 0 );
53                         }
54                 }
55                                 
56                 function my_init() {
57                         try {
58                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
59                                 if (typeof JSAN == 'undefined') { throw( $("commonStrings").getString('common.jsan.missing') ); }
60                                 JSAN.errorLevel = "die"; // none, warn, or die
61                                 JSAN.addRepository('/xul/server/');
62                                 JSAN.use('util.error'); g.error = new util.error();
63                                 g.error.sdump('D_TRACE','my_init() for patron_summary.xul');
64                                 
65                                 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
66                                 
67                                 var horizontal_interface = String( g.data.hash.aous['ui.circ.patron_summary.horizontal'] ) == 'true';
68                                 var url = horizontal_interface ? '/xul/server/patron/summary_overlay_horiz.xul' : '/xul/server/patron/summary_overlay.xul';
69                                 
70                                 observer = new myObserver();
71                                 document.loadOverlay(location.protocol + '//' + location.hostname + url,observer)
72                         } catch(E) {
73                                 var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/summary.xul:my_init()', E]);
74                                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
75                                 alert(err_msg);
76                         }
77                 }
78
79         function copy_mailing_address() {
80             var a = g.summary.patron.mailing_address();
81             if (!a) return;
82             copy_to_clipboard(
83                 (a.street1() ? a.street1() : "") + "\t" + 
84                 (a.street2() ? a.street2() : "") + "\t" +  
85                 (a.county() ? a.county() : "") + "\t" + 
86                 (a.city() ? a.city() : "") + "\t" +  
87                 (a.post_code() ? a.post_code() : "") + "\t" + 
88                 (a.country() ? a.country() : "")
89             );
90         }
91         
92         function copy_billing_address() {
93             var a = g.summary.patron.billing_address();
94             if (!a) return;
95             copy_to_clipboard(
96                 (a.street1() ? a.street1() : "") + "\t" + 
97                 (a.street2() ? a.street2() : "") + "\t" +  
98                 (a.county() ? a.county() : "") + "\t" + 
99                 (a.city() ? a.city() : "") + "\t" +  
100                 (a.post_code() ? a.post_code() : "") + "\t" + 
101                 (a.country() ? a.country() : "")
102             );
103         }
104         
105                 function post_overlay() {
106                         try {
107                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
108
109                                 var patron_id = xul_param('id'); 
110                                 var patron_bc = xul_param('barcode'); 
111
112                                 JSAN.use('patron.summary'); g.summary = new patron.summary();
113                                 g.summary.init( { 
114                                         'barcode' : patron_bc,
115                                         'id' : patron_id,
116                                         'show_name' : xul_param('show_name'),
117                                 } );
118
119                                 window.refresh = function () { g.summary.retrieve(); }
120                                 font_helper();
121                         } catch(E) {
122                                 var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/summary.xul:post_overlay()', E]);
123                                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
124                                 alert(err_msg);
125                         }
126                 }
127         ]]>
128         </script>
129         
130         <messagecatalog id="patronStrings" src="/xul/server/locale/<!--#echo var='locale'-->/patron.properties"/>
131
132         <commandset id="patron_summary_cmds">
133         </commandset>
134
135         <box id="patron_summary_main" />
136
137 </window>
138