]> git.evergreen-ils.org Git - Evergreen.git/blob - Evergreen/staff_client/chrome/content/evergreen/patron/patron_barcode_entry.xul
more ripping of legacy code. seems to work :)
[Evergreen.git] / Evergreen / staff_client / chrome / content / evergreen / patron / patron_barcode_entry.xul
1 <?xml version="1.0"?>
2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: About -->
4
5 <!-- Stylesheets -->
6 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
7 <?xml-stylesheet href="chrome://evergreen/skin/evergreen.css" type="text/css"?>
8
9 <window id="patron_barcode_entry_win" 
10         onload="try { my_init(); } catch(E) { alert(E); }"
11         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
12
13         <script>mw.sdump('D_TRACE','Loading patron_barcode_entry.xul\n');</script>
14
15         <script>
16         <![CDATA[
17
18                 function my_init() {
19                         var tb = document.getElementById('barcode_tb');
20                         tb.addEventListener(
21                                 'keypress',
22                                 function(ev) {
23                                         if (ev.keyCode == 13 || ev.keyCode == 77) {
24                                                 spawn();
25                                         }
26                                 },
27                                 false
28                         );
29                         tb.focus();
30                 }
31
32                 function spawn() {
33                         var tb = document.getElementById('barcode_tb');
34                         var barcode = tb.value;
35                         var patron = mw.retrieve_patron_by_barcode( barcode );
36                         if (mw.instanceOf(patron,mw.au)) {
37                                 mw.spawn_patron_display(
38                                         parent.document, 
39                                         'replace_tab', 'main_tabbox', { 'patron' : patron }
40                                 );
41                         } else {
42                                 mw.snd_bad();
43                                 var label = document.getElementById('status');
44                                 label.value = 'Patron not found.';
45                                 tb.select(); tb.focus();
46                         }
47                 }
48
49         ]]>
50         </script>
51
52         <vbox flex="1" class="my_overflow">
53                 <groupbox orient="vertical" flex="1">
54                         <caption label="Enter Patron Barcode" />
55                         <hbox>
56                                 <label value="Patron Barcode:" accesskey="B" control="barcode_tb"/>
57                                 <textbox id="barcode_tb" />
58                                 <button label="Submit" accesskey="S" oncommand="spawn();"/>
59                         </hbox>
60                         <hbox>
61                                 <label id="status"/>
62                         </hbox>
63                 </groupbox>
64         </vbox>
65
66 </window>
67