Index: openacs-4/packages/acs-subsite/lib/user-info.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/lib/user-info.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-subsite/lib/user-info.tcl 17 Sep 2003 12:03:00 -0000 1.3 +++ openacs-4/packages/acs-subsite/lib/user-info.tcl 17 Sep 2003 14:25:54 -0000 1.4 @@ -18,7 +18,7 @@ set action_url "[subsite::get_element -element url]user/basic-info-update" -acs_user::get -array user -include_bio +acs_user::get -user_id $user_id -array user -include_bio set authority_name [auth::authority::get_element -authority_id $user(authority_id) -element pretty_name] @@ -30,17 +30,19 @@ foreach elm $read_only_elements { set mode($elm) {display} } -set focus {} +set first_element {} foreach elm $form_elms { if { [empty_string_p $mode($elm)] } { - set focus "user_login.$elm" + set first_element $elm break } } +set focus "user_info.$first_element" set read_only_notice_p [expr [llength $read_only_elements] > 0] set edit_mode_p [expr ![empty_string_p [form::get_action user_info]]] ad_form -name user_info -cancel_url $return_url -action $action_url -mode display -form { + {user_id:integer(hidden),optional} {return_url:text(hidden),optional {value $return_url}} } @@ -90,42 +92,50 @@ {label "About yourself"} {html {rows 8 cols 60}} {mode $mode(bio)} + {display_value {[ad_text_to_html -- $user(bio)]}} } } -on_request { foreach var { first_names last_name email username screen_name url bio } { set $var $user($var) } } -on_submit { - db_transaction { + set user_info(authority_id) $user(authority_id) + set user_info(username) $user(username) + foreach elm $form_elms { + if { [empty_string_p $mode($elm)] } { + set user_info($elm) [string trim [set $elm]] + } + } - # TODO: Only change editable elements + array set result [auth::update_local_account \ + -authority_id $user(authority_id) \ + -username $user(username) \ + -array user_info] - person::update \ - -person_id $user_id \ - -first_names $first_names \ - -last_name $last_name - - party::update \ - -party_id $user_id \ - -email $email \ - -url $url - acs_user::update \ - -user_id $user_id \ - -screen_name $screen_name - - person::update_bio \ - -person_id $user_id \ - -bio $bio + # Handle authentication problems + switch $result(update_status) { + ok { + # Continue below + } + default { + # Adding the error to the first element, but only if there are no element messages + if { [llength $result(element_messages)] == 0 } { + form set_error user_info $first_element $result(update_message) + } + + # Element messages + foreach { elm_name elm_error } $result(element_messages) { + form set_error user_info $elm_name $elm_error + } + break + } } } -after_submit { ad_returnredirect $return_url ad_script_abort } -# TODO: Validate email: [util_email_valid_p $email] -# TODO: Validate email unique - # LARS HACK: Make the URL and email elements real links if { ![form is_valid user_info] } { element set_properties user_info email -display_value "[element get_value user_info email]" @@ -137,3 +147,4 @@ "[element get_value user_info url]" } } + Index: openacs-4/packages/acs-subsite/www/shared/community-member.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/community-member.adp,v diff -u -r1.8 -r1.9 --- openacs-4/packages/acs-subsite/www/shared/community-member.adp 31 Aug 2003 06:19:41 -0000 1.8 +++ openacs-4/packages/acs-subsite/www/shared/community-member.adp 17 Sep 2003 14:25:54 -0000 1.9 @@ -56,7 +56,7 @@ Biography:

- @bio@ + @bio;noquote@
Index: openacs-4/packages/acs-subsite/www/shared/community-member.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/shared/community-member.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-subsite/www/shared/community-member.tcl 31 Aug 2003 06:16:00 -0000 1.9 +++ openacs-4/packages/acs-subsite/www/shared/community-member.tcl 17 Sep 2003 14:25:54 -0000 1.10 @@ -62,7 +62,7 @@ set url "http://$url" } -set bio [person::get_bio -person_id $user_id] +set bio [ad_text_to_html -- [person::get_bio -person_id $user_id]] # Do we show the portrait? set inline_portrait_state "none" Index: openacs-4/packages/acs-subsite/www/user/basic-info-update.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/user/basic-info-update.adp,v diff -u -r1.8 -r1.9 --- openacs-4/packages/acs-subsite/www/user/basic-info-update.adp 17 Sep 2003 12:03:00 -0000 1.8 +++ openacs-4/packages/acs-subsite/www/user/basic-info-update.adp 17 Sep 2003 14:25:54 -0000 1.9 @@ -1,8 +1,8 @@ @page_title@ @context;noquote@ - @focus;noquote@

#acs-subsite.Basic_Information#

- + + Index: openacs-4/packages/acs-subsite/www/user/basic-info-update.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/user/basic-info-update.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-subsite/www/user/basic-info-update.tcl 17 Sep 2003 12:03:00 -0000 1.5 +++ openacs-4/packages/acs-subsite/www/user/basic-info-update.tcl 17 Sep 2003 14:25:54 -0000 1.6 @@ -12,7 +12,7 @@ set page_title "Update Basic Information" -if { ![exists_and_not_null user_id] } { +if { [empty_string_p $user_id] || ($user_id == [ad_conn user_id]) } { set context [list [list [ad_pvt_home] [ad_pvt_home_name]] $page_title] } else { set context [list $page_title]