--- loncom/interface/lonrequestcourse.pm 2014/06/16 01:42:22 1.85 +++ loncom/interface/lonrequestcourse.pm 2015/06/08 22:06:52 1.88 @@ -1,7 +1,7 @@ # The LearningOnline Network # Request a course # -# $Id: lonrequestcourse.pm,v 1.85 2014/06/16 01:42:22 raeburn Exp $ +# $Id: lonrequestcourse.pm,v 1.88 2015/06/08 22:06:52 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -939,7 +939,8 @@ END if ($action eq 'new') { my $jsextra; if (($state eq 'courseinfo') || ($state eq 'codepick')) { - $jsextra = "\n".&Apache::loncommon::coursebrowser_javascript($dom); + $jsextra = "\n".&Apache::loncommon::coursebrowser_javascript($dom,'','','','','', + $newinstcode); } elsif ($state eq 'enrollment') { if (($env{'form.crstype'} eq 'official') && (&Apache::lonnet::auto_run('',$dom))) { @@ -2788,6 +2789,7 @@ sub print_review { my $enrollrow_title = &mt('Default Access Dates').'
'. '('.&Apache::lonnet::plaintext('st',$category).')'; + my $instcode; if ($env{'form.crstype'} eq 'official') { if ((ref($codetitles) eq 'ARRAY') && (ref($cat_titles) eq 'HASH')) { foreach my $title (@{$codetitles}) { @@ -2803,6 +2805,11 @@ sub print_review { } } } + if (ref($code_order) eq 'ARRAY') { + foreach my $item (@{$code_order}) { + $instcode .= $env{'form.instcode_'.$item}; + } + } $inst_headers .= ''.&mt('Credits').''; if ($instcredits) { $inst_values .= ''.$instcredits.''; @@ -2890,7 +2897,7 @@ sub print_review { ($env{'form.clonedom'} =~ /^$match_domain$/)) { my $canclone = &Apache::loncoursequeueadmin::can_clone_course($uname, $udom,$env{'form.clonecrs'},$env{'form.clonedom'}, - $env{'form.crstype'}); + $env{'form.crstype'},$dom,$instcode); if ($canclone) { my %courseenv = &Apache::lonnet::userenvironment($env{'form.clonedom'}, $env{'form.clonecrs'},('description','internal.coursecode')); @@ -3588,7 +3595,7 @@ sub print_request_outcome { my $canclone = &Apache::loncoursequeueadmin::can_clone_course($env{'user.name'}, $env{'user.domain'},$env{'form.clonecrs'},$env{'form.clonedom'}, - $crstype); + $crstype,$dom,$instcode); if ($canclone) { $clonecrs = $env{'form.clonecrs'}; $clonedom = $env{'form.clonedom'}; @@ -3670,6 +3677,11 @@ sub process_request { $dom,$crstype,$limit,\$message); } elsif ($val eq 'validate') { my ($inststatuslist,$validationchk,$validation,%custominfo); + if (ref($details) eq 'HASH') { + if ($details->{'clonecrs'}) { + $custominfo{'_LC_clonefrom'} = $details->{'clonedom'}.'_'.$details->{'clonecrs'}; + } + } if (@inststatuses > 0) { $inststatuslist = join(',',@inststatuses); } @@ -3762,6 +3774,11 @@ sub process_request { &mt('Your request is being processed; this page will update when processing is complete.'). ''); $r->rflush(); + if (ref($details) eq 'HASH') { + if ($details->{'clonecrs'}) { + $customitems{'_LC_clonefrom'} = $details->{'clonedom'}.'_'.$details->{'clonecrs'}; + } + } my ($result,$postprocess) = &Apache::loncoursequeueadmin::course_creation($dom,$cnum, 'autocreate',$details,\$logmsg,\$newusermsg,\$addresult, \$enrollcount,\$response,\$keysmsg,\%domdefs,\%longroles, @@ -4452,7 +4469,7 @@ sub print_textbook_form { my ($clonedom,$clonecrs) = split(/_/,$item); if (ref($prefab{$type}{$item}) eq 'HASH') { if (&Apache::loncoursequeueadmin::can_clone_course($env{'user.name'}, - $env{'user.domain'},$clonecrs,$clonedom,$crstype)) { + $env{'user.domain'},$clonecrs,$clonedom,$crstype,$dom)) { my $num = $prefab{$type}{$item}{'order'}; $ordered{$type}{$num} = $item; @@ -4794,7 +4811,7 @@ sub process_textbook_request { if (&Apache::lonnet::homeserver($clonecrs,$clonedom) ne 'no_host') { my $canclone = &Apache::loncoursequeueadmin::can_clone_course($env{'user.name'}, - $env{'user.domain'},$clonecrs,$clonedom,$crstype); + $env{'user.domain'},$clonecrs,$clonedom,$crstype,$dom); unless ($canclone) { undef($clonecrs); undef($clonedom); @@ -4933,9 +4950,9 @@ function uncheckAllRadio() { if (numbook > 0) { uncheckRadio('textbook'); } - if (nutemplate > 0) { + if (numtemplate > 0) { uncheckRadio('template'); - }m + } if (numcurrent > 0) { uncheckRadio('existing'); }