]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xul/staff_client/server/cat/copy_summary.xul
clipboard action for barcode in item summary
[working/Evergreen.git] / Open-ILS / xul / staff_client / server / cat / copy_summary.xul
1 <?xml version="1.0"?>
2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Brief Bib Display -->
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="cat_copy_summary_win" 
22         onload="try { my_init(); } catch(E) { alert(E); }"
23         xmlns:html="http://www.w3.org/1999/xhtml"
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                 function $(id) { return document.getElementById(id); }
37                 function $w(id,text) { if ($(id)) util.widgets.set_text($(id),text); }
38
39                 function my_init() {
40                         try {
41                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
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 cat_copy_summary.xul');
47
48                                 g.cgi = new CGI();
49                                 var copy_id = g.cgi.param('copy_id');
50
51                                 JSAN.use('util.network'); g.network = new util.network();
52                                 JSAN.use('util.date'); JSAN.use('util.widgets');
53                                 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
54                                 var copy;
55                                 if (g.data.temp_copy) {
56                                         copy = g.data.temp_copy; g.data.temp_copy = null; g.data.stash('temp_copy');
57                                 }
58
59                                 $('caption').setAttribute('tooltiptext','Copy ID = ' + (copy_id || copy.id() ) );
60
61                                 function acp_callback(req) {
62                                         try {
63                                                 var copy = req.getResultObject();
64                                                 if (typeof copy.ilsevent != 'undefined') throw(copy);
65                                                 g.network.simple_request(
66                                                         'FM_ACN_RETRIEVE',
67                                                         [ copy.call_number() ],
68                                                         function (rreq) {
69                                                                 try {
70                                                                         $w('barcode',copy.barcode());   
71                                                                         $w('ref',get_bool(copy.ref()) ? 'Yes' : 'No');  
72                                                                         $w('opac_visible',get_bool(copy.opac_visible()) ? 'Yes' : 'No');        
73                                                                         $w('circulate',get_bool(copy.circulate()) ? 'Yes' : 'No');      
74                                                                         $w('holdable',get_bool(copy.holdable()) ? 'Yes' : 'No');        
75                                                                         $w('age_protect',copy.age_protect() == null ? '<Unset>' : ( typeof copy.age_protect() == 'object' ? copy.age_protect().name() : g.data.hash.crahp[ copy.age_protect() ].name() ) );     
76                                                                         $w('location',typeof copy.location() == 'object' ? copy.location().name() : g.data.lookup('acpl',copy.location()).name() );     
77                                                                         $w('create_date',util.date.formatted_date(copy.create_date(),'%F'));
78                                                                         $w('edit_date',util.date.formatted_date(copy.edit_date(),'%F'));
79                                                                         $w('status',typeof copy.status() == 'object' ? copy.status().name() : g.data.hash.ccs[ copy.status() ].name() );        
80                                                                 } catch(E) {
81                                                                         g.error.standard_unexpected_error_alert('rendering copy',E);
82                                                                 }
83                                                                 try {
84                                                                         var cn = rreq.getResultObject();
85                                                                         if (typeof cn.ilsevent != 'undefined') {
86                                                                                 switch(cn.ilsevent) {
87                                                                                         case 1508 /* ASSET_CALL_NUMBER_NOT_FOUND */ :
88                                                                                                 $w('callnumber','Not Cataloged');       
89                                                                                         break;
90                                                                                         default:
91                                                                                                 throw(cn);
92                                                                                         break;
93                                                                                 }
94                                                                         } else {
95                                                                                 $w('callnumber',cn.label());    
96                                                                         }
97                                                                 } catch(E) {
98                                                                         g.error.standard_unexpected_error_alert('retrieving volume',E);
99                                                                 }
100                                                         }
101                                                 );
102                                         } catch(E) {
103                                                 g.error.standard_unexpected_error_alert('retrieving copy',E);
104                                         }
105                                 }
106
107                                 if (copy_id) {
108                                         g.network.simple_request( 'FM_ACP_RETRIEVE', [ copy_id ], acp_callback);
109                                 } else {
110                                         acp_callback( { 'getResultObject' : function() { return copy; } } );
111                                         copy_id = copy.id();
112                                 }
113
114                                 g.network.simple_request('FM_CIRC_COUNT_RETRIEVE_VIA_COPY',[ copy_id ],function(req) {
115                                         try {
116                                                 var robj = req.getResultObject();
117                                                 if (typeof robj.ilsevent != 'undefined') throw(robj);
118                                                 $w('total_circs',robj.total.count);
119                                         } catch(E) {
120                                                 g.error.standard_unexpected_error_alert('retrieving circ total',E);
121                                         }
122                                 });
123
124                         } catch(E) {
125                                 var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
126                                         "system administrator or software developer the following:\ncat/copy_summary.xul\n" + E + '\n';
127                                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
128                                 alert(err_msg);
129                         }
130                 }
131
132         ]]>
133         </script>
134
135         <groupbox id="groupbox" flex="1" style="overflow: auto; min-height: 100px;">
136                 <caption label="Item Summary" id="caption"/>
137                 <grid>
138                         <columns>
139                                 <column/>
140                                 <column/>
141                                 <column/>
142                                 <column/>
143                                 <column/>
144                                 <column/>
145                                 <column/>
146                                 <column/>
147                         </columns>
148                         <rows>
149                                 <row>
150                                         <label style="font-weight: bold" value="Barcode:"/>
151                                         <label id="barcode" style="color: blue; text-decoration: underline; -moz-user-focus: normal;" onclick="copy_to_clipboard(event);"/>
152                                         <label style="font-weight: bold" value="Location:"/>
153                                         <label id="location"/>
154                                         <label style="font-weight: bold" value="Call Number:"/>
155                                         <label id="callnumber"/>
156                                         <label style="font-weight: bold" value="Status:"/>
157                                         <label id="status"/>
158                                 </row>
159                                 <row>
160                                         <label style="font-weight: bold" value="Circulate:"/>
161                                         <label id="circulate"/>
162                                         <label style="font-weight: bold" value="Reference:"/>
163                                         <label id="ref"/>
164                                         <label style="font-weight: bold" value="Holdable:"/>
165                                         <label id="holdable"/>
166                                         <label style="font-weight: bold" value="Opac Visible:"/>
167                                         <label id="opac_visible"/>
168                                 </row>
169                                 <row>
170                                         <label style="font-weight: bold" value="Created:"/>
171                                         <label id="create_date"/>
172                                         <label style="font-weight: bold" value="Edited:"/>
173                                         <label id="edit_date"/>
174                                         <label style="font-weight: bold" value="Age Protect:"/>
175                                         <label id="age_protect"/>
176                                         <label style="font-weight: bold" value="Total Circs:"/>
177                                         <label id="total_circs"/>
178                                 </row>
179                         </rows>
180                 </grid>
181         </groupbox>
182
183 </window>
184