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