--- loncom/interface/loncreateuser.pm 2010/04/23 17:51:42 1.295.2.33
+++ loncom/interface/loncreateuser.pm 2010/09/20 00:51:14 1.349
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.295.2.33 2010/04/23 17:51:42 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.349 2010/09/20 00:51:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -685,7 +685,7 @@ ENDBLOCK
);
my $sellink=&Apache::loncommon::selectstudent_link('crtusername','srchterm','srchdomain');
my ($title,$buttontext,$showresponse);
- if ($env{'form.action'} eq 'singlestudent') {
+ if ($env{'form.action'} eq 'singlestudent') {
if ($crstype eq 'Community') {
$title = $lt{'enrm'};
} else {
@@ -1053,8 +1053,8 @@ ENDFORMINFO
}
} else {
foreach my $key (keys(%env)) {
- if ($key=~/^user\.priv\.cm\.\/($match_domain)\/($match_username)/) {
- $inccourses{$1.'_'.$2}=1;
+ if ($key=~/^user\.priv\.cm\.\/($match_domain)\/($match_username)/) {
+ $inccourses{$1.'_'.$2}=1;
}
}
}
@@ -1428,7 +1428,7 @@ sub display_existing_roles {
my (%rolesdump,%roletext,%sortrole,%roleclass,%rolepriv);
if ($context eq 'course' || $context eq 'author') {
my @roles = &Apache::lonuserutils::roles_by_context($context,1,$crstype);
- my %roleshash =
+ my %roleshash =
&Apache::lonnet::get_my_roles($ccuname,$ccdomain,'userroles',
['active','previous','future'],\@roles,$roledom,1);
foreach my $key (keys(%roleshash)) {
@@ -1499,7 +1499,7 @@ sub display_existing_roles {
if (defined($coursedata{'description'})) {
$carea=$coursedata{'description'}.
'
'.&mt('Domain').': '.$coursedom.(' 'x8).
- &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$coursedir,$coursedom);
+ &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$coursedir,$coursedom);
$sortkey.="\0".$coursedata{'description'};
} else {
if ($class eq 'Community') {
@@ -1525,10 +1525,10 @@ sub display_existing_roles {
$allowed = 1;
}
}
- }
+ }
if ((&Apache::lonnet::allowed('dro',$coursedom)) ||
(&Apache::lonnet::allowed('dro',$ccdomain))) {
- $delallowed=1;
+ $delallowed=1;
}
# - custom role. Needs more info, too
if ($croletitle) {
@@ -1541,11 +1541,11 @@ sub display_existing_roles {
$carea.='
Section: '.$3;
$sortkey.="\0$3";
if (!$allowed) {
- if ($env{'request.course.sec'} eq $3) {
- if (&Apache::lonnet::allowed('c'.$role_code,$1.'/'.$2.'/'.$3)) {
- $allowed = 1;
- }
- }
+ if ($env{'request.course.sec'} eq $3) {
+ if (&Apache::lonnet::allowed('c'.$role_code,$1.'/'.$2.'/'.$3)) {
+ $allowed = 1;
+ }
+ }
}
}
$area=$carea;
@@ -1554,8 +1554,8 @@ sub display_existing_roles {
# Determine if current user is able to revoke privileges
if ($area=~m{^/($match_domain)/}) {
if ((&Apache::lonnet::allowed('c'.$role_code,$1)) ||
- (&Apache::lonnet::allowed('c'.$role_code,$ccdomain))) {
- $allowed=1;
+ (&Apache::lonnet::allowed('c'.$role_code,$ccdomain))) {
+ $allowed=1;
}
if (((&Apache::lonnet::allowed('dro',$1)) ||
(&Apache::lonnet::allowed('dro',$ccdomain))) &&
@@ -1613,13 +1613,16 @@ 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'); @@ -2381,7 +2386,7 @@ sub update_user_data { if ($env{'form.custom'.$item} == 1) { $newcustom{$item} = $env{'form.tools_'.$item}; $changed{$item} = &tool_admin($item,$newcustom{$item}, - \%changeHash,'tools'); + \%changeHash,'tools'); } } foreach my $item (@requestcourses) { @@ -2438,8 +2443,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); @@ -2586,7 +2594,7 @@ sub update_user_data { } push(@disporder,('quota','tools')); $oldinststatus = $userenv{'inststatus'}; - ($olddefquota,$oldsettingstatus) = + ($olddefquota,$oldsettingstatus) = &Apache::loncommon::default_quota($env{'form.ccdomain'},$oldinststatus); ($newdefquota,$newsettingstatus) = ($olddefquota,$oldsettingstatus); my %canshow; @@ -2606,7 +2614,7 @@ sub update_user_data { } my (%changeHash,%changed); if ($oldinststatus eq '') { - $oldsettings{'inststatus'} = $othertitle; + $oldsettings{'inststatus'} = $othertitle; } else { if (ref($usertypes) eq 'HASH') { $oldsettings{'inststatus'} = join(', ',map{ $usertypes->{ &unescape($_) }; } (split(/:/,$userenv{'inststatus'}))); @@ -2628,7 +2636,7 @@ sub update_user_data { &Apache::loncommon::default_quota($env{'form.ccdomain'},$newinststatus); } if (ref($usertypes) eq 'HASH') { - $newsettings{'inststatus'} = join(', ',map{ $usertypes->{$_}; } (@inststatuses)); + $newsettings{'inststatus'} = join(', ',map{ $usertypes->{$_}; } (@inststatuses)); } else { $newsettings{'inststatus'} = join(', ',@inststatuses); } @@ -2764,14 +2772,13 @@ sub update_user_data { id => $env{'form.cid'}, ); } - if (((keys(%namechanged) > 0) && $namechgresult eq 'ok') || + if (((keys(%namechanged) > 0) && $namechgresult eq 'ok') || ((keys(%changed) > 0) && $chgresult eq 'ok')) { # Tell the user we changed the name &display_userinfo($r,1,\@disporder,\%canshow,\@requestcourses, \@usertools,\%userenv,\%changed,\%namechanged, \%oldsettings, \%oldsettingstext,\%newsettings, \%newsettingstext); - if ($env{'form.cid'} ne $userenv{'id'}) { &Apache::lonnet::idput($env{'form.ccdomain'}, ($env{'form.ccuname'} => $env{'form.cid'})); @@ -2884,9 +2891,9 @@ sub display_userinfo { $changedhash,$namechangedhash,$oldsetting,$oldsettingtext, $newsetting,$newsettingtext) = @_; return unless (ref($order) eq 'ARRAY' && - ref($canshow) eq 'HASH' && - ref($requestcourses) eq 'ARRAY' && - ref($usertools) eq 'ARRAY' && + ref($canshow) eq 'HASH' && + ref($requestcourses) eq 'ARRAY' && + ref($usertools) eq 'ARRAY' && ref($userenv) eq 'HASH' && ref($changedhash) eq 'HASH' && ref($oldsetting) eq 'HASH' && @@ -2913,7 +2920,7 @@ sub display_userinfo { 'prvs' => 'Previous Value:', 'chto' => 'Changed To:' ); - my $title = $lt{'ui'}; + my $title = $lt{'ui'}; if ($changed) { $title = $lt{'uic'}; } @@ -3438,7 +3445,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')); } @@ -3491,8 +3498,8 @@ sub enroll_single_student { $r->print(&mt('If the member is currently logged-in to LON-CAPA, the new role will be available when the member next logs in.')); } else { $r->print(&mt('If the student is currently logged-in to LON-CAPA, the new role will be available when the student next logs in.')); - } - $r->print(''); + } + $r->print(''); } } else { $r->print(&mt('unable to enroll').": ".$enroll_result); @@ -3618,7 +3625,7 @@ sub build_roles { sub custom_role_editor { my ($r) = @_; my $action = $env{'form.customroleaction'}; - my $rolename; + my $rolename; if ($action eq 'new') { $rolename=$env{'form.newrolename'}; } else { @@ -3655,7 +3662,7 @@ sub custom_role_editor { # ------------------------------------------------- Get current role privileges ($syspriv,$dompriv,$coursepriv)=split(/\_/,$roledef); if ($crstype eq 'Community') { - $syspriv =~ s/bre\&S//; + $syspriv =~ s/bre\&S//; } } else { $body_top .= &mt('New Role').' "'; @@ -3696,8 +3703,8 @@ sub custom_role_editor { my ($jsback,$elements) = &crumb_utilities(); my $button_code = "\n"; my $head_script = "\n"; - $head_script .= ''."\n"; + + $head_script .= "\n".$jsback."\n" + .'// ]]>'."\n" + .''."\n"; $r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script)); - &Apache::lonhtmlcommon::add_breadcrumb + &Apache::lonhtmlcommon::add_breadcrumb ({href=>"javascript:backPage(document.form1,'pickrole','')", text=>"Pick custom role", faq=>282,bug=>'Instructor Interface',}, @@ -3762,6 +3770,7 @@ sub custom_role_editor { 'dml' => "Domain Level", 'ssl' => "System Level"); + $r->print(''.&mt('After:'). - ' | '.$startform.' |
'.&mt('Before:').' | '. - $endform.' |
'.&mt('After:'). + ' | '.$startform.' |
'.&mt('Before:').' | '. + ''.$endform.' |