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

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 15 Nov 2005 22:06:52 -0000


raeburn		Tue Nov 15 17:06:52 2005 EDT

  Modified files:              
    /loncom/interface	londropadd.pm 
  Log:
  Add links to londropadd.pm to allow creation and display of groups. (not all functions implemented yet). 
  
  
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.131 loncom/interface/londropadd.pm:1.132
--- loncom/interface/londropadd.pm:1.131	Tue Nov  1 15:47:15 2005
+++ loncom/interface/londropadd.pm	Tue Nov 15 17:06:50 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.131 2005/11/01 20:47:15 albertel Exp $
+# $Id: londropadd.pm,v 1.132 2005/11/15 22:06:50 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -137,7 +137,8 @@
 ###############################################################
 #  Menu Phase One
 sub print_main_menu {
-    my ($r,$enrl_permission,$view_permission)=@_;
+    my ($r,$enrl_permission,$view_permission,$grp_manage_permission,
+        $grp_view_permission)=@_;
     #
     my ($cdom,$cnum) = split/_/,$env{'request.course.id'};
     my @menu = 
@@ -171,6 +172,26 @@
             permission => &Apache::lonnet::auto_run($cnum,$cdom),
             url  => '/adm/populate',
             },
+          { text => 'Create a new group',
+            help => 'Course_Create_Group',
+            permission => $grp_manage_permission,
+            url => '/adm/coursegroups?refpage=enrl&action=create',
+            },
+          { text => 'Modify an existing group',
+            help => 'Course_Modify_Group',
+            permission => $grp_manage_permission,
+            url => '/adm/coursegroups?refpage=enrl&action=modify',
+            },
+          { text => 'Delete an existing group',
+            help => 'Course_Delete_Group',
+            permission => $grp_manage_permission,
+            url => '/adm/coursegroups?refpage=enrl&action=delete',
+            },
+          { text => 'Enter an existing group',
+            help => 'Course_Display_Group',
+            permission => $grp_view_permission,
+            url => '/adm/coursegroups?refpage=enrl&action=view',
+            },
           );
     my $menu_html = '';
     foreach my $menu_item (@menu) {
@@ -2289,7 +2310,8 @@
     if (! ($env{'request.course.fn'})) {
         # Not in a course
         $env{'user.error.msg'}=
-            "/adm/dropadd:cst:0:0:Cannot drop or add students";
+            "/adm/dropadd:cst:0:0:Cannot manage or view course groups, ".
+                                  "or drop or add students";
         return HTTP_NOT_ACCEPTABLE; 
     }
     #
@@ -2297,11 +2319,21 @@
         &Apache::lonnet::allowed('vcl',$env{'request.course.id'});
     my $enrl_permission = 
         &Apache::lonnet::allowed('cst',$env{'request.course.id'});
-    if (! $view_permission && ! $enrl_permission) {
+
+    my $grp_view_permission =
+        &Apache::lonnet::allowed('vcg',$env{'request.course.id'});
+    my $grp_manage_permission =
+        &Apache::lonnet::allowed('mdg',$env{'request.course.id'});
+
+
+    if (! $grp_view_permission && ! $grp_manage_permission && 
+                                  ! $view_permission && ! $enrl_permission) {
         $env{'user.error.msg'}=
-            "/adm/dropadd:cst:0:0:Cannot drop or add students";
-        return HTTP_NOT_ACCEPTABLE;        
+     "/adm/coursegroups:cst:0:0:Cannot manage or view course groups, ".
+                                 "or drop or add students";
+        return HTTP_NOT_ACCEPTABLE;
     }
+
     #
     # Only output the header information if they did not request csv format
     #
@@ -2314,7 +2346,8 @@
     if (! exists($env{'form.action'})) {
         $r->print(&Apache::lonhtmlcommon::breadcrumbs
                   (undef,'Enrollment Manager'));
-        &print_main_menu($r,$enrl_permission,$view_permission);
+        &print_main_menu($r,$enrl_permission,$view_permission,$grp_manage_permission,
+                         $grp_view_permission);
     } elsif ($env{'form.action'} eq 'upload' && $enrl_permission) {
         &Apache::lonhtmlcommon::add_breadcrumb
             ({href=>'/adm/dropadd?action=upload&state=',