--- lib/TWiki/Plugins/ActionTrackerPlugin/Action.pm.beforekent 2008-10-23 23:17:04.000000000 -0700 +++ lib/TWiki/Plugins/ActionTrackerPlugin/Action.pm 2009-08-17 17:32:29.000000000 -0700 @@ -634,6 +634,51 @@ return formatTime( $this->{$fld}, 'string' ); } +# PRIVATE format the given select box type +sub _formatType_select { + my ( $this, $fld, $args, $asHTML ) = @_; + + # Old behavior is to simply return the text as usual. + # Do this anyway if the state field isn't being allowed + # to edit on the fly without going to edit mode. + require TWiki::Plugins::ActionTrackerPlugin::Options; + unless ($TWiki::Plugins::ActionTrackerPlugin::Options::options{ENABLESTATESHORTCUT}) { + return (defined $this->{$fld}) ? $this->{$fld} : ''; + } + + # Turn the select into a fully populated drop down box + my $type = $this->getType( $fld ); + my $size = $type->{size}; + my $fields = ''; + my $any_selected = 0; + foreach my $option ( @{$type->{values}} ) { + my @extras = (); + if ( defined( $this->{$fld} ) && + $this->{$fld} eq $option ) { + push( @extras, selected => "selected" ); + $any_selected = 1; + } + $fields .= CGI::option({ value=>$option, @extras }, $option); + } + + # If nothing was selected, add an empty selection at the top + # That way, it can display a blank box, but can be changed. + # Ones with a value already can not be changed to blank. + if (!$any_selected) { + $fields = CGI::option({ value=>"NuLL", selected=>"selected" }, "") . $fields; + } + + return CGI::Select( + { name => $fld, + size => $size, + onChange => 'atp_update(this, "%SCRIPTURLPATH{rest}%/ActionTrackerPlugin/update?topic='. + $this->{web}.'.'.$this->{topic}. + ';uid='.$this->{uid}.'", "' . $fld . '")', + }, + $fields ); + +} + sub _formatField_formfield { my ( $this, $args, $asHTML ) = @_;