Skip to content

Commit

Permalink
Item1323: reverting implementation
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@3204 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
EugenMayer authored and EugenMayer committed Mar 20, 2009
1 parent 1eca3b0 commit 28c6b68
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 138 deletions.
54 changes: 6 additions & 48 deletions TwistyPlugin/data/System/TwistyPlugin.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="EugenMayer" date="1237430220" format="1.1" reprev="1.2" version="1.2"}%
%META:TOPICINFO{author="ProjectContributor" date="1195487956" format="1.1" version="1.1"}%
---+!! <nop>%TOPIC%

*A "twisty" is an interface toggle control to show and hide content.*
Expand Down Expand Up @@ -446,7 +446,7 @@ Usage: =%<nop>TWISTY{ ... }% Toggable contents %<nop>ENDTWISTY%=
| =link= | Link label | Link label for both show and hide links | optional |
| =hidelink= | Link label | Hide link label | optional |
| =showlink= | Link label | Show link label | optional |
| =mode= | ="div"=, ="span"= or "accordion" ( see below ) | Specify if the Twisty Toggle section will use a =&lt;div&gt;= or a =&lt;span&gt;= tag. Note that if the contents contains block elements such as =div=, =mode= should be =div= as well to create valid HTML markup. %BR% Also used to define the type of the Twisty ( default, accordion, tabs ) | optional, defaults to =&lt;span&gt;= |
| =mode= | ="div"= or ="span"= | Specify if the Twisty Toggle section will use a =&lt;div&gt;= or a =&lt;span&gt;= tag. Note that if the contents contains block elements such as =div=, =mode= should be =div= as well to create valid HTML markup. | optional, defaults to =&lt;span&gt;= |
| =showimgleft= | Image url | Specify the url of an image that will be displayed with the show link at the left side of the link. <br />You may use [[%SYSTEMWEB%.Macros#VarICONURLPATH][ICONURLPATH]] to display one of the %SYSTEMWEB%.DocumentGraphics icons. Alternatively use an image attached to the topic. | optional, defaults to no image |
| =hideimgleft= | Image url | Specify the url of an image that will be displayed with the hide link at the left side of the link. <br />You may use [[%SYSTEMWEB%.Macros#VarICONURLPATH][ICONURLPATH]] to display one of the %SYSTEMWEB%.DocumentGraphics icons. Alternatively use an image attached to the topic. | optional, defaults to no image |
| =showimgright= | Image url | Specify the url of an image that will be displayed with the show link at the right side of the link. <br />You may use [[%SYSTEMWEB%.Macros#VarICONURLPATH][ICONURLPATH]] to display one of the %SYSTEMWEB%.DocumentGraphics icons. Alternatively use an image attached to the topic. | optional, defaults to no image |
Expand Down Expand Up @@ -551,23 +551,6 @@ This is useful if both the show and the hide button take the same arguments.
* Will end the most inner unclosed Twisty Toggle section, using the proper tag
* Example: =%<nop>ENDTWISTYTOGGLE%=
* Related: [[#VarTWISTYTOGGLE][TWISTYTOGGLE]]

#VarTWISTYITEM
---+++ TWISTYITEM
*The Twisty closure*
* Syntax: =%<nop>TWISTYITEM{"LABEL"}%=
* Starts a new TWISTY sub item, with the label =Test=
* Example: =%<nop>TWISTYITEM{"test"}%=
* Related: [[#ENDTWISTYITEM][ENDTWISTYITEM]]
It is .e.g used for defining tabs or accordion sections

#VarENDTWISTYITEM
---+++ ENDTWISTYITEM
*The Twisty closure*
* Syntax: =%<nop>ENDTWISTYITEM%=
* Ends a TWISTY item defintion
* Example: =%<nop>ENDTWISTYITEM%=
* Related: [[#TWISTYITEM][TWISTYITEM]]
</div>

---++ Working with other Javascript libraries
Expand All @@ -582,31 +565,6 @@ If you want to use a different Javascript library than the default Foswiki Javas
or write: =Set SKIN = dojo,pattern=
* For this, Foswiki:Extensions/DojoToolkitContrib needs to be installed


---++ Additional Twisty types
---+++ Accordion
You can have the accordion effect using TwistyPlugin with the common syntax. You can have a look at the demo on [[http://jqueryui.com/demos/accordion/]] to see how it will look like.
You will need to have install JQueryPlugin or JQueryCompatibiltyModePlugin ( yes it works with bots ). You will also have to include the ui.accordion.js somewhere.. please consider the documentation of both JQuery plugins to see how this works ( 1 minute job ). In the end, you can use it that way:

<verbatim>
%TWISTY{mode="accordion"}%

%TWISTYITEM{"General""}%
Here you have the general content
%ENDTWISTYITEM%
%TWISTYITEM{"Advanced""}%
Here you have the advanced content
%ENDTWISTYITEM%
%TWISTYITEM{"Experts""}%
Here you have the experts content
%ENDTWISTYITEM%

%ENDTWISTY{}%
</verbatim>

You can have as many TWISTYITEMS ( Sections ) as you like. Have fun :)


#PluginSettings
---++ Plugin Settings

Expand Down Expand Up @@ -636,14 +594,14 @@ a plugin setting write ==%<nop>&lt;plugin&gt;_&lt;setting&gt;%==, i.e. ==%<nop>T
%$DEPENDECIES%
* Visit =configure= in your Foswiki installation, and enable the plugin in the {Plugins} section.


---++ Plugin Info

| Authors: | Foswiki:Main.RafaelAlvarez, Foswiki:Main.MichaelDaum, Foswiki:Main.ArthurClemens, Foswiki:Main.EugenMayer |
| Copyright | Copyright (C) Rafael Alvarez; Michael Daum, Arthur Clemens, EugenMayer |
| Authors: | Foswiki:Main.RafaelAlvarez, Foswiki:Main.MichaelDaum, Foswiki:Main.ArthurClemens |
| Copyright | Copyright (C) Rafael Alvarez; Michael Daum, Arthur Clemens |
| License: | [[http://www.gnu.org/copyleft/gpl.html][GPL]] |
| Plugin&nbsp;Version: | 19 Mar 2009 (version 1.5.3) |
| Plugin&nbsp;Version: | 29 Jan 2009 (version 1.5.2) |
| Change&nbsp;History: | <!-- versions below in reverse order -->&nbsp; |
| 19 Mar 2009 | 1.5.3 Added the possibility to add new Twisty types. Added TWISTYITEM to be able to have subsections in TWISTY. Added an JQuery accordion implementation |
| 03 Dec 2008 | 1.5.1 Added parameter =linkclass=. Foswiki version |
| 27 Nov 2008 | 1.5 Foswiki release; added option to use other Javascript libraries. |
| 08 Oct 2008 | 1.4.11, 1.4.12 It is now possible to have a twisty on the same line without a linebreak. |
Expand Down
45 changes: 4 additions & 41 deletions TwistyPlugin/lib/Foswiki/Plugins/TwistyPlugin.pm
Expand Up @@ -3,7 +3,6 @@
# Copyright (C) Michael Daum
# Copyright (C) Arthur Clemens, arthur@visiblearea.com
# Copyright (C) Rafael Alvarez, soronthar@sourceforge.net
# Copyright (C) Eugen Mayer, mayer@impressive-media.de
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand All @@ -29,9 +28,6 @@ use Foswiki::Func;
use CGI::Cookie;
use strict;

# custom Twisty implementations
use Foswiki::Plugins::TwistyPlugin::Accordion;

use vars
qw( $VERSION $RELEASE $pluginName @modes $doneHeader $doneDefaults $twistyCount
$prefMode $prefShowLink $prefHideLink $prefRemember);
Expand All @@ -44,7 +40,7 @@ $VERSION = '$Rev$';
# 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 = '1.5.3';
$RELEASE = '1.5.2';

$pluginName = 'TwistyPlugin';

Expand Down Expand Up @@ -74,10 +70,6 @@ sub initPlugin {
Foswiki::Func::registerTagHandler( 'ENDTWISTY', \&_ENDTWISTYTOGGLE );
Foswiki::Func::registerTagHandler( 'TWISTYTOGGLE', \&_TWISTYTOGGLE );
Foswiki::Func::registerTagHandler( 'ENDTWISTYTOGGLE', \&_ENDTWISTYTOGGLE );

# this macros our for TWISTY types ( modes ) which need section in the TWISTY section
Foswiki::Func::registerTagHandler( 'TWISTYITEM', \&_TWISTYITEM );
Foswiki::Func::registerTagHandler( 'ENDTWISTYITEM', \&_ENDTWISTYITEM );

return 1;
}
Expand Down Expand Up @@ -153,24 +145,12 @@ sub _TWISTY {
my ( $session, $params, $theTopic, $theWeb ) = @_;

_addHeader();

$twistyCount++;
my $id = $params->{'id'};
if ( !defined $id || $id eq '' ) {
$params->{'id'} = _createId( $params->{'id'}, $theWeb, $theTopic );
}
# lets add the current mode to the stack so other elements can use it ( END, ITEMS )
my $mode = $params->{'mode'} || $prefMode;

if($mode eq "accordion") {
# SMELL:sadly we cant do this globaly, as the defaul one does this in the _TWISTYTOGGLE method and we cant
# extract it from there, as the macro can be called directly
unshift @modes, $mode;
return Foswiki::Plugins::TwistyPlugin::Accordion::_accordionStart(@_);
}
# add new types here
# default
return _TWISTYBUTTON(@_) . _TWISTYTOGGLE(@_);
}
return _TWISTYBUTTON(@_) . _TWISTYTOGGLE(@_);
}

sub _TWISTYTOGGLE {
Expand All @@ -183,6 +163,7 @@ sub _TWISTYTOGGLE {
my $idTag = $id . 'toggle';
my $mode = $params->{'mode'} || $prefMode;
unshift @modes, $mode;

my $isTrigger = 0;
my $cookieState = _readCookie( $session, $idTag );
my @propList =
Expand All @@ -202,9 +183,6 @@ sub _ENDTWISTYTOGGLE {
"<span class='foswikiAlert'>woops, ordering error: got an ENDTWISTY before seeing a TWISTY</span>"
unless $mode;

# ok lets switch case all the types
return Foswiki::Plugins::TwistyPlugin::Accordion::_accordionEnd(@_) if($mode eq "accordion");

my $modeTag = ($mode) ? '</' . $mode . '>' : '';
return $modeTag . _wrapInContentHtmlClose($mode);
}
Expand Down Expand Up @@ -456,19 +434,4 @@ sub _wrapInContainerDivIfNoJavascripClose {
return '</' . $mode . '><!--/twistyPlugin foswikiMakeVisibleInline-->';
}

sub _TWISTYITEM {
my ( $session, $params, $theTopic, $theWeb ) = @_;
# the last started TWISTY added his mode / type to our global modes stack, so we can get the type out of it
my $type = $modes[0];
return Foswiki::Plugins::TwistyPlugin::Accordion::_accordionItemStart(@_) if($type eq "accordion");
# add new types here
}

sub _ENDTWISTYITEM {
my ( $session, $params, $theTopic, $theWeb ) = @_;
# the last started TWISTY added his mode / type to our global modes stack, so we can get the type out of it
my $type = $modes[0];
return Foswiki::Plugins::TwistyPlugin::Accordion::_accordionItemEnd(@_) if($type eq "accordion");
# add new types here
}
1;
46 changes: 0 additions & 46 deletions TwistyPlugin/lib/Foswiki/Plugins/TwistyPlugin/Accordion.pm

This file was deleted.

1 change: 0 additions & 1 deletion TwistyPlugin/lib/Foswiki/Plugins/TwistyPlugin/MANIFEST
@@ -1,6 +1,5 @@
data/System/TwistyPlugin.txt 0644
lib/Foswiki/Plugins/TwistyPlugin.pm 0444
lib/Foswiki/Plugins/TwistyPlugin/Accordion.pm 0444
pub/System/TwistyPlugin/twisty.js 0644
pub/System/TwistyPlugin/twisty.css 0644
pub/System/TwistyPlugin/twisty.dojo.js 0644
Expand Down
3 changes: 2 additions & 1 deletion TwistyPlugin/pub/System/TwistyPlugin/twisty.css
Expand Up @@ -17,4 +17,5 @@
.foswikiMakeVisibleInline,
.foswikiMakeVisibleBlock {
display:none; /* will be made visible with javascript */
}
}

3 changes: 2 additions & 1 deletion TwistyPlugin/pub/System/TwistyPlugin/twisty.jquery.css
Expand Up @@ -17,4 +17,5 @@ span.twistyContent {}
.foswikiMakeVisibleInline,
.foswikiMakeVisibleBlock {
display:none; /* will be made visible with javascript */
}
}

0 comments on commit 28c6b68

Please sign in to comment.