--- loncom/interface/lonpickcourse.pm 2015/05/21 23:40:09 1.116
+++ loncom/interface/lonpickcourse.pm 2016/10/05 13:59:46 1.119
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Pick a course
#
-# $Id: lonpickcourse.pm,v 1.116 2015/05/21 23:40:09 raeburn Exp $
+# $Id: lonpickcourse.pm,v 1.119 2016/10/05 13:59:46 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -55,7 +55,7 @@ sub handler {
my ($type,$title,$jscript,$multelement,$multiple,$roleelement,$typeelement,
$lastaction,$autosubmit,$submitopener,$cloneruname,$clonerudom,$crscode,$crsdom);
- # Get course type - Course or Community.
+ # Get course type - Course, Community or Placement.
$type = $env{'form.type'};
if (!defined($env{'form.type'})) {
$type = 'Course';
@@ -404,25 +404,70 @@ sub display_matched_courses {
.'
'
.''.&mt('Pick action').' '
.''
- .' '
+ .' '
.' ');
- if ($type eq 'Community') {
- $r->print(&mt('Enter the community with the role of [_1].',$cctitle));
- } else {
- $r->print(&mt('Enter the course with the role of [_1].',$cctitle));
+ if (&Apache::lonnet::allowed('ccc',$crsdom)) {
+ if ($type eq 'Community') {
+ $r->print(&mt('Enter the community with the role of [_1].',$cctitle));
+ } elsif ($type eq 'Placement') {
+ $r->print(&mt('Enter the placement test with the role of [_1].',$cctitle));
+ } else {
+ $r->print(&mt('Enter the course with the role of [_1].',$cctitle));
+ }
+ } elsif (&Apache::lonnet::allowed('rar',$crsdom)) {
+ my %adhocroles = &Apache::lonnet::userenvironment($env{'user.domain'},$env{'user.name'},
+ 'adhocroles.'.$crsdom);
+ if (keys(%adhocroles)) {
+ my @adhoc = split(/,/,$adhocroles{'adhocroles.'.$crsdom});
+ if (@adhoc > 1) {
+ my %adhochash;
+ map { $adhochash{$_} = $_; } @adhoc;
+ my $selector = &Apache::loncommon::select_form($adhoc[0],'adhocrole',\%adhochash);
+ if ($type eq 'Community') {
+ $r->print(&mt('Enter the community with one of the available ad hoc roles: [_1].',
+ $selector));
+ } elsif ($type eq 'Placement') {
+ $r->print(&mt('Enter the placement test with one of the available ad hoc roles: [_1].',
+ $selector));
+ } else {
+ $r->print(&mt('Enter the course with one of the available ad hoc roles: [_1].',
+ $selector));
+ }
+ } else {
+ if ($type eq 'Community') {
+ $r->print(&mt('Enter the community with the ad hoc role of: [_1]',$adhoc[0]));
+ } elsif ($type eq 'Placement') {
+ $r->print(&mt('Enter the placement test with the ad hoc role of: [_1]',$adhoc[0]));
+ } else {
+ $r->print(&mt('Enter the course with the ad hoc role of: [_1]',$adhoc[0]));
+ }
+ }
+ }
}
$r->print(' '
.''
.' ');
- if ($type eq 'Community') {
- $r->print(&mt('View or modify community settings which only a [_1] may modify.',$dctitle));
- } else {
- $r->print(&mt('View or modify course settings which only a [_1] may modify.',$dctitle));
+ if (&Apache::lonnet::allowed('ccc',$crsdom)) {
+ if ($type eq 'Community') {
+ $r->print(&mt('View or modify community settings which only a [_1] may modify.',$dctitle));
+ } elsif ($type eq 'Placement') {
+ $r->print(&mt('View or modify placement test settings which only a [_1] may modify.',$dctitle));
+ } else {
+ $r->print(&mt('View or modify course settings which only a [_1] may modify.',$dctitle));
+ }
+ } elsif (&Apache::lonnet::allowed('rar',$crsdom)) {
+ if ($type eq 'Community') {
+ $r->print(&mt('View community settings which only a [_1] may modify.',$dctitle));
+ } elsif ($type eq 'Placement') {
+ $r->print(&mt('View placement test settings which only a [_1] may modify.',$dctitle));
+ } else {
+ $r->print(&mt('View course settings which only a [_1] may modify.',$dctitle));
+ }
}
$r->print(' '
- .' '
- .' '
- );
+ .''
+ .' '
+ );
}
}
my %by_descrip;
@@ -457,7 +502,7 @@ sub display_matched_courses {
$r->print(''.&mt('Select').' '
.''.$titlehdr.' '
.''.&mt('Domain').' ');
- unless ($type eq 'Community') {
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
$r->print(''.&mt('Course Code').' ');
}
$r->print(''.&mt('Owner/Co-owner(s)').' ');
@@ -608,7 +653,7 @@ sub display_matched_courses {
$r->print(&Apache::lonnet::domain($cdom,'description')?
$cdom.' ('.&Apache::lonnet::domain($cdom,'description').')':$cdom);
$r->print('');
- unless ($type eq 'Community') {
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
$r->print('');
if ($instcode ne '') {
$r->print(&unescape($instcode));
@@ -706,7 +751,7 @@ sub get_coordinator_cloneable {
my ($cc_clone,$ccrole);
if ($type eq 'Community') {
$ccrole = 'co';
- } elsif ($type eq 'Course') {
+ } else {
$ccrole = 'cc';
}
my %ccroles = &Apache::lonnet::get_my_roles($cloneruname,$clonerudom,
@@ -751,6 +796,11 @@ sub gochoose_javascript {
total => 'coursetotal',
list => 'courselist',
},
+ 'Placement' => {
+ name => 'coursepick',
+ total => 'coursetotal',
+ list => 'courselist',
+ },
);
my $output = qq|
function gochoose(cname,cdom,cdesc) {
@@ -872,7 +922,7 @@ Course Activity - how recently was cours
Course Domain - the domain of the course
=item *
-Type - Course or Community
+Type - Course, Community or Placement
=item *
Course Institutional Code - the institutional identifier assigned to the course
@@ -925,7 +975,7 @@ Following selection, and/or submission,
X
B:
-Input: 1 - $type - the course type - Course or Community
+Input: 1 - $type - the course type - Course, Community, or Placement
Output: 1 - $output - javascript wrapped in EscriptEE/scriptE tags