data/TWiki/TWikiCompatibilityDotPm.txt,v
changeset 0 414e01d06fd5
equal deleted inserted replaced
-1:000000000000 0:414e01d06fd5
       
     1 head	1.3;
       
     2 access;
       
     3 symbols;
       
     4 locks; strict;
       
     5 comment	@# @;
       
     6 
       
     7 
       
     8 1.3
       
     9 date	2008.01.22.03.21.32;	author TWikiContributor;	state Exp;
       
    10 branches;
       
    11 next	1.2;
       
    12 
       
    13 1.2
       
    14 date	2007.01.16.04.11.57;	author TWikiContributor;	state Exp;
       
    15 branches;
       
    16 next	1.1;
       
    17 
       
    18 1.1
       
    19 date	2006.02.01.12.01.25;	author TWikiContributor;	state Exp;
       
    20 branches;
       
    21 next	;
       
    22 
       
    23 
       
    24 desc
       
    25 @new-topic
       
    26 @
       
    27 
       
    28 
       
    29 1.3
       
    30 log
       
    31 @buildrelease
       
    32 @
       
    33 text
       
    34 @---+ Package =TWiki::Compatibility=
       
    35 
       
    36 Support for compatibility with old TWiki versions. Packaged
       
    37 separately because 99.999999% of the time this won't be needed.
       
    38 
       
    39 
       
    40 %TOC%
       
    41 
       
    42 ---++ StaticMethod *upgradeCategoryTable* <tt>($session,$web,$topic,$meta,$text) -> $text</tt>
       
    43 
       
    44 Upgrade old style category table
       
    45 
       
    46 May throw TWiki::OopsException
       
    47 
       
    48 
       
    49 
       
    50 ---++ migrateToFileAttachmentMacro ( $session, $meta, $text  ) -> $text
       
    51 
       
    52 Migrate old HTML format
       
    53 
       
    54 
       
    55 ---++ upgradeFrom1v0beta ( $session, $meta  ) -> $text
       
    56 
       
    57 @
       
    58 
       
    59 
       
    60 1.2
       
    61 log
       
    62 @buildrelease
       
    63 @
       
    64 text
       
    65 @d16 8
       
    66 @
       
    67 
       
    68 
       
    69 1.1
       
    70 log
       
    71 @buildrelease
       
    72 @
       
    73 text
       
    74 @a5 83
       
    75 =end
       
    76 
       
    77 sub _upgradeCategoryItem {
       
    78     my ( $catitems, $ctext ) = @@_;
       
    79     my $catname = '';
       
    80     my $scatname = '';
       
    81     my $catmodifier = '';
       
    82     my $catvalue = '';
       
    83     my @@cmd = split( /\|/, $catitems );
       
    84     my $src = '';
       
    85     my $len = @@cmd;
       
    86     if( $len < '2' ) {
       
    87         # FIXME
       
    88         return ( $catname, $catmodifier, $catvalue )
       
    89     }
       
    90     my $svalue = '';
       
    91 
       
    92     my $i;
       
    93     my $itemsPerLine;
       
    94 
       
    95     # check for CategoryName=CategoryValue parameter
       
    96     my $paramCmd = '';
       
    97     my $cvalue = ''; # was$query->param( $cmd[1] );
       
    98     if( $cvalue ) {
       
    99         $src = "<!---->$cvalue<!---->";
       
   100     } elsif( $ctext ) {
       
   101         foreach( split( /\r?\n/, $ctext ) ) {
       
   102             if( /$cmd[1]/ ) {
       
   103                 $src = $_;
       
   104                 last;
       
   105             }
       
   106         }
       
   107     }
       
   108 
       
   109     if( $cmd[0] eq 'select' || $cmd[0] eq 'radio') {
       
   110         $catname = $cmd[1];
       
   111         $scatname = $catname;
       
   112         #$scatname =~ s/[^a-zA-Z0-9]//g;
       
   113         my $size = $cmd[2];
       
   114         for( $i = 3; $i < $len; $i++ ) {
       
   115             my $value = $cmd[$i];
       
   116             $svalue = $value;
       
   117             if( $src =~ /$value/ ) {
       
   118                $catvalue = $svalue;
       
   119             }
       
   120         }
       
   121 
       
   122     } elsif( $cmd[0] eq 'checkbox' ) {
       
   123         $catname = $cmd[1];
       
   124         $scatname = $catname;
       
   125         #$scatname =~ s/[^a-zA-Z0-9]//g;
       
   126         if( $cmd[2] eq 'true' || $cmd[2] eq '1' ) {
       
   127             $i = $len - 4;
       
   128             $catmodifier = 1;
       
   129         }
       
   130         $itemsPerLine = $cmd[3];
       
   131         for( $i = 4; $i < $len; $i++ ) {
       
   132             my $value = $cmd[$i];
       
   133             $svalue = $value;
       
   134             # I18N: FIXME - need to look at this, but since it's upgrading
       
   135             # old forms that probably didn't use I18N, it's not a high
       
   136             # priority.
       
   137             if( $src =~ /$value[^a-zA-Z0-9\.]/ ) {
       
   138                 $catvalue .= ", " if( $catvalue );
       
   139                 $catvalue .= $svalue;
       
   140             }
       
   141         }
       
   142 
       
   143     } elsif( $cmd[0] eq 'text' ) {
       
   144         $catname = $cmd[1];
       
   145         $scatname = $catname;
       
   146         #$scatname =~ s/[^a-zA-Z0-9]//g;
       
   147         $src =~ /<!---->(.*)<!---->/;
       
   148         if( $1 ) {
       
   149             $src = $1;
       
   150         } else {
       
   151             $src = '';
       
   152         }
       
   153         $catvalue = $src;
       
   154     }
       
   155 
       
   156     return ( $catname, $catmodifier, $catvalue )
       
   157 }
       
   158 d7 1
       
   159 a8 2
       
   160 
       
   161 %TOC%
       
   162 @