]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/patron/user_editor.js
c45dc263a393412aa8dbc8e908c73360efafa315
[Evergreen.git] / Open-ILS / xul / staff_client / server / patron / user_editor.js
1
2 var cgi                                 = null;
3 var patron                              = null;
4 var advanced                    = false;
5 var SC_FETCH_ALL     = 'open-ils.circ:open-ils.circ.stat_cat.actor.retrieve.all';
6 var SC_CREATE_MAP               = 'open-ils.circ:open-ils.circ.stat_cat.actor.user_map.create';
7 var SV_FETCH_ALL                = 'open-ils.circ:open-ils.circ.survey.retrieve.all';
8 var FETCH_ID_TYPES      = 'open-ils.actor:open-ils.actor.user.ident_types.retrieve';
9 var FETCH_GROUPS                = 'open-ils.actor:open-ils.actor.groups.tree.retrieve';
10 var identTypes                  = {};
11 var groupTree                   = null;
12 var cachedSurveys               = {};
13 var ERRORS                              = ""; /* global set of errors */
14
15 var myPerms             = [ 'CREATE_USER', 'UPDATE_USER', 'CREATE_PATRON_STAT_CAT_ENTRY_MAP' ];
16
17 var pages               = [ 
18         'uedit_userid', 
19         'uedit_contact_info', 
20         'uedit_addresses', 
21         'uedit_groups', 
22         'uedit_stat_cats', 
23         'uedit_surveys',
24         'uedit_finalize',
25         ];
26
27 /* ID's of objects that should be focused when their page is made visible */
28 var pageFocus   = [
29         'ue_barcode',
30         'ue_email1',
31         'ue_addr_label_1',
32         'ue_profile',
33         'ue_stat_cat_selector_1',
34         'ue_survey_selector_1',
35         'ue_view_summary'
36 ];
37
38 var regexes             = {};
39 regexes.phone   = /\d{3}-\d{3}-\d{4}/;
40 regexes.email   = /\w+\@\w+\.\w+/;
41 regexes.date    = /^\d{4}-\d{2}-\d{2}/;
42 regexes.isnum   = /^\d+$/;
43
44 /* fetch the necessary data to start off */
45 function uEditInit() {
46
47         cgi             = new CGI();
48         session = cgi.param('ses');
49         if(cgi.param('adv')) advanced = true 
50         if(!session) throw "User session is not defined";
51
52         fetchUser(session);
53         $('uedit_user').appendChild(text(USER.usrname()));
54         uEditShowPage('uedit_userid');
55
56         setTimeout( 
57                 function() { 
58                         fetchHighestPermOrgs( SESSION, USER.id(), myPerms );
59                         uEditDrawUser(fetchFleshedUser(cgi.param('usr')));
60                         uEditBuildLibSelector();
61                         uEditFetchIDTypes();
62                         uEditFetchAddrs();
63                         uEditFetchGroups();
64                         uEditFetchStatCats();
65                         uEditFetchSurveys();
66                 }, 20 
67         );
68 }
69
70 /* UI code ---------------------------------------------------- */
71
72 function uEditNext() {
73         var i = _findActive();
74         if( i < (pages.length - 1)) uEditShowPage(pages[i+1]);
75 }
76
77 function uEditPrev() {
78         var i = _findActive();
79         if( i > 0 ) uEditShowPage(pages[i-1]);
80 }
81
82 function uEditFetchError(id) { if($(id)) return $(id).innerHTML + "\n"; return "";}
83
84 function uEditShowPage(id) {
85         if( id == null ) return;
86
87         for( var p in pages ) {
88                 var page = pages[p];
89                 hideMe($(page));
90                 removeCSSClass($(page+'_label'), 'label_active');
91         }
92
93         unHideMe($(id));
94         addCSSClass($(id+'_label'), 'label_active');
95         var idx = _findPageIdx(id);
96         var fpage = pageFocus[idx];
97         if(fpage) { $(fpage).focus(); try{$(fpage).select()}catch(e){} }
98
99         unHideMe($('ue_back'));
100         unHideMe($('ue_fwd'));
101
102         if(idx == 0) hideMe($('ue_back'));
103         if(idx == (pages.length-1)) hideMe($('ue_fwd'));
104 }
105
106
107 function _findActive() {
108         for( var p in pages ) {
109                 if(! $(pages[p]).className.match(/hide_me/) )
110                         return parseInt(p);
111         }
112         return null;
113 }
114 function _findPageIdx(name) {
115         for( var i in pages ) {
116                 var page = pages[i];
117                 if( page == name ) return i;
118         }
119         return -1;
120 }
121
122 function uEditAddrHighlight( node, type ) {
123         var tbody = $('ue_address_tbody');
124         for( var c in tbody.childNodes ) {
125                 var row = tbody.childNodes[c];
126                 if(row.nodeType != XML_ELEMENT_NODE ) continue;
127                 var div = $n(row,'ue_addr_'+type+'_yes').parentNode;
128                 removeCSSClass(div, 'addr_info_checked');
129         }
130         addCSSClass(node.parentNode, 'addr_info_checked');
131 }
132
133
134 /* ------------------------------------------------------------------------------ */
135 /* Fetch code
136 /* ------------------------------------------------------------------------------ */
137 function uEditFetchIDTypes() {
138         var req = new Request(FETCH_ID_TYPES);
139         req.callback(uEditDrawIDTypes);
140         req.send();
141 }
142
143 function uEditFetchStatCats() {
144         var req = new Request(SC_FETCH_ALL, SESSION);
145         req.callback(uEditDrawStatCats);
146         req.send();
147 }
148
149 function uEditFetchSurveys() {
150         var req = new Request(SV_FETCH_ALL, SESSION);
151         req.callback(uEditDrawSurveys);
152         req.send();
153 }
154
155
156 /* ------------------------------------------------------------------------------ */
157 /* Save the user
158 /* ------------------------------------------------------------------------------ */
159 var uEditExistingStatEnties;
160 var uEditExistingSurveyResponses;
161
162 function uEditSaveUser() {
163         uEditCollectData();
164         if(ERRORS) { alert(ERRORS); ERRORS = ""; }
165         else alert(js2JSON(patron));
166 }
167
168 function uEditCollectData() {
169
170         var card                = null;
171
172         if(patron == null) { 
173                 patron = new au(); 
174                 patron.isnew(1);
175                 patron.id(-1);
176                 card = new ac();
177                 patron.card(-1); /* attach to the virtual id of the card */
178                 patron.cards([card]);
179
180         } else { 
181
182                 patron.ischanged(1); 
183                 patron.isnew(0);
184                 uEditExistingStatEnties = patron.stat_cat_entries();
185                 uEditExistingSurveyResponses = patron.survey_responses();
186         }
187
188         patron.stat_cat_entries([]);
189         patron.survey_responses([]);
190
191         uEditFleshCard(card);
192         uEditAddBasicPatronInfo(patron);
193         uEditAddPhones(patron);
194         uEditAddIdents(patron);
195         uEditAddAddresses(patron);
196         uEditAddGroupsAndPerms(patron);
197         uEditReapStatCats(patron);
198         uEditReapSurveys(patron);
199
200 }
201
202
203
204 /* ------------------------------------------------------------------------------ */
205 /* Draw the user
206 /* ------------------------------------------------------------------------------ */
207 function uEditDrawUser(patron) {
208         if(!patron) return 0;
209 }
210
211
212
213
214
215 /* ------------------------------------------------------------------------------ */
216 /* Draw the ID types
217 /* ------------------------------------------------------------------------------ */
218 function uEditDrawIDTypes(r) {
219
220         var types = r.getResultObject();
221         var pri_sel = $('ue_primary_ident_type');
222         var sec_sel = $('ue_secondary_ident_type');
223
224         var idx = 1;
225         for( var t in types ) {
226                 var type = types[t];
227                 identTypes[type.id()] = type;
228                 setSelectorVal( pri_sel, idx, type.name(), type.id() );
229                 setSelectorVal( sec_sel, idx++, type.name(), type.id() );
230         }
231 }
232
233
234
235 /* ------------------------------------------------------------------------------ */
236 /* Stat Cat handling code
237 /* ------------------------------------------------------------------------------ */
238 function uEditDrawStatCats(r) {
239         var cats = r.getResultObject();
240         var tbody = $('ue_stat_cat_tbody');
241         var templ = tbody.removeChild($('ue_stat_cat_row'));
242
243         for( var c in cats ) {
244                 var row = templ.cloneNode(true);
245                 uEditInsertCat( tbody, row, cats[c], c );
246                 tbody.appendChild(row);
247         }
248 }
249
250 /* fleshes the stat cat with entries in the dropdown */
251 function uEditInsertCat( tbody, row, cat, idx ) {
252
253         cat.entries().sort(  /* sort the entries by value */
254                 function( a, b ) { 
255                         if( a.value().toLowerCase() > b.value().toLowerCase()) return 1;
256                         if( a.value().toLowerCase() < b.value().toLowerCase()) return -1;
257                         return 0;
258                 }
259         );
260
261         row.setAttribute('statcat', cat.id());
262         var newval = $n(row, 'ue_stat_cat_newval');
263         newval.onchange = function(){ 
264                 findParentNodeByName(newval,'tr').setAttribute('changed', '1'); }
265
266         var selector = $n(row, 'ue_stat_cat_selector');
267         selector.onchange = function(){ 
268                 findParentByNodeName(selector, 'tr').setAttribute('changed', '1'); 
269                 newval.value = getSelectorName(selector);
270                 newval.setAttribute('entry', getSelectorVal(selector));
271         }
272
273         if( idx == 0 ) selector.id = 'ue_stat_cat_selector_1'; 
274
275         $n(row, 'ue_stat_cat_name').appendChild(text(cat.name()));
276         $n(row, 'ue_stat_cat_owner').appendChild(
277                 text(fetchOrgUnit(cat.owner()).shortname()));
278
279         var idx = 1;
280         for( var e in cat.entries() ) {
281                 var entry = cat.entries()[e];
282                 setSelectorVal( selector, idx++, entry.value(), entry.id() );
283         }
284 }
285
286 /* finds all the changed/new stat entries and updates the patron object*/
287 function uEditReapStatCats(patron) {
288    var tbody = $('ue_stat_cat_tbody');
289         for( var r in tbody.childNodes ) {
290                 var row = tbody.childNodes[r];
291                 if( !row || row.nodeName != 'tr' ) continue;
292                 if( row.getAttribute('changed') ) {
293                         var val = $n( row, 'ue_stat_cat_newval' );
294                         uEditCreateStatEntry( patron, row.getAttribute('statcat'), 
295                                 val.value, val.getAttribute('entry') );
296                 }
297         }
298 }
299
300
301 function uEditCreateStatEntry( patron, catid, newval, entryid ) {
302         var map = new actscecm();
303         map.isnew(1);
304
305         if( ! patron.isnew() ) {
306                 if( grep( uEditExistingStatEntries, 
307                         function(a) { return a.id() == entryid } ) )
308                         map.ischanged(1);
309         }
310
311         map.stat_cat_entry(newval);
312         map.stat_cat(catid);
313         map.target_usr(patron.id());
314         patron.stat_cat_entries().push(map);
315 }
316
317
318
319 /* ------------------------------------------------------------------------------ */
320 /* Survey handling code
321 /* ------------------------------------------------------------------------------ */
322 function uEditDrawSurveys(r) {
323
324         var surveys = r.getResultObject();
325         var div = $('uedit_surveys');
326         var table = div.removeChild($('ue_survey_table'));
327
328         var x = 0;
329         for( var s in surveys ) {
330                 var survey = surveys[s];
331                 cachedSurveys[survey.id()] = survey;
332                 var clone = table.cloneNode(true);
333                 uEditInsertSurvey( div, clone, survey, x++ );
334                 div.appendChild(clone);
335         }
336 }
337
338 function uEditInsertSurvey( div, table, survey, sidx ) {
339         $n(table, 'ue_survey_name').appendChild(text(survey.name()));
340         $n(table, 'ue_survey_desc').appendChild(text(survey.description()));
341         var tbody = $n(table, 'ue_survey_tbody');
342         var templ = tbody.removeChild($n(table, 'ue_survey_row'));
343
344         var polldiv             = $('ue_survey_answer_poll');
345
346         var idx = 1;
347         for( var q in survey.questions() ) {
348                 var row = templ.cloneNode(true);
349                 uEditInsertSurveyQuestion( div, table, tbody, row, survey, survey.questions()[q], sidx );
350                 tbody.appendChild(row);
351         }
352 }
353
354 function uEditInsertSurveyQuestion( div, table, tbody, row, survey, question, sidx ) {
355
356         $n(row, 'ue_survey_question').appendChild(text(question.question()));
357
358         var selector    = $n(row, 'ue_survey_answer');
359         var polldiv             = $n(row, 'ue_survey_answer_poll');
360         var idx                 = 1;
361         var polltbody   = $n(row, 'ue_survey_answer_poll_tbody');
362         var pollrow             = polltbody.removeChild($n(polltbody, 'ue_survey_answer_poll_row'));
363
364         table.setAttribute('survey', survey.id());
365         row.setAttribute('question', question.id());
366
367         selector.onchange = function() {
368                 row.setAttribute('answer', getSelectorVal(selector));
369                 row.setAttribute('changed', '1');
370         }
371
372         if( sidx == 0 ) selector.id = 'ue_survey_selector_1'; 
373
374         for( var a in question.answers() ) {
375
376                 var answer = question.answers()[a];
377
378                 if( survey.poll() ) {
379
380                         unHideMe(polldiv);
381                         var prow = pollrow.cloneNode(true);
382
383                         prow.onselect   = function() {
384                                 row.setAttribute('answer', answer.id());
385                                 row.setAttribute('changed', '1');
386                         }
387
388                         $n(prow, 'ue_survey_answer_poll_answer').appendChild(text(answer.answer()));
389
390                         $n(prow, 'ue_survey_answer_poll_radio').appendChild(
391                                 elem('input', { 
392                                         type    : 'radio', 
393                                         name    : 'survey_poll_answer_'+survey.id(),
394                                         id              :  answer.id()
395                                 }));
396
397                         polltbody.appendChild(prow);
398
399                 } else {
400
401                         unHideMe(selector.parentNode);
402                         setSelectorVal( selector, idx++, answer.answer(), answer.id() );
403                 }
404         }
405 }
406
407
408 function uEditReapSurveys(patron) {
409
410         var div = $('uedit_surveys');
411         var tables = getElementsByTagNameFlat(div, 'table');
412
413         for( var t in tables ) {
414
415                 var table               = tables[t];
416                 var survey              = cachedSurveys[table.getAttribute('survey')];
417                 var tbody               = getElementsByTagNameFlat( table, 'tbody' )[0];
418                 var rows                        = getElementsByTagNameFlat( tbody, 'tr' );
419
420                 for( var r in rows ) {
421                         var row = rows[r];
422                         var resp        = new asvr();
423                         resp.isnew(1);
424                         resp.survey(survey.id());
425                         resp.usr(patron.id());
426                         resp.question(row.getAttribute('question'));
427                         resp.answer(row.getAttribute('answer'));
428                         patron.survey_responses().push( resp );
429                 }
430         }
431 }
432
433
434
435
436
437
438 /* returns true if an error occurred */
439 function uEditSetVal( obj, func, val, regxtype, errtype ) {
440
441         var error = uEditFetchError(errtype);
442         var iserr = false;
443
444         while(1) {
445
446                 if( val == null ) { iserr = true; break; }
447
448                 if(!instanceOf(val, String)) {
449                         try { val = val.value; } catch(e) { return; }
450                 }
451
452                 if(val == "" ) { iserr = true; break; }
453
454                 if(regxtype && regexes[regxtype] 
455                         && !val.match(regexes[regxtype]) ) { iserr = true; break; }
456
457                 try { obj[func](val); } catch(e) {
458                         alert("Error running function: " +func);
459                 }
460
461                 break;
462         }
463
464         if(iserr) { ERRORS += error; return true; }
465         return false;
466 }
467
468
469 function uEditAddBasicPatronInfo(patron) {
470
471
472
473         /* make sure passwords match */
474         var p1 = $('ue_password1').value;
475         var p2 = $('ue_password1').value;
476         if( p1 != p2 || uEditSetVal( patron, "passwd", p1 )) 
477                 ERRORS += uEditFetchError('ue_bad_password');
478
479         uEditSetVal(patron, "usrname", $('ue_username'), null, 'ue_bad_username' );
480         uEditSetVal(patron, "first_given_name", $('ue_firstname'), null, 'ue_bad_firstname' );
481         uEditSetVal(patron, "second_given_name", $('ue_middlename'), null, 'ue_bad_middlename' ); 
482         uEditSetVal(patron, "family_name", $('ue_lastname'), null, 'ue_bad_lastname' ); 
483         uEditSetVal(patron, "dob", $('ue_dob'), 'date', 'ue_bad_dob' );
484
485         patron.suffix($('ue_suffix').value); /* suffis isn't required */
486
487
488         /* make sure emails match */
489         var email       = $('ue_email1').value;
490         var email2      = $('ue_email2').value;
491         if( email != email2 || uEditSetVal(patron, "email", email, 'email' ))
492                 ERRORS += uEditFetchError('ue_bad_email');
493
494         patron.home_ou(getSelectorVal($('ue_org_selector')));
495 }
496
497 function uEditAddPhones(patron) {
498
499
500         /* verifies the phone numbers are formatted correctly */
501         var verify = function(n1, n2, n3) {
502                 var a = n1.value;
503                 var p = n2.value;
504                 var s = n3.value;
505                 if( !a || !p || !s ) return false;
506                 return a + '-' + p + '-' + s;
507         }
508
509
510         var er = 'ue_bad_phone'
511
512         uEditSetVal( patron, "day_phone", 
513                 verify($('ue_day_phone_area'), 
514                 $('ue_day_phone_prefix'), 
515                 $('ue_day_phone_suffix')), 'phone', er );
516
517         uEditSetVal( patron, "evening_phone", 
518                 verify($('ue_night_phone_area'), 
519                 $('ue_night_phone_prefix'), 
520                 $('ue_night_phone_suffix')), 'phone', er );
521
522         uEditSetVal( patron, "other_phone", 
523                 verify($('ue_other_phone_area'), 
524                 $('ue_other_phone_prefix'), 
525                 $('ue_other_phone_suffix')), 'phone', er );
526
527 }
528
529 function uEditFleshCard(card) {
530         if(!card) return "";
531
532         if(uEditSetVal( card, "barcode", $('ue_barcode'), null, 'ue_bad_barcode' ))
533                 return; 
534
535         card.id(-1);
536         card.active(1);
537         return "";
538 }
539
540 function uEditAddIdents(patron) {
541
542         var err = 'ue_no_ident';
543
544         uEditSetVal( patron, "ident_type", 
545                 getSelectorVal($('ue_primary_ident_type')), 'isnum', err );
546
547         uEditSetVal( patron, "ident_type2", 
548                 getSelectorVal($('ue_secondary_ident_type')), 'isnum', err );
549
550         uEditSetVal( patron, "ident_value", 
551                 $('ue_primary_ident'), null, err );
552
553         uEditSetVal( patron, "ident_value2", 
554                 $('ue_secondary_ident'), null, err );
555
556 }
557
558
559 function uEditBuildLibSelector( node, depth, selector ) {
560         if(!selector) selector = $('ue_org_selector');
561         if(!node) { depth = 0; node = globalOrgTree; }
562         
563         var opt = insertSelectorVal( selector, -1, node.name(), node.id(), null, depth++ );
564
565         /* allow these orgs to be selectable via permission? */
566         if(!findOrgType(node.ou_type()).can_have_vols()) opt.disabled = true; 
567
568         if( node.id() == USER.home_ou() ) setSelector(selector, node.id());
569         for( var c in node.children() ) 
570                 uEditBuildLibSelector(node.children()[c], depth, selector);
571 }
572
573 function uEditFetchGroups() {
574         var req = new Request(FETCH_GROUPS);
575         req.callback(uEditDrawGroups);
576         req.send();
577 }
578
579 function uEditDrawGroups(r, tree, depth, selector) {
580
581         if(!tree) {
582                 tree = r.getResultObject();     
583                 depth = 0;
584                 groupTree = tree;
585                 selector = $('ue_profile');
586         }
587
588         insertSelectorVal( selector, -1, tree.name(), tree.id(), null, depth++ );       
589         for( var c in tree.children() ) 
590                 uEditDrawGroups( null, tree.children()[c], depth, selector );
591 }
592
593
594
595 function uEditAddGroupsAndPerms(patron) {
596
597         uEditSetVal( patron, "profile", 
598                 getSelectorVal($('ue_profile')), 'isnum', 'ue_no_profile');
599
600         var expire = $('ue_expire').value;
601         if(expire) 
602                 uEditSetVal( patron, "expire_date", expire, 'date', 'ue_bad_expire' );
603
604         if($('ue_active').checked) patron.active(1);
605         if($('ue_barred').checked) patron.barred(1);
606         if($('ue_group_lead').checked) patron.master_account(1);
607
608         uEditSetVal( patron, "claims_returned_count", 
609                 $('ue_claims_returned'), 'isnum', 'ue_bad_claims_returned');
610
611         if($('ue_alert_message').value) 
612                 uEditSetVal(patron, "alert_message", $('ue_alert_message'));
613 }
614
615
616
617 function uEditAddAddresses(patron) {
618         var tbody = $('ue_address_tbody');      
619         patron.addresses([]);
620
621         /* shove the addresses living in the page into the patron */
622         for( var r in tbody.childNodes ) {
623                 var row = tbody.childNodes[r];
624                 if(!(row && row.nodeName == 'tr')) continue;
625                 patron.addresses().push( uEditBuildAddress( patron, tbody, row ));      
626         }
627 }
628
629 /* extracts a single address from the page */
630 var uEditVirtualAddrId = -1;
631 function uEditBuildAddress( patron, tbody, row ) {
632
633         var addr = new aua();
634         var id = row.getAttribute('exists');
635
636         if(id) {
637                 addr.id(id)
638                 addr.ischanged(1);
639                 addr.isnew(0);
640         } else {
641                 addr.id(uEditVirtualAddrId--);
642                 addr.isnew(1);
643         }
644
645         if($n(row, 'ue_addr_mailing_yes')) patron.mailing_address(addr.id());
646         if($n(row, 'ue_addr_billing_yes')) patron.billing_address(addr.id());
647
648         uEditSetVal(addr, "address_type",       $n(row, 'ue_addr_address_type'),        null, 'ue_bad_addr_address_type' );
649         uEditSetVal(addr, "street1",                    $n(row, 'ue_addr_street1'),             null, 'ue_bad_addr_street' );
650         uEditSetVal(addr, "street2",                    $n(row, 'ue_addr_street2'),             null, 'ue_bad_addr_street' );
651         uEditSetVal(addr, "city",                               $n(row, 'ue_addr_city'),                        null, 'ue_bad_addr_city' );
652         uEditSetVal(addr, "county",                     $n(row, 'ue_addr_county'),                      null, 'ue_bad_addr_county' );
653         uEditSetVal(addr, "state",                              $n(row, 'ue_addr_state'),                       null, 'ue_bad_addr_state' );
654         uEditSetVal(addr, "post_code",          $n(row, 'ue_addr_post_code'),           null, 'ue_bad_addr_post_code' );
655         uEditSetVal(addr, "country",                    $n(row, 'ue_addr_country'),             null, 'ue_bad_addr_country' );
656
657         return addr;
658 }
659
660
661 var uEditAddrTemplate;
662 function uEditFetchAddrs() {
663
664         var tbody = $('ue_address_tbody');
665         uEditAddrTemplate = tbody.removeChild($('ue_address_template'));
666
667         $('ue_address_new').onclick = 
668                 function() { tbody.appendChild(uEditAddrTemplate.cloneNode(true)); }
669
670         /* go ahead and add a blank addr */
671         if(!patron) {
672                 var row = uEditAddrTemplate.cloneNode(true);
673                 $n( row, 'ue_addr_label').id = 'ue_addr_label_1';
674                 tbody.appendChild(row); 
675                 return;
676         }
677 }
678
679
680 function uEditShowSummary() {
681         uEditCollectData();
682         var table = $('ue_summary_table');
683         uEditFleshSummaryTable(table);
684         var win = window.open("", $('ue_summary_window').innerHTML );   
685         win.document.body.appendChild(table.cloneNode(true));
686 }
687
688 function uEditFleshSummaryTable(table) {
689         var identt1 = "";
690         var identt2 = "";
691         var homeorg = "";
692
693         if( patron.ident_type() != null) 
694                 identt1 = identTypes[patron.ident_type()].name();
695         if( patron.ident_type2() != null ) 
696                 identt2 = identTypes[patron.ident_type()].name();
697         if( patron.home_ou() != null )
698                 homeorg = findOrgUnit(patron.home_ou()).name();
699
700         $('ue_summary_username').appendChild(text(patron.usrname()));
701         $('ue_summary_firstname').appendChild(text(patron.first_given_name()));
702         $('ue_summary_middlename').appendChild(text(patron.second_given_name()));
703         $('ue_summary_lastname').appendChild(text(patron.family_name()));
704         $('ue_summary_suffix').appendChild(text(patron.suffix()));
705         $('ue_summary_dob').appendChild(text(patron.dob()));
706         $('ue_summary_primary_ident_type').appendChild(text(identt1));
707         $('ue_summary_primary_ident').appendChild(text(patron.ident_value()));
708         $('ue_summary_secondary_ident_type').appendChild(text(identt2));
709         $('ue_summary_secondary_ident').appendChild(text(patron.ident_value2()));
710         $('ue_summary_email').appendChild(text(patron.email()));
711         $('ue_summary_dayphone').appendChild(text(patron.day_phone()));
712         $('ue_summary_nightphone').appendChild(text(patron.evening_phone()));
713         $('ue_summary_otherphone').appendChild(text(patron.other_phone()));
714         $('ue_summary_home_lib').appendChild(text(homeorg));
715 }
716
717