TuxMessageTable.php
Go to the documentation of this file.00001 <?php
00002
00003 class TuxMessageTable extends ContextSource {
00004 protected $group;
00005 protected $language;
00006
00007 public function __construct( IContextSource $context, MessageGroup $group, $language ) {
00008 $this->setContext( $context );
00009 $this->group = $group;
00010 $this->language = $language;
00011 }
00012
00013 public function fullTable() {
00014 $modules = array( 'ext.translate.editor' );
00015 wfRunHooks( 'TranslateBeforeAddModules', array( &$modules ) );
00016 $this->getOutput()->addModules( $modules );
00017
00018 $sourceLang = Language::factory( $this->group->getSourceLanguage() );
00019 $targetLang = Language::factory( $this->language );
00020 $batchSize = 100;
00021
00022 $list = Html::element( 'div', array(
00023 'class' => 'row tux-messagelist',
00024 'data-grouptype' => get_class( $this->group ),
00025 'data-sourcelangcode' => $sourceLang->getCode(),
00026 'data-sourcelangdir' => $sourceLang->getDir(),
00027 'data-targetlangcode' => $targetLang->getCode(),
00028 'data-targetlangdir' => $targetLang->getDir(),
00029 ) );
00030
00031 $groupId = htmlspecialchars( $this->group->getId() );
00032 $msg = $this->msg( 'tux-messagetable-loading-messages' )
00033 ->numParams( $batchSize )
00034 ->escaped();
00035
00036 $loader = <<<HTML
00037 <div class="tux-messagetable-loader hide" data-messagegroup="$groupId" data-pagesize="$batchSize">
00038 <span class="tux-loading-indicator"></span>
00039 <div class="tux-messagetable-loader-count"></div>
00040 <div class="tux-messagetable-loader-more">$msg</div>
00041 </div>
00042 HTML;
00043
00044 $hideOwn = $this->msg( 'tux-editor-proofreading-hide-own-translations' )->escaped();
00045 $clearTranslated = $this->msg( 'tux-editor-clear-translated' )->escaped();
00046 $modeTranslate = $this->msg( 'tux-editor-translate-mode' )->escaped();
00047 $modePage = $this->msg( 'tux-editor-page-mode' )->escaped();
00048 $modeProofread = $this->msg( 'tux-editor-proofreading-mode' )->escaped();
00049
00050 $actionbar = <<<HTML
00051 <div class="tux-action-bar row">
00052 <div class="three columns tux-message-list-statsbar" data-messagegroup="$groupId"></div>
00053 <div class="three columns text-center">
00054 <button class="toggle button tux-proofread-own-translations-button hide-own hide">
00055 $hideOwn
00056 </button>
00057 <button class="toggle button tux-editor-clear-translated hide">$clearTranslated</button>
00058 </div>
00059 <div class="six columns tux-view-switcher text-center">
00060 <button class="toggle button down translate-mode-button">$modeTranslate
00061 </button><button class="toggle button down page-mode-button">$modePage
00062 </button><button class="toggle button hide proofread-mode-button">$modeProofread
00063 </button>
00064 </div>
00065 </div>
00066 HTML;
00067
00068
00069
00070 return $list . $loader . $actionbar;
00071 }
00072 }