]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/circ/circ_summary.xul
iframe tweaks for xulrunner 1.9. hold_notices.xul is all kinds of broken, though
[Evergreen.git] / Open-ILS / xul / staff_client / server / circ / circ_summary.xul
1 <?xml version="1.0" encoding="UTF-8"?>
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/${locale}/lang.dtd"-->
16 ]>
17
18 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
19 <!-- OVERLAYS -->
20 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
21
22 <window id="circ_circ_brief_win" 
23         onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
24         width="750" height="550"
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') {
46                                         throw( document.getElementById("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 circ_circ_brief.xul');
52
53                                 g.copy_id = xul_param('copy_id',{'modal_xulG':true});
54
55                                 JSAN.use('util.network'); g.network = new util.network();
56                                 JSAN.use('util.date');
57                                 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
58
59                                 g.copy = g.network.simple_request('FM_ACP_RETRIEVE',[ g.copy_id ]);
60                                 if (typeof g.copy.ilsevent != 'undefined') throw(g.copy);
61                                 g.callnumber = g.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ g.copy.call_number() ]);
62                                 if (typeof g.callnumber.ilsevent != 'undefined') throw(g.callnumber);
63
64                 var tv = $('top_vbox'); while(tv.firstChild) tv.removeChild(tv.lastChild);
65                 var top = document.createElement('iframe'); tv.appendChild(top);
66                                 top.setAttribute('src',urls.XUL_BIB_BRIEF);
67                 top.setAttribute('flex','1');
68                                 get_contentWindow(top).xulG = { 'docid' : g.callnumber.record() };
69                 var mv = $('mid_vbox'); while(mv.firstChild) mv.removeChild(mv.lastChild);
70                 var mid = document.createElement('iframe'); mv.appendChild(mid);
71                                 mid.setAttribute('src',urls.XUL_COPY_SUMMARY);
72                 mid.setAttribute('flex','1');
73                                 get_contentWindow(mid).xulG = { 'copy_id' : g.copy.id() };
74
75                                 show_circs();
76
77                         } catch(E) {
78                                 g.error.standard_unexpected_error_alert('Error in circ_brief.xul, my_init()',E);
79                         }
80                 }
81
82                 function show_circs() {
83                         try {
84                                 $('r_last').disabled = true; $('r_all').disabled = true;        
85                                 g.circs = g.network.simple_request('FM_CIRC_RETRIEVE_VIA_COPY',
86                                         [ ses(), g.copy_id ]);
87                                 if (g.circs == null || typeof g.circs.ilsevent != 'undefined') throw(circs);
88                                 if (g.circs.length == 0) return;
89                                 //g.circs = g.circs.reverse(); /* put the most recent at the top */
90                                 $('r_last').disabled = false; $('r_all').disabled = false;      
91
92                                 var gb = $('circs');
93                                 for (var j = 0; j < g.circs.length; j++) {
94                                         var iframe = document.createElement('iframe');
95                                         iframe.setAttribute('style','overflow: none; min-height: 100px;');
96                                         iframe.setAttribute('flex','1');
97                                         gb.appendChild(iframe);
98                                         iframe.setAttribute('src', urls.XUL_CIRC_BRIEF); // + '?circ_id=' + g.circs[j].id() );
99                                         get_contentWindow(iframe).xulG = { 'circ_id' : g.circs[j].id() };
100                                 }
101                         } catch(E) {
102                                 g.error.standard_unexpected_error_alert('error showing circs',E);
103                         }
104                 }
105
106                 function retrieve_last() {
107                         try {
108                                 //g.data.fancy_prompt_data = js2JSON( [ g.circs[0].usr() ] );
109                                 //g.data.stash('fancy_prompt_data');
110                                 xulG.retrieve_these_patrons = [ g.circs[0].usr() ];
111                                 update_modal_xulG(xulG);
112                                 window.close();
113                         } catch(E) {
114                                 g.error.standard_unexpected_error_alert('retrieve_last',E);
115                         }
116                 }
117
118                 function retrieve_all() {
119                         try {
120                                 var patrons = []; var p_hash = {};
121                                 for (var i = 0; i < g.circs.length; i++) {
122                                         var usr = g.circs[i].usr();
123                                         if (typeof p_hash[usr] != 'undefined') { continue; }
124                                         p_hash[usr] = true;
125                                         patrons.push( function(a){return a;}(usr) );
126                                 }
127                                 //g.data.fancy_prompt_data = js2JSON(patrons);
128                                 //g.data.stash('fancy_prompt_data');
129                                 xulG.retrieve_these_patrons = patrons;
130                                 update_modal_xulG(xulG);
131                                 window.close();
132                         } catch(E) {
133                                 g.error.standard_unexpected_error_alert('retrieve_all',E);
134                         }
135                 }
136
137         ]]>
138         </script>
139
140         <vbox flex="1" class="my_overflow">
141         <vbox id="top_vbox" flex="1" class="my_overflow"/>
142                 <splitter><grippy/></splitter>
143         <vbox id="mid_vbox" flex="1" class="my_overflow"/>
144                 <splitter><grippy/></splitter>
145                 <groupbox flex="1" id="circs" class="my_overflow">
146                         <caption label="&staff.circ.circ_summary.caption;"/>
147                 </groupbox>
148                 <hbox>
149                         <button id="r_last" label="&staff.circ.circ_summary.retrieve_last.label;" accesskey="&staff.circ.circ_summary.retrieve_last.accesskey;" oncommand="retrieve_last();"/>
150                         <button id="r_all" label="&staff.circ.circ_summary.retrieve_all.label;" accesskey="&staff.circ.circ_summary.retrieve_all.accesskey;" oncommand="retrieve_all();"/>
151                         <spacer flex="1"/>
152                         <button label="&staff.circ.circ_summary.done.label;" accesskey="&staff.circ.circ_summary.done.accesskey;" oncommand="window.close();"/>
153                 </hbox>
154         </vbox>
155
156 </window>
157