# Plugin for TWiki Collaboration Platform, http://TWiki.org/ # # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details, published at # http://www.gnu.org/copyleft/gpl.html # # ========================= # # Use EmptyPlugin.pm as a template # for your own plugins; see TWiki.TWikiPlugins for details. # # This plugin implements compatability functions that support # data defined using earlier versions of TWiki. The chances are # good that you don't need it, and can simply disable it (add # it to the DISABLEDPLUGINS list) # # Author: RafaelAlvarez (inspired by the SectionalEditPlugin) # ========================= package TWiki::Plugins::EditSectionPlugin; require TWiki::Func; require TWiki::User; use CGI qw( -any ); # ========================= use vars qw( $VERSION $pluginName ); $VERSION = '1.000'; $pluginName = 'EditSectionPlugin'; # Name of this Plugin use strict; sub initPlugin { # check for Plugins.pm versions if( $TWiki::Plugins::VERSION < 1.026 ) { TWiki::Func::writeWarning( "Version mismatch between $pluginName and Plugins.pm" ); return 0; } return 1; } sub beforeCommonTagsHandler { # do not uncomment, use $_[0], $_[1]... instead ### my ( $text, $topic, $web ) = @_; my $query = TWiki::Func::getCgiQuery(); my $id=$query->param('sectionid'); if ($id) { my $saveUrl=TWiki::Func::getScriptUrl($_[2],$_[1],"save"); $_[0]=~ s/(.+?)<\/section>/&_renderForm($id,$1,$saveUrl)/seo; } my $url=TWiki::Func::getScriptUrl($_[2],$_[1],"view").'?sectionid='; $_[0]=~ s/(.+?)<\/section>/