version 1.102, 2017/08/11 15:26:38
|
version 1.103, 2018/03/23 01:01:21
|
Line 155 sub handler {
|
Line 155 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 209 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 4541 sub generate_date_items {
|
Line 4559 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 4660 sub print_textbook_form {
|
Line 4680 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 4864 sub print_textbook_form {
|
Line 4890 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 4959 sub clone_selection_table {
|
Line 4994 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 5003 sub process_textbook_request {
|
Line 5040 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 5068 sub process_textbook_request {
|
Line 5111 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 %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 5077 sub process_textbook_request {
|
Line 5125 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()); |
} |
} |
|
|