05770d85a34c0adb40086d97f0dcec6d1fad4bc1
[Evergreen.git] / Evergreen / staff_client / chrome / content / evergreen / cat / spine_label_wizard.xul
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
3 <!-- This DTD declaration needs to be fixed for Mozilla locales -->
4 <!DOCTYPE wizard SYSTEM "chrome://evergreen/locale/cat.dtd">
5 <wizard id="spine_label" title="Spine Label Wizard"
6         orient="vertical" style="overflow: auto"
7         onload="spine_label_init()" width="800" height="600"
8         onwizardfinish=""
9         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
10
11         <!-- Overlays for this XUL file -->
12         <?xul-overlay href="chrome://evergreen/content/OpenSRF/OpenSRF_overlay.xul"?>
13         <?xul-overlay href="chrome://evergreen/content/util/util_overlay.xul"?>
14
15         <!-- OpenSRF -->
16         <script>var myPackageDir = "evergreen";</script>
17         <OpenSRF id="OpenSRF_js" />
18
19         <script>
20         <![CDATA[
21
22                 var cols = 20; var rows = 3; var divider = 0;
23
24                 function spine_label_init() {
25                         var spine_labels; try { spine_labels = params.spine_labels; } catch(E) { sdump('D_ERROR',js2JSON(E) + '\n'); }
26                         if (!spine_labels) spine_labels = [ [ 'A Call Number', '1' ] ];
27                         var rows = document.getElementById('page1_rows');
28                         for (var i = 0; i < spine_labels.length; i++) {
29                                 var sl = spine_labels[i];
30                                 var label = sl[0];
31                                 var count = sl[1];
32                                 var row = document.createElement('row'); rows.appendChild(row);
33                                 var btn = document.createElement('button'); row.appendChild(btn);
34                                         btn.setAttribute('label','Test Print');
35                                 var label_tb = document.createElement('textbox'); row.appendChild(label_tb);
36                                         label_tb.setAttribute('multiline','true');
37                                         label_tb.setAttribute('value',label);
38                                 var count_tb = document.createElement('textbox'); row.appendChild(count_tb);
39                                         count_tb.setAttribute('multiline','true');
40                                         count_tb.setAttribute('value',count);
41                                 btn.addEventListener('command',
42                                         function() {
43                                                 sPrint(label2html(label_tb.value), false);      
44                                         }, false
45                                 );
46                         }
47                 }
48
49                 function label2html(s) {
50                         var html = '';
51                         var a = s.split('\n');
52                         for (var i in a) {
53                                 if (i < rows) {
54                                         html += a[i].substr(0,cols) + print_crlf;
55                                 }
56                         }
57                         return html;
58                 }
59
60         ]]>
61         </script>
62
63
64         <wizardpage id="page1" description="Printing Spine Labels" onpageadvanced="">
65                 <grid>
66                         <columns> <column flex="0" /> <column flex="1" /> <column flex="0" /> </columns>
67                         <rows id="page1_rows">
68                                 <row><spacer/><label value="Label" /><label value="Print This Many"/></row>
69                         </rows>
70                 </grid>
71         </wizardpage>
72
73 </wizard>
74
75