]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/cat/copy_summary.xul
font resizer
[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(); font_helper(); } 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                                 JSAN.use('circ.util');
62                                 var columns = circ.util.columns( 
63                                         { 
64                                                 'barcode' : { 'hidden' : false },
65                                                 'location' : { 'hidden' : false },
66                                                 'owning_lib' : { 'hidden' : false },
67                                                 'circ_lib' : { 'hidden' : false },
68                                                 'call_number' : { 'hidden' : false },
69                                                 'status' : { 'hidden' : false },
70                                                 'alert_message' : { 'hidden' : false },
71                                         } 
72                                 ).concat(
73                                         {
74                                                 'id' : 'total_circs', 'label' : 'Total Circs', 'flex' : 1,
75                                                 'primary' : false, 'hidden' : false, 'persist' : 'hidden width ordinal',
76                                                 'render' : 'obj.network.simple_request("FM_CIRC_COUNT_RETRIEVE_VIA_COPY",[ my.acp.id() ]).total.count' 
77                                         }
78                                 );
79
80                                 JSAN.use('util.list'); g.list = new util.list('item_summary_list');
81                                 g.list.init(
82                                         {
83                                                 'columns' : columns,
84                                                 'map_row_to_column' : circ.util.std_map_row_to_column(),
85                                         }
86                                 );
87         
88                                 function acp_callback(req) {
89                                         try {
90                                                 var copy = req.getResultObject();
91                                                 if (typeof copy.ilsevent != 'undefined') throw(copy);
92                                                 g.list.append({'row':{'my':{'acp':copy}}});
93                                                 g.network.simple_request(
94                                                         'FM_ACN_RETRIEVE',
95                                                         [ copy.call_number() ],
96                                                         function (rreq) {
97                                                                 try {
98                                                                         $w('barcode',copy.barcode());   
99                                                                         $w('ref',get_bool(copy.ref()) ? 'Yes' : 'No');  
100                                                                         $w('opac_visible',get_bool(copy.opac_visible()) ? 'Yes' : 'No');        
101                                                                         $w('circulate',get_bool(copy.circulate()) ? 'Yes' : 'No');      
102                                                                         $w('holdable',get_bool(copy.holdable()) ? 'Yes' : 'No');        
103                                                                         $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() ) );     
104                                                                         $w('location',typeof copy.location() == 'object' ? copy.location().name() : g.data.lookup('acpl',copy.location()).name() );     
105                                                                         $w('create_date',util.date.formatted_date(copy.create_date(),'%F'));
106                                                                         $w('edit_date',util.date.formatted_date(copy.edit_date(),'%F'));
107                                                                         $w('status',typeof copy.status() == 'object' ? copy.status().name() : g.data.hash.ccs[ copy.status() ].name() );        
108                                                                 } catch(E) {
109                                                                         g.error.standard_unexpected_error_alert('rendering copy',E);
110                                                                 }
111                                                                 try {
112                                                                         var cn = rreq.getResultObject();
113                                                                         if (typeof cn.ilsevent != 'undefined') {
114                                                                                 switch(cn.ilsevent) {
115                                                                                         case 1508 /* ASSET_CALL_NUMBER_NOT_FOUND */ :
116                                                                                                 $w('callnumber','Not Cataloged');       
117                                                                                         break;
118                                                                                         default:
119                                                                                                 throw(cn);
120                                                                                         break;
121                                                                                 }
122                                                                         } else {
123                                                                                 $w('callnumber',cn.label());    
124                                                                         }
125                                                                 } catch(E) {
126                                                                         g.error.standard_unexpected_error_alert('retrieving volume',E);
127                                                                 }
128                                                         }
129                                                 );
130                                         } catch(E) {
131                                                 g.error.standard_unexpected_error_alert('retrieving copy',E);
132                                         }
133                                 }
134
135                                 if (copy_id) {
136                                         g.network.simple_request( 'FM_ACP_RETRIEVE', [ copy_id ], acp_callback);
137                                 } else {
138                                         acp_callback( { 'getResultObject' : function() { return copy; } } );
139                                         copy_id = copy.id();
140                                 }
141
142                                 g.network.simple_request('FM_CIRC_COUNT_RETRIEVE_VIA_COPY',[ copy_id ],function(req) {
143                                         try {
144                                                 var robj = req.getResultObject();
145                                                 if (typeof robj.ilsevent != 'undefined') throw(robj);
146                                                 $w('total_circs',robj.total.count);
147                                         } catch(E) {
148                                                 g.error.standard_unexpected_error_alert('retrieving circ total',E);
149                                         }
150                                 });
151
152                                 toggle_deck(); toggle_deck(); /* quick hack */
153
154                         } catch(E) {
155                                 try { g.error.standard_unexpected_error_alert('copy_summary.xul',E); } catch(F) { alert(E + '\n' + F); }
156                         }
157                 }
158
159                 function toggle_deck() {
160                         try {
161                                 if ($('item_deck').selectedIndex == 0) {
162                                         $('item_deck').selectedIndex = 1; /* change to grid */
163                                         $('save_columns').hidden = true;
164                                         $('sel_clip').hidden = true;
165                                 } else {
166                                         $('item_deck').selectedIndex = 0; /* change to tree */
167                                         $('save_columns').hidden = false;
168                                         $('sel_clip').hidden = false;
169                                 }
170                         } catch(E) {
171                         }
172                 }
173         ]]>
174         </script>
175
176         <groupbox id="groupbox" flex="1" style="overflow: none; min-height: 80;">
177                 <caption label="Item Summary" id="caption"/>
178                 <deck id="item_deck" persist="selectedIndex">
179                         <tree id="item_summary_list" enableColumnDrag="true" flex="1"/>
180                         <grid>
181                                 <columns>
182                                         <column/>
183                                         <column/>
184                                         <column/>
185                                         <column/>
186                                         <column/>
187                                         <column/>
188                                         <column/>
189                                         <column/>
190                                 </columns>
191                                 <rows>
192                                         <row>
193                                                 <label style="font-weight: bold" value="Barcode:"/>
194                                                 <label id="barcode" style="color: blue; text-decoration: underline; -moz-user-focus: normal;" onclick="copy_to_clipboard(event);"/>
195                                                 <label style="font-weight: bold" value="Location:"/>
196                                                 <label id="location"/>
197                                                 <label style="font-weight: bold" value="Call Number:"/>
198                                                 <label id="callnumber"/>
199                                                 <label style="font-weight: bold" value="Status:"/>
200                                                 <label id="status"/>
201                                         </row>
202                                         <row>
203                                                 <label style="font-weight: bold" value="Circulate:"/>
204                                                 <label id="circulate"/>
205                                                 <label style="font-weight: bold" value="Reference:"/>
206                                                 <label id="ref"/>
207                                                 <label style="font-weight: bold" value="Holdable:"/>
208                                                 <label id="holdable"/>
209                                                 <label style="font-weight: bold" value="Opac Visible:"/>
210                                                 <label id="opac_visible"/>
211                                         </row>
212                                         <row>
213                                                 <label style="font-weight: bold" value="Created:"/>
214                                                 <label id="create_date"/>
215                                                 <label style="font-weight: bold" value="Edited:"/>
216                                                 <label id="edit_date"/>
217                                                 <label style="font-weight: bold" value="Age Protect:"/>
218                                                 <label id="age_protect"/>
219                                                 <label style="font-weight: bold" value="Total Circs:"/>
220                                                 <label id="total_circs"/>
221                                         </row>
222                                 </rows>
223                         </grid>
224                 </deck>
225                 <hbox>
226                         <label value="Alternate View" style="text-decoration: underline; color: blue" onclick="toggle_deck()"/>
227                         <label id="save_columns" value="Save Columns" style="text-decoration: underline; color: blue" onclick="try { g.list.save_columns(); } catch(E) { alert(E); }"/>
228                         <label id="sel_clip" value="Copy to Clipboard" style="text-decoration: underline; color: blue" onclick="try { g.list.node.view.selection.selectAll(); g.list.clipboard(); } catch(E) { alert(E); }"/>
229                 </hbox>
230         </groupbox>
231
232 </window>
233