Skip to content

Commit

Permalink
Item9422: perltidy
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@8507 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
PaulHarvey authored and PaulHarvey committed Aug 15, 2010
1 parent 56544a8 commit df8b3b9
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions TwistyPlugin/lib/Foswiki/Plugins/TwistyPlugin.pm
Expand Up @@ -42,8 +42,8 @@ sub initPlugin {
$doneHeader = 0;
$twistyCount = 0;

Foswiki::Plugins::JQueryPlugin::registerPlugin('twisty',
'Foswiki::Plugins::TwistyPlugin::TWISTY');
Foswiki::Plugins::JQueryPlugin::registerPlugin( 'twisty',
'Foswiki::Plugins::TwistyPlugin::TWISTY' );
Foswiki::Func::registerTagHandler( 'TWISTYSHOW', \&_TWISTYSHOW );
Foswiki::Func::registerTagHandler( 'TWISTYHIDE', \&_TWISTYHIDE );
Foswiki::Func::registerTagHandler( 'TWISTYBUTTON', \&_TWISTYBUTTON );
Expand Down Expand Up @@ -83,13 +83,15 @@ sub _addHeader {
return if $doneHeader;
$doneHeader = 1;

if (Foswiki::Func::getContext()->{JQueryPluginEnabled}) {
if ( Foswiki::Func::getContext()->{JQueryPluginEnabled} ) {
Foswiki::Plugins::JQueryPlugin::createPlugin('twisty');
} else {
}
else {
my $header;
Foswiki::Func::loadTemplate( 'twistyplugin' );
Foswiki::Func::loadTemplate('twistyplugin');

$header = Foswiki::Func::expandTemplate("TwistyPlugin/twisty")
$header =
Foswiki::Func::expandTemplate("TwistyPlugin/twisty")
. Foswiki::Func::expandTemplate("TwistyPlugin/twisty.css");
Foswiki::Func::expandCommonVariables($header);
}
Expand Down Expand Up @@ -139,7 +141,8 @@ sub _TWISTY {
$params->{'id'} = _createId( $params->{'id'}, $theWeb, $theTopic );
}
$params->{'id'} .= ++$twistyCount;
return _TWISTYBUTTON($session, $params, $theTopic, $theWeb) . _TWISTYTOGGLE($session, $params, $theTopic, $theWeb);
return _TWISTYBUTTON( $session, $params, $theTopic, $theWeb )
. _TWISTYTOGGLE( $session, $params, $theTopic, $theWeb );
}

sub _TWISTYTOGGLE {
Expand Down Expand Up @@ -206,7 +209,8 @@ sub _twistyBtn {
my $idTag;
if ($twistyControlState) {
$idTag = $id . $twistyControlState;
} else {
}
else {
$idTag = '';
}

Expand Down Expand Up @@ -348,8 +352,8 @@ sub _createHtmlProperties {
if ( !$isTrigger ) {
push( @classList, 'twistyContent' );

if ( not ($state eq $TWISTYPLUGIN_CONTENT_SHOWN) ) {
push( @propList, 'style="display: none;"' );
if ( not( $state eq $TWISTYPLUGIN_CONTENT_SHOWN ) ) {
push( @propList, 'style="display: none;"' );
push( @classList, 'foswikiMakeHidden' );
}
}
Expand Down Expand Up @@ -425,14 +429,22 @@ sub _wrapInContentHtmlClose {

sub _wrapInContainerHideIfNoJavascripOpen {
my ($mode) = @_;
my $inlineOrBlock = ($mode eq 'div')?'Block':'Inline';
return '<' . $mode . ' class="twistyPlugin foswikiMakeVisible'.$inlineOrBlock.'">';
my $inlineOrBlock = ( $mode eq 'div' ) ? 'Block' : 'Inline';
return
'<'
. $mode
. ' class="twistyPlugin foswikiMakeVisible'
. $inlineOrBlock . '">';
}

sub _wrapInContainerDivIfNoJavascripClose {
my ($mode) = @_;
my $inlineOrBlock = ($mode eq 'div')?'Block':'Inline';
return '</' . $mode . '><!--/twistyPlugin foswikiMakeVisible'.$inlineOrBlock.'-->';
my $inlineOrBlock = ( $mode eq 'div' ) ? 'Block' : 'Inline';
return
'</'
. $mode
. '><!--/twistyPlugin foswikiMakeVisible'
. $inlineOrBlock . '-->';
}

1;
Expand Down

0 comments on commit df8b3b9

Please sign in to comment.