version 1.95.2.7.2.2, 2023/01/23 05:30:44
|
version 1.118, 2025/01/10 22:45:55
|
Line 163 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 200 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 319 sub handler {
|
Line 337 sub handler {
|
$jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored); |
$jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored); |
if ($state eq 'courseinfo') { |
if ($state eq 'courseinfo') { |
$jscript .= &cloning_javascript(); |
$jscript .= &cloning_javascript(); |
} elsif ($state eq 'process') { |
|
$jscript .= &processing_javascript(); |
|
} |
} |
} |
} |
} |
} |
Line 755 function check_can_request(crschoice,act
|
Line 771 function check_can_request(crschoice,act
|
var unofficial = ''; |
var unofficial = ''; |
var community = ''; |
var community = ''; |
var textbook = ''; |
var textbook = ''; |
|
var placement = ''; |
END |
END |
if (ref($can_request) eq 'HASH') { |
if (ref($can_request) eq 'HASH') { |
foreach my $item (keys(%{$can_request})) { |
foreach my $item (keys(%{$can_request})) { |
Line 768 END
|
Line 785 END
|
unofficial => 'You are not permitted to request creation of an unofficial course in this domain.', |
unofficial => 'You are not permitted to request creation of an unofficial course in this domain.', |
community => 'You are not permitted to request creation of a community in this domain.', |
community => 'You are not permitted to request creation of a community in this domain.', |
textbook => 'You are not permitted to request creation of a textbook course in this domain', |
textbook => 'You are not permitted to request creation of a textbook course in this domain', |
|
placement => 'You are not permitted to request creation of a placement test in this domain', |
all => 'You must choose a specific course type when making a new course request.', |
all => 'You must choose a specific course type when making a new course request.', |
allt => '"All types" is not allowed.', |
allt => '"All types" is not allowed.', |
); |
); |
Line 797 END
|
Line 815 END
|
return false; |
return false; |
} |
} |
} else { |
} else { |
if (actionchoice == 'new') { |
if (crschoice == 'placement') { |
alert('$js_lt{'all'}'+'\\n'+'$js_lt{'allt'}'); |
if (placement != 1) { |
return false; |
alert("$js_lt{'placement'}"); |
|
return false; |
|
} |
|
} else { |
|
if (actionchoice == 'new') { |
|
alert('$js_lt{'all'}'+'\\n'+'$js_lt{'allt'}'); |
|
return false; |
|
} |
} |
} |
} |
} |
} |
} |
Line 810 END
|
Line 835 END
|
END |
END |
my ($pagetitle,$pageinfo,$domaintitle,$earlyout); |
my ($pagetitle,$pageinfo,$domaintitle,$earlyout); |
if (ref($can_request) eq 'HASH') { |
if (ref($can_request) eq 'HASH') { |
if (($can_request->{'official'}) || ($can_request->{'unofficial'}) || $can_request->{'textbook'}) { |
if (($can_request->{'official'}) || ($can_request->{'unofficial'}) || ($can_request->{'textbook'}) || ($can_request->{'placement'})) { |
if ($can_request->{'community'}) { |
if ($can_request->{'community'}) { |
$pagetitle = 'Course/Community Requests'; |
$pagetitle = 'Course/Community Requests'; |
$pageinfo = &mt('Request creation of a new course or community, or review your pending requests.'); |
$pageinfo = &mt('Request creation of a new course or community, or review your pending requests.'); |
Line 987 END
|
Line 1012 END
|
$title = &mt('Pending requests for unofficial courses'); |
$title = &mt('Pending requests for unofficial courses'); |
} elsif ($env{'form.crstype'} eq 'textbook') { |
} elsif ($env{'form.crstype'} eq 'textbook') { |
$title = &mt('Pending requests for textbook courses'); |
$title = &mt('Pending requests for textbook courses'); |
|
} elsif ($env{'form.crstype'} eq 'textbook') { |
|
$title = &mt('Pending requests for placement tests'); |
} else { |
} else { |
$title = &mt('Pending course/community requests'); |
$title = &mt('Pending course/community requests'); |
} |
} |
Line 2088 sub print_personnel_menu {
|
Line 2115 sub print_personnel_menu {
|
official => 'Requestor is automatically assigned Course Coordinator role.', |
official => 'Requestor is automatically assigned Course Coordinator role.', |
); |
); |
$lt{'unofficial'} = $lt{'official'}; |
$lt{'unofficial'} = $lt{'official'}; |
$lt{'textbook'} = $lt{'textbook'}; |
$lt{'textbook'} = $lt{'official'}; |
|
$lt{'placement'} = $lt{'official'}; |
$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>'; |
} |
} |
Line 2104 sub print_personnel_menu {
|
Line 2132 sub print_personnel_menu {
|
} |
} |
} |
} |
} |
} |
for (my $i=0; $i<$persontotal; $i++) { |
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 2516 sub print_request_logs {
|
Line 2545 sub print_request_logs {
|
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 ($curr{'crstype'} eq 'any') { |
if ($curr{'crstype'} eq 'any') { |
my @types = qw(official unofficial community textbook); |
my @types = qw(official unofficial community textbook placement); |
foreach my $type (@types) { |
foreach my $type (@types) { |
if ($domconfig{'requestcourses'}{'uniquecode'}{$type}) { |
if ($domconfig{'requestcourses'}{'uniquecode'}{$type}) { |
$showuniquecode = 1; |
$showuniquecode = 1; |
Line 2684 sub reqstatus_names {
|
Line 2713 sub reqstatus_names {
|
rejected => 'Request rejected', |
rejected => 'Request rejected', |
cancelled => 'Request cancelled', |
cancelled => 'Request cancelled', |
); |
); |
if (($crstype eq 'official') || ($crstype eq 'unofficial') || ($crstype eq 'textbook')) { |
if (($crstype eq 'official') || ($crstype eq 'unofficial') || ($crstype eq 'textbook') || ($crstype eq 'placement')) { |
$statusnames{'created'} = &mt('Course created'); |
$statusnames{'created'} = &mt('Course created'); |
} elsif ($crstype eq 'community') { |
} elsif ($crstype eq 'community') { |
$statusnames{'created'} = &mt('Community created'); |
$statusnames{'created'} = &mt('Community created'); |
Line 2697 sub requestlog_display_filter {
|
Line 2726 sub requestlog_display_filter {
|
my $nolink = 1; |
my $nolink = 1; |
my $output = '<table><tr><td valign="top">'. |
my $output = '<table><tr><td valign="top">'. |
'<span class="LC_nobreak"><b>'.&mt('Records/page:').'</b></span><br />'. |
'<span class="LC_nobreak"><b>'.&mt('Records/page:').'</b></span><br />'. |
&Apache::lonmeta::selectbox('show',$curr->{'show'},undef, |
&Apache::lonmeta::selectbox('show',$curr->{'show'},'',undef, |
(&mt('all'),5,10,20,50,100,1000,10000)). |
(&mt('all'),5,10,20,50,100,1000,10000)). |
'</td><td> </td>'; |
'</td><td> </td>'; |
my $startform = |
my $startform = |
Line 3097 sub courseinfo_form {
|
Line 3126 sub courseinfo_form {
|
&js_escape(\%js_lt); |
&js_escape(\%js_lt); |
$js_lt{'unofficial'} = $js_lt{'official'}; |
$js_lt{'unofficial'} = $js_lt{'official'}; |
$js_lt{'textbook'} = $js_lt{'official'}; |
$js_lt{'textbook'} = $js_lt{'official'}; |
|
$js_lt{'placement'} = $js_lt{'official'}; |
my $js_validate = <<"ENDJS"; |
my $js_validate = <<"ENDJS"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[' |
// <![CDATA[' |
Line 3176 sub clone_form {
|
Line 3206 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($crstype); |
my %lt = &clone_text($crstype); |
my $output .= |
my $output .= |
Line 3359 sub get_course_dom {
|
Line 3391 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 3652 sub print_request_outcome {
|
Line 3689 sub print_request_outcome {
|
} |
} |
} |
} |
} |
} |
|
if ($env{'form.chome'} eq 'default') { |
|
my %servers = &Apache::lonnet::get_servers($dom,'library'); |
|
my $numlib = keys(%servers); |
|
if ($numlib) { |
|
my $loadm=10000000; |
|
my $chome; |
|
foreach my $tryserver (keys(%servers)) { |
|
($chome,$loadm) = |
|
&Apache::lonnet::compare_server_load($tryserver,$chome,$loadm); |
|
} |
|
$env{'form.chome'} = $chome; |
|
} |
|
} |
my $details = { |
my $details = { |
owner => $env{'user.name'}, |
owner => $env{'user.name'}, |
domain => $env{'user.domain'}, |
domain => $env{'user.domain'}, |
Line 3684 sub print_request_outcome {
|
Line 3734 sub print_request_outcome {
|
$instcode,$req_notifylist,\@instsections,\%domconfig); |
$instcode,$req_notifylist,\@instsections,\%domconfig); |
return ($result,$output,$customized); |
return ($result,$output,$customized); |
} |
} |
|
|
sub process_request { |
sub process_request { |
my ($r,$lonhost,$dom,$cnum,$crstype,$now,$details,$instcode,$req_notifylist,$instsections, |
my ($r,$lonhost,$dom,$cnum,$crstype,$now,$details,$instcode,$req_notifylist,$instsections, |
$domconfig) = @_; |
$domconfig) = @_; |
Line 3702 sub process_request {
|
Line 3752 sub process_request {
|
$output = &mt('You are not permitted to request creation of communities'); |
$output = &mt('You are not permitted to request creation of communities'); |
} elsif ($crstype eq 'textbook') { |
} elsif ($crstype eq 'textbook') { |
$output = &mt('You are not permitted to request creation of textbook courses'); |
$output = &mt('You are not permitted to request creation of textbook courses'); |
|
} elsif ($crstype eq 'placement') { |
|
$output = &mt('You are not permitted to request creation of placement tests'); |
} else { |
} else { |
$output = &mt('Unrecognized course type: [_1]',$crstype); |
$output = &mt('Unrecognized course type: [_1]',$crstype); |
} |
} |
Line 3867 ENDCLOSE
|
Line 3919 ENDCLOSE
|
if (($code) || ((ref($postprocess) eq 'HASH') && |
if (($code) || ((ref($postprocess) eq 'HASH') && |
(($postprocess->{'createdweb'}) || ($postprocess->{'createdmsg'})))) { |
(($postprocess->{'createdweb'}) || ($postprocess->{'createdmsg'})))) { |
$output .= ¬ification_information($disposition,$env{'user.name'}.':'.$env{'user.domain'}, |
$output .= ¬ification_information($disposition,$env{'user.name'}.':'.$env{'user.domain'}, |
$dom,$cnum,$now,$code,$postprocess); |
$dom,$cnum,$now,$code,$postprocess,$crstype); |
} |
} |
if ($code) { |
if ($code) { |
$reqhash{'code'} = $code; |
$reqhash{'code'} = $code; |
Line 3980 ENDCLOSE
|
Line 4032 ENDCLOSE
|
unless ($disposition eq 'pending') { |
unless ($disposition eq 'pending') { |
$output .= '<br />'. |
$output .= '<br />'. |
¬ification_information($disposition,$req_notifylist, |
¬ification_information($disposition,$req_notifylist, |
$dom,$cnum,$now); |
$dom,$cnum,$now,'','',$crstype); |
} |
} |
} else { |
} else { |
$reqstatus = 'domainerror'; |
$reqstatus = 'domainerror'; |
Line 4013 ENDCLOSE
|
Line 4065 ENDCLOSE
|
$output .= '<p>'.&mt('Your course request has been updated').'</p>'; |
$output .= '<p>'.&mt('Your course request has been updated').'</p>'; |
} |
} |
if ($disposition eq 'approval') { |
if ($disposition eq 'approval') { |
$output .= ¬ification_information($disposition,$req_notifylist,$dom,$cnum,$now); |
$output .= ¬ification_information($disposition,$req_notifylist,$dom,$cnum,$now,'','',$crstype); |
} |
} |
} |
} |
if ($disposition eq 'approval') { |
if ($disposition eq 'approval') { |
if ((ref($postprocess) eq 'HASH') && |
if ((ref($postprocess) eq 'HASH') && |
((ref($postprocess->{'queuedmsg'}) eq 'HASH') || ($postprocess->{'queuedweb'}))) { |
((ref($postprocess->{'queuedmsg'}) eq 'HASH') || ($postprocess->{'queuedweb'}))) { |
¬ification_information($disposition,undef,$dom,$cnum,$now,undef,$postprocess); |
¬ification_information($disposition,undef,$dom,$cnum,$now,undef,$postprocess,$crstype); |
$customized = $postprocess->{'createdcustomized'}; |
$customized = $postprocess->{'createdcustomized'}; |
} |
} |
} elsif ($disposition eq 'pending') { |
} elsif ($disposition eq 'pending') { |
Line 4031 ENDCLOSE
|
Line 4083 ENDCLOSE
|
if ($pendingform) { |
if ($pendingform) { |
$output .= $pendingform; |
$output .= $pendingform; |
} else { |
} else { |
$output .= ¬ification_information($disposition,undef,$dom,$cnum,$now,undef,$postprocess); |
$output .= ¬ification_information($disposition,undef,$dom,$cnum,$now,undef,$postprocess,$crstype); |
} |
} |
if (ref($postprocess) eq 'HASH') { |
if (ref($postprocess) eq 'HASH') { |
$customized = $postprocess->{'createdcustomized'}; |
$customized = $postprocess->{'createdcustomized'}; |
Line 4229 sub update_requestors_roles {
|
Line 4281 sub update_requestors_roles {
|
} |
} |
|
|
sub notification_information { |
sub notification_information { |
my ($disposition,$req_notifylist,$dom,$cnum,$now,$code,$postprocess) = @_; |
my ($disposition,$req_notifylist,$dom,$cnum,$now,$code,$postprocess,$crstype) = @_; |
my %emails = &Apache::loncommon::getemails(); |
my %emails = &Apache::loncommon::getemails(); |
my $address; |
my $address; |
if (($emails{'permanentemail'} ne '') || ($emails{'notification'} ne '')) { |
if (($emails{'permanentemail'} ne '') || ($emails{'notification'} ne '')) { |
Line 4245 sub notification_information {
|
Line 4297 sub notification_information {
|
if ($address ne '') { |
if ($address ne '') { |
$output.= &mt('An e-mail will also be sent to: [_1] when this occurs.',$address).'<br />'; |
$output.= &mt('An e-mail will also be sent to: [_1] when this occurs.',$address).'<br />'; |
} |
} |
|
my %possemails; |
|
my $fullname = &Apache::loncommon::plainname($env{'user.name'}, |
|
$env{'user.domain'}); |
|
my $emailto = &Apache::loncommon::build_recipient_list(undef,'requestsmail',$dom); |
|
if ($emailto) { |
|
map { $possemails{$_} = 1; } (split(/,/,$emailto)); |
|
} |
if ($req_notifylist) { |
if ($req_notifylist) { |
my $fullname = &Apache::loncommon::plainname($env{'user.name'}, |
if ($emailto) { |
$env{'user.domain'}); |
foreach my $recip (split(/,/,$req_notifylist)) { |
|
my ($uname,$udom) = split(/:/,$recip); |
|
my %emails = &Apache::loncommon::getemails($uname,$udom); |
|
foreach my $type ('permanentemail','notification') { |
|
if ((exists($emails{$type})) && ($emails{$type} ne '')) { |
|
my @to = split(/,/,$emails{$type}); |
|
foreach my $addr (@to) { |
|
if (($addr ne '') && ($addr =~ m/\@/)) { |
|
if (exists($possemails{$addr})) { |
|
delete($possemails{$addr}); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
my $sender = $env{'user.name'}.':'.$env{'user.domain'}; |
my $sender = $env{'user.name'}.':'.$env{'user.domain'}; |
&Apache::loncoursequeueadmin::send_selfserve_notification($req_notifylist,"$fullname ($env{'user.name'}:$env{'user.domain'})", |
&Apache::loncoursequeueadmin::send_selfserve_notification($req_notifylist,"$fullname ($env{'user.name'}:$env{'user.domain'})", |
'undef',$env{'form.cdescr'},$now,'coursereq',$sender); |
undef,$env{'form.cdescr'},$now,'coursereq',$sender,'','',$crstype); |
|
} |
|
# |
|
# If domain configuration for "E-mail addresses and helpform" has values set |
|
# for "E-mail from course requests requiring approval", send email to those |
|
# addresse(es) when a course request is queued, pending approval, unless |
|
# the email address will already receive a notification email, because of |
|
# values set for "Receive notification of course requests requiring approval" |
|
# in "Request creation of courses" configuration item. |
|
# |
|
if ($emailto && keys(%possemails)) { |
|
¬ify_admin($dom,$crstype,$env{'form.cdescr'},"$fullname ($env{'user.name'}:$env{'user.domain'})",$now,\%possemails); |
} |
} |
if (ref($postprocess) eq 'HASH') { |
if (ref($postprocess) eq 'HASH') { |
if (ref($postprocess->{'queuedmsg'}) eq 'ARRAY') { |
if (ref($postprocess->{'queuedmsg'}) eq 'ARRAY') { |
Line 4331 sub notification_information {
|
Line 4417 sub notification_information {
|
$type = 'uniquecode'; |
$type = 'uniquecode'; |
} |
} |
&Apache::loncoursequeueadmin::send_selfserve_notification($recipient,$addmsg,$dom.'_'.$cnum,$env{'form.cdescr'}, |
&Apache::loncoursequeueadmin::send_selfserve_notification($recipient,$addmsg,$dom.'_'.$cnum,$env{'form.cdescr'}, |
$now,$type,$sender); |
$now,$type,$sender,'','',$crstype); |
} |
} |
} |
} |
} else { |
} else { |
Line 4342 sub notification_information {
|
Line 4428 sub notification_information {
|
return $output; |
return $output; |
} |
} |
|
|
|
sub notify_admin { |
|
my ($dom,$crstype,$contextdesc,$textstr,$timestamp,$emailsref) = @_; |
|
if ((ref($emailsref) eq 'HASH') && (keys(%{$emailsref}))) { |
|
my $emailto = join(',',sort(keys(%{$emailsref}))); |
|
my (@rawmsg,$rawsubj,$msgtxt); |
|
if ($crstype eq 'community') { |
|
$rawsubj = 'Community request to review'; |
|
$msgtxt = 'Creation of the following community: [_1]was requested by [_2] on [_3].'; |
|
} else { |
|
$rawsubj = 'Course request to review'; |
|
$msgtxt = 'Creation of the following course: [_1]was requested by [_2] on [_3].'; |
|
} |
|
$timestamp =&Apache::lonlocal::locallocaltime($timestamp); |
|
push(@rawmsg,{ |
|
mt => $msgtxt, |
|
args => ["\n $contextdesc\n",$textstr,$timestamp], |
|
}, |
|
{ |
|
mt =>'[_1]A Domain Coordinator will use: [_2]Main Menu -> Course and community creation -> Approve or reject requests[_3]to display a list of pending requests, which can either be approved or rejected.', |
|
args => ["\n","\n\n","\n\n"], |
|
}); |
|
|
|
my $sender_lh = &Apache::loncommon::user_lang($env{'user.name'},$env{'user.domain'}); |
|
my $subject = &mt_user($sender_lh,$rawsubj); |
|
my $message = ''; |
|
foreach my $item (@rawmsg) { |
|
if (ref($item) eq 'HASH') { |
|
if (ref($item->{args}) eq 'ARRAY') { |
|
$message .= &mt_user($sender_lh,$item->{mt},@{$item->{args}})."\n"; |
|
} else { |
|
$message .= &mt_user($sender_lh,$item->{mt})."\n"; |
|
} |
|
} |
|
} |
|
my $chgmail = "To: $emailto\n". |
|
"Subject: $subject\n". |
|
"Content-type: text/plain\; charset=UTF-8\n". |
|
"MIME-Version: 1.0\n\n". |
|
"$message\n\n"; |
|
if (open(my $mailh, "|/usr/lib/sendmail -oi -t -odb")) { |
|
print $mailh $chgmail; |
|
close($mailh); |
|
} |
|
} |
|
} |
|
|
sub pending_validation_form { |
sub pending_validation_form { |
my ($r,$cdom,$cnum,$crstype,$now,$token,$lonhost,$cdesc) = @_; |
my ($r,$cdom,$cnum,$crstype,$now,$token,$lonhost,$cdesc) = @_; |
my $output; |
my $output; |
Line 4406 sub check_autolimit {
|
Line 4538 sub check_autolimit {
|
if (($crstype eq 'community') && |
if (($crstype eq 'community') && |
(exists($crsroles{$cnum.':'.$cdom.':co'}))) { |
(exists($crsroles{$cnum.':'.$cdom.':co'}))) { |
$count ++; |
$count ++; |
} elsif ((($crstype eq 'official') || ($crstype eq 'unofficial') || ($crstype eq 'textbook')) && |
} elsif ((($crstype eq 'official') || ($crstype eq 'unofficial') || ($crstype eq 'textbook') || ($crstype eq 'placement')) && |
(exists($crsroles{$cnum.':'.$cdom.':cc'}))) { |
(exists($crsroles{$cnum.':'.$cdom.':cc'}))) { |
$count ++; |
$count ++; |
} |
} |
Line 4609 sub generate_date_items {
|
Line 4741 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 4671 sub print_textbook_form {
|
Line 4805 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 4728 sub print_textbook_form {
|
Line 4862 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 4948 sub print_textbook_form {
|
Line 5088 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 5043 sub clone_selection_table {
|
Line 5192 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 5086 sub process_textbook_request {
|
Line 5237 sub process_textbook_request {
|
undef($clonedom); |
undef($clonedom); |
} |
} |
} |
} |
$r->print(&header('Course Creation')); |
my $args; |
|
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','','',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 5155 sub process_textbook_request {
|
Line 5312 sub process_textbook_request {
|
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 $storecrs; |
|
if ($env{'request.lti.login'}) { |
|
my %lti = &Apache::lonnet::get_domain_lti($dom,'provider'); |
|
if (ref($lti{$env{'request.lti.login'}}) eq 'HASH') { |
|
$storecrs = $lti{$env{'request.lti.login'}}{'storecrs'}; |
|
} |
|
if ($storecrs) { |
|
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'} => $env{'request.lti.login'}.':'.$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 5164 sub process_textbook_request {
|
Line 5335 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()); |
} |
} |
|
|