--- loncom/interface/Attic/londropadd.pm 2006/05/01 19:37:33 1.141
+++ loncom/interface/Attic/londropadd.pm 2007/07/26 23:56:35 1.165
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.141 2006/05/01 19:37:33 albertel Exp $
+# $Id: londropadd.pm,v 1.165 2007/07/26 23:56:35 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -39,6 +39,8 @@ use Apache::Constants qw(:common :http R
use Spreadsheet::WriteExcel;
use Apache::lonstathelpers();
use Apache::lonlocal;
+use Apache::longroup;
+use LONCAPA();
###############################################################
###############################################################
@@ -59,8 +61,8 @@ sub modifystudent {
# if $csec is undefined, drop the student from all the courses matching
# this one. If $csec is defined, drop them from all other sections of
# this course and add them to section $csec
- $courseid=~s/\_/\//g;
- $courseid=~s/^(\w)/\/$1/;
+ my $cdom = $env{'course.'.$courseid.'.domain'};
+ my $cnum = $env{'course.'.$courseid.'.num'};
my %roles = &Apache::lonnet::dump('roles',$udom,$unam);
my ($tmp) = keys(%roles);
# Bail out if we were unable to get the students roles
@@ -68,16 +70,16 @@ sub modifystudent {
# Go through the roles looking for enrollment in this course
my $result = '';
foreach my $course (keys(%roles)) {
- if ($course=~/^$courseid(?:\/)*(?:\s+)*(\w+)*\_st$/) {
+ if ($course=~m{^/\Q$cdom\E/\Q$cnum\E(?:\/)*(?:\s+)*(\w+)*\_st$}) {
# We are in this course
my $section=$1;
- $section='' if ($course eq $courseid.'_st');
+ $section='' if ($course eq "/$cdom/$cnum".'_st');
if (defined($csec) && $section eq $csec) {
$result .= 'ok:';
} elsif ( ((!$section) && (!$csec)) || ($section ne $csec) ) {
my (undef,$end,$start)=split(/\_/,$roles{$course});
my $now=time;
- # if this is an active role
+ # if this is an active role
if (!($start && ($now<$start)) || !($end && ($now>$end))) {
my $reply=&Apache::lonnet::modifystudent
# dom name id mode pass f m l g
@@ -104,7 +106,7 @@ sub domain_form {
# Set up domain and server selection forms
#
# Get the domains
- my @domains = &Apache::loncommon::get_domains();
+ my @domains = &Apache::lonnet::all_domains();
# build up the menu information to be passed to
# &Apache::loncommon::linked_select_forms
my %select_menus;
@@ -115,7 +117,7 @@ sub domain_form {
$select_menus{$dom}->{'default'}= 'default';
$select_menus{$dom}->{'select2'}->{'default'} = 'default';
# Now build up the other items in the second menu
- my %servers = &Apache::loncommon::get_library_servers($dom);
+ my %servers = &Apache::lonnet::get_servers($dom,'library');
foreach my $server (keys(%servers)) {
$select_menus{$dom}->{'select2'}->{$server}
= "$server $servers{$server}";
@@ -131,59 +133,66 @@ sub domain_form {
###############################################################
# Menu Phase One
sub print_main_menu {
- my ($r,$enrl_permission,$view_permission,$grp_manage_permission,
- $grp_view_permission)=@_;
+ my ($r,$permission)=@_;
#
- my ($cdom,$cnum) = split/_/,$env{'request.course.id'};
+ my $cid =$env{'request.course.id'};
+ my $cdom=$env{'course.'.$cid.'.domain'};
+ my $cnum=$env{'course.'.$cid.'.num'};
my @menu =
(
{ text => 'Upload a class list',
help => 'Course_Create_Class_List',
action => 'upload',
- permission => $enrl_permission,
+ permission => $permission->{'enrl'},
},
{ text => 'Enroll a single student',
help => 'Course_Add_Student',
action => 'enrollstudent',
- permission => $enrl_permission,
+ permission => $permission->{'enrl'},
},
{ text => 'Modify student data',
help => 'Course_Modify_Student_Data',
action => 'modifystudent',
- permission => $enrl_permission,
+ permission => $permission->{'enrl'},
},
{ text => 'View Class List',
help => 'Course_View_Class_List',
action => 'classlist',
- permission => $view_permission,
+ permission => $permission->{'view'},
},
{ text => 'Drop Students',
help => 'Course_Drop_Student',
action => 'drop',
- permission => $enrl_permission,
+ permission => $permission->{'enrl'},
},
{ text => 'Automated Enrollment Manager',
- permission => &Apache::lonnet::auto_run($cnum,$cdom),
+ permission => (&Apache::lonnet::auto_run($cnum,$cdom)
+ && $permission->{'enrl'}),
url => '/adm/populate',
},
{ text => 'Create a new group',
help => 'Course_Create_Group',
- permission => $grp_manage_permission,
+ permission => $permission->{'grp_manage'},
url => '/adm/coursegroups?refpage=enrl&action=create',
},
{ text => 'Modify an existing group',
help => 'Course_Modify_Group',
- permission => $grp_manage_permission,
+ permission => $permission->{'grp_manage'},
url => '/adm/coursegroups?refpage=enrl&action=modify',
},
{ text => 'Delete an existing group',
help => 'Course_Delete_Group',
- permission => $grp_manage_permission,
+ permission => $permission->{'grp_manage'},
url => '/adm/coursegroups?refpage=enrl&action=delete',
},
+ { text => 'Re-enable a deleted group',
+ help => 'Course_Reenable_Group',
+ permission => $permission->{'grp_manage'},
+ url => '/adm/coursegroups?refpage=enrl&action=reenable',
+ },
{ text => 'Enter an existing group',
help => 'Course_Display_Group',
- permission => $grp_view_permission,
+ permission => $permission->{'grp_view'},
url => '/adm/coursegroups?refpage=enrl&action=view',
},
);
@@ -249,7 +258,7 @@ sub print_upload_manager_header {
#
my $javascript_validations=&javascript_validations('auth',$krbdefdom,
$password_choice);
- my $checked=(($env{'form.noFirstLine'})?' checked="1"':'');
+ my $checked=(($env{'form.noFirstLine'})?' checked="checked" ':'');
$r->print('