--- loncom/auth/lonroles.pm 2009/10/30 16:31:30 1.238
+++ loncom/auth/lonroles.pm 2009/10/31 05:44:35 1.239
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.238 2009/10/30 16:31:30 bisitz Exp $
+# $Id: lonroles.pm,v 1.239 2009/10/31 05:44:35 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1454,10 +1454,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;
@@ -1507,11 +1508,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});
@@ -1528,7 +1534,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 = ''.
''.
''.
@@ -1538,7 +1544,7 @@ sub courselink {
sub coursepick_jscript {
my %lt = &Apache::lonlocal::texthash(
- plsu => "Please use the 'Select Course' link to open a separate pick course window where you may select the course or community you wish to enter.",
+ plsu => "Please use the 'Select Course/Community' link to open a separate pick course window where you may select the course or community you wish to enter.",
youc => 'You can only use this screen to select courses and communities in the current domain.',
);
my $verify_script = <<"END";
@@ -1624,7 +1630,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