Finished moving most of the Javascript to an external file.
authorJoseph Lewis <joehms22@gmail.com>
Tue, 9 Aug 2011 17:52:01 +0000 (11:52 -0600)
committerJoseph Lewis <joehms22@gmail.com>
Tue, 9 Aug 2011 17:52:01 +0000 (11:52 -0600)
Signed-off-by: Joseph Lewis <joehms22@gmail.com>
Open-ILS/web/conify/global/actor/org_unit.html
Open-ILS/web/conify/global/actor/org_unit.js

index 1c71ea4..f40e705 100644 (file)
                             window.ou_type_store = new dojo.data.ItemFileReadStore({ data : window._ou_type_data });
                        }
                     });
-
-                                       highlighter.ou_tree = {};
-                                       highlighter.editor_pane = {};
-                                       highlighter.hoo_pane = {};
-                                       highlighter.addresses_pane = {};
-
-                                       highlighter.ou_tree.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'ou_tree', duration : 500 } );
-                                       highlighter.ou_tree.red = dojox.fx.highlight( { color : '#FF2018', node : 'ou_tree', duration : 500 } );
-
-                                       highlighter.editor_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'editor_pane', duration : 500 } );
-                                       highlighter.editor_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'editor_pane', duration : 500 } );
-
-                                       highlighter.hoo_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'hoo_pane', duration : 500 } );
-                                       highlighter.hoo_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'hoo_pane', duration : 500 } );
-
-                                       highlighter.addresses_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'addresses_pane', duration : 500 } );
-                                       highlighter.addresses_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'addresses_pane', duration : 500 } );
 ]]>
                                </script>
                                <div
                                                                </script>
                                                        </button>
        
-                                                       <button jsId="delete_ou_button" dojoType="dijit.form.Button" label="&conify.delete_button.label;">
+                                                       <button jsId="delete_ou_button" dojoType="dijit.form.Button" label="&conify.delete_button.label;" onClick="deleteOu()">
                                                                <script type="dojo/connect" event="startup">
                                                                        this.disabled = true;
                                                                </script>
-                                                               <script type="dojo/connect" event="onClick">
-<![CDATA[
-                                                                       var old_name = ou_list_store.getValue( current_ou, 'name' );
-
-                                                                       if (ou_list_store.getValue( current_ou, '_trueRoot' ) == 'true') {
-                                                                               highlighter.editor_pane.red.play();
-                                                                               status_update( dojo.string.substitute( aou_strings.ERROR_DELETING_LAST_AOU, [ou_list_store.getValue( current_ou, 'name' )] ) );
-                                                                               return false;
-                                                                       }
-
-                                                                       if ( current_ou.children ) {
-                                                                               var kids = current_ou.children;
-                                                                               if (!dojo.isArray(kids)) kids = [kids];
-       
-                                                                               var existing_kids = dojo.filter(
-                                                                                       kids,
-                                                                                       function(kid){ return kid.isdeleted[0] != 1 }
-                                                                               );
-                                                                               if ( existing_kids.length > 0) {
-                                                                                       highlighter.editor_pane.red.play();
-                                                                                       status_update( dojo.string.substitute( aou_strings.ERROR_ORPHANS, [ou_list_store.getValue( current_ou, 'name' ), existing_kids.length] ) );
-                                                                                       return;
-                                                                               }
-                                                                       }
-       
-                                                                       if (confirm(dojo.string.substitute(aou_strings.CONFIRM_DELETE, [current_ou.name]))) {
-                                                                               ou_list_store.setValue( current_ou, 'isdeleted', 1 );
-
-                                                                               var modified_ou = new aou().fromStoreItem( current_ou );
-                                                                               modified_ou.isdeleted( 1 );
-
-                                        var objs = [];
-                                        objs.push(modified_ou);
-                                                                               if (!current_billing_address.isnew()) {
-                                            current_billing_address.isdeleted( 1 );
-                                            objs.push(current_billing_address);
-                                        }
-                                                                               if (!current_mailing_address.isnew()) {
-                                            current_mailing_address.isdeleted( 1 );
-                                            objs.push(current_mailing_address);
-                                        }
-                                                                               if (!current_holds_address.isnew()) {
-                                            current_holds_address.isdeleted( 1 );
-                                            objs.push(current_holds_address);
-                                        }
-                                                                               if (!current_ill_address.isnew()) {
-                                            current_ill_address.isdeleted( 1 );
-                                            objs.push(current_ill_address);
-                                        }
-                                        if (!current_ou_hoo.isnew()) {
-                                            current_ou_hoo.isdeleted( 1 );
-                                            objs.push(current_ou_hoo);
-                                        }
-                                        pcrud.apply(objs, {
-                                                                                       timeout : 10,
-                                                                                       onerror : function (r) {
-                                                                                               highlighter.editor_pane.red.play();
-                                                                                               status_update(dojo.string.substitute(aou_strings.ERROR_DELETING, [old_name]));
-                                                                                       },
-                                                                                       oncomplete : function (r) {
-                                                                                               new_kid_button.disabled = true;
-                                                                                               save_ou_button.disabled = true;
-                                                                                               delete_ou_button.disabled = true;
-
-                                                                                               var main_settings_fields = [ 'name', 'shortname', 'email', 'phone', 'ou_type', 'parent_ou' ];
-                                                                                               for ( var i in main_settings_fields ) {
-                                                                                                       var field = main_settings_fields[i];
-                                                                                                       window["editor_pane_" + field].setValue( '' ); // unset the value
-                                                                                                       window["editor_pane_" + field].setDisplayedValue( '' ); // unset the value
-                                                                                               }
-
-                                                                                               ou_list_store.fetch({
-                                                                                                       query : { id : ou_list_store.getValue( current_ou, 'id' ) },
-                                                                                                       queryOptions : { deep : true },
-                                                                                                       onItem : function (item, req) { try { if (this.isItem( item )) this.deleteItem( item ); } catch (e) { } },
-                                                                                                       scope : ou_list_store
-                                                                                               });
-
-                                                current_billing_address = null;
-                                                current_mailing_address = null;
-                                                current_holds_address = null;
-                                                current_ill_address = null;
-                                                current_ou_hoo = null;
-                                                                                               current_ou = null;
-
-                                                                                               highlighter.editor_pane.green.play();
-                                                                                               status_update(dojo.string.substitute(aou_strings.STATUS_DELETED, [old_name]));
-                                                                                       }
-                                                                               });
-                                                                       }
-]]>
-                                                               </script>
                                                        </button>
        
                                                </div>
        
