2 # Copyright (C) 2008 Georgia Public Library Service / Equinox Software, Inc
3 # Mike Rylander <miker@esilibrary.com>
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.
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.
15 <html xmlns="http://www.w3.org/1999/xhtml">
17 <title>Confiy :: Global :: Actor :: Org Units</title>
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");
30 margin: 0px 0px 0px 0px;
31 padding: 0px 0px 0px 0px;
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>
50 <!-- Dojo goodness -->
51 <script type="text/javascript" src="../admin.js"></script>
53 <script type="text/javascript" src="/js/dojo/dojo/dojo.js"></script>
54 <script type="text/javascript" src="/js/dojo/dijit/dijit.js"></script>
56 <script type="text/javascript" src="org_unit.js"></script>
60 <body class="tundra" id='pagebody'>
62 <div dojoType="dijit.layout.SplitContainer" orientation="horizontal" style="height: 100%">
64 <div dojoType="dijit.layout.ContentPane" sizeShare="100">
65 <script type="dojo/method">
67 var ou_list_data = { label : 'shortname', identifier : 'id' };
68 window.dirtyStore = [];
71 method : 'open-ils.permacrud.search.aou.atomic',
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 });
80 window.ou_list_store.onSet = function (item, attr, o, n) {
81 if (attr == 'ischanged') return;
83 this.setValue( item, 'ischanged', 1);
86 dojo.addOnUnload( function (event) {
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 */ } },
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.'
102 for (var i in window.dirtyStore) {
103 window.current_ou = window.dirtyStore[i];
114 method : 'open-ils.permacrud.search.aout.atomic',
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 });
125 highlighter.ou_tree = {};
126 highlighter.editor_pane = {};
127 highlighter.hoo_pane = {};
128 highlighter.addresses_pane = {};
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 } );
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 } );
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 } );
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 } );
144 label="Organizational Units"
145 query="{'_top':'true'}"
146 dojoType="dijit.Tree"
147 store="ou_list_store"
152 <script type="dojo/method" event="onClick" args="item,node">
154 right_pane_toggler.show();
157 window.current_fm_ou = new aou().fromStoreItem(item);
159 highlighter.editor_pane.green.play();
160 status_update( 'Now editing ' + this.store.getValue( item, 'name' ) );
162 new_kid_button.disabled = false;
163 save_ou_button.disabled = false;
164 delete_ou_button.disabled = false;
166 dojo.byId('current_ou_name').innerHTML = this.store.getValue( current_ou, 'name' );
168 var main_settings_fields = [ 'name', 'shortname', 'email', 'phone', 'ou_type' ];
169 for ( var i in main_settings_fields ) {
170 var field = main_settings_fields[i];
171 var value = this.store.getValue( current_ou, field );
174 window["editor_pane_" + field].setValue( '' ); // unset the value
175 window["editor_pane_" + field].setDisplayedValue( '' ); // unset the value
176 } else window["editor_pane_" + field].setValue( value );
179 if ( this.store.getValue( current_ou, '_trueRoot' ) == 'true' ) {
180 editor_pane_parent_ou.disabled = true;
181 editor_pane_parent_ou.setValue(null);
182 editor_pane_parent_ou.setDisplayedValue('');
183 editor_pane_parent_ou.validate(false);
185 editor_pane_parent_ou.disabled = false;
186 editor_pane_parent_ou.validate(true);
187 editor_pane_parent_ou.setValue( this.store.getValue( current_ou, 'parent_ou' ) );
190 editor_pane_opac_visible.setChecked( this.store.getValue( current_ou, 'opac_visible' ) == 't' ? true : false );
197 <script type="dojo/method" event="getLabel" args="item,pI">
198 var label = this.store.getValue(item,'shortname') + ' : ' + this.store.getValue(item,'name');
199 if (this.store.getValue(item,'ischanged') == 1) label = '* ' + label;
206 <div jsId="right_pane" id="right_pane" dojoType="dijit.layout.ContentPane" sizeShare="200">
207 <script type="dojo/method">
208 window.right_pane_toggler = new dojo.fx.Toggler({ node: 'right_pane'});
209 window.right_pane_toggler.hide();
212 <div id="right_tabpane" dojoType="dijit.layout.TabContainer">
214 <div id="editor_pane" dojoType="dijit.layout.ContentPane" title="Main Settings">
216 <table class="tundra" style="margin:10px;">
218 <th>Org Unit Name</th>
220 <span id="editor_pane_name" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_name" regExp=".+" required="true">
221 <script type="dojo/connect" event="onChange">
222 if (current_ou) ou_list_store.setValue( current_ou, "name", this.getValue() );
225 <span dojoType="openils.I18N.translationWidget" targetObject="current_fm_ou" field="name"></span>
229 <th>Org Unit Policy Code</th>
231 <span id="editor_pane_shortname" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_shortname" uppercase="true" regExp=".+" required="true">
232 <script type="dojo/connect" event="onChange">
233 if (current_ou) ou_list_store.setValue( current_ou, "shortname", this.getValue() );
239 <th>Main Email Address</th>
241 <span id="editor_pane_email" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_email" regExp="^\w+\@\w+(?:\.\w+)+$">
242 <script type="dojo/connect" event="onChange">
243 if (current_ou) ou_list_store.setValue( current_ou, "email", this.getValue() );
249 <th>Main Phone Number</th>
251 <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+.*)$">
252 <script type="dojo/connect" event="onChange">
253 if (current_ou) ou_list_store.setValue( current_ou, "phone", this.getValue() );
259 <th>Org Unit Type</th>
262 id="editor_pane_ou_type"
263 dojoType="dijit.form.FilteringSelect"
264 jsId="editor_pane_ou_type"
265 store="ou_type_store"
270 <script type="dojo/method" event="onChange">
271 if (current_ou) ou_list_store.setValue( current_ou, "ou_type", this.getValue() );
277 <th>Parent Org Unit</th>
280 id="editor_pane_parent_ou"
281 dojoType="dijit.form.FilteringSelect"
282 jsId="editor_pane_parent_ou"
283 store="ou_list_store"
284 searchAttr="shortname"
288 <script type="dojo/method" event="onChange">
289 if (current_ou && this.getValue()) this.store.setValue( current_ou, "parent_ou", this.getValue() );
290 if ( this.store.getValue( current_ou, '_trueRoot' ) == 'true' ) this.required = false;
291 else this.required = true;
297 <th>OPAC Visible</th>
300 id="editor_pane_opac_visible"
301 jsId="editor_pane_opac_visible"
303 dojoType="dijit.form.CheckBox"
304 onChange='if (current_ou) ou_list_store.setValue( current_ou, "opac_visible", this.checked ? "t" : "f" );'
310 <div dojoType="dijit.layout.ContentPane" orientation="horizontal" style="margin-bottom: 20px;">
312 <button jsId="save_ou_button" dojoType="dijit.form.Button" label="Save" onClick="save_org()">
313 <script type="dojo/connect" event="startup">
314 this.disabled = true;
318 <button jsId="delete_ou_button" dojoType="dijit.form.Button" label="Delete">
319 <script type="dojo/connect" event="startup">
320 this.disabled = true;
322 <script type="dojo/connect" event="onClick">
324 var old_name = ou_list_store.getValue( current_ou, 'name' );
326 if (ou_list_store.getValue( current_ou, '_trueRoot' ) == 'true') {
327 highlighter.editor_pane.red.play();
328 status_update( 'Cannot delete' + ou_list_store.getValue( current_ou, 'name' ) + ', you need at least one.' );
332 if ( current_ou.children ) {
333 var kids = current_ou.children;
334 if (!dojo.isArray(kids)) kids = [kids];
336 var existing_kids = dojo.filter(
338 function(kid){ return kid.isdeleted[0] != 1 }
340 if ( existing_kids.length > 0) {
341 highlighter.editor_pane.red.play();
342 status_update( 'Cannot delete' + ou_list_store.getValue( current_ou, 'name' ) + ', ' + existing_kids.length + ' subordinates still exist.' );
347 if ( confirm('Are you sure you want to delete ' + current_ou.name + '?')) {
348 ou_list_store.setValue( current_ou, 'isdeleted', 1 );
350 var modified_ou = new aou().fromStoreItem( current_ou );
351 modified_ou.isdeleted( 1 );
354 method : 'open-ils.permacrud.delete.aou',
356 params : [ ses, modified_ou ],
357 onerror : function (r) {
358 highlighter.editor_pane.red.play();
359 status_update( 'Problem deleting ' + old_name );
361 oncomplete : function (r) {
363 if ( res && res.content() ) {
365 ou_list_store.fetch({
366 query : { id : ou_list_store.getValue( current_ou, 'id' ) },
367 queryOptions : { deep : true },
368 onItem : function (item, req) { try { if (this.isItem( item )) this.deleteItem( item ); } catch (e) { /* meh */ } },
369 scope : ou_list_store
374 new_kid_button.disabled = true;
375 save_ou_button.disabled = true;
376 delete_ou_button.disabled = true;
378 var main_settings_fields = [ 'name', 'shortname', 'email', 'phone', 'ou_type', 'parent_ou' ];
379 for ( var i in main_settings_fields ) {
380 var field = main_settings_fields[i];
381 window["editor_pane_" + field].setValue( '' ); // unset the value
382 window["editor_pane_" + field].setDisplayedValue( '' ); // unset the value
385 highlighter.editor_pane.green.play();
386 status_update( old_name + ' deleted' );
388 highlighter.editor_pane.red.play();
389 status_update( 'Problem deleting ' + old_name );
401 <button jsId="new_kid_button" dojoType="dijit.form.Button" label="New Child">
402 <script type="dojo/connect" event="startup">
403 this.disabled = true;
405 <script type="dojo/connect" event="onClick">
407 var new_fm_obj = new aou().fromHash({
411 shortname : ou_list_store.getValue( current_ou, 'shortname' ) + '-NEW' + virgin_ou_id--,
412 parent_ou : ou_list_store.getValue( current_ou, 'id' ),
413 ou_type : ou_list_store.getValue( current_ou, 'ou_type' )
419 method : 'open-ils.permacrud.create.aou',
421 params : [ ses, new_fm_obj ],
422 onerror : function (r) {
423 highlighter.editor_pane.red.play();
424 status_update( 'Problem creating child Org Unit' );
426 oncomplete : function (r) {
428 if ( res && res.content() ) {
429 ou_list_store.newItem(
430 res.content().toHash(),
431 { parent : current_ou, attribute : 'children' }
434 highlighter.editor_pane.red.play();
435 status_update( 'Problem creating child Org Unit' );
440 highlighter.editor_pane.green.play();
441 highlighter.ou_tree.green.play();
442 status_update( 'New child Organizational Unit created for ' + ou_list_store.getValue( current_ou, 'name' ) );
449 <div id="hoo_pane" dojoType="dijit.layout.ContentPane" title="Hours of Operation">
450 <table class="tundra" style="margin:10px;">
451 <tr><th/><th>Open time</th><th>Close time</th></tr>
453 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_0_open" onChange="current_ou_hoo.dow_0_open( this.getDisplayedValue() );"/></td>
454 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_0_close" onChange="current_ou_hoo.dow_0_close( this.getDisplayedValue() );"/></td>
455 <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>
458 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_1_open" onChange="current_ou_hoo.dow_1_open( this.getDisplayedValue() );"/></td>
459 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_1_close" onChange="current_ou_hoo.dow_1_close( this.getDisplayedValue() );"/></td>
460 <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>
462 <tr><th>Wednesday</th>
463 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_2_open" onChange="current_ou_hoo.dow_2_open( this.getDisplayedValue() );"/></td>
464 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_2_close" onChange="current_ou_hoo.dow_2_close( this.getDisplayedValue() );"/></td>
465 <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>
467 <tr><th>Thursday</th>
468 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_3_open" onChange="current_ou_hoo.dow_3_open( this.getDisplayedValue() );"/></td>
469 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_3_close" onChange="current_ou_hoo.dow_3_close( this.getDisplayedValue() );"/></td>
470 <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>
473 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_4_open" onChange="current_ou_hoo.dow_4_open( this.getDisplayedValue() );"/></td>
474 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_4_close" onChange="current_ou_hoo.dow_4_close( this.getDisplayedValue() );"/></td>
475 <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>
477 <tr><th>Saturday</th>
478 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_5_open" onChange="current_ou_hoo.dow_5_open( this.getDisplayedValue() );"/></td>
479 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_5_close" onChange="current_ou_hoo.dow_5_close( this.getDisplayedValue() );"/></td>
480 <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>
483 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_6_open" onChange="current_ou_hoo.dow_6_open( this.getDisplayedValue() );"/></td>
484 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_6_close" onChange="current_ou_hoo.dow_6_close( this.getDisplayedValue() );"/></td>
485 <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 <button jsId="save_hoo_button" dojoType="dijit.form.Button" label="Save">
490 <script type="dojo/connect" event="onClick">
492 var method_name = 'open-ils.permacrud.update.aouhoo';
493 if (current_ou_hoo.isnew() == 1) method_name = 'open-ils.permacrud.create.aouhoo';
496 method : method_name,
497 params : [ ses, current_ou_hoo ],
498 onerror : function (r) {
499 highlighter.editor_pane.red.play();
500 status_update( 'Problem saving Hours of Operation data for ' + ou_list_store.getValue( current_ou, 'name' ));
502 oncomplete : function (r) {
504 if ( res && res.content() ) {
505 current_ou_hoo.isnew(0);
506 highlighter.editor_pane.green.play();
507 status_update( 'Hours of Operation updated for ' + ou_list_store.getValue( current_ou, 'name' ) );
509 highlighter.editor_pane.red.play();
510 status_update( 'Problem saving Hours of Operation data for ' + ou_list_store.getValue( current_ou, 'name' ));
520 <div id="addresses_pane" dojoType="dijit.layout.ContentPane" title="Addresses">
522 <div id="billing_address_pane" dojoType="dijit.layout.TabContainer" style="margin-top:10px">
524 <script type="dojo/method">
525 window.current_billing_address = null;
526 window.current_mailing_address = null;
527 window.current_holds_address = null;
528 window.current_ill_address = null;
531 <div id="billing_address" dojoType="dijit.layout.ContentPane" title="Physical Address">
532 <table class="tundra" style="margin:10px;">
536 <span jsId="billing_addr_type" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_billing_address.address_type( this.getValue() )"/>
541 jsId="billing_addr_valid"
542 dojoType="dijit.form.CheckBox"
544 onChange='if (current_billing_address) current_billing_address.valid( this.checked ? "t" : "f" );'
549 <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>
552 <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>
555 <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>
556 <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>
557 <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>
560 <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>
561 <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 <button jsId="save_billing_address" dojoType="dijit.form.Button" label="Save">
566 <script type="dojo/connect" event="startup">
567 this.disabled = true;
569 <script type="dojo/connect" event="onClick">
571 var method_name = 'open-ils.permacrud.update.aoa';
572 if (current_billing_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
575 method : method_name,
576 params : [ ses, current_billing_address ],
577 onerror : function (r) {
578 highlighter.addresses_pane.red.play();
579 status_update( 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' ) );
581 oncomplete : function (r) {
583 if ( res && res.content() ) {
584 if (current_billing_address.isnew() == 1) {
585 current_billing_address = res.content();
586 ou_list_store.setValue( current_ou, 'billing_address', current_billing_address.id() );
589 current_billing_address.isnew(0);
590 highlighter.addresses_pane.green.play();
591 status_update( 'Changes to the Physical Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
593 highlighter.addresses_pane.red.play();
594 status_update( 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' ) );
603 <div id="holds_address" dojoType="dijit.layout.ContentPane" title="Holds Address">
604 <table class="tundra" style="margin:10px;">
606 <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 jsId="holds_addr_valid"
611 dojoType="dijit.form.CheckBox"
613 onChange='if (current_holds_address) current_holds_address.valid( this.checked ? "t" : "f" );'
618 <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>
621 <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>
624 <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>
625 <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>
626 <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>
629 <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>
630 <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 <button jsId="save_holds_address" dojoType="dijit.form.Button" label="Save">
635 <script type="dojo/connect" event="startup">
636 this.disabled = true;
638 <script type="dojo/connect" event="onClick">
640 var method_name = 'open-ils.permacrud.update.aoa';
641 if (current_holds_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
644 method : method_name,
645 params : [ ses, current_holds_address ],
646 onerror : function (r) {
647 highlighter.addresses_pane.red.play();
648 throw 'Problem saving Holds Address data for ' + ou_list_store.getValue( current_ou, 'name' );
650 oncomplete : function (r) {
652 if ( res && res.content() ) {
653 if (current_holds_address.isnew() == 1) {
654 current_holds_address = res.content();
655 ou_list_store.setValue( current_ou, 'holds_address', current_holds_address.id() );
658 current_holds_address.isnew(0);
659 highlighter.addresses_pane.green.play();
660 status_update( 'Changes to the Holds Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
662 highlighter.addresses_pane.red.play();
663 throw 'Problem saving Holds Address data for ' + ou_list_store.getValue( current_ou, 'name' );
672 <div id="mailing_address" dojoType="dijit.layout.ContentPane" title="Mailing Address">
673 <table class="tundra" style="margin:10px;">
675 <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 jsId="mailing_addr_valid"
680 dojoType="dijit.form.CheckBox"
681 onChange='if (current_mailing_address) current_mailing_address.valid( this.checked ? "t" : "f" );'
686 <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>
689 <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>
692 <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>
693 <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>
694 <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>
697 <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>
698 <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 <button jsId="save_mailing_address" dojoType="dijit.form.Button" label="Save">
703 <script type="dojo/connect" event="startup">
704 this.disabled = true;
706 <script type="dojo/connect" event="onClick">
708 var method_name = 'open-ils.permacrud.update.aoa';
709 if (current_mailing_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
712 method : method_name,
713 params : [ ses, current_mailing_address ],
714 onerror : function (r) {
715 highlighter.addresses_pane.red.play();
716 throw 'Problem saving Mailing Address data for ' + ou_list_store.getValue( current_ou, 'name' );
718 oncomplete : function (r) {
720 if ( res && res.content() ) {
721 if (current_mailing_address.isnew() == 1) {
722 current_mailing_address = res.content();
723 ou_list_store.setValue( current_ou, 'mailing_address', current_mailing_address.id() );
726 current_mailing_address.isnew(0);
727 highlighter.addresses_pane.green.play();
728 status_update( 'Changes to the Mailing Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
730 highlighter.addresses_pane.red.play();
731 throw 'Problem saving Mailing Address data for ' + ou_list_store.getValue( current_ou, 'name' );
740 <div id="ill_address" dojoType="dijit.layout.ContentPane" title="ILL Address">
741 <table class="tundra" style="margin:10px;">
743 <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 jsId="ill_addr_valid"
748 dojoType="dijit.form.CheckBox"
749 onChange='if (current_ill_address) current_ill_address.valid( this.checked ? "t" : "f" );'
754 <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>
757 <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>
760 <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>
761 <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>
762 <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>
765 <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>
766 <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 <button jsId="save_ill_address" dojoType="dijit.form.Button" label="Save">
771 <script type="dojo/connect" event="startup">
772 this.disabled = true;
774 <script type="dojo/connect" event="onClick">
776 var method_name = 'open-ils.permacrud.update.aoa';
777 if (current_ill_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
780 method : method_name,
781 params : [ ses, current_ill_address ],
782 onerror : function (r) {
783 highlighter.addresses_pane.red.play();
784 throw 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' );
786 oncomplete : function (r) {
788 if ( res && res.content() ) {
789 if (current_ill_address.isnew() == 1) {
790 current_ill_address = res.content();
791 ou_list_store.setValue( current_ou, 'ill_address', current_ill_address.id() );
794 current_ill_address.isnew(0);
795 highlighter.addresses_pane.green.play();
796 status_update( 'Changes to the ILL Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
798 highlighter.addresses_pane.red.play();
799 throw 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' );
813 <div id="status_bar"><span style="font-weight: bold; margin: 5px; margin-right: 10px;">Now editing:</span><span id="current_ou_name"></span></div>