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(); font_helper(); } 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');
51 g.patron_id = xul_param('patron_id');
56 var err_msg = "!! This software has encountered an error. Please tell your friendly " +
57 "system administrator or software developer the following:\npatron_info_stat_cats.xul\n" + E + '\n';
58 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
64 retrieve_fleshed_patron(); render_stat_cats();
67 function retrieve_fleshed_patron() {
70 g.patron = patron.util.retrieve_fleshed_au_via_id(ses(), g.patron_id);
71 if (g.patron.ilsevent) throw(g.patron);
74 g.error.standard_unexpected_error_alert('Failed to retrieve patron stat cats.',E);
80 function apply(node,field,value) {
85 case 'description' : n.appendChild( document.createTextNode( value ) ); break;
86 case 'label' : n.value = value; break;
87 default : n.value = value; break;
93 function render_stat_cats() {
94 JSAN.use('util.widgets'); util.widgets.remove_children('stat_cats_panel');
95 if (!g.patron) return;
96 var sp = $('stat_cats_panel');
97 var my_actsc = g.data.list.my_actsc;
98 /* 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. */
100 for (var i = 0; i < g.patron.stat_cat_entries().length; i++) {
101 scem_hash[ g.patron.stat_cat_entries()[i].stat_cat() ] = function(a){ return g.patron.stat_cat_entries()[a]; }(i);
104 for (var i = 0; i < my_actsc.length; i++) {
107 var actsc_node = $('actsc_template').cloneNode(true); sp.appendChild(actsc_node); actsc_node.hidden = false;
108 apply(actsc_node,'name',my_actsc[i].name());
109 apply(actsc_node,'opac',my_actsc[i].opac_visible() ? 'OPAC Visible' : 'Not OPAC Visible');
110 apply(actsc_node,'owner',g.data.hash.aou[my_actsc[i].owner()].shortname());
112 var nl = actsc_node.getElementsByAttribute('name','entry');
113 var entry_placeholder;
114 if (nl.length>0) entry_placeholder = nl[0];
116 if (entry_placeholder && scem_hash[ my_actsc[i].id() ]) {
119 var actsce_node = $('actsce_template').cloneNode(true); entry_placeholder.appendChild(actsce_node); actsce_node.hidden = false;
120 var sc_id = my_actsc[i].id();
121 var scem = scem_hash[ sc_id ];
122 apply(actsce_node,'value',scem.stat_cat_entry());
123 delete scem_hash[ sc_id ];
128 for (var i in scem_hash) {
132 var sc_id = scem_hash[i].stat_cat();
133 if (sc_id == null || sc_id == '') throw(scem_hash[i]);
134 var sc = g.network.simple_request('FM_ACTSC_RETRIEVE_BATCH', [ ses(), [ sc_id ] ]);
135 if (!sc || typeof sc.ilsevent != 'undefined') { throw(sc); continue; }
139 var actsc_node = $('actsc_template').cloneNode(true); sp.appendChild(actsc_node); actsc_node.hidden = false;
140 apply(actsc_node,'name',sc.name());
141 apply(actsc_node,'opac',sc.opac_visible() ? 'OPAC Visible' : 'Not OPAC Visible');
142 apply(actsc_node,'owner',g.data.hash.aou[sc.owner()].shortname());
144 var nl = actsc_node.getElementsByAttribute('name','entry');
145 var entry_placeholder;
146 if (nl.length>0) entry_placeholder = nl[0];
148 if (entry_placeholder) {
151 var actsce_node = $('actsce_template').cloneNode(true); entry_placeholder.appendChild(actsce_node); actsce_node.hidden = false;
152 var scem = scem_hash[ i ];
153 apply(actsce_node,'value',scem.stat_cat_entry());
158 g.error.standard_unexpected_error_alert('rendering/retrieving stat cat',E);
166 <stack hidden="true" id="actsc_template" flex="1">
167 <groupbox flex="1" style="background-color: black;"/>
168 <groupbox flex="1" style="background-color: #99CC66; -moz-border-radius-topright: 35px;" >
170 <description name="name" style="font-weight: bold"/>
172 <description name="opac" style="font-weight: bold"/>
173 <description name="owner" style="font-weight: bold"/>
179 <hbox hidden="true" id="actsce_template" flex="1">
180 <description name="value"/>
183 <vbox flex="1" class="my_overflow" id="stat_cats_panel">