--- /d/CairoRelease/lib/TWiki/Form.pm 2004-08-08 02:47:45.000000000 +0200
+++ /d/TWiki/lib/TWiki/Form.pm 2005-04-13 11:57:08.828125000 +0200
@@ -181,6 +181,8 @@
# Read topic that defines the form
if( &TWiki::Store::topicExists( $webName, $form ) ) {
my( $meta, $text ) = &TWiki::Store::readTopic( $webName, $form );
+ $text = TWiki::handleCommonTags( $text, $form, $webName );
+ #$text =~ s/\%SEARCH{(.*?)}%/&TWiki::handleSearchWeb($1, $webName, $form)/geo;
@fieldDefs = getFormDefinition( $text );
} else {
# FIXME - do what if there is an error?
@@ -194,7 +196,7 @@
my( $name, $title, $type, $size, $posValuesS, $tooltip, $attributes ) = @fieldDef;
my @posValues = ();
if( $posValuesS ) {
- @posValues = split( /,\s*/, $posValuesS );
+ @posValues = split( /,\s*/, $posValuesS );
}
if( ( ! @posValues ) && &TWiki::Store::topicExists( $webName, $name ) ) {
@@ -383,6 +385,28 @@
$val =~ s/%DEFAULTOPTION%//go;
}
$value = "";
+ } elsif( $type eq "multi" ) {
+ my $val = "";
+ my $matched = "";
+ my $defaultMarker = "%DEFAULTOPTION%";
+ #&TWiki::Func::writeDebug("Form.pm edit: value = $value; fieldInfo=" . join(", ", @fieldInfo));
+ foreach my $item ( @fieldInfo ) {
+ my $selected = $defaultMarker;
+ if( $value =~ /(^|,\s*)\Q$item\E(,|$)/ ) {
+ $selected = ' selected="selected"';
+ $matched = $item;
+ }
+ $defaultMarker = "";
+ $item =~ s/$val";
+ $extra = qq[
\n(multiple selections)\n];
} elsif( $type =~ "^checkbox" ) {
if( $type eq "checkbox+buttons" ) {
my $boxes = $#fieldInfo + 1;
@@ -504,6 +528,9 @@
my $value = $query->param( $fieldName );
my $cvalue = "";
+ if ( defined($value) && $type eq "multi" ) {
+ $value = join(", ", $query->param($fieldName));
+ }
if( ! $value && $type =~ "^checkbox" ) {
foreach my $name ( @fieldInfo ) {
my $cleanName = $name;
@@ -682,6 +709,8 @@
}
}
+ } elsif( $cmd[0] eq "multi" ) {
+ &TWiki::Func::writeDebug("Form.pm: updateCategory for multi???");
} elsif( $cmd[0] eq "checkbox" ) {
$catname = $cmd[1];
$scatname = $catname;
--- /d/CairoRelease/lib/TWiki/Plugins/EditTablePlugin.pm 2004-07-31 02:16:12.000000000 +0200
+++ /d/TWiki/lib/TWiki/Plugins/EditTablePlugin.pm 2005-04-07 16:30:52.753000000 +0200
@@ -467,6 +467,7 @@
sub parseEditCellFormat
{
$_[1] = &TWiki::Func::extractNameValuePair( $_[0] );
+ $debug and &TWiki::Func::writeDebug( "- TWiki::Plugins::EditTablePlugin::parseEditCellFormat( $_[0] )" );
return "";
}
@@ -505,6 +506,7 @@
{
my ( $theFormat, $theName ) = @_;
return "" unless( $theFormat );
+ $theFormat =~ s//p>/g;
$theName =~ s/cell/format/;
return "";
}
@@ -542,7 +544,37 @@
my $sel = "";
my $style = "";
$style = " style='background:#e8e8e8'" if ($theRowNr % 2);
- if( $type eq "select" ) {
+ if( $type eq "multi" ) {
+ my $expandedValue = &TWiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb );
+ my %selected;
+ for my $e (split(/,\s*/, $theValue)) {
+ $e =~ s/\A\s+//;
+ $e =~ s/\s+\Z//;
+ $selected{$e}++;
+ $debug and &TWiki::Func::writeDebug( "- TWiki::Plugins::EditTablePlugin::selected $e" );
+ }
+ {
+ local ($")="; ";
+ $debug and &TWiki::Func::writeDebug( "- TWiki::Plugins::EditTablePlugin::bits @bits" );
+ $debug and &TWiki::Func::writeDebug( "- TWiki::Plugins::EditTablePlugin::bitsExpanded @bitsExpanded" );
+ }
+ $size = @bits-2 if $size < 3;
+ $text = "";
+ $text .= saveEditCellFormat( $cellFormat, $theName );
+
+ } elsif( $type eq "select" ) {
my $expandedValue = &TWiki::Func::expandCommonVariables( $theValue, $theTopic, $theWeb );
$size = 1 if $size < 1;
$text = "