-                                               <button jsId="new_kid_button" dojoType="dijit.form.Button" label="&conify.new_kid_button.label;">
+                                               <button jsId="new_kid_button" dojoType="dijit.form.Button" label="&conify.new_kid_button.label;" onClick="newChild()">
                                                        <script type="dojo/connect" event="startup">
                                                                this.disabled = true;
                                                        </script>
-                                                       <script type="dojo/connect" event="onClick">
-<![CDATA[
-                                                               var new_fm_obj = new aou().fromHash({
-                                                                       isnew                   : 1,
-                                                                       name                    : aou_strings.LABEL_NEW_BRANCH + virgin_ou_id,
-                                                                       opac_visible    : 'f',
-                                                                       shortname               : ou_list_store.getValue( current_ou, 'shortname' ) + '-NEW' + virgin_ou_id--,
-                                                                       parent_ou               : ou_list_store.getValue( current_ou, 'id' ),
-                                                                       ou_type                 : ou_list_store.getValue( current_ou, 'ou_type' )
-                                                               });
-
-                                                               pcrud.create( new_fm_obj, {
-                                                                       timeout : 10,
-                                                                       onerror : function (r) {
-                                                                               highlighter.editor_pane.red.play();
-                                                                               status_update( aou_strings.ERROR_CREATING_CHILD_AOU );
-                                                                       },
-                                                                       oncomplete : function (r) {
-                                                                               var res = r.recv();
-                                                                               if ( res && res.content() ) {
-                                                                                       ou_list_store.newItem(
-                                                                                               res.content().toHash(),
-                                                                                               { parent : current_ou, attribute : 'children' }
-                                                                                       );
-                                                                               } else {
-                                                                                       highlighter.editor_pane.red.play();
-                                                                                       status_update( aou_strings.ERROR_CREATING_CHILD_AOU );
-                                                                               }
-                                                                       }
-                                                               });
-       
-                                                               highlighter.editor_pane.green.play();
-                                                               highlighter.ou_tree.green.play();
-                                                               status_update( dojo.string.substitute(aou_strings.SUCCESS_CREATING_CHILD_AOU, [ou_list_store.getValue( current_ou, 'name' )] ) );
-]]>
-                                                       </script>
                                                </button>
        
                                        </div>
                                                                        </tr>
                                                                </table>
        
