2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Patron Display -->
5 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
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"?>
12 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
14 <!DOCTYPE window PUBLIC "" ""[
15 <!--#include virtual="/opac/locale/en-US/lang.dtd"-->
18 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
20 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
22 <window id="hold_notices_win" width="700" height="550"
23 onload="try{ my_init(); font_helper(); } catch(E) { alert(E); }" title="Hold Notices"
24 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
26 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
28 <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};</script>
29 <scripts id="openils_util_scripts"/>
31 <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
35 function $(id) { return document.getElementById(id); }
39 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
40 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
41 JSAN.errorLevel = "die"; // none, warn, or die
42 JSAN.addRepository('/xul/server/');
44 JSAN.use('util.error'); g.error = new util.error();
45 JSAN.use('util.network'); g.network = new util.network();
46 JSAN.use('util.date'); JSAN.use('util.money'); JSAN.use('patron.util');
47 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
49 g.error.sdump('D_TRACE','my_init() for hold_notices.xul');
51 g.ahr_id = xul_param('ahr_id');
52 g.ahr = g.network.simple_request('FM_AHR_RETRIEVE',[ ses(), g.ahr_id ]);
53 if (typeof g.ahr.ilsevent != 'undefined') { throw(g.ahr); }
60 document.getElementById('bib_brief').setAttribute('src',urls.XUL_BIB_BRIEF); // + '?docid=' + g.ahr.target());
61 document.getElementById('bib_brief').contentWindow.xulG = { 'docid' : g.ahr.target() };
66 try { g.error.standard_unexpected_error_alert('/xul/server/patron/hold_notices.xul',E); } catch(E) { alert('FIXME: ' + js2JSON(E)); }
70 function render_patron() {
72 JSAN.use('patron.util');
73 var au_obj = patron.util.retrieve_fleshed_au_via_id( ses(), g.ahr.usr() );
75 $('patron_name').setAttribute('value',
76 ( au_obj.prefix() ? au_obj.prefix() + ' ' : '') +
77 au_obj.family_name() + ', ' +
78 au_obj.first_given_name() + ' ' +
79 ( au_obj.second_given_name() ? au_obj.second_given_name() + ' ' : '' ) +
80 ( au_obj.suffix() ? au_obj.suffix() : '')
81 + ' : ' + au_obj.card().barcode()
86 function a_list_of_one() {
87 JSAN.use('circ.util');
88 var columns = circ.util.hold_columns(
90 'status' : { 'hidden' : true },
91 'request_time' : { 'hidden' : false },
92 'pickup_lib_shortname' : { 'hidden' : false },
93 'current_copy' : { 'hidden' : false },
94 'phone_notify' : { 'hidden' : false },
95 'email_notify' : { 'hidden' : false },
98 JSAN.use('util.list'); g.list = new util.list('holds_list');
102 'map_row_to_columns' : circ.util.std_map_row_to_columns(),
103 'retrieve_row' : function(params) {
104 var row = params.row;
106 switch(row.my.ahr.hold_type()) {
108 row.my.mvr = g.network.request(
109 api.MODS_SLIM_METARECORD_RETRIEVE.app,
110 api.MODS_SLIM_METARECORD_RETRIEVE.method,
111 [ row.my.ahr.target() ]
115 row.my.mvr = g.network.request(
116 api.MODS_SLIM_RECORD_RETRIEVE.app,
117 api.MODS_SLIM_RECORD_RETRIEVE.method,
118 [ row.my.ahr.target() ]
120 if (row.my.ahr.current_copy()) {
121 row.my.acp = g.network.simple_request( 'FM_ACP_RETRIEVE', [ row.my.ahr.current_copy() ]);
126 g.error.sdump('D_ERROR','retrieve_row: ' + E );
128 if (typeof params.on_retrieve == 'function') {
129 params.on_retrieve(row);
142 'no_auto_select' : true,
148 retrieve_notifications(); render_notifications();
151 function retrieve_notifications() {
152 g.notifications = g.network.simple_request('FM_AHN_RETRIEVE_VIA_AHR',[ ses(), g.ahr_id ]).reverse();
155 function apply(node,field,value) {
160 case 'description' : n.appendChild( document.createTextNode( value ) ); break;
161 case 'label' : n.value = value; break;
162 default : n.value = value; break;
168 function render_notifications() {
169 JSAN.use('util.widgets'); util.widgets.remove_children('notifications_panel');
170 var np = $('notifications_panel');
172 for (var i = 0; i < g.notifications.length; i++) {
175 var node = $('notification_template').cloneNode(true); np.appendChild(node); node.hidden = false;
176 util.widgets.apply(node,'name','notify_time',
177 function(n){n.setAttribute("tooltiptext","ID: " + g.notifications[i].id() + " Hold ID: " + g.notifications[i].hold() + " Notifying Staff ID: " + g.notifications[i].notify_staff());}
179 apply(node,'method',g.notifications[i].method ? g.notifications[i].method() : '');
180 apply(node,'note',g.notifications[i].note() ? g.notifications[i].note() : '');
181 apply(node,'notify_time',g.notifications[i].notify_time() ? g.notifications[i].notify_time().toString().substr(0,10) : '');
186 function new_notification() {
188 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
189 var xml = '<groupbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1">';
190 xml += '<caption label="New Notification Record"/><grid flex="1"><columns><column/><column flex="1"/></columns><rows>';
191 xml += '<row><label value="Method"/><textbox id="method" name="fancy_data"/></row>';
192 xml += '<row><label value="Note"/><textbox multiline="true" id="note" name="fancy_data"/></row>';
193 xml += '<row><spacer/><hbox><button label="Cancel" name="fancy_cancel" accesskey="C"/>';
194 xml += '<button label="Add Notification Record" accesskey="A" name="fancy_submit"/></hbox></row></rows></grid></groupbox>';
195 //g.data.init({'via':'stash'});
196 //g.data.temp_notification_xml = xml; g.data.stash('temp_notification_xml');
197 JSAN.use('util.window'); var win = new util.window();
198 var fancy_prompt_data = window.open(
199 urls.XUL_FANCY_PROMPT,
200 //+ '?xml_in_stash=temp_notification_xml'
201 //+ '&focus=' + window.escape('method')
202 //+ '&title=' + window.escape('Add Notification Record'),
203 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
204 { 'xml' : xml, 'focus' : 'method', 'title' : 'Add Notification Record' }
206 if (fancy_prompt_data.fancy_status == 'complete') {
207 var notification = new ahn();
208 notification.isnew(1);
209 notification.hold(g.ahr_id);
210 notification.method( fancy_prompt_data.method );
211 notification.note( fancy_prompt_data.note );
212 var r = g.network.simple_request('FM_AHN_CREATE',[ ses(), notification ]); if (typeof r.ilsevent != 'undefined') throw(r);
213 setTimeout(function(){refresh();},0);
216 g.error.standard_unexpected_error_alert('The notification was not likely created.',E);
217 setTimeout(function(){refresh();},0);
224 <stack hidden="true" id="notification_template" flex="1">
225 <groupbox flex="1" style="background-color: black;"/>
226 <groupbox flex="1" style="background-color: #FFDE00; -moz-border-radius-topright: 35px;" >
228 <description name="method" label="Method:" style="font-weight: bold"/>
230 <description name="notify_time" style="font-weight: bold"/>
232 <description name="note"/>
236 <vbox id="top_panel" flex="1">
237 <label id="patron_name" class="patronNameLarge"/>
238 <iframe id="bib_brief" flex="2"/>
239 <vbox flex="1" style="min-height: 30px">
240 <tree id="holds_list" flex="1" enableColumnDrag="true" style=""/>
243 <button label="Add Record of Notification" accesskey="A" oncommand="new_notification()"/>
245 <button label="Close" accesskey="C" oncommand="window.close()"/>
249 <vbox flex="9" class="my_overflow" id="notifications_panel">