started the address handling
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 21 Feb 2006 16:03:48 +0000 (16:03 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 21 Feb 2006 16:03:48 +0000 (16:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@3142 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/patron/user_editor.js
Open-ILS/xul/staff_client/server/patron/user_editor.xml

index c21591a..562aec5 100644 (file)
@@ -27,7 +27,7 @@ var pages             = [
 var pageFocus  = [
        'ue_barcode',
        'ue_email1',
-       'ue_addr_label',
+       'ue_addr_label_1',
        'ue_profile',
        'ue_stat_cat_selector_1',
        'ue_survey_selector_1',
@@ -58,6 +58,7 @@ function uEditInit() {
                        uEditDrawUser(fetchFleshedUser(cgi.param('usr')));
                        uEditBuildLibSelector();
                        uEditFetchIDTypes();
+                       uEditFetchAddrs();
                        uEditFetchGroups();
                        uEditFetchStatCats();
                        uEditFetchSurveys();
@@ -292,6 +293,7 @@ function uEditSaveUser() {
        uEditAddBasicPatronInfo(patron);
        uEditAddPhones(patron);
        uEditAddIdents(patron);
+       uEditAddAddresses(patron);
        uEditAddGroupsAndPerms(patron);
 
        if(ERRORS) { alert(ERRORS); ERRORS = ""; }
@@ -470,7 +472,52 @@ function uEditAddGroupsAndPerms(patron) {
 
        uEditSetVal( patron, "claims_returned_count", 
                $('ue_claims_returned'), 'isnum', 'ue_bad_claims_returned');
+
+       if($('ue_alert_message').value) 
+               uEditSetVal(patron, "alert_message", $('ue_alert_message'));
+}
+
+
+
+function uEditAddAddresses(patron) {
+       var tbody = $('ue_address_tbody');      
+
+       for( var r in tbody.childNodes ) {
+               var row = tbody.childNodes[r];
+               if(!(row && row.nodeName == 'tr')) continue;
+               uEditSetAddress( tbody, row );  
+       }
+}
+
+/* extracts a single address from the page */
+function uEditSetAddress( tbody, row ) {
+
+       var label       = $n(row, 'ue_addr_label');
+       var street1     = $n(row, 'ue_addr_street1');
+       var street2     = $n(row, 'ue_addr_street2');
+       var city                = $n(row, 'ue_addr_city');
+       var county      = $n(row, 'ue_addr_county');
+       var state       = $n(row, 'ue_addr_state');
+       var zip         = $n(row, 'ue_addr_zip');
+       var country = $n(row, 'ue_addr_country');
+
 }
 
 
+var uEditAddrTemplate;
+function uEditFetchAddrs() {
+
+       var tbody = $('ue_address_tbody');
+       uEditAddrTemplate = tbody.removeChild($('ue_address_template'));
+
+       $('ue_address_new').onclick = 
+               function() { tbody.appendChild(uEditAddrTemplate.cloneNode(true)); }
 
+       /* go ahead and add a blank addr */
+       if(!patron) {
+               var row = uEditAddrTemplate.cloneNode(true);
+               $n( row, 'ue_addr_label').id = 'ue_addr_label_1';
+               tbody.appendChild(row); 
+               return;
+       }
+}
index 27fd754..b66d1d7 100644 (file)
@@ -25,9 +25,9 @@
                <script language='javascript' src='/opac/common/js/org_utils.js'> </script>
                <script language='javascript' src='/opac/common/js/init.js'> </script>
                <script language='javascript' src='/opac/common/js/RemoteRequest.js'> </script>
-               <script language='javascript' src='adminlib.js'> </script>
+               <script language='javascript' src='../admin/adminlib.js'> </script>
                <script language='javascript' src='user_editor.js'> </script>
-               <link type='text/css' rel='stylesheet' href='admin.css'/>
+               <link type='text/css' rel='stylesheet' href='../admin/admin.css'/>
   
                <link rel="stylesheet" type="text/css" media="all" 
                        href="/opac/common/js/jscalendar/calendar-brown.css" title="win2k-cold-1" />
                                                                                                        <tr>
                                                                                                                <td colspan='6'>
                                                                                                                        <div class='button_row'>
-                                                                                                                               <input type='submit' name='ue_addr_delete' value='Delete this Address'/>
+                                                                                                                               <input type='submit' name='ue_addr_delete' value='Delete this Address'
+                                                                                                                                       onclick='
+                                                                                                                                               var mytab = this.parentNode.parentNode.parentNode.parentNode.parentNode;
+                                                                                                                                               mytab.parentNode.parentNode.parentNode.removeChild(mytab.parentNode.parentNode);
+                                                                                                                                       '/>
                                                                                                                </div>
                                                                                                        </td>
                                                                                                </tr>
                                                        </table>
 
                                                        <div class='button_row' style='margin-top: 20px;'>
-                                                               <input type='submit' value='Create a New Address'
-                                                                       onclick='$("ue_address_tbody").appendChild($("ue_address_template").cloneNode(true));'/>
+                                                               <input type='submit' value='Create a New Address' id='ue_address_new'/>
                                                        </div>
                                                </div>