-                                                               <button jsId="save_billing_address" dojoType="dijit.form.Button" label="&conify.save_button.label;">
+                                                               <button jsId="save_billing_address" dojoType="dijit.form.Button" label="&conify.save_button.label;" onClick='billingAddrChange()'>
                                                                        <script type="dojo/connect" event="startup">
                                                                                this.disabled = true;
                                                                        </script>
-                                                                       <script type="dojo/connect" event="onClick">
-<![CDATA[
-                                        if (!current_billing_address.isnew()) {
-                                            current_billing_address.ischanged( 1 );
-                                        }
-
-                                        pcrud.apply( current_billing_address, {
-                                            timeout : 10,
-                                            onerror : function (r) {
-                                                highlighter.addresses_pane.red.play();
-                                                status_update( dojo.string.substitute( aou_strings.ERROR_SAVING_PHYSICAL, [ou_list_store.getValue( current_ou, 'name' )] ) );
-                                            },
-                                            oncomplete : function (r) {
-                                                var res = r.recv();
-                                                if (res && res.content()
-                                                    && (current_billing_address.isnew() == 1)) {
-                                                    current_billing_address = res.content();
-
-                                                    ou_list_store.setValue( current_ou, "billing_address", current_billing_address.id());
-                                                    save_org();
-                                                }
-                                                current_billing_address.isnew( 0 );
-                                                current_billing_address.ischanged( 0 );
-                                                highlighter.addresses_pane.green.play();
-                                                status_update( dojo.string.substitute( aou_strings.SUCCESS_SAVING_PHYSICAL, [ou_list_store.getValue( current_ou, 'name' )] ) );
-                                            },
-                                        });
-]]>
-                                                                       </script>
                                                                </button>
                                                        </div>
 
                                                                        </tr>
                                                                </table>
        
-                                                               <button jsId="save_holds_address" dojoType="dijit.form.Button" label="&conify.save_button.label;">
+                                                               <button jsId="save_holds_address" dojoType="dijit.form.Button" label="&conify.save_button.label;" onClick="saveHoldsAddrs()">
                                                                        <script type="dojo/connect" event="startup">
                                                                                this.disabled = true;
                                                                        </script>
-                                                                       <script type="dojo/connect" event="onClick">
-<![CDATA[
-                                        if (!current_holds_address.isnew()) {
-                                            current_holds_address.ischanged( 1 );
-                                        }
-
-                                        pcrud.apply( current_holds_address, {
-                                            timeout : 10,
-                                            onerror : function (r) {
-                                                highlighter.addresses_pane.red.play();
-                                                status_update( dojo.string.substitute( aou_strings.ERROR_SAVING_HOLDS, [ou_list_store.getValue( current_ou, 'name' )] ) );
-                                            },
-                                            oncomplete : function (r) {
-                                                var res = r.recv();
-                                                if (res && res.content()
-                                                    && (current_holds_address.isnew() == 1)) {
-                                                    current_holds_address = res.content();
-
-                                                    ou_list_store.setValue( current_ou, "holds_address", current_holds_address.id());
-                                                    save_org();
-                                                }
-                                                current_holds_address.isnew( 0 );
-                                                current_holds_address.ischanged( 0 );
-                                                highlighter.addresses_pane.green.play();
-                                                status_update( dojo.string.substitute( aou_strings.SUCCESS_SAVING_HOLDS, [ou_list_store.getValue( current_ou, 'name' )] ) );
-                                            },
-                                        });
-]]>
-                                                                       </script>
                                                                </button>
                                                        </div>
 
                                                                        </tr>
                                                                </table>
        
-                                                               <button jsId="save_mailing_address" dojoType="dijit.form.Button" label="&conify.save_button.label;">
+                                                               <button jsId="save_mailing_address" dojoType="dijit.form.Button" label="&conify.save_button.label;" onClick="changeAddr()">
                                                                        <script type="dojo/connect" event="startup">
                                                                                this.disabled = true;
                                                                        </script>
