]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/circ/copy_details.xul
xul_param and modal xulG conversion
[Evergreen.git] / Open-ILS / xul / staff_client / server / circ / copy_details.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 <?xml-stylesheet href="/xul/server/skin/patron_display.css" type="text/css"?>
11
12 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
13 <!-- LOCALIZATION -->
14 <!DOCTYPE window PUBLIC "" ""[
15         <!--#include virtual="/opac/locale/en-US/lang.dtd"-->
16 ]>
17
18 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
19 <!-- OVERLAYS -->
20 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
21
22 <window id="circ_copy_details_win" 
23         onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
24         width="800" height="600" persist="width height"
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
40                 var xulG = {};
41
42                 function my_init() {
43                         try {
44                                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
45                                 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
46                                 JSAN.errorLevel = "die"; // none, warn, or die
47                                 JSAN.addRepository('/xul/server/');
48                                 JSAN.use('util.error'); g.error = new util.error();
49                                 g.error.sdump('D_TRACE','my_init() for circ_copy_details.xul');
50
51                                 g.copy_id = xul_param('copy_id',{'modal_xulG':true});
52
53                                 JSAN.use('util.network'); g.network = new util.network();
54                                 JSAN.use('util.date');
55                                 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
56
57                                 // uber method
58                                 var robj = g.network.simple_request('FM_ACP_DETAILS', [ ses(), g.copy_id ] );
59                                 if (typeof robj.ilsevent != 'undefined') throw(robj);
60                                 if (robj.copy) g.copy = robj.copy; else throw(robj);
61                                 g.hold = robj.hold; g.transit = robj.transit; g.circ = robj.circ; g.callnumber = robj.volume;
62                                 if (g.hold) $('hold_caption').setAttribute('tooltiptext','Hold ID = ' + g.hold.id());
63                                 if (g.transit) $('transit_caption').setAttribute('tooltiptext','Transit ID = ' + g.transit.id());
64                                 if (g.circ) $('circ_caption').setAttribute('tooltiptext','Circ ID = ' + g.circ.id());
65
66                                 //g.callnumber = g.network.simple_request('FM_ACN_RETRIEVE',[ g.copy.call_number() ]);
67                                 //if (typeof g.callnumber.ilsevent != 'undefined') throw(g.callnumber);
68
69                                 $('top').setAttribute('src',urls.XUL_BIB_BRIEF); // + '?docid=' + g.callnumber.record());
70                                 $('top').contentWindow.xulG = { 'docid' : g.callnumber.record() };
71                                 //g.data.temp_copy = g.copy; g.data.stash('temp_copy'); 
72                                 //g.data.temp_callnumber = g.callnumber; g.data.stash('temp_callnumber'); 
73                                 $('item_summary').setAttribute('src',urls.XUL_COPY_SUMMARY);
74                                 $('item_summary').contentWindow.xulG = { 'copy' : g.copy, 'callnumber' : g.callnumber };
75
76                                 $('r_last').disabled = true;
77                                 if (g.circ) {
78                                         $('r_last').disabled = false;
79                                         g.data.temp_circ = g.circ; g.data.stash('temp_circ');
80                                         $('circ').setAttribute('src',urls.XUL_CIRC_BRIEF); // + '?no_border=1');
81                                         $('circ').contentWindow.xulG = { 'no_border' : 1 };
82                                         if (g.circ.checkin_time()) {
83                                                 $('circ_caption').setAttribute('label','Last Circulation');
84                                         } else {
85                                                 $('circ_caption').setAttribute('label','Current Circulation');
86                                         }
87                                 } else {
88                                         $('circ_caption').setAttribute('label','This item has yet to circulate.');
89                                         $('circ').hidden = true;
90                                 }
91
92                                 if (g.transit) {
93                                         JSAN.use('circ.util'); var columns = circ.util.transit_columns({});
94
95                                         JSAN.use('util.list'); g.list = new util.list('transit');
96                                         g.list.init( { 'columns' : columns, 'map_row_to_columns' : circ.util.std_map_row_to_columns(), });
97                                         g.list.append( { 'row' : { 'my' : { 'atc' : g.transit, } } });
98         
99                                 } else {
100                                         $('transit_caption').setAttribute('label','This item is not in transit.');
101                                         $('transit').hidden = true;
102                                 }
103
104
105                                 $('r_hold').disabled = true;
106                                 if (g.hold) {
107                                         $('r_hold').disabled = false;
108                                         var status_robj = g.network.simple_request('FM_AHR_STATUS',[ ses(), g.hold.id() ]);
109                                         JSAN.use('circ.util');
110                                         var columns = circ.util.hold_columns( 
111                                                 { 
112                                                         'request_time' : { 'hidden' : false },
113                                                         'pickup_lib_shortname' : { 'hidden' : false },
114                                                         'hold_type' : { 'hidden' : true },
115                                                         'current_copy' : { 'hidden' : true },
116                                                         'capture_time' : { 'hidden' : true },
117                                                         'email_notify' : { 'hidden' : false },
118                                                         'phone_notify' : { 'hidden' : false },
119                                                 } 
120                                         );
121
122                                         JSAN.use('util.list'); g.list = new util.list('hold');
123                                         g.list.init( { 'columns' : columns, 'map_row_to_columns' : circ.util.std_map_row_to_columns(), });
124                                         g.list.append( { 'row' : { 'my' : { 'ahr' : g.hold, 'acp' : g.copy, 'status' : status_robj, } } });
125         
126                                         JSAN.use('patron.util'); 
127                                         var au_obj = patron.util.retrieve_fleshed_au_via_id( ses(), g.hold.usr() );
128                                         $('patron_name').setAttribute('value', au_obj.family_name() + ', ' + au_obj.first_given_name() + ' : ' + au_obj.card().barcode() );
129
130                                 } else {
131                                         if (g.copy.status() == 8 /* ON HOLDS SHELF */) {
132                                                 $('hold_caption').setAttribute('label','This item is not captured for a hold, however its status is incorrectly set to "On Holds Shelf".  Please check this item in to correct the status.');
133                                         } else {
134                                                 $('hold_caption').setAttribute('label','This item is not captured for a hold.');
135                                         }
136                                         $('hold').hidden = true;
137                                 }
138
139                         } catch(E) {
140                                 g.error.standard_unexpected_error_alert('Error in copy_details.xul, my_init()',E);
141                         }
142                 }
143
144                 function retrieve_last_patron() {
145                         try {
146                                 //g.data.fancy_prompt_data = js2JSON( [ g.circ.usr() ] );
147                                 //g.data.stash('fancy_prompt_data');
148                                 xulG.retrieve_these_patrons = [ g.circ.user() ];
149                                 update_modal_xulG(xulG);
150                                 window.close();
151                         } catch(E) {
152                                 alert(E);
153                         }
154                 }
155
156                 function retrieve_hold_patron() {
157                         try {
158                                 //g.data.fancy_prompt_data = js2JSON( [ g.hold.usr() ] );
159                                 //g.data.stash('fancy_prompt_data');
160                                 xulG.retrieve_these_patrons = [ g.hold.user() ];
161                                 update_modal_xulG(xulG);
162                                 window.close();
163                         } catch(E) {
164                                 alert(E);
165                         }
166                 }
167
168         ]]>
169         </script>
170
171         <vbox flex="1" style="overflow: auto;">
172                 <vbox style="border: none; overflow: none; min-height: 80;">
173                         <iframe flex="1" id="top" style="overflow: none; min-height: 80;"/>
174                 </vbox>
175                 <splitter><grippy/></splitter>
176                 <vbox style="border: none; overflow: none; min-height: 80;">
177                         <iframe flex="1" id="item_summary" style="overflow: none; min-height: 80;"/>
178                 </vbox>
179                 <splitter><grippy/></splitter>
180                 <groupbox flex="1" id="holds" style="overflow: none; min-height: 80;">
181                         <caption id="hold_caption" label="Captured for Hold"/>
182                         <label id="patron_name" class="patronNameLarge"/>
183                         <tree id="hold" flex="1" enableColumnDrag="true"/>
184                         <spacer FIXME="label and tree get swapped without this"/>
185                 </groupbox>
186                 <splitter><grippy/></splitter>
187                 <groupbox flex="1" id="transits" style="overflow: none; min-height: 80;">
188                         <caption id="transit_caption" label="In Transit"/>
189                         <tree id="transit" flex="1" enableColumnDrag="true"/>
190                 </groupbox>
191                 <splitter><grippy/></splitter>
192                 <groupbox flex="1" id="circs" style="overflow: none; min-height: 80;">
193                         <caption id="circ_caption" label="Last/Current Circulation" style="font-weight: bold"/>
194                         <iframe id="circ" style="min-height: 80" flex="1"/>
195                 </groupbox>
196         </vbox>
197         <hbox>
198                 <button id="r_last" label="Retrieve Last Patron" accesskey="L" oncommand="retrieve_last_patron();"/>
199                 <button id="r_hold" label="Retrieve Hold Patron" accesskey="H" oncommand="retrieve_hold_patron();"/>
200                 <spacer flex="1"/>
201                 <button id="done" label="Done" accesskey="D" oncommand="window.close();"/>
202         </hbox>
203
204 </window>
205