From: <var...@us...> - 2009-02-20 16:20:30
|
Revision: 6521 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6521&view=rev Author: vargenau Date: 2009-02-20 16:20:24 +0000 (Fri, 20 Feb 2009) Log Message: ----------- Allow multiple table of contents in a page Modified Paths: -------------- trunk/lib/plugin/CreateToc.php trunk/themes/MonoBook/commonPrint.css trunk/themes/MonoBook/main.css trunk/themes/Sidebar/monobook.css trunk/themes/default/wikicommon.js Modified: trunk/lib/plugin/CreateToc.php =================================================================== --- trunk/lib/plugin/CreateToc.php 2009-02-20 14:36:19 UTC (rev 6520) +++ trunk/lib/plugin/CreateToc.php 2009-02-20 16:20:24 UTC (rev 6521) @@ -371,14 +371,15 @@ } } $content = $current->getContent(); - $html = HTML::div(array('class' => 'toc', 'id'=>'toc')); + $html = HTML::div(array('class' => 'toc', 'id'=> GenerateId("toc"))); if ($notoc) { $html->setAttr('style','display:none;'); } if (($position == "left") or ($position == "right")) { $html->setAttr('style','float:'.$position.'; width:'.$width.';'); } - $list = HTML::div(array('id'=>'toclist')); + $toclistid = GenerateId("toclist"); + $list = HTML::div(array('id'=>$toclistid, 'class'=>toclist)); if (!strstr($headers,",")) { $headers = array($headers); } else { @@ -415,33 +416,18 @@ $list->setAttr('style','display:'.($jshide?'none;':'block;')); $open = DATA_PATH.'/'.$WikiTheme->_findFile("images/folderArrowOpen.png"); $close = DATA_PATH.'/'.$WikiTheme->_findFile("images/folderArrowClosed.png"); - $html->pushContent(Javascript(" -function toggletoc(a) { - var toc=document.getElementById('toclist') - //toctoggle=document.getElementById('toctoggle') - var open='".$open."' - var close='".$close."' - if (toc.style.display=='none') { - toc.style.display='block' - a.title='"._("Click to hide the TOC")."' - a.src = open - } else { - toc.style.display='none'; - a.title='"._("Click to display")."' - a.src = close - } -}")); if ($noheader) { } else { + $toctoggleid = GenerateId("toctoggle"); if ($extracollapse) $toclink = HTML(_("Table of Contents"), " ", HTML::a(array('name'=>'TOC')), HTML::img(array( - 'id'=>'toctoggle', + 'id'=>$toctoggleid, 'class'=>'wikiaction', 'title'=>_("Click to display to TOC"), - 'onclick'=>"toggletoc(this)", + 'onclick'=>"toggletoc(this, '".$open."', '".$close."', '".$toclistid."')", 'border' => 0, 'alt' => 'toctoggle', 'src' => $jshide ? $close : $open ))); @@ -449,11 +435,11 @@ $toclink = HTML::a(array('name'=>'TOC', 'class'=>'wikiaction', 'title'=>_("Click to display"), - 'onclick'=>"toggletoc(this)"), + 'onclick'=>"toggletoc(this, '".$open."', '".$close."', '".$toclistid."')"), _("Table of Contents"), HTML::span(array('style'=>'display:none', - 'id'=>'toctoggle')," ")); - $html->pushContent(HTML::p(array('id'=>'toctitle'), $toclink)); + 'id'=>$toctoggleid)," ")); + $html->pushContent(HTML::p(array('class'=>'toctitle'), $toclink)); } $html->pushContent($list); if (count($headers) == 0) { Modified: trunk/themes/MonoBook/commonPrint.css =================================================================== --- trunk/themes/MonoBook/commonPrint.css 2009-02-20 14:36:19 UTC (rev 6520) +++ trunk/themes/MonoBook/commonPrint.css 2009-02-20 16:20:24 UTC (rev 6521) @@ -14,6 +14,7 @@ a.stub, a.new{ color:#ba0000; text-decoration:none; } +.toc, #toc { /*border:1px solid #2f6fab;*/ border:1px solid #aaaaaa; Modified: trunk/themes/MonoBook/main.css =================================================================== --- trunk/themes/MonoBook/main.css 2009-02-20 14:36:19 UTC (rev 6520) +++ trunk/themes/MonoBook/main.css 2009-02-20 16:20:24 UTC (rev 6521) @@ -350,6 +350,7 @@ clear: right; } #toc #toctitle, +.toc .toctitle, .toc #toctitle { display: inline; border: none; @@ -357,6 +358,7 @@ font-size: 110%; font-weight: bold; } +.toc .toclist, .toc #toclist { width: auto; border: none; Modified: trunk/themes/Sidebar/monobook.css =================================================================== --- trunk/themes/Sidebar/monobook.css 2009-02-20 14:36:19 UTC (rev 6520) +++ trunk/themes/Sidebar/monobook.css 2009-02-20 16:20:24 UTC (rev 6521) @@ -372,6 +372,7 @@ font-size: 100%; font-weight: bold; } +.toc .toclist, .toc #toclist { width: auto; border: none; Modified: trunk/themes/default/wikicommon.js =================================================================== --- trunk/themes/default/wikicommon.js 2009-02-20 14:36:19 UTC (rev 6520) +++ trunk/themes/default/wikicommon.js 2009-02-20 16:20:24 UTC (rev 6521) @@ -12,3 +12,17 @@ } } } + +function toggletoc(a, open, close, toclist) { + var toc=document.getElementById(toclist) + if (toc.style.display=='none') { + toc.style.display='block' + a.title='"._("Click to hide the TOC")."' + a.src = open + } else { + toc.style.display='none'; + a.title='"._("Click to display")."' + a.src = close + } +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |