version 1.44, 2014/03/03 17:11:41
|
version 1.49, 2014/05/13 16:05:45
|
Line 90 use Apache::loncommon;
|
Line 90 use Apache::loncommon;
|
use Apache::lonmsg; |
use Apache::lonmsg; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonuserutils; |
use Apache::lonuserutils; |
|
use LONCAPA::batchcreatecourse; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
|
sub send_selfserve_notification { |
sub send_selfserve_notification { |
Line 885 sub update_request_queue {
|
Line 886 sub update_request_queue {
|
$middlename = $curr{$uname}{'middlename'}; |
$middlename = $curr{$uname}{'middlename'}; |
$lastname = $curr{$uname}{'lastname'}; |
$lastname = $curr{$uname}{'lastname'}; |
$generation = $curr{$uname}{'generation'}; |
$generation = $curr{$uname}{'generation'}; |
$inststatus = $curr{$uname}{'usertype'}; |
$inststatus = $curr{$uname}{'inststatus'}; |
|
|
my ($key,$caller)=split(/&/,$curr{$uname}{'tmpinfo'}); |
my ($key,$caller)=split(/&/,$curr{$uname}{'tmpinfo'}); |
if ($caller eq 'createaccount') { |
if ($caller eq 'createaccount') { |
Line 1310 sub update_request_queue {
|
Line 1311 sub update_request_queue {
|
my $syllabuslink = |
my $syllabuslink = |
&Apache::loncommon::syllabuswrapper($showcourse,$cnum,$cdom); |
&Apache::loncommon::syllabuswrapper($showcourse,$cnum,$cdom); |
if ($codes{$cnum}) { |
if ($codes{$cnum}) { |
$syllabuslink .= &mt('Unique code: [_1]',$codes{$cnum}); |
$syllabuslink .= ' '.&mt('Unique code: [_1]',$codes{$cnum}); |
} |
} |
$output .= '<li>'.$syllabuslink.'</li>'; |
$output .= '<li>'.$syllabuslink.'</li>'; |
} |
} |
Line 1604 sub course_creation {
|
Line 1605 sub course_creation {
|
my ($result,$ownername,$ownerdom); |
my ($result,$ownername,$ownerdom); |
my $crstype = $details->{'crstype'}; |
my $crstype = $details->{'crstype'}; |
my $coursedesc = $details->{'cdescr'}; |
my $coursedesc = $details->{'cdescr'}; |
my %domconfig = &Apache::lonnet::get_dom('configuration',['requestauthor'],$dom); |
my $accessstart = $details->{'accessstart'}; |
|
my $accessend = $details->{'accessend'}; |
|
my %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$dom); |
if (ref($domconfig{'requestcourses'}) eq 'HASH') { |
if (ref($domconfig{'requestcourses'}) eq 'HASH') { |
if (ref($domconfig{'requestcourses'}{'uniquecode'}) eq 'HASH') { |
if (ref($domconfig{'requestcourses'}{'uniquecode'}) eq 'HASH') { |
if ($domconfig{'requestcourses'}{'uniquecode'}{$crstype}) { |
if ($domconfig{'requestcourses'}{'uniquecode'}{$crstype}) { |
Line 1638 sub course_creation {
|
Line 1641 sub course_creation {
|
$code = $$coderef; |
$code = $$coderef; |
} |
} |
$postprocess = &Apache::lonnet::auto_crsreq_update($dom,$cnum,$crstype,$result,$ownername, |
$postprocess = &Apache::lonnet::auto_crsreq_update($dom,$cnum,$crstype,$result,$ownername, |
$ownerdom,$fullname,$coursedesc,$code,$customhash); |
$ownerdom,$fullname,$coursedesc,$code, |
|
$accessstart,$accessend,$customhash); |
} else { |
} else { |
$result = 'error: '.$cid; |
$result = 'error: '.$cid; |
} |
} |
Line 2058 sub process_official_reqs {
|
Line 2062 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, |
&send_selfserve_notification($owner,$approvedmsg, |
$cid,$cdescr,$now, |
$cid,$cdescr,$now, |
Line 2129 sub process_official_reqs {
|
Line 2138 sub process_official_reqs {
|
return $output; |
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 ( |
|
url => 'Web address of validation server/script', |
|
fields => 'Form fields to send to validator', |
|
button => 'Text for validation button', |
|
markup => 'Validation description (HTML)', |
|
); |
|
my @fields = ('owner','course','coursetype','description'); |
|
return (\@items,\%names,\@fields); |
|
} |
|
|
sub is_active_author { |
sub is_active_author { |
if ($env{'user.role.au./'.$env{'user.domain'}.'/'} =~ /^(\d*)\.(\d*)$/) { |
if ($env{'user.role.au./'.$env{'user.domain'}.'/'} =~ /^(\d*)\.(\d*)$/) { |
if ((!$1 || $1 < time) && |
if ((!$1 || $1 < time) && |