Skip to content

Commit

Permalink
Item11324: perltidy them all
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/branches/Release01x01@14060 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
PaulHarvey authored and PaulHarvey committed Feb 23, 2012
1 parent 64ac674 commit c7619e8
Show file tree
Hide file tree
Showing 13 changed files with 150 additions and 126 deletions.
9 changes: 4 additions & 5 deletions core/lib/Foswiki/Configure/Checkers/WorkingDir.pm
Expand Up @@ -39,14 +39,14 @@ sub check {
unless ( -d $d ) {
mkdir( untaint($d), oct(755) )
|| return $mess
. $this->ERROR( "$d does not exist, and I can't create it: $!" );
. $this->ERROR("$d does not exist, and I can't create it: $!");
$mess .= $this->NOTE("Created $d");
}

unless ( -d "$d/tmp" ) {
if ( -e "$d/tmp" ) {
$mess .=
$this->ERROR( "$d/tmp already exists, but is not a directory" );
$this->ERROR("$d/tmp already exists, but is not a directory");
}
elsif ( !mkdir( untaint("$d/tmp"), oct(1777) ) ) {
$mess .= $this->ERROR("Could not create $d/tmp");
Expand All @@ -59,7 +59,7 @@ sub check {
unless ( -d "$d/work_areas" ) {
if ( -e "$d/work_areas" ) {
$mess .= $this->ERROR(
"$d/work_areas already exists, but is not a directory" );
"$d/work_areas already exists, but is not a directory");
}
elsif ( !mkdir( untaint("$d/work_areas"), oct(755) ) ) {
$mess .= $this->ERROR("Could not create $d/work_areas");
Expand Down Expand Up @@ -97,8 +97,7 @@ the upgrade." );
);
}
elsif ( !mkdir( untaint("$d/registration_approvals"), oct(755) ) ) {
$mess .=
$this->ERROR( "Could not create $d/registration_approvals" );
$mess .= $this->ERROR("Could not create $d/registration_approvals");
}
}

Expand Down
41 changes: 22 additions & 19 deletions core/lib/Foswiki/Form/Checkbox.pm
Expand Up @@ -41,9 +41,9 @@ sub getOptions {
foreach my $val (@$vals) {
if ( $val =~ /^(.*?[^\\])=(.*)$/ ) {
$str = TAINT($1);
my $descr = $this->{_descriptions}{$val};
my $descr = $this->{_descriptions}{$val};
$val = $2;
$this->{_descriptions}{$val} = $descr;
$this->{_descriptions}{$val} = $descr;
$str =~ s/\\=/=/g;
}
else {
Expand All @@ -70,16 +70,17 @@ sub renderForDisplay {

$this->getOptions();

if ($this->isValueMapped()) {
my @vals = ();
foreach my $val (split(/\s*,\s*/, $value)) {
if ( defined( $this->{valueMap}{$val} ) ) {
push @vals, $this->{valueMap}{$val};
} else {
push @vals, $val;
if ( $this->isValueMapped() ) {
my @vals = ();
foreach my $val ( split( /\s*,\s*/, $value ) ) {
if ( defined( $this->{valueMap}{$val} ) ) {
push @vals, $this->{valueMap}{$val};
}
else {
push @vals, $val;
}
}
}
$value = join(", ", @vals);
$value = join( ", ", @vals );
}

return $this->SUPER::renderForDisplay( $format, $value, $attrs );
Expand Down Expand Up @@ -122,12 +123,14 @@ sub renderForEdit {
};

if ( $isSelected{$item} ) {
# One or the other; not both, or CGI generates two checked="checked"
if ($this->isValueMapped()) {
$attrs{$item}{checked} = 'checked';
} else {
push( @defaults, $item );
}

# One or the other; not both, or CGI generates two checked="checked"
if ( $this->isValueMapped() ) {
$attrs{$item}{checked} = 'checked';
}
else {
push( @defaults, $item );
}
}
}
my %params = (
Expand All @@ -137,8 +140,8 @@ sub renderForEdit {
-columns => $this->{size},
-attributes => \%attrs
);
if (defined $this->{valueMap}) {
$params{-labels} = $this->{valueMap};
if ( defined $this->{valueMap} ) {
$params{-labels} = $this->{valueMap};
}
$value = CGI::checkbox_group(%params);

Expand Down
12 changes: 6 additions & 6 deletions core/lib/Foswiki/Form/ListFieldDefinition.pm
Expand Up @@ -44,7 +44,7 @@ sub getOptions {

return $this->{_options} if $this->{_options};

my @vals = ();
my @vals = ();
my %descr = ();

@vals = split( /,/, $this->{value} );
Expand Down Expand Up @@ -75,10 +75,10 @@ sub getOptions {
$inBlock = 1;
}
elsif (/^\s*\|\s*([^|]*?)\s*\|(?:\s*([^|]*?)\s*\|)?/) {
if ($inBlock) {
push( @vals, TAINT($1) );
$descr{$1} = $2 if defined $2;
}
if ($inBlock) {
push( @vals, TAINT($1) );
$descr{$1} = $2 if defined $2;
}
}
else {
$inBlock = 0;
Expand All @@ -88,7 +88,7 @@ sub getOptions {
}
@vals = map { $_ =~ s/^\s*(.*)\s*$/$1/; $_; } @vals;

$this->{_options} = \@vals;
$this->{_options} = \@vals;
$this->{_descriptions} = \%descr;

return $this->{_options};
Expand Down
20 changes: 10 additions & 10 deletions core/lib/Foswiki/Form/Radio.pm
Expand Up @@ -44,9 +44,9 @@ sub getOptions {
foreach my $val (@$vals) {
if ( $val =~ /^(.*?[^\\])=(.*)$/ ) {
$str = TAINT($1);
my $descr = $this->{_descriptions}{$val};
my $descr = $this->{_descriptions}{$val};
$val = $2;
$this->{_descriptions}{$val} = $descr;
$this->{_descriptions}{$val} = $descr;
$str =~ s/\\=/=/g;
}
else {
Expand Down Expand Up @@ -89,17 +89,17 @@ sub renderForEdit {
}

my %params = (
-name => $this->{name},
-values => $this->getOptions(),
-default => $selected,
-columns => $this->{size},
-attributes => \%attrs,
-name => $this->{name},
-values => $this->getOptions(),
-default => $selected,
-columns => $this->{size},
-attributes => \%attrs,
);
if (defined $this->{valueMap}) {
$params{-labels} = $this->{valueMap};
if ( defined $this->{valueMap} ) {
$params{-labels} = $this->{valueMap};
}

return ('', CGI::radio_group(%params));
return ( '', CGI::radio_group(%params) );
}

1;
Expand Down
27 changes: 14 additions & 13 deletions core/lib/Foswiki/Form/Select.pm
Expand Up @@ -59,9 +59,9 @@ sub getOptions {
foreach my $val (@$vals) {
if ( $val =~ /^(.*[^\\])*=(.*)$/ ) {
$str = TAINT( $1 || '' );
my $descr = $this->{_descriptions}{$val};
my $descr = $this->{_descriptions}{$val};
$val = $2;
$this->{_descriptions}{$val} = $descr;
$this->{_descriptions}{$val} = $descr;
$str =~ s/\\=/=/g;
}
else {
Expand Down Expand Up @@ -104,16 +104,17 @@ sub renderForDisplay {

$this->getOptions();

if ($this->isValueMapped()) {
my @vals = ();
foreach my $val (split(/\s*,\s*/, $value)) {
if ( defined( $this->{valueMap}{$val} ) ) {
push @vals, $this->{valueMap}{$val};
} else {
push @vals, $val;
if ( $this->isValueMapped() ) {
my @vals = ();
foreach my $val ( split( /\s*,\s*/, $value ) ) {
if ( defined( $this->{valueMap}{$val} ) ) {
push @vals, $this->{valueMap}{$val};
}
else {
push @vals, $val;
}
}
}
$value = join(", ", @vals);
$value = join( ", ", @vals );
}

return $this->SUPER::renderForDisplay( $format, $value, $attrs );
Expand All @@ -129,8 +130,8 @@ sub renderForEdit {
my $option = $item;
my %params = ( class => 'foswikiOption', );
$params{selected} = 'selected' if $isSelected{$option};
if ($this->{_descriptions}{$option}) {
$params{title} = $this->{_descriptions}{$option};
if ( $this->{_descriptions}{$option} ) {
$params{title} = $this->{_descriptions}{$option};
}
if ( defined( $this->{valueMap}{$option} ) ) {
$params{value} = $option;
Expand Down

0 comments on commit c7619e8

Please sign in to comment.