]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/xul/staff_client/server/cat/copy_summary.xul
age protection 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 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
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                 function my_bool(b) {
39                         switch(b) {
40                                 case 't' :
41                                 case '1' :
42                                 case 1 :
43                                 case true:
44                                         return true;
45                                 break;
46                                 default:
47                                         return false;
48                                 break;
49                         }
50                 }
51
52                 function my_init() {
53                         try {
54                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
55                                 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
56                                 JSAN.errorLevel = "die"; // none, warn, or die
57                                 JSAN.addRepository('/xul/server/');
58                                 JSAN.use('util.error'); g.error = new util.error();
59                                 g.error.sdump('D_TRACE','my_init() for cat_copy_summary.xul');
60
61                                 g.cgi = new CGI();
62                                 var copy_id = g.cgi.param('copy_id');
63
64                                 JSAN.use('util.network'); g.network = new util.network();
65                                 JSAN.use('util.date'); JSAN.use('util.widgets');
66                                 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
67
68                                 $('caption').setAttribute('tooltiptext','Copy ID = ' + copy_id);
69
70                                 g.network.simple_request(
71                                         'FM_ACP_RETRIEVE',
72                                         [ copy_id ],
73                                         function (req) {
74                                                 try {
75                                                         var copy = req.getResultObject();
76                                                         if (typeof copy.ilsevent != 'undefined') throw(copy);
77                                                         g.network.simple_request(
78                                                                 'FM_ACN_RETRIEVE',
79                                                                 [ copy.call_number() ],
80                                                                 function (rreq) {
81                                                                         try {
82                                                                                 $w('barcode',copy.barcode());   
83                                                                                 $w('ref',my_bool(copy.ref()) ? 'Yes' : 'No');   
84                                                                                 $w('opac_visible',my_bool(copy.opac_visible()) ? 'Yes' : 'No'); 
85                                                                                 $w('circulate',my_bool(copy.circulate()) ? 'Yes' : 'No');       
86                                                                                 $w('holdable',my_bool(copy.holdable()) ? 'Yes' : 'No'); 
87                                                                                 $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() ) );     
88                                                                                 $w('location',copy.location().name());  
89                                                                                 $w('create_date',util.date.formatted_date(copy.create_date(),'%F'));
90                                                                                 $w('edit_date',util.date.formatted_date(copy.edit_date(),'%F'));
91                                                                                 $w('status',copy.status().name());      
92                                                                         } catch(E) {
93                                                                                 g.error.standard_unexpected_error_alert('rendering copy',E);
94                                                                         }
95                                                                         try {
96                                                                                 var cn = rreq.getResultObject();
97                                                                                 if (typeof cn.ilsevent != 'undefined') {
98                                                                                         switch(cn.ilsevent) {
99                                                                                                 case 1508 /* ASSET_CALL_NUMBER_NOT_FOUND */ :
100                                                                                                         $w('callnumber','Not Cataloged');       
101                                                                                                 break;
102                                                                                                 default:
103                                                                                                         throw(cn);
104                                                                                                 break;
105                                                                                         }
106                                                                                 } else {
107                                                                                         $w('callnumber',cn.label());    
108                                                                                 }
109                                                                         } catch(E) {
110                                                                                 g.error.standard_unexpected_error_alert('retrieving volume',E);
111                                                                         }
112                                                                 }
113                                                         );
114                                                 } catch(E) {
115                                                         g.error.standard_unexpected_error_alert('retrieving copy',E);
116                                                 }
117                                         }
118                                 );
119
120                                 g.network.simple_request('FM_CIRC_COUNT_RETRIEVE_VIA_COPY',[ g.copy_id ],function(req) {
121                                         try {
122                                                 var robj = req.getResultObject();
123                                                 if (typeof robj.ilsevent != 'undefined') throw(robj);
124                                                 $w('total_circs',robj.total.count);
125                                         } catch(E) {
126                                                 g.error.standard_unexpected_error_alert('retrieving circ total',E);
127                                         }
128                                 });
129
130
131
132                         } catch(E) {
133                                 var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
134                                         "system administrator or software developer the following:\ncat/copy_summary.xul\n" + E + '\n';
135                                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
136                                 alert(err_msg);
137                         }
138                 }
139
140         ]]>
141         </script>
142
143         <groupbox id="groupbox" flex="1" style="overflow: auto; min-height: 100px;">
144                 <caption label="Item Summary" id="caption"/>
145                 <grid>
146                         <columns>
147                                 <column/>
148                                 <column/>
149                                 <column/>
150                                 <column/>
151                                 <column/>
152                                 <column/>
153                                 <column/>
154                                 <column/>
155                         </columns>
156                         <rows>
157                                 <row>
158                                         <label style="font-weight: bold" value="Barcode:"/>
159                                         <label id="barcode"/>
160                                         <label style="font-weight: bold" value="Location:"/>
161                                         <label id="location"/>
162                                         <label style="font-weight: bold" value="Call Number:"/>
163                                         <label id="callnumber"/>
164                                         <label style="font-weight: bold" value="Status:"/>
165                                         <label id="status"/>
166                                 </row>
167                                 <row>
168                                         <label style="font-weight: bold" value="Circulate:"/>
169                                         <label id="circulate"/>
170                                         <label style="font-weight: bold" value="Reference:"/>
171                                         <label id="ref"/>
172                                         <label style="font-weight: bold" value="Holdable:"/>
173                                         <label id="holdable"/>
174                                         <label style="font-weight: bold" value="Opac Visible:"/>
175                                         <label id="opac_visible"/>
176                                 </row>
177                                 <row>
178                                         <label style="font-weight: bold" value="Created:"/>
179                                         <label id="create_date"/>
180                                         <label style="font-weight: bold" value="Edited:"/>
181                                         <label id="edit_date"/>
182                                         <label style="font-weight: bold" value="Age Protect:"/>
183                                         <label id="age_protect"/>
184                                         <label style="font-weight: bold" value="Total Circs:"/>
185                                         <label id="total_circs"/>
186                                 </row>
187                         </rows>
188                 </grid>
189         </groupbox>
190
191 </window>
192