r43601 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43600‎ | r43601 | r43602 >
Date:12:46, 17 November 2008
Author:jojo
Status:ok
Tags:
Comment:
Modified paths:
  • /trunk/extensions/Collection/Collection.body.php (modified) (history)
  • /trunk/extensions/Collection/Collection.i18n.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.i18n.php
@@ -37,6 +37,7 @@
3838 'coll-n_pages' => '$1 {{PLURAL:$1|page|pages}}',
3939 'coll-unknown_subpage_title' => 'Unknown subpage',
4040 'coll-unknown_subpage_text' => 'This subpage of [[Special:Collection|Collection]] does not exist',
 41+ 'coll-printable_version_pdf' => 'PDF version',
4142 'coll-download_as' => 'Download as $1',
4243 'coll-noscript_text' => '<h1>JavaScript is required!</h1>
4344 <strong>Your browser does not support JavaScript or JavaScript has been turned off.
Index: trunk/extensions/Collection/Collection.body.php
@@ -937,15 +937,17 @@
938938 if ( $skinTemplate->iscontent && ( $action == '' || $action == 'view' || $action == 'purge' ) ) {
939939 if ( self::isCollectionPage( $skinTemplate->mTitle, $wgArticle ) ) {
940940 $params = 'colltitle=' . wfUrlencode( $skinTemplate->mTitle->getPrefixedDBKey() );
941 - foreach ( $wgCollectionFormats as $writer => $name ) {
942 - $nav_urls['download_as_' . $writer] = array(
 941+ if ( isset( $wgCollectionFormats['rl'] ) ) {
 942+ $nav_urls['printable_version_pdf'] = array(
943943 'href' => SkinTemplate::makeSpecialUrlSubpage(
944944 'Collection',
945945 'render_collection/',
946 - $params . '&writer=' . $writer ),
947 - 'text' => wfMsg( 'coll-download_as', $name ),
 946+ $params . '&writer=rl'),
 947+ 'text' => wfMsg( 'coll-printable_version_pdf' ),
948948 );
949949 }
 950+ foreach ( $wgCollectionFormats as $writer => $name ) {
 951+ }
950952 } else {
951953 $params = 'arttitle=' . $skinTemplate->mTitle->getPrefixedURL();
952954 if( $wgArticle ) {
@@ -954,13 +956,13 @@
955957 $params .= '&oldid=' . $oldid;
956958 }
957959 }
958 - foreach ( $wgCollectionFormats as $writer => $name ) {
959 - $nav_urls['download_as_' . $writer] = array(
 960+ if ( isset( $wgCollectionFormats['rl'] ) ) {
 961+ $nav_urls['printable_version_pdf'] = array(
960962 'href' => SkinTemplate::makeSpecialUrlSubpage(
961963 'Collection',
962964 'render_article/',
963965 $params . '&writer=' . $writer ),
964 - 'text' => wfMsg( 'coll-download_as', $name )
 966+ 'text' => wfMsg( 'coll-printable_version_pdf' )
965967 );
966968 }
967969 }
@@ -975,16 +977,13 @@
976978 static function insertMonoBookToolboxLink( &$skinTemplate ) {
977979 global $wgCollectionFormats;
978980
979 - foreach ( $wgCollectionFormats as $writer => $name ) {
980 - if ( !empty( $skinTemplate->data['nav_urls']['download_as_' . $writer]['href'] ) ) {
981 - $href = htmlspecialchars( $skinTemplate->data['nav_urls']['download_as_' . $writer]['href'] );
982 - $label = htmlspecialchars( $skinTemplate->data['nav_urls']['download_as_' . $writer]['text'] );
983 - print <<<EOS
 981+ if ( !empty( $skinTemplate->data['nav_urls']['printable_version_pdf']['href'] ) ) {
 982+ $href = htmlspecialchars( $skinTemplate->data['nav_urls']['printable_version_pdf']['href'] );
 983+ $label = htmlspecialchars( $skinTemplate->data['nav_urls']['printable_version_pdf']['text'] );
 984+ print <<<EOS
984985 <li id="t-download-as-$writer"><a href="$href" rel="nofollow">$label</a></li>
985986 EOS
986 - ;
987 - }
988 -
 987+ ;
989988 }
990989 return true;
991990 }

Status & tagging log