'."\n");
+ ' align="center">');
+ if ($which<10) {
+ $r->print(&plink($$typeoutpar[$which],
+ $$display{$value},$$outpar[$which],
+ $mprefix."$which",'parmform.pres','psub'));
+ } else {
+ $r->print(&valout($$outpar[$which],$$typeoutpar[$which]));
+ }
+ $r->print(''."\n");
}
sub get_env_multiple {
@@ -728,8 +734,8 @@ sub assessparms {
"Unknown user '$uname' at domain '$udom'";
$uname='';
} else {
- $csec=&Apache::lonnet::usection($udom,$uname,
- $ENV{'request.course.id'});
+ $csec=&Apache::lonnet::getsection($udom,$uname,
+ $ENV{'request.course.id'});
if ($csec eq '-1') {
$message="".
"User '$uname' at domain '$udom' not ".
@@ -852,12 +858,13 @@ sub assessparms {
$message.="Write Error: $1";
}
# ---------------------------------------------------------------- Done storing
- $message.='
Changes can take up to 10 minutes before being active for all students
';
+ $message.='
Changes can take up to 10 minutes before being active for all students.'.&Apache::loncommon::help_open_topic('Caching').'
';
}
# --------------------------------------------- Devalidate cache for this child
- &Apache::lonnet::devalidatecourseresdata(
+ &Apache::lonnet::devalidatecourseresdata(
$ENV{'course.'.$ENV{'request.course.id'}.'.num'},
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'});
+ &Apache::lonnet::clear_EXT_cache_status();
# -------------------------------------------------------------- Get coursedata
%courseopt = &Apache::lonnet::dump
('resourcedata',
@@ -891,7 +898,11 @@ sub assessparms {
&startpage($r,$id,$udom,$csec,$uname,$have_assesments);
- if (!$have_assesments) { return ''; }
+ if (!$have_assesments) {
+ untie(%bighash);
+ untie(%parmhash);
+ return '';
+ }
# if ($ENV{'form.url'}) {
# $r->print('');
@@ -1371,7 +1382,7 @@ ENDMAPONE
=item crsenv
-Show course data and parameters. This is a large routine that should
+Show and set course data and parameters. This is a large routine that should
be simplified and shortened... someday.
Inputs: $r
@@ -1389,50 +1400,71 @@ sub crsenv {
'Set Course Environment Parameters');
my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
-# -------------------------------------------------- Go through list of changes
+
+ #
+ # Go through list of changes
foreach (keys %ENV) {
- if ($_=~/^form\.(.+)\_setparmval$/) {
- my $name=$1;
- my $value=$ENV{'form.'.$name.'_value'};
- if ($name eq 'newp') {
- $name=$ENV{'form.newp_name'};
- }
- if ($name eq 'url') {
- $value=~s/^\/res\///;
- my $bkuptime=time;
- my @tmp = &Apache::lonnet::get
- ('environment',['url'],$dom,$crs);
- $setoutput.='Backing up previous URL: '.
- &Apache::lonnet::put
- ('environment',
- {'top level map backup '.$bkuptime => $tmp[1] },
- $dom,$crs).
- ' ';
+ next if ($_!~/^form\.(.+)\_setparmval$/);
+ my $name = $1;
+ my $value = $ENV{'form.'.$name.'_value'};
+ if ($name eq 'newp') {
+ $name = $ENV{'form.newp_name'};
+ }
+ if ($name eq 'url') {
+ $value=~s/^\/res\///;
+ my $bkuptime=time;
+ my @tmp = &Apache::lonnet::get
+ ('environment',['url'],$dom,$crs);
+ $setoutput.='Backing up previous URL: '.
+ &Apache::lonnet::put
+ ('environment',
+ {'top level map backup '.$bkuptime => $tmp[1] },
+ $dom,$crs).
+ ' ';
+ }
+ #
+ # Deal with modified default spreadsheets
+ if ($name =~ /^spreadsheet_default_(classcalc|
+ studentcalc|
+ assesscalc)$/x) {
+ my $sheettype = $1;
+ if ($sheettype eq 'classcalc') {
+ # no need to do anything since viewing the sheet will
+ # cause it to be updated.
+ } elsif ($sheettype eq 'studentcalc') {
+ # expire all the student spreadsheets
+ &Apache::lonnet::expirespread('','','studentcalc');
+ } else {
+ # expire all the assessment spreadsheets
+ # this includes non-default spreadsheets, but better to
+ # be safe than sorry.
+ &Apache::lonnet::expirespread('','','assesscalc');
+ # expire all the student spreadsheets
+ &Apache::lonnet::expirespread('','','studentcalc');
}
- if ($name =~ /^spreadsheet_default_(classcalc|
- studentcalc|
- assesscalc)$/x) {
- my $sheettype = $1;
- if ($sheettype eq 'classcalc') {
- # no need to do anything since viewing the sheet will
- # cause it to be updated.
- } elsif ($sheettype eq 'studentcalc') {
- # expire all the student spreadsheets
- &Apache::lonnet::expirespread('','','studentcalc');
- } else {
- # expire all the default assessment spreadsheets
- }
+ }
+ #
+ # Deal with the enrollment dates
+ if ($name =~ /^default_enrollment_(start|end)_date$/) {
+ $value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value');
+ }
+ #
+ # Let the user know we made the changes
+ if ($name) {
+ my $put_result = &Apache::lonnet::put('environment',
+ {$name=>$value},$dom,$crs);
+ if ($put_result eq 'ok') {
+ $setoutput.='Set '.$name.' to '.$value.'. ';
+ } else {
+ $setoutput.='Unable to set '.$name.' to '.
+ ''.$value.' due to '.$put_result.'. ';
}
-
- if ($name) {
- $setoutput.='Setting '.$name.' to '.
- $value.': '.
- &Apache::lonnet::put
- ('environment',{$name=>$value},$dom,$crs).
- ' ';
- }
}
}
+# ------------------------- Re-init course environment entries for this session
+
+ &Apache::lonnet::coursedescription($ENV{'request.course.id'});
+
# -------------------------------------------------------- Get parameters again
my %values=&Apache::lonnet::dump('environment',$dom,$crs);
@@ -1448,6 +1480,10 @@ sub crsenv {
'description' => 'Course Description',
'courseid' => 'Course ID or number '.
'(internal, optional)',
+ 'grading' => 'Grading'.
+ '"standard" or any other value. '.
+ 'Default for new courses is "standard".',
+
'default_xml_style' => 'Default XML Style File '.
' 'Visibly Separate Items on Pages '.
'("yes" for visible separation, '.
'changes will not show until next login)',
+
+ 'plc.roles.denied'=> 'Disallow live chatroom use for '.
+ 'Roles "st": '.
+ 'student, "ta": '.
+ 'TA, "in": '.
+ 'instructor; role,role,...) '.
+ Apache::loncommon::help_open_topic("Course_Disable_Discussion"),
+ 'plc.users.denied' =>
+ 'Disallow live chatroom use for Users '.
+ '(user:domain,user:domain,...)',
+
'pch.roles.denied'=> 'Disallow Resource Discussion for '.
'Roles "st": '.
'student, "ta": '.
@@ -1490,30 +1537,73 @@ sub crsenv {
",'spreadsheet')\">Select Spreadsheet File ",
'allow_limited_html_in_feedback'
=> 'Allow limited HTML in discussion posts '.
- '(Set value to yes to allow)',
+ '(Set value to "yes" to allow)',
'rndseed'
=> 'Randomization algorithm used '.
'Modifying this will make problems '.
'have different numbers and answers',
'problem_stream_switch'
- => 'Allow problems to be splitted over pages '.
- ' (yes if allow anything else if not)'
- );
- foreach (keys(%values)) {
- unless ($descriptions{$_}) {
- $descriptions{$_}=$_;
+ => 'Allow problems to be split over pages '.
+ ' ("yes" if allowed, anything else if not)',
+ 'anonymous_quiz'
+ => 'Anonimous quiz/exam '.
+ ' (yes to avoid print students names )',
+ 'default_enrollment_start_date' => 'Default beginning date '.
+ 'when enrolling students',
+ 'default_enrollment_end_date' => 'Default ending date '.
+ 'when enrolling students',
+ 'languages' => 'Languages used',
+ 'disable_receipt_display'
+ => 'Disable display of problem receipts '.
+ ' ("yes" to disable, anything else if not)'
+ );
+ my @Display_Order = ('url','description','courseid','grading',
+ 'default_xml_style','pageseparators',
+ 'question.email','comment.email','policy.email',
+ 'plc.roles.denied','plc.users.denied',
+ 'pch.roles.denied','pch.users.denied',
+ 'allow_limited_html_in_feedback',
+ 'languages',
+ 'rndseed',
+ 'problem_stream_switch',
+ 'disable_receipt_display',
+ 'spreadsheet_default_classcalc',
+ 'spreadsheet_default_studentcalc',
+ 'spreadsheet_default_assesscalc',
+ 'hideemptyrows',
+ 'default_enrollment_start_date',
+ 'default_enrollment_end_date',
+ );
+ foreach my $parameter (sort(keys(%values))) {
+ if (! $descriptions{$parameter}) {
+ $descriptions{$parameter}=$parameter;
+ push(@Display_Order,$parameter);
}
}
- foreach (sort keys %descriptions) {
+ foreach my $parameter (@Display_Order) {
+ my $description = $descriptions{$parameter};
# onchange is javascript to automatically check the 'Set' button.
my $onchange = 'onFocus="javascript:window.document.forms'.
- '[\'envform\'].elements[\''.$_.'_setparmval\']'.
+ "['envform'].elements['".$parameter."_setparmval']".
'.checked=true;"';
- $output.='