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="patron_info_stat_cats_win" width="700" height="550"
23 onload="try{ my_init(); } catch(E) { alert(E); }"
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'); JSAN.use('util.functional');
47 JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
49 g.error.sdump('D_TRACE','my_init() for patron_info_stat_cats.xul');
52 g.patron_id = g.cgi.param('patron_id');
57 var err_msg = "!! This software has encountered an error. Please tell your friendly " +
58 "system administrator or software developer the following:\npatron_info_stat_cats.xul\n" + E + '\n';
59 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
65 retrieve_fleshed_patron(); render_stat_cats();
68 function retrieve_fleshed_patron() {
71 g.patron = patron.util.retrieve_fleshed_au_via_id(ses(), g.patron_id);
72 if (g.patron.ilsevent) throw(g.patron);
75 g.error.standard_unexpected_error_alert('Failed to retrieve patron stat cats.',E);
81 function apply(node,field,value) {
86 case 'description' : n.appendChild( document.createTextNode( value ) ); break;
87 case 'label' : n.value = value; break;
88 default : n.value = value; break;
94 function render_stat_cats() {
95 JSAN.use('util.widgets'); util.widgets.remove_children('stat_cats_panel');
96 if (!g.patron) return;
97 var sp = $('stat_cats_panel');
98 var my_actsc = g.data.list.my_actsc;
99 /* I'm throwing all the patron's stat cat entry maps in here, and pruning it as we go through my_actsc. Those left behind are "foreign" stat cats that need to pulled from the server. */
101 for (var i = 0; i < g.patron.stat_cat_entries().length; i++) {
102 scem_hash[ g.patron.stat_cat_entries()[i].stat_cat() ] = function(a){ return g.patron.stat_cat_entries()[a]; }(i);
105 for (var i = 0; i < my_actsc.length; i++) {
108 var actsc_node = $('actsc_template').cloneNode(true); sp.appendChild(actsc_node); actsc_node.hidden = false;
109 apply(actsc_node,'name',my_actsc[i].name());
110 apply(actsc_node,'opac',my_actsc[i].opac_visible() ? 'OPAC Visible' : 'Not OPAC Visible');
111 apply(actsc_node,'owner',g.data.hash.aou[my_actsc[i].owner()].shortname());
113 var nl = actsc_node.getElementsByAttribute('name','entry');
114 var entry_placeholder;
115 if (nl.length>0) entry_placeholder = nl[0];
117 if (entry_placeholder && scem_hash[ my_actsc[i].id() ]) {
120 var actsce_node = $('actsce_template').cloneNode(true); entry_placeholder.appendChild(actsce_node); actsce_node.hidden = false;
121 var sc_id = my_actsc[i].id();
122 var scem = scem_hash[ sc_id ];
123 apply(actsce_node,'value',scem.stat_cat_entry());
124 delete scem_hash[ sc_id ];
129 for (var i in scem_hash) {
133 var sc_id = scem_hash[i].stat_cat();
134 if (sc_id == null || sc_id == '') throw(scem_hash[i]);
135 var sc = g.network.simple_request('FM_ACTSC_RETRIEVE_BATCH', [ ses(), [ sc_id ] ]);
136 if (!sc || typeof sc.ilsevent != 'undefined') { throw(sc); continue; }
140 var actsc_node = $('actsc_template').cloneNode(true); sp.appendChild(actsc_node); actsc_node.hidden = false;
141 apply(actsc_node,'name',sc.name());
142 apply(actsc_node,'opac',sc.opac_visible() ? 'OPAC Visible' : 'Not OPAC Visible');
143 apply(actsc_node,'owner',g.data.hash.aou[sc.owner()].shortname());
145 var nl = actsc_node.getElementsByAttribute('name','entry');
146 var entry_placeholder;
147 if (nl.length>0) entry_placeholder = nl[0];
149 if (entry_placeholder) {
152 var actsce_node = $('actsce_template').cloneNode(true); entry_placeholder.appendChild(actsce_node); actsce_node.hidden = false;
153 var scem = scem_hash[ i ];
154 apply(actsce_node,'value',scem.stat_cat_entry());
159 g.error.standard_unexpected_error_alert('rendering/retrieving stat cat',E);
167 <stack hidden="true" id="actsc_template" flex="1">
168 <groupbox flex="1" style="background-color: black;"/>
169 <groupbox flex="1" style="background-color: #99CC66; -moz-border-radius-topright: 35px;" >
171 <description name="name" style="font-weight: bold"/>
173 <description name="opac" style="font-weight: bold"/>
174 <description name="owner" style="font-weight: bold"/>
180 <hbox hidden="true" id="actsce_template" flex="1">
181 <description name="value"/>
184 <vbox flex="1" class="my_overflow" id="stat_cats_panel">