r96583 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96582‎ | r96583 | r96584 >
Date:16:34, 8 September 2011
Author:maxsem
Status:ok
Tags:
Comment:
TOC for hieroglyph list
Modified paths:
  • /trunk/extensions/wikihiero/SpecialHieroglyphs.php (modified) (history)
  • /trunk/extensions/wikihiero/modules/ext.wikihiero.Special.css (modified) (history)

Diff [purge]

Index: trunk/extensions/wikihiero/SpecialHieroglyphs.php
@@ -62,9 +62,12 @@
6363 . Html::closeElement( 'form' )
6464 );
6565
 66+ $out->addHTML( '<table><tr><td>' );
6667 $out->addHTML( '<div class="mw-hiero-list">' );
6768 $out->addHTML( $this->listHieroglyphs() );
68 - $out->addHTML( '</div>' );
 69+ $out->addHTML( '</div></td><td>' );
 70+ $out->addHTML( $this->getToc() );
 71+ $out->addHTML( '</td></tr></table>' );
6972 }
7073
7174 /**
@@ -124,6 +127,32 @@
125128 return $html;
126129 }
127130
 131+ private function getToc() {
 132+ $html = '<table class="toc mw-hiero-toc"><tr>';
 133+ $count = 0;
 134+ $cats = $this->getCategories();
 135+ $end = array_pop( $cats );
 136+ foreach ( $cats as $cat ) {
 137+ $html .= '<td>'
 138+ . Html::element( 'a',
 139+ array( 'href' => "#cat-$cat", 'title' => wfMessage( "wikihiero-category-$cat" )->text() ),
 140+ $cat
 141+ )
 142+ . '</td>';
 143+ $count++;
 144+ if ( $count % 5 == 0 ) {
 145+ $html .= '</tr><tr>';
 146+ }
 147+ }
 148+ $html .= '</tr><tr><td colspan="5">'
 149+ . Html::element( 'a',
 150+ array( 'href' => "#cat-$end", 'title' => wfMessage( "wikihiero-category-$end" )->text() ),
 151+ $end
 152+ )
 153+ . '</td>';
 154+ return $html . '</tr></table>';
 155+ }
 156+
128157 /**
129158 * Returns an array with hieroglyph categories from Gardiner's list
130159 */
Index: trunk/extensions/wikihiero/modules/ext.wikihiero.Special.css
@@ -2,4 +2,9 @@
33 overflow: auto;
44 height: 400px;
55 margin-top: 1em;
 6+ border: 1px solid silver;
67 }
 8+
 9+.mw-hiero-toc {
 10+ text-align: center;
 11+}

Status & tagging log