version 1.97, 2016/04/04 01:07:17
|
version 1.110, 2021/03/06 13:44:51
|
Line 119 use Apache::loncoursequeueadmin;
|
Line 119 use Apache::loncoursequeueadmin;
|
use Apache::lonuserutils; |
use Apache::lonuserutils; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
|
|
my $registered_flush; |
|
my $registered_instcats; |
|
my $modified_dom; |
|
|
sub handler { |
sub handler { |
my ($r) = @_; |
my ($r) = @_; |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
Line 127 sub handler {
|
Line 131 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
|
$registered_flush = 0; |
|
$registered_instcats = 0; |
|
$modified_dom = ''; |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['action','showdom','cnum','state','crstype','queue','tabs']); |
['action','showdom','cnum','state','crstype','queue','tabs']); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
Line 155 sub handler {
|
Line 163 sub handler {
|
} |
} |
|
|
if ($canreq) { |
if ($canreq) { |
|
if (($env{'form.crstype'} eq 'lti') && ($env{'request.lti.login'}) && |
|
($env{'form.lti.reqrole'} eq 'cc') && ($env{'form.lti.reqcrs'}) && |
|
($env{'form.lti.sourcecrs'} ne '')) { |
|
if ($action eq 'process') { |
|
if ($can_request{'lti'}) { |
|
my %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$dom); |
|
&process_textbook_request($r,$dom,$action,\%domdefs,\%domconfig,\%can_request,'lti'); |
|
} else { |
|
$r->print(&header('Course Request','','','',{ 'only_body' => 1}). |
|
'<div>'. |
|
'<p class="LC_info">'.&mt('You do not have privileges to request creation of LTI courses.').'</p>'. |
|
'</div>'. |
|
&Apache::loncommon::end_page()); |
|
} |
|
} |
|
return OK; |
|
} |
if (($env{'form.crstype'} eq 'textbook') || |
if (($env{'form.crstype'} eq 'textbook') || |
(scalar(keys(%can_request)) == 1) && ($can_request{'textbook'})) { |
(scalar(keys(%can_request)) == 1) && ($can_request{'textbook'})) { |
my %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$dom); |
my %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$dom); |
Line 192 sub handler {
|
Line 217 sub handler {
|
} |
} |
} else { |
} else { |
if ($can_request{'textbook'}) { |
if ($can_request{'textbook'}) { |
&print_textbook_form($r,$dom,\@incdoms,\%domdefs,$domconfig{'requestcourses'},\%can_request); |
&print_textbook_form($r,$dom,\@incdoms,\%domdefs,$domconfig{'requestcourses'}, |
|
\%can_request,'textbook'); |
} else { |
} else { |
&textbook_request_disabled($r,$dom,$action,\%can_request); |
&textbook_request_disabled($r,$dom,$action,\%can_request); |
} |
} |
Line 551 sub form_elements {
|
Line 577 sub form_elements {
|
clonedom => 'selectbox', |
clonedom => 'selectbox', |
datemode => 'radio', |
datemode => 'radio', |
dateshift => 'text', |
dateshift => 'text', |
|
tinyurls => 'radio', |
}, |
}, |
enrollment => { |
enrollment => { |
accessstart_month => 'selectbox', |
accessstart_month => 'selectbox', |
Line 2109 sub print_personnel_menu {
|
Line 2136 sub print_personnel_menu {
|
$output .= &Apache::lonhtmlcommon::row_headline(). |
$output .= &Apache::lonhtmlcommon::row_headline(). |
'<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Personnel').' '.$lt{$crstype}.' '.&mt('Include other personnel?').'</h3>'; |
'<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Personnel').' '.$lt{$crstype}.' '.&mt('Include other personnel?').'</h3>'; |
} |
} |
for (my $i=0; $i<$persontotal; $i++) { |
my $cansearch = 1; |
|
my @alldoms = &Apache::lonnet::all_domains(); |
|
if (@alldoms == 1) { |
|
my %domsrch = &Apache::lonnet::get_dom('configuration', |
|
['directorysrch'],$alldoms[0]); |
|
if (ref($domsrch{'directorysrch'}) eq 'HASH') { |
|
if ((!$domsrch{'directorysrch'}{'available'}) && |
|
($domsrch{'directorysrch'}{'lcavailable'} eq '0')) { |
|
$cansearch = 0; |
|
} |
|
} |
|
} |
|
my ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('enroll',$dom); |
|
for (my $i=0; $i<$persontotal; $i++) { |
my @linkargs = map { 'person_'.$i.'_'.$_ } (@items); |
my @linkargs = map { 'person_'.$i.'_'.$_ } (@items); |
my $linkargstr = join("','",@linkargs); |
my $linkargstr = join("','",@linkargs); |
my $uname_form = '<input type="text" name="person_'.$i.'_uname" value="" size="20" />'; |
my $uname_form = '<input type="text" name="person_'.$i.'_uname" value="" size="20" />'; |
my $onchange = 'javascript:fix_domain('."'$formname','person_".$i."_dom',". |
my $onchange = 'javascript:fix_domain('."'$formname','person_".$i."_dom',". |
"'person_".$i."_hidedom','person_".$i."_uname'".');'; |
"'person_".$i."_hidedom','person_".$i."_uname'".');'; |
my $udom_form = &Apache::loncommon::select_dom_form($dom,'person_'.$i.'_dom','', |
my $udom_form = &Apache::loncommon::select_dom_form($dom,'person_'.$i.'_dom','', |
1,$onchange). |
1,$onchange,undef,$trusted,$untrusted). |
'<input type="hidden" name="person_'.$i.'_hidedom" value="" />'; |
'<input type="hidden" name="person_'.$i.'_hidedom" value="" />'; |
my %form_elems; |
my %form_elems; |
foreach my $item (@items) { |
foreach my $item (@items) { |
Line 2133 sub print_personnel_menu {
|
Line 2173 sub print_personnel_menu {
|
} |
} |
$sectionselector .= $newtitle. |
$sectionselector .= $newtitle. |
'<input type="text" name="person_'.$i.'_newsec" size="15" value="" />'."\n"; |
'<input type="text" name="person_'.$i.'_newsec" size="15" value="" />'."\n"; |
my $usersrchlinktxt = &mt('Search for user'); |
my $usersrchlink; |
my $usersrchlink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom, |
if ($cansearch) { |
$usersrchlinktxt); |
my $usersrchlinktxt = &mt('Search for user'); |
|
$usersrchlink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom, |
|
$usersrchlinktxt); |
|
} else { |
|
$usersrchlink = ' '; |
|
} |
my $userchklinktxt = &mt('Check username'); |
my $userchklinktxt = &mt('Check username'); |
my $userchklink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom, |
my $userchklink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom, |
$userchklinktxt,'checkusername'); |
$userchklinktxt,'checkusername'); |
Line 2382 sub print_cancel_request {
|
Line 2427 sub print_cancel_request {
|
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td>'.$history{details}{'cdescr'}.'</td><td>'. |
'<td>'.$history{details}{'cdescr'}.'</td><td>'. |
&Apache::lonlocal::locallocaltime($timestamp).'</td>'. |
&Apache::lonlocal::locallocaltime($timestamp).'</td>'. |
'<td>'.$showtype.'</td>'. |
'<td>'.&mt($showtype).'</td>'. |
&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table(). |
&Apache::loncommon::end_data_table(). |
'<br /><div class="LC_warning">'; |
'<br /><div class="LC_warning">'; |
Line 2736 sub requestlog_display_filter {
|
Line 2781 sub requestlog_display_filter {
|
$typename = $typenames->{$crstype}; |
$typename = $typenames->{$crstype}; |
} |
} |
} |
} |
$output .= '<option value="'.$crstype.'"'.$selstr.'>'.$typename.'</option>'."\n"; |
$output .= '<option value="'.$crstype.'"'.$selstr.'>'.&mt($typename).'</option>'."\n"; |
} |
} |
$output .= '</select></td>'; |
$output .= '</select></td>'; |
} |
} |
Line 2912 sub print_review {
|
Line 2957 sub print_review {
|
$inst_values .= '<td>'.$env{'form.coursecredits'}.'</td>'; |
$inst_values .= '<td>'.$env{'form.coursecredits'}.'</td>'; |
} |
} |
|
|
my %ctxt = &clone_text(); |
my %ctxt = &clone_text($env{'form.crstype'}); |
$inst_headers .= '<th>'.&mt('Clone From').'</th>'; |
$inst_headers .= '<th>'.&mt('Clone From').'</th>'; |
if (($env{'form.cloning'}) && |
if (($env{'form.cloning'}) && |
($env{'form.clonecrs'} =~ /^$match_name$/) && |
($env{'form.clonecrs'} =~ /^$match_name$/) && |
Line 2924 sub print_review {
|
Line 2969 sub print_review {
|
my %courseenv = &Apache::lonnet::userenvironment($env{'form.clonedom'}, |
my %courseenv = &Apache::lonnet::userenvironment($env{'form.clonedom'}, |
$env{'form.clonecrs'},('description','internal.coursecode')); |
$env{'form.clonecrs'},('description','internal.coursecode')); |
if (keys(%courseenv) > 0) { |
if (keys(%courseenv) > 0) { |
$inst_headers .= '<th>'.$ctxt{'dsh'}.'</th>'; |
$inst_headers .= '<th>'.$ctxt{'dsh'}.'</th>'. |
|
'<th>'.$ctxt{'dpl'}.'</th>'; |
$inst_values .= '<td>'.$courseenv{'description'}.' '; |
$inst_values .= '<td>'.$courseenv{'description'}.' '; |
my $cloneinst = $courseenv{'internal.coursecode'}; |
my $cloneinst = $courseenv{'internal.coursecode'}; |
if ($cloneinst ne '') { |
if ($cloneinst ne '') { |
Line 2940 sub print_review {
|
Line 2986 sub print_review {
|
} else { |
} else { |
$inst_values .= $ctxt{'ncd'}; |
$inst_values .= $ctxt{'ncd'}; |
} |
} |
|
$inst_values .= '</td><td>'; |
|
if ($env{'form.tinyurls'} eq 'delete') { |
|
$inst_values .= $ctxt{'nsl'}; |
|
} elsif ($env{'form.tinyurls'} eq 'transfer') { |
|
$inst_values .= $ctxt{'tsl'}; |
|
} else { |
|
$inst_values .= $ctxt{'csl'}; |
|
} |
$inst_values .= '</td>'; |
$inst_values .= '</td>'; |
} else { |
} else { |
$inst_values .= '<td>'.&mt('Unknown').'</td>'; |
$inst_values .= '<td>'.&mt('Unknown').'</td>'; |
Line 3168 sub clone_form {
|
Line 3222 sub clone_form {
|
my $type = 'Course'; |
my $type = 'Course'; |
if ($crstype eq 'community') { |
if ($crstype eq 'community') { |
$type = 'Community'; |
$type = 'Community'; |
|
} elsif ($crstype eq 'placement') { |
|
$type = 'Placement'; |
} |
} |
my %lt = &clone_text(); |
my %lt = &clone_text($crstype); |
my $output .= |
my $output .= |
&Apache::lonhtmlcommon::row_title($lt{'dmn'}).'<label>'. |
&Apache::lonhtmlcommon::row_title($lt{'dmn'}).'<label>'. |
&Apache::loncommon::select_dom_form($dom,'clonedom').'</label>'. |
&Apache::loncommon::select_dom_form($dom,'clonedom').'</label>'. |
Line 3187 sub clone_form {
|
Line 3243 sub clone_form {
|
'<input type="radio" name="datemode" value="shift" checked="checked" /> '. |
'<input type="radio" name="datemode" value="shift" checked="checked" /> '. |
$lt{'shd'}.'</label>'. |
$lt{'shd'}.'</label>'. |
'<input type="text" size="5" name="dateshift" value="365" />'. |
'<input type="text" size="5" name="dateshift" value="365" />'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
&Apache::lonhtmlcommon::row_title($lt{'dpl'}).'<label>'. |
|
'<input type="radio" name="tinyurls" value="delete" /> '.$lt{'nsl'}. |
|
'</label><br /><label>'. |
|
'<input type="radio" name="tinyurls" value="transfer" /> '.$lt{'tsl'}. |
|
'</label><br /><label>'. |
|
'<input type="radio" name="tinyurls" value="create" checked="checked" /> '.$lt{'csl'}. |
|
'</label>'. |
&Apache::lonhtmlcommon::row_closure(1); |
&Apache::lonhtmlcommon::row_closure(1); |
return $output; |
return $output; |
} |
} |
|
|
sub clone_text { |
sub clone_text { |
return &Apache::lonlocal::texthash( |
my ($crstype) = @_; |
|
my %lt = &Apache::lonlocal::texthash( |
'cid' => 'Course ID', |
'cid' => 'Course ID', |
'dmn' => 'Domain', |
'dmn' => 'Domain', |
'dsh' => 'Date Shift', |
'dsh' => 'Date Shift', |
'ncd' => 'Do not clone date parameters', |
'ncd' => 'Do not clone date parameters', |
'prd' => 'Clone date parameters as-is', |
'prd' => 'Clone date parameters as-is', |
'shd' => 'Shift date parameters by number of days', |
'shd' => 'Shift date parameters by number of days', |
); |
'dpl' => 'URL shortcuts (for deep linking)', |
|
'nsl' => 'Do not clone URL shortcuts', |
|
'tsl' => 'Transfer URL shortcuts from existing course to new course', |
|
'csl' => 'Create new URL shortcuts in new course', |
|
); |
|
if ($crstype eq 'Community') { |
|
$lt{'tsl'} = &mt('Transfer URL shortcuts from existing course to new community'); |
|
$lt{'csl'} = &mt('Create new URL shortcuts in new course'); |
|
} |
|
return %lt; |
} |
} |
|
|
sub coursecode_form { |
sub coursecode_form { |
Line 3225 sub coursecode_form {
|
Line 3299 sub coursecode_form {
|
} |
} |
if (@{$codetitles} > 0) { |
if (@{$codetitles} > 0) { |
my $lastitem = pop(@{$codetitles}); |
my $lastitem = pop(@{$codetitles}); |
my $lastinput = '<input type="text" size="5" name="'.$sel.'_'. $lastitem.'" />'; |
my $lastinput = '<input type="text" size="5" name="'.$sel.'_'.$lastitem.'" />'; |
if (@{$codetitles} > 0) { |
if (@{$codetitles} > 0) { |
my $helplink; |
my $helplink; |
if (defined($helpitem{$context})) { |
if (defined($helpitem{$context})) { |
Line 3333 sub get_course_dom {
|
Line 3407 sub get_course_dom {
|
return $env{'user.domain'}; |
return $env{'user.domain'}; |
} |
} |
} |
} |
my @possible_doms; |
my (@possible_doms,%willtrust); |
foreach my $type (@{$types}) { |
foreach my $type (@{$types}) { |
my $dom_str = $env{'environment.reqcrsotherdom.'.$type}; |
my $dom_str = $env{'environment.reqcrsotherdom.'.$type}; |
if ($dom_str ne '') { |
if ($dom_str ne '') { |
my @domains = split(',',$dom_str); |
my @domains = split(',',$dom_str); |
foreach my $entry (@domains) { |
foreach my $entry (@domains) { |
my ($extdom,$extopt) = split(':',$entry); |
my ($extdom,$extopt) = split(':',$entry); |
if ($extdom eq $env{'request.role.domain'}) { |
unless (exists($willtrust{$extdom})) { |
return $extdom; |
$willtrust{$extdom} = &Apache::lonnet::will_trust('reqcrs',$env{'user.domain'},$extdom); |
} |
} |
unless(grep(/^\Q$extdom\E$/,@possible_doms)) { |
if ($willtrust{$extdom}) { |
push(@possible_doms,$extdom); |
if ($extdom eq $env{'request.role.domain'}) { |
|
return $extdom; |
|
} |
|
unless(grep(/^\Q$extdom\E$/,@possible_doms)) { |
|
push(@possible_doms,$extdom); |
|
} |
} |
} |
} |
} |
} |
} |
Line 3641 sub print_request_outcome {
|
Line 3720 sub print_request_outcome {
|
clonecrs => $clonecrs, |
clonecrs => $clonecrs, |
datemode => $env{'form.datemode'}, |
datemode => $env{'form.datemode'}, |
dateshift => $env{'form.dateshift'}, |
dateshift => $env{'form.dateshift'}, |
|
tinyurls => $env{'form.tinyurls'}, |
sectotal => $sectotal, |
sectotal => $sectotal, |
sections => \%sections, |
sections => \%sections, |
crosslisttotal => $crosslisttotal, |
crosslisttotal => $crosslisttotal, |
Line 3774 sub process_request {
|
Line 3854 sub process_request {
|
$storeresult = 'rejected'; |
$storeresult = 'rejected'; |
} elsif ($disposition eq 'process') { |
} elsif ($disposition eq 'process') { |
my %domdefs = &Apache::lonnet::get_domain_defaults($dom); |
my %domdefs = &Apache::lonnet::get_domain_defaults($dom); |
my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg,%longroles,$code); |
my ($logmsg,$newusermsg,$addresult,$enrollcount,$response, |
|
$keysmsg,%longroles,$code); |
|
my $clonemsg = []; |
my $type = 'Course'; |
my $type = 'Course'; |
if ($crstype eq 'community') { |
if ($crstype eq 'community') { |
$type = 'Community'; |
$type = 'Community'; |
Line 3807 sub process_request {
|
Line 3889 sub process_request {
|
$customitems{'_LC_coursestartdate'} = $accessstart; |
$customitems{'_LC_coursestartdate'} = $accessstart; |
$customitems{'_LC_courseenddate'} = $accessend; |
$customitems{'_LC_courseenddate'} = $accessend; |
my ($result,$postprocess) = &Apache::loncoursequeueadmin::course_creation($dom,$cnum, |
my ($result,$postprocess) = &Apache::loncoursequeueadmin::course_creation($dom,$cnum, |
'autocreate',$details,\$logmsg,\$newusermsg,\$addresult, |
'autocreate',$details,\$logmsg,$clonemsg,\$newusermsg, |
\$enrollcount,\$response,\$keysmsg,\%domdefs,\%longroles, |
\$addresult,\$enrollcount,\$response,\$keysmsg,\%domdefs, |
\$code,\%customitems); |
\%longroles,\$code,\%customitems); |
if (ref($postprocess) eq 'HASH') { |
if (ref($postprocess) eq 'HASH') { |
$customized = $postprocess->{'createdcustomized'}; |
$customized = $postprocess->{'createdcustomized'}; |
} |
} |
Line 3843 sub process_request {
|
Line 3925 sub process_request {
|
$output .= '<br />'.$role_result; |
$output .= '<br />'.$role_result; |
} |
} |
$output .= '</p>'; |
$output .= '</p>'; |
|
if ($logmsg) { |
|
$output .= '<p>'.$logmsg.'</p>'; |
|
} |
|
if ((ref($clonemsg) eq 'ARRAY') && (@{$clonemsg})) { |
|
$output .= '<p class="LC_info">'; |
|
my $user_lh = &Apache::loncommon::user_lang($env{'user.name'},$env{'user.domain'}); |
|
foreach my $item (@{$clonemsg}) { |
|
if (ref($item) eq 'HASH') { |
|
$output .= &mt_user($user_lh,$item->{mt}, |
|
@{$item->{args}}).'<br />'."\n"; |
|
} |
|
} |
|
$output .= '</p>'."\n"; |
|
} |
$creationresult = 'created'; |
$creationresult = 'created'; |
|
# Flush the course logs so reverse user roles immediately updated |
|
unless ($registered_flush) { |
|
my $handlers = $r->get_handlers('PerlCleanupHandler'); |
|
$r->set_handlers('PerlCleanupHandler' => [\&Apache::lonnet::flushcourselogs,@{$handlers}]); |
|
$registered_flush=1; |
|
} |
|
if ($instcode ne '') { |
|
&Apache::lonnet::devalidate_cache_new('instcats',$dom); |
|
# Update cache of self-cataloging courses on institution's server(s). |
|
if (&Apache::lonnet::shared_institution($dom)) { |
|
unless ($registered_instcats) { |
|
my $handlers = $r->get_handlers('PerlCleanupHandler'); |
|
$r->set_handlers('PerlCleanupHandler' => [\&devalidate_remote_instcats,@{$handlers}]); |
|
$registered_instcats=1; |
|
$modified_dom = $dom; |
|
} |
|
} |
|
} |
} else { |
} else { |
$output = '<span class="LC_error">'; |
$output = '<span class="LC_error">'; |
if ($crstype eq 'community') { |
if ($crstype eq 'community') { |
Line 3979 sub process_request {
|
Line 4093 sub process_request {
|
} |
} |
} |
} |
|
|
|
sub devalidate_remote_instcats { |
|
if ($modified_dom ne '') { |
|
my %servers = &Apache::lonnet::internet_dom_servers($modified_dom); |
|
my %thismachine; |
|
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); |
|
if (keys(%servers)) { |
|
foreach my $server (keys(%servers)) { |
|
next if ($thismachine{$server}); |
|
&Apache::lonnet::remote_devalidate_cache($server,['instcats:'.$modified_dom]); |
|
} |
|
} |
|
$modified_dom = ''; |
|
} |
|
return; |
|
} |
|
|
sub custom_formitems { |
sub custom_formitems { |
my ($preprocess,$customhash) = @_; |
my ($preprocess,$customhash) = @_; |
return unless ((ref($preprocess) eq 'HASH') && (ref($customhash) eq 'HASH')); |
return unless ((ref($preprocess) eq 'HASH') && (ref($customhash) eq 'HASH')); |
Line 4287 sub pending_validation_form {
|
Line 4417 sub pending_validation_form {
|
$buttontext = &mt('Create course'); |
$buttontext = &mt('Create course'); |
} |
} |
} |
} |
|
my $hostname = &Apache::lonnet::hostname($lonhost); |
my $protocol = $Apache::lonnet::protocol{$lonhost}; |
my $protocol = $Apache::lonnet::protocol{$lonhost}; |
$protocol = 'http' if ($protocol ne 'https'); |
$protocol = 'http' if ($protocol ne 'https'); |
my $crscreator = $protocol.'://'.&Apache::lonnet::hostname($lonhost).'/cgi-bin/createpending.pl'; |
my $crscreator = $protocol.'://'.$hostname.'/cgi-bin/createpending.pl'; |
$output .= '<input type="hidden" name="crscreator" value="'.$crscreator.'" />'."\n". |
$output .= '<input type="hidden" name="crscreator" value="'.$crscreator.'" />'."\n". |
'<input type="hidden" name="token" value="'.$token.'" />'."\n". |
'<input type="hidden" name="token" value="'.$token.'" />'."\n". |
'<input type="submit" name="validate" value="'.$buttontext.'" />'."\n". |
'<input type="submit" name="validate" value="'.$buttontext.'" />'."\n". |
Line 4365 sub retrieve_settings {
|
Line 4496 sub retrieve_settings {
|
} |
} |
$env{'form.datemode'} = $reqinfo{'datemode'}; |
$env{'form.datemode'} = $reqinfo{'datemode'}; |
$env{'form.dateshift'} = $reqinfo{'dateshift'}; |
$env{'form.dateshift'} = $reqinfo{'dateshift'}; |
|
$env{'form.tinyurls'} = $reqinfo{'tinyurls'}; |
if ($reqinfo{'crstype'} eq 'official') { |
if ($reqinfo{'crstype'} eq 'official') { |
$env{'form.autoadds'} = $reqinfo{'autoadds'}; |
$env{'form.autoadds'} = $reqinfo{'autoadds'}; |
$env{'form.autodrops'} = $reqinfo{'autodrops'}; |
$env{'form.autodrops'} = $reqinfo{'autodrops'}; |
Line 4516 sub generate_date_items {
|
Line 4648 sub generate_date_items {
|
} |
} |
|
|
sub print_textbook_form { |
sub print_textbook_form { |
my ($r,$dom,$incdoms,$domdefs,$settings,$can_request) = @_; |
my ($r,$dom,$incdoms,$domdefs,$settings,$can_request,$crstype,$formhash) = @_; |
my (%prefab,%ordered,%numprefab); |
my (%prefab,%ordered,%numprefab); |
my $crstype = 'textbook'; |
if ($crstype eq '') { |
|
$crstype = 'textbook'; |
|
} |
# |
# |
# Retrieve list of prefabricated courses (textbook courses and templates) cloneable by user |
# Retrieve list of prefabricated courses (textbook courses and templates) cloneable by user |
# |
# |
Line 4578 sub print_textbook_form {
|
Line 4712 sub print_textbook_form {
|
owner => $courseinfo{'internal.courseowner'}, |
owner => $courseinfo{'internal.courseowner'}, |
releaserequired => $courseinfo{'internal.releaserequired'}, |
releaserequired => $courseinfo{'internal.releaserequired'}, |
type => $courseinfo{'type'}, |
type => $courseinfo{'type'}, |
}; |
}; |
} |
} |
} |
} |
|
|
Line 4635 sub print_textbook_form {
|
Line 4769 sub print_textbook_form {
|
|
|
my $jscript = &textbook_request_javascript(\%numprefab,$numcurrent,$numdomcourses,$customvalidationjs); |
my $jscript = &textbook_request_javascript(\%numprefab,$numcurrent,$numdomcourses,$customvalidationjs); |
$jscript .= $customjs; |
$jscript .= $customjs; |
my %loaditems; |
my (%loaditems,$args); |
$loaditems{'onload'} = 'javascript:uncheckAllRadio();'.$customonload; |
$loaditems{'onload'} = 'javascript:uncheckAllRadio();'.$customonload; |
$r->print(&header('Course Request',$jscript,\%loaditems)); |
if ($crstype eq 'lti') { |
|
$args = { 'only_body' => 1}; |
|
} |
|
$r->print(&header('Course Request',$jscript,\%loaditems,undef,$args)); |
|
|
if (ref($can_request) eq 'HASH') { |
if (ref($can_request) eq 'HASH') { |
unless ((scalar(keys(%{$can_request})) == 1) && ($can_request->{'textbook'})) { |
unless (((scalar(keys(%{$can_request})) == 1) && ($can_request->{'textbook'})) || |
|
($crstype eq 'lti')) { |
&Apache::lonhtmlcommon::add_breadcrumb( |
&Apache::lonhtmlcommon::add_breadcrumb( |
{ href => '/adm/requestcourse', |
{ href => '/adm/requestcourse', |
text => 'Pick action', |
text => 'Pick action', |
}); |
}); |
} |
} |
} |
} |
&Apache::lonhtmlcommon::add_breadcrumb({text=>'Course Request'}); |
unless ($crstype eq 'lti') { |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests')); |
&Apache::lonhtmlcommon::add_breadcrumb({text=>'Course Request'}); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests')); |
|
|
&startContentScreen($r,'textbookrequests'); |
&startContentScreen($r,'textbookrequests'); |
# |
# |
# Show domain selector form, if required. |
# Show domain selector form, if required. |
# |
# |
if (@{$incdoms} > 1) { |
if (@{$incdoms} > 1) { |
my $onchange = 'this.form.submit()'; |
my $onchange = 'this.form.submit()'; |
$r->print('<form name="domforcourse" method="post" action="/adm/requestcourse">'. |
$r->print('<form name="domforcourse" method="post" action="/adm/requestcourse">'. |
'<div><fieldset><legend>'.&mt('Domain').'</legend>'. |
'<div><fieldset><legend>'.&mt('Domain').'</legend>'. |
&Apache::loncommon::select_dom_form($dom,'showdom','',1,$onchange,$incdoms). |
&Apache::loncommon::select_dom_form($dom,'showdom','',1,$onchange,$incdoms). |
'</fieldset></form>'); |
'</fieldset></form>'); |
|
} |
} |
} |
|
|
# |
# |
Line 4767 sub print_textbook_form {
|
Line 4907 sub print_textbook_form {
|
# |
# |
# Table of user's current courses (owner and/or course coordinator) |
# Table of user's current courses (owner and/or course coordinator) |
# |
# |
my %lt = &clone_text(); |
my %lt = &clone_text('Course'); |
if (keys(%cloneable)) { |
if (keys(%cloneable)) { |
$r->print('<div id="showexisting" style="display:none">'. |
$r->print('<div id="showexisting" style="display:none">'. |
&clone_selection_table($dom,'owned',\%cloneable). |
&clone_selection_table($dom,'owned',\%cloneable). |
'<p><input type="radio" name="owndatemode" value="delete" /> '.$lt{'ncd'}. |
'<fieldset style="display:inline-block"><legend>'.$lt{'dsh'}.'</legend><label>'. |
|
'<input type="radio" name="owndatemode" value="delete" /> '.$lt{'ncd'}. |
'</label><br /><label>'. |
'</label><br /><label>'. |
'<input type="radio" name="owndatemode" value="preserve" /> '.$lt{'prd'}. |
'<input type="radio" name="owndatemode" value="preserve" /> '.$lt{'prd'}. |
'</label><br /><label>'. |
'</label><br /><label>'. |
'<input type="radio" name="owndatemode" value="shift" checked="checked" /> '. |
'<input type="radio" name="owndatemode" value="shift" checked="checked" /> '. |
$lt{'shd'}.'</label>'. |
$lt{'shd'}.'</label>'. |
'<input type="text" size="5" name="owndateshift" value="365" />'. |
'<input type="text" size="5" name="owndateshift" value="365" />'. |
|
'</fieldset><fieldset style="display:inline-block">'. |
|
'<legend>'.$lt{'dpl'}.'</legend><label>'. |
|
'<input type="radio" name="owntinyurls" value="delete" />'.$lt{'nsl'}. |
|
'</label><br /><label>'. |
|
'<input type="radio" name="owntinyurls" value="transfer" />'.$lt{'tsl'}. |
|
'</label><br /><label>'. |
|
'<input type="radio" name="owntinyurls" value="create" checked="checked" />'.$lt{'csl'}. |
|
'</label></fieldset>'. |
'</div>'); |
'</div>'); |
} |
} |
# |
# |
Line 4786 sub print_textbook_form {
|
Line 4935 sub print_textbook_form {
|
if (keys(%domcloneable)) { |
if (keys(%domcloneable)) { |
$r->print('<div id="showcolleague" style="display:none">'. |
$r->print('<div id="showcolleague" style="display:none">'. |
&clone_selection_table($dom,'colleague',\%domcloneable). |
&clone_selection_table($dom,'colleague',\%domcloneable). |
'<p><input type="radio" name="colldatemode" value="delete" /> '.$lt{'ncd'}. |
'<fieldset style="display:inline-block"><legend>'.$lt{'dsh'}.'</legend><label>'. |
|
'<input type="radio" name="colldatemode" value="delete" /> '.$lt{'ncd'}. |
'</label><br /><label>'. |
'</label><br /><label>'. |
'<input type="radio" name="colldatemode" value="preserve" /> '.$lt{'prd'}. |
'<input type="radio" name="colldatemode" value="preserve" /> '.$lt{'prd'}. |
'</label><br /><label>'. |
'</label><br /><label>'. |
'<input type="radio" name="colldatemode" value="shift" checked="checked" /> '. |
'<input type="radio" name="colldatemode" value="shift" checked="checked" /> '. |
$lt{'shd'}.'</label>'. |
$lt{'shd'}.'</label>'. |
'<input type="text" size="5" name="colldateshift" value="365" />'. |
'<input type="text" size="5" name="colldateshift" value="365" />'. |
|
'</fieldset><fieldset style="display:inline-block">'. |
|
'<legend>'.$lt{'dpl'}.'</legend><label>'. |
|
'<input type="radio" name="colltinyurls" value="delete" />'.$lt{'nsl'}. |
|
'</label><br /><label>'. |
|
'<input type="radio" name="colltinyurls" value="create" checked="checked" />'.$lt{'csl'}. |
|
'</label></fieldset>'. |
'</div>'); |
'</div>'); |
} |
} |
|
|
Line 4839 sub print_textbook_form {
|
Line 4995 sub print_textbook_form {
|
# |
# |
# Submit button |
# Submit button |
# |
# |
$r->print('<input type="hidden" name="crstype" value="textbook" />'. |
$r->print('<input type="hidden" name="crstype" value="'.$crstype.'" />'. |
'<input type="hidden" name="action" value="process" />'. |
'<input type="hidden" name="action" value="process" />'. |
'<input type="submit" value="'.&mt('Create course').'" />'); |
'<input type="submit" value="'.&mt('Create course').'" />'); |
|
|
# |
# |
# End request form |
# End request form |
# |
# |
|
|
|
if (($crstype eq 'lti') && (ref($formhash) eq 'HASH')) { |
|
foreach my $item (keys(%{$formhash})) { |
|
$r->print('<input type="hidden" name="'.$item.'" value="'.$formhash->{$item}.'" />'."\n"); |
|
} |
|
} |
|
|
$r->print('</form>'); |
$r->print('</form>'); |
&endContentScreen($r). |
unless ($crstype eq 'lti') { |
|
&endContentScreen($r); |
|
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
Line 4934 sub clone_selection_table {
|
Line 5099 sub clone_selection_table {
|
} |
} |
|
|
sub process_textbook_request { |
sub process_textbook_request { |
my ($r,$dom,$action,$domdefs,$domconfig,$can_request) = @_; |
my ($r,$dom,$action,$domdefs,$domconfig,$can_request,$crstype) = @_; |
my ($uniquecode,$req_notifylist); |
my ($uniquecode,$req_notifylist); |
my $crstype = 'textbook'; |
if ($crstype eq '') { |
|
$crstype = 'textbook'; |
|
} |
if (ref($domconfig) eq 'HASH') { |
if (ref($domconfig) eq 'HASH') { |
if (ref($domconfig->{'requestcourses'}) eq 'HASH') { |
if (ref($domconfig->{'requestcourses'}) eq 'HASH') { |
if (ref($domconfig->{'requestcourses'}{'notify'}) eq 'HASH') { |
if (ref($domconfig->{'requestcourses'}{'notify'}) eq 'HASH') { |
Line 4978 sub process_textbook_request {
|
Line 5145 sub process_textbook_request {
|
} |
} |
} |
} |
my $js = &processing_javascript(); |
my $js = &processing_javascript(); |
my $loaditems = { |
my ($loaditems,$args); |
onload => 'javascript:hideProcessing();', |
$loaditems = { |
}; |
onload => 'javascript:hideProcessing();', |
$r->print(&header('Course Creation',$js,$loaditems)); |
}; |
|
if ($crstype eq 'lti') { |
if (ref($can_request) eq 'HASH') { |
$args = { 'only_body' => 1}; |
unless ((scalar(keys(%{$can_request})) == 1) && ($can_request->{'textbook'})) { |
} |
&Apache::lonhtmlcommon::add_breadcrumb( |
$r->print(&header('Course Creation',$js,$loaditems,undef,$args)); |
{ href => '/adm/requestcourse', |
|
text => 'Pick action', |
unless ($crstype eq 'lti') { |
}); |
if (ref($can_request) eq 'HASH') { |
|
unless ((scalar(keys(%{$can_request})) == 1) && ($can_request->{'textbook'})) { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{ href => '/adm/requestcourse', |
|
text => 'Pick action', |
|
}); |
|
} |
} |
} |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{ href => '/adm/requestcourse', |
|
text => "Create Course", |
|
} |
|
); |
|
&Apache::lonhtmlcommon::add_breadcrumb({text=>'Request Processed'}); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests')); |
|
&startContentScreen($r,'textbookrequests'); |
} |
} |
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{ href => '/adm/requestcourse', |
|
text => "Create Course", |
|
} |
|
); |
|
&Apache::lonhtmlcommon::add_breadcrumb({text=>'Request Processed'}); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests')); |
|
&startContentScreen($r,'textbookrequests'); |
|
|
|
my $details = { |
my $details = { |
owner => $env{'user.name'}, |
owner => $env{'user.name'}, |
Line 5023 sub process_textbook_request {
|
Line 5196 sub process_textbook_request {
|
} else { |
} else { |
$details->{dateshift} = ''; |
$details->{dateshift} = ''; |
} |
} |
|
$details->{tinyurls} = $env{'form.owntinyurls'}; |
} elsif ($reqtype eq 'colleague') { |
} elsif ($reqtype eq 'colleague') { |
$details->{datemode} = $env{'form.colldatemode'}; |
$details->{datemode} = $env{'form.colldatemode'}; |
if ($details->{datemode} eq 'shift') { |
if ($details->{datemode} eq 'shift') { |
Line 5030 sub process_textbook_request {
|
Line 5204 sub process_textbook_request {
|
} else { |
} else { |
$details->{dateshift} = ''; |
$details->{dateshift} = ''; |
} |
} |
|
$details->{tinyurls} = $env{'form.colltinyurls'}; |
|
} elsif (($reqtype eq 'textbook') || ($reqtype eq 'template')) { |
|
$details->{datemode} = 'delete'; |
|
$details->{dateshift} = ''; |
|
$details->{tinyurls} = ''; |
} |
} |
if ($details->{dateshift} ne '') { |
if ($details->{dateshift} ne '') { |
$details->{dateshift} =~ s/[^\d\.]+//g; |
$details->{dateshift} =~ s/[^\d\.]+//g; |
Line 5037 sub process_textbook_request {
|
Line 5216 sub process_textbook_request {
|
} else { |
} else { |
$details->{datemode} = ''; |
$details->{datemode} = ''; |
$details->{dateshift} = ''; |
$details->{dateshift} = ''; |
|
$details->{tinyurls} = ''; |
} |
} |
my $lonhost = $r->dir_config('lonHostID'); |
my $lonhost = $r->dir_config('lonHostID'); |
$r->rflush(); |
$r->rflush(); |
my ($result,$output,$customized) = &process_request($r,$lonhost,$dom,$cnum,$crstype,$now,$details, |
my ($result,$output,$customized) = &process_request($r,$lonhost,$dom,$cnum,$crstype,$now,$details, |
'',$req_notifylist,[],$domconfig); |
'',$req_notifylist,[],$domconfig); |
$r->print($output); |
$r->print($output); |
if (&Apache::loncoursequeueadmin::author_prompt()) { |
if ($crstype eq 'lti') { |
|
my %consumers = &Apache::lonnet::get_dom('lticonsumers',[$env{'form.sourcecrs'}],$dom); |
|
if (($env{'form.lti.sourcecrs'} ne '') && ($consumers{$env{'form.lti.sourcecrs'}} eq '') && ($cnum ne '')) { |
|
&Apache::lonnet::put_dom('lticonsumers',{ $env{'form.lti.sourcecrs'} => $cnum },$dom); |
|
} |
|
} elsif (&Apache::loncoursequeueadmin::author_prompt()) { |
unless ($customized) { |
unless ($customized) { |
&print_author_prompt($r,$action,$cnum,$dom,$crstype,$result); |
&print_author_prompt($r,$action,$cnum,$dom,$crstype,$result); |
} |
} |
Line 5052 sub process_textbook_request {
|
Line 5237 sub process_textbook_request {
|
$r->print('<p><a href="/adm/requestcourse">'.&mt('Create another course').'</a></p>'); |
$r->print('<p><a href="/adm/requestcourse">'.&mt('Create another course').'</a></p>'); |
} |
} |
} |
} |
&endContentScreen($r); |
unless ($crstype eq 'lti') { |
|
&endContentScreen($r); |
|
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|