--- loncom/interface/Attic/londropadd.pm 2006/04/22 01:06:48 1.139
+++ loncom/interface/Attic/londropadd.pm 2006/07/20 21:55:37 1.146
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# $Id: londropadd.pm,v 1.139 2006/04/22 01:06:48 albertel Exp $
+# $Id: londropadd.pm,v 1.146 2006/07/20 21:55:37 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -39,6 +39,7 @@ use Apache::Constants qw(:common :http R
use Spreadsheet::WriteExcel;
use Apache::lonstathelpers();
use Apache::lonlocal;
+use Apache::longroup;
###############################################################
###############################################################
@@ -77,7 +78,7 @@ sub modifystudent {
} 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
@@ -176,11 +177,11 @@ sub print_main_menu {
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 => '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,
@@ -307,7 +308,7 @@ sub javascript_validations {
ipass => 'You need to specify the initial password.',
name => 'The optional name field was not specified.',
snum => 'The optional student number field was not specified.',
- section => 'The optional section or group field was not specified.',
+ section => 'The optional section field was not specified.',
email => 'The optional email address field was not specified.',
continue => 'Continue enrollment?',
);
@@ -393,6 +394,7 @@ END
}
END
}
+ my $section_checks;
my $optional_checks = '';
if ( ($mode eq 'createcourse') || ($mode eq 'modifycourse') ) {
$optional_checks = (<
\n";
- $Str .= ''."
\n";
$Str .= &mt('Note: for large courses, this operation may be time '.
'consuming');
@@ -701,7 +705,7 @@ sub print_upload_manager_form {
['lname',&mt('Last Name'), $env{'form.lname_choice'}],
['gen', &mt('Generation'), $env{'form.gen_choice'}],
['id', &mt('ID/Student Number'),$env{'form.id_choice'}],
- ['sec', &mt('Group/Section'), $env{'form.sec_choice'}],
+ ['sec', &mt('Section'), $env{'form.sec_choice'}],
['ipwd', &mt('Initial Password'),$env{'form.ipwd_choice'}],
['email',&mt('EMail Address'), $env{'form.email_choice'}]);
if ($env{'form.upfile_associate'} eq 'reverse') {
@@ -905,7 +909,8 @@ sub make_dates_default {
$result .= "Set default start and end dates for course
";
#
# Refresh the course environment
- &Apache::lonnet::coursedescription($env{'request.course.id'});
+ &Apache::lonnet::coursedescription($env{'request.course.id'},
+ {'freshen_cache' => 1});
} else {
$result .= &mt('Unable to set default dates for course').":".$put_result.
'
';
@@ -1073,7 +1078,7 @@ END
# Print it all out
my %lt=&Apache::lonlocal::texthash(
'cd' => "Course Data",
- 'gs' => "Group/Section",
+ 'gs' => "Section",
'idsn' => "ID/Student Number",
'disn' => "Disable ID/Student Number Safeguard and Force Change of Conflicting IDs (only do if you know what you are doing)",
'eas' => "Enroll as student",
@@ -1084,7 +1089,7 @@ END
$lt{'odcc'} @@ -1669,7 +1707,7 @@ $lt{'disn'}
$current_date_description
$date_table
- + END $r->print(&Apache::loncommon::end_page()); return; @@ -1893,9 +1931,13 @@ sub show_drop_list { ['sortby']); } my $sortby = $env{'form.sortby'}; - if ($sortby !~ /^(username|domain|section|fullname|id|start|end)$/) { + if ($sortby !~ /^(username|domain|section|groups|fullname|id|start|end)$/) { $sortby = 'username'; } + my $cdom = $env{'course.'.$cid.'.domain'}; + my $cnum = $env{'course.'.$cid,'.num'}; + my ($classgroups) = &Apache::loncoursedata::get_group_memberships( + $classlist,$keylist,$cdom,$cnum); # my $action = "drop"; $r->print(<'.&mt('Re-enrollment will re-activate data.')) if ($count);
}
+sub section_check_js {
+ my $groupslist;
+ my %curr_groups = &Apache::longroup::coursegroups();
+ if (%curr_groups) {
+ $groupslist = join('","',sort(keys(%curr_groups)));
+ }
+ return <<"END";
+function validate(caller) {
+ var groups = new Array("$groupslist");
+ var secname = caller.value;
+ if ((secname == 'all') || (secname == 'none')) {
+ alert("'"+secname+"' may not be used as the name for a section, as it is a reserved word.\\nPlease choose a different section name.");
+ return 'error';
+ }
+ if (secname != '') {
+ for (var k=0; k