]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/patron/adv_barcode_entry.xul
debugging
[Evergreen.git] / Open-ILS / xul / staff_client / server / patron / adv_barcode_entry.xul
1 <?xml version="1.0"?>
2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Retrieve Patron By Barcode -->
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 <?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
10
11 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
12 <!-- LOCALIZATION -->
13 <!DOCTYPE window PUBLIC "" ""[
14         <!--#include virtual="/opac/locale/en-US/lang.dtd"-->
15 ]>
16
17 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
18 <!-- OVERLAYS -->
19 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
20
21 <window id="patron_barcode_entry_win" 
22         onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
23         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
24
25         <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
26         <!-- BEHAVIOR -->
27         <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};</script>
28         <scripts id="openils_util_scripts"/>
29
30         <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
31         <script>
32         <![CDATA[
33                 function my_init() {
34                         try {
35                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
36                                 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
37                                 JSAN.errorLevel = "die"; // none, warn, or die
38                                 JSAN.addRepository('/xul/server/');
39                                 JSAN.use('util.error'); g.error = new util.error();
40                                 g.error.sdump('D_TRACE','my_init() for patron/barcode_entry.xul');
41
42                                 g.cgi = new CGI();
43
44                                 var tb = document.getElementById('barcode_tb');
45                                 tb.addEventListener(
46                                         'keypress',
47                                         function(ev) {
48                                                 if (ev.keyCode == 13 || ev.keyCode == 77) {
49                                                         setTimeout(
50                                                                 function() {
51                                                                         spawn();
52                                                                 }, 0
53                                                         );
54                                                 }
55                                         },
56                                         false
57                                 );
58                                 tb.focus();
59         
60                                 if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
61                                         try { window.xulG.set_tab_name('User Permission Editor'); } catch(E) { alert(E); }
62                                 }
63
64                         } catch(E) {
65                                 var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
66                                         "system administrator or software developer the following:\n" + E + '\n';
67                                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
68                                 alert(err_msg);
69                         }
70                 }
71
72                 function spawn() {
73                         var tb;
74                         try {
75                                 JSAN.use('util.sound'); var sound = new util.sound();
76                                 tb = document.getElementById('barcode_tb');
77                                 var barcode = tb.value;
78
79                                 if (!barcode) { sound.bad(); tb.select(); tb.focus(); return; }
80
81                                 JSAN.use('util.network'); var net = new util.network();
82
83                                 var robj = net.simple_request('PATRON_BARCODE_EXISTS',[ ses(), barcode ]);
84                                 if (typeof robj.ilsevent != 'undefined') throw(robj);
85
86                                 if (robj == 0) {
87                                         sound.bad(); tb.select(); tb.focus();
88                                         alert('Barcode not found.');
89                                         return;
90                                 }
91
92                                 sound.good();
93
94                                 var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape( 
95                                         urls.XUL_ADV_PATRON_EDIT
96                                         + '?ses=' + window.escape( ses() )
97                                         + '&adv=1'
98                                         + '&barcode=' + window.escape( barcode )
99                                 );
100
101                                 if (typeof window.xulG == 'object' && typeof window.xulG.set_tab == 'function') {
102
103                                         window.xulG.set_tab( loc, {}, { 'show_print_button' : true, } );
104
105                                 } else {
106
107                                         location.href = loc;
108                                 }
109
110                         } catch(E) {
111                                         tb.select(); tb.focus();
112                                 g.error.standard_unexpected_error_alert('adv_barcode_entry.xul',E);
113                         }
114                 }
115
116         ]]>
117         </script>
118
119         <vbox flex="1" class="my_overflow">
120                 <groupbox orient="vertical" flex="1">
121                         <caption label="Retrieve User" />
122                         <hbox>
123                                 <label value="Barcode:" accesskey="B" control="barcode_tb"/>
124                                 <textbox id="barcode_tb" />
125                                 <button label="Submit" accesskey="S" oncommand="spawn();"/>
126                         </hbox>
127                         <hbox>
128                                 <label id="status"/>
129                         </hbox>
130                 </groupbox>
131         </vbox>
132
133 </window>
134