Skip to content

Commit

Permalink
Item369: Rebranding RevCommentPlugin
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/RevCommentPlugin@1105 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
KennethLavrsen authored and KennethLavrsen committed Dec 1, 2008
1 parent 72fed33 commit 5addaad
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 50 deletions.
File renamed without changes.
25 changes: 11 additions & 14 deletions data/TWiki/RevCommentPlugin.txt → data/System/RevCommentPlugin.txt 100644 → 100755
Expand Up @@ -5,7 +5,7 @@ This plugin allows to enter a short summary of changes made to a topic for a new
This summary can be displayed e.g. in a history page of the topic or on the !WebChanges page
of a web. Changes may also be marked as "minor" by using the "Quiet save" button.

Since in TWiki it is possible to make several changes within the edit lock time (normally
Since in Foswiki it is possible to make several changes within the edit lock time (normally
60 minutes) which are accumulated in only one new revision, it is also possible to
have several comments for one revision.

Expand Down Expand Up @@ -72,22 +72,22 @@ Plugin settings are stored as preferences variables. To reference a plugin setti

---++ Plugin Installation Instructions

__Note:__ You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.
__Note:__ You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where Foswiki is running.

* Download the ZIP file from the Plugin web (see below)
* Unzip ==%TOPIC%.zip== in your twiki installation directory. Content:
* Unzip ==%TOPIC%.zip== in your Foswiki installation directory. Content:
| *File:* | *Description:* |
| ==data/System/%TOPIC%.txt== | Plugin topic |
| ==data/System/%TOPIC%.txt,v== | Plugin topic repository |
| ==lib/Foswiki/Plugins/%TOPIC%.pm== | Plugin Perl module |
| ==data/TWiki/WebChangesWC.txt== | Replacement for ==WebChanges.txt==, see below |
| ==data/TWiki/RevComment.txt== | Help text |
* Visit =configure= in your TWiki installation, and enable the plugin in the {Plugins} section.
| ==data/System/WebChangesWC.txt== | Replacement for ==WebChanges.txt==, see below |
| ==data/System/RevComment.txt== | Help text |
* Visit =configure= in your Foswiki installation, and enable the plugin in the {Plugins} section.

* Test if the installation was successful:
<ul>
<li> Here should be the comment of this topic: %REVCOMMENT%
<li> Look at the recent changes to the TWiki web:
<li> Look at the recent changes to the System web:
%SYSTEMWEB%.WebChangesWC
<li> If you have also the [[Foswiki:Extensions.HistoryPlugin][HistoryPlugin]] installed,
look at the history of this document:
Expand All @@ -99,24 +99,24 @@ __Note:__ You do not need to install anything on the browser to use this plugin.
* This distribution contains a topic which can replace an existing
one. This file has a WC ("with comments") in the name. You should backup
your old file and rename this file:
* =data/TWiki/WebChangesWC.txt= --> =data/TWiki/WebChanges.txt=
* =data/System/WebChangesWC.txt= --> =data/System/WebChanges.txt=
* If [[Foswiki:Extensions.HistoryPlugin][HistoryPlugin]] is installed, the template =oopshistory.tmpl= from this plugin is automatically expanded with revision comments once this plugin is installed
* If you are using other skins than the pattern or classical skin, you have to
enter a textfield to =templates/edit.<i>skin</i>.tmpl= and =templates/preview.<i>skin</i>.tmpl= :
Enter the line
&lt;input class="twikiEditComment" type="text" size="%<nop>EDITBOXWIDTH%" style="%<nop>EDITBOXSTYLE%" name="comment"&gt;
&lt;input class="foswikiEditComment" type="text" size="%<nop>EDITBOXWIDTH%" style="%<nop>EDITBOXSTYLE%" name="comment"&gt;
to the template, between the &lt;form&gt; and &lt;/form&gt; tags.


---++ Plugin Info

| Plugin Author: | TWiki:Main.JChristophFuchs & TWiki:Main.SteffenPoulsen |
| Plugin Author: | TWiki:Main.JChristophFuchs & Foswiki:Main.SteffenPoulsen |
| Plugin Version: | 14 Apr 2006 (V1.110) |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 14 Apr 2006: | &lt;noautolink&gt; added to default pre/post rendering output of REVCOMMENT tag |
| 14 Apr 2006: | Minor update for Dakar 4.0.2 |
| 22 Apr 2005: | Initial version |
| TWiki Dependency: | $TWiki::Plugins::VERSION 1.024 |
| Dependency: | $Foswiki::Plugins::VERSION 1.024 |
| CPAN Dependencies: | none |
| Other Dependencies: | none |
| Perl Version: | 5.005 |
Expand All @@ -127,6 +127,3 @@ __Note:__ You do not need to install anything on the browser to use this plugin.
| Appraisal: | http://foswiki.org/Extensions/%TOPIC%Appraisal |

__Related Topics:__ %SYSTEMWEB%.DefaultPreferences, %USERSWEB%.SitePreferences, [[%SYSTEMWEB%.Plugins][Plugins]]

-- TWiki:Main.JChristophFuchs - 22 Apr 2005

File renamed without changes.
2 changes: 1 addition & 1 deletion data/TWiki/WebRssBaseWC.txt → data/System/WebRssBaseWC.txt 100644 → 100755
Expand Up @@ -3,7 +3,7 @@

---++ Find out What's New

There are several ways to find out what's new in each TWiki web:
There are several ways to find out what's new in each Foswiki web:
1. Visit WebChanges to see recent changes
1. Subscribed in WebNotify get notified of recent changes by e-mail
1. Use a news readers such as Foswiki:Extensions/HeadlinesPlugin to display the recent changes
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions lib/Foswiki/Plugins/RecCommentPlugin/MANIFEST
@@ -0,0 +1,7 @@
data/System/RevComment.txt 0644
data/System/RevCommentPlugin.txt 0644
data/System/WebChangesWC.txt 0644
data/System/WebRssBaseWC.txt 0644
lib/Foswiki/Plugins/RevCommentPlugin.pm 0644
pub/System/RevCommentPlugin/ExampleHistory.png 0644
pub/System/RevCommentPlugin/ExampleWebChanges.png 0644
Expand Up @@ -8,10 +8,10 @@ BEGIN
}
}

