r72028 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72027‎ | r72028 | r72029 >
Date:16:09, 31 August 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Make SpecialManageGroup a real special page
Modified paths:
  • /trunk/extensions/Translate/SpecialManageGroups.php (modified) (history)
  • /trunk/extensions/Translate/Translate.alias.php (modified) (history)
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/TranslatePage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/SpecialManageGroups.php
@@ -18,7 +18,7 @@
1919 *
2020 * @todo Needs documentation.
2121 */
22 -class SpecialManageGroups {
 22+class SpecialManageGroups extends SpecialPage {
2323 protected $skin, $user, $out;
2424 /**
2525 * Maximum allowed processing time in seconds.
@@ -33,9 +33,10 @@
3434 $this->out = $wgOut;
3535 $this->user = $wgUser;
3636 $this->skin = $wgUser->getSkin();
 37+ parent::__construct( 'ManageMessageGroups', 'translate-manage' );
3738 }
3839
39 - public function execute() {
 40+ public function execute( $par ) {
4041 global $wgRequest;
4142
4243 $this->out->setPageTitle( htmlspecialchars( wfMsg( 'translate-managegroups' ) ) );
@@ -85,6 +86,8 @@
8687 continue;
8788 }
8889
 90+ wfDebug( __METHOD__ . ": {$group->getId()}\n" );
 91+
8992 $link = $this->skin->link( $this->getTitle(), $group->getLabel(), array(), array( 'group' => $group->getId() ) );
9093 $out = $link . $separator;
9194
@@ -96,10 +99,20 @@
97100 $wgLang->time( $timestamp )
98101 );
99102
100 - if ( !$cache->isValid() ) {
101 - $out = '<span style="color:red">!!</span> ' . $out;
 103+ $languages = array_keys( Language::getLanguageNames( false ) );
 104+ $modified = array();
 105+
 106+ foreach ( $languages as $code ) {
 107+ $cache = new MessageGroupCache( $group, $code );
 108+ if ( !$cache->isValid() ) $modified[] = $code;
102109 }
103110
 111+ if ( count( $modified ) ) {
 112+ $out = '[' . implode( ",", $modified ) . '] ' . $out;
 113+ } else {
 114+ $out = Html::rawElement( 'span', array( 'style' => 'color:grey' ), $out );
 115+ }
 116+
104117 } else {
105118 $out .= wfMsg( 'translate-manage-newgroup' );
106119 }
@@ -124,13 +137,6 @@
125138 }
126139
127140 /**
128 - * Special:Translate/manage.
129 - */
130 - public function getTitle() {
131 - return SpecialPage::getTitleFor( 'Translate', 'manage' );
132 - }
133 -
134 - /**
135141 * @todo Very long code block; split up.
136142 */
137143 public function importForm( $group, $code ) {
Index: trunk/extensions/Translate/TranslatePage.php
@@ -39,18 +39,7 @@
4040
4141 $this->setHeaders();
4242
43 - if ( $parameters === 'manage' ) {
44 - $this->restriction( 'translate-manage' );
45 - if ( !$this->userCanExecute( $wgUser ) ) {
46 - $this->displayRestrictionError();
47 - return;
48 - }
49 -
50 - $manage = new SpecialManageGroups();
51 - $manage->execute();
52 -
53 - return;
54 - } elseif ( $parameters === 'editpage' ) {
 43+ if ( $parameters === 'editpage' ) {
5544 $editpage = TranslationEditPage::newFromRequest( $wgRequest );
5645
5746 if ( $editpage ) {
Index: trunk/extensions/Translate/Translate.php
@@ -66,6 +66,8 @@
6767 $wgSpecialPageGroups['LanguageStats'] = 'wiki';
6868 $wgSpecialPages['ImportTranslations'] = 'SpecialImportTranslations';
6969 $wgSpecialPageGroups['ImportTranslations'] = 'wiki';
 70+$wgSpecialPages['ManageMessageGroups'] = 'SpecialManageGroups';
 71+$wgSpecialPageGroups['ManageMessageGroups'] = 'wiki';
7072 // Unlisted special page; does not need $wgSpecialPageGroups.
7173 $wgSpecialPages['FirstSteps'] = 'SpecialFirstSteps';
7274 // Unlisted special page; does not need $wgSpecialPageGroups.
Index: trunk/extensions/Translate/Translate.alias.php
@@ -20,6 +20,7 @@
2121 'LanguageStats' => array( 'LanguageStats' ),
2222 'PageTranslation' => array( 'PageTranslation' ),
2323 'ImportTranslations' => array( 'ImportTranslations' ),
 24+ 'ManageMessageGroups'=> array( 'ManageMessageGroups' ),
2425 'FirstSteps' => array( 'FirstSteps' ),
2526 'SupportedLanguages' => array( 'SupportedLanguages' ),
2627 'MyLanguage' => array( 'MyLanguage' ),

Status & tagging log