[LON-CAPA-cvs] cvs: loncom /interface lonmsgdisplay.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 27 Jun 2006 18:34:43 -0000


albertel		Tue Jun 27 14:34:43 2006 EDT

  Modified files:              
    /loncom/interface	lonmsgdisplay.pm 
  Log:
  - switching the course type accessor
  
  
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.32 loncom/interface/lonmsgdisplay.pm:1.33
--- loncom/interface/lonmsgdisplay.pm:1.32	Thu Jun 22 10:53:15 2006
+++ loncom/interface/lonmsgdisplay.pm	Tue Jun 27 14:34:43 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.32 2006/06/22 14:53:15 albertel Exp $
+# $Id: lonmsgdisplay.pm,v 1.33 2006/06/27 18:34:43 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -976,10 +976,7 @@
      }
     # Check to see if there were any messages.
     if ($result eq '') {
-        my $lctype = 'course';
-        if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
-            $lctype = lc($env{'course.'.$env{'request.course.id'}.'.type'});
-        }
+        my $lctype = lc(&Apache::loncommon::course_type());
 	if ($target ne 'tex') { 
 	    $r->print("<p><b>".&mt('No notes, face-to-face discussion records, critical messages, or broadcast messages in this [_1].',$lctype)."</b></p>");
 	} else {
@@ -1012,12 +1009,9 @@
 	$r->print('Not allowed');
 	return;
     }
-    my $crstype = 'Course';
-    my $leaders = 'faculty and staff';
-    if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
-        $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
-        $leaders = 'coordinators and leaders';
-    }
+    my $crstype = &Apache::loncommon::course_type();
+    my $leaders = ($crstype eq 'Group') ? 'coordinators and leaders'
+                                        : 'faculty and staff';
     &printheader($r,
 		 '/adm/email?recordftf=query',
 		 "User Notes, Face-to-Face, Critical Messages, Broadcast Messages");
@@ -1092,10 +1086,8 @@
 	$r->print('Not allowed');
 	return;
     }
-    my $usertype = 'students';
-    if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Group') {
-        $usertype = 'members';
-    }
+    my $usertype = (&Apache::loncommon::course_type() eq 'Group') ? 'members',
+	                                                          : 'students';
     my %lt=&Apache::lonlocal::texthash(
             'comb' => 'Communication Blocking',
             'cbds' => 'Communication blocking during scheduled exams',
@@ -1431,10 +1423,7 @@
     my $startblock = 0;
     my $endblock = 0;
     my $numblocked = 0;
-    my $crstype = 'Course';
-    if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) {
-        $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
-    }
+    my $crstype = &Apache::loncommon::course_type();
 
 # info to generate "next" and "previous" buttons and check if message is blocked
     &blockcheck(\%setters,\$startblock,\$endblock);