use TWiki::Contrib::Build;
use Foswiki::Contrib::Build;

# Create the build object
$build = new TWiki::Contrib::Build( 'RevCommentPlugin' );
$build = new Foswiki::Contrib::Build( 'RevCommentPlugin' );

# Build the target on the command line, or the default target
$build->build($build->{target});
Expand Down
53 changes: 27 additions & 26 deletions lib/TWiki/Plugins/RevCommentPlugin.pm → lib/Foswiki/Plugins/RevCommentPlugin.pm 100644 → 100755
@@ -1,6 +1,7 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2005 by TWiki:Main.JChristophFuchs
# Copyright (C) 2008 Foswiki Contributors
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -15,10 +16,10 @@
#

# =========================
package TWiki::Plugins::RevCommentPlugin;
package Foswiki::Plugins::RevCommentPlugin;
use strict;

use TWiki::Func;
use Foswiki::Func;

# =========================
use vars qw(
Expand All @@ -30,7 +31,7 @@ use vars qw(
$commentFromUpload $attachmentComments $cachedCommentWeb $cachedCommentTopic $minorMark
);

# This should always be $Rev: 9841 $ so that TWiki can determine the checked-in
# This should always be $Rev: 9841 $ so that Foswiki can determine the checked-in
# status of the plugin. It is used by the build automation tools, so
# you should leave it alone.
$VERSION = '$Rev: 9841 $';
Expand All @@ -49,29 +50,29 @@ sub initPlugin {
( $topic, $web, $user, $installWeb ) = @_;

# check for Plugins.pm versions
if ( $TWiki::Plugins::VERSION < 1.021 ) {
TWiki::Func::writeWarning(
if ( $Foswiki::Plugins::VERSION < 1.021 ) {
Foswiki::Func::writeWarning(
"Version mismatch between $pluginName and Plugins.pm");
return 0;
}

$commentFromUpload = undef;

# Get plugin debug flag
$debug = TWiki::Func::getPluginPreferencesFlag("DEBUG");
$debug = Foswiki::Func::getPluginPreferencesFlag("DEBUG");

# Get plugin preferences, the variable defined by: * Set EXAMPLE = ...
$attachmentComments =
TWiki::Func::getPluginPreferencesValue("ATTACHMENT_COMMENTS") || 1;
Foswiki::Func::getPluginPreferencesValue("ATTACHMENT_COMMENTS") || 1;

$cachedCommentWeb = '';
$cachedCommentTopic = '';

# Plugin correctly initialized
TWiki::Func::writeDebug(
"- TWiki::Plugins::${pluginName}::initPlugin( $web.$topic ) is OK")
Foswiki::Func::writeDebug(
"- Foswiki::Plugins::${pluginName}::initPlugin( $web.$topic ) is OK")
if $debug;
TWiki::Func::writeDebug(
Foswiki::Func::writeDebug(
"- --- attachmentComments = " . $attachmentComments )
if $debug;
return 1;
Expand All @@ -80,11 +81,11 @@ sub initPlugin {
sub commonTagsHandler {
### my ( $text, $topic, $web ) = @_; # do not uncomment, use $_[0], $_[1]... instead

TWiki::Func::writeDebug("- ${pluginName}::commonTagsHandler( $_[2].$_[1] )")
Foswiki::Func::writeDebug("- ${pluginName}::commonTagsHandler( $_[2].$_[1] )")
if $debug;

# This is the place to define customized tags and variables
# Called by TWiki::handleCommonTags, after %INCLUDE:"..."%
# Called by Foswiki::handleCommonTags, after %INCLUDE:"..."%

$_[0] =~ s/%REVCOMMENT%/&handleRevComment()/ge;
$_[0] =~ s/%REVCOMMENT{(.*?)}%/&handleRevComment($1)/ge;
Expand All @@ -95,16 +96,16 @@ sub beforeSaveHandler {
### my ( $text, $topic, $web, $meta ) = @_; # do not uncomment, use $_[0], $_[1]... instead
my ( $topic, $web, $meta ) = @_[ 1 .. 3 ];

TWiki::Func::writeDebug("- ${pluginName}::beforeSaveHandler( $_[2].$_[1] )")
Foswiki::Func::writeDebug("- ${pluginName}::beforeSaveHandler( $_[2].$_[1] )")
if $debug;

# This handler is called by TWiki::Store::saveTopic just before the save action.
# New hook in TWiki::Plugins $VERSION = '1.010'
# This handler is called by Foswiki::Store::saveTopic just before the save action.
# New hook in Foswiki::Plugins $VERSION = '1.010'

my $query = TWiki::Func::getCgiQuery();
my $query = Foswiki::Func::getCgiQuery();

# Get current revision
my ( $date, $user, $currev ) = TWiki::Func::getRevisionInfo( $_[2], $_[1] );
my ( $date, $user, $currev ) = Foswiki::Func::getRevisionInfo( $_[2], $_[1] );
$currev ||= 0;

my @comments = _extractComments($meta);
Expand Down Expand Up @@ -160,14 +161,14 @@ sub beforeSaveHandler {
}

sub beforeAttachmentSaveHandler {
TWiki::Func::writeDebug(
Foswiki::Func::writeDebug(
"- ${pluginName}::beforeAttachmentSaveHandler( $_[2].$_[1] )")
if $debug;

return unless $attachmentComments;
TWiki::Func::writeDebug("--- still here") if $debug;
Foswiki::Func::writeDebug("--- still here") if $debug;

my $query = TWiki::Func::getCgiQuery();
my $query = Foswiki::Func::getCgiQuery();
if ( defined( $query->param('filename') )
&& $query->param('filename') eq $_[0]->{attachment} )
{
Expand Down Expand Up @@ -219,21 +220,21 @@ sub _putComments {

sub handleRevComment {

TWiki::Func::writeDebug(
"- TWiki::Plugins::${pluginName}::handleRevComments: Args=>$_[0]<\n")
Foswiki::Func::writeDebug(
"- Foswiki::Plugins::${pluginName}::handleRevComments: Args=>$_[0]<\n")
if $debug;
my $params = $_[0] || '';

# SMELL: this "convenience" should probably be removed; you can \" in Attributes
$params =~ s/''/"/g;

my %params = TWiki::Func::extractParameters($params);
my %params = Foswiki::Func::extractParameters($params);

my $web = $params{web} || $web;
my $topic = $params{topic} || $topic;
my $rev = $params{rev}
|| $params{_DEFAULT}
|| ( TWiki::Func::getRevisionInfo( $web, $topic ) )[2];
|| ( Foswiki::Func::getRevisionInfo( $web, $topic ) )[2];
$rev =~ s/^1\.//;
my $delimiter = $params{delimiter};
$delimiter = '</li><li style="margin-left:-1em;">'
Expand All @@ -247,13 +248,13 @@ sub handleRevComment {
my $minor = $params{minor};
$minor = '<i>(minor)</i> ' unless defined($minor);

unless ( TWiki::Func::topicExists( $web, $topic ) ) {
unless ( Foswiki::Func::topicExists( $web, $topic ) ) {
return "Topic $web.$topic does not exist";
}
my @comments;

# SMELL: doesn't respect access permissions (too bad there isn't a version that does, like readTopic() does...)
my ( $meta, undef ) = TWiki::Func::readTopic( $web, $topic, $rev );
my ( $meta, undef ) = Foswiki::Func::readTopic( $web, $topic, $rev );

@comments = _extractComments($meta);
foreach my $comment (@comments) {
Expand Down
7 changes: 0 additions & 7 deletions lib/TWiki/Plugins/RevCommentPlugin/MANIFEST

This file was deleted.

File renamed without changes
File renamed without changes

0 comments on commit 5addaad

Please sign in to comment.