--- loncom/interface/loncreateuser.pm 2008/07/13 09:53:16 1.254
+++ loncom/interface/loncreateuser.pm 2008/11/27 15:15:06 1.264
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.254 2008/07/13 09:53:16 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.264 2008/11/27 15:15:06 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,11 +33,13 @@ package Apache::loncreateuser;
=head1 NAME
-Apache::loncreateuser - handler to create users and custom roles
+Apache::loncreateuser.pm
=head1 SYNOPSIS
-Apache::loncreateuser provides an Apache handler for creating users,
+ Handler to create users and custom roles
+
+ Provides an Apache handler for creating users,
editing their login parameters, roles, and removing roles, and
also creating and assigning custom roles.
@@ -833,10 +835,10 @@ ENDNOPORTPRIV
$addrolesdisplay = $add_domainroles;
}
$r->print(&course_level_dc($env{'request.role.domain'},'Course'));
- $r->print('
'."\n");
+ $r->print('
'."\n");
} elsif ($context eq 'author') {
if ($addrolesdisplay) {
- $r->print('
print('
print(' onClick="auth_check()" \>'."\n");
} else {
@@ -848,7 +850,7 @@ ENDNOPORTPRIV
}
} else {
$r->print(&course_level_table(%inccourses));
- $r->print('
'."\n");
+ $r->print('
'."\n");
}
}
$r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','userrole','ccdomain','prevphase','currstate','ccuname','ccdomain']));
@@ -967,7 +969,7 @@ sub display_existing_roles {
if (defined($coursedata{'description'})) {
$carea=$coursedata{'description'}.
'
'.&mt('Domain').': '.$coursedom.(' 'x8).
- &Apache::loncommon::syllabuswrapper('Syllabus',$coursedir,$coursedom);
+ &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$coursedir,$coursedom);
$sortkey.="\0".$coursedata{'description'};
$class=$coursedata{'type'};
} else {
@@ -1397,30 +1399,22 @@ sub modify_login_block {
sub personal_data_display {
my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray) = @_;
- my ($output,$showforceid,%userenv,%canmodify,@inststatuses);
+ my ($output,$showforceid,%userenv,%canmodify);
my @userinfo = ('firstname','middlename','lastname','generation',
'permanentemail','id');
my $rowcount = 0;
my $editable = 0;
- if ($context eq 'selfcreate') {
- if (ref($inst_results) eq 'HASH') {
- @inststatuses = &get_inststatuses($inst_results);
- if (@inststatuses == 0) {
- @inststatuses = ('default');
- }
- $rolesarray = \@inststatuses;
- }
- }
if (!$newuser) {
# Get the users information
%userenv = &Apache::lonnet::get('environment',
['firstname','middlename','lastname','generation',
'permanentemail','id'],$ccdomain,$ccuname);
- }
- if ((!$newuser) || ($context eq 'selfcreate')) {
%canmodify =
&Apache::lonuserutils::can_modify_userinfo($context,$ccdomain,
\@userinfo,$rolesarray);
+ } elsif ($context eq 'selfcreate') {
+ %canmodify = &selfcreate_canmodify($context,$ccdomain,\@userinfo,
+ $inst_results,$rolesarray);
}
my %lt=&Apache::lonlocal::texthash(
'pd' => "Personal Data",
@@ -1429,7 +1423,7 @@ sub personal_data_display {
'lastname' => "Last Name",
'generation' => "Generation",
'permanentemail' => "Permanent e-mail address",
- 'id' => "ID/Student Number",
+ 'id' => "Student/Employee ID",
'lg' => "Login Data"
);
my %textboxsize = (
@@ -1506,6 +1500,21 @@ sub personal_data_display {
}
}
+sub selfcreate_canmodify {
+ my ($context,$dom,$userinfo,$inst_results,$rolesarray) = @_;
+ if (ref($inst_results) eq 'HASH') {
+ my @inststatuses = &get_inststatuses($inst_results);
+ if (@inststatuses == 0) {
+ @inststatuses = ('default');
+ }
+ $rolesarray = \@inststatuses;
+ }
+ my %canmodify =
+ &Apache::lonuserutils::can_modify_userinfo($context,$dom,$userinfo,
+ $rolesarray);
+ return %canmodify;
+}
+
sub get_inststatuses {
my ($insthashref) = @_;
my @inststatuses = ();
@@ -1840,7 +1849,7 @@ sub update_user_data {
$env{'form.c'.$item} = $userenv{$item};
}
}
- # Check to see if we can change the ID/student number
+ # Check to see if we can change the Student/Employee ID
my $forceid = $env{'form.forceid'};
my $recurseid = $env{'form.recurseid'};
my (%alerts,%rulematch,%idinst_results,%curr_rules,%got_rules);
@@ -1851,7 +1860,10 @@ sub update_user_data {
(!$forceid)) {
if ($env{'form.cid'} ne $uidhash{$env{'form.ccuname'}}) {
$env{'form.cid'} = $userenv{'id'};
- $no_forceid_alert = &mt('New student/employeeID does not match existing ID for this user.').'
'.&mt('Change is not permitted without checking the \'Force ID change\' checkbox on the previous page.').'
'."\n";
+ $no_forceid_alert = &mt('New Student/Employee ID does not match existing ID for this user.')
+ .'
'
+ .&mt("Change is not permitted without checking the 'Force ID change' checkbox on the previous page.")
+ .'
'."\n";
}
}
if ($env{'form.cid'} ne $userenv{'id'}) {
@@ -1965,7 +1977,7 @@ sub update_user_data {
'mddl' => "middle",
'lst' => "last",
'gen' => "generation",
- 'id' => "ID/Student number",
+ 'id' => "Student/Employee ID",
'mail' => "permanent e-mail",
'disk' => "disk space allocated to portfolio files",
'prvs' => "Previous",
@@ -2048,7 +2060,7 @@ END
# They did not want to change the users name or quota but we can
# still tell them what the name and quota are
my %lt=&Apache::lonlocal::texthash(
- 'id' => "ID/Student number",
+ 'id' => "Student/Employee ID",
'mail' => "Permanent e-mail",
'disk' => "Disk space allocated to user's portfolio files",
);
@@ -2091,8 +2103,10 @@ END
$r->print(''.$rolestr.'
'.
&mt('Contact your helpdesk for more information.',"javascript:helpMenu('display')").'
');
}
- $r->print($no_forceid_alert.
- &Apache::lonuserutils::print_namespacing_alerts($env{'form.ccdomain'},\%alerts,\%curr_rules));
+ $r->print(''
+ .$no_forceid_alert
+ .&Apache::lonuserutils::print_namespacing_alerts($env{'form.ccdomain'},\%alerts,\%curr_rules)
+ .'');
}
if ($env{'form.action'} eq 'singlestudent') {
&enroll_single_student($r,$uhome,$amode,$genpwd,$now,$newuser,$context);
@@ -2593,7 +2607,7 @@ sub custom_role_editor {
my @template_roles = ("cc","in","ta","ep","st");
foreach my $role (@template_roles) {
$head_script .= &make_script_template($role);
- $button_code .= &make_button_code($role);
+ $button_code .= &make_button_code($role).' ';
}
$head_script .= "\n".$jsback."\n".''."\n";
$r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script));
@@ -2613,10 +2627,15 @@ sub custom_role_editor {
'crl' => "Course Level",
'dml' => "Domain Level",
'ssl' => "System Level");
- $r->print(&mt('Select a Template').'
');
- $r->print('