-                                                                       <script type="dojo/connect" event="onClick">
-<![CDATA[
-                                        if (!current_mailing_address.isnew()) {
-                                            current_mailing_address.ischanged( 1 );
-                                        }
-
-                                        pcrud.apply( current_mailing_address, {
-                                            timeout : 10,
-                                            onerror : function (r) {
-                                                highlighter.addresses_pane.red.play();
-                                                status_update( dojo.string.substitute( aou_strings.ERROR_SAVING_MAILING, [ou_list_store.getValue( current_ou, 'name' )] ) );
-                                            },
-                                            oncomplete : function (r) {
-                                                var res = r.recv();
-                                                if (res && res.content()
-                                                    && (current_mailing_address.isnew() == 1)) {
-                                                    current_mailing_address = res.content();
-
-                                                    ou_list_store.setValue( current_ou, "mailing_address", current_mailing_address.id());
-                                                    save_org();
-                                                }
-                                                current_mailing_address.isnew( 0 );
-                                                current_mailing_address.ischanged( 0 );
-                                                highlighter.addresses_pane.green.play();
-                                                status_update( dojo.string.substitute( aou_strings.SUCCESS_SAVING_MAILING, [ou_list_store.getValue( current_ou, 'name' )] ) );
-                                            },
-                                        });
-]]>
-                                                                       </script>
                                                                </button>
                                                        </div>
 
                                                                        </tr>
                                                                </table>
        
-                                                               <button jsId="save_ill_address" dojoType="dijit.form.Button" label="&conify.save_button.label;">
+                                                               <button jsId="save_ill_address" dojoType="dijit.form.Button" label="&conify.save_button.label;" onClick="changeAddr()">
                                                                        <script type="dojo/connect" event="startup">
                                                                                this.disabled = true;
                                                                        </script>
-                                                                       <script type="dojo/connect" event="onClick">
-<![CDATA[
-                                        if (!current_ill_address.isnew()) {
-                                            current_ill_address.ischanged( 1 );
-                                        }
-
-                                        pcrud.apply( current_ill_address, {
-                                            timeout : 10,
-                                            onerror : function (r) {
-                                                highlighter.addresses_pane.red.play();
-                                                status_update( dojo.string.substitute( aou_strings.ERROR_SAVING_ILL, [ou_list_store.getValue( current_ou, 'name' )] ) );
-                                            },
-                                            oncomplete : function (r) {
-                                                var res = r.recv();
-                                                if (res && res.content()
-                                                    && (current_ill_address.isnew() == 1)) {
-                                                    current_ill_address = res.content();
-
-                                                    ou_list_store.setValue( current_ou, "ill_address", current_ill_address.id());
-                                                    save_org();
-                                                }
-                                                current_ill_address.isnew( 0 );
-                                                current_ill_address.ischanged( 0 );
-                                                highlighter.addresses_pane.green.play();
-                                                status_update( dojo.string.substitute( aou_strings.SUCCESS_SAVING_ILL, [ou_list_store.getValue( current_ou, 'name' )] ) );
-                                            },
-                                        });
-]]>
-                                                                       </script>
                                                                </button>
                                                        </div>
                                                </div>
index 066dedd..f9c4e2c 100644 (file)
@@ -50,7 +50,26 @@ var aou_strings = dojo.i18n.getLocalization('openils.conify', 'conify');
 
 //var ou_type_store = new dojo.data.ItemFileWriteStore({ data : aout.toStoreData( globalOrgTypes ) });
 
+// Provides visual alerts when something changes.
 var highlighter = {};
