]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/circ/circ_summary.xul
LP#1497335 Aged circ display release notes
[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="/xul/server/skin/global.css" type="text/css"?>
9 <?xml-stylesheet href="/xul/server/skin/patron_display.css" type="text/css"?>
10
11 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
12 <!-- LOCALIZATION -->
13 <!DOCTYPE window PUBLIC "" ""[
14     <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
15 ]>
16
17 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
18 <!-- OVERLAYS -->
19 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
20
21 <window id="circ_circ_brief_win" 
22     onload="try { my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
23     width="750" height="550" oils_persist="height width sizemode"
24     xmlns:html="http://www.w3.org/1999/xhtml"
25     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
26
27     <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
28     <!-- BEHAVIOR -->
29         <script type="text/javascript">
30         var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};
31     </script>
32         <scripts id="openils_util_scripts"/>
33
34     <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
35     <script>
36     <![CDATA[
37         function $(id) { return document.getElementById(id); }
38
39         function my_init() {
40             try {
41                 if (typeof JSAN == 'undefined') {
42                     throw( document.getElementById("commonStrings").getString('common.jsan.missing') );
43                 }
44                 JSAN.errorLevel = "die"; // none, warn, or die
45                 JSAN.addRepository('/xul/server/');
46                 JSAN.use('util.error'); g.error = new util.error();
47                 g.error.sdump('D_TRACE','my_init() for circ_circ_brief.xul');
48
49                 g.copy_id = xul_param('copy_id');
50
51                 JSAN.use('util.network'); g.network = new util.network();
52                 JSAN.use('util.date');
53                 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
54
55                 g.copy = g.network.simple_request('FM_ACP_RETRIEVE',[ g.copy_id ]);
56                 if (typeof g.copy.ilsevent != 'undefined') throw(g.copy);
57                 g.callnumber = g.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ g.copy.call_number() ]);
58                 if (typeof g.callnumber.ilsevent != 'undefined') throw(g.callnumber);
59
60                 var tv = $('top_vbox'); while(tv.firstChild) tv.removeChild(tv.lastChild);
61                 var top = document.createElement('iframe'); tv.appendChild(top);
62                 top.setAttribute('src',urls.XUL_BIB_BRIEF);
63                 top.setAttribute('flex','1');
64                 get_contentWindow(top).xulG = { 'docid' : g.callnumber.record() };
65                 var mv = $('mid_vbox'); while(mv.firstChild) mv.removeChild(mv.lastChild);
66                 var mid = document.createElement('iframe'); mv.appendChild(mid);
67                 mid.setAttribute('src',urls.XUL_COPY_SUMMARY);
68                 mid.setAttribute('flex','1');
69                 get_contentWindow(mid).xulG = { 'copy_id' : g.copy.id(), 'new_tab' : xulG.new_tab, 'url_prefix' : xulG.url_prefix };
70
71                 show_circs();
72
73             } catch(E) {
74                 g.error.standard_unexpected_error_alert('Error in circ_brief.xul, my_init()',E);
75             }
76         }
77
78         function show_circs() {
79             try {
80                 $('r_last').disabled = true; $('r_all').disabled = true;    
81                 g.circs = g.network.simple_request('FM_CIRC_RETRIEVE_VIA_COPY',
82                     [ ses(), g.copy_id ]);
83                 if (g.circs == null || typeof g.circs.ilsevent != 'undefined') throw(circs);
84                 if (g.circs.length == 0) return;
85                 //g.circs = g.circs.reverse(); /* put the most recent at the top */
86                 $('r_last').disabled = false; $('r_all').disabled = false;    
87
88                 var gb = $('circs');
89                 for (var j = 0; j < g.circs.length; j++) {
90                     var iframe = document.createElement('iframe');
91                     iframe.setAttribute('style','overflow: none; min-height: 100px;');
92                     iframe.setAttribute('flex','1');
93                     gb.appendChild(iframe);
94                     iframe.setAttribute('src', urls.XUL_CIRC_BRIEF); // + '?circ_id=' + g.circs[j].id() );
95                     get_contentWindow(iframe).xulG = { 'circ_id' : g.circs[j].id() };
96                 }
97             } catch(E) {
98                 g.error.standard_unexpected_error_alert('error showing circs',E);
99             }
100         }
101
102         function retrieve_last() {
103             try {
104                 //g.data.fancy_prompt_data = js2JSON( [ g.circs[0].usr() ] );
105                 //g.data.stash('fancy_prompt_data');
106                 xulG.retrieve_these_patrons = [ g.circs[0].usr() ];
107                 window.close();
108             } catch(E) {
109                 g.error.standard_unexpected_error_alert('retrieve_last',E);
110             }
111         }
112
113         function retrieve_all() {
114             try {
115                 var patrons = []; var p_hash = {};
116                 for (var i = 0; i < g.circs.length; i++) {
117                     var usr = g.circs[i].usr();
118                     if (typeof p_hash[usr] != 'undefined') { continue; }
119                     p_hash[usr] = true;
120                     patrons.push( function(a){return a;}(usr) );
121                 }
122                 //g.data.fancy_prompt_data = js2JSON(patrons);
123                 //g.data.stash('fancy_prompt_data');
124                 xulG.retrieve_these_patrons = patrons;
125                 window.close();
126             } catch(E) {
127                 g.error.standard_unexpected_error_alert('retrieve_all',E);
128             }
129         }
130
131     ]]>
132     </script>
133
134     <vbox flex="1" class="my_overflow">
135         <vbox id="top_vbox" flex="1" class="my_overflow" oils_persist="height"/>
136         <splitter id="splitter1" oils_persist="state hidden" oils_persist_peers="top_vbox mid_vbox"><grippy/></splitter>
137         <vbox id="mid_vbox" flex="1" class="my_overflow" oils_persist="height"/>
138         <splitter id="splitter2" oils_persist="state hidden" oils_persist_peers="mid_vbox circs"><grippy/></splitter>
139         <groupbox flex="1" id="circs" class="my_overflow" oils_persist="height">
140             <caption label="&staff.circ.circ_summary.caption;"/>
141         </groupbox>
142         <hbox>
143             <button id="r_last" label="&staff.circ.circ_summary.retrieve_last.label;" accesskey="&staff.circ.circ_summary.retrieve_last.accesskey;" oncommand="retrieve_last();"/>
144             <button id="r_all" label="&staff.circ.circ_summary.retrieve_all.label;" accesskey="&staff.circ.circ_summary.retrieve_all.accesskey;" oncommand="retrieve_all();"/>
145             <spacer flex="1"/>
146             <button label="&staff.circ.circ_summary.done.label;" accesskey="&staff.circ.circ_summary.done.accesskey;" oncommand="window.close();"/>
147         </hbox>
148     </vbox>
149
150 </window>
151