package TWiki::Plugins::QuickPostPlugin; # ========================= use vars qw( $web $topic $user $installWeb $VERSION $debug $exampleCfgVar ); $VERSION = '1.000'; # ========================= sub initPlugin { ( $topic, $web, $user, $installWeb ) = @_; # Plugin correctly initialized &TWiki::Func::writeDebug( "- TWiki::Plugins::QuickPostPlugin::initPlugin( $web.$topic ) is OK" ) if $debug; return 1; } # ========================= sub DISABLEcommonTagsHandler { ### my ( $text, $topic, $web ) = @_; # do not uncomment, use $_[0], $_[1]... instead &TWiki::Func::writeDebug( "- QuickPostPlugin::commonTagsHandler( $_[2].$_[1] )" ) if $debug; } # ========================= sub handleQuickPost { my ( $attributes ) = @_; my $text =""; my $r = scalar &TWiki::extractNameValuePair( $attributes, "rows" ); my $c = scalar &TWiki::extractNameValuePair( $attributes, "cols" ); my $mode = &TWiki::extractNameValuePair( $attributes, "mode" ); if (! $r || $r < 1 ) { $r = 5 } if (! $c || $c < 10) { $c = 70 } my $position = "before"; my $chronOrder = ""; if ($mode eq "after") { $position = "after"; $chronOrder = "reverse"; } #AS removed hardcoded scriptUrlPath $text="\n
\n"; return $text; } # ========================= sub DISABLEstartRenderingHandler { ### my ( $text, $web ) = @_; # do not uncomment, use $_[0], $_[1] instead &TWiki::Func::writeDebug( "- QuickPostPlugin::startRenderingHandler( $_[1].$topic )" ); # if $debug; # This handler is called by getRenderedVersion just before the line loop } # ========================= sub DISABLE_outsidePREHandler { ### my ( $text ) = @_; # do not uncomment, use $_[0] instead # &TWiki::Func::writeDebug( "- QuickPostPlugin::outsidePREHandler( $web.$topic )" ) if $debug; # This handler is called by getRenderedVersion, in loop outside oftag. # This is the place to define customized rendering rules. # Note: This is an expensive function to comment out. # Consider startRenderingHandler instead } # ========================= sub DISABLE_insidePREHandler { ### my ( $text ) = @_; # do not uncomment, use $_[0] instead # &TWiki::Func::writeDebug( "- QuickPostPlugin::insidePREHandler( $web.$topic )" ) if $debug; # This handler is called by getRenderedVersion, in loop inside oftag. # This is the place to define customized rendering rules. # Note: This is an expensive function to comment out. # Consider startRenderingHandler instead } # ========================= sub endRenderingHandler { ### my ( $text ) = @_; # do not uncomment, use $_[0] instead &TWiki::Func::writeDebug( "- QuickPostPlugin::endRenderingHandler( $web.$topic )" ) if $debug; # This handler is called by getRenderedVersion just after the line loop $_[0] =~ s/%QUICKPOST%/&handleQuickPost()/geo; $_[0] =~ s/%QUICKPOST{(.*?)}%/&handleQuickPost($1)/geo; } # ========================= 1;