+highlighter.ou_tree = {};
+highlighter.editor_pane = {};
+highlighter.hoo_pane = {};
+highlighter.addresses_pane = {};
+
+highlighter.ou_tree.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'ou_tree', duration : 500 } );
+highlighter.ou_tree.red = dojox.fx.highlight( { color : '#FF2018', node : 'ou_tree', duration : 500 } );
+
+highlighter.editor_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'editor_pane', duration : 500 } );
+highlighter.editor_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'editor_pane', duration : 500 } );
+
+highlighter.hoo_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'hoo_pane', duration : 500 } );
+highlighter.hoo_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'hoo_pane', duration : 500 } );
+
+highlighter.addresses_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'addresses_pane', duration : 500 } );
+highlighter.addresses_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'addresses_pane', duration : 500 } );
+
+
 
 function status_update (markup) {
     if (parent !== window && parent.status_update) parent.status_update( markup );
@@ -162,3 +181,221 @@ function set_addr_inputs (type) {
     window[type + '_addr_san'].setValue( window['current_' + type + '_address'].san() || '' );
 }
 
+/**
+ * 2011/08/08 - Joseph Lewis
+ * 
+ * This function originally resided in org_unit.html, it was too long 
+ * to keep there.
+ * 
+ * 
+ */
+function delete_ou() {
+    var old_name = ou_list_store.getValue( current_ou, 'name' );
+    if (ou_list_store.getValue( current_ou, '_trueRoot' ) == 'true') {
+        highlighter.editor_pane.red.play();
+        status_update( dojo.string.substitute( aou_strings.ERROR_DELETING_LAST_AOU, [ou_list_store.getValue( current_ou, 'name' )] ) );
+        return false;
+    }
+
+    if ( current_ou.children ) {
+        var kids = current_ou.children;
+        if (!dojo.isArray(kids)) kids = [kids];
+
+        var existing_kids = dojo.filter(
+            kids,
+            function(kid){ return kid.isdeleted[0] != 1 }
+        );
+        if ( existing_kids.length > 0) {
+            highlighter.editor_pane.red.play();
+            status_update( dojo.string.substitute( aou_strings.ERROR_ORPHANS, [ou_list_store.getValue( current_ou, 'name' ), existing_kids.length] ) );
+            return;
+        }
+    }
+
+    if (confirm(dojo.string.substitute(aou_strings.CONFIRM_DELETE, [current_ou.name]))) {
+        ou_list_store.setValue( current_ou, 'isdeleted', 1 );
+
+        var modified_ou = new aou().fromStoreItem( current_ou );
+        modified_ou.isdeleted( 1 );
+
+        var objs = [];
+        objs.push(modified_ou);
+        if (!current_billing_address.isnew()) {
+            current_billing_address.isdeleted( 1 );
+            objs.push(current_billing_address);
+        }
+        if (!current_mailing_address.isnew()) {
+            current_mailing_address.isdeleted( 1 );
+            objs.push(current_mailing_address);
+        }
+        if (!current_holds_address.isnew()) {
+            current_holds_address.isdeleted( 1 );
+            objs.push(current_holds_address);
+        }
+        if (!current_ill_address.isnew()) {
+            current_ill_address.isdeleted( 1 );
+            objs.push(current_ill_address);
+        }
+        if (!current_ou_hoo.isnew()) {
+            current_ou_hoo.isdeleted( 1 );
+            objs.push(current_ou_hoo);
+        }
+        pcrud.apply(objs, {
+            timeout : 10,
+            onerror : function (r) {
+                highlighter.editor_pane.red.play();
+                status_update(dojo.string.substitute(aou_strings.ERROR_DELETING, [old_name]));
+            },
+            oncomplete : function (r) {
+                new_kid_button.disabled = true;
+                save_ou_button.disabled = true;
+                delete_ou_button.disabled = true;
+
+                var main_settings_fields = [ 'name', 'shortname', 'email', 'phone', 'ou_type', 'parent_ou' ];
+                for ( var i in main_settings_fields ) {
+                    var field = main_settings_fields[i];
+                    window["editor_pane_" + field].setValue( '' ); // unset the value
+                    window["editor_pane_" + field].setDisplayedValue( '' ); // unset the value
+                }
+
+                ou_list_store.fetch({
+                    query : { id : ou_list_store.getValue( current_ou, 'id' ) },
+                    queryOptions : { deep : true },
+                    onItem : function (item, req) { try { if (this.isItem( item )) this.deleteItem( item ); } catch (e) { } },
+                    scope : ou_list_store
+                });
+
+                current_billing_address = null;
+                current_mailing_address = null;
+                current_holds_address = null;
+                current_ill_address = null;
+                current_ou_hoo = null;
+                current_ou = null;
+
+                highlighter.editor_pane.green.play();
+                status_update(dojo.string.substitute(aou_strings.STATUS_DELETED, [old_name]));
+            }
+        });
+    }
+}
+
+
+function changeAddr() {
+        if (!current_ill_address.isnew()) {
+        current_ill_address.ischanged( 1 );
+    }
+
+    pcrud.apply( current_ill_address, {
+        timeout : 10,
+        onerror : function (r) {
+            highlighter.addresses_pane.red.play();
+            status_update( dojo.string.substitute( aou_strings.ERROR_SAVING_ILL, [ou_list_store.getValue( current_ou, 'name' )] ) );
+        },
+        oncomplete : function (r) {
+            var res = r.recv();
+            if (res && res.content()
+                && (current_ill_address.isnew() == 1)) {
+                current_ill_address = res.content();
+
+                ou_list_store.setValue( current_ou, "ill_address", current_ill_address.id());
+                save_org();
+            }
+            current_ill_address.isnew( 0 );
+            current_ill_address.ischanged( 0 );
+            highlighter.addresses_pane.green.play();
+            status_update( dojo.string.substitute( aou_strings.SUCCESS_SAVING_ILL, [ou_list_store.getValue( current_ou, 'name' )] ) );
+        },
+    });
+}
+
+function saveHoldsAddrs() {
+    if (!current_holds_address.isnew()) {
+        current_holds_address.ischanged( 1 );
+    }
+
+    pcrud.apply( current_holds_address, {
+        timeout : 10,
+        onerror : function (r) {
+            highlighter.addresses_pane.red.play();
+            status_update( dojo.string.substitute( aou_strings.ERROR_SAVING_HOLDS, [ou_list_store.getValue( current_ou, 'name' )] ) );
+        },
+        oncomplete : function (r) {
+            var res = r.recv();
+            if (res && res.content()
+                && (current_holds_address.isnew() == 1)) {
+                current_holds_address = res.content();
+
+                ou_list_store.setValue( current_ou, "holds_address", current_holds_address.id());
+                save_org();
+            }
+            current_holds_address.isnew( 0 );
+            current_holds_address.ischanged( 0 );
+            highlighter.addresses_pane.green.play();
+            status_update( dojo.string.substitute( aou_strings.SUCCESS_SAVING_HOLDS, [ou_list_store.getValue( current_ou, 'name' )] ) );
+        },
+    });
+}
+
+function billingAddrChange() {
+    if (!current_billing_address.isnew()) {
+        current_billing_address.ischanged( 1 );
+    }
+
+    pcrud.apply( current_billing_address, {
+        timeout : 10,
+        onerror : function (r) {
+            highlighter.addresses_pane.red.play();
+            status_update( dojo.string.substitute( aou_strings.ERROR_SAVING_PHYSICAL, [ou_list_store.getValue( current_ou, 'name' )] ) );
+        },
+        oncomplete : function (r) {
+            var res = r.recv();
+            if (res && res.content()
+                && (current_billing_address.isnew() == 1)) {
+                current_billing_address = res.content();
+
+                ou_list_store.setValue( current_ou, "billing_address", current_billing_address.id());
+                save_org();
+            }
+            current_billing_address.isnew( 0 );
+            current_billing_address.ischanged( 0 );
+            highlighter.addresses_pane.green.play();
+            status_update( dojo.string.substitute( aou_strings.SUCCESS_SAVING_PHYSICAL, [ou_list_store.getValue( current_ou, 'name' )] ) );
+        },
+    });
+}
+
+function newChild() {
+    var new_fm_obj = new aou().fromHash({
+        isnew                  : 1,
+        name                   : aou_strings.LABEL_NEW_BRANCH + virgin_ou_id,
+        opac_visible   : 'f',
+        shortname              : ou_list_store.getValue( current_ou, 'shortname' ) + '-NEW' + virgin_ou_id--,
+        parent_ou              : ou_list_store.getValue( current_ou, 'id' ),
+        ou_type                        : ou_list_store.getValue( current_ou, 'ou_type' )
+    });
+
+    pcrud.create( new_fm_obj, {
+        timeout : 10,
+        onerror : function (r) {
+            highlighter.editor_pane.red.play();
+            status_update( aou_strings.ERROR_CREATING_CHILD_AOU );
+        },
+        oncomplete : function (r) {
+            var res = r.recv();
+            if ( res && res.content() ) {
+                ou_list_store.newItem(
+                    res.content().toHash(),
+                    { parent : current_ou, attribute : 'children' }
+                );
+            } else {
+                highlighter.editor_pane.red.play();
+                status_update( aou_strings.ERROR_CREATING_CHILD_AOU );
+            }
+        }
+    });
+
+    highlighter.editor_pane.green.play();
+    highlighter.ou_tree.green.play();
+    status_update( dojo.string.substitute(aou_strings.SUCCESS_CREATING_CHILD_AOU, [ou_list_store.getValue( current_ou, 'name' )] ) );
+
+}
\ No newline at end of file