]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xul/staff_client/server/circ/circ_brief.xul
Replace deprecated javascript escape() with encodeURIComponent()
[working/Evergreen.git] / Open-ILS / xul / staff_client / server / circ / circ_brief.xul
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Brief Bib 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
11 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
12 <!-- LOCALIZATION -->
13 <!DOCTYPE window PUBLIC "" ""[
14     <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
15 ]>
16
17 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
18 <!-- OVERLAYS -->
19 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
20
21 <window id="circ_circ_brief_win" 
22     onload="try { my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
23     xmlns:html="http://www.w3.org/1999/xhtml"
24     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
25
26     <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
27     <!-- BEHAVIOR -->
28         <script type="text/javascript">
29         var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};
30     </script>
31         <scripts id="openils_util_scripts"/>
32
33     <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
34     <script>
35     <![CDATA[
36         function my_init() {
37             try {
38                 if (typeof JSAN == 'undefined') { throw( document.getElementById("commonStrings").getString('common.jsan.missing') ); }
39                 JSAN.errorLevel = "die"; // none, warn, or die
40                 JSAN.addRepository('/xul/server/');
41                 JSAN.use('util.error'); g.error = new util.error();
42                 g.error.sdump('D_TRACE','my_init() for circ_circ_brief.xul');
43
44                 g.circ_id = xul_param('circ_id');
45
46                 var caption = xul_param('caption'); if (caption) $('caption').setAttribute('label',caption);
47                 if (xul_param('no_border')) $('gb').setAttribute('style','border: none');
48
49                 JSAN.use('util.network'); g.network = new util.network();
50                 JSAN.use('util.date');
51                 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
52
53                 function circ_callback(req) {
54                     try {
55                         var r_circ = req.getResultObject();
56                         $('circ_lib').value = r_circ.circ_lib() ? g.data.hash.aou[ r_circ.circ_lib() ].shortname() : '';
57                         $('xact_start').value = r_circ.xact_start() ? util.date.formatted_date( r_circ.xact_start(), '%{localized}' ) : '';
58                         $('due_date').value = r_circ.due_date() ? util.date.formatted_date( r_circ.due_date(), '%{localized}' ) : '';
59                         $('circ_lib').setAttribute('tooltiptext', document.getElementById('circStrings').getFormattedString('staff.circ.circ_brief.staff_out_id', [r_circ.circ_staff()]) );
60                         $('checkin_lib').value = r_circ.checkin_lib() ? g.data.hash.aou[ r_circ.checkin_lib() ].shortname() : '';
61                         $('checkin_time').value = r_circ.checkin_time() ? util.date.formatted_date( r_circ.checkin_time(), '%{localized}' ) : '';
62                         $('checkin_lib').setAttribute('tooltiptext', document.getElementById('circStrings').getFormattedString('staff.circ.circ_brief.staff_in_id', [r_circ.checkin_staff()]) );
63                         $('id').value = r_circ.id() ? r_circ.id() : '';
64                         $('stop_fines').value = r_circ.stop_fines() ? r_circ.stop_fines() : '';
65                         $('stop_fines_time').value = r_circ.stop_fines_time() ? util.date.formatted_date( r_circ.stop_fines_time(), '%{localized}' ) : '';
66                         var r = '';
67                         if (get_bool( r_circ.desk_renewal() ) ) r += 'DESK ';
68                         if (get_bool(r_circ.opac_renewal() ) ) r += 'OPAC ';
69                         if (get_bool(r_circ.phone_renewal() ) ) r += 'PHONE ';
70                         $('renewal').value = r || document.getElementById('circStrings').getString('staff.circ.checkout.no.btn');
71                         g.patron_id = r_circ.usr(); $('add_billing').disabled = false;
72                         g.network.simple_request('FM_AU_FLESHED_RETRIEVE_VIA_ID',[ ses(), r_circ.usr() ], function(preq) {
73                             var r_au = preq.getResultObject();
74                             JSAN.use('patron.util'); 
75                             $('patron_name').value = patron.util.format_name( r_au ) + ' : ' + r_au.card().barcode();
76                             patron.util.set_penalty_css(r_au);
77                         });
78
79                     } catch(E) {
80                         g.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.circ_brief.failure'), E);
81                     }
82                 }
83
84                 if (g.circ_id) {
85                     g.network.simple_request( 'FM_CIRC_RETRIEVE_VIA_ID', [ ses(), g.circ_id ], circ_callback);
86                 } else {
87                     g.circ = g.data.temp_circ; g.data.temp_circ = null; g.data.stash('temp_circ');
88                     g.circ_id = g.data.temp_circ_id; g.data.temp_circ_id = null; g.data.stash('temp_circ_id');
89                     if (!g.circ_id) g.circ_id = g.circ.id();
90                     if (g.circ) {
91                         circ_callback( { 'getResultObject' : function() { return g.circ; } } );
92                     } else {
93                         g.network.simple_request( 'FM_CIRC_RETRIEVE_VIA_ID', [ ses(), g.circ_id ], circ_callback);
94                     }
95                 }
96
97             } catch(E) {
98                 var err_msg = document.getElementById("commonStrings").getFormattedString('common.exception', ['circ/circ_brief.xul', E]);
99                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
100                 alert(err_msg);
101             }
102         }
103
104         function $(id) { return document.getElementById(id); }
105
106         g.add_billing = function() {
107             JSAN.use('util.window');
108             var win = new util.window();
109             var w = win.open(
110                 urls.XUL_PATRON_BILL_WIZARD,
111                 'billwizard',
112                 'chrome,resizable,modal',
113                 { 'patron_id' : g.patron_id, 'xact_id' : g.circ_id }
114             );
115         }
116
117     ]]>
118     </script>
119
120     <messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale'-->/circ.properties" />
121
122     <groupbox id="gb" flex="1" style="overflow: auto;">
123         <caption id="caption"/>
124         <hbox>
125             <label id="patron_name" class="patronNameLarge" flex="1"/>
126             <label value="&staff.circ.circ_brief.patron_id.label;"/><label id="id"/>
127             <button id="add_billing" disabled="true" label="&staff.circ.circ_brief.add_billing.label;" oncommand="g.add_billing();"/>
128         </hbox>
129         <grid flex="1">
130             <columns>
131                 <column/>
132                 <column flex="1"/>
133                 <column/>
134                 <column flex="1"/>
135                 <column/>
136                 <column flex="1"/>
137                 <column/>
138                 <column flex="1"/>
139             </columns>
140             <rows>
141                 <row>
142                     <label style="font-weight: bold" value="&staff.circ.circ_brief.xact_start.label;"/><label id="xact_start"/>
143                     <label style="font-weight: bold" value="&staff.circ.circ_brief.due_date.label;"/><label id="due_date"/>
144                     <label style="font-weight: bold" value="&staff.circ.circ_brief.stop_fines_time.label;"/><label id="stop_fines_time"/>
145                     <label style="font-weight: bold" value="&staff.circ.circ_brief.checkin_time.label;"/><label id="checkin_time"/>
146                 </row>
147                 <row>
148                     <label style="font-weight: bold" value="&staff.circ.circ_brief.circ_lib.label;"/><label id="circ_lib"/>
149                     <label style="font-weight: bold" value="&staff.circ.circ_brief.renewal.label;"/><label id="renewal"/>
150                     <label style="font-weight: bold" value="&staff.circ.circ_brief.stop_fines.label;"/><label id="stop_fines"/>
151                     <label style="font-weight: bold" value="&staff.circ.circ_brief.checkin_lib.label;"/><label id="checkin_lib"/>
152                 </row>
153             </rows>
154         </grid>
155     </groupbox>
156
157 </window>
158