--- loncom/interface/loncoursequeueadmin.pm 2014/04/30 17:17:35 1.47
+++ loncom/interface/loncoursequeueadmin.pm 2015/03/26 14:16:11 1.50
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Utilities to administer domain course requests and course self-enroll requests
#
-# $Id: loncoursequeueadmin.pm,v 1.47 2014/04/30 17:17:35 raeburn Exp $
+# $Id: loncoursequeueadmin.pm,v 1.50 2015/03/26 14:16:11 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -968,6 +968,9 @@ sub update_request_queue {
}
}
}
+ if ($history{'details'}{'clonecrs'}) {
+ $customitems{'_LC_clonefrom'} = $history{'details'}{'clonedom'}.'_'.$history{'details'}{'clonecrs'};
+ }
my ($result,$postprocess) = &course_creation($cdom,$cnum,$context,$history{'details'},\$logmsg,
\$newusermsg,\$addresult,\$enrollcount,
\$response,\$keysmsg,\%domdefs,$longroles,\$code,\%customitems);
@@ -1311,7 +1314,7 @@ sub update_request_queue {
my $syllabuslink =
&Apache::loncommon::syllabuswrapper($showcourse,$cnum,$cdom);
if ($codes{$cnum}) {
- $syllabuslink .= &mt('Unique code: [_1]',$codes{$cnum});
+ $syllabuslink .= ' '.&mt('Unique code: [_1]',$codes{$cnum});
}
$output .= '
'.$syllabuslink.'';
}
@@ -2026,6 +2029,9 @@ sub process_official_reqs {
}
}
}
+ if ($history{'details'}{'clonecrs'}) {
+ $customitems{'_LC_clonefrom'} = $history{'details'}{'clonedom'}.'_'.$history{'details'}{'clonecrs'};
+ }
my ($result,$postprocess) =
&course_creation($dom,$cnum,'domain',$history{'details'},\$logmsg,\$newusermsg,\$addresult,
\$enrollcount,\$response,\$keysmsg,\%domdefs,\%longroles,\$code,\%customitems);
@@ -2062,6 +2068,11 @@ sub process_official_reqs {
}
}
}
+ if (ref($postprocess->{'createdactions'}) eq 'HASH') {
+ if (ref($postprocess->{'createdactions'}{'environment'}) eq 'HASH') {
+ &postprocess_crsenv($dom,$cnum,$postprocess->{'createdactions'}{'environment'});
+ }
+ }
}
&send_selfserve_notification($owner,$approvedmsg,
$cid,$cdescr,$now,
@@ -2133,6 +2144,56 @@ sub process_official_reqs {
return $output;
}
+sub postprocess_crsenv {
+ my ($dom,$cnum,$postprocessenv) = @_;
+ if (ref($postprocessenv) eq 'HASH') {
+ my $cid = $dom.'_'.$cnum;
+ my %settablecrsenv = (
+ 'internal.selfenroll_types' => 1,
+ 'internal.selfenroll_registered' => 1,
+ 'internal.selfenroll_section' => 1,
+ 'internal.selfenroll_start_access' => 1,
+ 'internal.selfenroll_end_access' => 1,
+ 'internal.selfenroll_limit' => 1,
+ 'internal.selfenroll_cap' => 1,
+ 'internal.selfenroll_approval' => 1,
+ 'internal.selfenroll_notifylist' => 1,
+ );
+ my %needcrsidput = (
+ 'internal.selfenroll_types' => 1,
+ 'internal.selfenroll_start_date' => 1,
+ 'internal. selfenroll_end_date' => 1,
+ );
+ my (@needupdate,%newcrsenv);
+ foreach my $key (keys(%{$postprocessenv})) {
+ if ($settablecrsenv{$key}) {
+ $newcrsenv{$key} = $postprocessenv->{$key};
+ if ($needcrsidput{$key}) {
+ push(@needupdate,$key);
+ }
+ }
+ if (keys(%newcrsenv)) {
+ my $putresult = &Apache::lonnet::put('environment',\%newcrsenv,$dom,$cnum);
+ if ($putresult eq 'ok') {
+ if (@needupdate) {
+ my %crsinfo =
+ &Apache::lonnet::courseiddump($dom,'.',1,'.','.',$cnum,undef,undef,'.');
+ if (ref($crsinfo{$cid}) eq 'HASH') {
+ foreach my $key (@needupdate) {
+ $crsinfo{$cid}{$key} = $newcrsenv{$key};
+ }
+ my $chome = &Apache::lonnet::homeserver($cnum,$dom);
+ &Apache::lonnet::courseidput($dom,\%crsinfo,$chome,'notime');
+ }
+ }
+ }
+ }
+ }
+ }
+ return;
+}
+
+
sub requestcourses_validation_types {
my @items = ('url','fields','button','markup');
my %names = &Apache::lonlocal::texthash (