- Timestamp:
- 11/19/08 15:00:00 (4 years ago)
- Location:
- trunk/CommentPlugin/lib/Foswiki
- Files:
-
- 1 edited
- 1 moved
-
. (moved) (moved from trunk/CommentPlugin/lib/TWiki)
-
Plugins/CommentPlugin/Comment.pm (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/CommentPlugin/lib/Foswiki/Plugins/CommentPlugin/Comment.pm
r781 r811 2 2 # 3 3 # Copyright (C) 2004 Crawford Currie 4 # Copyright (C) 2001-2006 TWiki Contributors.5 # All Rights Reserved. TWiki Contributors4 # Copyright (C) 2001-2006 Foswiki Contributors. 5 # All Rights Reserved. Foswiki Contributors 6 6 # are listed in the AUTHORS file in the root of this distribution. 7 7 # NOTE: Please extend that file, not this notice. … … 23 23 # and again by Crawford Currie 24 24 # 25 # This version is specific to TWiki::Plugins::VERSION > 1.02625 # This version is specific to Foswiki::Plugins::VERSION > 1.026 26 26 27 27 use strict; 28 28 29 use TWiki;30 use TWiki::Plugins;31 use TWiki::Store;32 use TWiki::Attrs;29 use Foswiki; 30 use Foswiki::Plugins; 31 use Foswiki::Store; 32 use Foswiki::Attrs; 33 33 use CGI qw( -any ); 34 34 35 package TWiki::Plugins::CommentPlugin::Comment;35 package Foswiki::Plugins::CommentPlugin::Comment; 36 36 37 37 # PUBLIC save the given comment. … … 39 39 #my ( $text, $topic, $web ) = @_; 40 40 41 my $wikiName = TWiki::Func::getWikiName();42 if( ! TWiki::Func::checkAccessPermission( 'change', $wikiName, '',41 my $wikiName = Foswiki::Func::getWikiName(); 42 if( ! Foswiki::Func::checkAccessPermission( 'change', $wikiName, '', 43 43 $_[1], $_[2] ) ) { 44 44 # user has no permission to change the topic 45 throw TWiki::OopsException( 'accessdenied',45 throw Foswiki::OopsException( 'accessdenied', 46 46 def => 'topic_access', 47 47 web => $_[2], … … 56 56 #my ( $previewing, $text, $web, $topic ) = @_; 57 57 58 my $defaultType = TWiki::Func::getPreferencesValue('COMMENTPLUGIN_DEFAULT_TYPE') || 'above';58 my $defaultType = Foswiki::Func::getPreferencesValue('COMMENTPLUGIN_DEFAULT_TYPE') || 'above'; 59 59 60 60 my $message = ''; … … 84 84 if ( $attrtemplatetopic ) { 85 85 my ($templocweb, $temploctopic ) = 86 TWiki::Func::normalizeWebTopicName($templateweb, $attrtemplatetopic);86 Foswiki::Func::normalizeWebTopicName($templateweb, $attrtemplatetopic); 87 87 $templatetopic = "$templocweb.$temploctopic"; 88 88 } … … 97 97 $attributes =~ s/^{(.*)}$/$1/ if ( $attributes ); 98 98 99 my $attrs = new TWiki::Attrs( $attributes, 1 );99 my $attrs = new Foswiki::Attrs( $attributes, 1 ); 100 100 my $type = 101 101 $attrs->remove( 'type' ) || $attrs->remove( 'mode' ) || $defaultType; … … 143 143 my $url = ''; 144 144 if ( $disable eq '' ) { 145 $url = TWiki::Func::getScriptUrl( $web, $topic, 'save' );145 $url = Foswiki::Func::getScriptUrl( $web, $topic, 'save' ); 146 146 } 147 147 … … 213 213 # Get the templates. 214 214 my $templateFile = $templatetopic 215 || TWiki::Func::getPreferencesValue('COMMENTPLUGIN_TEMPLATES')215 || Foswiki::Func::getPreferencesValue('COMMENTPLUGIN_TEMPLATES') 216 216 || 'comments'; 217 217 218 218 my $templates = 219 TWiki::Func::loadTemplate( $templateFile );219 Foswiki::Func::loadTemplate( $templateFile ); 220 220 if (! $templates ) { 221 TWiki::Func::writeWarning("Could not read template file '$templateFile'");221 Foswiki::Func::writeWarning("Could not read template file '$templateFile'"); 222 222 return; 223 223 } 224 224 225 my $t = TWiki::Func::expandTemplate( $name );225 my $t = Foswiki::Func::expandTemplate( $name ); 226 226 return "%RED%No such template def TMPL:DEF{$name}%ENDCOLOR%" 227 227 unless ( defined($t) && $t ne '' ) || $warn eq 'off'; … … 244 244 my ( $topic, $web ) = ( $_[1], $_[2] ); 245 245 246 my $query = TWiki::Func::getCgiQuery();246 my $query = Foswiki::Func::getCgiQuery(); 247 247 return unless $query; 248 248 249 249 my $type = $query->param( 'comment_type' ) || 250 TWiki::Func::getPreferencesValue('COMMENTPLUGIN_DEFAULT_TYPE') ||250 Foswiki::Func::getPreferencesValue('COMMENTPLUGIN_DEFAULT_TYPE') || 251 251 'below'; 252 252 my $index = $query->param( 'comment_index' ) || 0; … … 270 270 # Expand common variables in the template, but don't expand other 271 271 # tags. 272 $output = TWiki::Func::expandVariablesOnTopicCreation($output);272 $output = Foswiki::Func::expandVariablesOnTopicCreation($output); 273 273 274 274 $output = '' unless defined($output);
Note: See TracChangeset
for help on using the changeset viewer.
