- Timestamp:
- 10/15/09 19:28:59 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Release01x00/MailerContrib/lib/Foswiki/Contrib/MailerContrib/Change.pm
r1340 r5269 53 53 54 54 $this->{SESSION} = $session; 55 $this->{WEB} = $web;56 $this->{TOPIC} = $topic;55 $this->{WEB} = $web; 56 $this->{TOPIC} = $topic; 57 57 my $user; 58 58 59 # SMELL: call to unpublished core function 59 if ( defined(&Foswiki::Users::findUser)) {60 if ( defined(&Foswiki::Users::findUser) ) { 60 61 $user = $session->{users}->findUser( $author, undef, 1 ); 61 62 $this->{AUTHOR} = $user ? $user->wikiName() : $author; 62 } else { 63 } 64 else { 63 65 $this->{AUTHOR} = Foswiki::Func::getWikiName($author); 64 66 } 65 67 $this->{TIME} = $time; 66 68 ASSERT($rev) if DEBUG; 69 67 70 # rev at this change 68 71 $this->{CURR_REV} = $rev; 72 69 73 # previous rev 70 74 $this->{BASE_REV} = $rev - 1 || 1; … … 76 80 my $this = shift; 77 81 78 return "$this->{WEB}.$this->{TOPIC} by $this->{AUTHOR} at $this->{TIME} from r$this->{BASE_REV} to r$this->{CURR_REV}"; 82 return 83 "$this->{WEB}.$this->{TOPIC} by $this->{AUTHOR} at $this->{TIME} from r$this->{BASE_REV} to r$this->{CURR_REV}"; 79 84 } 80 85 … … 89 94 90 95 sub merge { 91 my ( $this, $other ) = @_;92 ASSERT( $this->isa( 'Foswiki::Contrib::MailerContrib::Change' ))if DEBUG;93 ASSERT( $other->isa( 'Foswiki::Contrib::MailerContrib::Change' )) if DEBUG;94 95 if ( $other->{CURR_REV} > $this->{CURR_REV} ) {96 my ( $this, $other ) = @_; 97 ASSERT( $this->isa('Foswiki::Contrib::MailerContrib::Change') ) if DEBUG; 98 ASSERT( $other->isa('Foswiki::Contrib::MailerContrib::Change') ) if DEBUG; 99 100 if ( $other->{CURR_REV} > $this->{CURR_REV} ) { 96 101 $this->{CURR_REV} = $other->{CURR_REV}; 97 $this->{AUTHOR} = $other->{AUTHOR};98 $this->{TIME} = $other->{TIME};102 $this->{AUTHOR} = $other->{AUTHOR}; 103 $this->{TIME} = $other->{TIME}; 99 104 } 100 105 101 106 $this->{BASE_REV} = $other->{BASE_REV} 102 if ($other->{BASE_REV} < $this->{BASE_REV});107 if ( $other->{BASE_REV} < $this->{BASE_REV} ); 103 108 } 104 109 … … 118 123 my ( $this, $html ) = @_; 119 124 120 unless ( defined $this->{HTML_SUMMARY} ) {121 if ( defined &Foswiki::Func::summariseChanges ) {125 unless ( defined $this->{HTML_SUMMARY} ) { 126 if ( defined &Foswiki::Func::summariseChanges ) { 122 127 $this->{HTML_SUMMARY} = 123 Foswiki::Func::summariseChanges( 124 $this->{WEB}, $this->{TOPIC}, $this->{BASE_REV},125 $this->{CURR_REV}, 1 );126 }else {128 Foswiki::Func::summariseChanges( $this->{WEB}, $this->{TOPIC}, 129 $this->{BASE_REV}, $this->{CURR_REV}, 1 ); 130 } 131 else { 127 132 $this->{HTML_SUMMARY} = 128 $this->{SESSION}->{renderer} ->summariseChanges129 ( undef, $this->{WEB}, $this->{TOPIC}, $this->{BASE_REV},130 $this->{CURR_REV}, 1 );133 $this->{SESSION}->{renderer} 134 ->summariseChanges( undef, $this->{WEB}, $this->{TOPIC}, 135 $this->{BASE_REV}, $this->{CURR_REV}, 1 ); 131 136 } 132 137 } … … 134 139 $html =~ s/%TOPICNAME%/$this->{TOPIC}/g; 135 140 $html =~ s/%AUTHOR%/$this->{AUTHOR}/g; 136 my $tim = Foswiki::Time::formatTime( $this->{TIME} );141 my $tim = Foswiki::Time::formatTime( $this->{TIME} ); 137 142 $html =~ s/%TIME%/$tim/go; 138 143 $html =~ s/%CUR_REV%/$this->{CURR_REV}/g; 139 144 $html =~ s/%BASE_REV%/$this->{BASE_REV}/g; 140 145 my $frev = ''; 141 if( $this->{CURR_REV} ) { 142 if( $this->{CURR_REV} > 1 ) { 143 $frev = 'r'.$this->{BASE_REV}. 144 '->r'.$this->{CURR_REV}; 145 } else { 146 if ( $this->{CURR_REV} ) { 147 if ( $this->{CURR_REV} > 1 ) { 148 $frev = 'r' . $this->{BASE_REV} . '->r' . $this->{CURR_REV}; 149 } 150 else { 151 146 152 # new _since the last notification_ 147 $frev = CGI::span( { class =>'foswikiNew' }, 'NEW' );153 $frev = CGI::span( { class => 'foswikiNew' }, 'NEW' ); 148 154 } 149 155 } 150 156 $html =~ s/%REVISION%/$frev/g; 151 $html = Foswiki::Func::expandCommonVariables( 152 $html, $this->{TOPIC}, $this->{WEB} ); 153 $html = Foswiki::Func::renderText( $html ); 157 $html = 158 Foswiki::Func::expandCommonVariables( $html, $this->{TOPIC}, 159 $this->{WEB} ); 160 $html = Foswiki::Func::renderText($html); 154 161 $html =~ s/%TEXTHEAD%/$this->{HTML_SUMMARY}/g; 155 162 … … 167 174 my ( $this, $template ) = @_; 168 175 169 unless ( defined $this->{TEXT_SUMMARY} ) {176 unless ( defined $this->{TEXT_SUMMARY} ) { 170 177 my $s; 171 if( defined &Foswiki::Func::summariseChanges ) { 172 $s = Foswiki::Func::summariseChanges( 173 $this->{WEB}, $this->{TOPIC}, $this->{BASE_REV}, 174 $this->{CURR_REV}, 0 ); 175 } else { 176 $s = $this->{SESSION}->{renderer}->summariseChanges( 177 undef, $this->{WEB}, $this->{TOPIC}, $this->{BASE_REV}, 178 $this->{CURR_REV}, 0 ); 178 if ( defined &Foswiki::Func::summariseChanges ) { 179 $s = 180 Foswiki::Func::summariseChanges( $this->{WEB}, $this->{TOPIC}, 181 $this->{BASE_REV}, $this->{CURR_REV}, 0 ); 182 } 183 else { 184 $s = 185 $this->{SESSION}->{renderer} 186 ->summariseChanges( undef, $this->{WEB}, $this->{TOPIC}, 187 $this->{BASE_REV}, $this->{CURR_REV}, 0 ); 179 188 } 180 189 $s =~ s/\n/\n /gs; … … 183 192 } 184 193 185 my $tim = Foswiki::Time::formatTime( $this->{TIME} );194 my $tim = Foswiki::Time::formatTime( $this->{TIME} ); 186 195 187 196 # URL-encode topic names for use of I18N topic names in plain text … … 193 202 $template =~ s/%CUR_REV%/$this->{CURR_REV}/g; 194 203 $template =~ s/%BASE_REV%/$this->{BASE_REV}/g; 195 $template =~ s/%TOPICNAME%/$this->{TOPIC}/g; # deprecated DO NOT USE!204 $template =~ s/%TOPICNAME%/$this->{TOPIC}/g; # deprecated DO NOT USE! 196 205 $template =~ s/%TOPIC%/$this->{TOPIC}/g; 197 206 my $frev = ''; 198 if( $this->{CURR_REV} ) { 199 if( $this->{CURR_REV} > 1 ) { 200 $frev = 'r'.$this->{BASE_REV}. 201 '->r'.$this->{CURR_REV}; 202 } else { 207 if ( $this->{CURR_REV} ) { 208 if ( $this->{CURR_REV} > 1 ) { 209 $frev = 'r' . $this->{BASE_REV} . '->r' . $this->{CURR_REV}; 210 } 211 else { 212 203 213 # new _since the last notification_ 204 214 $frev = 'NEW';
Note: See TracChangeset
for help on using the changeset viewer.
