# Plugin for TWiki Collaboration Platform, http://TWiki.org/ # # Author Angel Gerdzhikov. angel.gerdzhikov@ipeq.de # ========================= package TWiki::Plugins::MyPlugin; # ========================= use vars qw( $distWeb $distTopic $newName $VERSION $thisUrl $distUrl $pluginName $debug $placeHolder $template $web $topic ); $VERSION = '1.000'; $pluginName = 'MyPlugin'; # ========================= sub initPlugin { ( $topic, $web ) = @_; # check for Plugins.pm versions if ( $TWiki::Plugins::VERSION < 1.000 ) { TWiki::Func::writeWarning("Version mismatch between $pluginName and Plugins.pm"); return 0; } # Get plugin debug flag $debug = TWiki::Func::getPluginPreferencesFlag("DEBUG"); # Get plugin preferences, the variable defined by: * Set EXAMPLE = ... $placeHolder = TWiki::Func::getPluginPreferencesValue("PLACEHOLDER") || "BspName"; $template = TWiki::Func::getPluginPreferencesValue("TEMPLATE") || "default.xml"; $thisUrl = TWiki::Func::getViewUrl( $web, $topic ); # Plugin correctly initialized TWiki::Func::writeDebug("- TWiki::Plugins::${pluginName}::initPlugin( $web.$topic ) is OK") if $debug; return 1; } # ========================= sub commonTagsHandler { ### my ( $text, $topic, $web ) = @_; # do not uncomment, use $_[0], $_[1]... instead TWiki::Func::writeDebug("- ${pluginName}::commonTagsHandler( $_[2].$_[1] )") if $debug; # This is the place to define customized tags and variables # Called by TWiki::handleCommonTags, after %INCLUDE:"..."% # do custom extension rule, like for example: my $scriptUrl = TWiki::Func::getScriptUrl( "Main", "WebHome", "view" ); my $form = "
Parent web: (default Main)
Parent topic: (default WebHome)
New name: (default NewProject)
Template: (default: from plugin settings)
Placeholder*: (default: from plugin settings)

* \"New name\" wird überall dort gesetzt, wo \"Placeholder\" gefunden wird
"; $_[0] =~ s/%CREATETOPICSFORM%/$form/ge; # $_[0] =~ s/%XYZ{(.*?)}%/&handleXyz($1)/ge; } # ========================= 1;