]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/chrome/content/util/list_clipboard.xul
font resizer
[Evergreen.git] / Open-ILS / xul / staff_client / chrome / content / util / list_clipboard.xul
1 <?xml version="1.0"?>
2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Example Template for remote xul -->
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="util_list_clipboard_win" 
22         onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
23         width="300" height="300" persist="width height"
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
37                 function $(id) { return document.getElementById(id); }
38                 function $c(n) { return document.createElement(n); }
39
40                 function my_init() {
41                         try {
42                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
43                                 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
44                                 JSAN.errorLevel = "die"; // none, warn, or die
45                                 JSAN.addRepository('/xul/server/');
46                                 JSAN.use('util.error'); g.error = new util.error();
47                                 g.error.sdump('D_TRACE','my_init() for util_list_clipboard.xul');
48
49                                 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
50                                 if (! g.data.list_clipboard ) {
51                                         window.close();
52                                 } else {
53                                         for (var i = 0; i < g.data.list_clipboard.length; i++) {
54                                                 var data_row = g.data.list_clipboard[i];
55                                                 make_grid(data_row);
56                                         }
57                                 }
58
59                         } catch(E) {
60                                 try { g.error.standard_unexpected_error_alert('util/list_clipboard.xul',E); } catch(F) { alert(E); }
61                         }
62                 }
63
64                 function make_grid(data_row) {
65                         try {
66                                 var vbox = $c('vbox'); vbox.setAttribute('flex','1'); $('area').appendChild(vbox);
67                                 var grid = $c('grid'); grid.setAttribute('flex','1'); grid.setAttribute('style','border: solid black');  vbox.appendChild(grid);
68                                 var columns = $c('columns'); grid.appendChild(columns);
69                                 var c1 = $c('column'); c1.setAttribute('flex','1'); columns.appendChild(c1);
70                                 var c2 = $c('column'); c2.setAttribute('flex','1'); columns.appendChild(c2);
71                                 var rows = $c('rows'); grid.appendChild(rows);
72                                 var data_row2 = [];
73                                 for (j in data_row) {
74                                         data_row2.push( { 'label' : j, 'value' : data_row[j] } );
75                                 }
76                                 data_row2.sort( function(a,b) { if ( a.label < b.label ) return -1; else return 1; } );
77                                 for (var j = 0; j < data_row2.length; j++) {
78                                         var label = data_row2[j].label;
79                                         var value = data_row2[j].value;
80                                         if (value == '???' || value == '' || value == 'undefined') continue;
81                                         var row = $c('row'); 
82                                         var l1 = $c('label'); l1.setAttribute('value',label); row.appendChild(l1);
83                                         var l2 = $c('label'); l2.setAttribute('value',value); 
84                                         l2.setAttribute('style','text-decoration: underline; color: blue; -moz-user-focus: normal'); 
85                                         l2.setAttribute('onfocus','this.setAttribute("class","clipboard_outline_me")');
86                                         l2.setAttribute('onblur','this.setAttribute("class","")');
87                                         l2.setAttribute('onclick','copy_to_clipboard(event); window.close();');
88                                         row.appendChild(l2);
89                                         rows.appendChild(row);
90                                         if (!g.focus) { g.focus = true; l2.focus(); }
91                                 }
92                         } catch(E) {
93                                 try { g.error.standard_unexpected_error_alert('util/list_clipboard.xul, make_grid',E); } catch(F) { alert(E); }
94                         }
95                 }
96
97         ]]>
98         </script>
99
100         <description style="font-weight: bold">Choose the data to copy into the clipboard:</description>
101
102         <hbox id="area" flex="1" style="overflow: scroll">
103         </hbox>
104
105         <hbox><spacer flex="1"/><button label="Close" accesskey="C" oncommand="window.close()"/></hbox>
106
107 </window>
108