'
+ );
}
$r->print(''.
$end_page);
@@ -610,6 +617,8 @@ sub create_course {
$crstype='Course';
$enrollstart=&Apache::lonhtmlcommon::get_date_from_form('startenroll');
$enrollend=&Apache::lonhtmlcommon::get_date_from_form('endenroll');
+ } elsif ($env{'form.phase'} eq 'placementtwo') {
+ $crstype='Placement';
}
$startaccess = &Apache::lonhtmlcommon::get_date_from_form('startaccess');
$endaccess = &Apache::lonhtmlcommon::get_date_from_form('endaccess');
@@ -653,7 +662,6 @@ sub create_course {
clonedomain => $env{'form.clonedomain'},
datemode => $env{'form.datemode'},
dateshift => $env{'form.dateshift'},
- tinyurls => $env{'form.tinyurls'},
crsid => $env{'form.crsid'},
curruser => $env{'user.name'}.':'.$env{'user.domain'},
crssections => $env{'form.crssections'},
@@ -672,7 +680,6 @@ sub create_course {
endaccess => $endaccess,
setpolicy => $env{'form.setpolicy'},
setcontent => $env{'form.setcontent'},
- setcomment => $env{'form.setcomment'},
reshome => $env{'form.reshome'},
setkeys => $env{'form.setkeys'},
keyauth => $env{'form.keyauth'},
@@ -720,20 +727,12 @@ sub create_course {
return;
}
my ($courseid,$crsudom,$crsunum,$code);
- my ($success,$output,$clonemsgref) =
+ my ($success,$output) =
&Apache::loncommon::construct_course($args,\$logmsg,\$courseid,
\$crsudom,\$crsunum,
$env{'user.domain'},
$env{'user.name'},'dc_create',undef,undef,\$code);
$r->print($output);
- if (ref($clonemsgref) eq 'ARRAY') {
- my $user_lh = &Apache::loncommon::user_lang($env{'user.name'},$env{'user.domain'});
- foreach my $item (@{$clonemsgref}) {
- if (ref($item) eq 'HASH') {
- $r->print(&mt($item->{mt},@{$item->{args}}).' '."\n");
- }
- }
- }
if ($success) {
#
# Make the requested user a course coordinator or group coordinator
@@ -767,19 +766,15 @@ sub create_course {
}
sub print_intro_page {
- my ($r,$show_all_choices,$cancreate,$permission) = @_;
+ my ($r,$show_all_choices,$cancreate) = @_;
my $start_page =
- &Apache::loncommon::start_page('Create a New Course or Community');
+ &Apache::loncommon::start_page('Create a New Course, Community or Placement Test');
my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Options','Create_Course',undef,'Create_Courses');
my $end_page =
&Apache::loncommon::end_page();
my $helplink=&Apache::loncommon::help_open_topic('Create_Course_Community',&mt('Help on Creating Courses and Communities'));
# Create menu
- my $approve = 'Display requests awaiting approval';
- if ($permission->{'create'}) {
- $approve = 'Approve or reject requests';
- }
my @menu;
@menu =
({ categorytitle => 'Course/Community Creation',
@@ -787,7 +782,7 @@ sub print_intro_page {
{
linktext => 'Create a single course',
url => '/adm/createcourse?phase=courseone',
- permission => $permission->{'create'},
+ permission => 1,
#help => '',
icon => 'crsnew.png',
linktitle => 'Create a new course by completing an online form.'
@@ -795,30 +790,38 @@ sub print_intro_page {
{
linktext => 'Create a single community',
url => '/adm/createcourse?phase=groupone',
- permission => $permission->{'create'} && $cancreate->{'Community'},
+ permission => $cancreate->{'Community'},
#help => '',
icon => 'crsnew.png',
linktitle => 'Create a new collaborative community by completing an online form.'
},
{
- linktext => 'Create courses/communities by uploading an attributes file',
+ linktext => 'Create a single placement test',
+ url => '/adm/createcourse?phase=placementone',
+ permission => $cancreate->{'Placement'},
+ #help => '',
+ icon => 'crsnew.png',
+ linktitle => 'Create a new placement test by completing an online form.'
+ },
+ {
+ linktext => 'Create courses/communities/placement tests by uploading an attributes file',
url => '/adm/createcourse?phase=batchone',
- permission => $permission->{'create'},
+ permission => 1,
help => 'Batch_Creation',
icon => 'uplcrs.png',
- linktitle => 'Upload an attributes file containing specifications for one or more courses or communities in XML format.'
+ linktitle => 'Upload an attributes file containing specifications for one or more courses, communities or placement tests in XML format.'
},
]
},
{ categorytitle => 'Course/Community Requests',
items => [
{
- linktext => $approve,
+ linktext => 'Approve or reject requests',
url => '/adm/createcourse?phase=requestdisplay',
permission => $show_all_choices,
#help => '',
icon => 'rcrs.png',
- linktitle => 'Display course and community creation requests submitted by authorized users, held pending approval by a Domain Coordinator.'
+ linktitle => 'Display course, community creation and placement test requests submitted by authorized users, held pending approval by a Domain Coordinator.'
},
{
linktext => 'View pending official course requests',
@@ -839,7 +842,7 @@ sub print_intro_page {
permission => $show_all_choices,
#help => '',
icon => 'document-properties.png',
- linktitle => 'Display information about when, how and by whom courses and communities were created in this domain.'
+ linktitle => 'Display information about when, how and by whom courses, communities and placement tests were created in this domain.'
},
]
},
@@ -856,82 +859,61 @@ sub print_intro_page {
sub upload_batchfile {
my $r = shift;
my $start_page =
- &Apache::loncommon::start_page('Create a New Course or Community');
- my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Upload Course/Community Attributes File','Create_Course',undef,'Create_Courses');
+ &Apache::loncommon::start_page('Create a New Course, Community, or Placement Test');
+ my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Upload Course/Community/Placement Test Attributes File','Create_Course',undef,'Create_Courses');
my $end_page =
&Apache::loncommon::end_page();
$r->print($start_page.$crumbs);
- $r->print('
'.&mt('Upload a courses or communities attributes file').'
');
+ $r->print('
'.&mt('Upload a courses, communities or placement tests attributes file').'
');
$r->print('');
+ 'value="'.&mt('Create Courses/Communities/Placement Tests').'" />');
$r->print($end_page);
return;
}
sub process_batchfile {
my $r = shift;
+ my $start_page =
+ &Apache::loncommon::start_page('Create a New Course, Community or Placement Test');
+ my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('Creation Outcome','Create_Course',undef,'Create_Courses');
+ my $end_page =
+ &Apache::loncommon::end_page();
my $defdom=$env{'request.role.domain'};
- my $uname = $env{'user.name'};
- my $udom = $env{'user.domain'};
- my $dir = &LONCAPA::tempdir().'addcourse';
- my ($result,$logmsg,$clonemsg,$keysmsg,$codesref,$instcodesref
- if (($defdom =~ /^$match_domain$/) && ($uname =~ /^$match_username$/) && ($udom =~/^$match_domain$/)) {
- my $batchfilepath=&Apache::lonnet::userfileupload('coursecreatorxml',undef,
- 'batchupload',undef,undef,
- undef,undef,$defdom);
- if ($batchfilepath =~ m{^(\Q$dir/$defdom/web/$uname\_$udom\E)/pending/([^/]+)$}) {
- my ($batchdir,$filename) = ($1,$2);
- if (-e "$batchfilepath") {
- if (open(FILE,"<",$batchfilepath)) {
- my @buffer = ;
+ my $batchfilepath=&Apache::lonnet::userfileupload('coursecreatorxml',undef,
+ 'batchupload',undef,undef,
+ undef,undef,$defdom);
+ my ($batchdir,$filename) = ($batchfilepath =~ m-^(.+)/pending/([^/]+)$-);
+ my ($result,$logmsg);
+ if (-e "$batchfilepath") {
+ open(FILE,"<$batchfilepath");
+ my @buffer = ;
+ close(FILE);
+ if ((defined($filename)) && (defined($batchdir))) {
+ my @requests = ($filename);
+ my %courseids = ();
+ ($result,$logmsg) = &LONCAPA::batchcreatecourse::create_courses(
+ \@requests,\%courseids,'web',$defdom,
+ $env{'user.name'},$env{'user.domain'});
+ if ($result) {
+ if (!-e "$batchdir/processed") {
+ mkdir("$batchdir/processed", 0755);
+ open(FILE,">$batchdir/processed/$filename");
+ print FILE @buffer;
close(FILE);
- if ((defined($filename)) && (defined($batchdir))) {
- my @requests = ($filename);
- my %courseids = ();
- ($result,$logmsg,$clonemsg,$keysmsg,$codesref,$instcodesref) =
- &LONCAPA::batchcreatecourse::create_courses(
- \@requests,\%courseids,'web',$defdom,
- $uname,$udom);
- if (keys(%courseids) > 0) {
- if (!-e "$batchdir/processed") {
- mkdir("$batchdir/processed", 0755);
- }
- if (-d "$batchdir/processed") {
- if (open(FILE,">","$batchdir/processed/$filename")) {
- print FILE @buffer;
- close(FILE);
- }
- }
- if (-e "$batchdir/processed/$filename") {
- unlink("$batchdir/pending/$filename");
- }
- }
- if ($clonemsg) {
- $clonemsg = '