From: Peter T. <pet...@us...> - 2002-12-29 05:56:41
|
Update of /cvsroot/twiki/twiki/lib/TWiki In directory sc8-pr-cvs1:/tmp/cvs-serv13756/TWiki Modified Files: Meta.pm Log Message: write all meta data, not just the official ones Index: Meta.pm =================================================================== RCS file: /cvsroot/twiki/twiki/lib/TWiki/Meta.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Meta.pm 4 Jul 2001 13:13:22 -0000 1.1 --- Meta.pm 29 Dec 2002 05:56:38 -0000 1.2 *************** *** 134,139 **** # =========================== ! # If no keyValue, remove all, otherwise for types ! # with key, just remove specified item sub remove { --- 134,140 ---- # =========================== ! # If no keyValue, remove all types, otherwise for types ! # with key, just remove specified item. Remove all types ! # if $type is empty. sub remove { *************** *** 141,145 **** my %args = (); ! my $key = _key( $type ); if( $keyValue && $key ) { --- 142,147 ---- my %args = (); ! my $key = ""; ! $key = _key( $type ) if( $type ); if( $keyValue && $key ) { *************** *** 152,157 **** } $self->{$type} = \@newData; ! } else { delete $self->{$type}; } } --- 154,162 ---- } $self->{$type} = \@newData; ! } elsif( $type ) { delete $self->{$type}; + } else { + $self = {}; + bless $self; } } *************** *** 184,193 **** } ! ! sub writeTypes { my( $self, @types ) = @_; my $text = ""; foreach my $type ( @types ) { --- 189,207 ---- } ! sub _writeTypes { my( $self, @types ) = @_; my $text = ""; + + if( $types[0] eq "not" ) { + # write all types that are not in the list + my %seen; + @seen{ @types } = (); + @types = (); # empty "not in list" + foreach my $key ( keys %$self ) { + push( @types, $key ) unless exists $seen{ $key }; + } + } foreach my $type ( @types ) { *************** *** 289,293 **** my( $self ) = @_; ! return $self->writeTypes( qw/TOPICINFO TOPICPARENT/ ); } --- 303,307 ---- my( $self ) = @_; ! return $self->_writeTypes( qw/TOPICINFO TOPICPARENT/ ); } *************** *** 298,302 **** my( $self ) = @_; ! return $self->writeTypes( qw/FORM FIELD FILEATTACHMENT TOPICMOVED/ ); } --- 312,319 ---- my( $self ) = @_; ! my $text = $self->_writeTypes( qw/FORM FIELD FILEATTACHMENT TOPICMOVED/ ); ! # append remaining meta data ! $text .= $self->_writeTypes( qw/not TOPICINFO TOPICPARENT FORM FIELD FILEATTACHMENT TOPICMOVED/ ); ! return $text; } |