[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface lonmenu.pm

raeburn raeburn@source.lon-capa.org
Mon, 18 Jan 2010 20:47:57 -0000


raeburn		Mon Jan 18 20:47:57 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	lonmenu.pm 
  Log:
  - Backport 1.298 and part of 1.286. 
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.244.2.8 loncom/interface/lonmenu.pm:1.244.2.9
--- loncom/interface/lonmenu.pm:1.244.2.8	Mon Jan 18 20:28:20 2010
+++ loncom/interface/lonmenu.pm	Mon Jan 18 20:47:57 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.244.2.8 2010/01/18 20:28:20 raeburn Exp $
+# $Id: lonmenu.pm,v 1.244.2.9 2010/01/18 20:47:57 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -179,7 +179,7 @@
                                        'login' => 'Log In',
 				       'launch' => 'Launch Remote Control',
                                        'groups' => 'Groups',
-                                       'gdoc' => 'Group Documents',
+                                       'gdoc' => 'Community Documents',
                                        );
 }
 
@@ -247,9 +247,12 @@
 <a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a>
 ENDRELOAD
             }
-	    if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
-               $docs=(<<ENDDOCS);
-<a href="/adm/coursedocs" target="_top">$lt{'docs'}</a>
+            my $is_community =
+                (&Apache::loncommon::course_type() eq 'Community');
+            if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
+                my $text = ($is_community) ? $lt{'gdoc'} : $lt{'docs'};
+                $docs=(<<ENDDOCS);
+<a href="/adm/coursedocs" target="_top">$text</a>
 ENDDOCS
             }
             if ($showgroups) {
@@ -314,9 +317,10 @@
 	    $navmaps=(<<ENDNAV);
 <td><a href="$link" target="_top">$lt{'nav'}</a></td>
 ENDNAV
-            my $is_group = (&Apache::loncommon::course_type() eq 'Group');
+            my $is_community =
+                (&Apache::loncommon::course_type() eq 'Community');
 	    if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
-                my $text = ($is_group) ? $lt{'gdoc'} : $lt{'docs'};
+                my $text = ($is_community) ? $lt{'gdoc'} : $lt{'docs'};
 		$docs=(<<ENDDOCS);
 <td><a href="/adm/coursedocs" target="_top">$text</a></td>
 ENDDOCS
@@ -1663,13 +1667,18 @@
 
 sub roles_selector {
     my ($cdom,$cnum) = @_;
+    my $crstype = &Apache::loncommon::course_type();
     my $now = time;
     my (%courseroles,%seccount);
     my $is_cc;
     my $role_selector;
-    if ($env{'user.role.cc./'.$cdom.'/'.$cnum}) {
-        my ($start,$end) = split(/\./,$env{'user.role.cc./'.$cdom.'/'.$cnum});
-        
+    if ($crstype eq 'Community') {
+        $ccrole = 'co';
+    } else {
+        $ccrole = 'cc';
+    }
+    if ($env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum}) {
+        my ($start,$end) = split(/\./,$env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum});
         if ((($start) && ($start<0)) || 
             (($end) && ($end<$now))  ||
             (($start) && ($now<$start))) {
@@ -1712,15 +1721,22 @@
             }
         }
     }
-    my @roles_order = ('cc','in','ta','ep','ad','st');
+    my $switchtext;
+    if ($crstype eq 'Community') {
+        $switchtext = &mt('Switch community role to...')
+    } else {
+        $switchtext = &mt('Switch course role to...')
+    }
+
+    my @roles_order = ($ccrole,'in','ta','ep','ad','st');
     if (keys(%courseroles) > 1) {
         $role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles);
         $role_selector .= '<form name="rolechooser" method="post" action="/adm/roles">
                           <select name="switchrole" onchange="javascript:adhocRole('."'switchrole'".')">';
-        $role_selector .= '<option value="">'.&mt('Switch course role to...').'</option>';
+        $role_selector .= '<option value="">'.$switchtext.'</option>';
         foreach my $role (@roles_order) {
             if (defined($courseroles{$role})) {
-                $role_selector .= "\n".'<option value="'.$role.'">'.&Apache::lonnet::plaintext($role).'</option>'; 
+                $role_selector .= "\n".'<option value="'.$role.'">'.&Apache::lonnet::plaintext($role,$crstype).'</option>'; 
             }
         }
         foreach my $role (sort(keys(%courseroles))) {