r70612 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70611‎ | r70612 | r70613 >
Date:01:39, 7 August 2010
Author:kaldari
Status:ok
Tags:
Comment:
fixing bug with messages conflicting with reserved term (2nd half of r70611)
Modified paths:
  • /trunk/extensions/CentralNotice/SpecialNoticeTemplate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialNoticeTemplate.php
@@ -7,7 +7,7 @@
88
99 class SpecialNoticeTemplate extends UnlistedSpecialPage {
1010 var $editable;
11 -
 11+
1212 function __construct() {
1313 parent::__construct( 'NoticeTemplate' );
1414
@@ -135,7 +135,7 @@
136136 global $wgOut, $wgUser;
137137
138138 $sk = $wgUser->getSkin();
139 - $pager = new NoticeTemplatePager( $this );
 139+ $pager = new TemplatePager( $this );
140140
141141 // Begin building HTML
142142 $htmlOut = '';
@@ -192,9 +192,9 @@
193193 $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-add-template' ) );
194194 $htmlOut .= Xml::hidden( 'wpMethod', 'addTemplate' );
195195 $htmlOut .= Xml::tags( 'p', null,
196 - Xml::inputLabel( wfMsg( 'centralnotice-template-name' ) . ":", 'templateName', 'templateName', 25 )
 196+ Xml::inputLabel( wfMsg( 'centralnotice-banner-name' ) . ":", 'templateName', 'templateName', 25 )
197197 );
198 - $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-template' ) );
 198+ $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-banner' ) );
199199 $htmlOut .= wfMsg( 'centralnotice-edit-template-summary' );
200200 $htmlOut .= Xml::tags( 'div',
201201 array( 'style' => 'margin-bottom: 0.2em;' ),
@@ -242,7 +242,7 @@
243243 // Begin View Banner fieldset
244244 $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
245245
246 - $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-template' ) . ': ' . $currentTemplate );
 246+ $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-banner' ) . ': ' . $currentTemplate );
247247
248248 // Show preview of banner
249249 $render = new SpecialNoticeText();
@@ -464,7 +464,7 @@
465465 // Begin View Banner fieldset
466466 $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) );
467467
468 - $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-template' ) . ': ' . $template );
 468+ $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-banner' ) . ': ' . $template );
469469
470470 foreach ( $langs as $lang ) {
471471 // Link and Preview all available translations
@@ -697,100 +697,3 @@
698698 return $translations;
699699 }
700700 }
701 -
702 -class NoticeTemplatePager extends ReverseChronologicalPager {
703 - var $onRemoveChange, $viewPage, $special;
704 - var $editable;
705 -
706 - function __construct( $special ) {
707 - $this->special = $special;
708 - $this->editable = $special->editable;
709 - parent::__construct();
710 -
711 - // Override paging defaults
712 - list( $this->mLimit, /* $offset */ ) = $this->mRequest->getLimitOffset( 20, '' );
713 - $this->mLimitsShown = array( 20, 50, 100 );
714 -
715 - $msg = Xml::encodeJsVar( wfMsg( 'centralnotice-confirm-delete' ) );
716 - $this->onRemoveChange = "if( this.checked ) { this.checked = confirm( $msg ) }";
717 - $this->viewPage = SpecialPage::getTitleFor( 'NoticeTemplate', 'view' );
718 - }
719 -
720 - function getQueryInfo() {
721 - return array(
722 - 'tables' => 'cn_templates',
723 - 'fields' => array( 'tmp_name', 'tmp_id' ),
724 - );
725 - }
726 -
727 - function getIndexField() {
728 - return 'tmp_id';
729 - }
730 -
731 - function formatRow( $row ) {
732 - $htmlOut = Xml::openElement( 'tr' );
733 -
734 - if ( $this->editable ) {
735 - // Remove box
736 - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
737 - Xml::check( 'removeTemplates[]', false,
738 - array(
739 - 'value' => $row->tmp_name,
740 - 'onchange' => $this->onRemoveChange
741 - )
742 - )
743 - );
744 - }
745 -
746 - // Link and Preview
747 - $render = new SpecialNoticeText();
748 - $render->project = 'wikipedia';
749 - $render->language = $this->mRequest->getVal( 'wpUserLanguage' );
750 - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ),
751 - $this->getSkin()->makeLinkObj( $this->viewPage,
752 - htmlspecialchars( $row->tmp_name ),
753 - 'template=' . urlencode( $row->tmp_name ) ) .
754 - Xml::fieldset( wfMsg( 'centralnotice-preview' ),
755 - $render->getHtmlNotice( $row->tmp_name ),
756 - array( 'class' => 'cn-bannerpreview')
757 - )
758 - );
759 -
760 - $htmlOut .= Xml::closeElement( 'tr' );
761 - return $htmlOut;
762 - }
763 -
764 - function getStartBody() {
765 - $htmlOut = '';
766 -
767 - $htmlOut .= Xml::openElement( 'table',
768 - array(
769 - 'cellpadding' => 9,
770 - 'width' => '100%'
771 - )
772 - );
773 - if ( $this->editable ) {
774 - $htmlOut .= Xml::element( 'th', array( 'align' => 'left', 'width' => '5%' ),
775 - wfMsg ( 'centralnotice-remove' )
776 - );
777 - }
778 - $htmlOut .= Xml::element( 'th', array( 'align' => 'left' ),
779 - wfMsg ( 'centralnotice-template-name' )
780 - );
781 - return $htmlOut;
782 - }
783 -
784 - function getEndBody() {
785 - global $wgUser;
786 - $htmlOut = '';
787 - $htmlOut .= Xml::closeElement( 'table' );
788 - if ( $this->editable ) {
789 - $htmlOut .= Xml::hidden( 'authtoken', $wgUser->editToken() );
790 - $htmlOut .= Xml::tags( 'div',
791 - array( 'class' => 'cn-buttons' ),
792 - Xml::submitButton( wfMsg( 'centralnotice-modify' ) )
793 - );
794 - }
795 - return $htmlOut;
796 - }
797 -}

Follow-up revisions

RevisionCommit summaryAuthorDate
r70613moving TemplatePager to Autoloaded class since we'll need it in Campaign inte...kaldari01:43, 7 August 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70611fixing bug with messages conflicting with reserved termkaldari01:35, 7 August 2010

Status & tagging log