[LON-CAPA-cvs] cvs: doc /loncapafiles loncapafiles.lpml loncom/html/adm/help/tex Docs_Standard_Problem.tex Domain_Configuration_Course_Defaults.tex Modify_Course_Crsauthor.tex Modify_Course_External_Tool.tex loncom/html/res/adm/pages crsauthor.png impcrsau.png loncom/interface domainprefs.pm londocs.pm lonmodifycourse.pm loncom/lonnet/perl lonnet.pm
raeburn
raeburn at source.lon-capa.org
Fri Dec 22 21:17:41 EST 2023
raeburn Sat Dec 23 02:17:41 2023 EDT
Added files:
/loncom/html/res/adm/pages crsauthor.png impcrsau.png
/loncom/html/adm/help/tex Docs_Standard_Problem.tex
Modify_Course_Crsauthor.tex
Modify_Course_External_Tool.tex
Modified files:
/loncom/interface domainprefs.pm lonmodifycourse.pm londocs.pm
/loncom/lonnet/perl lonnet.pm
/loncom/html/adm/help/tex Domain_Configuration_Course_Defaults.tex
/doc/loncapafiles loncapafiles.lpml
Log:
- Availability of "Course Authoring Space" set in Course Community defaults
in domain (by container type), can be overridden for specific course(s).
- Add some help files for Course Editor and View/modify a course/community
- Add icons for use of Course Authoring Space.
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.431 loncom/interface/domainprefs.pm:1.432
--- loncom/interface/domainprefs.pm:1.431 Tue Nov 7 11:50:56 2023
+++ loncom/interface/domainprefs.pm Sat Dec 23 02:17:38 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.431 2023/11/07 11:50:56 raeburn Exp $
+# $Id: domainprefs.pm,v 1.432 2023/12/23 02:17:38 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6822,7 +6822,7 @@
my %choices = &Apache::lonlocal::texthash (
canuse_pdfforms => 'Course/Community users can create/upload PDF forms',
uploadquota => 'Default quota for files uploaded directly to course/community using Course Editor (MB)',
- coursequota => 'Default cumulative quota for all group portfolio spaces in course',
+ coursequota => 'Default cumulative quota for all group portfolio spaces in course (MB)',
anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys',
coursecredits => 'Credits can be specified for courses',
uselcmath => 'Math preview uses LON-CAPA previewer (javascript) in place of DragMath (Java)',
@@ -6835,6 +6835,7 @@
ltiauth => 'Student username in LTI launch of deep-linked URL can be accepted without re-authentication',
domexttool => 'External Tools defined in the domain may be used in courses/communities (by type)',
exttool => 'External Tools can be defined and configured in courses/communities (by type)',
+ crsauthor => 'Standard LON-CAPA problems can be created within a course/community (by type)',
);
my %staticdefaults = (
anonsurvey_threshold => 10,
@@ -6844,6 +6845,7 @@
mysqltables => 172800,
domexttool => 1,
exttool => 0,
+ crsauthor => 1,
);
if ($position eq 'top') {
%defaultchecked = (
@@ -6964,6 +6966,7 @@
my $ltiauth = 0;
my %domexttool;
my %exttool;
+ my %crsauthor;
my @types = ('official','unofficial','community','textbook','placement');
if (ref($settings) eq 'HASH') {
if ($settings->{'ltiauth'}) {
@@ -6989,6 +6992,19 @@
}
}
}
+ if (ref($settings->{'crsauthor'}) eq 'HASH') {
+ foreach my $type (@types) {
+ if ($settings->{'crsauthor'}->{$type}) {
+ $crsauthor{$type} = ' checked="checked"';
+ }
+ }
+ } else {
+ foreach my $type (@types) {
+ if ($staticdefaults{'crsauthor'}) {
+ $crsauthor{$type} = ' checked="checked"';
+ }
+ }
+ }
$currdefresponder = $settings->{'anonsurvey_threshold'};
if (ref($settings->{'uploadquota'}) eq 'HASH') {
foreach my $type (keys(%{$settings->{'uploadquota'}})) {
@@ -7048,6 +7064,9 @@
if ($staticdefaults{'domexttool'}) {
$domexttool{$type} = ' checked="checked"';
}
+ if ($staticdefaults{'crsauthor'}) {
+ $crsauthor{$type} = ' checked="checked"';
+ }
}
}
if (!$currdefresponder) {
@@ -7196,6 +7215,21 @@
&mt($type).'</span></td>'."\n";
}
$datatable .= '</tr></table></td></tr>'."\n";
+ $itemcount ++;
+ $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
+ $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.
+ $choices{'crsauthor'}.
+ '</span></td>'.
+ '<td style="text-align: right" class="LC_right_item">'.
+ '<table><tr>';
+ foreach my $type (@types) {
+ $datatable .= '<td style="text-align: left">'.
+ '<span class="LC_nobreak">'.
+ '<input type="checkbox" name="crsauthor"'.
+ ' value="'.$type.'"'.$crsauthor{$type}.' />'.
+ &mt($type).'</span></td>'."\n";
+ }
+ $datatable .= '</tr></table></td></tr>'."\n";
}
$$rowtotal += $itemcount;
return $datatable;
@@ -21009,6 +21043,7 @@
postsubmit => 60,
mysqltables => 172800,
domexttool => 1,
+ crsauthor => 1,
);
my %texoptions = (
MathJax => 'MathJax',
@@ -21200,9 +21235,10 @@
$changes{'postsubmit'} = 1;
}
}
- my (%newdomexttool,%newexttool,%olddomexttool,%oldexttool);
+ my (%newdomexttool,%newexttool,%newcrsauthor,%olddomexttool,%oldexttool,%oldcrsauthor);
map { $newdomexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.domexttool');
map { $newexttool{$_} = 1; } &Apache::loncommon::get_env_multiple('form.exttool');
+ map { $newcrsauthor{$_} = 1; } &Apache::loncommon::get_env_multiple('form.crsauthor');
if (ref($domconfig{'coursedefaults'}{'domexttool'}) eq 'HASH') {
%olddomexttool = %{$domconfig{'coursedefaults'}{'domexttool'}};
} else {
@@ -21225,6 +21261,17 @@
}
}
}
+ if (ref($domconfig{'coursedefaults'}{'crsauthor'}) eq 'HASH') {
+ %oldcrsauthor = %{$domconfig{'coursedefaults'}{'crsauthor'}};
+ } else {
+ foreach my $type (@types) {
+ if ($staticdefaults{'crsauthor'}) {
+ $oldcrsauthor{$type} = 1;
+ } else {
+ $oldcrsauthor{$type} = 0;
+ }
+ }
+ }
foreach my $type (@types) {
unless ($newdomexttool{$type}) {
$newdomexttool{$type} = 0;
@@ -21232,15 +21279,22 @@
unless ($newexttool{$type}) {
$newexttool{$type} = 0;
}
+ unless ($newcrsauthor{$type}) {
+ $newcrsauthor{$type} = 0;
+ }
if ($newdomexttool{$type} != $olddomexttool{$type}) {
$changes{'domexttool'} = 1;
}
if ($newexttool{$type} != $oldexttool{$type}) {
$changes{'exttool'} = 1;
}
+ if ($newcrsauthor{$type} != $oldcrsauthor{$type}) {
+ $changes{'crsauthor'} = 1;
+ }
}
$defaultshash{'coursedefaults'}{'domexttool'} = \%newdomexttool;
$defaultshash{'coursedefaults'}{'exttool'} = \%newexttool;
+ $defaultshash{'coursedefaults'}{'crsauthor'} = \%newcrsauthor;
}
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,
$dom);
@@ -21251,7 +21305,7 @@
($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'}) ||
($changes{'canclone'}) || ($changes{'mysqltables'}) || ($changes{'texengine'}) ||
($changes{'inline_chem'}) || ($changes{'ltiauth'}) || ($changes{'domexttool'}) ||
- ($changes{'exttool'}) || ($changes{'coursequota'})) {
+ ($changes{'exttool'}) || ($changes{'coursequota'}) || ($changes{'crsauthor'})) {
foreach my $item ('canuse_pdfforms','uselcmath','usejsme','inline_chem','texengine',
'ltiauth') {
if ($changes{$item}) {
@@ -21317,6 +21371,13 @@
}
}
}
+ if ($changes{'crsauthor'}) {
+ if (ref($defaultshash{'coursedefaults'}{'crsauthor'}) eq 'HASH') {
+ foreach my $type (@types) {
+ $domdefaults{$type.'crsauthor'}=$defaultshash{'coursedefaults'}{'crsauthor'}{$type};
+ }
+ }
+ }
my $cachetime = 24*60*60;
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
if (ref($lastactref) eq 'HASH') {
@@ -21467,33 +21528,34 @@
} else {
$resulttext .= '<li>'.&mt('LTI launch of deep-linked URL will require re-authentication').'</li>';
}
- } elsif ($item eq 'domexttool') {
- my @noyes = (&mt('no'),&mt('yes'));
- if (ref($defaultshash{'coursedefaults'}{'domexttool'}) eq 'HASH') {
- $resulttext .= '<li>'.&mt('External Tools defined in the domain may be used as follows:').'<ul>'.
- '<li>'.&mt('Official courses: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{'domexttool'}{'official'}].'</b>').'</li>'.
- '<li>'.&mt('Unofficial courses: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{'domexttool'}{'unofficial'}].'</b>').'</li>'.
- '<li>'.&mt('Textbook courses: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{'domexttool'}{'textbook'}].'</b>').'</li>'.
- '<li>'.&mt('Placement tests: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{'domexttool'}{'placement'}].'</b>').'</li>'.
- '<li>'.&mt('Communities: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{'domexttool'}{'community'}].'</b>').'</li>'.
- '</ul>'.
- '</li>';
- } else {
- $resulttext .= '<li>'.&mt('External Tools defined in the domain may be used in all course types, by default').'</li>';
- }
- } elsif ($item eq 'exttool') {
+ } elsif (($item eq 'domexttool') || ($item eq 'exttool') || ($item eq 'crsauthor')) {
my @noyes = (&mt('no'),&mt('yes'));
- if (ref($defaultshash{'coursedefaults'}{'exttool'}) eq 'HASH') {
- $resulttext .= '<li>'.&mt('External Tools can be defined and configured in course containers as follows:').'<ul>'.
- '<li>'.&mt('Official courses: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{'exttool'}{'official'}].'</b>').'</li>'.
- '<li>'.&mt('Unofficial courses: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{'exttool'}{'unofficial'}].'</b>').'</li>'.
- '<li>'.&mt('Textbook courses: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{'exttool'}{'textbook'}].'</b>').'</li>'.
- '<li>'.&mt('Placement tests: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{'exttool'}{'placement'}].'</b>').'</li>'.
- '<li>'.&mt('Communities: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{'exttool'}{'community'}].'</b>').'</li>'.
+ my %status = (
+ domexttool => {
+ ishash => &mt('External Tools defined in the domain may be used as follows:'),
+ default => &mt('External Tools defined in the domain may be used in all course types, by default'),
+ },
+ exttool => {
+ ishash => &mt('External Tools can be defined and configured in course containers as follows:'),
+ default => &mt('External Tools can not be defined in any course types, by default'),
+ },
+ crsauthor => {
+ ishash => &mt('Standard Problems can be created within course containers as follows:'),
+ default => &mt('Standard Problems can be created within any course type, by default'),
+ },
+ );
+
+ if (ref($defaultshash{'coursedefaults'}{$item}) eq 'HASH') {
+ $resulttext .= '<li>'.$status{$item}{'ishash'}.'<ul>'.
+ '<li>'.&mt('Official courses: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{$item}{'official'}].'</b>').'</li>'.
+ '<li>'.&mt('Unofficial courses: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{$item}{'unofficial'}].'</b>').'</li>'.
+ '<li>'.&mt('Textbook courses: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{$item}{'textbook'}].'</b>').'</li>'.
+ '<li>'.&mt('Placement tests: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{$item}{'placement'}].'</b>').'</li>'.
+ '<li>'.&mt('Communities: [_1]','<b>'.$noyes[$defaultshash{'coursedefaults'}{$item}{'community'}].'</b>').'</li>'.
'</ul>'.
'</li>';
} else {
- $resulttext .= '<li>'.&mt('External Tools can not be defined in any course types, by default').'</li>';
+ $resulttext .= '<li>'.$status{$item}{'default'}.'</li>';
}
}
}
Index: loncom/interface/lonmodifycourse.pm
diff -u loncom/interface/lonmodifycourse.pm:1.103 loncom/interface/lonmodifycourse.pm:1.104
--- loncom/interface/lonmodifycourse.pm:1.103 Tue Sep 5 03:42:31 2023
+++ loncom/interface/lonmodifycourse.pm Sat Dec 23 02:17:38 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# handler for DC-only modifiable course settings
#
-# $Id: lonmodifycourse.pm,v 1.103 2023/09/05 03:42:31 raeburn Exp $
+# $Id: lonmodifycourse.pm,v 1.104 2023/12/23 02:17:38 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -433,6 +433,7 @@
'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 = (
@@ -442,6 +443,7 @@
'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') {
@@ -582,6 +584,14 @@
permission => $permission->{'setexttool'},
linktitle => '',
},
+ {
+ linktext => $linktext{'setcrsauthor'},
+ icon => 'crsauthor.png',
+ #help => '',
+ url => &phaseurl('setcrsauthor'),
+ permission => $permission->{'setcrsauthor'},
+ linktitle => '',
+ },
]
},
);
@@ -1301,171 +1311,76 @@
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 = '<input type="button" onclick="javascript:changePage(this.form,'."'processltiauth'".');" value="'.$lt{'modi'}.'" />';
- }
- my $helpitem = &Apache::loncommon::help_open_topic('Modify_Course_LTI_Authen');
- my $showtype = &mt($type);
- $r->print(<<ENDDOCUMENT);
-<h3>$helpitem $lt{'requ'}</h3>
-<h4><span class="LC_nobreak">$showtype: $cdesc</span></h4>
-<form action="/adm/modifycourse" method="post" name="setltiauth">
-<p><span class="LC_nobreak">$lt{'curd'}: <span style="font-style:italic">$domdefdisplay</span></span></p>
-<p><span class="LC_nobreak">
-<label><input type="radio" name="ltiauthset" value="dom" onclick="toggleLTIOptions(this.form);"$checkeddom$disabled />$lt{'used'}</label></span><br />
-<span class="LC_nobreak">
-<label><input type="radio" name="ltiauthset" value="course" onclick="toggleLTIOptions(this.form);"$checkedcrs$disabled />$lt{'cour'}</label></span></p>
-<fieldset id="crsltiauth" style="$divsty">
-<legend>$lt{'valu'}</legend>
-<span class="LC_nobreak">
-<label><input type="radio" name="ltiauth" value="0"$authno$disabled />$lt{'logi'}</label>
-</span><br />
-<span class="LC_nobreak">
-<label><input type="radio" name="ltiauth" value="1"$authok$disabled />$lt{'link'}</label>
-</span>
-</fieldset><p>
-$submit
-$hidden_elements
-</p>
-</form>
-ENDDOCUMENT
- my @actions =
- ('<a href="javascript:changePage(document.setltiauth,'."'menu'".')">'.
- $lt{'back'}.'</a>');
- $r->print('<br />'.&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 = '<input type="button" onclick="javascript:changePage(this.form,'."'processexttool'".');" value="'.$titles{'modi'}.'" />';
+ $submit = '<input type="button" onclick="javascript:changePage(this.form,'."'process${item}'".');" value="'.$titles{'modi'}.'" />';
+ }
+ foreach my $option (@{$options}) {
+ $crselements .= '<span class="LC_nobreak">'.
+ '<label><input type="radio" name="'.$item.'" value="'.$option.'"'.
+ $crschecked{$option}.$disabled.' />'.$optiontext->{$option}.'</label>'.
+ '</span><br />'."\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(<<ENDDOCUMENT);
-<h3>$helpitem $titles{'extt'}</h3>
+<h3>$helpitem $title</h3>
<h4><span class="LC_nobreak">$showtype: $cdesc</span></h4>
-<form action="/adm/modifycourse" method="post" name="setexttool">
+<form action="/adm/modifycourse" method="post" name="set$item">
<p><span class="LC_nobreak">$titles{'curd'}: <span style="font-style:italic">$domdefdisplay</span></span></p>
<p><span class="LC_nobreak">
-<label><input type="radio" name="exttoolset" value="dom" onclick="toggleExtToolOptions(this.form);"$checkeddom$disabled />$titles{'used'}</label></span><br />
+<label><input type="radio" name="${item}set" value="dom" onclick="toggleOptions(this.form,'set$item');"$checkeddom$disabled />$titles{'used'}</label></span><br />
<span class="LC_nobreak">
-<label><input type="radio" name="exttoolset" value="course" onclick="toggleExtToolOptions(this.form);"$checkedcrs$disabled />$titles{'cour'}</label></span></p>
-<fieldset id="crsexttool" style="$divsty">
+<label><input type="radio" name="${item}set" value="course" onclick="toggleOptions(this.form,'set$item');"$checkedcrs$disabled />$titles{'cour'}</label></span></p>
+<fieldset id="crs$item" style="$divsty">
<legend>$titles{'valu'}</legend>
-<span class="LC_nobreak">
-<label><input type="radio" name="exttool" value="both"$crschecked{'both'}$disabled />$titles{'both'}</label>
-</span><br />
-<span class="LC_nobreak">
-<label><input type="radio" name="exttool" value="dom"$crschecked{'dom'}$disabled />$titles{'dom'}</label>
-</span><br />
-<span class="LC_nobreak">
-<label><input type="radio" name="exttool" value="crs"$crschecked{'crs'}$disabled />$titles{'crs'}</label>
-</span><br />
-<span class="LC_nobreak">
-<label><input type="radio" name="exttool" value="none"$crschecked{'none'}$disabled />$titles{'none'}</label>
-</span>
+$crselements
</fieldset><p>
$submit
$hidden_elements
@@ -1473,20 +1388,26 @@
</form>
ENDDOCUMENT
my @actions =
- ('<a href="javascript:changePage(document.setexttool,'."'menu'".')">'.
+ ('<a href="javascript:changePage(document.set'.$item.','."'menu'".')">'.
$titles{'back'}.'</a>');
$r->print('<br />'.&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',
@@ -1503,6 +1424,85 @@
return %titles;
}
+sub default_overrides_common {
+ my ($item,$cdom,$cnum,$type,$titles) = @_;
+ my ($title,$domdef,$domdefdom,$domdefdisplay,%settings,%optiontext, at 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');
@@ -2508,182 +2508,70 @@
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('<h3>'.$lt{'requ'}.'</h3>'."\n".
- '<h4><span class="LC_nobreak">'.&mt($type).': '.$cdesc.'</span></h4>'."\n".
- '<form action="/adm/modifycourse" method="post" name="processltiauth">'."\n");
- my %oldsettings = &Apache::lonnet::get('environment',['internal.ltiauth'],$cdom,$cnum);
- my $oldltiauth = $oldsettings{'internal.ltiauth'};
- my $domdef;
- my %domconfig =
- &Apache::lonnet::get_dom('configuration',['coursedefaults'],$cdom);
- if (ref($domconfig{'coursedefaults'}) eq 'HASH') {
- $domdef = $domconfig{'coursedefaults'}{'ltiauth'};
- }
- my ($newltiauth,$nochange,$change,$status,$error,$ltiauth);
- if ($env{'form.ltiauthset'} eq 'dom') {
- if ($oldltiauth eq '') {
- $nochange = 1;
- } else {
- $change = 1;
- }
- } elsif ($env{'form.ltiauthset'} eq 'course') {
- if ($env{'form.ltiauth'} =~ /^0|1$/) {
- $newltiauth = $env{'form.ltiauth'};
- }
- if ($oldltiauth == $newltiauth) {
- $nochange = 1;
- } else {
- $change = 1;
- }
- }
- if ($change) {
- if ($newltiauth ne '') {
- my %cenv = (
- 'internal.ltiauth' => $newltiauth,
- );
- if (&Apache::lonnet::put('environment',\%cenv,$cdom,$cnum) eq 'ok') {
- if ($env{'course.'.$cdom.'_'.$cnum.'.description'} ne '') {
- &Apache::lonnet::appenv(
- {'course.'.$cdom.'_'.$cnum.'.internal.ltiauth' => $newltiauth});
- }
- } else {
- $error = 1;
- }
- } else {
- if (&Apache::lonnet::del('environment',['internal.ltiauth'],$cdom,$cnum) eq 'ok') {
- if (exists($env{'course.'.$cdom.'_'.$cnum.'.internal.ltiauth'})) {
- &Apache::lonnet::delenv('course.'.$cdom.'_'.$cnum.'.internal.ltiauth');
- }
- } else {
- $error = 1;
- }
- }
+sub modify_default_overrides {
+ my ($r,$cdom,$cnum,$cdesc,$domdesc,$type,$item) = @_;
+ my (%titles,$oldcrsval,$newcrsval,%resulttext,$itemvalue,$nochange,$change,$status,$error);
+ %titles = &default_overrides_titles($type);
+ my ($title,$domdefdisplay,$oldsettings,$optiontext,$options) =
+ &default_overrides_common($item,$cdom,$cnum,$type,\%titles);
+ $oldcrsval = $oldsettings->{'internal.'.$item};
+ if ($item eq 'ltiauth') {
+ %resulttext =
+ &Apache::lonlocal::texthash(
+ chg => 'Re-authentication requirement for LTI launch of deep-linked changed',
+ nochg => 'Re-authentication requirement for LTI launch of deep-linked item is unchanged',
+ );
+ } elsif ($item eq 'exttool') {
+ %resulttext =
+ &Apache::lonlocal::texthash(
+ chg => 'External Tool permissions changed',
+ nochg => 'External Tool permissions unchanged',
+ );
+ } elsif ($item eq 'crsauthor') {
+ %resulttext =
+ &Apache::lonlocal::texthash(
+ chg => 'In-course authoring permissions changed',
+ nochg => 'In-course authoring permissions unchanged',
+ );
}
- if ($error) {
- $nochange = 1;
- }
- if ($nochange) {
- $ltiauth = $oldltiauth;
- } else {
- $ltiauth = $newltiauth;
- }
- if ($ltiauth eq '') {
- $status = $lt{'used'}.': ';
- if ($domdef) {
- $status .= '<span style="font-style:italic">'.$lt{'link'}.'</span>';
- } else {
- $status .= '<span style="font-style:italic">'.$lt{'logi'}.'</span>';
- }
- } else {
- $status = $lt{'cour'}.': ';
- if ($ltiauth) {
- $status .= '<span style="font-style:italic">'.$lt{'link'}.'</span>';
- } else {
- $status .= '<span style="font-style:italic">'.$lt{'logi'}.'</span>';
- }
- }
- if ($error) {
- $r->print('<p class="LC_warning">'.&mt('An error occurred when saving your changes').'</p>');
- }
- $r->print('<p>');
- if ($nochange) {
- $r->print(&mt('Re-authentication requirement for LTI launch of deep-linked item is unchanged'));
- } elsif ($change) {
- $r->print(&mt('Re-authentication requirement for LTI launch of deep-linked changed'));
- }
- $r->print('<br />'.$status.'</p>'.
- &hidden_form_elements().'</form>');
- my @actions =
- ('<a href="javascript:changePage(document.processltiauth,'."'menu'".')">'.
- $lt{'back'}.'</a>');
- $r->print('<br />'.&Apache::lonhtmlcommon::actionbox(\@actions));
- return;
-}
-
-sub modify_exttool {
- my ($r,$cdom,$cnum,$cdesc,$domdesc,$type) = @_;
- my %titles = &exttool_titles($type);
&print_header($r,$type);
- $r->print('<h3>'.$titles{'extt'}.'</h3>'."\n".
- '<h4><span class="LC_nobreak">'.$type.': '.$cdesc.'</span></h4>'."\n".
- '<form action="/adm/modifycourse" method="post" name="processexttool">'."\n");
- my %oldsettings = &Apache::lonnet::get('environment',['internal.exttool'],$cdom,$cnum);
- my $oldcrsexttool = $oldsettings{'internal.exttool'};
- my $domdefdom = 1;
- my $domdef = 0;
- my $domdefdisplay;
- 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'}{'domexttool'}) eq 'HASH') {
- if (exists($domconfig{'coursedefaults'}{'domexttool'}{$lctype})) {
- $domdefdom = $domconfig{'coursedefaults'}{'domexttool'}{$lctype};
- }
- }
- if (ref($domconfig{'coursedefaults'}{'exttool'}) eq 'HASH') {
- if (exists($domconfig{'coursedefaults'}{'exttool'}{$lctype})) {
- $domdef = $domconfig{'coursedefaults'}{'exttool'}{$lctype};
- }
- }
- }
- if ($domdef && $domdefdom) {
- $domdefdisplay = $titles{'both'};
- } elsif ($domdef) {
- $domdefdisplay = $titles{'crs'};
- } elsif ($domdefdom) {
- $domdefdisplay = $titles{'dom'};
- } else {
- $domdefdisplay = $titles{'none'};
- }
- my ($newcrsexttool,$nochange,$change,$status,$error,$exttool);
- if ($env{'form.exttoolset'} eq 'dom') {
- if ($oldcrsexttool eq '') {
+ $r->print('<h3>'.$title.'</h3>'."\n".
+ '<h4><span class="LC_nobreak">'.&mt($type).': '.$cdesc.'</span></h4>'."\n".
+ '<form action="/adm/modifycourse" method="post" name="process'.$item.'">'."\n");
+ if ($env{'form.'.$item.'set'} eq 'dom') {
+ if ($oldcrsval eq '') {
$nochange = 1;
} else {
$change = 1;
}
- } elsif ($env{'form.exttoolset'} eq 'course') {
- if ($env{'form.exttool'} =~ /^both|dom|crs|none$/) {
- $newcrsexttool = $env{'form.exttool'};
+ } elsif ($env{'form.'.$item.'set'} eq 'course') {
+ my $posscrsval = $env{'form.'.$item};
+ if (grep(/^\Q$posscrsval\E$/,@{$options})) {
+ $newcrsval = $posscrsval;
}
- if ($oldcrsexttool eq $newcrsexttool) {
+ if ($oldcrsval eq $newcrsval) {
$nochange = 1;
} else {
$change = 1;
}
}
if ($change) {
- if ($newcrsexttool ne '') {
+ if ($newcrsval ne '') {
my %cenv = (
- 'internal.exttool' => $newcrsexttool,
+ 'internal.'.$item => $newcrsval,
);
if (&Apache::lonnet::put('environment',\%cenv,$cdom,$cnum) eq 'ok') {
if ($env{'course.'.$cdom.'_'.$cnum.'.description'} ne '') {
&Apache::lonnet::appenv(
- {'course.'.$cdom.'_'.$cnum.'.internal.exttool' => $newcrsexttool});
+ {'course.'.$cdom.'_'.$cnum.'.internal.'.$item => $newcrsval});
}
} else {
$error = 1;
}
} else {
- if (&Apache::lonnet::del('environment',['internal.exttool'],$cdom,$cnum) eq 'ok') {
- if (exists($env{'course.'.$cdom.'_'.$cnum.'.internal.exttool'})) {
- &Apache::lonnet::delenv('course.'.$cdom.'_'.$cnum.'.internal.exttool');
+ if (&Apache::lonnet::del('environment',['internal.'.$item],$cdom,$cnum) eq 'ok') {
+ if (exists($env{'course.'.$cdom.'_'.$cnum.'.internal.'.$item})) {
+ &Apache::lonnet::delenv('course.'.$cdom.'_'.$cnum.'.internal.'.$item);
}
} else {
$error = 1;
@@ -2694,28 +2582,30 @@
$nochange = 1;
}
if ($nochange) {
- $exttool = $oldcrsexttool;
+ $itemvalue = $oldcrsval;
} else {
- $exttool = $newcrsexttool;
+ $itemvalue = $newcrsval;
}
- if ($exttool eq '') {
- $status = $titles{'used'}.': <span style="font-style:italic">'.$domdefdisplay.'</span>';
+ if ($itemvalue eq '') {
+ $status = $titles{'used'}.': '.
+ '<span style="font-style:italic">'.$domdefdisplay.'</span>';
} else {
- $status = $titles{'cour'}.': <span style="font-style:italic">'.$titles{$exttool}.'</span>';
+ $status = $titles{'cour'}.': '.
+ '<span style="font-style:italic">'.$optiontext->{$itemvalue}.'</span>';
}
if ($error) {
$r->print('<p class="LC_warning">'.&mt('An error occurred when saving your changes').'</p>');
}
$r->print('<p>');
if ($nochange) {
- $r->print(&mt('External Tool permissions unchanged'));
+ $r->print($resulttext{'nochg'});
} elsif ($change) {
- $r->print(&mt('External Tool permissions changed'));
+ $r->print($resulttext{'chg'});
}
$r->print('<br />'.$status.'</p>'.
&hidden_form_elements().'</form>');
my @actions =
- ('<a href="javascript:changePage(document.processexttool,'."'menu'".')">'.
+ ('<a href="javascript:changePage(document.process'.$item.','."'menu'".')">'.
$titles{'back'}.'</a>');
$r->print('<br />'.&Apache::lonhtmlcommon::actionbox(\@actions));
return;
@@ -2877,40 +2767,21 @@
ENDSCRIPT
- } elsif ($phase eq 'setltiauth') {
+ } elsif (($phase eq 'setltiauth') || ($phase eq 'setexttool') || ($phase eq 'setcrsauthor')) {
$js .= <<"ENDJS";
-function toggleLTIOptions(form) {
- var radioname = 'ltiauthset';
- var divid = 'crsltiauth';
- var num = form.elements[radioname].length;
- if (num) {
- var setvis = '';
- for (var i=0; i<num; i++) {
- if (form.elements[radioname][i].checked) {
- if (form.elements[radioname][i].value == 'course') {
- if (document.getElementById(divid)) {
- document.getElementById(divid).style.display = 'inline-block';
- }
- setvis = 1;
- }
- break;
- }
- }
- if (!setvis) {
- if (document.getElementById(divid)) {
- document.getElementById(divid).style.display = 'none';
- }
- }
+function toggleOptions(form,phase) {
+ var radioname;
+ var divid;
+ if (phase == 'setltiauth') {
+ radioname = 'ltiauthset';
+ divid = 'crsltiauth';
+ } else if (phase == 'setexttool') {
+ radioname = 'exttoolset';
+ divid = 'crsexttool';
+ } else if (phase == 'setcrsauthor') {
+ radioname = 'crsauthorset';
+ divid = 'crscrsauthor';
}
- return;
-}
-
-ENDJS
- } elsif ($phase eq 'setexttool') {
- $js .= <<"ENDJS";
-function toggleExtToolOptions(form) {
- var radioname = 'exttoolset';
- var divid = 'crsexttool';
var num = form.elements[radioname].length;
if (num) {
var setvis = '';
@@ -2945,13 +2816,9 @@
$starthash = {
add_entries => {'onload' => "hide_searching(); courseSet(document.filterpicker.official, 'load');"},
};
- } elsif ($env{'form.phase'} eq 'setltiauth') {
+ } elsif ($env{'form.phase'} =~ /^set(ltiauth|exttool|crsauthor)$/) {
$starthash = {
- add_entries => {'onload' => "toggleLTIOptions(document.setltiauth);"},
- };
- } elsif ($env{'form.phase'} eq 'setexttool') {
- $starthash = {
- add_entries => {'onload' => "toggleExtToolOptions(document.setexttool);"},
+ add_entries => {'onload' => "toggleOptions(document.$env{'form.phase'},'$env{'form.phase'}');"},
};
}
$r->print(&Apache::loncommon::start_page('View/Modify Course/Community Settings',
@@ -3061,7 +2928,8 @@
'threshold','postsubmit','postsubtimeout','defaultcredits','uploadquota',
'selfenrollmgrdc','selfenrollmgrcc','action','state','currsec_st',
'sections','newsec','mysqltables','nopasswdchg','ltiauth','ltiauthset',
- 'exttoolset','exttool'],['^selfenrollmgr_','^selfenroll_'])."\n".
+ 'exttoolset','exttool','crsauthorset','crsauthor'],
+ ['^selfenrollmgr_','^selfenroll_'])."\n".
'<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" />';
return $hidden_elements;
}
@@ -3098,6 +2966,8 @@
processltiauth => 'edit',
setexttool => 'edit',
processexttool => 'edit',
+ setcrsauthor => 'edit',
+ processcrsauthor => 'edit',
);
if ($passwdconf{'crsownerchg'}) {
$permission{passwdchg} = 'edit';
@@ -3115,6 +2985,7 @@
adhocrole => 'custom',
setltiauth => 'view',
setexttool => 'view',
+ setcrsauthor => 'view',
);
if ($passwdconf{'crsownerchg'}) {
$permission{passwdchg} = 'view';
@@ -3321,27 +3192,39 @@
} elsif (($phase eq 'setltiauth') && ($permission->{'setltiauth'})) {
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:changePage(document.$phase,'$phase')",
- text=>"Requirement for re-authentication for LTI launch of deep-linked item"});
- &print_set_ltiauth($r,$cdom,$cnum,$cdesc,$type,$readonly);
+ text=>"Authentication post-LTI launch"});
+ &print_default_overrides($r,$cdom,$cnum,$cdesc,$type,$readonly,'ltiauth');
} elsif (($phase eq 'processltiauth') && ($permission->{'processltiauth'})) {
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:changePage(document.$phase,'setltiauth')",
- text=>"Requirement for re-authentication for LTI launch of deep-linked item"},
+ text=>"Authentication post-LTI launch"},
{href=>"javascript:changePage(document.$phase,'$phase')",
text=>"Result"});
- &modify_ltiauth($r,$cdom,$cnum,$cdesc,$domdesc,$type);
+ &modify_default_overrides($r,$cdom,$cnum,$cdesc,$domdesc,$type,'ltiauth');
} elsif (($phase eq 'setexttool') && ($permission->{'setexttool'})) {
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:changePage(document.$phase,'$phase')",
text=>"External Tool permission"});
- &print_set_exttool($r,$cdom,$cnum,$cdesc,$type,$readonly);
+ &print_default_overrides($r,$cdom,$cnum,$cdesc,$type,$readonly,'exttool');
} elsif (($phase eq 'processexttool') && ($permission->{'processexttool'})) {
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:changePage(document.$phase,'setexttool')",
text=>"External Tool permission"},
{href=>"javascript:changePage(document.$phase,'$phase')",
text=>"Result"});
- &modify_exttool($r,$cdom,$cnum,$cdesc,$domdesc,$type);
+ &modify_default_overrides($r,$cdom,$cnum,$cdesc,$domdesc,$type,'exttool');
+ } elsif (($phase eq 'setcrsauthor') && ($permission->{'setcrsauthor'})) {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:changePage(document.$phase,'$phase')",
+ text=>"In-course authoring permission"});
+ &print_default_overrides($r,$cdom,$cnum,$cdesc,$type,$readonly,'crsauthor');
+ } elsif (($phase eq 'processcrsauthor') && ($permission->{'processcrsauthor'})) {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"javascript:changePage(document.$phase,'setcrsauthor')",
+ text=>"In-course authoring permission"},
+ {href=>"javascript:changePage(document.$phase,'$phase')",
+ text=>"Result"});
+ &modify_default_overrides($r,$cdom,$cnum,$cdesc,$domdesc,$type,'crsauthor');
}
}
} else {
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.705 loncom/interface/londocs.pm:1.706
--- loncom/interface/londocs.pm:1.705 Wed Sep 27 14:52:26 2023
+++ loncom/interface/londocs.pm Sat Dec 23 02:17:38 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.705 2023/09/27 14:52:26 raeburn Exp $
+# $Id: londocs.pm,v 1.706 2023/12/23 02:17:38 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -5892,7 +5892,9 @@
'Load_Map','Supplemental','Score_Upload_Form',
'Adding_Pages','Importing_LON-CAPA_Resource',
'Importing_IMS_Course','Uploading_From_Harddrive',
- 'Course_Roster','Web_Page','Dropbox','Simple_Problem') {
+ 'Course_Roster','Web_Page','Dropbox','Simple_Problem',
+ 'Standard_Problem','Course_Resources',
+ 'Search_LON-CAPA_Resource','Import_Stored_Links') {
$help{$topic}=&Apache::loncommon::help_open_topic('Docs_'.$topic);
}
# Composite help files
@@ -6147,8 +6149,8 @@
&Apache::loncommon::validate_folderpath($supplementalflag,$allowed,$coursenum,$coursedom);
}
}
-
-# If we are not allowed to make changes and this is supplemental content set folderpath
+
+# Set folderpath if we are not allowed to make changes and this is supplemental content
if ((!$allowed) && ($supplementalflag)) {
unless ($env{'form.folderpath'} =~ /^supplemental/) {
$env{'form.folderpath'} = &supplemental_base();
@@ -6509,8 +6511,8 @@
'copm' => 'All documents out of a published map into this folder',
'upfi' => 'Upload File',
'upld' => 'Upload Content',
- 'srch' => 'Search',
- 'impo' => 'Import',
+ 'srch' => 'Search Repository',
+ 'impo' => 'Import from Repository',
'lnks' => 'Import from Stored Links',
'impm' => 'Import from Assembled Map',
'imcr' => 'Import from Course Resources',
@@ -6687,13 +6689,22 @@
</form>
SEDFFORM
- my $importcrsresform;
- my ($numdirs,$pickfile) =
- &Apache::loncommon::import_crsauthor_form('coursepath','coursefile',
- "resize_scrollbox('contentscroll','1','0');",
- undef,'res');
- if ($pickfile) {
- $importcrsresform=(<<CRSFORM);
+ my ($importcrsresform,$checkcrsres);
+ if ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.crsauthor'}) {
+ $checkcrsres = 1;
+ } elsif ($env{'course.'.$coursedom.'_'.$coursenum.'.internal.crsauthor'} ne '0') {
+ my %domdefs=&Apache::lonnet::get_domain_defaults($coursedom);
+ if ($domdefs{'crsauthor'}) {
+ $checkcrsres = 1;
+ }
+ }
+ if ($checkcrsres) {
+ my ($numdirs,$pickfile) =
+ &Apache::loncommon::import_crsauthor_form('coursepath','coursefile',
+ "resize_scrollbox('contentscroll','1','0');",
+ undef,'res');
+ if ($pickfile) {
+ $importcrsresform=(<<CRSFORM);
<a class="LC_menubuttons_link" href="javascript:toggleImportCrsres('res');">
$lt{'imcr'}</a>$help{'Course_Resources'}
<form action="/adm/coursedocs" method="post" name="crsresimportform" onsubmit="return validImportCrsRes();">
@@ -6716,6 +6727,7 @@
</fieldset>
</form>
CRSFORM
+ }
}
my $fromstoredjs;
@@ -6726,13 +6738,13 @@
}
my @importpubforma = (
- { '<img class="LC_noBorder LC_middle" src="/res/adm/pages/src.png" alt="'.$lt{srch}.'" onclick="javascript:groupsearch()" />' => $pathitem."<a class='LC_menubuttons_link' href='javascript:groupsearch()'>$lt{'srch'}</a>" },
+ { '<img class="LC_noBorder LC_middle" src="/res/adm/pages/src.png" alt="'.$lt{srch}.'" onclick="javascript:groupsearch()" />' => $pathitem."<a class='LC_menubuttons_link' href='javascript:groupsearch()'>$lt{'srch'}</a>$help{'Search_LON-CAPA_Resource'}" },
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/res.png" alt="'.$lt{impo}.'" onclick="javascript:groupimport();"/>' => "<a class='LC_menubuttons_link' href='javascript:groupimport();'>$lt{'impo'}</a>$help{'Importing_LON-CAPA_Resource'}" },
- { '<img class="LC_noBorder LC_middle" src="/res/adm/pages/wishlist.png" alt="'.$lt{lnks}.'" onclick="javascript:'.$fromstoredjs.';" />' => '<a class="LC_menubuttons_link" href="javascript:'.$fromstoredjs.';">'.$lt{'lnks'}.'</a>' },
+ { '<img class="LC_noBorder LC_middle" src="/res/adm/pages/wishlist.png" alt="'.$lt{lnks}.'" onclick="javascript:'.$fromstoredjs.';" />' => '<a class="LC_menubuttons_link" href="javascript:'.$fromstoredjs.';">'.$lt{'lnks'}.'</a>'.$help{'Import_Stored_Links'} },
{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/sequence.png" alt="'.$lt{impm}.'" onclick="javascript:toggleMap(\'map\');" />' => $importpubform },
);
- if ($pickfile) {
- push(@importpubforma,{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/res.png" alt="'.$lt{imcr}.'" onclick="javascript:toggleImportCrsres(\'res\');" />' => $importcrsresform});
+ if ($importcrsresform) {
+ push(@importpubforma,{ '<img class="LC_noBorder LC_middle" src="/res/adm/pages/impcrsau.png" alt="'.$lt{imcr}.'" onclick="javascript:toggleImportCrsres(\'res\');" />' => $importcrsresform});
}
$importpubform = &create_form_ul(&create_list_elements(@importpubforma));
my $extresourcesform =
@@ -6984,13 +6996,14 @@
}
}
}
- $pickdir .= '<option value="course">'.&mt('Course Resource').'</option>'."\n".
- '</select><br />'."\n".
+ if ($checkcrsres) {
+ $pickdir .= '<option value="course">'.&mt('Course Resource').'</option>'."\n";
+ }
+ $pickdir .= '</select><br />'."\n".
$lt{'dire'}.
'<select name="authorpath" onchange="toggleCrsResTitle();">'.
'<option value=""></option>'.
'</select><br />'."\n";
-
my %seltemplate_menus;
my @files = &Apache::lonhomework::get_template_list('problem');
my @noexamplelink = ('blank.problem','blank.library','script.library');
@@ -7031,9 +7044,11 @@
"toggleExampleText();",'template').'<br />';
my $templatepreview = '<a href="#" target="sample" onclick="javascript:getExample(600,420,\'yes\',true); return false;">'.
'<span id="newresexample">'.&mt('Example').'</span></a>';
- my $crsresform=(<<RESFORM);
+ my $crsresform;
+ if (($env{'user.author'}) || ($checkcrsres)) {
+ $crsresform=(<<RESFORM);
<a class="LC_menubuttons_link" href="javascript:toggleCrsRes('res');">
- $lt{'stpr'}</a>$help{'Course_Resource'}
+ $lt{'stpr'}</a>$help{'Standard_Problem'}
<form action="/adm/coursedocs" method="post" name="courseresform">
<fieldset id="crsresform" style="display:none;">
<legend>$lt{'stpr'}</legend>
@@ -7087,6 +7102,7 @@
</form>
RESFORM
+ }
my $specialdocumentsform;
my @specialdocumentsforma;
@@ -7180,9 +7196,13 @@
@gradingforma=(
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/simpprob.png" alt="'.$lt{sipr}.'" onclick="javascript:makesmpproblem();" />'=>$newsmpproblemform},
{'<img class="LC_noBorder LC_middle" src="/res/adm/pages/dropbox.png" alt="'.$lt{drbx}.'" onclick="javascript:makedropbox();" />'=>$newdropboxform},
- {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/scoreupfrm.png" alt="'.$lt{scuf}.'" onclick="javascript:makeexamupload();" />'=>$newexuploadform},
- {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/simpprob.png" alt="'.$lt{stpr}.'" onclick="javascript:toggleCrsRes(\'res\');" />'=>$crsresform},
+ {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/scoreupfrm.png" alt="'.$lt{scuf}.'" onclick="javascript:makeexamupload();" />'=>$newexuploadform}
);
+ if ($crsresform) {
+ push(@gradingforma,
+ {'<img class="LC_noBorder LC_middle" src="/res/adm/pages/simpprob.png" alt="'.$lt{stpr}.'" onclick="javascript:toggleCrsRes(\'res\');" />'=>$crsresform}
+ );
+ }
$gradingform = &create_form_ul(&create_list_elements(@gradingforma));
@communityforma=(
@@ -8182,6 +8202,13 @@
}
}
document.getElementById('importmapform').style.display=disp;
+ if (disp == 'block') {
+ if (document.getElementById('importcrsresform')) {
+ if (document.getElementById('importcrsresform').style.display == 'block') {
+ document.getElementById('importcrsresform').style.display = 'none';
+ }
+ }
+ }
resize_scrollbox('contentscroll','1','1');
}
return;
@@ -8382,6 +8409,13 @@
}
}
document.getElementById('importcrsresform').style.display=disp;
+ if (disp == 'block') {
+ if (document.getElementById('importmapform')) {
+ if (document.getElementById('importmapform').style.display == 'block') {
+ document.getElementById('importmapform').style.display = 'none';
+ }
+ }
+ }
resize_scrollbox('contentscroll','1','0');
}
return;
@@ -8433,6 +8467,7 @@
}
}
}
+ var templateradio = document.courseresform.elements['newresusetemp'];
if (athome) {
if (document.getElementById('stdprobswitch')) {
document.getElementById('stdprobswitch').style.display = 'none';
@@ -8440,6 +8475,16 @@
if (document.getElementById('newstdproblem')) {
document.getElementById('newstdproblem').style.display = 'none';
}
+ var canedit = '$canedit';
+ if (canedit) {
+ if (templateradio.length > 1) {
+ for (var i=0; i<templateradio.length; i++) {
+ templateradio[i].disabled = false;
+ }
+ }
+ document.courseresform.newresourcename.disabled = false;
+ document.courseresform.newcrs.disabled = false;
+ }
var http = new XMLHttpRequest();
var url = "/adm/courseauthor";
var params = "role="+role+"&rec="+recurse+"&nonempty="+nonemptydir+"&addtop=1";
@@ -8478,6 +8523,13 @@
if (document.getElementById('newstdproblem')) {
document.getElementById('newstdproblem').style.display = 'none';
}
+ if (templateradio.length > 1) {
+ for (var i=0; i<templateradio.length; i++) {
+ templateradio[i].disabled = true;
+ }
+ }
+ document.courseresform.newresourcename.disabled = true;
+ document.courseresform.newcrs.disabled = true;
}
}
return;
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1519 loncom/lonnet/perl/lonnet.pm:1.1520
--- loncom/lonnet/perl/lonnet.pm:1.1519 Sat Nov 18 14:33:07 2023
+++ loncom/lonnet/perl/lonnet.pm Sat Dec 23 02:17:39 2023
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.1519 2023/11/18 14:33:07 raeburn Exp $
+# $Id: lonnet.pm,v 1.1520 2023/12/23 02:17:39 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2757,8 +2757,7 @@
'selfenrollment','coursecategories',
'ssl','autoenroll','trust',
'helpsettings','wafproxy',
- 'ltisec','toolsec','domexttool',
- 'exttool','privacy'],$domain);
+ 'ltisec','toolsec','privacy'],$domain);
my @coursetypes = ('official','unofficial','community','textbook','placement');
if (ref($domconfig{'defaults'}) eq 'HASH') {
$domdefaults{'lang_def'} = $domconfig{'defaults'}{'lang_def'};
@@ -2854,6 +2853,11 @@
} else {
$domdefaults{$type.'exttool'} = 0;
}
+ if (ref($domconfig{'coursedefaults'}{'crsauthor'}) eq 'HASH') {
+ $domdefaults{$type.'crsauthor'} = $domconfig{'coursedefaults'}{'crsauthor'}{$type};
+ } else {
+ $domdefaults{$type.'crsauthor'} = 1;
+ }
}
if (ref($domconfig{'coursedefaults'}{'canclone'}) eq 'HASH') {
if (ref($domconfig{'coursedefaults'}{'canclone'}{'instcode'}) eq 'ARRAY') {
@@ -9216,6 +9220,22 @@
if (($ownername eq $env{'course.'.$env{'request.course.id'}.'.num'}) &&
($ownerdomain eq $env{'course.'.$env{'request.course.id'}.'.domain'})) {
if (&allowed('mdc',$env{'request.course.id'})) {
+ return if ($env{'course.'.$env{'request.course.id'}.'.internal.crsauthor'} eq '0');
+ unless ($env{'course.'.$env{'request.course.id'}.'.internal.crsauthor'}) {
+ my %domdefs = &get_domain_defaults($ownerdomain);
+ my $type = lc($env{'course.'.$env{'request.course.id'}.'.type'});
+ unless (($type eq 'community') || ($type eq 'placement')) {
+ $type = 'unofficial';
+ if ($env{'course.'.$env{'request.course.id'}.'internal.coursecode'} ne '') {
+ $type = 'official';
+ } elsif ($env{'course.'.$env{'request.course.id'}.'internal.textbook'} ne '') {
+ $type = 'textbook';
+ } else {
+ $type = 'unofficial';
+ }
+ }
+ return if ($domdefs{$type.'crsauthor'} eq '0');
+ }
$ownerhome = $env{'course.'.$env{'request.course.id'}.'.home'};
return ($ownername,$ownerdomain,$ownerhome);
}
Index: loncom/html/adm/help/tex/Domain_Configuration_Course_Defaults.tex
diff -u loncom/html/adm/help/tex/Domain_Configuration_Course_Defaults.tex:1.12 loncom/html/adm/help/tex/Domain_Configuration_Course_Defaults.tex:1.13
--- loncom/html/adm/help/tex/Domain_Configuration_Course_Defaults.tex:1.12 Tue Feb 22 18:11:11 2022
+++ loncom/html/adm/help/tex/Domain_Configuration_Course_Defaults.tex Sat Dec 23 02:17:40 2023
@@ -55,14 +55,18 @@
\item \textbf{Defaults that can be overridden in an individual course by a Domain
Coordinator}
-Currently, there are six domain defaults of this type (which can be overridden
+Currently, there are ten domain defaults of this type (which can be overridden
via the ``View or modify a course or community'' interface).
\begin{itemize}
\item responder count - number of responses needed before submissions made to
anonymous surveys (with no identifying information) are viewable by Course personnel.
\item default course quotas - domain default for quotas (MB) for official, unofficial,
-community, and textbook course types for content uploaded directly to the course.
+community, and textbook course types for:
+\begin{numerate}
+\item content uploaded directly to the course
+\item content uploaded to portfolio space(s) for all group(s) in the course
+\end{numerate}
\item default course credits - whether credits may be specified for courses (Yes/No),
if yes: default values for number of credits for official, unofficial and textbook courses.
\item submit button behavior post-submission
@@ -90,6 +94,20 @@
For deep-link access to a specific folder (or resource) in LON-CAPA, mediated by LTI launch from a different system, the signed payload included on launch can include the username of the authenticated user who followed a link in another system. Whether such a username will be accepted, and a session launched for that username in LON-CAPA, or whether the user will be prompted to log-in to LON-CAPA in order to access the deep-linked resource(s) depends on the ``Use identity'' setting in effect for the current course. If the domain default is set to ``No'', then a Course Coordinator will not be given the option to set ``Use identity'' when configuring Link Protector(s) in a course, and all users will need to log-in to LON-CAPA to complete the launch process.
+\item External Tool definition and configuration in domain and/or course
+
+External Tools can be created in a domain by adding definitions to the ``Provider panel'' in the domain configuration for ``External Tools (LTI)'' available via ``Main Menu'' $>$ ``Set domain configuration''.
+
+The Course/Community default settings in a domain's configuration will determine whether external tools defined in the domain are available by default, for use in each of the available types of course container. A second default setting determines whether, by default, external tool definitions may be created by Course Coordinators in each of the course container types.
+
+\item Create standard LON-CAPA problems within a course/community
+
+The small tabs on the right side of the Course Editor for the Main Content area include an ``Assessment'' tab. One of the functions which may be available within ``Assessments'' is ``Standard Problem'', which allows creation of a new LON-CAPA problem for incorporation in a course. Unlike the ``Simple Problem'' also available from the same tab, a ``standard'' problem can feature the full functionality of the LON-CAPA Assessment engine. The Standard Problem link/icon will be listed if the current user has a current author or co-author role, or if the user has neither, will still be listed if the current course is permitted to access its own Course Authoring Space.
+
+The Course/Community defaults in the domain include checkboxes for each of the different course container types, which when checked set the ability to select ``Course Resource'' as the location for a new standard problem being created. Resources created in that location are not listed when browsing or searching the shared content repository, and may only be imported into the course in which they were created, by using the ``Import from Course Resources'' icon/link.
+
+Neither the ``Import from Course Resources'' icon/link nor the ``Course Resource'' as destination for ``Standard Problem'' will be available if the Course/Community default for the course's/community's container type has been left unchecked, and there is no course-specific override of the domain default.
+
\end{itemize}
\end{itemize}
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.1047 doc/loncapafiles/loncapafiles.lpml:1.1048
--- doc/loncapafiles/loncapafiles.lpml:1.1047 Sun Nov 19 21:28:18 2023
+++ doc/loncapafiles/loncapafiles.lpml Sat Dec 23 02:17:40 2023
@@ -2,7 +2,7 @@
"http://lpml.sourceforge.net/DTD/lpml.dtd">
<!-- loncapafiles.lpml -->
-<!-- $Id: loncapafiles.lpml,v 1.1047 2023/11/19 21:28:18 raeburn Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.1048 2023/12/23 02:17:40 raeburn Exp $ -->
<!--
@@ -3765,6 +3765,7 @@
Docs_Search.tex;
Docs_Short_URLs.tex;
Docs_Simple_Problem.tex;
+Docs_Standard_Problem.tex;
Docs_String_Response.tex;
Docs_Supplemental.tex;
Docs_Uploading_From_Harddrive.tex;
@@ -3900,7 +3901,9 @@
Modify_Community_Owner.tex;
Modify_Course_Chgpasswd.tex;
Modify_Course_Credithours.tex;
+Modify_Course_Crsauthor.tex;
Modify_Course_Defaultauth.tex;
+Modify_Course_External_Tool.tex;
Modify_Course_Instcode.tex;
Modify_Course_LTI_Authen.tex;
Modify_Course_Owner.tex;
@@ -8516,6 +8519,7 @@
contact-new.png;
contact-new-22x22.png;
coprplot.png;
+crsauthor.png;
crsnew.png;
dialog-information.png;
docs-22x22.png;
@@ -8552,6 +8556,7 @@
grp_settings.png;
grp_tools.png;
helpdesk-access.png;
+impcrsau.png;
ims.png;
imsexport.png;
link-new-22x22.png;
Index: loncom/html/adm/help/tex/Docs_Standard_Problem.tex
+++ loncom/html/adm/help/tex/Docs_Standard_Problem.tex
\label{Docs_Standard_Problem}
A ``Standard Problem'' icon/link will be available when the Course Editor's
Assessment tab is the currently selectea tabd, if:
\begin{itemize}
\item The current user has an active Author or co-Author role
or
\item `In-course Authoring'' is set to be available in the course.
\end{itemize}
To create a new LON-CAPA problem in a specified Authoring Space proceed as follows:
\begin{enumerate}
\item Select \textbf{Course Editor} on the Inline Menu or
\includegraphics[width=0.03\paperwidth]{docs}
\textbf{Edit course contents}
within Main Menu.
\item On the in-line menu of the \textbf{Course Editor} screen,
click \fbox{Assessment}. Next click on
\includegraphics[width=0.03\paperwidth]{stdprob}
\textbf{Standard Problem}.
\item In the expanded box, select the location where the new file should be stored.
\end{enumerate}
If the Authoring Space's homeserver is hosting the current LON-CAPA session then
the file can be stored. Otherwise, pushing the ``Switch Server'' button will transfer
the session to the homeserver, so a new file can be created and stored.
Once a Authoring Space location is chosen, a directory (and optionally a new
sub-directory) can be selected, and a filename entered.
If the chosen location is the course's own Authoring Space, then a ``placeholder''
for a problem instance in the current folder can (optionally) be added. If added,
the title to display in the course's Contents Listing (and Editor) can be entered.
Choosing Yes for ``Use Template?'' will expand the display to permit
selection of one of LON-CAPA's standard templates as the initial contents of the
new file.
If a placeholder was added it will be appended to the existing items in the current
folder in the Course Editor. The new placeholder item will be
hidden from students until the ``hidden'' checkbox has been unchecked,
and the problem itself will have a status of ``published'',
i.e., the initial version will have been copied from the course's
``Authoring Space'' to its ``Published Resource Space'',
a default metadata file will have been created (and published)
including specifying restricting its use to just the current course.
After ``Create Problem'' is pushed the problem will be rendered in Authoring Space,
with button(s) available for launch of all editor(s) supported in the homeserver's domain.
Index: loncom/html/adm/help/tex/Modify_Course_Crsauthor.tex
+++ loncom/html/adm/help/tex/Modify_Course_Crsauthor.tex
\label{Modify_Course_Crsauthor}
For each type of course container, Course/Community defaults in a domain's configuration determine whether ``Course Resource'' is available as a location for a new standard problem created via the Course Editor. The same setting will also determine whether an ``Import from Course Resources'' icon/link is available, by default, in the Import tab in the Course Editor.
A domain's default availability for each course's ``Course Authoring Space'' may be overridden on a course-by-course basis by checking "Use course-specific setting" in the ``In-course authoring of standard LON-CAPA problems'' accessed via the "View or modify a course or community" item (Main Menu).
Index: loncom/html/adm/help/tex/Modify_Course_External_Tool.tex
+++ loncom/html/adm/help/tex/Modify_Course_External_Tool.tex
\label{Modify_Course_External_Tool}
External Tools can be created in a domain by adding definitions to the ``Provider panel'' in the domain configuration for ``External Tools (LTI)'' available via ``Main Menu'' $>$ ``Set domain configuration''.
Course/Community defaults in a domain's configuration determine whether external tools defined in the domain are available by default, for use in each type of course container. A second default determines whether external tool definitions may be created by Course Coordinators in each of the container types.
A Domain Coordinator can choose to override the domain defaults on a course-by-course basis by checking ``Use course-specific setting'' in the ``External Tool permissions'' menu, accessed via the ``View or modify a course or community'' item (Main Menu). When that is done one of the following options can be chosen:
\begin{itemize}
\item External tools defined/configured in either domain or course may be used
\item Only external tools defined in domain may be used
\item Only external tools defined in course may be used
\item Use of external tools not permitted
\end{itemize}
More information about the LON-CAPA-cvs
mailing list