--- loncom/interface/lonmodifycourse.pm 2003/12/26 16:30:17 1.1
+++ loncom/interface/lonmodifycourse.pm 2006/02/10 23:38:15 1.22
@@ -1,3 +1,30 @@
+# The LearningOnline Network with CAPA
+# automated enrollment course setup handler
+#
+# $Id: lonmodifycourse.pm,v 1.22 2006/02/10 23:38:15 albertel Exp $
+#
+# Copyright Michigan State University Board of Trustees
+#
+# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
+#
+# LON-CAPA is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# LON-CAPA is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LON-CAPA; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# /home/httpd/html/adm/gpl.txt
+#
+# http://www.lon-capa.org/
+#
package Apache::lonmodifycourse;
use strict;
@@ -8,31 +35,33 @@ use Apache::lonlocal;
use Apache::londropadd;
use LONCAPA::Enrollment;
use lib '/home/httpd/lib/perl';
-use localenroll;
sub print_course_selection_page {
my ($r,$tasklongref) = @_;
- my $dom = $ENV{'user.domain'};
+ my $dom = $env{'request.role.domain'};
my %lt=&Apache::lonlocal::texthash(
- 'incs' => "Internal course settings",
- 'stat' => "Although the majority of course settings for LON-CAPA courses may be modified by a Course Coordinator, there are a small number of settings which may only be modified by a Domain Coordinator. These particular course parameters control automated student enrollment in LON-CAPA courses based on classlist data available from your institution's student information system.",
- 'chcs' => "Once you have chosen the course for which you wish to view/modify internal settings, click 'Go' to proceed",
+ 'csae' => "Course settings for automated enrollment",
+ 'unst' => "Unlike standard LON-CAPA course parameters, such as course description, feedback addresses, and top level map, which are displayed and/or modified using the 'Course Environment Parameters' screen, settings that control automated enrollment based on classlist data available from your institution's student information system are handled differently. Automated enrollment settings fall into two groups: (a) settings that can be modified by a Course Coordinator using the Automated Enrollment Manager and (b) settings that may only be modified by a Domain Coordinator via the 'View/Modify Course settings' menu accessed from this page.",
+ 'chcs' => "Choose the course for which you wish to view/modify automated enrollment settings from the select box below and click 'Go' to proceed.",
+ 'eaen' => "Each entry in the select box contains: course code -- course title ------- course owner, and entries are ordered alphabetically by course code.",
+ 'psac' => "Please select a course",
'ccrs' => "Choose a course",
'gobt' => "Go"
);
# Determine the courses
- my %courseIDs = &Apache::lonnet::courseiddump($dom,'.',1);
+ my %courseIDs = &Apache::lonnet::courseiddump($dom,'.',1,'.','.','.');
&print_header($r,$tasklongref);
$r->print(<
-
$lt{'incs'}
-
$lt{'stat'}
+
$lt{'ccrs'}:
-
+
+
+
Use the appropriate text boxes and radio buttons below to change some or all of the four automated enrollment settings that may only be changed by a Domain Coordinator. Click the "$lt{'gobt'}" button to save your changes.
");
}
if (@changes > 0) {
my $putreply = &Apache::lonnet::put('environment',\%cenv,$dom,$crs);
if ($putreply !~ /^ok$/) {
- $response = "There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged. ";
+ $response = &mt("There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged. ");
} else {
foreach my $attr (@params) {
if (grep/^$attr$/,@changes) {
- $chgresponse .= "
$$typeref{$attr} now set to $newattr{$attr}.
";
+ $chgresponse .= "
$$typeref{$attr} ".&mt("now set to \"").$newattr{$attr}."\".
";
} else {
- $nochgresponse .= "
$$typeref{$attr} still set to $currattr{$attr}.
";
+ $nochgresponse .= "
$$typeref{$attr} ".&mt("still set to \"").$currattr{$attr}."\".
";
}
}
if ($changecode || $changeowner) {
if ( $newattr{'courseowner'} eq '') {
- $warning .= "There is no owner associated with this LON-CAPA course. If automated enrollment in LON-CAPA courses at your institution requires validation of course owners, automated enrollment will fail for this course. ";
+ $warning .= &mt("There is no owner associated with this LON-CAPA course. If automated enrollment in LON-CAPA courses at your institution requires validation of course owners, automated enrollment will fail for this course. ");
} else {
if (@sections > 0) {
- foreach my $sec (@sections) {
- if ($sec =~ m/^(.+):/) {
- my $course_id = $newattr{'coursecode'}.$1;
- if ($changecode) {
-# my $course_check = &localenroll::validate_courseID($course_id);
- my $course_check = 'ok';
- if ($course_check eq 'ok') {
-# my $outcome = &localenroll::new_course($course_id,$newattr{'courseowner'});
- my $outcome = 'ok';
+ if ($changecode) {
+ foreach my $sec (@sections) {
+ if ($sec =~ m/^(.+):/) {
+ my $inst_course_id = $newattr{'coursecode'}.$1;
+ my $course_check = &Apache::lonnet::auto_validate_courseID($crs,$dom,$inst_course_id);
+ if ($course_check eq 'ok') {
+ my $outcome = &Apache::lonnet::auto_new_course($crs,$dom,$inst_course_id,$newattr{'courseowner'});
unless ($outcome eq 'ok') {
- $warning .= "If automatic enrollment is enabled for LON-CAPA course: $description, automated enrollment may fail for $newattr{'coursecode'} - section $1 for the following reason: $outcome. ";
+ $warning .= &mt("If automatic enrollment is enabled for LON-CAPA course: ").$description.&mt(", automated enrollment may fail for ").$newattr{'coursecode'}.&mt(" - section $1 for the following reason: $outcome. ");
}
} else {
- $warning .= "If automatic enrollment is enabled for LON-CAPA course: $description, automated enrollment may fail for $newattr{'coursecode'} - section $1 for the following reason: $course_check. ";
+ $warning .= &mt("If automatic enrollment is enabled for LON-CAPA course: ").$description.&mt(", automated enrollment may fail for ").$newattr{'coursecode'}.&mt(" - section $1 for the following reason: $course_check. ");
}
} else {
- $warning .= "If automatic enrollment is enabled for LON-CAPA course: $description, automated enrollment may fail for $newattr{'coursecode'} - section $sec because this is not a valid section entry. ";
+ $warning .= &mt("If automatic enrollment is enabled for LON-CAPA course: ").$description.&mt(", automated enrollment may fail for ").$newattr{'coursecode'}.&mt(" - section $sec because this is not a valid section entry. ");
}
}
- }
+ } elsif ($changeowner) {
+ foreach my $sec (@sections) {
+ if ($sec =~ m/^(.+):/) {
+ my $inst_course_id = $newattr{'coursecode'}.$1;
+ my $outcome = &Apache::lonnet::auto_new_course($crs,$dom,$inst_course_id,$newattr{'courseowner'});
+ unless ($outcome eq 'ok') {
+ $warning .= &mt("If automatic enrollment is enabled for LON-CAPA course: ").$description.&mt(", automated enrollment may fail for ").$newattr{'coursecode'}.&mt(" - section $1 for the following reason: $outcome. ");
+ }
+ } else {
+ $warning .= &mt("If automatic enrollment is enabled for LON-CAPA course: ").$description.&mt(", automated enrollment may fail for ").$newattr{'coursecode'}.&mt(" - section $sec because this is not a valid section entry. ");
+ }
+ }
+ }
} else {
- $warning .= "As no section numbers are currently listed for LON-CAPA course: $description, automated enrollment will not occur for any sections of coursecode: $newattr{'coursecode'}. ";
+ $warning .= &mt("As no section numbers are currently listed for LON-CAPA course: ").$description.&mt(", automated enrollment will not occur for any sections of coursecode: ").$newattr{'coursecode'}." ";
}
if ( (@xlists > 0) && ($changeowner) ) {
foreach my $xlist (@xlists) {
if ($xlist =~ m/^(.+):/) {
-# my $outcome = &localenroll::new_course($1,$newattr{'courseowner'});
- my $outcome = 'ok';
+ my $outcome = &Apache::lonnet::auto_new_course($crs,$dom,$1,$newattr{'courseowner'});
unless ($outcome eq 'ok') {
- $warning .= "If automatic enrollment is enabled for LON-CAPA course: $description, automated enrollment may fail for crosslisted class: $1 for the following reason: $outcome. ";
+ $warning .= &mt("If automatic enrollment is enabled for LON-CAPA course: ").$description.&mt(", automated enrollment may fail for crosslisted class: ").$1.&mt(" for the following reason: $outcome. ");
}
}
}
@@ -499,8 +617,13 @@ sub modify_course {
}
}
}
+ } else {
+ foreach my $attr (@params) {
+ $nochgresponse .= "
$$typeref{$attr} ".&mt("still set to")." \"".$currattr{$attr}."\".
";
}
unless ($warning eq '') {
- $warning = "The following warning messages were generated as a result of applying the changes you specified to course settings that can affect the automated enrollment process:
".$warning;
+ $warning = &mt("The following warning messages were generated as a result of applying the changes you specified to course settings that can affect the automated enrollment process: