--- loncom/interface/lonparmset.pm 2007/09/11 01:59:30 1.381
+++ loncom/interface/lonparmset.pm 2007/10/17 00:27:44 1.383
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.381 2007/09/11 01:59:30 albertel Exp $
+# $Id: lonparmset.pm,v 1.383 2007/10/17 00:27:44 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2124,9 +2124,19 @@ sub crsenv {
if ($name eq 'cloners') {
&change_clone($value,\@oldcloner);
}
- # Flush the course logs so course description is immediately updated
+ # Update environment and nohist_courseids.db
if ($name eq 'description' && defined($value)) {
- &Apache::lonnet::flushcourselogs();
+ my %crsinfo =
+ &Apache::lonnet::courseiddump($dom,'.',1,'.','.',
+ $crs,undef,undef,'Course');
+ &Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.description' => $value);
+ if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') {
+ $crsinfo{$env{'request.course.id'}}{'description'} = $value;
+ my $chome = &Apache::lonnet::homeserver($crs,$dom);
+ my $putresult =
+ &Apache::lonnet::courseidput($dom,\%crsinfo,
+ $chome,'notime');
+ }
}
} else {
$setoutput.=&mt('Unable to set').' '.$name.' '.&mt('to').
@@ -2729,30 +2739,11 @@ sub listdata {
''.
&date_sanity_info($$resourcedata{$thiskey})
);
- } elsif ($thistype eq 'string_yesno') {
- my $showval;
- if (defined($$resourcedata{$thiskey})) {
- $showval=$$resourcedata{$thiskey};
- }
- $r->print(' ');
- $r->print('');
+ } elsif ($thistype =~ m/^string/) {
+ $r->print(&string_selector($thistype,$thiskey,
+ $$resourcedata{$thiskey}));
} else {
- my $showval;
- if (defined($$resourcedata{$thiskey})) {
- $showval=$$resourcedata{$thiskey};
- }
- $r->print('');
+ $r->print(&default_selector($thiskey,$$resourcedata{$thiskey}));
}
$r->print('');
@@ -2762,6 +2753,43 @@ sub listdata {
return $foundkeys;
}
+sub default_selector {
+ my ($thiskey, $showval) = @_;
+ return '' ;
+}
+
+my %strings =
+ (
+ 'string_yesno'
+ => [[ 'yes', 'Yes' ],
+ [ 'no', 'No' ]],
+ 'string_problemstatus'
+ => [[ 'yes', 'Yes' ],
+ [ 'no', 'No, don\'t show correct/incorrect feedback.' ],
+ [ 'no_feedback_ever', 'No, show no feedback at all.' ]],
+ );
+
+
+sub string_selector {
+ my ($thistype, $thiskey, $showval) = @_;
+
+ if (!exists($strings{$thistype})) {
+ return &default_selector($thiskey,$showval);
+ }
+
+ my $result;
+ foreach my $possibilities (@{ $strings{$thistype} }) {
+ my ($name, $description) = @{ $possibilities };
+ $result .= '