--- loncom/interface/loncreateuser.pm 2010/01/20 14:35:36 1.295.2.28
+++ 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.28 2010/01/20 14:35:36 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.347 2010/09/08 02:16:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -231,11 +231,13 @@ sub build_tools_display {
'uscu' => "Use custom",
'official' => 'Can request creation of official courses',
'unofficial' => 'Can request creation of unofficial courses',
+ 'community' => 'Can request creation of communities',
);
if ($context eq 'requestcourses') {
%userenv = &Apache::lonnet::userenvironment($ccdomain,$ccuname,
- 'requestcourses.official','requestcourses.unofficial');
- @usertools = ('official','unofficial');
+ 'requestcourses.official','requestcourses.unofficial',
+ 'requestcourses.community');
+ @usertools = ('official','unofficial','community');
@options =('norequest','approval','autolimit','validate');
%validations = &Apache::lonnet::auto_courserequest_checks($ccdomain);
%reqtitles = &courserequest_titles();
@@ -529,7 +531,6 @@ sub print_username_entry_form {
my %lt=&Apache::lonlocal::texthash(
'srst' => 'Search for a user and enroll as a student',
'srme' => 'Search for a user and enroll as a member',
-
'srad' => 'Search for a user and modify/add user information or roles',
'usr' => "Username",
'dom' => "Domain",
@@ -684,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 {
@@ -944,7 +945,7 @@ sub print_user_modification_page {
);
my $response;
if ($env{'form.origform'} eq 'crtusername') {
- $response = ''.&mt('No match was found for the username ([_1]) in LON-CAPA domain: [_2]',$ccuname,$ccdomain).
+ $response = ''.&mt('No match found for the username [_1] in LON-CAPA domain: [_2]',''.$ccuname.'',$ccdomain).
' '
@@ -1052,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;
}
}
}
@@ -1427,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)) {
@@ -1454,6 +1455,8 @@ sub display_existing_roles {
$newkey .= '_'.$newrole;
if ($start ne '' && $end ne '') {
$newvalue .= '_'.$end.'_'.$start;
+ } elsif ($end ne '') {
+ $newvalue .= '_'.$end;
}
$rolesdump{$newkey} = $newvalue;
}
@@ -1496,9 +1499,8 @@ sub display_existing_roles {
if (defined($coursedata{'description'})) {
$carea=$coursedata{'description'}.
'
';
}
$response .= '
'.&mt('Domain').': '.$coursedom.(' 'x8).
- &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$coursedir,$coursedom);
+ &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$coursedir,$coursedom);
$sortkey.="\0".$coursedata{'description'};
- $class=$coursedata{'type'};
} else {
if ($class eq 'Community') {
$carea=&mt('Unavailable community').': '.$area;
@@ -1523,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) {
@@ -1539,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;
@@ -1552,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))) &&
@@ -1611,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'); - my @requestcourses = ('official','unofficial'); + my @requestcourses = ('official','unofficial','community'); my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($env{'form.ccdomain'}); + my %canmodify_status = + &Apache::lonuserutils::can_modify_userinfo($context,$env{'form.ccdomain'}, + ['inststatus']); if ($env{'form.makeuser'}) { $r->print(''.&mt('After:'). - ' | '.$startform.' |
'.&mt('Before:').' | '. - $endform.' |
'.&mt('After:'). + ' | '.$startform.' |
'.&mt('Before:').' | '. + ''.$endform.' |