--- loncom/interface/loncreateuser.pm 2010/11/01 13:54:00 1.295.2.36
+++ loncom/interface/loncreateuser.pm 2010/09/08 02:16:07 1.347
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.295.2.36 2010/11/01 13:54:00 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.347 2010/09/08 02:16:07 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)) {
@@ -1461,8 +1461,7 @@ sub display_existing_roles {
$rolesdump{$newkey} = $newvalue;
}
} else {
- my $extra = &Apache::lonnet::freeze_escape({'skipcheck' => 1});
- %rolesdump=&Apache::lonnet::dump('roles',$ccdomain,$ccuname,'.',undef,$extra);
+ %rolesdump=&Apache::lonnet::dump('roles',$ccdomain,$ccuname);
}
# Build up table of user roles to allow revocation and re-enabling of roles.
my ($tmp) = keys(%rolesdump);
@@ -1500,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') {
@@ -1526,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) {
@@ -1542,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;
@@ -1555,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))) &&
@@ -1623,7 +1622,7 @@ sub display_existing_roles {
'
'.&mt('Please be patient').'
'); + my (%alerts,%rulematch,%inst_results,%curr_rules); my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id'); my @usertools = ('aboutme','blog','portfolio'); @@ -2386,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) { @@ -2594,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; @@ -2614,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'}))); @@ -2636,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); } @@ -2772,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'})); @@ -2892,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' && @@ -2921,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'}; } @@ -3499,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); @@ -3626,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 { @@ -3663,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').' "'; @@ -3704,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',}, @@ -3770,6 +3770,7 @@ sub custom_role_editor { 'dml' => "Domain Level", 'ssl' => "System Level"); + $r->print('