Index: openacs-4/packages/dotlrn/www/admin/users-bulk-upload-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/users-bulk-upload-2.tcl,v diff -u -r1.11.2.1.4.2 -r1.11.2.1.4.3 --- openacs-4/packages/dotlrn/www/admin/users-bulk-upload-2.tcl 25 Aug 2004 15:50:58 -0000 1.11.2.1.4.2 +++ openacs-4/packages/dotlrn/www/admin/users-bulk-upload-2.tcl 10 Sep 2004 10:09:48 -0000 1.11.2.1.4.3 @@ -50,15 +50,22 @@ oacs_util::csv_foreach -file $file_location -array_name row { # First make sure the required data is there - if { ![info exists row(email)] || ![info exists row(first_names)] || ![info exists row(last_name)] } { - doc_body_append "
Datafile must include at least the email, first_names and last_name fields
" + if { ![info exists row(email)] || ![info exists row(first_names)] || ![info exists row(last_name) || ![info exists row(username)]] } { + doc_body_append "
Datafile must include at least the email, first_names, last_name, username fields
" db_abort_transaction return } # We need to insert the ACS user - set password [ad_generate_random_string] + if {![info exists row(password)]} { + # We need to insert the ACS user + set password [ad_generate_random_string] + } else { + set password $row(password) + } + + # Check if this user already exists set user_id [cc_lookup_email_user $row(email)] if {![empty_string_p $user_id]} { @@ -70,7 +77,7 @@ auth::create_user \ -user_id $user_id \ - -username "" \ + -username "$row(username)" \ -email $row(email) \ -first_names $row(first_names) \ -last_name $row(last_name) \ @@ -95,6 +102,12 @@ set row(id) $row(email) } + if {![info exists row(notify)]} { + set row(notify) f + } else { + set row(notify) t + } + doc_body_append "Creating user $row(email)...." # Now we make them a dotLRN user @@ -120,14 +133,18 @@ set subject [_ dotlrn.user_add_confirm_email_subject $msg_subst_list] # Send note to new user - if [catch {ns_sendmail "$row(email)" "$admin_email" "$subject" "$message"} errmsg] { - doc_body_append "[_ dotlrn.lt_emailing_this_user_fa]" + if { $row(notify) == "t" } { + # Send note to new user + if [catch {ns_sendmail "$row(email)" "$admin_email" "$subject" "$message"} errmsg] { + doc_body_append "[_ dotlrn.lt_emailing_this_user_fa]" set fail_p 1 + } else { + doc_body_append "[_ dotlrn.email_sent]" + lappend list_of_addresses_and_passwords $row(email) $password + } } else { - doc_body_append "[_ dotlrn.email_sent]" + doc_body_append "[_ dotlrn.No_notification_requested]" } - - lappend list_of_addresses_and_passwords $row(email) $password } doc_body_append "
"