'
+ );
}
$r->print(''.
$end_page);
@@ -593,6 +631,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');
@@ -654,7 +694,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'},
@@ -741,19 +780,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',
@@ -761,7 +796,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.'
@@ -769,30 +804,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',
@@ -813,7 +856,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.'
},
]
},
@@ -830,78 +873,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 $batchfilepath=&Apache::lonnet::userfileupload('coursecreatorxml',undef,
+ 'batchupload',undef,undef,
+ undef,undef,$defdom);
+ my ($batchdir,$filename) = ($batchfilepath =~ m-^(.+)/pending/([^/]+)$-);
my ($result,$logmsg);
- 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 = ;
+ 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) = &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 (-e "$batchdir/processed/$filename") {
+ unlink("$batchdir/pending/$filename");
}
- } else {
- $result = '
'.&mt('Could not open attributes file.').' '.&mt('No courses created.').'