--- loncom/interface/loncreateuser.pm 2010/03/21 21:05:42 1.337
+++ loncom/interface/loncreateuser.pm 2010/09/26 01:57:21 1.350
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.337 2010/03/21 21:05:42 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.350 2010/09/26 01:57:21 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1461,7 +1461,8 @@ sub display_existing_roles {
$rolesdump{$newkey} = $newvalue;
}
} else {
- %rolesdump=&Apache::lonnet::dump('roles',$ccdomain,$ccuname);
+ my $extra = &Apache::lonnet::freeze_escape({'skipcheck' => 1});
+ %rolesdump=&Apache::lonnet::dump('roles',$ccdomain,$ccuname,'.',undef,$extra);
}
# Build up table of user roles to allow revocation and re-enabling of roles.
my ($tmp) = keys(%rolesdump);
@@ -1613,7 +1614,10 @@ sub display_existing_roles {
$plaintext=&Apache::lonnet::plaintext($role_code,$class)
} else {
$plaintext=
- "Customrole '$croletitle'
defined by $croleuname\@$croleudom";
+ &mt('Customrole [_1][_2]defined by [_3]',
+ '"'.$croletitle.'"',
+ '
',
+ $croleuname.':'.$croleudom);
}
$row.= '
'.&mt('Please be patient').'
'); + my (%alerts,%rulematch,%inst_results,%curr_rules); my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id'); my @usertools = ('aboutme','blog','portfolio'); @@ -2385,15 +2391,17 @@ sub update_user_data { } } foreach my $item (@requestcourses) { - $newcustom{$item} = $env{'form.crsreq_'.$item}; - if ($env{'form.crsreq_'.$item} eq 'autolimit') { - $newcustom{$item} .= '='; - unless ($env{'form.crsreq_'.$item.'_limit'} =~ /\D/) { - $newcustom{$item} .= $env{'form.crsreq_'.$item.'_limit'}; + if ($env{'form.custom'.$item} == 1) { + $newcustom{$item} = $env{'form.crsreq_'.$item}; + if ($env{'form.crsreq_'.$item} eq 'autolimit') { + $newcustom{$item} .= '='; + unless ($env{'form.crsreq_'.$item.'_limit'} =~ /\D/) { + $newcustom{$item} .= $env{'form.crsreq_'.$item.'_limit'}; + } } + $changed{$item} = &tool_admin($item,$newcustom{$item}, + \%changeHash,'requestcourses'); } - $changed{$item} = &tool_admin($item,$newcustom{$item}, - \%changeHash,'requestcourses'); } } if ($canmodify_status{'inststatus'}) { @@ -2436,8 +2444,11 @@ sub update_user_data { $r->print($error.&mt('You do not have the authority to modify this users authentification information').'.'.$end); } } + + $r->rflush(); # Finish display of header before time consuming actions start + ## - my (@userroles,%userupdate,$cnum,$cdom,$crstype,%namechanged); + my (@userroles,%userupdate,$cnum,$cdom,%namechanged); if ($context eq 'course') { ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity(); $crstype = &Apache::loncommon::course_type($cdom.'_'.$cnum); @@ -2574,7 +2585,8 @@ sub update_user_data { } my ($quotachanged,$oldportfolioquota,$newportfolioquota,$oldinststatus, $newinststatus,$oldisdefault,$newisdefault,%oldsettings, - %oldsettingstext,%newsettings,%newsettingstext,@disporder); + %oldsettingstext,%newsettings,%newsettingstext,@disporder, + $olddefquota,$oldsettingstatus,$newdefquota,$newsettingstatus); @disporder = ('inststatus'); if ($env{'request.role.domain'} eq $env{'form.ccdomain'}) { push(@disporder,'requestcourses'); @@ -2582,8 +2594,10 @@ sub update_user_data { push(@disporder,'reqcrsotherdom'); } push(@disporder,('quota','tools')); - my ($defquota,my $settingstatus) = + $oldinststatus = $userenv{'inststatus'}; + ($olddefquota,$oldsettingstatus) = &Apache::loncommon::default_quota($env{'form.ccdomain'},$oldinststatus); + ($newdefquota,$newsettingstatus) = ($olddefquota,$oldsettingstatus); my %canshow; if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) { $canshow{'quota'} = 1; @@ -2600,7 +2614,6 @@ sub update_user_data { $canshow{'inststatus'} = 1; } my (%changeHash,%changed); - $oldinststatus = $userenv{'inststatus'}; if ($oldinststatus eq '') { $oldsettings{'inststatus'} = $othertitle; } else { @@ -2620,6 +2633,8 @@ sub update_user_data { $changeHash{'inststatus'} = $newinststatus; if ($newinststatus ne $oldinststatus) { $changed{'inststatus'} = $newinststatus; + ($newdefquota,$newsettingstatus) = + &Apache::loncommon::default_quota($env{'form.ccdomain'},$newinststatus); } if (ref($usertypes) eq 'HASH') { $newsettings{'inststatus'} = join(', ',map{ $usertypes->{$_}; } (@inststatuses)); @@ -2633,6 +2648,8 @@ sub update_user_data { $newsettings{'inststatus'} = $othertitle; if ($newinststatus ne $oldinststatus) { $changed{'inststatus'} = $changeHash{'inststatus'}; + ($newdefquota,$newsettingstatus) = + &Apache::loncommon::default_quota($env{'form.ccdomain'},$newinststatus); } } } elsif ($context ne 'selfcreate') { @@ -2655,12 +2672,12 @@ sub update_user_data { } } else { $changed{'quota'} = "a_admin('',\%changeHash); - $newportfolioquota = $defquota; + $newportfolioquota = $newdefquota; $newisdefault = 1; } } else { $oldisdefault = 1; - $oldportfolioquota = $defquota; + $oldportfolioquota = $olddefquota; if ($env{'form.customquota'} == 1) { if ($env{'form.portfolioquota'} eq '') { $newportfolioquota = 0; @@ -2670,15 +2687,15 @@ sub update_user_data { } $changed{'quota'} = "a_admin($newportfolioquota,\%changeHash); } else { - $newportfolioquota = $defquota; + $newportfolioquota = $newdefquota; $newisdefault = 1; } } if ($oldisdefault) { - $oldsettingstext{'quota'} = &get_defaultquota_text($settingstatus); + $oldsettingstext{'quota'} = &get_defaultquota_text($oldsettingstatus); } if ($newisdefault) { - $newsettingstext{'quota'} = &get_defaultquota_text($settingstatus); + $newsettingstext{'quota'} = &get_defaultquota_text($newsettingstatus); } &tool_changes('tools',\@usertools,\%oldsettings,\%oldsettingstext,\%userenv, \%changeHash,\%changed,\%newsettings,\%newsettingstext); @@ -3429,7 +3446,7 @@ sub update_roles { } } # End of foreach (keys(%env)) # Flush the course logs so reverse user roles immediately updated - &Apache::lonnet::flushcourselogs(); + $r->register_cleanup(\&Apache::lonnet::flushcourselogs); if (@rolechanges == 0) { $r->print(&mt('No roles to modify')); } @@ -4380,7 +4397,7 @@ sub print_main_menu { [ { linktext => $links{$linkcontext}{'upload'}, - icon => 'sctr.png', + icon => 'uplusr.png', #help => 'Course_Create_Class_List', url => '/adm/createuser?action=upload', permission => $permission->{'cusr'}, @@ -4388,7 +4405,7 @@ sub print_main_menu { }, { linktext => $links{$linkcontext}{'listusers'}, - icon => 'edit-find.png', + icon => 'mngcu.png', #help => 'Course_View_Class_List', url => '/adm/createuser?action=listusers', permission => ($permission->{'view'} || $permission->{'cusr'}), @@ -4520,7 +4537,7 @@ sub print_main_menu { push(@{ $menu[2]->{items} }, { linktext => 'User Self-Enrollment', - icon => 'cstr.png', + icon => 'self_enroll.png', #help => 'Course_Self_Enrollment', url => '/adm/createuser?action=selfenroll', permission => $permission->{'cusr'}, @@ -4946,7 +4963,7 @@ ENDSCRIPT ''. &Apache::loncommon::plainname($ccuname,$ccudom). '