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