]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xul/staff_client/server/cat/copy_summary.xul
i18n for copy_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         vim:noet:sw=4:ts=4:
6 -->
7
8 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
9 <!-- STYLESHEETS -->
10 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
11 <?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
12 <?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
13
14 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
15 <!-- LOCALIZATION -->
16 <!DOCTYPE window PUBLIC "" ""[
17         <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
18 ]>
19
20 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
21 <!-- OVERLAYS -->
22 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
23
24 <window id="cat_copy_summary_win" 
25         onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
26         xmlns:html="http://www.w3.org/1999/xhtml"
27         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
28
29         <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
30         <!-- BEHAVIOR -->
31         <script type="text/javascript">
32                 var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};
33         </script>
34         <scripts id="openils_util_scripts"/>
35
36         <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
37         <script>
38         <![CDATA[
39                 function $(id) { return document.getElementById(id); }
40                 function $w(id,text) { if ($(id)) util.widgets.set_text($(id),text); }
41
42                 function my_init() {
43                         try {
44                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
45                                 if (typeof JSAN == 'undefined') { 
46                                         throw( $("commonStrings").getString('common.jsan.missing') );
47                                 }
48                                 JSAN.errorLevel = "die"; // none, warn, or die
49                                 JSAN.addRepository('/xul/server/');
50                                 JSAN.use('util.error'); g.error = new util.error();
51                                 g.error.sdump('D_TRACE','my_init() for cat_copy_summary.xul');
52
53                                 var copy_id = xul_param('copy_id');
54
55                                 JSAN.use('util.network'); g.network = new util.network();
56                                 JSAN.use('util.date'); JSAN.use('util.widgets');
57                                 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
58                                 var copy = xul_param('copy',{'stash_name':'temp_copy','clear_xpcom':true});
59                                 var callnumber = xul_param('callnumber',{'stash_name':'temp_callnumber','clear_xpcom':true});
60
61                                 $('caption').setAttribute('tooltiptext', $('catStrings').getFormattedString('staff.cat.copy_summary.copy_id', [(copy_id || copy.id())]));
62
63                                 JSAN.use('circ.util');
64                                 var columns = circ.util.columns( 
65                                         { 
66                                                 'barcode' : { 'hidden' : false },
67                                                 'location' : { 'hidden' : false },
68                                                 'owning_lib' : { 'hidden' : false },
69                                                 'circ_lib' : { 'hidden' : false },
70                                                 'call_number' : { 'hidden' : false },
71                                                 'status' : { 'hidden' : false },
72                                                 'alert_message' : { 'hidden' : false },
73                                         } 
74                                 ).concat(
75                                         {
76                                                 'id' : 'total_circs', 'label' : $('catStrings').getString('staff.cat.copy_summary.total_circs.label'), 'flex' : 1,
77                                                 'primary' : false, 'hidden' : false, 'persist' : 'hidden width ordinal',
78                                                 'render' : 'v = obj.network.simple_request("FM_CIRC_COUNT_RETRIEVE_VIA_COPY",[ my.acp.id() ]).total.count; v;' 
79                                         }
80                                 );
81
82                                 JSAN.use('util.list'); g.list = new util.list('item_summary_list');
83                                 g.list.init(
84                                         {
85                                                 'columns' : columns,
86                                                 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
87                                         }
88                                 );
89         
90                                 function acp_callback(req) {
91                                         try {
92                                                 var copy = req.getResultObject();
93                                                 if (typeof copy.ilsevent != 'undefined') throw(copy);
94
95                                                 function acn_callback(rreq) {
96                                                         try {
97                                                                 $w('barcode',copy.barcode());   
98                                                                 $w('ref',get_bool(copy.ref()) ? $('catStrings').getString('staff.cat.copy_summary.yes') : $('catStrings').getString('staff.cat.copy_summary.no'));      
99                                                                 $w('opac_visible',get_bool(copy.opac_visible()) ? $('catStrings').getString('staff.cat.copy_summary.yes') : $('catStrings').getString('staff.cat.copy_summary.no'));    
100                                                                 $w('circulate',get_bool(copy.circulate()) ? $('catStrings').getString('staff.cat.copy_summary.yes') : $('catStrings').getString('staff.cat.copy_summary.no'));  
101                                                                 $w('holdable',get_bool(copy.holdable()) ? $('catStrings').getString('staff.cat.copy_summary.yes') : $('catStrings').getString('staff.cat.copy_summary.no'));    
102                                                                 $w('age_protect',copy.age_protect() == null ? $('staff.cat.copy_summary.unset') : ( typeof copy.age_protect() == 'object' ? copy.age_protect().name() : g.data.hash.crahp[ copy.age_protect() ].name() ) );     
103                                                                 $w('location',typeof copy.location() == 'object' ? copy.location().name() : g.data.lookup('acpl',copy.location()).name() );     
104                                                                 $w('create_date',util.date.formatted_date(copy.create_date(),'%F'));
105                                                                 $w('edit_date',util.date.formatted_date(copy.edit_date(),'%F'));
106                                                                 $w('status',typeof copy.status() == 'object' ? copy.status().name() : g.data.hash.ccs[ copy.status() ].name() );        
107                                                         } catch(E) {
108                                                                 g.error.standard_unexpected_error_alert('rendering copy',E);
109                                                         }
110                                                         try {
111                                                                 var cn = rreq.getResultObject();
112                                                                 if (typeof cn.ilsevent != 'undefined') {
113                                                                         switch(Number(cn.ilsevent)) {
114                                                                                 case 1508 /* ASSET_CALL_NUMBER_NOT_FOUND */ :
115                                                                                         $w('callnumber', $('catStrings').getString('staff.cat.copy_summary.not_cataloged'));    
116                                                                                 break;
117                                                                                 default:
118                                                                                         throw(cn);
119                                                                                 break;
120                                                                         }
121                                                                 } else {
122                                                                         $w('callnumber',cn.label());    
123                                                                 }
124                                                                 g.list.append({'row':{'my':{'acp':copy,'acn':cn}}});
125                                                         } catch(E) {
126                                                                 g.error.standard_unexpected_error_alert('retrieving volume',E);
127                                                         }
128                                                 }
129
130                                                 if (callnumber) {
131                                                         acn_callback( { 'getResultObject' : function() { return callnumber; } } );
132                                                 } else {
133                                                         g.network.simple_request(
134                                                                 'FM_ACN_RETRIEVE.authoritative',
135                                                                 [ copy.call_number() ], acn_callback
136                                                         );
137                                                 }
138                                         } catch(E) {
139                                                 g.error.standard_unexpected_error_alert('retrieving copy',E);
140                                         }
141                                 }
142
143                                 if (copy_id) {
144                                         g.network.simple_request( 'FM_ACP_RETRIEVE', [ copy_id ], acp_callback);
145                                 } else {
146                                         acp_callback( { 'getResultObject' : function() { return copy; } } );
147                                         copy_id = copy.id();
148                                 }
149
150                                 g.network.simple_request('FM_CIRC_COUNT_RETRIEVE_VIA_COPY',[ copy_id ],function(req) {
151                                         try {
152                                                 var robj = req.getResultObject();
153                                                 if (typeof robj.ilsevent != 'undefined') throw(robj);
154                                                 $w('total_circs',robj.total.count);
155                                         } catch(E) {
156                                                 g.error.standard_unexpected_error_alert('retrieving circ total',E);
157                                         }
158                                 });
159
160                                 toggle_deck(); toggle_deck(); /* quick hack */
161
162                         } catch(E) {
163                                 try { g.error.standard_unexpected_error_alert('copy_summary.xul',E); } catch(F) { alert(E + '\n' + F); }
164                         }
165                 }
166
167                 function toggle_deck() {
168                         try {
169                                 if ($('item_deck').selectedIndex == 0) {
170                                         $('item_deck').selectedIndex = 1; /* change to grid */
171                                         $('save_columns').hidden = true;
172                                         $('sel_clip').hidden = true;
173                                 } else {
174                                         $('item_deck').selectedIndex = 0; /* change to tree */
175                                         $('save_columns').hidden = false;
176                                         $('sel_clip').hidden = false;
177                                 }
178                         } catch(E) {
179                         }
180                 }
181         ]]>
182         </script>
183
184         <messagecatalog id="catStrings" src="/xul/server/locale/<!--#echo var='locale'-->/cat.properties" />
185         <messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale'-->/circ.properties" />
186         <messagecatalog id="commonStrings" src="/xul/server/locale/<!--#echo var='locale'-->/common.properties" />
187
188         <groupbox id="groupbox" flex="1" style="overflow: none; min-height: 80;">
189                 <caption label="&staff.cat.copy_summary.label;" id="caption"/>
190                 <deck id="item_deck" persist="selectedIndex">
191                         <tree id="item_summary_list" enableColumnDrag="true" flex="1"/>
192                         <grid>
193                                 <columns>
194                                         <column/>
195                                         <column/>
196                                         <column/>
197                                         <column/>
198                                         <column/>
199                                         <column/>
200                                         <column/>
201                                         <column/>
202                                 </columns>
203                                 <rows>
204                                         <row>
205                                                 <label style="font-weight: bold" value="&staff.cat.copy_summary.barcode.label;"/>
206                                                 <label id="barcode" style="color: blue; text-decoration: underline; -moz-user-focus: normal;" onclick="copy_to_clipboard(event);"/>
207                                                 <label style="font-weight: bold" value="&staff.cat.copy_summary.location.label;"/>
208                                                 <label id="location"/>
209                                                 <label style="font-weight: bold" value="&staff.cat.copy_summary.call_number.label;"/>
210                                                 <label id="callnumber"/>
211                                                 <label style="font-weight: bold" value="&staff.cat.copy_summary.status.label;"/>
212                                                 <label id="status"/>
213                                         </row>
214                                         <row>
215                                                 <label style="font-weight: bold" value="&staff.cat.copy_summary.circulate.label;"/>
216                                                 <label id="circulate"/>
217                                                 <label style="font-weight: bold" value="&staff.cat.copy_summary.reference.label;"/>
218                                                 <label id="ref"/>
219                                                 <label style="font-weight: bold" value="&staff.cat.copy_summary.holdable.label;"/>
220                                                 <label id="holdable"/>
221                                                 <label style="font-weight: bold" value="&staff.cat.copy_summary.opac_visible.label;"/>
222                                                 <label id="opac_visible"/>
223                                         </row>
224                                         <row>
225                                                 <label style="font-weight: bold" value="&staff.cat.copy_summary.created.label;"/>
226                                                 <label id="create_date"/>
227                                                 <label style="font-weight: bold" value="&staff.cat.copy_summary.edited.label;"/>
228                                                 <label id="edit_date"/>
229                                                 <label style="font-weight: bold" value="&staff.cat.copy_summary.age_protect.label;"/>
230                                                 <label id="age_protect"/>
231                                                 <label style="font-weight: bold" value="&staff.cat.copy_summary.total_circs.label;"/>
232                                                 <label id="total_circs"/>
233                                         </row>
234                                 </rows>
235                         </grid>
236                 </deck>
237                 <hbox>
238                         <button label="&staff.cat.copy_summary.alternate_view.label;" oncommand="toggle_deck()"/>
239                         <button id="save_columns" label="&staff.cat.copy_summary.save_columns.label;" oncommand="try { g.list.save_columns(); } catch(E) { alert(E); }"/>
240                         <button id="sel_clip" label="&staff.cat.copy_summary.sel_clip.label;" oncommand="try { g.list.node.view.selection.selectAll(); g.list.clipboard(); } catch(E) { alert(E); }"/>
241                         <button id="print_export" label="&staff.cat.copy_summary.print_export.label;" oncommand="try { g.list.on_all_fleshed = function() { JSAN.use('util.print'); var p = new util.print(); p.simple( g.list.dump_csv(), { 'content_type' : 'text/plain' } ); setTimeout( function() { g.list.on_all_fleshed = null; }, 0); }; g.list.full_retrieve(); } catch(E) { alert(E); }"/>
242                 </hbox>
243         </groupbox>
244
245 </window>
246