From: <var...@us...> - 2008-12-13 19:19:21
|
Revision: 6355 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6355&view=rev Author: vargenau Date: 2008-12-13 19:19:17 +0000 (Sat, 13 Dec 2008) Log Message: ----------- Added "align" parameter to PrevNext plugin Modified Paths: -------------- trunk/lib/plugin/PrevNext.php trunk/pgsrc/Help%2FPrevNextPlugin Modified: trunk/lib/plugin/PrevNext.php =================================================================== --- trunk/lib/plugin/PrevNext.php 2008-12-04 07:51:53 UTC (rev 6354) +++ trunk/lib/plugin/PrevNext.php 2008-12-13 19:19:17 UTC (rev 6355) @@ -2,6 +2,7 @@ rcs_id('$Id$'); /** Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam + Copyright 2008 Marc-Etienne Vargenau, Alcatel-Lucent This file is part of PhpWiki. @@ -52,6 +53,7 @@ 'last' => '', 'order' => '', 'style' => 'button', // or 'text' + 'align' => 'left', // or 'right', or 'center' 'class' => 'wikiaction' ); } @@ -79,11 +81,27 @@ global $WikiTheme; $sep = $WikiTheme->getButtonSeparator(); - $links = HTML(); + if ($align == 'center') { + $tr = HTML::tr(); + $links = HTML::table(array('cellpadding' => 0, 'cellspacing' => 0, 'width' => '100%'), $tr); + } else if ($align == 'right') { + $td = HTML::td(array('align' => $align)); + $links = HTML::table(array('cellpadding' => 0, 'cellspacing' => 0, 'width' => '100%'), HTML::tr($td)); + } else { + $links = HTML(); + } + if ($style == 'text') { - if (!$sep) + if (!$sep) { $sep = " | "; // force some kind of separator - $links->pushcontent(" [ "); + } + if ($align == 'center') { + $tr->pushContent(HTML::td(array('align' => $align), " [ ")); + } else if ($align == 'right') { + $td->pushcontent(" [ "); + } else { + $links->pushcontent(" [ "); + } } $last_is_text = false; $this_is_first = true; @@ -94,35 +112,92 @@ if ($style == 'button') { // localized version: _("Previous").gif if ($imgurl = $WikiTheme->getButtonURL($label)) { - if ($last_is_text) - $links->pushContent($sep); - $links->pushcontent(new ImageButton($label, $url, - false, $imgurl)); + if ($last_is_text) { + if ($align == 'center') { + $tr->pushContent(HTML::td(array('align' => $align), $sep)); + } else if ($align == 'right') { + $td->pushcontent($sep); + } else { + $links->pushcontent($sep); + } + } + if ($align == 'center') { + $tr->pushContent(HTML::td(array('align' => $align), new ImageButton($label, $url, false, $imgurl))); + } else if ($align == 'right') { + $td->pushContent(new ImageButton($label, $url, false, $imgurl)); + } else { + $links->pushcontent(new ImageButton($label, $url, false, $imgurl)); + } $last_is_text = false; // generic version: prev.gif } elseif ($imgurl = $WikiTheme->getButtonURL($dir)) { - if ($last_is_text) - $links->pushContent($sep); - $links->pushContent(new ImageButton($label, $url, - false, $imgurl)); + if ($last_is_text) { + if ($align == 'center') { + $tr->pushContent(HTML::td(array('align' => $align), $sep)); + } else if ($align == 'right') { + $td->pushcontent($sep); + } else { + $links->pushcontent($sep); + } + } + if ($align == 'center') { + $tr->pushContent(HTML::td(array('align' => $align), new ImageButton($label, $url, false, $imgurl))); + } else if ($align == 'right') { + $td->pushContent(new ImageButton($label, $url, false, $imgurl)); + } else { + $links->pushcontent(new ImageButton($label, $url, false, $imgurl)); + } $last_is_text = false; } else { // text only - if (! $this_is_first) - $links->pushContent($sep); - $links->pushContent(new Button($label, $url, $class)); + if (! $this_is_first) { + if ($align == 'center') { + $tr->pushContent(HTML::td(array('align' => $align), $sep)); + } else if ($align == 'right') { + $td->pushcontent($sep); + } else { + $links->pushcontent($sep); + } + } + if ($align == 'center') { + $tr->pushContent(HTML::td(array('align' => $align), new Button($label, $url, $class))); + } else if ($align == 'right') { + $td->pushContent(new Button($label, $url, $class)); + } else { + $links->pushcontent(new Button($label, $url, $class)); + } $last_is_text = true; } } else { - if (! $this_is_first) - $links->pushContent($sep); - $links->pushContent(new Button($label, $url, $class)); + if (! $this_is_first) { + if ($align == 'center') { + $tr->pushContent(HTML::td(array('align' => $align), $sep)); + } else if ($align == 'right') { + $td->pushcontent($sep); + } else { + $links->pushcontent($sep); + } + } + if ($align == 'center') { + $tr->pushContent(HTML::td(array('align' => $align), new Button($label, $url, $class))); + } else if ($align == 'right') { + $td->pushContent(new Button($label, $url, $class)); + } else { + $links->pushcontent(new Button($label, $url, $class)); + } $last_is_text = true; } $this_is_first = false; } } - if ($style == 'text') - $links->pushcontent(" ] "); + if ($style == 'text') { + if ($align == 'center') { + $tr->pushContent(HTML::td(array('align' => $align), " ] ")); + } else if ($align == 'right') { + $td->pushcontent(" ] "); + } else { + $links->pushcontent(" ] "); + } + } return $links; } } Modified: trunk/pgsrc/Help%FPrevNextPlugin =================================================================== --- trunk/pgsrc/Help%2FPrevNextPlugin 2008-12-04 07:51:53 UTC (rev 6354) +++ trunk/pgsrc/Help%2FPrevNextPlugin 2008-12-13 19:19:17 UTC (rev 6355) @@ -1,4 +1,4 @@ -Date: Mon, 9 Aug 2008 12:19:24 +0000 +Date: Mon, 12 Dec 2008 12:19:24 +0000 Mime-Version: 1.0 (Produced by PhpWiki 1.3.14-20080124) X-Rcs-Id: $Id$ Content-Type: application/x-phpwiki; @@ -55,6 +55,10 @@ | Reorder the buttons: comma-delimited | empty |- +| <b>order</b> +| Can be ''left'', ''right'' or ''center'' +| left +|- | <b>style</b> | Can be ''button'' or ''text'' | button @@ -87,6 +91,34 @@ <verbatim> <?plugin PrevNext prev="Help/CreateTocPlugin" next="Help/MediawikiTablePlugin" + contents="Help" + align="right" +?> +</verbatim> + +<?plugin PrevNext prev="Help/CreateTocPlugin" + next="Help/MediawikiTablePlugin" + contents="Help" + align="right" +?> + +<verbatim> +<?plugin PrevNext prev="Help/CreateTocPlugin" + next="Help/MediawikiTablePlugin" + contents="Help" + align="center" +?> +</verbatim> + +<?plugin PrevNext prev="Help/CreateTocPlugin" + next="Help/MediawikiTablePlugin" + contents="Help" + align="center" +?> + +<verbatim> +<?plugin PrevNext prev="Help/CreateTocPlugin" + next="Help/MediawikiTablePlugin" up="Help" style="text" ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |