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

raeburn raeburn@source.lon-capa.org
Tue, 03 Nov 2009 03:01:47 -0000


raeburn		Tue Nov  3 03:01:47 2009 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  - Ad hoc community coordinator role ("co") available to DCs. 
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.239 loncom/auth/lonroles.pm:1.240
--- loncom/auth/lonroles.pm:1.239	Sat Oct 31 05:44:35 2009
+++ loncom/auth/lonroles.pm	Tue Nov  3 03:01:47 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.239 2009/10/31 05:44:35 raeburn Exp $
+# $Id: lonroles.pm,v 1.240 2009/11/03 03:01:47 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -255,12 +255,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;
                 }
@@ -491,8 +491,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'}) {
@@ -1597,9 +1597,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';
@@ -1614,7 +1615,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,'');
         }