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