]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/web/conify/global/actor/org_unit.html
locale parsing based on URL knowledge (because apache is not helping); aou.name trans...
[Evergreen.git] / Open-ILS / web / conify / global / actor / org_unit.html
1 <!--
2 # Copyright (C) 2008  Georgia Public Library Service / Equinox Software, Inc
3 # Mike Rylander <miker@esilibrary.com>
4
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 -->
15 <html xmlns="http://www.w3.org/1999/xhtml">
16         <head>
17                 <title>Confiy :: Global :: Actor :: Org Units</title>
18
19                 <style type="text/css">
20                         @import url("/js/dojo/dojo/resources/dojo.css");
21                         @import url("/js/dojo/dijit/themes/tundra/tundra.css");
22                         @import url("/js/dojo/dojox/widget/Toaster/Toaster.css");
23                 </style>
24
25                 <style>
26                         html, body
27                         {
28                                 height: 100%;
29                                 width: 100%;
30                                 margin: 0px 0px 0px 0px;
31                                 padding: 0px 0px 0px 0px;
32                                 overflow: hidden;
33                         }
34
35                         th
36                         {
37                                 text-align: right;
38                                 font-weight: bold;
39                                 padding-left: 20px;
40                                 padding-right: 5px;
41                         }
42                 </style>
43
44                 <!-- The OpenSRF API writ JS -->
45                 <script language='javascript' src='/opac/common/js/utils.js' type='text/javascript'></script>
46                 <script language='javascript' src='/opac/common/js/Cookies.js' type='text/javascript'></script>
47                 <script language='javascript' src='/opac/common/js/CGI.js' type='text/javascript'></script>
48                 <script language='javascript' src='/opac/common/js/JSON_v1.js' type='text/javascript'></script>
49
50                 <!-- Fieldmapper objects -->
51                 <script language='javascript' src='/opac/common/js/fmall.js' type='text/javascript'></script>
52
53                 <!-- Dojo goodness -->
54                 <script type="text/javascript">
55                         var djConfig = { parseOnLoad : true };
56
57                         var _url_locale = location.href.replace(/^.*conify\/(.+)\/global.*$/, "$1").toLowerCase().replace(/-/,'_');
58                         if (_url_locale) djConfig.locale = _url_locale;
59                         else djConfig.locale = '<!--#echo var="locale"-->';
60
61                 </script>
62
63                 <script type="text/javascript" src="/js/dojo/dojo/dojo.js"></script>
64                 <script type="text/javascript" src="/js/dojo/dijit/dijit.js"></script>
65
66                 <script type="text/javascript" src="org_unit.js"></script>
67
68         </head>
69
70         <body class="tundra" id='pagebody'>
71
72                 <div dojoType="dijit.layout.SplitContainer" orientation="horizontal" style="height: 100%">
73
74                         <div dojoType="dijit.layout.ContentPane" sizeShare="100">
75                                 <script type="dojo/method">
76
77                                         var ou_list_data = { label : 'shortname', identifier : 'id' };
78                                         window.dirtyStore = [];
79                 
80                                         pCRUD.request({
81                                                 method : 'open-ils.permacrud.search.aou.atomic',
82                                                 timeout : 15,
83                                                 params : [ ses, { id : { "!=" : null } }, { order_by : { aou : 'shortname' } } ],
84                                                 onerror : function (r) { throw 'Problem fetching org units';},
85                                                 oncomplete : function (r) {
86                                                         window._ou_list = r.recv().content();
87                                                         window._ou_data = aou.toStoreData( window._ou_list );
88                                                         window.ou_list_store = new dojo.data.ItemFileWriteStore({ data : window._ou_data });
89
90                                                         window.ou_list_store.onSet = function (item, attr, o, n) {
91                                                                 if (attr == 'ischanged') return;
92                                                                 if (n == o) return;
93                                                                 this.setValue( item, 'ischanged', 1);
94                                                         };
95
96                                                         dojo.addOnUnload( function (event) {
97
98                                                                 ou_list_store.fetch({
99                                                                         query : { ischanged : 1 },
100                                                                         queryOptions : { deep : true },
101                                                                         onItem : function (item, req) { try { if (this.isItem( item )) window.dirtyStore.push( item ); } catch (e) { /* meh */ } },
102                                                                         scope : ou_list_store
103                                                                 });
104
105                                                                 if (dirtyStore.length > 0) {
106                                                                         var confirmation = confirm(
107                                                                                 'There are unsaved modified Organizational Units!  '+
108                                                                                 'OK to save these changes, Cancel to abandon them.'
109                                                                         );
110
111                                                                         if (confirmation) {
112                                                                                 for (var i in window.dirtyStore) {
113                                                                                         window.current_ou = window.dirtyStore[i];
114                                                                                         save_org(true);
115                                                                                 }
116                                                                         }
117                                                                 }
118
119                                                         });
120                                                 }
121                                         }).send();
122
123                     pCRUD.request({
124                         method : 'open-ils.permacrud.search.aout.atomic',
125                         timeout : 10,
126                         params : [ ses, { id : { "!=" : null } }, { order_by : { aout : 'depth' } } ],
127                         onerror : function (r) { status_update('Problem fetching types') },
128                         oncomplete : function (r) {
129                             window._ou_type_list = r.recv().content();
130                             window._ou_type_data = aout.toStoreData( window._ou_type_list );
131                             window.ou_type_store = new dojo.data.ItemFileReadStore({ data : window._ou_type_data });
132                         }
133                     }).send();
134
135                                         highlighter.ou_tree = {};
136                                         highlighter.editor_pane = {};
137                                         highlighter.hoo_pane = {};
138                                         highlighter.addresses_pane = {};
139
140                                         highlighter.ou_tree.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'ou_tree', duration : 500 } );
141                                         highlighter.ou_tree.red = dojox.fx.highlight( { color : '#FF2018', node : 'ou_tree', duration : 500 } );
142
143                                         highlighter.editor_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'editor_pane', duration : 500 } );
144                                         highlighter.editor_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'editor_pane', duration : 500 } );
145
146                                         highlighter.hoo_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'hoo_pane', duration : 500 } );
147                                         highlighter.hoo_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'hoo_pane', duration : 500 } );
148
149                                         highlighter.addresses_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'addresses_pane', duration : 500 } );
150                                         highlighter.addresses_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'addresses_pane', duration : 500 } );
151                                 </script>
152                                 <div
153                                   id="ou_tree"
154                                   label="Organizational Units"
155                                   query="{'_top':'true'}"
156                                   dojoType="dijit.Tree"
157                                   store="ou_list_store"
158                                   minSize="200"
159                                   jsId="ou_tree"
160                                 >
161
162                                         <script type="dojo/method" event="onClick" args="item,node">
163
164                                                 right_pane_toggler.show();
165
166                                                 current_ou = item;
167                                                 window.current_fm_ou = new aou().fromStoreItem(item);
168
169                                                 highlighter.editor_pane.green.play();
170                                                 status_update( 'Now editing ' + this.store.getValue( item, 'name' ) );
171
172                                                 new_kid_button.disabled = false;
173                                                 save_ou_button.disabled = false;
174                                                 delete_ou_button.disabled = false;
175
176                                                 dojo.byId('current_ou_name').innerHTML = this.store.getValue( current_ou, 'name' );
177
178                                                 var main_settings_fields = [ 'name', 'shortname', 'email', 'phone', 'ou_type' ];
179                                                 for ( var i in main_settings_fields ) {
180                                                         var field = main_settings_fields[i];
181                                                         var value = this.store.getValue( current_ou, field );
182
183                                                         if (!value) {
184                                                                 window["editor_pane_" + field].setValue( '' ); // unset the value
185                                                                 window["editor_pane_" + field].setDisplayedValue( '' ); // unset the value
186                                                         } else window["editor_pane_" + field].setValue( value );
187                                                 }
188
189                                                 if ( this.store.getValue( current_ou, '_trueRoot' ) == 'true' ) {
190                                                         editor_pane_parent_ou.disabled = true;
191                                                         editor_pane_parent_ou.setValue(null);
192                                                         editor_pane_parent_ou.setDisplayedValue('');
193                                                         editor_pane_parent_ou.validate(false);
194                                                 } else {
195                                                         editor_pane_parent_ou.disabled = false;
196                                                         editor_pane_parent_ou.validate(true);
197                                                         editor_pane_parent_ou.setValue( this.store.getValue( current_ou, 'parent_ou' ) );
198                                                 }
199
200                                                 editor_pane_opac_visible.setChecked( this.store.getValue( current_ou, 'opac_visible' ) == 't' ? true : false );
201
202                                                 hoo_load();
203                                                 addr_load();
204
205                                         </script>
206
207                                         <script type="dojo/method" event="getLabel" args="item,pI">
208                                                 var label = this.store.getValue(item,'shortname') + ' : ' + this.store.getValue(item,'name');
209                                                 if (this.store.getValue(item,'ischanged') == 1) label = '* ' + label;
210                                                 return label;
211                                         </script>
212
213                                 </div>
214                         </div>
215
216                         <div jsId="right_pane" id="right_pane" dojoType="dijit.layout.ContentPane"  sizeShare="200">
217                                 <script type="dojo/method">
218                                         window.right_pane_toggler = new dojo.fx.Toggler({ node: 'right_pane'});
219                                         window.right_pane_toggler.hide();
220                                 </script>
221
222                                 <div id="right_tabpane" dojoType="dijit.layout.TabContainer">
223         
224                                         <div id="editor_pane" dojoType="dijit.layout.ContentPane" title="Main Settings">
225
226                                                 <table class="tundra" style="margin:10px;">
227                                                         <tr>
228                                                                 <th>Org Unit Name</th>
229                                                                 <td>
230                                                                         <span id="editor_pane_name" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_name" regExp=".+" required="true">
231                                                                                 <script type="dojo/connect" event="onChange">
232                                                                                         if (current_ou) ou_list_store.setValue( current_ou, "name", this.getValue() );
233                                                                                 </script>
234                                                                         </span>
235                                                                         <span dojoType="openils.I18N.translationWidget" targetObject="current_fm_ou" field="name"></span>
236                                                                 </td>
237                                                         </tr>
238                                                         <tr>
239                                                                 <th>Org Unit Policy Code</th>
240                                                                 <td>
241                                                                         <span id="editor_pane_shortname" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_shortname" uppercase="true" regExp=".+" required="true">
242                                                                                 <script type="dojo/connect" event="onChange">
243                                                                                         if (current_ou) ou_list_store.setValue( current_ou, "shortname", this.getValue() );
244                                                                                 </script>
245                                                                         </span>
246                                                                 </td>
247                                                         </tr>
248                                                         <tr>
249                                                                 <th>Main Email Address</th>
250                                                                 <td>
251                                                                         <span id="editor_pane_email" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_email" regExp="^\w+\@\w+(?:\.\w+)+$">
252                                                                                 <script type="dojo/connect" event="onChange">
253                                                                                         if (current_ou) ou_list_store.setValue( current_ou, "email", this.getValue() );
254                                                                                 </script>
255                                                                         </span>
256                                                                 </td>
257                                                         </tr>
258                                                         <tr>
259                                                                 <th>Main Phone Number</th>
260                                                                 <td>
261                                                                         <span id="editor_pane_phone" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_phone" regExp="^(?:(?:\d{1}[ -\.])?\(?\d{3}\)?[ -\.]{1})?\d{3}[ -\.]{1}\d{4}(| \S+.*)$">
262                                                                                 <script type="dojo/connect" event="onChange">
263                                                                                         if (current_ou) ou_list_store.setValue( current_ou, "phone", this.getValue() );
264                                                                                 </script>
265                                                                         </span>
266                                                                 </td>
267                                                         </tr>
268                                                         <tr>
269                                                                 <th>Org Unit Type</th>
270                                                                 <td>
271                                                                         <div
272                                                                           id="editor_pane_ou_type"
273                                                                           dojoType="dijit.form.FilteringSelect"
274                                                                           jsId="editor_pane_ou_type"
275                                                                           store="ou_type_store"
276                                                                           searchAttr="name"
277                                                                           ignoreCase="true"
278                                                                           required="true"
279                                                                         >
280                                                                                 <script type="dojo/method" event="onChange">
281                                                                                         if (current_ou) ou_list_store.setValue( current_ou, "ou_type", this.getValue() );
282                                                                                 </script>
283                                                                         </div>
284                                                                 </td>
285                                                         </tr>
286                                                         <tr>
287                                                                 <th>Parent Org Unit</th>
288                                                                 <td>
289                                                                         <div
290                                                                           id="editor_pane_parent_ou"
291                                                                           dojoType="dijit.form.FilteringSelect"
292                                                                           jsId="editor_pane_parent_ou"
293                                                                           store="ou_list_store"
294                                                                           searchAttr="shortname"
295                                                                           ignoreCase="true"
296                                                                           required="true"
297                                                                         >
298                                                                                 <script type="dojo/method" event="onChange">
299                                                                                         if (current_ou && this.getValue()) this.store.setValue( current_ou, "parent_ou", this.getValue() );
300                                                                                         if ( this.store.getValue( current_ou, '_trueRoot' ) == 'true' ) this.required = false;
301                                                                                         else this.required = true;
302                                                                                 </script>
303                                                                         </div>
304                                                                 </td>
305                                                         </tr>
306                                                         <tr>
307                                                                 <th>OPAC Visible</th>
308                                                                 <td>
309                                                                         <input
310                                                                           id="editor_pane_opac_visible"
311                                                                           jsId="editor_pane_opac_visible"
312                                                                           type="checkbox"
313                                                                           dojoType="dijit.form.CheckBox"
314                                                                           onChange='if (current_ou) ou_list_store.setValue( current_ou, "opac_visible", this.checked ? "t" : "f" );'
315                                                                         />
316                                                                 </td>
317                                                         </tr>
318                                                 </table>
319         
320                                                 <div dojoType="dijit.layout.ContentPane" orientation="horizontal" style="margin-bottom: 20px;">
321         
322                                                         <button jsId="save_ou_button" dojoType="dijit.form.Button" label="Save" onClick="save_org()">
323                                                                 <script type="dojo/connect" event="startup">
324                                                                         this.disabled = true;
325                                                                 </script>
326                                                         </button>
327         
328                                                         <button jsId="delete_ou_button" dojoType="dijit.form.Button" label="Delete">
329                                                                 <script type="dojo/connect" event="startup">
330                                                                         this.disabled = true;
331                                                                 </script>
332                                                                 <script type="dojo/connect" event="onClick">
333         
334                                                                         var old_name = ou_list_store.getValue( current_ou, 'name' );
335
336                                                                         if (ou_list_store.getValue( current_ou, '_trueRoot' ) == 'true') {
337                                                                                 highlighter.editor_pane.red.play();
338                                                                                 status_update( 'Cannot delete' + ou_list_store.getValue( current_ou, 'name' ) + ', you need at least one.' );
339                                                                                 return false;
340                                                                         }
341
342                                                                         if ( current_ou.children ) {
343                                                                                 var kids = current_ou.children;
344                                                                                 if (!dojo.isArray(kids)) kids = [kids];
345         
346                                                                                 var existing_kids = dojo.filter(
347                                                                                         kids,
348                                                                                         function(kid){ return kid.isdeleted[0] != 1 }
349                                                                                 );
350                                                                                 if ( existing_kids.length > 0) {
351                                                                                         highlighter.editor_pane.red.play();
352                                                                                         status_update( 'Cannot delete' + ou_list_store.getValue( current_ou, 'name' ) + ', ' + existing_kids.length + ' subordinates still exist.' );
353                                                                                         return;
354                                                                                 }
355                                                                         }
356         
357                                                                         if ( confirm('Are you sure you want to delete ' + current_ou.name + '?')) {
358                                                                                 ou_list_store.setValue( current_ou, 'isdeleted', 1 );
359         
360                                                                                 var modified_ou = new aou().fromStoreItem( current_ou );
361                                                                                 modified_ou.isdeleted( 1 );
362         
363                                                                                 pCRUD.request({
364                                                                                         method : 'open-ils.permacrud.delete.aou',
365                                                                                         timeout : 10,
366                                                                                         params : [ ses, modified_ou ],
367                                                                                         onerror : function (r) {
368                                                                                                 highlighter.editor_pane.red.play();
369                                                                                                 status_update( 'Problem deleting ' + old_name );
370                                                                                         },
371                                                                                         oncomplete : function (r) {
372                                                                                                 var res = r.recv();
373                                                                                                 if ( res && res.content() ) {
374         
375                                                                                                         ou_list_store.fetch({
376                                                                                                                 query : { id : ou_list_store.getValue( current_ou, 'id' ) },
377                                                                                                                 queryOptions : { deep : true },
378                                                                                                                 onItem : function (item, req) { try { if (this.isItem( item )) this.deleteItem( item ); } catch (e) { /* meh */ } },
379                                                                                                                 scope : ou_list_store
380                                                                                                         });
381         
382                                                                                                         current_ou = null;
383         
384                                                                                                         new_kid_button.disabled = true;
385                                                                                                         save_ou_button.disabled = true;
386                                                                                                         delete_ou_button.disabled = true;
387                         
388                                                                                                         var main_settings_fields = [ 'name', 'shortname', 'email', 'phone', 'ou_type', 'parent_ou' ];
389                                                                                                         for ( var i in main_settings_fields ) {
390                                                                                                                 var field = main_settings_fields[i];
391                                                                                                                 window["editor_pane_" + field].setValue( '' ); // unset the value
392                                                                                                                 window["editor_pane_" + field].setDisplayedValue( '' ); // unset the value
393                                                                                                         }
394                         
395                                                                                                         highlighter.editor_pane.green.play();
396                                                                                                         status_update( old_name + ' deleted' );
397                                                                                                 } else {
398                                                                                                         highlighter.editor_pane.red.play();
399                                                                                                         status_update( 'Problem deleting ' + old_name );
400                                                                                                 }
401                                                                                         }
402                                                                                 }).send();
403         
404                                                                         }
405         
406                                                                 </script>
407                                                         </button>
408         
409                                                 </div>
410         
411                                                 <button jsId="new_kid_button" dojoType="dijit.form.Button" label="New Child">
412                                                         <script type="dojo/connect" event="startup">
413                                                                 this.disabled = true;
414                                                         </script>
415                                                         <script type="dojo/connect" event="onClick">
416         
417                                                                 var new_fm_obj = new aou().fromHash({
418                                                                         isnew                   : 1,
419                                                                         name                    : 'New Branch',
420                                                                         opac_visible    : 'f',
421                                                                         shortname               : ou_list_store.getValue( current_ou, 'shortname' ) + '-NEW' + virgin_ou_id--,
422                                                                         parent_ou               : ou_list_store.getValue( current_ou, 'id' ),
423                                                                         ou_type                 : ou_list_store.getValue( current_ou, 'ou_type' )
424                                                                 });
425         
426                                                                 var new_obj;
427         
428                                                                 pCRUD.request({
429                                                                         method : 'open-ils.permacrud.create.aou',
430                                                                         timeout : 10,
431                                                                         params : [ ses, new_fm_obj ],
432                                                                         onerror : function (r) {
433                                                                                 highlighter.editor_pane.red.play();
434                                                                                 status_update( 'Problem creating child Org Unit' );
435                                                                         },
436                                                                         oncomplete : function (r) {
437                                                                                 var res = r.recv();
438                                                                                 if ( res && res.content() ) {
439                                                                                         ou_list_store.newItem(
440                                                                                                 res.content().toHash(),
441                                                                                                 { parent : current_ou, attribute : 'children' }
442                                                                                         );
443                                                                                 } else {
444                                                                                         highlighter.editor_pane.red.play();
445                                                                                         status_update( 'Problem creating child Org Unit' );
446                                                                                 }
447                                                                         },
448                                                                 }).send();
449         
450                                                                 highlighter.editor_pane.green.play();
451                                                                 highlighter.ou_tree.green.play();
452                                                                 status_update( 'New child Organizational Unit created for ' + ou_list_store.getValue( current_ou, 'name' ) );
453         
454                                                         </script>
455                                                 </button>
456         
457                                         </div>
458
459                                         <div id="hoo_pane" dojoType="dijit.layout.ContentPane" title="Hours of Operation">
460                                                 <table class="tundra" style="margin:10px;">
461                                                         <tr><th/><th>Open time</th><th>Close time</th></tr>
462                                                         <tr><th>Monday</th>
463                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_0_open" onChange="current_ou_hoo.dow_0_open( this.getDisplayedValue() );"/></td>
464                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_0_close" onChange="current_ou_hoo.dow_0_close( this.getDisplayedValue() );"/></td>
465                                                                 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_0_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_0_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
466                                                         </tr>
467                                                         <tr><th>Tuesday</th>
468                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_1_open" onChange="current_ou_hoo.dow_1_open( this.getDisplayedValue() );"/></td>
469                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_1_close" onChange="current_ou_hoo.dow_1_close( this.getDisplayedValue() );"/></td>
470                                                                 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_1_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_1_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
471                                                         </tr>
472                                                         <tr><th>Wednesday</th>
473                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_2_open" onChange="current_ou_hoo.dow_2_open( this.getDisplayedValue() );"/></td>
474                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_2_close" onChange="current_ou_hoo.dow_2_close( this.getDisplayedValue() );"/></td>
475                                                                 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_2_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_2_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
476                                                         </tr>
477                                                         <tr><th>Thursday</th>
478                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_3_open" onChange="current_ou_hoo.dow_3_open( this.getDisplayedValue() );"/></td>
479                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_3_close" onChange="current_ou_hoo.dow_3_close( this.getDisplayedValue() );"/></td>
480                                                                 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_3_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_3_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
481                                                         </tr>
482                                                         <tr><th>Friday</th>
483                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_4_open" onChange="current_ou_hoo.dow_4_open( this.getDisplayedValue() );"/></td>
484                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_4_close" onChange="current_ou_hoo.dow_4_close( this.getDisplayedValue() );"/></td>
485                                                                 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_4_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_4_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
486                                                         </tr>
487                                                         <tr><th>Saturday</th>
488                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_5_open" onChange="current_ou_hoo.dow_5_open( this.getDisplayedValue() );"/></td>
489                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_5_close" onChange="current_ou_hoo.dow_5_close( this.getDisplayedValue() );"/></td>
490                                                                 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_5_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_5_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
491                                                         </tr>
492                                                         <tr><th>Sunday</th>
493                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_6_open" onChange="current_ou_hoo.dow_6_open( this.getDisplayedValue() );"/></td>
494                                                                 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_6_close" onChange="current_ou_hoo.dow_6_close( this.getDisplayedValue() );"/></td>
495                                                                 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_6_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_6_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
496                                                         </tr>
497                                                 </table>
498         
499                                                 <button jsId="save_hoo_button" dojoType="dijit.form.Button" label="Save">
500                                                         <script type="dojo/connect" event="onClick">
501         
502                                                                 var method_name = 'open-ils.permacrud.update.aouhoo';
503                                                                 if (current_ou_hoo.isnew() == 1) method_name = 'open-ils.permacrud.create.aouhoo';
504         
505                                                                 pCRUD.request({
506                                                                         method : method_name,
507                                                                         params : [ ses, current_ou_hoo ],
508                                                                         onerror : function (r) {
509                                                                                 highlighter.editor_pane.red.play();
510                                                                                 status_update( 'Problem saving Hours of Operation data for ' + ou_list_store.getValue( current_ou, 'name' ));
511                                                                         },
512                                                                         oncomplete : function (r) {
513                                                                                 var res = r.recv();
514                                                                                 if ( res && res.content() ) {
515                                                                                         current_ou_hoo.isnew(0);
516                                                                                         highlighter.editor_pane.green.play();
517                                                                                         status_update( 'Hours of Operation updated for ' + ou_list_store.getValue( current_ou, 'name' ) );
518                                                                                 } else {
519                                                                                         highlighter.editor_pane.red.play();
520                                                                                         status_update( 'Problem saving Hours of Operation data for ' + ou_list_store.getValue( current_ou, 'name' ));
521                                                                                 }
522                                                                         },
523                                                                 }).send();
524         
525                                                         </script>
526                                                 </button>
527         
528                                         </div>
529         
530                                         <div id="addresses_pane" dojoType="dijit.layout.ContentPane" title="Addresses">
531                                                 
532                                                 <div id="billing_address_pane" dojoType="dijit.layout.TabContainer" style="margin-top:10px">
533         
534                                                         <script type="dojo/method">
535                                                                 window.current_billing_address = null;
536                                                                 window.current_mailing_address = null;
537                                                                 window.current_holds_address = null;
538                                                                 window.current_ill_address = null;
539                                                         </script>
540         
541                                                         <div id="billing_address" dojoType="dijit.layout.ContentPane" title="Physical Address">
542                                                                 <table class="tundra" style="margin:10px;">
543                                                                         <tr>
544                                                                                 <th>Type</th>
545                                                                                 <td colspan="3">
546                                                                                         <span jsId="billing_addr_type" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_billing_address.address_type( this.getValue() )"/>
547                                                                                 </td>
548                                                                                 <th>Valid</th><td>
549                                                                                         <input
550                                                                                           type="checkbox"
551                                                                                           jsId="billing_addr_valid"
552                                                                                           dojoType="dijit.form.CheckBox"
553                                                                                           value='t'
554                                                                                           onChange='if (current_billing_address) current_billing_address.valid( this.checked ? "t" : "f" );'
555                                                                                         />
556                                                                                 </td>
557                                                                         </tr>
558                                                                         <tr>
559                                                                                 <th>Street 1</th><td colspan="5"><span jsId="billing_addr_street1" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_billing_address.street1( this.getValue() )" required="true"/></td>
560                                                                         </tr>
561                                                                         <tr>
562                                                                                 <th>Street 2</th><td colspan="5"><span jsId="billing_addr_street2" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_billing_address.street2( this.getValue() )"/></td>
563                                                                         </tr>
564                                                                         <tr>
565                                                                                 <th>City</th><td><span jsId="billing_addr_city" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_billing_address.city( this.getValue() )" required="true"/></td>
566                                                                                 <th>State</th><td><span jsId="billing_addr_state" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="2" maxSize="2" uppercase="true" onChange="current_billing_address.state( this.getValue() )" required="true"/></td>
567                                                                                 <th>Zip</th><td><span jsId="billing_addr_post_code" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="10" maxSize="10" regExp="^\d{5}(?:-\d{4})?$" uppercase="true" onChange="current_billing_address.post_code( this.getValue() )" required="true"/></td>
568                                                                         </tr>
569                                                                         <tr>
570                                                                                 <th>Country</th><td colspan="2"><span jsId="billing_addr_country" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_billing_address.country( this.getValue() )" required="true"/></td>
571                                                                                 <th>County</th><td colspan="2"><span jsId="billing_addr_county" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_billing_address.county( this.getValue() )" required="true"/></td>
572                                                                         </tr>
573                                                                 </table>
574         
575                                                                 <button jsId="save_billing_address" dojoType="dijit.form.Button" label="Save">
576                                                                         <script type="dojo/connect" event="startup">
577                                                                                 this.disabled = true;
578                                                                         </script>
579                                                                         <script type="dojo/connect" event="onClick">
580         
581                                                                                 var method_name = 'open-ils.permacrud.update.aoa';
582                                                                                 if (current_billing_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
583         
584                                                                                 pCRUD.request({
585                                                                                         method : method_name,
586                                                                                         params : [ ses, current_billing_address ],
587                                                                                         onerror : function (r) {
588                                                                                                 highlighter.addresses_pane.red.play();
589                                                                                                 status_update( 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' ) );
590                                                                                         },
591                                                                                         oncomplete : function (r) {
592                                                                                                 var res = r.recv();
593                                                                                                 if ( res && res.content() ) {
594                                                                                                         if (current_billing_address.isnew() == 1) {
595                                                                                                                 current_billing_address = res.content();
596                                                                                                                 ou_list_store.setValue( current_ou, 'billing_address', current_billing_address.id() );
597                                                                                                                 save_org();
598                                                                                                         }
599                                                                                                         current_billing_address.isnew(0);
600                                                                                                         highlighter.addresses_pane.green.play();
601                                                                                                         status_update( 'Changes to the Physical Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
602                                                                                                 } else {
603                                                                                                         highlighter.addresses_pane.red.play();
604                                                                                                         status_update( 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' ) );
605                                                                                                 }
606                                                                                         },
607                                                                                 }).send();
608         
609                                                                         </script>
610                                                                 </button>
611                                                         </div>
612
613                                                         <div id="holds_address" dojoType="dijit.layout.ContentPane" title="Holds Address">
614                                                                 <table class="tundra" style="margin:10px;">
615                                                                         <tr>
616                                                                                 <th>Type</th><td colspan="3"><span jsId="holds_addr_type" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_holds_address.address_type( this.getValue() )"/></td>
617                                                                                 <th>Valid</th><td>
618                                                                                         <input
619                                                                                           type="checkbox"
620                                                                                           jsId="holds_addr_valid"
621                                                                                           dojoType="dijit.form.CheckBox"
622                                                                                           value='t'
623                                                                                           onChange='if (current_holds_address) current_holds_address.valid( this.checked ? "t" : "f" );'
624                                                                                         />
625                                                                                 </td>
626                                                                         </tr>
627                                                                         <tr>
628                                                                                 <th>Street 1</th><td colspan="5"><span jsId="holds_addr_street1" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_holds_address.street1( this.getValue() )" required="true"/></td>
629                                                                         </tr>
630                                                                         <tr>
631                                                                                 <th>Street 2</th><td colspan="5"><span jsId="holds_addr_street2" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_holds_address.street2( this.getValue() )"/></td>
632                                                                         </tr>
633                                                                         <tr>
634                                                                                 <th>City</th><td><span jsId="holds_addr_city" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_holds_address.city( this.getValue() )" required="true"/></td>
635                                                                                 <th>State</th><td><span jsId="holds_addr_state" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="2" maxSize="2" uppercase="true" onChange="current_holds_address.state( this.getValue() )" required="true"/></td>
636                                                                                 <th>Zip</th><td><span jsId="holds_addr_post_code" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="10" maxSize="10" regExp="^\d{5}(?:-\d{4})?$" uppercase="true" onChange="current_holds_address.post_code( this.getValue() )" required="true"/></td>
637                                                                         </tr>
638                                                                         <tr>
639                                                                                 <th>Country</th><td colspan="2"><span jsId="holds_addr_country" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_holds_address.country( this.getValue() )" required="true"/></td>
640                                                                                 <th>County</th><td colspan="2"><span jsId="holds_addr_county" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_holds_address.county( this.getValue() )" required="true"/></td>
641                                                                         </tr>
642                                                                 </table>
643         
644                                                                 <button jsId="save_holds_address" dojoType="dijit.form.Button" label="Save">
645                                                                         <script type="dojo/connect" event="startup">
646                                                                                 this.disabled = true;
647                                                                         </script>
648                                                                         <script type="dojo/connect" event="onClick">
649         
650                                                                                 var method_name = 'open-ils.permacrud.update.aoa';
651                                                                                 if (current_holds_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
652         
653                                                                                 pCRUD.request({
654                                                                                         method : method_name,
655                                                                                         params : [ ses, current_holds_address ],
656                                                                                         onerror : function (r) {
657                                                                                                 highlighter.addresses_pane.red.play();
658                                                                                                 throw 'Problem saving Holds Address data for ' + ou_list_store.getValue( current_ou, 'name' );
659                                                                                         },
660                                                                                         oncomplete : function (r) {
661                                                                                                 var res = r.recv();
662                                                                                                 if ( res && res.content() ) {
663                                                                                                         if (current_holds_address.isnew() == 1) {
664                                                                                                                 current_holds_address = res.content();
665                                                                                                                 ou_list_store.setValue( current_ou, 'holds_address', current_holds_address.id() );
666                                                                                                                 save_org();
667                                                                                                         }
668                                                                                                         current_holds_address.isnew(0);
669                                                                                                         highlighter.addresses_pane.green.play();
670                                                                                                         status_update( 'Changes to the Holds Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
671                                                                                                 } else {
672                                                                                                         highlighter.addresses_pane.red.play();
673                                                                                                         throw 'Problem saving Holds Address data for ' + ou_list_store.getValue( current_ou, 'name' );
674                                                                                                 }
675                                                                                         },
676                                                                                 }).send();
677         
678                                                                         </script>
679                                                                 </button>
680                                                         </div>
681
682                                                         <div id="mailing_address" dojoType="dijit.layout.ContentPane" title="Mailing Address">
683                                                                 <table class="tundra" style="margin:10px;">
684                                                                         <tr>
685                                                                                 <th>Type</th><td colspan="3"><span jsId="mailing_addr_type" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_mailing_address.address_type( this.getValue() )"/></td>
686                                                                                 <th>Valid</th><td>
687                                                                                         <input
688                                                                                           type="checkbox"
689                                                                                           jsId="mailing_addr_valid"
690                                                                                           dojoType="dijit.form.CheckBox"
691                                                                                           onChange='if (current_mailing_address) current_mailing_address.valid( this.checked ? "t" : "f" );'
692                                                                                         />
693                                                                                 </td>
694                                                                         </tr>
695                                                                         <tr>
696                                                                                 <th>Street 1</th><td colspan="5"><span jsId="mailing_addr_street1" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_mailing_address.street1( this.getValue() )" required="true"/></td>
697                                                                         </tr>
698                                                                         <tr>
699                                                                                 <th>Street 2</th><td colspan="5"><span jsId="mailing_addr_street2" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_mailing_address.street2( this.getValue() )"/></td>
700                                                                         </tr>
701                                                                         <tr>
702                                                                                 <th>City</th><td><span jsId="mailing_addr_city" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_mailing_address.city( this.getValue() )" required="true"/></td>
703                                                                                 <th>State</th><td><span jsId="mailing_addr_state" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="2" maxSize="2" uppercase="true" onChange="current_mailing_address.state( this.getValue() )" required="true"/></td>
704                                                                                 <th>Zip</th><td><span jsId="mailing_addr_post_code" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="10" maxSize="10" regExp="^\d{5}(?:-\d{4})?$" uppercase="true" onChange="current_mailing_address.post_code( this.getValue() )" required="true"/></td>
705                                                                         </tr>
706                                                                         <tr>
707                                                                                 <th>Country</th><td colspan="2"><span jsId="mailing_addr_country" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_mailing_address.country( this.getValue() )" required="true"/></td>
708                                                                                 <th>County</th><td colspan="2"><span jsId="mailing_addr_county" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_mailing_address.county( this.getValue() )" required="true"/></td>
709                                                                         </tr>
710                                                                 </table>
711         
712                                                                 <button jsId="save_mailing_address" dojoType="dijit.form.Button" label="Save">
713                                                                         <script type="dojo/connect" event="startup">
714                                                                                 this.disabled = true;
715                                                                         </script>
716                                                                         <script type="dojo/connect" event="onClick">
717         
718                                                                                 var method_name = 'open-ils.permacrud.update.aoa';
719                                                                                 if (current_mailing_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
720         
721                                                                                 pCRUD.request({
722                                                                                         method : method_name,
723                                                                                         params : [ ses, current_mailing_address ],
724                                                                                         onerror : function (r) {
725                                                                                                 highlighter.addresses_pane.red.play();
726                                                                                                 throw 'Problem saving Mailing Address data for ' + ou_list_store.getValue( current_ou, 'name' );
727                                                                                         },
728                                                                                         oncomplete : function (r) {
729                                                                                                 var res = r.recv();
730                                                                                                 if ( res && res.content() ) {
731                                                                                                         if (current_mailing_address.isnew() == 1) {
732                                                                                                                 current_mailing_address = res.content();
733                                                                                                                 ou_list_store.setValue( current_ou, 'mailing_address', current_mailing_address.id() );
734                                                                                                                 save_org();
735                                                                                                         }
736                                                                                                         current_mailing_address.isnew(0);
737                                                                                                         highlighter.addresses_pane.green.play();
738                                                                                                         status_update( 'Changes to the Mailing Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
739                                                                                                 } else {
740                                                                                                         highlighter.addresses_pane.red.play();
741                                                                                                         throw 'Problem saving Mailing Address data for ' + ou_list_store.getValue( current_ou, 'name' );
742                                                                                                 }
743                                                                                         },
744                                                                                 }).send();
745         
746                                                                         </script>
747                                                                 </button>
748                                                         </div>
749
750                                                         <div id="ill_address" dojoType="dijit.layout.ContentPane" title="ILL Address">
751                                                                 <table class="tundra" style="margin:10px;">
752                                                                         <tr>
753                                                                                 <th>Type</th><td colspan="3"><span jsId="ill_addr_type" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_ill_address.address_type( this.getValue() )"/></td>
754                                                                                 <th>Valid</th><td>
755                                                                                         <input
756                                                                                           type="checkbox"
757                                                                                           jsId="ill_addr_valid"
758                                                                                           dojoType="dijit.form.CheckBox"
759                                                                                           onChange='if (current_ill_address) current_ill_address.valid( this.checked ? "t" : "f" );'
760                                                                                         />
761                                                                                 </td>
762                                                                         </tr>
763                                                                         <tr>
764                                                                                 <th>Street 1</th><td colspan="5"><span jsId="ill_addr_street1" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_ill_address.street1( this.getValue() )" required="true"/></td>
765                                                                         </tr>
766                                                                         <tr>
767                                                                                 <th>Street 2</th><td colspan="5"><span jsId="ill_addr_street2" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_ill_address.street2( this.getValue() )"/></td>
768                                                                         </tr>
769                                                                         <tr>
770                                                                                 <th>City</th><td><span jsId="ill_addr_city" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_ill_address.city( this.getValue() )" required="true"/></td>
771                                                                                 <th>State</th><td><span jsId="ill_addr_state" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="2" maxSize="2" uppercase="true" onChange="current_ill_address.state( this.getValue() )" required="true"/></td>
772                                                                                 <th>Zip</th><td><span jsId="ill_addr_post_code" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="10" maxSize="10" regExp="^\d{5}(?:-\d{4})?$" uppercase="true" onChange="current_ill_address.post_code( this.getValue() )" required="true"/></td>
773                                                                         </tr>
774                                                                         <tr>
775                                                                                 <th>Country</th><td colspan="2"><span jsId="ill_addr_country" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_ill_address.country( this.getValue() )" required="true"/></td>
776                                                                                 <th>County</th><td colspan="2"><span jsId="ill_addr_county" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_ill_address.county( this.getValue() )" required="true"/></td>
777                                                                         </tr>
778                                                                 </table>
779         
780                                                                 <button jsId="save_ill_address" dojoType="dijit.form.Button" label="Save">
781                                                                         <script type="dojo/connect" event="startup">
782                                                                                 this.disabled = true;
783                                                                         </script>
784                                                                         <script type="dojo/connect" event="onClick">
785         
786                                                                                 var method_name = 'open-ils.permacrud.update.aoa';
787                                                                                 if (current_ill_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
788         
789                                                                                 pCRUD.request({
790                                                                                         method : method_name,
791                                                                                         params : [ ses, current_ill_address ],
792                                                                                         onerror : function (r) {
793                                                                                                 highlighter.addresses_pane.red.play();
794                                                                                                 throw 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' );
795                                                                                         },
796                                                                                         oncomplete : function (r) {
797                                                                                                 var res = r.recv();
798                                                                                                 if ( res && res.content() ) {
799                                                                                                         if (current_ill_address.isnew() == 1) {
800                                                                                                                 current_ill_address = res.content();
801                                                                                                                 ou_list_store.setValue( current_ou, 'ill_address', current_ill_address.id() );
802                                                                                                                 save_org();
803                                                                                                         }
804                                                                                                         current_ill_address.isnew(0);
805                                                                                                         highlighter.addresses_pane.green.play();
806                                                                                                         status_update( 'Changes to the ILL Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
807                                                                                                 } else {
808                                                                                                         highlighter.addresses_pane.red.play();
809                                                                                                         throw 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' );
810                                                                                                 }
811                                                                                         },
812                                                                                 }).send();
813         
814                                                                         </script>
815                                                                 </button>
816                                                         </div>
817                                                 </div>
818                                         </div>
819                                 </div>
820                         </div>
821                 </div>
822
823                 <div id="status_bar"><span style="font-weight: bold; margin: 5px; margin-right: 10px;">Now editing:</span><span id="current_ou_name"></span></div>
824         </body>
825 </html>