--- loncom/interface/courseprefs.pm 2015/09/13 19:55:34 1.73
+++ loncom/interface/courseprefs.pm 2016/05/13 22:57:45 1.79
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set configuration settings for a course
#
-# $Id: courseprefs.pm,v 1.73 2015/09/13 19:55:34 raeburn Exp $
+# $Id: courseprefs.pm,v 1.79 2016/05/13 22:57:45 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -419,6 +419,7 @@ sub handler {
{ text => 'Discussion and Chat',
help => 'Course_Prefs_Discussions',
ordered => ['pch.roles.denied','pch.users.denied',
+ 'pac.roles.denied','pac.users.denied',
'plc.roles.denied','plc.users.denied',
'allow_limited_html_in_feedback',
'allow_discussion_post_editing',
@@ -428,9 +429,11 @@ sub handler {
'pch.users.denied' => 'No Resource Discussion',
'plc.roles.denied' => 'No Chat room use',
'plc.users.denied' => 'No Chat room use',
+ 'pac.roles.denied' => 'No Anonymous Resource Discussion',
+ 'pac.users.denied' => 'No Anonymous Resource Discussion',
allow_limited_html_in_feedback => 'Allow limited HTML in discussion',
allow_discussion_post_editing => 'Users can edit/delete own discussion posts',
- discussion_post_fonts => 'Discussion post fonts based on likes/unlikes',
+ discussion_post_fonts => 'Discussion post fonts based on likes/unlikes',
},
},
'classlists' =>
@@ -1021,7 +1024,8 @@ sub process_changes {
}
}
}
- } elsif (($entry eq 'plc.roles.denied') || ($entry eq 'pch.roles.denied')) {
+ } elsif (($entry eq 'plc.roles.denied') || ($entry eq 'pch.roles.denied') ||
+ ($entry eq 'pac.roles.denied')) {
my @denied = &Apache::loncommon::get_env_multiple('form.'.$entry);
@denied = sort(@denied);
my $deniedstr = '';
@@ -1029,7 +1033,8 @@ sub process_changes {
$deniedstr = join(',',@denied);
}
$newvalues{$entry} = $deniedstr;
- } elsif (($entry eq 'plc.users.denied') || ($entry eq 'pch.users.denied')) {
+ } elsif (($entry eq 'plc.users.denied') || ($entry eq 'pch.users.denied') ||
+ ($entry eq 'pac.users.denied')) {
my $total = $env{'form.'.$entry.'_total'};
my $userstr = '';
my @denied;
@@ -2557,29 +2562,52 @@ sub display_loncaparev_constraints {
if (grep(/^\Q$value\E$/,@{$Apache::lonrelrequtils::checkparms{$item}})) {
my $stdtype = &Apache::lonparmset::standard_parameter_types($item);
$found{$item}{'valname'} = &get_param_description($stdtype,$value);
- $found{$item}{'rev'} = $Apache::lonnet::needsrelease{'parameter:'.$item.':'.$value.':'};
+ $found{$item}{'rev'} = $Apache::lonnet::needsrelease{'parameter:'.$item.':'.$value.'::'};
}
}
}
}
- foreach my $item (keys(%Apache::lonrelrequtils::checkparmsmatch)) {
- if (ref($Apache::lonrelrequtils::checkparmsmatch{$item}) eq 'ARRAY') {
+ foreach my $item (keys(%Apache::lonrelrequtils::checkparmvalsmatch)) {
+ if (ref($Apache::lonrelrequtils::checkparmvalsmatch{$item}) eq 'ARRAY') {
my $value = $resourcedata->{$key};
- foreach my $valuematch (@{$Apache::lonrelrequtils::checkparmsmatch{$item}}) {
+ foreach my $valuematch (@{$Apache::lonrelrequtils::checkparmvalsmatch{$item}}) {
if ($value =~ /$valuematch/) {
my $stdtype = &Apache::lonparmset::standard_parameter_types($item);
- $found{$item}{'valname'} = &get_param_description($stdtype,$value,1);
+ $found{$item}{'valname'} = &get_param_description($stdtype,$value,1);
$found{$item}{'rev'} =
- $Apache::lonnet::needsrelease{'parameter:'.$item.'::'.$valuematch};
+ $Apache::lonnet::needsrelease{'parameter:'.$item.'::'.$valuematch.':'};
last;
}
}
}
}
+ foreach my $item (keys(%Apache::lonrelrequtils::checkparmnamesmatch)) {
+ my $regexp;
+ if ($item eq 'maplevelrecurse') {
+ $regexp = '\.(?:sequence|page)___\(rec\)\.';
+ }
+ if ($regexp ne '') {
+ if ($key =~ /$regexp.*\.(\w+)$/) {
+ my $name = $1;
+ my $value = $resourcedata->{$key};
+ if ($name eq 'type') {
+ last unless (($value eq 'problem') || ($value eq 'practice') || ($value eq 'exam') ||
+ ($value eq 'survey') || ($value eq 'surveycred') || ($value eq 'anonsurvey') ||
+ ($value eq 'anonsurveycred') || ($value eq 'randomizetry') || ($value eq 'library'));
+ }
+ my $stdtype = &Apache::lonparmset::standard_parameter_types($name);
+ $found{$name}{'valname'} = &get_param_description($stdtype,$value);
+ $found{$name}{'extra'} = &mt('Recursive into sub-folders');
+ $found{$name}{'rev'} =
+ $Apache::lonnet::needsrelease{'parameter::::'.$item};
+ }
+ }
+ }
foreach my $item (keys(%found)) {
my $stdname = &Apache::lonparmset::standard_parameter_names($item);
my $rev = $found{$item}{'rev'};
my $valname = $found{$item}{'valname'};
+ my $extra = $found{$item}{'extra'};
my ($middle,$scope,$which,$level,$map,$resource);
my $start = $cid.'.';
if ($key =~ /^\Q$start\E(\[useropt\:($match_username\:$match_domain)\]\.)/) {
@@ -2594,6 +2622,9 @@ sub display_loncaparev_constraints {
$scope = 'all';
}
my $what="$stdname=$valname";
+ if ($extra) {
+ $what .= "
$extra
";
+ }
if ($key =~ /^\Q$start$middle\E\w+\.\Q$item\E$/) {
$level = 'general';
if ($scope eq 'all') {
@@ -2614,7 +2645,7 @@ sub display_loncaparev_constraints {
}
}
$rowspan{$rev} ++;
- } elsif ($key =~ /^\Q$start$middle\E(.+)___\(all\).\w+\.\Q$item\E$/) {
+ } elsif ($key =~ /^\Q$start$middle\E(.+)___\((all|rec)\).\w+\.\Q$item\E$/) {
$level = 'folder';
$map = $1;
if ($scope eq 'all') {
@@ -2769,9 +2800,9 @@ sub display_loncaparev_constraints {
if (defined($navmap)) {
my %anonsubms=&Apache::lonnet::dump('nohist_anonsurveys',$cdom,$cnum);
- my $rev_anonsurv=$Apache::lonnet::needsrelease{'parameter:type:anonsurvey'};
+ my $rev_anonsurv=$Apache::lonnet::needsrelease{'parameter:type:anonsurvey::'};
my %randtrysubms=&Apache::lonnet::dump('nohist_randomizetry',$cdom,$cnum);
- my $rev_randtry=$Apache::lonnet::needsrelease{'parameter:type:randomizetry'};
+ my $rev_randtry=$Apache::lonnet::needsrelease{'parameter:type:randomizetry::'};
my $stdtype=&Apache::lonparmset::standard_parameter_types('type');
my $stdname=&Apache::lonparmset::standard_parameter_names('type');
my $valanon=&get_param_description($stdtype,'anonsurvey');
@@ -3083,9 +3114,17 @@ sub releases_by_map {
sub get_param_description {
my ($stdtype,$value,$regexp) = @_;
my ($name,$parammatches,$paramstrings,@possibles);
- $paramstrings = &Apache::lonparmset::standard_string_options($stdtype);
+ if ($stdtype =~ /^string/) {
+ $paramstrings = &Apache::lonparmset::standard_string_options($stdtype);
+ } elsif ($stdtype eq 'date_interval') {
+ $paramstrings = &Apache::lonparmset::standard_interval_options($stdtype);
+ }
if ($regexp) {
- $parammatches = &Apache::lonparmset::standard_string_matches($stdtype);
+ if ($stdtype =~ /^string/) {
+ $parammatches = &Apache::lonparmset::standard_string_matches($stdtype);
+ } elsif ($stdtype eq 'date_interval') {
+ $parammatches = &Apache::lonparmset::standard_interval_matches($stdtype);
+ }
if (ref($parammatches) eq 'ARRAY') {
@possibles = @{$parammatches};
} else {
@@ -3098,6 +3137,13 @@ sub get_param_description {
if (ref($paramstrings) eq 'ARRAY') {
@possibles = @{$paramstrings};
} else {
+ if (($stdtype eq 'date_start') || ($stdtype eq 'date_end')) {
+ if ($name == 0) {
+ $name = &mt('Never');
+ } elsif (($name ne '') && ($name !~ /\D/)) {
+ $name = &Apache::lonlocal::locallocaltime($name);
+ }
+ }
return $name;
}
}
@@ -3576,6 +3622,20 @@ sub print_discussion {
&mt('(specific user(s))'),
input => 'checkbox',
},
+
+ 'pac.roles.denied' => {
+ text => ''.&mt($itemtext->{'pac.roles.denied'}).''.
+ &Apache::loncommon::help_open_topic("Course_Disable_Anonymous_Discussion").'
'.
+ &mt('(role-based)'),
+ input => 'checkbox',
+ },
+
+ 'pac.users.denied' => {
+ text => ''.&mt($itemtext->{'pac.users.denied'}).'
'.
+ &mt('(specific user(s))'),
+ input => 'checkbox',
+ },
+
'allow_limited_html_in_feedback' => {
text => ''.&mt($itemtext->{'allow_limited_html_in_feedback'}).'',
input => 'radio',
@@ -3626,6 +3686,14 @@ sub print_discussion {
$datatable .= '