'.&mt('Continue').''.
- &Apache::loncommon::end_page());
+ ' '.&mt('Continue').''
+ );
+ $r->print(&Apache::loncommon::end_page());
}
sub handler {
@@ -243,12 +256,12 @@ sub handler {
# Check if user is a DC trying to enter a course or author space and needs privs to be created
if ($numdc > 0) {
foreach my $envkey (keys %env) {
-# Is this an ad-hoc CC-role?
- if (my ($domain,$coursenum) =
- ($envkey =~ m-^form\.cc\./($match_domain)/($match_courseid)$-)) {
+# Is this an ad-hoc Coordinator role?
+ if (my ($ccrole,$domain,$coursenum) =
+ ($envkey =~ m-^form\.(cc|co)\./($match_domain)/($match_courseid)$-)) {
if ($dcroles{$domain}) {
&Apache::lonnet::check_adhoc_privs($domain,$coursenum,
- $then,$refresh,$now,'cc');
+ $then,$refresh,$now,$ccrole);
}
last;
}
@@ -479,8 +492,8 @@ ENDENTERKEY
$courseid = substr($courseid, 1);
}
$courseid =~ s/\//_/;
- if ($role eq 'cc' && $env{'course.' . $courseid .
- '.course.helper.not.run'}) {
+ if ((($role eq 'cc') || ($role eq 'co'))
+ && ($env{'course.' . $courseid .'.course.helper.not.run'})) {
$furl = "/adm/helper/course.initialization.helper";
# Send the user to the course they selected
} elsif ($env{'request.course.id'}) {
@@ -659,11 +672,12 @@ ENDHEADER
if ($reinit) {
$r->print(
'
'.
- &mt('As your session file for the course or community has expired, you will need to re-select the course.').'
');
+ &mt('As your session file for the course or community has expired, you will need to re-select it.').'');
} else {
$r->print(
'
'.
- &mt('You need to choose another user role or enter a specific course or community for this function').'
');
+ &mt('You need to choose another user role or enter a specific course or community for this function.').
+ '');
}
}
}
@@ -691,16 +705,16 @@ ENDHEADER
$refresh = $now;
&Apache::lonnet::appenv({'user.refresh.time' => $refresh});
if ($env{'user.adv'}) {
- $r->print(
- '
'
+ .' '
+ .'
');
} else {
if ($countactive > 0) {
- &queued_selfenrollment($r);
+ $r->print(&Apache::loncoursequeueadmin::queued_selfenrollment());
my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&');
-
$r->print(
'
'.&mt('Currently no active roles, courses or communities').'
');
}
&findcourse_advice($r);
- &requestcourse_advice($r);
+ &requestcourse_advice($r);
$r->print('');
if ($countfuture) {
$r->print(&mt('The following [quant,_1,role,roles] will become active in the future:',$countfuture));
@@ -1097,7 +1111,7 @@ sub roletable_headers {
}
sub roletypes {
- my @types = ('Domain','Construction Space','Course','Unavailable','System');
+ my @types = ('Domain','Construction Space','Course','Community','Unavailable','System');
return @types;
}
@@ -1161,8 +1175,8 @@ sub findcourse_advice {
}
$r->print('
'.&mt('Self-Enrollment').'
'.
'
'.&mt('The [_1]Course/Community Catalog[_2] provides information about all [_3] classes for which LON-CAPA courses have been created, as well as any communities in the domain.','','',$domdesc).' ');
- $r->print(&mt('You can search for courses and communities which permit self-enrollment, if you would like to enroll in one.').'
');
- &queued_selfenrollment($r);
+ $r->print(&mt('You can search for courses and communities which permit self-enrollment, if you would like to enroll in one.').''.
+ &Apache::loncoursequeueadmin::queued_selfenrollment());
return;
}
@@ -1174,12 +1188,12 @@ sub requestcourse_advice {
&Apache::lonnet::check_can_request($env{'user.domain'},\%can_request,\%request_doms);
if (keys(%request_doms) > 0) {
my ($types,$typename) = &Apache::loncommon::course_types();
- if ((ref($types) eq 'ARRAY') && (ref($typename) eq 'HASH')) {
+ if ((ref($types) eq 'ARRAY') && (ref($typename) eq 'HASH')) {
$r->print('
'.&mt('Request creation of a course or community').'
'.
'
'.&mt('You have rights to request the creation of courses and/or communities in the following domain(s):').'
');
my (@reqdoms,@reqtypes);
foreach my $type (sort(keys(%request_doms))) {
- push(@reqtypes,$type);
+ push(@reqtypes,$type);
if (ref($request_doms{$type}) eq 'ARRAY') {
my $domstr = join(', ',map { &Apache::lonnet::domain($_) } sort(@{$request_doms{$type}}));
$r->print(
@@ -1212,7 +1226,7 @@ sub requestcourse_advice {
}
if (@reqdoms == 1 || @showtypes > 0) {
$requrl .= '&state=crstype&action=new';
- }
+ }
$r->print('
'.&mt('Use the [_1]request form[_2] to submit a request for creation of a new course or community.','','').'');
}
}
@@ -1441,10 +1455,11 @@ sub check_fordc {
sub adhoc_course_role {
my ($refresh,$then) = @_;
- my ($cdom,$cnum);
+ my ($cdom,$cnum,$crstype);
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
- if (&check_forcc($cdom,$cnum,$refresh,$then)) {
+ $crstype = &Apache::loncommon::course_type();
+ if (&check_forcc($cdom,$cnum,$refresh,$then,$crstype)) {
my $setprivs;
if (!defined($env{'user.role.'.$env{'form.switchrole'}})) {
$setprivs = 1;
@@ -1494,11 +1509,16 @@ sub adhoc_course_role {
}
sub check_forcc {
- my ($cdom,$cnum,$refresh,$then) = @_;
- my $is_cc;
+ my ($cdom,$cnum,$refresh,$then,$crstype) = @_;
+ my ($is_cc,$ccrole);
+ if ($crstype eq 'Community') {
+ $ccrole = 'co';
+ } else {
+ $ccrole = 'cc';
+ }
if ($cdom ne '' && $cnum ne '') {
if (&Apache::lonnet::is_course($cdom,$cnum)) {
- my $envkey = 'user.role.cc./'.$cdom.'/'.$cnum;
+ my $envkey = 'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum;
if (defined($env{$envkey})) {
$is_cc = 1;
my ($tstart,$tend)=split(/\./,$env{$envkey});
@@ -1515,7 +1535,7 @@ sub courselink {
my $courseform=&Apache::loncommon::selectcourse_link
('rolechoice','dccourse'.$rowtype.'_'.$dcdom,
'dcdomain'.$rowtype.'_'.$dcdom,'coursedesc'.$rowtype.'_'.
- $dcdom,$dcdom,undef);
+ $dcdom,$dcdom,undef,'Course/Community');
my $hiddenitems = ''.
''.
''.
@@ -1578,9 +1598,10 @@ sub display_cc_role {
my $advanced = $env{'user.adv'};
my $tryagain = $env{'form.tryagain'};
unless ($rolekey =~/^error\:/) {
- if ($rolekey =~ m-^user\.role.cc\./($match_domain)/($match_courseid)$-) {
- my $tcourseid = $1.'_'.$2;
- my $trolecode = 'cc./'.$1.'/'.$2;
+ if ($rolekey =~ m{^user\.role\.(cc|co)\./($match_domain)/($match_courseid)$}) {
+ my $ccrole = $1;
+ my $tcourseid = $2.'_'.$3;
+ my $trolecode = $1.'./'.$2.'/'.$3;
my $twhere;
my $ttype;
my $tbg='LC_roles_is';
@@ -1595,7 +1616,7 @@ sub display_cc_role {
$twhere=&mt('Currently not available');
$env{'course.'.$tcourseid.'.description'}=$twhere;
}
- my $trole = &Apache::lonnet::plaintext('cc',$ttype);
+ my $trole = &Apache::lonnet::plaintext($ccrole,$ttype);
$twhere.=" ".&mt('Domain').":".$1;
($roletext,$roletext_end) = &build_roletext($trolecode,$1,$2,'is',$tryagain,$advanced,'',$tbg,$trole,$twhere,'','','',1,'');
}
@@ -1611,7 +1632,7 @@ sub adhoc_roles_row {
,'','',$dcdom)
.' ';
my $selectcclink = &courselink($dcdom,$rowtype);
- my $ccrole = &Apache::lonnet::plaintext('cc');
+ my $ccrole = &Apache::lonnet::plaintext('co',undef,undef,1);
my $carole = &Apache::lonnet::plaintext('ca');
my $selectcalink = &coauthorlink($dcdom,$rowtype);
$output.=$ccrole.': '.$selectcclink