Skip to content

Commit

Permalink
Item13454: ignore format and unsubscribeformat params
Browse files Browse the repository at this point in the history
  • Loading branch information
Crawford Currie committed Jun 9, 2015
1 parent 1d536bc commit d9394f7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
17 changes: 10 additions & 7 deletions SubscribePlugin/data/System/SubscribePlugin.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1430749988" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1433863566" format="1.1" version="1"}%
%META:TOPICPARENT{name="Plugins"}%
<a href="http://wikiring.com"><img src="%ATTACHURL%/logo.gif" style="float:right" /></a>
---+ Subscribe Plugin
Expand All @@ -10,6 +10,8 @@

Example (only works if plugin is installed, and you are logged in - you are: %WIKIUSERNAME% - and you are not %USERSWEB%.WikiGuest): %SUBSCRIBE%

%X% This version is designed for use with Foswiki 1.2.0 and later. While it will work with Foswiki 1.1.x, it is *not* recommended that you install it there.

---++ Usage
%INCLUDE{"VarSUBSCRIBE" section="subscribe_attributes"}%

Expand Down Expand Up @@ -76,12 +78,13 @@ Another great Foswiki extension from the <a style="text-decoration:none" href="h

%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="[[http://c-dot.co.uk][Crawford Currie]]"}%
%META:FIELD{name="Version" title="Version" value="%25$VERSION%25"}%
%META:FIELD{name="Release" title="Release" value="%25$RELEASE%25"}%
%META:FIELD{name="Version" title="Version" value="%$VERSION%"}%
%META:FIELD{name="Compatibility" title="Compatibility" value="1.2.0"}%
%META:FIELD{name="Release" title="Release" value="%$RELEASE%"}%
%META:FIELD{name="Repository" title="Repository" value="https://github.com/foswiki/distro"}%
%META:FIELD{name="Copyright" title="Copyright" value="&copy; 2007-2014, Crawford Currie http://c-dot.co.uk %25BR%25 &copy; 2008-2014 Foswiki Contributors"}%
%META:FIELD{name="License" title="License" value="GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]])"}%
%META:FIELD{name="Home" title="Home" value="http://foswiki.org/Extensions/%25$ROOTMODULE%25"}%
%META:FIELD{name="Support" title="Support" value="http://foswiki.org/Support/%25$ROOTMODULE%25"}%
%META:FILEATTACHMENT{name="logo.gif" attr="h" autoattached="1" comment="" date="1430749988" size="21246" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="wikiringlogo20x20.png" attr="h" autoattached="1" comment="" date="1430749988" size="1343" user="ProjectContributor" version="1"}%
%META:FIELD{name="Home" title="Home" value="http://foswiki.org/Extensions/%$ROOTMODULE%"}%
%META:FIELD{name="Support" title="Support" value="http://foswiki.org/Support/%$ROOTMODULE%"}%
%META:FILEATTACHMENT{name="logo.gif" attr="h" autoattached="1" comment="" date="1433863642" size="21246" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="wikiringlogo20x20.png" attr="h" autoattached="1" comment="" date="1433863642" size="1343" user="ProjectContributor" version="1"}%
8 changes: 5 additions & 3 deletions SubscribePlugin/data/System/VarSUBSCRIBE.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1417320330" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1433863566" format="1.1" version="1"}%
#VarSUBSCRIBE
---+++ SUBSCRIBE{ _attributes_ } - subscribe the current user for notification of changes to the current topic
%STARTSECTION{"subscribe_attributes"}%
Expand All @@ -9,9 +9,11 @@ Anywhere in a topic or template:
| =who= | Logged-in user | Who to subscribe (wikiname, no web) |
| =topic= | Current topic | Topic to subscribe to. Wildcards may be used e.g. =topic="Item*"= will subscribe to all topics starting with =Item=. Use =topic="%USERSWEB%.*"= to subscribe to the !WebNotify for the %USERSWEB% web. |
| =unsubscribe= | Not set | If set to "on", will *unsubscribe* the user |
| =format= | Simple HTML link with an action anchor "Subscribe" or "Unsubscribe" | Defines custom look-and-feel for subscribe link using the following format variables: =$topics=, =$url=, =$wikiname=, =$action= *DEPRECATED do not use* |
| =formatunsubscribe= | =format= | Serves same function as =format=, but allows the user to define a different format than =subscribe=. *DEPRECATED do not use* |

The format of the Subscribe/Unsubscribe button is defined in a template file =templates/subscribe.tmpl=. The normal skin mechanisms can be used to override this with your own local definitions. The default template works with Javascript to provide a smooth interactive experience.

%X% The =format= and =formatunsubscribe= parameters have been removed and will
be ignored. The version of !PatternSkin shipped with Foswiki 1.1.9 used these
parameters.

%ENDSECTION{"subscribe_attributes"}%
8 changes: 2 additions & 6 deletions SubscribePlugin/lib/Foswiki/Plugins/SubscribePlugin.pm
Expand Up @@ -88,11 +88,7 @@ sub _SUBSCRIBE {
$topic ) ) ? 1 : 0;
my $doUnsubscribe = Foswiki::isTrue($unsubscribe);

my $tmpl;

$tmpl = $doUnsubscribe ? $params->{formatunsubscribe} : $params->{format};
$tmpl = _template_text( ( $doUnsubscribe ? 'un' : '' ) . 'subscribe' )
unless defined $tmpl;
my $tmpl = _template_text( ( $doUnsubscribe ? 'un' : '' ) . 'subscribe' );

my $action =
$session->i18n->maketext( $doUnsubscribe ? "Unsubscribe" : "Subscribe" );
Expand All @@ -105,7 +101,7 @@ sub _SUBSCRIBE {

Foswiki::Plugins::JQueryPlugin::createPlugin("subscribe");

return $tmpl;
return "<span class='foswikiRequiresChangePermission'>$tmpl</span>";
}

# subscribe_topic (topic is used if subscribe_topic is missing)
Expand Down

0 comments on commit d9394f7

Please sign in to comment.