--- loncom/interface/lonrequestcourse.pm 2014/06/16 01:42:22 1.85
+++ loncom/interface/lonrequestcourse.pm 2018/12/27 18:14:25 1.105
@@ -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.105 2018/12/27 18:14:25 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -155,6 +155,23 @@ sub handler {
}
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}).
+ '
'.
+ '
'.&mt('You do not have privileges to request creation of LTI courses.').'
'.
+ '
'.
+ &Apache::loncommon::end_page());
+ }
+ }
+ return OK;
+ }
if (($env{'form.crstype'} eq 'textbook') ||
(scalar(keys(%can_request)) == 1) && ($can_request{'textbook'})) {
my %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$dom);
@@ -192,7 +209,8 @@ sub handler {
}
} else {
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 {
&textbook_request_disabled($r,$dom,$action,\%can_request);
}
@@ -760,6 +778,7 @@ function check_can_request(crschoice,act
var unofficial = '';
var community = '';
var textbook = '';
+ var placement = '';
END
if (ref($can_request) eq 'HASH') {
foreach my $item (keys(%{$can_request})) {
@@ -768,42 +787,51 @@ END
";
}
}
- my %lt = &Apache::lonlocal::texthash(
+ my %js_lt = &Apache::lonlocal::texthash(
official => 'You are not permitted to request creation of an official 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.',
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.',
allt => '"All types" is not allowed.',
);
+ &js_escape(\%js_lt);
$js .= <{'official'}) || ($can_request->{'unofficial'}) || $can_request->{'textbook'}) {
+ if (($can_request->{'official'}) || ($can_request->{'unofficial'}) || ($can_request->{'textbook'}) || ($can_request->{'placement'})) {
if ($can_request->{'community'}) {
$pagetitle = 'Course/Community Requests';
$pageinfo = &mt('Request creation of a new course or community, or review your pending requests.');
@@ -939,7 +967,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))) {
@@ -990,6 +1019,8 @@ END
$title = &mt('Pending requests for unofficial courses');
} elsif ($env{'form.crstype'} eq 'textbook') {
$title = &mt('Pending requests for textbook courses');
+ } elsif ($env{'form.crstype'} eq 'textbook') {
+ $title = &mt('Pending requests for placement tests');
} else {
$title = &mt('Pending course/community requests');
}
@@ -1174,6 +1205,8 @@ sub enrollment_lcsec_js {
my %alerts = §ion_check_alerts();
my $secname = $alerts{'badsec'};
my $secnone = $alerts{'reserved'};
+ &js_escape(\$secname);
+ &js_escape(\$secnone);
my $output = '
function validateEnrollSections(formname,nextstate) {
var badsectotal = 0;
@@ -1231,8 +1264,10 @@ function validateEnrollSections(formname
sub personnel_lcsec_js {
my %alerts = §ion_check_alerts();
- my $secname = $alerts{'badsec'}.'\\n'.$alerts{'separate'};
+ my $secname = $alerts{'badsec'}."\n".$alerts{'separate'};
my $secnone = $alerts{'reserved'};
+ &js_escape(\$secname);
+ &js_escape(\$secnone);
my $output = '
function validatePersonnelSections(formname,nextstate) {
var badsectotal = 0;
@@ -1568,8 +1603,8 @@ sub print_request_form {
\%cat_order,\@code_order);
}
my $lonhost = $r->dir_config('lonHostID');
- my ($storeresult,$result) = &print_request_outcome($r,$lonhost,$dom,\@codetitles,
- \@code_order,$instcredits);
+ my ($storeresult,$result,$customized) = &print_request_outcome($r,$lonhost,$dom,\@codetitles,
+ \@code_order,$instcredits);
$r->print($result);
if (($storeresult eq 'ok') || ($storeresult eq 'created')) {
if ($storeresult eq 'ok') {
@@ -1578,10 +1613,14 @@ sub print_request_form {
''.&mt('Make another request').'');
}
if (&Apache::loncoursequeueadmin::author_prompt()) {
- &print_author_prompt($r,$env{'form.action'},$env{'form.cnum'},$env{'form.showdom'},
- $env{'form.crstype'},$storeresult);
+ unless ($customized) {
+ &print_author_prompt($r,$env{'form.action'},$env{'form.cnum'},$env{'form.showdom'},
+ $env{'form.crstype'},$storeresult);
+ }
} elsif ($storeresult eq 'created') {
- $r->print('