[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /auth lonroles.pm
raeburn
raeburn@source.lon-capa.org
Sat, 02 Jan 2010 19:14:29 -0000
raeburn Sat Jan 2 19:14:29 2010 EDT
Modified files: (Branch: version_2_9_X)
/loncom/auth lonroles.pm
Log:
- Backport 1.239.
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.231.4.8 loncom/auth/lonroles.pm:1.231.4.9
--- loncom/auth/lonroles.pm:1.231.4.8 Sat Jan 2 19:06:39 2010
+++ loncom/auth/lonroles.pm Sat Jan 2 19:14:29 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.231.4.8 2010/01/02 19:06:39 raeburn Exp $
+# $Id: lonroles.pm,v 1.231.4.9 2010/01/02 19:14:29 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1442,10 +1442,11 @@
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;
@@ -1495,11 +1496,16 @@
}
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});
@@ -1516,7 +1522,7 @@
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 = '<input type="hidden" name="dcdomain'.$rowtype.'_'.$dcdom.'" value="'.$dcdom.'" />'.
'<input type="hidden" name="origdom'.$rowtype.'_'.$dcdom.'" value="'.$dcdom.'" />'.
'<input type="hidden" name="dccourse'.$rowtype.'_'.$dcdom.'" value="" />'.
@@ -1612,7 +1618,7 @@
,'<span class="LC_cusr_emph">','</span>',$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