r69092 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69091‎ | r69092 | r69093 >
Date:13:43, 6 July 2010
Author:siebrand
Status:deferred
Tags:
Comment:
* revert r69087
* implement what we needed (translation tool entry page displaying stats for user language) directly into Special:LanguageStats
* remove obsolete code
* remove some double spaces
Modified paths:
  • /trunk/extensions/Translate/SpecialLanguageStats.php (modified) (history)
  • /trunk/extensions/Translate/SpecialMyLanguage.php (modified) (history)
  • /trunk/extensions/Translate/SpecialTranslationStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/SpecialMyLanguage.php
@@ -22,9 +22,9 @@
2323 $title = null;
2424 if ( strval($par) !== '' ) {
2525 $title = Title::newFromText( $par );
26 - if ( $title && ( $title->exists() || $title->isAlwaysKnown() ) ) {
 26+ if ( $title && $title->exists() ) {
2727 $local = Title::newFromText( "$par/" . $wgLang->getCode() );
28 - if ( $local && ( $local->exists() || $local->isAlwaysKnown() ) ) {
 28+ if ( $local && $local->exists() ) {
2929 $title = $local;
3030 }
3131 }
Index: trunk/extensions/Translate/SpecialLanguageStats.php
@@ -31,16 +31,22 @@
3232 $code = $wgRequest->getVal( 'code', $par );
3333 $suppressComplete = $wgRequest->getVal( 'suppresscomplete', $par );
3434 $wgOut->addHTML( $this->buildLanguageForm( $code, $suppressComplete ) );
35 -/*
36 - $form = $this->buildLanguageForm( $code, $suppressComplete );
37 - $form->show();
38 -*/
3935 } else {
4036 $paramArray = explode( '/', $par, 2 );
4137 $code = $paramArray[0];
4238 $suppressComplete = isset( $paramArray[1] ) && (bool)$paramArray[1];
4339 }
4440
 41+ if ( !$code ) {
 42+ global $wgUser;
 43+
 44+ if ( $wgUser->isLoggedIn() ) {
 45+ global $wgLnng;
 46+
 47+ $code = $wgLang->getCode();
 48+ }
 49+ }
 50+
4551 $out = '';
4652
4753 if ( array_key_exists( $code, Language::getLanguageNames() ) ) {
@@ -60,28 +66,10 @@
6167 */
6268 function buildLanguageForm( $code = '', $suppressComplete = false ) {
6369 global $wgScript;
 70+
6471 $t = $this->getTitle();
6572
66 -/*
67 - $formFields = array(
68 - 'code' => array(
69 - 'type' => 'text',
70 - 'label-message' => 'translate-language-code-field-name',
71 - 'size' => '30'
72 - ),
73 - 'suppresscomplete' => array(
74 - 'type' => 'toggle',
75 - 'label-message' => 'translate-suppress-complete',
76 - ),
77 - );
78 -
79 - $form = new HTMLForm( $formFields );
80 - $form->setTitle( SpecialPage::getTitleFor( 'LanguageStats' ) );
81 -
82 - return $form;
83 -*/
84 -
85 - $out = Xml::openElement( 'div', array( 'class' => 'languagecode' ) );
 73+ $out = Xml::openElement( 'div', array( 'class' => 'languagecode' ) );
8674 $out .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
8775 $out .= Xml::hidden( 'title', $t->getPrefixedText() );
8876 $out .= Xml::openElement( 'fieldset' );
@@ -89,10 +77,10 @@
9078 $out .= Xml::openElement( 'table', array( 'id' => 'langcodeselect', 'class' => 'allpages' ) );
9179
9280 $out .= Xml::openElement( 'tr' );
93 - $out .= Xml::openElement( 'td', array( 'class' => 'mw-label' ) );
 81+ $out .= Xml::openElement( 'td', array( 'class' => 'mw-label' ) );
9482 $out .= Xml::label( wfMsg( 'translate-language-code-field-name' ), 'code' );
9583 $out .= Xml::closeElement( 'td' );
96 - $out .= Xml::openElement( 'td', array( 'class' => 'mw-input' ) );
 84+ $out .= Xml::openElement( 'td', array( 'class' => 'mw-input' ) );
9785 $out .= Xml::input( 'code', 30, str_replace( '_', ' ', $code ), array( 'id' => 'code' ) );
9886 $out .= Xml::closeElement( 'td' );
9987 $out .= Xml::closeElement( 'tr' );
Index: trunk/extensions/Translate/SpecialTranslationStats.php
@@ -50,7 +50,6 @@
5151 if ( $this->including() ) {
5252 $wgOut->addHTML( $this->image( $opts ) );
5353 } elseif ( $opts['graphit'] ) {
54 -
5554 // Cache for two hours
5655 if ( !$opts['preview'] ) {
5756 $lastMod = $wgOut->checkLastModified( wfTimestamp( TS_MW, time() - 2 * 3600 ) );
@@ -193,7 +192,7 @@
194193
195194 ksort( $languages );
196195
197 - $selector = new XmlSelect( 'mw-language-selector', 'mw-language-selector' );
 196+ $selector = new XmlSelect( 'mw-language-selector', 'mw-language-selector' );
198197 foreach ( $languages as $code => $name ) {
199198 $selector->addOption( "$code - $name", $code );
200199 }
@@ -232,7 +231,7 @@
233232
234233 ksort( $groups );
235234
236 - $selector = new XmlSelect( 'mw-group-selector', 'mw-group-selector' );
 235+ $selector = new XmlSelect( 'mw-group-selector', 'mw-group-selector' );
237236 foreach ( $groups as $code => $name ) {
238237 $selector->addOption( $name->getLabel(), $code );
239238 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69087Append language code to special pages instead of not doing anythingnikerabbit09:30, 6 July 2010

Status & tagging log