[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /auth lonroles.pm

raeburn raeburn@source.lon-capa.org
Sat, 02 Jan 2010 19:20:28 -0000


raeburn		Sat Jan  2 19:20:28 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/auth	lonroles.pm 
  Log:
  - Backport 1.240. 
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.231.4.9 loncom/auth/lonroles.pm:1.231.4.10
--- loncom/auth/lonroles.pm:1.231.4.9	Sat Jan  2 19:14:29 2010
+++ loncom/auth/lonroles.pm	Sat Jan  2 19:20:28 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.231.4.9 2010/01/02 19:14:29 raeburn Exp $
+# $Id: lonroles.pm,v 1.231.4.10 2010/01/02 19:20:28 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -243,12 +243,12 @@
 # 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 +479,8 @@
 				    $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'}) {
@@ -1585,9 +1585,10 @@
     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';
@@ -1602,7 +1603,7 @@
                 $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.="<br />".&mt('Domain').":".$1;
             ($roletext,$roletext_end) = &build_roletext($trolecode,$1,$2,'is',$tryagain,$advanced,'',$tbg,$trole,$twhere,'','','',1,'');
         }