Welcome, Registration, and other StartingPoints; TWiki history & Wiki style; All the docs...
View   r2  >  r1  ...
TWikiCompatibilityDotPm 2 - 16 Jan 2007 - Main.TWikiContributor
Line: 3 to 3
 Support for compatibility with old TWiki versions. Packaged separately because 99.999999% of the time this won't be needed.
Deleted:
<
<
=end

sub _upgradeCategoryItem { my ( $catitems, $ctext ) = @_; my $catname = ''; my $scatname = ''; my $catmodifier = ''; my $catvalue = ''; my @cmd = split( /\|/, $catitems ); my $src = ''; my $len = @cmd; if( $len < '2' ) { # FIXME return ( $catname, $catmodifier, $catvalue ) } my $svalue = '';

my $i; my $itemsPerLine;

# check for CategoryName? =CategoryValue parameter my $paramCmd = ''; my $cvalue = ''; # was$query->param( $cmd[1] ); if( $cvalue ) { $src = "

<---->
$cvalue
<---->
"; } elsif( $ctext ) { foreach( split( /\r?\n/, $ctext ) ) { if( /$cmd[1]/ ) { $src = $_; last; } } }

if( $cmd[0] eq 'select' || $cmd[0] eq 'radio') { $catname = $cmd[1]; $scatname = $catname; #$scatname =~ s/[^a-zA-Z0-9]//g; my $size = $cmd[2]; for( $i = 3; $i < $len; $i++ ) { my $value = $cmd[$i]; $svalue = $value; if( $src =~ /$value/ ) { $catvalue = $svalue; } }

} elsif( $cmd[0] eq 'checkbox' ) { $catname = $cmd[1]; $scatname = $catname; #$scatname =~ s/[^a-zA-Z0-9]//g; if( $cmd[2] eq 'true' || $cmd[2] eq '1' ) { $i = $len - 4; $catmodifier = 1; } $itemsPerLine = $cmd[3]; for( $i = 4; $i < $len; $i++ ) { my $value = $cmd[$i]; $svalue = $value; # I18N? : FIXME - need to look at this, but since it's upgrading # old forms that probably didn't use I18N? , it's not a high # priority. if( $src =~ /$value[^a-zA-Z0-9\.]/ ) { $catvalue .= ", " if( $catvalue ); $catvalue .= $svalue; } }

} elsif( $cmd[0] eq 'text' ) { $catname = $cmd[1]; $scatname = $catname; #$scatname =~ s/[^a-zA-Z0-9]//g; $src =~ /

<---->
(.*)
<---->
/; if( $1 ) { $src = $1; } else { $src = ''; } $catvalue = $src; }

return ( $catname, $catmodifier, $catvalue ) }

 
Added:
>
>
 

StaticMethod upgradeCategoryTable ($session,$web,$topic,$meta,$text) -> $text

Upgrade old style category table


TWikiCompatibilityDotPm 1 - 01 Feb 2006 - Main.TWikiContributor
Line: 1 to 1
Added:
>
>

Package TWiki::Compatibility

Support for compatibility with old TWiki versions. Packaged separately because 99.999999% of the time this won't be needed.

=end

sub _upgradeCategoryItem { my ( $catitems, $ctext ) = @_; my $catname = ''; my $scatname = ''; my $catmodifier = ''; my $catvalue = ''; my @cmd = split( /\|/, $catitems ); my $src = ''; my $len = @cmd; if( $len < '2' ) { # FIXME return ( $catname, $catmodifier, $catvalue ) } my $svalue = '';

my $i; my $itemsPerLine;

# check for CategoryName? =CategoryValue parameter my $paramCmd = ''; my $cvalue = ''; # was$query->param( $cmd[1] ); if( $cvalue ) { $src = "

<---->
$cvalue
<---->
"; } elsif( $ctext ) { foreach( split( /\r?\n/, $ctext ) ) { if( /$cmd[1]/ ) { $src = $_; last; } } }

if( $cmd[0] eq 'select' || $cmd[0] eq 'radio') { $catname = $cmd[1]; $scatname = $catname; #$scatname =~ s/[^a-zA-Z0-9]//g; my $size = $cmd[2]; for( $i = 3; $i < $len; $i++ ) { my $value = $cmd[$i]; $svalue = $value; if( $src =~ /$value/ ) { $catvalue = $svalue; } }

} elsif( $cmd[0] eq 'checkbox' ) { $catname = $cmd[1]; $scatname = $catname; #$scatname =~ s/[^a-zA-Z0-9]//g; if( $cmd[2] eq 'true' || $cmd[2] eq '1' ) { $i = $len - 4; $catmodifier = 1; } $itemsPerLine = $cmd[3]; for( $i = 4; $i < $len; $i++ ) { my $value = $cmd[$i]; $svalue = $value; # I18N? : FIXME - need to look at this, but since it's upgrading # old forms that probably didn't use I18N? , it's not a high # priority. if( $src =~ /$value[^a-zA-Z0-9\.]/ ) { $catvalue .= ", " if( $catvalue ); $catvalue .= $svalue; } }

} elsif( $cmd[0] eq 'text' ) { $catname = $cmd[1]; $scatname = $catname; #$scatname =~ s/[^a-zA-Z0-9]//g; $src =~ /

<---->
(.*)
<---->
/; if( $1 ) { $src = $1; } else { $src = ''; } $catvalue = $src; }

return ( $catname, $catmodifier, $catvalue ) }

StaticMethod upgradeCategoryTable ($session,$web,$topic,$meta,$text) -> $text

Upgrade old style category table

May throw TWiki::OopsException


Revision 2r2 - 16 Jan 2007 - 04:11:57 - TWikiContributor
Revision 1r1 - 01 Feb 2006 - 12:01:25 - TWikiContributor
This site is powered by the TWiki collaboration platform.
All material on this collaboration platform is the property of the contributing authors.
All material marked as authored by Eben Moglen is available under the license terms CC-BY-SA version 4.
Syndicate this site RSSATOM