'.&mt('Search for a placement test in the [_1] domain',$domdesc).'
');
} else {
$r->print('
'.&mt('Search for a course in the [_1] domain',$domdesc).'
');
}
@@ -185,6 +194,8 @@ sub print_course_search_page {
my ($actiontext,$roleoption,$settingsoption);
if ($type eq 'Community') {
$actiontext = &mt('Actions available after searching for a community:');
+ } elsif ($type eq 'Placement') {
+ $actiontext = &mt('Actions available after searching for a placement test:')
} else {
$actiontext = &mt('Actions available after searching for a course:');
}
@@ -192,6 +203,9 @@ sub print_course_search_page {
if ($type eq 'Community') {
$roleoption = &mt('Enter the community with the role of [_1]',$cctitle);
$settingsoption = &mt('View or modify community settings which only a [_1] may modify.',$dctitle);
+ } elsif ($type eq 'Placement') {
+ $roleoption = &mt('Enter the placement test with the role of [_1]',$cctitle);
+ $settingsoption = &mt('View or modify placement test settings which only a [_1] may modify.',$dctitle);
} else {
$roleoption = &mt('Enter the course with the role of [_1]',$cctitle);
$settingsoption = &mt('View or modify course settings which only a [_1] may modify.',$dctitle);
@@ -202,6 +216,8 @@ sub print_course_search_page {
if (@{$roles_by_num} > 1) {
if ($type eq 'Community') {
$roleoption = &mt('Enter the community with one of the available ad hoc roles');
+ } elsif ($type eq 'Placement') {
+ $roleoption = &mt('Enter the placement test with one of the available ad hoc roles.');
} else {
$roleoption = &mt('Enter the course with one of the available ad hoc roles.');
}
@@ -209,6 +225,8 @@ sub print_course_search_page {
my $rolename = $description->{$roles_by_num->[0]};
if ($type eq 'Community') {
$roleoption = &mt('Enter the community with the ad hoc role of: [_1]',$rolename);
+ } elsif ($type eq 'Placement') {
+ $roleoption = &mt('Enter the placement test with the ad hoc role of: [_1]',$rolename);
} else {
$roleoption = &mt('Enter the course with the ad hoc role of: [_1]',$rolename);
}
@@ -216,6 +234,8 @@ sub print_course_search_page {
}
if ($type eq 'Community') {
$settingsoption = &mt('View community settings which only a [_1] may modify.',$dctitle);
+ } elsif ($type eq 'Placement') {
+ $settingsoption = &mt('View placement test settings which only a [_1] may modify.',$dctitle);
} else {
$settingsoption = &mt('View course settings which only a [_1] may modify.',$dctitle);
}
@@ -413,6 +433,7 @@ sub print_modification_menu {
'setpostsubmit' => 'View/Modify submit button behavior, post-submission',
'setltiauth' => 'View/Modify re-authentication requirement for LTI launch of deep-linked item',
'setexttool' => 'View/Modify External Tools permissions',
+ 'setcrsauthor' => 'View/Modify In-course Authoring permissions',
);
} else {
%linktext = (
@@ -422,6 +443,7 @@ sub print_modification_menu {
'setpostsubmit' => 'View submit button behavior, post-submission',
'setltiauth' => 'View re-authentication requirement for LTI launch of deep-linked item',
'setexttool' => 'View External Tools permissions',
+ 'setcrsauthor' => 'View In-course Authoring permissions',
);
}
if ($type eq 'Community') {
@@ -525,7 +547,7 @@ sub print_modification_menu {
{
linktext => $linktext{'viewparms'},
url => &phaseurl('viewparms'),
- permission => ($permission->{'viewparms'} && ($type ne 'Community')),
+ permission => ($permission->{'viewparms'} && ($type ne 'Community') && ($type ne 'Placement')),
#help => '',
icon => 'roles.png',
linktitle => ''
@@ -562,6 +584,14 @@ sub print_modification_menu {
permission => $permission->{'setexttool'},
linktitle => '',
},
+ {
+ linktext => $linktext{'setcrsauthor'},
+ icon => 'crsauthor.png',
+ #help => '',
+ url => &phaseurl('setcrsauthor'),
+ permission => $permission->{'setcrsauthor'},
+ linktitle => '',
+ },
]
},
);
@@ -933,7 +963,7 @@ sub domain_postsubtimeout {
sub get_lctype {
my ($type,$settings) = @_;
my $lctype = lc($type);
- unless ($type eq 'Community') {
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
$lctype = 'unofficial';
if (ref($settings) eq 'HASH') {
if ($settings->{'internal.coursecode'}) {
@@ -988,6 +1018,8 @@ sub print_catsettings {
'
');
if ($type eq 'Community') {
$r->print(&mt("If a community has been categorized using at least one of the categories defined for communities in the domain, it will be listed in the domain's publicly accessible Course/Community Catalog, unless excluded.").'
');
+ } elsif ($type eq 'Placement') {
+ $r->print(&mt("If a placement test has been categorized using at least one of the categories defined for placement tests in the domain, it will be listed in the domain's publicly accessible Course/Community Catalog, unless excluded.").'');
} else {
$r->print(&mt("Unless excluded, a course will be listed in the domain's publicly accessible Course/Community Catalog, if at least one of the following applies").':
'.
'
'.&mt('Auto-cataloging is enabled and the course is assigned an institutional code.').'
'.
@@ -1020,7 +1052,7 @@ sub print_catsettings {
'
'.&mt('No categories defined for this domain.'));
$shownsave = 1;
}
- if ($type eq 'Community') {
+ if (($type eq 'Community') || ($type eq 'Placement')) {
$r->print('
');
} elsif ($shownsave) {
$r->print(' '.&mt('If auto-cataloging based on institutional code is enabled in the domain, a course will continue to be listed in the catalog of official courses.').'');
@@ -1279,171 +1311,76 @@ sub print_selfenrollconfig {
return;
}
-sub print_set_ltiauth {
- my ($r,$cdom,$cnum,$cdesc,$type,$readonly) = @_;
- my %lt = &Apache::lonlocal::texthash(
- 'requ' => 'Requirement for re-authentication for student LTI-limited launch of deep-linked item',
- 'link' => 'Link protection can be set to accept username for an enrolled student (if sent by Consumer)',
- 'logi' => 'Login needed, regardless of user information sent by LTI Consumer in (signed) parameters',
- 'used' => 'Use domain default',
- 'cour' => 'Use course-specific setting',
- 'curd' => 'Current domain default is',
- 'valu' => 'Value for this course',
- 'modi' => 'Save',
- 'back' => 'Pick another action',
- );
- my ($domdef,$checkeddom,$checkedcrs,$domdefdisplay,$divsty,$authok,$authno);
- $domdef = 0;
+sub print_default_overrides {
+ my ($r,$cdom,$cnum,$cdesc,$type,$readonly,$item) = @_;
+ my (%titles,$checkeddom,$checkedcrs,$divsty,$currcrsval,$crsdefault,%crschecked,
+ $helpfile,$title,$crselements);
+ %titles = &default_overrides_titles($type);
+ my ($title,$domdefdisplay,$settings,$optiontext,$options) =
+ &default_overrides_common($item,$cdom,$cnum,$type,\%titles);
$checkeddom = ' checked="checked"';
- $domdefdisplay = $lt{'logi'};
$divsty = 'display:none';
- $authno = ' checked="checked"';
- my %domconfig =
- &Apache::lonnet::get_dom('configuration',['coursedefaults'],$cdom);
- if (ref($domconfig{'coursedefaults'}) eq 'HASH') {
- $domdef = $domconfig{'coursedefaults'}{'ltiauth'};
- }
- if ($domdef) {
- $domdefdisplay = $lt{'link'};
+ if ($item eq 'ltiauth') {
+ $helpfile = 'Modify_Course_LTI_Authen';
+ $crsdefault = 0;
+ } else {
+ if ($item eq 'exttool') {
+ $helpfile = 'Modify_Course_External_Tool';
+ $crsdefault = 'both';
+ } elsif ($item eq 'crsauthor') {
+ $helpfile = 'Modify_Course_Crsauthor';
+ $crsdefault = 1;
+ }
}
- my %settings = &Apache::lonnet::get('environment',['internal.ltiauth'],$cdom,$cnum);
- my $ltiauth = $settings{'internal.ltiauth'};
-
- if ($ltiauth ne '') {
+ $currcrsval = $settings->{'internal.'.$item};
+ if ($currcrsval ne '') {
$checkedcrs = $checkeddom;
$checkeddom = '';
$divsty = 'display:inline-block';
- if ($ltiauth) {
- $authok = ' checked="checked"';
- }
- }
- &print_header($r,$type);
- my $hidden_elements = &hidden_form_elements();
- my ($disabled,$submit);
- if ($readonly) {
- $disabled = ' disabled="disabled"';
- } else {
- $submit = '';
- }
- my $helpitem = &Apache::loncommon::help_open_topic('Modify_Course_LTI_Authen');
- my $showtype = &mt($type);
- $r->print(<$helpitem $lt{'requ'}
-
$showtype: $cdesc
-
-ENDDOCUMENT
- my @actions =
- (''.
- $lt{'back'}.'');
- $r->print(' '.&Apache::lonhtmlcommon::actionbox(\@actions));
- return;
-}
-
-sub print_set_exttool {
- my ($r,$cdom,$cnum,$cdesc,$type,$readonly) = @_;
- my %titles = &exttool_titles($type);
- my ($domdef,$domdefdom,$checkeddom,$checkedcrs,$domdefdisplay,$divsty);
- $domdef = 0;
- $domdefdom = 1;
- $checkeddom = ' checked="checked"';
- $divsty = 'display:none';
- my %settings = &Apache::lonnet::get('environment',['internal.coursecode',
- 'internal.textbook'],$cdom,$cnum);
- my $lctype = &get_lctype($type,\%settings);
- my %domconfig =
- &Apache::lonnet::get_dom('configuration',['coursedefaults'],$cdom);
- if (ref($domconfig{'coursedefaults'}) eq 'HASH') {
- if (ref($domconfig{'coursedefaults'}{'exttool'}) eq 'HASH') {
- if (exists($domconfig{'coursedefaults'}{'exttool'}{$lctype})) {
- $domdef = $domconfig{'coursedefaults'}{'exttool'}{$lctype};
- }
- }
- if (ref($domconfig{'coursedefaults'}{'domexttool'}) eq 'HASH') {
- if (exists($domconfig{'coursedefaults'}{'domexttool'}{$lctype})) {
- $domdefdom = $domconfig{'coursedefaults'}{'domexttool'}{$lctype};
+ foreach my $option (@{$options}) {
+ if ($currcrsval eq $option) {
+ $crschecked{$option} = ' checked="checked"';
+ } else {
+ $crschecked{$option} = '';
}
}
- }
- if ($domdef && $domdefdom) {
- $domdefdisplay = $titles{'both'};
- } elsif ($domdef) {
- $domdefdisplay = $titles{'crs'};
- } elsif ($domdefdom) {
- $domdefdisplay = $titles{'dom'};
- } else {
- $domdefdisplay = $titles{'none'};
- }
- my %settings = &Apache::lonnet::get('environment',['internal.exttool'],$cdom,$cnum);
- my $crsexttool = $settings{'internal.exttool'};
- my %crschecked = (
- both => ' checked="checked"',
- dom => '',
- crs => '',
- none => '',
- );
- if ($crsexttool ne '') {
- $checkedcrs = $checkeddom;
- $checkeddom = '';
- $divsty = 'display:inline-block';
- foreach my $option ('both','dom','crs','none') {
- if ($crsexttool eq $option) {
+ } else {
+ foreach my $option (@{$options}) {
+ if ($crsdefault eq $option) {
$crschecked{$option} = ' checked="checked"';
} else {
$crschecked{$option} = '';
}
}
}
- &print_header($r,$type);
- my $hidden_elements = &hidden_form_elements();
my ($disabled,$submit);
if ($readonly) {
$disabled = ' disabled="disabled"';
} else {
- $submit = '';
+ $submit = '';
+ }
+ foreach my $option (@{$options}) {
+ $crselements .= ''.
+ ''.
+ ' '."\n";
}
- my $helpitem = &Apache::loncommon::help_open_topic('Modify_Course_External_Tool');
+ &print_header($r,$type);
+ my $hidden_elements = &hidden_form_elements();
+ my $helpitem = &Apache::loncommon::help_open_topic($helpfile);
my $showtype = &mt($type);
$r->print(<$helpitem $titles{'extt'}
+
$helpitem $title
$showtype: $cdesc
-
ENDDOCUMENT
my @actions =
- (''.
+ (''.
$titles{'back'}.'');
$r->print(' '.&Apache::lonhtmlcommon::actionbox(\@actions));
return;
}
-sub exttool_titles {
+sub default_overrides_titles {
my ($type) = @_;
my %titles = &Apache::lonlocal::texthash(
+ 'requ' => 'Requirement for re-authentication for student LTI-limited launch of deep-linked item',
+ 'link' => 'Link protection can be set to accept username for an enrolled student (if sent by Consumer)',
+ 'logi' => 'Login needed, regardless of user information sent by LTI Consumer in (signed) parameters',
'extt' => 'External Tool permissions',
'none' => 'Use of external tools not permitted',
'crs' => 'Only external tools defined in course may be used',
'dom' => 'Only external tools defined in domain may be used',
'both' => 'External tools defined/configured in either domain or course may be used',
+ 'stan' => "'In-course' authoring of standard LON-CAPA problems",
+ 'on' => 'In-course authoring available',
+ 'off' => 'In-course authoring unavailable',
'used' => 'Use domain default',
'cour' => 'Use course-specific setting',
'curd' => 'Current domain default is',
@@ -1481,6 +1424,85 @@ sub exttool_titles {
return %titles;
}
+sub default_overrides_common {
+ my ($item,$cdom,$cnum,$type,$titles) = @_;
+ my ($title,$domdef,$domdefdom,$domdefdisplay,%settings,%optiontext,@options);
+ if ($item eq 'ltiauth') {
+ %settings = &Apache::lonnet::get('environment',['internal.'.$item],$cdom,$cnum);
+ $title = $titles->{'requ'};
+ $domdef = 0;
+ @options = ('0','1');
+ %optiontext = (
+ 0 => $titles->{'logi'},
+ 1 => $titles->{'link'},
+ );
+ } else {
+ %settings =
+ &Apache::lonnet::get('environment',['internal.'.$item,'internal.coursecode',
+ 'internal.textbook'],$cdom,$cnum);
+ if ($item eq 'exttool') {
+ $title = $titles->{'extt'};
+ $domdefdom = 1;
+ $domdef = 0;
+ @options = ('both','dom','crs','none');
+ map { $optiontext{$_} = $titles->{$_}; } @options;
+ } elsif ($item eq 'crsauthor') {
+ $title = $titles->{'stan'};
+ $domdef = 1;
+ @options = ('1','0');
+ %optiontext = (
+ 1 => $titles->{'on'},
+ 0 => $titles->{'off'},
+ );
+ }
+ }
+ my %domconfig =
+ &Apache::lonnet::get_dom('configuration',['coursedefaults'],$cdom);
+ if (ref($domconfig{'coursedefaults'}) eq 'HASH') {
+ if ($item eq 'ltiauth') {
+ $domdef = $domconfig{'coursedefaults'}{$item};
+ } else {
+ my $lctype = &get_lctype($type,\%settings);
+ if (ref($domconfig{'coursedefaults'}{$item}) eq 'HASH') {
+ if (exists($domconfig{'coursedefaults'}{$item}{$lctype})) {
+ $domdef = $domconfig{'coursedefaults'}{$item}{$lctype};
+ }
+ }
+ if ($item eq 'exttool') {
+ if (ref($domconfig{'coursedefaults'}{'domexttool'}) eq 'HASH') {
+ if (exists($domconfig{'coursedefaults'}{'domexttool'}{$lctype})) {
+ $domdefdom = $domconfig{'coursedefaults'}{'domexttool'}{$lctype};
+ }
+ }
+ }
+ }
+ }
+ if ($item eq 'ltiauth') {
+ if ($domdef) {
+ $domdefdisplay = $titles->{'link'};
+ } else {
+ $domdefdisplay = $titles->{'logi'};
+ }
+ } elsif ($item eq 'exttool') {
+ if ($domdef && $domdefdom) {
+ $domdefdisplay = $titles->{'both'};
+ } elsif ($domdef) {
+ $domdefdisplay = $titles->{'crs'};
+ } elsif ($domdefdom) {
+ $domdefdisplay = $titles->{'dom'};
+ } else {
+ $domdefdisplay = $titles->{'none'};
+ }
+ } elsif ($item eq 'crsauthor') {
+ if ($domdef) {
+ $domdefdisplay = $titles->{'on'};
+ } else {
+ $domdefdisplay = $titles->{'off'};
+ }
+ }
+ return ($title,$domdefdisplay,\%settings,\%optiontext,\@options);
+}
+
sub modify_selfenrollconfig {
my ($r,$type,$cdesc,$coursehash) = @_;
return unless(ref($coursehash) eq 'HASH');
@@ -1586,7 +1608,7 @@ sub modify_course {
'internal.pendingco-owners','internal.selfenrollmgrdc',
'internal.selfenrollmgrcc','internal.mysqltables');
my ($selfenrollrows,$selfenrolltitles) = &Apache::lonuserutils::get_selfenroll_titles();
- unless ($type eq 'Community') {
+ unless (($type eq 'Community') || ($type eq 'Placement')) {
push(@items,('internal.coursecode','internal.authtype','internal.autharg',
'internal.sectionnums','internal.crosslistings'));
if (&showcredits($cdom)) {
@@ -1821,7 +1843,7 @@ sub modify_course {
$nochgresponse .= '
'.&mt('[_1] still set to: [_2]',$longtype{$attr},$shown).'
';
}
}
- if (($type ne 'Community') && ($changed{'code'} || $changed{'owner'})) {
+ if (($type ne 'Community') && ($type ne 'Placement') && ($changed{'code'} || $changed{'owner'})) {
if ( $newattr{'courseowner'} eq '') {
push(@warnings,&mt('There is no owner associated with this LON-CAPA course.').
' '.&mt('If automated enrollment at your institution requires validation of course owners, automated enrollment will fail.'));
@@ -2486,182 +2508,70 @@ sub modify_catsettings {
return;
}
-sub modify_ltiauth {
- my ($r,$cdom,$cnum,$cdesc,$domdesc,$type) = @_;
- my %lt = &Apache::lonlocal::texthash(
- 'requ' => 'Requirement for re-authentication for student LTI-limited launch of deep-linked item',
- 'link' => 'Link protection can be set to accept username for an enrolled student (if sent by Consumer)',
- 'logi' => 'Login needed, regardless of user information sent by LTI Consumer in (signed) parameters',
- 'used' => 'Use domain default',
- 'cour' => 'Use course-specific setting',
- 'modi' => 'Save',
- 'back' => 'Pick another action',
- );
- &print_header($r,$type);
- $r->print('