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 <!-- Fieldmapper objects -->
51 <script language='javascript' src='/opac/common/js/fmall.js' type='text/javascript'></script>
53 <!-- Dojo goodness -->
54 <script type="text/javascript" src="/js/dojo/dojo/dojo.js" djConfig="parseOnLoad: true"></script>
55 <script type="text/javascript" src="/js/dojo/dijit/dijit.js"></script>
57 <script type="text/javascript" src="org_unit.js"></script>
61 <body class="tundra" id='pagebody'>
63 <div dojoType="dijit.layout.SplitContainer" orientation="horizontal" style="height: 100%">
65 <div dojoType="dijit.layout.ContentPane" sizeShare="100">
66 <script type="dojo/method">
68 var ou_list_data = { label : 'shortname', identifier : 'id' };
69 window.dirtyStore = [];
72 method : 'open-ils.permacrud.search.aou.atomic',
74 params : [ ses, { id : { "!=" : null } }, { order_by : { aou : 'shortname' } } ],
75 onerror : function (r) { throw 'Problem fetching org units';},
76 oncomplete : function (r) {
77 window._ou_list = r.recv().content();
78 window._ou_data = aou.toStoreData( window._ou_list );
79 window.ou_list_store = new dojo.data.ItemFileWriteStore({ data : window._ou_data });
81 window.ou_list_store.onSet = function (item, attr, o, n) {
82 if (attr == 'ischanged') return;
84 this.setValue( item, 'ischanged', 1);
87 dojo.addOnUnload( function (event) {
90 query : { ischanged : 1 },
91 queryOptions : { deep : true },
92 onItem : function (item, req) { try { if (this.isItem( item )) window.dirtyStore.push( item ); } catch (e) { /* meh */ } },
96 if (dirtyStore.length > 0) {
97 var confirmation = confirm(
98 'There are unsaved modified Organizational Units! '+
99 'OK to save these changes, Cancel to abandon them.'
103 for (var i in window.dirtyStore) {
104 window.current_ou = window.dirtyStore[i];
115 method : 'open-ils.permacrud.search.aout.atomic',
117 params : [ ses, { id : { "!=" : null } }, { order_by : { aout : 'depth' } } ],
118 onerror : function (r) { status_update('Problem fetching types') },
119 oncomplete : function (r) {
120 window._ou_type_list = r.recv().content();
121 window._ou_type_data = aout.toStoreData( window._ou_type_list );
122 window.ou_type_store = new dojo.data.ItemFileReadStore({ data : window._ou_type_data });
126 highlighter.ou_tree = {};
127 highlighter.editor_pane = {};
128 highlighter.hoo_pane = {};
129 highlighter.addresses_pane = {};
131 highlighter.ou_tree.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'ou_tree', duration : 500 } );
132 highlighter.ou_tree.red = dojox.fx.highlight( { color : '#FF2018', node : 'ou_tree', duration : 500 } );
134 highlighter.editor_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'editor_pane', duration : 500 } );
135 highlighter.editor_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'editor_pane', duration : 500 } );
137 highlighter.hoo_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'hoo_pane', duration : 500 } );
138 highlighter.hoo_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'hoo_pane', duration : 500 } );
140 highlighter.addresses_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'addresses_pane', duration : 500 } );
141 highlighter.addresses_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'addresses_pane', duration : 500 } );
145 label="Organizational Units"
146 query="{'_top':'true'}"
147 dojoType="dijit.Tree"
148 store="ou_list_store"
153 <script type="dojo/method" event="onClick" args="item,node">
155 right_pane_toggler.show();
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() );
228 <th>Org Unit Policy Code</th>
230 <span id="editor_pane_shortname" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_shortname" uppercase="true" regExp=".+" required="true">
231 <script type="dojo/connect" event="onChange">
232 if (current_ou) ou_list_store.setValue( current_ou, "shortname", this.getValue() );
238 <th>Main Email Address</th>
240 <span id="editor_pane_email" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_email" regExp="^\w+\@\w+(?:\.\w+)+$">
241 <script type="dojo/connect" event="onChange">
242 if (current_ou) ou_list_store.setValue( current_ou, "email", this.getValue() );
248 <th>Main Phone Number</th>
250 <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+.*)$">
251 <script type="dojo/connect" event="onChange">
252 if (current_ou) ou_list_store.setValue( current_ou, "phone", this.getValue() );
258 <th>Org Unit Type</th>
261 id="editor_pane_ou_type"
262 dojoType="dijit.form.FilteringSelect"
263 jsId="editor_pane_ou_type"
264 store="ou_type_store"
269 <script type="dojo/method" event="onChange">
270 if (current_ou) ou_list_store.setValue( current_ou, "ou_type", this.getValue() );
276 <th>Parent Org Unit</th>
279 id="editor_pane_parent_ou"
280 dojoType="dijit.form.FilteringSelect"
281 jsId="editor_pane_parent_ou"
282 store="ou_list_store"
283 searchAttr="shortname"
287 <script type="dojo/method" event="onChange">
288 if (current_ou && this.getValue()) this.store.setValue( current_ou, "parent_ou", this.getValue() );
289 if ( this.store.getValue( current_ou, '_trueRoot' ) == 'true' ) this.required = false;
290 else this.required = true;
296 <th>OPAC Visible</th>
299 id="editor_pane_opac_visible"
300 jsId="editor_pane_opac_visible"
302 dojoType="dijit.form.CheckBox"
303 onChange='if (current_ou) ou_list_store.setValue( current_ou, "opac_visible", this.checked ? "t" : "f" );'
309 <div dojoType="dijit.layout.ContentPane" orientation="horizontal" style="margin-bottom: 20px;">
311 <button jsId="save_ou_button" dojoType="dijit.form.Button" label="Save" onClick="save_org()">
312 <script type="dojo/connect" event="startup">
313 this.disabled = true;
317 <button jsId="delete_ou_button" dojoType="dijit.form.Button" label="Delete">
318 <script type="dojo/connect" event="startup">
319 this.disabled = true;
321 <script type="dojo/connect" event="onClick">
323 var old_name = ou_list_store.getValue( current_ou, 'name' );
325 if (ou_list_store.getValue( current_ou, '_trueRoot' ) == 'true') {
326 highlighter.editor_pane.red.play();
327 status_update( 'Cannot delete' + ou_list_store.getValue( current_ou, 'name' ) + ', you need at least one.' );
331 if ( current_ou.children ) {
332 var kids = current_ou.children;
333 if (!dojo.isArray(kids)) kids = [kids];
335 var existing_kids = dojo.filter(
337 function(kid){ return kid.isdeleted[0] != 1 }
339 if ( existing_kids.length > 0) {
340 highlighter.editor_pane.red.play();
341 status_update( 'Cannot delete' + ou_list_store.getValue( current_ou, 'name' ) + ', ' + existing_kids.length + ' subordinates still exist.' );
346 if ( confirm('Are you sure you want to delete ' + current_ou.name + '?')) {
347 ou_list_store.setValue( current_ou, 'isdeleted', 1 );
349 var modified_ou = new aou().fromStoreItem( current_ou );
350 modified_ou.isdeleted( 1 );
353 method : 'open-ils.permacrud.delete.aou',
355 params : [ ses, modified_ou ],
356 onerror : function (r) {
357 highlighter.editor_pane.red.play();
358 status_update( 'Problem deleting ' + old_name );
360 oncomplete : function (r) {
362 if ( res && res.content() ) {
364 ou_list_store.fetch({
365 query : { id : ou_list_store.getValue( current_ou, 'id' ) },
366 queryOptions : { deep : true },
367 onItem : function (item, req) { try { if (this.isItem( item )) this.deleteItem( item ); } catch (e) { /* meh */ } },
368 scope : ou_list_store
373 new_kid_button.disabled = true;
374 save_ou_button.disabled = true;
375 delete_ou_button.disabled = true;
377 var main_settings_fields = [ 'name', 'shortname', 'email', 'phone', 'ou_type', 'parent_ou' ];
378 for ( var i in main_settings_fields ) {
379 var field = main_settings_fields[i];
380 window["editor_pane_" + field].setValue( '' ); // unset the value
381 window["editor_pane_" + field].setDisplayedValue( '' ); // unset the value
384 highlighter.editor_pane.green.play();
385 status_update( old_name + ' deleted' );
387 highlighter.editor_pane.red.play();
388 status_update( 'Problem deleting ' + old_name );
400 <button jsId="new_kid_button" dojoType="dijit.form.Button" label="New Child">
401 <script type="dojo/connect" event="startup">
402 this.disabled = true;
404 <script type="dojo/connect" event="onClick">
406 var new_fm_obj = new aou().fromHash({
410 shortname : ou_list_store.getValue( current_ou, 'shortname' ) + '-NEW' + virgin_ou_id--,
411 parent_ou : ou_list_store.getValue( current_ou, 'id' ),
412 ou_type : ou_list_store.getValue( current_ou, 'ou_type' )
418 method : 'open-ils.permacrud.create.aou',
420 params : [ ses, new_fm_obj ],
421 onerror : function (r) {
422 highlighter.editor_pane.red.play();
423 status_update( 'Problem creating child Org Unit' );
425 oncomplete : function (r) {
427 if ( res && res.content() ) {
428 ou_list_store.newItem(
429 res.content().toHash(),
430 { parent : current_ou, attribute : 'children' }
433 highlighter.editor_pane.red.play();
434 status_update( 'Problem creating child Org Unit' );
439 highlighter.editor_pane.green.play();
440 highlighter.ou_tree.green.play();
441 status_update( 'New child Organizational Unit created for ' + ou_list_store.getValue( current_ou, 'name' ) );
448 <div id="hoo_pane" dojoType="dijit.layout.ContentPane" title="Hours of Operation">
449 <table class="tundra" style="margin:10px;">
450 <tr><th/><th>Open time</th><th>Close time</th></tr>
452 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_0_open" onChange="current_ou_hoo.dow_0_open( this.getDisplayedValue() );"/></td>
453 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_0_close" onChange="current_ou_hoo.dow_0_close( this.getDisplayedValue() );"/></td>
454 <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>
457 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_1_open" onChange="current_ou_hoo.dow_1_open( this.getDisplayedValue() );"/></td>
458 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_1_close" onChange="current_ou_hoo.dow_1_close( this.getDisplayedValue() );"/></td>
459 <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>
461 <tr><th>Wednesday</th>
462 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_2_open" onChange="current_ou_hoo.dow_2_open( this.getDisplayedValue() );"/></td>
463 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_2_close" onChange="current_ou_hoo.dow_2_close( this.getDisplayedValue() );"/></td>
464 <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>
466 <tr><th>Thursday</th>
467 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_3_open" onChange="current_ou_hoo.dow_3_open( this.getDisplayedValue() );"/></td>
468 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_3_close" onChange="current_ou_hoo.dow_3_close( this.getDisplayedValue() );"/></td>
469 <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>
472 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_4_open" onChange="current_ou_hoo.dow_4_open( this.getDisplayedValue() );"/></td>
473 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_4_close" onChange="current_ou_hoo.dow_4_close( this.getDisplayedValue() );"/></td>
474 <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>
476 <tr><th>Saturday</th>
477 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_5_open" onChange="current_ou_hoo.dow_5_open( this.getDisplayedValue() );"/></td>
478 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_5_close" onChange="current_ou_hoo.dow_5_close( this.getDisplayedValue() );"/></td>
479 <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>
482 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_6_open" onChange="current_ou_hoo.dow_6_open( this.getDisplayedValue() );"/></td>
483 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_6_close" onChange="current_ou_hoo.dow_6_close( this.getDisplayedValue() );"/></td>
484 <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>
488 <button jsId="save_hoo_button" dojoType="dijit.form.Button" label="Save">
489 <script type="dojo/connect" event="onClick">
491 var method_name = 'open-ils.permacrud.update.aouhoo';
492 if (current_ou_hoo.isnew() == 1) method_name = 'open-ils.permacrud.create.aouhoo';
495 method : method_name,
496 params : [ ses, current_ou_hoo ],
497 onerror : function (r) {
498 highlighter.editor_pane.red.play();
499 status_update( 'Problem saving Hours of Operation data for ' + ou_list_store.getValue( current_ou, 'name' ));
501 oncomplete : function (r) {
503 if ( res && res.content() ) {
504 current_ou_hoo.isnew(0);
505 highlighter.editor_pane.green.play();
506 status_update( 'Hours of Operation updated for ' + ou_list_store.getValue( current_ou, 'name' ) );
508 highlighter.editor_pane.red.play();
509 status_update( 'Problem saving Hours of Operation data for ' + ou_list_store.getValue( current_ou, 'name' ));
519 <div id="addresses_pane" dojoType="dijit.layout.ContentPane" title="Addresses">
521 <div id="billing_address_pane" dojoType="dijit.layout.TabContainer" style="margin-top:10px">
523 <script type="dojo/method">
524 window.current_billing_address = null;
525 window.current_mailing_address = null;
526 window.current_holds_address = null;
527 window.current_ill_address = null;
530 <div id="billing_address" dojoType="dijit.layout.ContentPane" title="Physical Address">
531 <table class="tundra" style="margin:10px;">
533 <th>Type</th><td colspan="3"><span jsId="billing_addr_type" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_billing_address.address_type( this.getValue() )"/></td>
537 jsId="billing_addr_valid"
538 dojoType="dijit.form.CheckBox"
540 onChange='if (current_billing_address) current_billing_address.valid( this.checked ? "t" : "f" );'
545 <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>
548 <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>
551 <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>
552 <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>
553 <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>
556 <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>
557 <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>
561 <button jsId="save_billing_address" dojoType="dijit.form.Button" label="Save">
562 <script type="dojo/connect" event="startup">
563 this.disabled = true;
565 <script type="dojo/connect" event="onClick">
567 var method_name = 'open-ils.permacrud.update.aoa';
568 if (current_billing_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
571 method : method_name,
572 params : [ ses, current_billing_address ],
573 onerror : function (r) {
574 highlighter.addresses_pane.red.play();
575 status_update( 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' ) );
577 oncomplete : function (r) {
579 if ( res && res.content() ) {
580 if (current_billing_address.isnew() == 1) {
581 current_billing_address = res.content();
582 ou_list_store.setValue( current_ou, 'billing_address', current_billing_address.id() );
585 current_billing_address.isnew(0);
586 highlighter.addresses_pane.green.play();
587 status_update( 'Changes to the Physical Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
589 highlighter.addresses_pane.red.play();
590 status_update( 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' ) );
599 <div id="holds_address" dojoType="dijit.layout.ContentPane" title="Holds Address">
600 <table class="tundra" style="margin:10px;">
602 <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>
606 jsId="holds_addr_valid"
607 dojoType="dijit.form.CheckBox"
609 onChange='if (current_holds_address) current_holds_address.valid( this.checked ? "t" : "f" );'
614 <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>
617 <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>
620 <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>
621 <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>
622 <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>
625 <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>
626 <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>
630 <button jsId="save_holds_address" dojoType="dijit.form.Button" label="Save">
631 <script type="dojo/connect" event="startup">
632 this.disabled = true;
634 <script type="dojo/connect" event="onClick">
636 var method_name = 'open-ils.permacrud.update.aoa';
637 if (current_holds_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
640 method : method_name,
641 params : [ ses, current_holds_address ],
642 onerror : function (r) {
643 highlighter.addresses_pane.red.play();
644 throw 'Problem saving Holds Address data for ' + ou_list_store.getValue( current_ou, 'name' );
646 oncomplete : function (r) {
648 if ( res && res.content() ) {
649 if (current_holds_address.isnew() == 1) {
650 current_holds_address = res.content();
651 ou_list_store.setValue( current_ou, 'holds_address', current_holds_address.id() );
654 current_holds_address.isnew(0);
655 highlighter.addresses_pane.green.play();
656 status_update( 'Changes to the Holds Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
658 highlighter.addresses_pane.red.play();
659 throw 'Problem saving Holds Address data for ' + ou_list_store.getValue( current_ou, 'name' );
668 <div id="mailing_address" dojoType="dijit.layout.ContentPane" title="Mailing Address">
669 <table class="tundra" style="margin:10px;">
671 <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>
675 jsId="mailing_addr_valid"
676 dojoType="dijit.form.CheckBox"
677 onChange='if (current_mailing_address) current_mailing_address.valid( this.checked ? "t" : "f" );'
682 <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>
685 <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>
688 <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>
689 <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>
690 <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>
693 <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>
694 <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>
698 <button jsId="save_mailing_address" dojoType="dijit.form.Button" label="Save">
699 <script type="dojo/connect" event="startup">
700 this.disabled = true;
702 <script type="dojo/connect" event="onClick">
704 var method_name = 'open-ils.permacrud.update.aoa';
705 if (current_mailing_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
708 method : method_name,
709 params : [ ses, current_mailing_address ],
710 onerror : function (r) {
711 highlighter.addresses_pane.red.play();
712 throw 'Problem saving Mailing Address data for ' + ou_list_store.getValue( current_ou, 'name' );
714 oncomplete : function (r) {
716 if ( res && res.content() ) {
717 if (current_mailing_address.isnew() == 1) {
718 current_mailing_address = res.content();
719 ou_list_store.setValue( current_ou, 'mailing_address', current_mailing_address.id() );
722 current_mailing_address.isnew(0);
723 highlighter.addresses_pane.green.play();
724 status_update( 'Changes to the Mailing Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
726 highlighter.addresses_pane.red.play();
727 throw 'Problem saving Mailing Address data for ' + ou_list_store.getValue( current_ou, 'name' );
736 <div id="ill_address" dojoType="dijit.layout.ContentPane" title="ILL Address">
737 <table class="tundra" style="margin:10px;">
739 <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>
743 jsId="ill_addr_valid"
744 dojoType="dijit.form.CheckBox"
745 onChange='if (current_ill_address) current_ill_address.valid( this.checked ? "t" : "f" );'
750 <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>
753 <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>
756 <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>
757 <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>
758 <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>
761 <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>
762 <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>
766 <button jsId="save_ill_address" dojoType="dijit.form.Button" label="Save">
767 <script type="dojo/connect" event="startup">
768 this.disabled = true;
770 <script type="dojo/connect" event="onClick">
772 var method_name = 'open-ils.permacrud.update.aoa';
773 if (current_ill_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
776 method : method_name,
777 params : [ ses, current_ill_address ],
778 onerror : function (r) {
779 highlighter.addresses_pane.red.play();
780 throw 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' );
782 oncomplete : function (r) {
784 if ( res && res.content() ) {
785 if (current_ill_address.isnew() == 1) {
786 current_ill_address = res.content();
787 ou_list_store.setValue( current_ou, 'ill_address', current_ill_address.id() );
790 current_ill_address.isnew(0);
791 highlighter.addresses_pane.green.play();
792 status_update( 'Changes to the ILL Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
794 highlighter.addresses_pane.red.play();
795 throw 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' );
809 <div id="status_bar"><span style="font-weight: bold; margin: 5px; margin-right: 10px;">Now editing:</span><span id="current_ou_name"></span></div>