Skip to content

Commit

Permalink
Item13619: Make RevCommentPlugin work with Foswiki 2.0
Browse files Browse the repository at this point in the history
This change untangles the templates a bit from core templates.  It means
that a "revcomment" skin needs to be added to the SKIN setting. Should
be ahead of the "natedit" skin.

Need to follow up with more documentation.  And the default skins
should have the revcomment stuff removed at some point.
  • Loading branch information
gac410 committed Aug 14, 2015
1 parent 87f727d commit e7c9e8f
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 20 deletions.
10 changes: 10 additions & 0 deletions .gitignore
@@ -0,0 +1,10 @@
*,v
*,pfv
*.gz
/RevCommentPlugin.md5
/RevCommentPlugin.sha1
/RevCommentPlugin.tgz
/RevCommentPlugin.txt
/RevCommentPlugin.zip
/RevCommentPlugin_installer
/RevCommentPlugin_installer.pl
Empty file added TIDY
Empty file.
21 changes: 8 additions & 13 deletions lib/Foswiki/Plugins/RevCommentPlugin.pm
@@ -1,7 +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
# Copyright (C) 2008-2015 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 Down Expand Up @@ -34,15 +34,8 @@ use vars qw(
$commentFromUpload $attachmentComments $cachedCommentWeb $cachedCommentTopic $minorMark
);

# 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 $';

# This is a free-form string you can use to "name" your own plugin version.
# It is *not* used by the build automation tools, but is reported as part
# of the version number in PLUGINDESCRIPTIONS.
$RELEASE = '22 Jan 2009';
$VERSION = '2.00';
$RELEASE = '14 Aug 2015';

$pluginName = 'RevCommentPlugin';

