'.
@@ -1230,7 +1289,7 @@ ENDTABLEHEADFOUR
&print_row($r,$_,\%part,\%name,$rid,\%default,
\%type,\%display,$defbgone,$defbgtwo,
- $parmlev);
+ $parmlev,$uname,$udom,$csec);
}
}
}
@@ -1338,7 +1397,7 @@ ENDMAPONE
$r->print('');
&print_row($r,$_,\%part,\%name,$mapid,\%default,
\%type,\%display,$defbgone,$defbgtwo,
- $parmlev);
+ $parmlev,$uname,$udom,$csec);
# $r->print(" resource.$part{$_}.$name{$_},$symbp{$mapid} | \n");
}
$r->print("");
@@ -1415,7 +1474,7 @@ ENDMAPONE
foreach (sort keys %name) {
$r->print('');
&print_row($r,$_,\%part,\%name,$mapid,\%default,
- \%type,\%display,$defbgone,$defbgtwo,$parmlev);
+ \%type,\%display,$defbgone,$defbgtwo,$parmlev,$uname,$udom,$csec);
# $r->print(" resource.$part{$_}.$name{$_},$symbp{$mapid} | \n");
}
$r->print("");
@@ -1450,17 +1509,17 @@ sub crsenv {
my $setoutput='';
my $bodytag=&Apache::loncommon::bodytag(
'Set Course Environment Parameters');
- my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
- my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
+ my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
#
# Go through list of changes
- foreach (keys %ENV) {
+ foreach (keys %env) {
next if ($_!~/^form\.(.+)\_setparmval$/);
my $name = $1;
- my $value = $ENV{'form.'.$name.'_value'};
+ my $value = $env{'form.'.$name.'_value'};
if ($name eq 'newp') {
- $name = $ENV{'form.newp_name'};
+ $name = $env{'form.newp_name'};
}
if ($name eq 'url') {
$value=~s/^\/res\///;
@@ -1500,13 +1559,34 @@ sub crsenv {
if ($name =~ /^default_enrollment_(start|end)_date$/) {
$value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value');
}
+ # Get existing cloners
+ my @oldcloner = ();
+ if ($name eq 'cloners') {
+ my %clonenames=&Apache::lonnet::dump('environment',$dom,$crs,'cloners');
+ if ($clonenames{'cloners'} =~ /,/) {
+ @oldcloner = split/,/,$clonenames{'cloners'};
+ } else {
+ $oldcloner[0] = $clonenames{'cloners'};
+ }
+ }
#
# Let the user know we made the changes
if ($name && defined($value)) {
+ if ($name eq 'cloners') {
+ $value =~ s/^,//;
+ $value =~ s/,$//;
+ }
my $put_result = &Apache::lonnet::put('environment',
{$name=>$value},$dom,$crs);
if ($put_result eq 'ok') {
$setoutput.=&mt('Set').' '.$name.' '.&mt('to').' '.$value.'. ';
+ if ($name eq 'cloners') {
+ &change_clone($value,\@oldcloner);
+ }
+ # Flush the course logs so course description is immediately updated
+ if ($name eq 'description' && defined($value)) {
+ &Apache::lonnet::flushcourselogs();
+ }
} else {
$setoutput.=&mt('Unable to set').' '.$name.' '.&mt('to').
' '.$value.' '.&mt('due to').' '.$put_result.'. ';
@@ -1515,7 +1595,7 @@ sub crsenv {
}
# ------------------------- Re-init course environment entries for this session
- &Apache::lonnet::coursedescription($ENV{'request.course.id'});
+ &Apache::lonnet::coursedescription($env{'request.course.id'});
# -------------------------------------------------------- Get parameters again
@@ -1535,6 +1615,7 @@ sub crsenv {
'courseid' => ''.&mt('Course ID or number').
' '.
'('.&mt('internal').', '.&mt('optional').')',
+ 'cloners' => ''.&mt('Users allowed to clone course').' (user:domain,user:domain) '.&mt('Users with active Course Coordinator role in the course automatically have the right to clone it, and can be omitted from list.'),
'grading' => ''.&mt('Grading').' '.
'"standard", "external", or "spreadsheet" '.&Apache::loncommon::help_open_topic('GradingOptions'),
'default_xml_style' => ''.&mt('Default XML Style File').' '.
@@ -1592,6 +1673,9 @@ sub crsenv {
'allow_limited_html_in_feedback'
=> ''.&mt('Allow limited HTML in discussion posts').' '.
'('.&mt('Set value to "[_1]" to allow',"yes").')',
+ 'allow_discussion_post_editing'
+ => ''.&mt('Allow users to edit/delete their own discussion posts').' '.
+ '('.&mt('Set value to "[_1]" to allow',"yes").')',
'rndseed'
=> ''.&mt('Randomization algorithm used').' '.
''.&mt('Modifying this will make problems').' '.
@@ -1627,13 +1711,14 @@ sub crsenv {
'tthoptions'
=> ''.&mt('Default set of options to pass to tth/m when converting tex').''
);
- my @Display_Order = ('url','description','courseid','grading',
+ my @Display_Order = ('url','description','courseid','cloners','grading',
'default_xml_style','pageseparators',
'question.email','comment.email','policy.email',
'student_classlist_view',
'plc.roles.denied','plc.users.denied',
'pch.roles.denied','pch.users.denied',
'allow_limited_html_in_feedback',
+ 'allow_discussion_post_editing',
'languages',
'nothideprivileged',
'rndseed',
@@ -1705,12 +1790,13 @@ sub crsenv {
my $Value=&mt('Value');
my $Set=&mt('Set');
my $browse_js=&Apache::loncommon::browser_and_searcher_javascript('parmset');
- $r->print(<
+ my $html=&Apache::lonxml::xmlbegin();
+ $r->print(<
-
LON-CAPA Course Environment
$bodytag
@@ -1725,7 +1811,7 @@ $output
|