Index: trunk/extensions/CentralNotice/SpecialNoticeTemplate.php |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | |
9 | 9 | class SpecialNoticeTemplate extends UnlistedSpecialPage { |
10 | 10 | var $editable; |
11 | | - |
| 11 | + |
12 | 12 | function __construct() { |
13 | 13 | parent::__construct( 'NoticeTemplate' ); |
14 | 14 | |
— | — | @@ -135,7 +135,7 @@ |
136 | 136 | global $wgOut, $wgUser; |
137 | 137 | |
138 | 138 | $sk = $wgUser->getSkin(); |
139 | | - $pager = new NoticeTemplatePager( $this ); |
| 139 | + $pager = new TemplatePager( $this ); |
140 | 140 | |
141 | 141 | // Begin building HTML |
142 | 142 | $htmlOut = ''; |
— | — | @@ -192,9 +192,9 @@ |
193 | 193 | $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-add-template' ) ); |
194 | 194 | $htmlOut .= Xml::hidden( 'wpMethod', 'addTemplate' ); |
195 | 195 | $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 ) |
197 | 197 | ); |
198 | | - $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-template' ) ); |
| 198 | + $htmlOut .= Xml::fieldset( wfMsg( 'centralnotice-banner' ) ); |
199 | 199 | $htmlOut .= wfMsg( 'centralnotice-edit-template-summary' ); |
200 | 200 | $htmlOut .= Xml::tags( 'div', |
201 | 201 | array( 'style' => 'margin-bottom: 0.2em;' ), |
— | — | @@ -242,7 +242,7 @@ |
243 | 243 | // Begin View Banner fieldset |
244 | 244 | $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) ); |
245 | 245 | |
246 | | - $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-template' ) . ': ' . $currentTemplate ); |
| 246 | + $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-banner' ) . ': ' . $currentTemplate ); |
247 | 247 | |
248 | 248 | // Show preview of banner |
249 | 249 | $render = new SpecialNoticeText(); |
— | — | @@ -464,7 +464,7 @@ |
465 | 465 | // Begin View Banner fieldset |
466 | 466 | $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) ); |
467 | 467 | |
468 | | - $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-template' ) . ': ' . $template ); |
| 468 | + $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-banner' ) . ': ' . $template ); |
469 | 469 | |
470 | 470 | foreach ( $langs as $lang ) { |
471 | 471 | // Link and Preview all available translations |
— | — | @@ -697,100 +697,3 @@ |
698 | 698 | return $translations; |
699 | 699 | } |
700 | 700 | } |
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 | | -} |