]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/patron/adv_barcode_entry.xul
User Permission Editor
[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="my_init()"
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                                 var session = g.cgi.param('session');
44                                 if (!session) { 
45                                         g.error.sdump('D_ERROR','session = ' + session + '\n'
46                                                 + 'g.cgi._keys = ' + g.cgi._keys + '\n'
47                                                 + 'g.cgi.param("session") = ' + g.cgi.param('session') + '\n'
48                                                 + 'location = ' + location + '\n'
49                                                 + 'location.href = ' + location.href + '\n'
50                                         );
51                                         alert('pause.  session is ' + session ); 
52                                 }
53
54                                 var tb = document.getElementById('barcode_tb');
55                                 tb.addEventListener(
56                                         'keypress',
57                                         function(ev) {
58                                                 if (ev.keyCode == 13 || ev.keyCode == 77) {
59                                                         setTimeout(
60                                                                 function() {
61                                                                         spawn();
62                                                                 }, 0
63                                                         );
64                                                 }
65                                         },
66                                         false
67                                 );
68                                 tb.focus();
69         
70                                 if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
71                                         try { window.xulG.set_tab_name('User Permission Editor'); } catch(E) { alert(E); }
72                                 }
73
74                         } catch(E) {
75                                 var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
76                                         "system administrator or software developer the following:\n" + E + '\n';
77                                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
78                                 alert(err_msg);
79                         }
80                 }
81
82                 function spawn() {
83                         try {
84                                 JSAN.use('util.sound'); var sound = new util.sound(); sound.good();
85                                 var tb = document.getElementById('barcode_tb');
86                                 var barcode = tb.value;
87
88                                 var loc = urls.XUL_REMOTE_BROWSER + '?url=' + window.escape( 
89                                         urls.XUL_ADV_PATRON_EDIT
90                                         + '?ses=' + window.escape( g.cgi.param('session') )
91                                         + '&adv=1'
92                                         + '&barcode=' + window.escape( barcode )
93                                 );
94
95                                 if (typeof window.xulG == 'object' && typeof window.xulG.set_tab == 'function') {
96
97                                         window.xulG.set_tab( loc, {}, { 'show_print_button' : true, } );
98
99                                 } else {
100
101                                         location.href = loc;
102                                 }
103
104                         } catch(E) {
105                                 var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
106                                         "system administrator or software developer the following:\n" + E + '\n';
107                                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
108                                 alert(err_msg);
109                         }
110                 }
111
112         ]]>
113         </script>
114
115         <vbox flex="1" class="my_overflow">
116                 <groupbox orient="vertical" flex="1">
117                         <caption label="Retrieve User" />
118                         <hbox>
119                                 <label value="Barcode:" accesskey="B" control="barcode_tb"/>
120                                 <textbox id="barcode_tb" />
121                                 <button label="Submit" accesskey="S" oncommand="spawn();"/>
122                         </hbox>
123                         <hbox>
124                                 <label id="status"/>
125                         </hbox>
126                 </groupbox>
127         </vbox>
128
129 </window>
130