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">
55 var djConfig = { parseOnLoad : true };
57 var _url_locale = location.href.replace(/^.*conify\/(.+)\/global.*$/, "$1").toLowerCase().replace(/-/,'_');
58 if (_url_locale) djConfig.locale = _url_locale;
59 else djConfig.locale = '<!--#echo var="locale"-->';
63 <script type="text/javascript" src="/js/dojo/dojo/dojo.js"></script>
64 <script type="text/javascript" src="/js/dojo/dijit/dijit.js"></script>
66 <script type="text/javascript" src="org_unit.js"></script>
70 <body class="tundra" id='pagebody'>
72 <div dojoType="dijit.layout.SplitContainer" orientation="horizontal" style="height: 100%">
74 <div dojoType="dijit.layout.ContentPane" sizeShare="100">
75 <script type="dojo/method">
77 var ou_list_data = { label : 'shortname', identifier : 'id' };
78 window.dirtyStore = [];
81 method : 'open-ils.permacrud.search.aou.atomic',
83 params : [ ses, { id : { "!=" : null } }, { order_by : { aou : 'shortname' } } ],
84 onerror : function (r) { throw 'Problem fetching org units';},
85 oncomplete : function (r) {
86 window._ou_list = r.recv().content();
87 window._ou_data = aou.toStoreData( window._ou_list );
88 window.ou_list_store = new dojo.data.ItemFileWriteStore({ data : window._ou_data });
90 window.ou_list_store.onSet = function (item, attr, o, n) {
91 if (attr == 'ischanged') return;
93 this.setValue( item, 'ischanged', 1);
96 dojo.addOnUnload( function (event) {
99 query : { ischanged : 1 },
100 queryOptions : { deep : true },
101 onItem : function (item, req) { try { if (this.isItem( item )) window.dirtyStore.push( item ); } catch (e) { /* meh */ } },
102 scope : ou_list_store
105 if (dirtyStore.length > 0) {
106 var confirmation = confirm(
107 'There are unsaved modified Organizational Units! '+
108 'OK to save these changes, Cancel to abandon them.'
112 for (var i in window.dirtyStore) {
113 window.current_ou = window.dirtyStore[i];
124 method : 'open-ils.permacrud.search.aout.atomic',
126 params : [ ses, { id : { "!=" : null } }, { order_by : { aout : 'depth' } } ],
127 onerror : function (r) { status_update('Problem fetching types') },
128 oncomplete : function (r) {
129 window._ou_type_list = r.recv().content();
130 window._ou_type_data = aout.toStoreData( window._ou_type_list );
131 window.ou_type_store = new dojo.data.ItemFileReadStore({ data : window._ou_type_data });
135 highlighter.ou_tree = {};
136 highlighter.editor_pane = {};
137 highlighter.hoo_pane = {};
138 highlighter.addresses_pane = {};
140 highlighter.ou_tree.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'ou_tree', duration : 500 } );
141 highlighter.ou_tree.red = dojox.fx.highlight( { color : '#FF2018', node : 'ou_tree', duration : 500 } );
143 highlighter.editor_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'editor_pane', duration : 500 } );
144 highlighter.editor_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'editor_pane', duration : 500 } );
146 highlighter.hoo_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'hoo_pane', duration : 500 } );
147 highlighter.hoo_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'hoo_pane', duration : 500 } );
149 highlighter.addresses_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'addresses_pane', duration : 500 } );
150 highlighter.addresses_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'addresses_pane', duration : 500 } );
154 label="Organizational Units"
155 query="{'_top':'true'}"
156 dojoType="dijit.Tree"
157 store="ou_list_store"
162 <script type="dojo/method" event="onClick" args="item,node">
164 right_pane_toggler.show();
167 window.current_fm_ou = new aou().fromStoreItem(item);
169 highlighter.editor_pane.green.play();
170 status_update( 'Now editing ' + this.store.getValue( item, 'name' ) );
172 new_kid_button.disabled = false;
173 save_ou_button.disabled = false;
174 delete_ou_button.disabled = false;
176 dojo.byId('current_ou_name').innerHTML = this.store.getValue( current_ou, 'name' );
178 var main_settings_fields = [ 'name', 'shortname', 'email', 'phone', 'ou_type' ];
179 for ( var i in main_settings_fields ) {
180 var field = main_settings_fields[i];
181 var value = this.store.getValue( current_ou, field );
184 window["editor_pane_" + field].setValue( '' ); // unset the value
185 window["editor_pane_" + field].setDisplayedValue( '' ); // unset the value
186 } else window["editor_pane_" + field].setValue( value );
189 if ( this.store.getValue( current_ou, '_trueRoot' ) == 'true' ) {
190 editor_pane_parent_ou.disabled = true;
191 editor_pane_parent_ou.setValue(null);
192 editor_pane_parent_ou.setDisplayedValue('');
193 editor_pane_parent_ou.validate(false);
195 editor_pane_parent_ou.disabled = false;
196 editor_pane_parent_ou.validate(true);
197 editor_pane_parent_ou.setValue( this.store.getValue( current_ou, 'parent_ou' ) );
200 editor_pane_opac_visible.setChecked( this.store.getValue( current_ou, 'opac_visible' ) == 't' ? true : false );
207 <script type="dojo/method" event="getLabel" args="item,pI">
208 var label = this.store.getValue(item,'shortname') + ' : ' + this.store.getValue(item,'name');
209 if (this.store.getValue(item,'ischanged') == 1) label = '* ' + label;
216 <div jsId="right_pane" id="right_pane" dojoType="dijit.layout.ContentPane" sizeShare="200">
217 <script type="dojo/method">
218 window.right_pane_toggler = new dojo.fx.Toggler({ node: 'right_pane'});
219 window.right_pane_toggler.hide();
222 <div id="right_tabpane" dojoType="dijit.layout.TabContainer">
224 <div id="editor_pane" dojoType="dijit.layout.ContentPane" title="Main Settings">
226 <table class="tundra" style="margin:10px;">
228 <th>Org Unit Name</th>
230 <span id="editor_pane_name" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_name" regExp=".+" required="true">
231 <script type="dojo/connect" event="onChange">
232 if (current_ou) ou_list_store.setValue( current_ou, "name", this.getValue() );
235 <span dojoType="openils.I18N.translationWidget" targetObject="current_fm_ou" field="name"></span>
239 <th>Org Unit Policy Code</th>
241 <span id="editor_pane_shortname" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_shortname" uppercase="true" regExp=".+" required="true">
242 <script type="dojo/connect" event="onChange">
243 if (current_ou) ou_list_store.setValue( current_ou, "shortname", this.getValue() );
249 <th>Main Email Address</th>
251 <span id="editor_pane_email" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_email" regExp="^\w+\@\w+(?:\.\w+)+$">
252 <script type="dojo/connect" event="onChange">
253 if (current_ou) ou_list_store.setValue( current_ou, "email", this.getValue() );
259 <th>Main Phone Number</th>
261 <span id="editor_pane_phone" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_phone" regExp="^(?:(?:\d{1}[ -\.])?\(?\d{3}\)?[ -\.]{1})?\d{3}[ -\.]{1}\d{4}(| \S+.*)$">
262 <script type="dojo/connect" event="onChange">
263 if (current_ou) ou_list_store.setValue( current_ou, "phone", this.getValue() );
269 <th>Org Unit Type</th>
272 id="editor_pane_ou_type"
273 dojoType="dijit.form.FilteringSelect"
274 jsId="editor_pane_ou_type"
275 store="ou_type_store"
280 <script type="dojo/method" event="onChange">
281 if (current_ou) ou_list_store.setValue( current_ou, "ou_type", this.getValue() );
287 <th>Parent Org Unit</th>
290 id="editor_pane_parent_ou"
291 dojoType="dijit.form.FilteringSelect"
292 jsId="editor_pane_parent_ou"
293 store="ou_list_store"
294 searchAttr="shortname"
298 <script type="dojo/method" event="onChange">
299 if (current_ou && this.getValue()) this.store.setValue( current_ou, "parent_ou", this.getValue() );
300 if ( this.store.getValue( current_ou, '_trueRoot' ) == 'true' ) this.required = false;
301 else this.required = true;
307 <th>OPAC Visible</th>
310 id="editor_pane_opac_visible"
311 jsId="editor_pane_opac_visible"
313 dojoType="dijit.form.CheckBox"
314 onChange='if (current_ou) ou_list_store.setValue( current_ou, "opac_visible", this.checked ? "t" : "f" );'
320 <div dojoType="dijit.layout.ContentPane" orientation="horizontal" style="margin-bottom: 20px;">
322 <button jsId="save_ou_button" dojoType="dijit.form.Button" label="Save" onClick="save_org()">
323 <script type="dojo/connect" event="startup">
324 this.disabled = true;
328 <button jsId="delete_ou_button" dojoType="dijit.form.Button" label="Delete">
329 <script type="dojo/connect" event="startup">
330 this.disabled = true;
332 <script type="dojo/connect" event="onClick">
334 var old_name = ou_list_store.getValue( current_ou, 'name' );
336 if (ou_list_store.getValue( current_ou, '_trueRoot' ) == 'true') {
337 highlighter.editor_pane.red.play();
338 status_update( 'Cannot delete' + ou_list_store.getValue( current_ou, 'name' ) + ', you need at least one.' );
342 if ( current_ou.children ) {
343 var kids = current_ou.children;
344 if (!dojo.isArray(kids)) kids = [kids];
346 var existing_kids = dojo.filter(
348 function(kid){ return kid.isdeleted[0] != 1 }
350 if ( existing_kids.length > 0) {
351 highlighter.editor_pane.red.play();
352 status_update( 'Cannot delete' + ou_list_store.getValue( current_ou, 'name' ) + ', ' + existing_kids.length + ' subordinates still exist.' );
357 if ( confirm('Are you sure you want to delete ' + current_ou.name + '?')) {
358 ou_list_store.setValue( current_ou, 'isdeleted', 1 );
360 var modified_ou = new aou().fromStoreItem( current_ou );
361 modified_ou.isdeleted( 1 );
364 method : 'open-ils.permacrud.delete.aou',
366 params : [ ses, modified_ou ],
367 onerror : function (r) {
368 highlighter.editor_pane.red.play();
369 status_update( 'Problem deleting ' + old_name );
371 oncomplete : function (r) {
373 if ( res && res.content() ) {
375 ou_list_store.fetch({
376 query : { id : ou_list_store.getValue( current_ou, 'id' ) },
377 queryOptions : { deep : true },
378 onItem : function (item, req) { try { if (this.isItem( item )) this.deleteItem( item ); } catch (e) { /* meh */ } },
379 scope : ou_list_store
384 new_kid_button.disabled = true;
385 save_ou_button.disabled = true;
386 delete_ou_button.disabled = true;
388 var main_settings_fields = [ 'name', 'shortname', 'email', 'phone', 'ou_type', 'parent_ou' ];
389 for ( var i in main_settings_fields ) {
390 var field = main_settings_fields[i];
391 window["editor_pane_" + field].setValue( '' ); // unset the value
392 window["editor_pane_" + field].setDisplayedValue( '' ); // unset the value
395 highlighter.editor_pane.green.play();
396 status_update( old_name + ' deleted' );
398 highlighter.editor_pane.red.play();
399 status_update( 'Problem deleting ' + old_name );
411 <button jsId="new_kid_button" dojoType="dijit.form.Button" label="New Child">
412 <script type="dojo/connect" event="startup">
413 this.disabled = true;
415 <script type="dojo/connect" event="onClick">
417 var new_fm_obj = new aou().fromHash({
421 shortname : ou_list_store.getValue( current_ou, 'shortname' ) + '-NEW' + virgin_ou_id--,
422 parent_ou : ou_list_store.getValue( current_ou, 'id' ),
423 ou_type : ou_list_store.getValue( current_ou, 'ou_type' )
429 method : 'open-ils.permacrud.create.aou',
431 params : [ ses, new_fm_obj ],
432 onerror : function (r) {
433 highlighter.editor_pane.red.play();
434 status_update( 'Problem creating child Org Unit' );
436 oncomplete : function (r) {
438 if ( res && res.content() ) {
439 ou_list_store.newItem(
440 res.content().toHash(),
441 { parent : current_ou, attribute : 'children' }
444 highlighter.editor_pane.red.play();
445 status_update( 'Problem creating child Org Unit' );
450 highlighter.editor_pane.green.play();
451 highlighter.ou_tree.green.play();
452 status_update( 'New child Organizational Unit created for ' + ou_list_store.getValue( current_ou, 'name' ) );
459 <div id="hoo_pane" dojoType="dijit.layout.ContentPane" title="Hours of Operation">
460 <table class="tundra" style="margin:10px;">
461 <tr><th/><th>Open time</th><th>Close time</th></tr>
463 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_0_open" onChange="current_ou_hoo.dow_0_open( this.getDisplayedValue() );"/></td>
464 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_0_close" onChange="current_ou_hoo.dow_0_close( this.getDisplayedValue() );"/></td>
465 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_0_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_0_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
468 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_1_open" onChange="current_ou_hoo.dow_1_open( this.getDisplayedValue() );"/></td>
469 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_1_close" onChange="current_ou_hoo.dow_1_close( this.getDisplayedValue() );"/></td>
470 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_1_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_1_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
472 <tr><th>Wednesday</th>
473 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_2_open" onChange="current_ou_hoo.dow_2_open( this.getDisplayedValue() );"/></td>
474 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_2_close" onChange="current_ou_hoo.dow_2_close( this.getDisplayedValue() );"/></td>
475 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_2_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_2_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
477 <tr><th>Thursday</th>
478 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_3_open" onChange="current_ou_hoo.dow_3_open( this.getDisplayedValue() );"/></td>
479 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_3_close" onChange="current_ou_hoo.dow_3_close( this.getDisplayedValue() );"/></td>
480 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_3_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_3_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
483 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_4_open" onChange="current_ou_hoo.dow_4_open( this.getDisplayedValue() );"/></td>
484 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_4_close" onChange="current_ou_hoo.dow_4_close( this.getDisplayedValue() );"/></td>
485 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_4_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_4_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
487 <tr><th>Saturday</th>
488 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_5_open" onChange="current_ou_hoo.dow_5_open( this.getDisplayedValue() );"/></td>
489 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_5_close" onChange="current_ou_hoo.dow_5_close( this.getDisplayedValue() );"/></td>
490 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_5_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_5_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
493 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_6_open" onChange="current_ou_hoo.dow_6_open( this.getDisplayedValue() );"/></td>
494 <td><span dojoType="dijit.form.TimeTextBox" style="width:8em;" jsId="dow_6_close" onChange="current_ou_hoo.dow_6_close( this.getDisplayedValue() );"/></td>
495 <td><span dojoType="dijit.form.Button" label="Closed" onClick="dow_6_open.setValue( new Date('Tue Mar 25 2008 00:00:00') ); dow_6_close.setValue( new Date('Tue Mar 25 2008 00:00:00') );"/></td>
499 <button jsId="save_hoo_button" dojoType="dijit.form.Button" label="Save">
500 <script type="dojo/connect" event="onClick">
502 var method_name = 'open-ils.permacrud.update.aouhoo';
503 if (current_ou_hoo.isnew() == 1) method_name = 'open-ils.permacrud.create.aouhoo';
506 method : method_name,
507 params : [ ses, current_ou_hoo ],
508 onerror : function (r) {
509 highlighter.editor_pane.red.play();
510 status_update( 'Problem saving Hours of Operation data for ' + ou_list_store.getValue( current_ou, 'name' ));
512 oncomplete : function (r) {
514 if ( res && res.content() ) {
515 current_ou_hoo.isnew(0);
516 highlighter.editor_pane.green.play();
517 status_update( 'Hours of Operation updated for ' + ou_list_store.getValue( current_ou, 'name' ) );
519 highlighter.editor_pane.red.play();
520 status_update( 'Problem saving Hours of Operation data for ' + ou_list_store.getValue( current_ou, 'name' ));
530 <div id="addresses_pane" dojoType="dijit.layout.ContentPane" title="Addresses">
532 <div id="billing_address_pane" dojoType="dijit.layout.TabContainer" style="margin-top:10px">
534 <script type="dojo/method">
535 window.current_billing_address = null;
536 window.current_mailing_address = null;
537 window.current_holds_address = null;
538 window.current_ill_address = null;
541 <div id="billing_address" dojoType="dijit.layout.ContentPane" title="Physical Address">
542 <table class="tundra" style="margin:10px;">
546 <span jsId="billing_addr_type" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_billing_address.address_type( this.getValue() )"/>
551 jsId="billing_addr_valid"
552 dojoType="dijit.form.CheckBox"
554 onChange='if (current_billing_address) current_billing_address.valid( this.checked ? "t" : "f" );'
559 <th>Street 1</th><td colspan="5"><span jsId="billing_addr_street1" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_billing_address.street1( this.getValue() )" required="true"/></td>
562 <th>Street 2</th><td colspan="5"><span jsId="billing_addr_street2" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_billing_address.street2( this.getValue() )"/></td>
565 <th>City</th><td><span jsId="billing_addr_city" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_billing_address.city( this.getValue() )" required="true"/></td>
566 <th>State</th><td><span jsId="billing_addr_state" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="2" maxSize="2" uppercase="true" onChange="current_billing_address.state( this.getValue() )" required="true"/></td>
567 <th>Zip</th><td><span jsId="billing_addr_post_code" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="10" maxSize="10" regExp="^\d{5}(?:-\d{4})?$" uppercase="true" onChange="current_billing_address.post_code( this.getValue() )" required="true"/></td>
570 <th>Country</th><td colspan="2"><span jsId="billing_addr_country" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_billing_address.country( this.getValue() )" required="true"/></td>
571 <th>County</th><td colspan="2"><span jsId="billing_addr_county" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_billing_address.county( this.getValue() )" required="true"/></td>
575 <button jsId="save_billing_address" dojoType="dijit.form.Button" label="Save">
576 <script type="dojo/connect" event="startup">
577 this.disabled = true;
579 <script type="dojo/connect" event="onClick">
581 var method_name = 'open-ils.permacrud.update.aoa';
582 if (current_billing_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
585 method : method_name,
586 params : [ ses, current_billing_address ],
587 onerror : function (r) {
588 highlighter.addresses_pane.red.play();
589 status_update( 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' ) );
591 oncomplete : function (r) {
593 if ( res && res.content() ) {
594 if (current_billing_address.isnew() == 1) {
595 current_billing_address = res.content();
596 ou_list_store.setValue( current_ou, 'billing_address', current_billing_address.id() );
599 current_billing_address.isnew(0);
600 highlighter.addresses_pane.green.play();
601 status_update( 'Changes to the Physical Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
603 highlighter.addresses_pane.red.play();
604 status_update( 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' ) );
613 <div id="holds_address" dojoType="dijit.layout.ContentPane" title="Holds Address">
614 <table class="tundra" style="margin:10px;">
616 <th>Type</th><td colspan="3"><span jsId="holds_addr_type" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_holds_address.address_type( this.getValue() )"/></td>
620 jsId="holds_addr_valid"
621 dojoType="dijit.form.CheckBox"
623 onChange='if (current_holds_address) current_holds_address.valid( this.checked ? "t" : "f" );'
628 <th>Street 1</th><td colspan="5"><span jsId="holds_addr_street1" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_holds_address.street1( this.getValue() )" required="true"/></td>
631 <th>Street 2</th><td colspan="5"><span jsId="holds_addr_street2" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_holds_address.street2( this.getValue() )"/></td>
634 <th>City</th><td><span jsId="holds_addr_city" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_holds_address.city( this.getValue() )" required="true"/></td>
635 <th>State</th><td><span jsId="holds_addr_state" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="2" maxSize="2" uppercase="true" onChange="current_holds_address.state( this.getValue() )" required="true"/></td>
636 <th>Zip</th><td><span jsId="holds_addr_post_code" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="10" maxSize="10" regExp="^\d{5}(?:-\d{4})?$" uppercase="true" onChange="current_holds_address.post_code( this.getValue() )" required="true"/></td>
639 <th>Country</th><td colspan="2"><span jsId="holds_addr_country" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_holds_address.country( this.getValue() )" required="true"/></td>
640 <th>County</th><td colspan="2"><span jsId="holds_addr_county" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_holds_address.county( this.getValue() )" required="true"/></td>
644 <button jsId="save_holds_address" dojoType="dijit.form.Button" label="Save">
645 <script type="dojo/connect" event="startup">
646 this.disabled = true;
648 <script type="dojo/connect" event="onClick">
650 var method_name = 'open-ils.permacrud.update.aoa';
651 if (current_holds_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
654 method : method_name,
655 params : [ ses, current_holds_address ],
656 onerror : function (r) {
657 highlighter.addresses_pane.red.play();
658 throw 'Problem saving Holds Address data for ' + ou_list_store.getValue( current_ou, 'name' );
660 oncomplete : function (r) {
662 if ( res && res.content() ) {
663 if (current_holds_address.isnew() == 1) {
664 current_holds_address = res.content();
665 ou_list_store.setValue( current_ou, 'holds_address', current_holds_address.id() );
668 current_holds_address.isnew(0);
669 highlighter.addresses_pane.green.play();
670 status_update( 'Changes to the Holds Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
672 highlighter.addresses_pane.red.play();
673 throw 'Problem saving Holds Address data for ' + ou_list_store.getValue( current_ou, 'name' );
682 <div id="mailing_address" dojoType="dijit.layout.ContentPane" title="Mailing Address">
683 <table class="tundra" style="margin:10px;">
685 <th>Type</th><td colspan="3"><span jsId="mailing_addr_type" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_mailing_address.address_type( this.getValue() )"/></td>
689 jsId="mailing_addr_valid"
690 dojoType="dijit.form.CheckBox"
691 onChange='if (current_mailing_address) current_mailing_address.valid( this.checked ? "t" : "f" );'
696 <th>Street 1</th><td colspan="5"><span jsId="mailing_addr_street1" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_mailing_address.street1( this.getValue() )" required="true"/></td>
699 <th>Street 2</th><td colspan="5"><span jsId="mailing_addr_street2" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_mailing_address.street2( this.getValue() )"/></td>
702 <th>City</th><td><span jsId="mailing_addr_city" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_mailing_address.city( this.getValue() )" required="true"/></td>
703 <th>State</th><td><span jsId="mailing_addr_state" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="2" maxSize="2" uppercase="true" onChange="current_mailing_address.state( this.getValue() )" required="true"/></td>
704 <th>Zip</th><td><span jsId="mailing_addr_post_code" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="10" maxSize="10" regExp="^\d{5}(?:-\d{4})?$" uppercase="true" onChange="current_mailing_address.post_code( this.getValue() )" required="true"/></td>
707 <th>Country</th><td colspan="2"><span jsId="mailing_addr_country" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_mailing_address.country( this.getValue() )" required="true"/></td>
708 <th>County</th><td colspan="2"><span jsId="mailing_addr_county" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_mailing_address.county( this.getValue() )" required="true"/></td>
712 <button jsId="save_mailing_address" dojoType="dijit.form.Button" label="Save">
713 <script type="dojo/connect" event="startup">
714 this.disabled = true;
716 <script type="dojo/connect" event="onClick">
718 var method_name = 'open-ils.permacrud.update.aoa';
719 if (current_mailing_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
722 method : method_name,
723 params : [ ses, current_mailing_address ],
724 onerror : function (r) {
725 highlighter.addresses_pane.red.play();
726 throw 'Problem saving Mailing Address data for ' + ou_list_store.getValue( current_ou, 'name' );
728 oncomplete : function (r) {
730 if ( res && res.content() ) {
731 if (current_mailing_address.isnew() == 1) {
732 current_mailing_address = res.content();
733 ou_list_store.setValue( current_ou, 'mailing_address', current_mailing_address.id() );
736 current_mailing_address.isnew(0);
737 highlighter.addresses_pane.green.play();
738 status_update( 'Changes to the Mailing Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
740 highlighter.addresses_pane.red.play();
741 throw 'Problem saving Mailing Address data for ' + ou_list_store.getValue( current_ou, 'name' );
750 <div id="ill_address" dojoType="dijit.layout.ContentPane" title="ILL Address">
751 <table class="tundra" style="margin:10px;">
753 <th>Type</th><td colspan="3"><span jsId="ill_addr_type" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_ill_address.address_type( this.getValue() )"/></td>
757 jsId="ill_addr_valid"
758 dojoType="dijit.form.CheckBox"
759 onChange='if (current_ill_address) current_ill_address.valid( this.checked ? "t" : "f" );'
764 <th>Street 1</th><td colspan="5"><span jsId="ill_addr_street1" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_ill_address.street1( this.getValue() )" required="true"/></td>
767 <th>Street 2</th><td colspan="5"><span jsId="ill_addr_street2" style="width:100%;" dojoType="dijit.form.TextBox" onChange="current_ill_address.street2( this.getValue() )"/></td>
770 <th>City</th><td><span jsId="ill_addr_city" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_ill_address.city( this.getValue() )" required="true"/></td>
771 <th>State</th><td><span jsId="ill_addr_state" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="2" maxSize="2" uppercase="true" onChange="current_ill_address.state( this.getValue() )" required="true"/></td>
772 <th>Zip</th><td><span jsId="ill_addr_post_code" style="width:100%;" dojoType="dijit.form.ValidationTextBox" size="10" maxSize="10" regExp="^\d{5}(?:-\d{4})?$" uppercase="true" onChange="current_ill_address.post_code( this.getValue() )" required="true"/></td>
775 <th>Country</th><td colspan="2"><span jsId="ill_addr_country" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_ill_address.country( this.getValue() )" required="true"/></td>
776 <th>County</th><td colspan="2"><span jsId="ill_addr_county" style="width:100%;" dojoType="dijit.form.ValidationTextBox" onChange="current_ill_address.county( this.getValue() )" required="true"/></td>
780 <button jsId="save_ill_address" dojoType="dijit.form.Button" label="Save">
781 <script type="dojo/connect" event="startup">
782 this.disabled = true;
784 <script type="dojo/connect" event="onClick">
786 var method_name = 'open-ils.permacrud.update.aoa';
787 if (current_ill_address.isnew() == 1) method_name = 'open-ils.permacrud.create.aoa';
790 method : method_name,
791 params : [ ses, current_ill_address ],
792 onerror : function (r) {
793 highlighter.addresses_pane.red.play();
794 throw 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' );
796 oncomplete : function (r) {
798 if ( res && res.content() ) {
799 if (current_ill_address.isnew() == 1) {
800 current_ill_address = res.content();
801 ou_list_store.setValue( current_ou, 'ill_address', current_ill_address.id() );
804 current_ill_address.isnew(0);
805 highlighter.addresses_pane.green.play();
806 status_update( 'Changes to the ILL Address of ' + ou_list_store.getValue( current_ou, 'name' ) + ' saved' );
808 highlighter.addresses_pane.red.play();
809 throw 'Problem saving Physical Address data for ' + ou_list_store.getValue( current_ou, 'name' );
823 <div id="status_bar"><span style="font-weight: bold; margin: 5px; margin-right: 10px;">Now editing:</span><span id="current_ou_name"></span></div>