Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions lib/WeBWorK/ContentGenerator/CourseAdmin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,6 @@ sub do_add_course ($c) {

my $ce2 = WeBWorK::CourseEnvironment->new({ courseName => $add_courseID });

my %courseOptions;

my @users;

# copy users from current (admin) course if desired
Expand Down Expand Up @@ -392,15 +390,7 @@ sub do_add_course ($c) {

my $output = $c->c;

eval {
addCourse(
courseID => $add_courseID,
ce => $ce2,
courseOptions => \%courseOptions,
users => \@users,
%optional_arguments,
);
};
eval { addCourse(courseID => $add_courseID, ce => $ce2, users => \@users, %optional_arguments,); };
if ($@) {
my $error = $@;
push(
Expand Down
29 changes: 12 additions & 17 deletions lib/WeBWorK/Utils/CourseManagement.pm
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,9 @@ sub listArchivedCourses {

%options must contain:

courseID => course ID for the new course,
ce => a course environment for the new course,
courseOptions => hash ref explained below
users => array ref explained below
courseID => course ID for the new course,
ce => a course environment for the new course,
users => array ref explained below

%options may contain:

Expand All @@ -150,8 +149,6 @@ Create a new course with ID $courseID.
$ce is a WeBWorK::CourseEnvironment object that describes the new course's
environment.

$courseOptions is a reference to a hash containing the following options:

$users is a list of arrayrefs, each containing a User, Password, and
PermissionLevel record for a single user:

Expand Down Expand Up @@ -183,11 +180,10 @@ sub addCourse {
debug("$key : $value");
}

my $courseID = $options{courseID};
my $sourceCourse = $options{copyFrom} // '';
my $ce = $options{ce};
my %courseOptions = %{ $options{courseOptions} // {} };
my @users = exists $options{users} ? @{ $options{users} } : ();
my $courseID = $options{courseID};
my $sourceCourse = $options{copyFrom} // '';
my $ce = $options{ce};
my @users = exists $options{users} ? @{ $options{users} } : ();

debug \@users;

Expand Down Expand Up @@ -428,7 +424,7 @@ sub addCourse {
my $courseEnvFile = $ce->{courseFiles}{environment};
open my $fh, ">:utf8", $courseEnvFile
or die "failed to open $courseEnvFile for writing.\n";
writeCourseConf($fh, $ce, %courseOptions);
writeCourseConf($fh);
close $fh;
}

Expand Down Expand Up @@ -1176,18 +1172,17 @@ sub protectQString {
return $string;
}

=item writeCourseConf($fh, $ce, %options)
=item writeCourseConf($fh)

Writes a course.conf file to $fh, a file handle, using defaults from the course
environment object $ce and overrides from %options. %options can contain any of
the pairs accepted in %courseOptions by addCourse(), above.
Writes an essentially empty course.conf file to $fh, a file handle. System
administrators can use this file to override global settings for a course.

=back

=cut

sub writeCourseConf {
my ($fh, $ce, %options) = @_;
my ($fh) = @_;

print $fh <<'EOF';
#!perl
Expand Down
Loading