From: Mike G. v. a. <we...@ma...> - 2005-12-27 00:37:45
|
Log Message: ----------- Added popuplist widget to Config.pm. Modified Constants.pm to allow choice of theme from a pop up menu. Modified Files: -------------- webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor: Config.pm Revision Data ------------- Index: Config.pm =================================================================== RCS file: /webwork/cvs/system/webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/Config.pm,v retrieving revision 1.5 retrieving revision 1.6 diff -Llib/WeBWorK/ContentGenerator/Instructor/Config.pm -Llib/WeBWorK/ContentGenerator/Instructor/Config.pm -u -r1.5 -r1.6 --- lib/WeBWorK/ContentGenerator/Instructor/Config.pm +++ lib/WeBWorK/ContentGenerator/Instructor/Config.pm @@ -343,6 +343,58 @@ ); } +########################### configpopuplist +package configpopuplist; +@configpopuplist::ISA = qw(configobject); + +sub display_value { + my ($self, $val) = @_; + $val = 'ur' if not defined($val); + return join(CGI::br(), $val); +} + +# here r->param() returns an array, so we need a custom +# version of convert_newval_source + +# sub convert_newval_source { +# my ($self, $newvalsource) = @_; +# my $inlinevarname = WeBWorK::ContentGenerator::Instructor::Config::inline_var($self->{var}); +# my @newvals; +# if($newvalsource =~ /widget/) { +# @newvals = $self->{Module}->{r}->param($newvalsource); +# } else { +# my $newval = eval('$self->{Module}->{r}->{ce}->'. $inlinevarname); +# @newvals = @$newval; +# } +# return(@newvals); +# } + +sub save_string { + my ($self, $oldval, $newvalsource) = @_; + my $varname = $self->{var}; + my $newval = $self->convert_newval_source($newvalsource); + my $displayoldval = $self->comparison_value($oldval); + return '' if($displayoldval eq $newval); + return('$'. $varname . " = " . "'$newval';\n"); +} + +# sub comparison_value { +# my ($self, $val) = @_; +# $val = 'ur' if not defined($val); +# my $str = join(',', @{$val}); +# return($str); +# } + +sub entry_widget { + my ($self, $name, $default) = @_; + return CGI::popup_menu( + -name => $name, + -value => $self->{values}, + -default => $default, + + ); +} + ########### Main Config Package starts here package WeBWorK::ContentGenerator::Instructor::Config; |