Expand Down Expand Up @@ -71,10 +64,12 @@ sub initPlugin {
$cachedCommentWeb = '';
$cachedCommentTopic = '';

# Need to register meta, Item11249
# Need to register meta, Item11249
# SMELL: Foswiki 2.0 meta strictly enforces attribut names. This plugin indexes these names
# with relative comment number: comment_1, comment_2, etc. and the META:REVCOMMENT lines are
# ignored. Needed to remove the definition: allow => [qw(comment t minor rev ncomments)] );
if ( defined &Foswiki::Meta::registerMETA ) {
Foswiki::Meta::registerMETA( 'REVCOMMENT',
allow => [qw(comment t minor rev ncomments)] );
Foswiki::Meta::registerMETA('REVCOMMENT');
}

# Plugin correctly initialized
Expand Down
17 changes: 10 additions & 7 deletions lib/Foswiki/Plugins/RevCommentPlugin/MANIFEST
@@ -1,7 +1,10 @@
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
data/System/RevComment.txt 0775
data/System/RevCommentPlugin.txt 0775
data/System/WebChangesWC.txt 0775
data/System/WebRssBaseWC.txt 0775
lib/Foswiki/Plugins/RevCommentPlugin.pm 0775
pub/System/RevCommentPlugin/ExampleHistory.png 0775
pub/System/RevCommentPlugin/ExampleWebChanges.png 0775
templates/edit.revcomment.tmpl 0664
templates/edittoolbar.revcomment.tmpl 0664
templates/oopshistory.revcomment.tmpl 0664
3 changes: 3 additions & 0 deletions templates/edit.revcomment.tmpl
@@ -0,0 +1,3 @@
%TMPL:INCLUDE{"edit"}%
%TMPL:DEF{"revCommentPluginOptions"}%<hr /><div class='foswikiFormStep revComment'><label for='comment'>Summary of changes</label> <input class='foswikiInputField' type='text' style='width:50%' name='comment' id='comment' /> %POPUPWINDOW{"%SYSTEMWEB%.RevComment" label="%MAKETEXT{"help"}%"}%</div>%TMPL:END%
%TMPL:DEF{"topicinfo"}%%TMPL:P{context="RevCommentPluginEnabled" then="revCommentPluginOptions"}%<hr /><div class="patternTopicActions foswikiFormStep clear"><div class="patternActionButtons">%TMPL:P{"action_buttons"}%</div></div>%TMPL:P{"forcerevisioncheckbox"}%%TMPL:END%
13 changes: 13 additions & 0 deletions templates/edittoolbar.revcomment.tmpl
@@ -0,0 +1,13 @@
%TMPL:INCLUDE{"edittoolbar"}%
%{ ################################################################################ }%
%TMPL:DEF{"bottomtopicactions"}%<div class="natEditBottomBar">
%IF{ "context RevCommentPluginEnabled" then="%TMPL:P{"revcomment"}%"}%
<ul>%TMPL:P{"saveorrestorebutton"}%%TMPL:P{"checkpointbutton"}%%TMPL:P{"previewbutton"}%%TMPL:P{"formbutton"}%%TMPL:P{"changeform"}%%TMPL:P{"cancelbutton"}%%TMPL:P{"forcenewrevision"}%</ul>
%CLEAR%
</div>
%TMPL:END%
%TMPL:DEF{"revcomment"}%
<div class='revComment'>
<label for='comment'>Summary of changes</label>
<input class='foswikiInputField' type='text' style='width:50%' name='comment' id='comment' />
%POPUPWINDOW{"%SYSTEMWEB%.RevComment" label="%MAKETEXT{"help"}%"}%</div>%TMPL:END%
24 changes: 24 additions & 0 deletions templates/oopshistory.revcomment.tmpl
@@ -0,0 +1,24 @@
%TMPL:INCLUDE{"oopshistory"}%
%{ SMELL: historytable_rcp_disabled defined in oopshistory.tmp. It really ought to be renamed. }%
%TMPL:DEF{"historytable"}%%TMPL:P{context="RevCommentPluginEnabled" then="historytable_rcp_enabled" else="historytable_rcp_disabled"}%%TMPL:END%
%TMPL:DEF{"historytable_rcp_enabled"}%<table class="foswikiTable historySelectTable" summary="%MAKETEXT{"Topic history"}%">
<tr>
<th colspan="3">%MAKETEXT{"Revision"}%</th>
<th>%MAKETEXT{"Changed on"}%</th>
<th>%MAKETEXT{"Last edited by"}%</th>
<th>%MAKETEXT{"Comment"}%</th>
</tr>
%HISTORY{"<tr><td align="right"><a href=\"%SCRIPTURL{view}%/%WEB%/%TOPIC%?rev=$rev\">$rev</a></td><td style=\"background-color:#fffaf2; text-align:center;\"><input type=\"radio\" name=\"rev2\" value=\"$rev\" style=\"border:none; background-color:#fffaf2;\" /></td><td style=\"background-color:#f2f7fc; text-align:center;\"><input type=\"radio\" name=\"rev1\" value=\"$rev\" style=\"border:none; background-color:#f2f7fc;\" /></td><td style="white-space: nowrap;">$date</td><td>[[$wikiusername][$wikiname]]</td><td><div class="historyRevComment">%REVCOMMENT[$rev]%</div></td></tr>" rev1="%URLPARAM{"rev1"}%" rev2="%URLPARAM{"rev2"}%" nrev="%URLPARAM{"nrev"}%" header="" footer="</table>$n%TMPL:P{"historytable:navigation"}%%TMPL:END%

%TMPL:DEF{"cssFoswikiDiffOptions"}%%TMPL:PREV%%ADDTOZONE{"head" id="cssFoswikiRcpDiffOptions" text="<style type='text/css' media='all'>
.historyRevComment ul {
list-style:none;
padding:0;
margin:0 0 0 1em;
}
.historyRevComment li {
padding:0;
margin:0;
}
</style>"}%%TMPL:END%

0 comments on commit e7c9e8f

Please sign in to comment.