--- loncom/interface/lonrequestcourse.pm 2023/01/23 05:30:44 1.95.2.7.2.2
+++ loncom/interface/lonrequestcourse.pm 2020/07/01 20:08:54 1.109
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Request a course
#
-# $Id: lonrequestcourse.pm,v 1.95.2.7.2.2 2023/01/23 05:30:44 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.109 2020/07/01 20:08:54 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -163,6 +163,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);
@@ -200,7 +217,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);
}
@@ -432,6 +450,17 @@ function setCloneDisplay(courseForm) {
END
}
+sub processing_javascript {
+ return <<"END";
+function hideProcessing() {
+ if (document.getElementById('processing')) {
+ document.getElementById('processing').style.display="none";
+ }
+}
+
+END
+}
+
sub get_breadcrumbs {
my ($dom,$action,$state,$states,$trail) = @_;
my ($crumb,$newinstcode,$codechk,$checkedcode,$numtitles,$description);
@@ -710,6 +739,9 @@ sub onload_action {
if ($state eq 'courseinfo') {
$loaditems{'onload'} .= 'javascript:setCloneDisplay(document.requestcrs);';
}
+ if ($state eq 'process') {
+ $loaditems{'onload'} .= 'javascript:hideProcessing();';
+ }
}
return \%loaditems;
}
@@ -755,6 +787,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,6 +801,7 @@ END
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.',
);
@@ -797,9 +831,16 @@ END
return false;
}
} else {
- if (actionchoice == 'new') {
- alert('$js_lt{'all'}'+'\\n'+'$js_lt{'allt'}');
- return false;
+ if (crschoice == 'placement') {
+ if (placement != 1) {
+ alert("$js_lt{'placement'}");
+ return false;
+ }
+ } else {
+ if (actionchoice == 'new') {
+ alert('$js_lt{'all'}'+'\\n'+'$js_lt{'allt'}');
+ return false;
+ }
}
}
}
@@ -810,7 +851,7 @@ END
END
my ($pagetitle,$pageinfo,$domaintitle,$earlyout);
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'}) {
$pagetitle = 'Course/Community Requests';
$pageinfo = &mt('Request creation of a new course or community, or review your pending requests.');
@@ -987,6 +1028,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');
}
@@ -2088,7 +2131,8 @@ sub print_personnel_menu {
official => 'Requestor is automatically assigned Course Coordinator role.',
);
$lt{'unofficial'} = $lt{'official'};
- $lt{'textbook'} = $lt{'textbook'};
+ $lt{'textbook'} = $lt{'official'};
+ $lt{'placement'} = $lt{'official'};
$output .= &Apache::lonhtmlcommon::row_headline().
'
'.&Apache::loncommon::help_open_topic('Course_Request_Personnel').' '.$lt{$crstype}.' '.&mt('Include other personnel?').'
';
}
@@ -2104,14 +2148,15 @@ 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 $linkargstr = join("','",@linkargs);
my $uname_form = '';
my $onchange = 'javascript:fix_domain('."'$formname','person_".$i."_dom',".
"'person_".$i."_hidedom','person_".$i."_uname'".');';
my $udom_form = &Apache::loncommon::select_dom_form($dom,'person_'.$i.'_dom','',
- 1,$onchange).
+ 1,$onchange,undef,$trusted,$untrusted).
'';
my %form_elems;
foreach my $item (@items) {
@@ -2382,7 +2427,7 @@ sub print_cancel_request {
&Apache::loncommon::start_data_table_row().
'