r43038 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43037‎ | r43038 | r43039 >
Date:22:18, 1 November 2008
Author:tomasz
Status:old (Comments)
Tags:
Comment:
adding spacing when no content is present
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.i18n.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialCentralNotice.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialNoticeTemplate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php
@@ -515,7 +515,7 @@
516516 }
517517
518518 function listNoticeDetail( $notice ) {
519 - global $wgOut, $wgRequest;
 519+ global $wgOut, $wgRequest, $wgUser;
520520
521521 if ( $wgRequest->wasPosted() ) {
522522 // Handle removing of templates
@@ -532,6 +532,7 @@
533533 $this->updateProjectName ( $notice, $projectName );
534534 }
535535
 536+ // Handle new user language
536537 $projectLang = $wgRequest->getVal( 'wpUserLanguage' );
537538 if ( isset( $projectLang ) ) {
538539 $this->updateProjectLanguage( $notice, $projectLang );
@@ -562,43 +563,41 @@
563564 */
564565 $this->showAll = 'Y';
565566
566 - $output = $this->noticeDetailForm( $notice );
 567+ $output_detail = $this->noticeDetailForm( $notice );
 568+ $output_assigned = $this->assignedTemplatesForm( $notice );
 569+ $output_templates = $this->addTemplatesForm( $notice );
567570
568571 // No notices returned
569 - if ( $output == '' ) {
 572+ if ( $output_detail == '' ) {
570573 $htmlOut .= wfMsg( 'centralnotice-no-notices-exist' );
571574 } else {
572 - $htmlOut .= $output;
 575+ $htmlOut .= $output_detail;
573576 }
574577
575 - $output = $this->assignedTemplatesForm( $notice );
576 -
577 - // No templates assigned returned
578 - if ( $output == '' ) {
579 - $htmlOut .= wfMsg( 'centralnotice-no-templates-assigned' );
580 - } else {
581 - $htmlOut .= $output;
582 - }
583 -
 578+ // Catch for no templates so that we dont' double message
584579 if( $this->editable ) {
585 - $output = $this->addTemplatesForm( $notice );
586 -
587 - // No templates in the system
588 - if ( $output == '' ) {
 580+ if ( $output_assigned == '' && $output_templates == '' ) {
589581 $htmlOut .= wfMsg( 'centralnotice-no-templates' );
 582+ $htmlOut .= Xml::element( 'p' );
 583+ $newPage = SpecialPage::getTitleFor( 'NoticeTemplate/add' );
 584+ $sk = $wgUser->getSkin();
 585+ $htmlOut .= $sk->makeLinkObj( $newPage, wfMsgHtml( 'centralnotice-add-template' ) );
 586+ $htmlOut .= Xml::element( 'p' );
 587+ } elseif ( $output_assigned == '' ) {
 588+ $htmlOut .= wfMsg( 'centralnotice-no-templates-assigned' );
 589+ $htmlOut .= $output_templates;
590590 } else {
591 - $htmlOut .= $output;
 591+ $htmlOut .= $output_assigned;
 592+ $htmlOut .= $output_templates;
592593 }
 594+ }
 595+ $htmlOut .= Xml::tags( 'tr', null,
 596+ Xml::tags( 'td', array( 'collspan' => 2 ),
 597+ Xml::submitButton( wfMsg( 'centralnotice-modify' ) )
 598+ )
 599+ );
593600
594 - $htmlOut .= Xml::tags( 'tr', null,
595 - Xml::tags( 'td', array( 'collspan' => 2 ),
596 - Xml::submitButton( wfMsg( 'centralnotice-modify' ) )
597 - )
598 - );
599 -
600 - $htmlOut .= Xml::closeElement( 'form' );
601 - }
602 -
 601+ $htmlOut .= Xml::closeElement( 'form' );
603602 $wgOut->addHTML( $htmlOut );
604603 }
605604
@@ -804,7 +803,7 @@
805804 'cn_templates'
806805 ),
807806 array(
808 - 'cn_templates.tmp_name',
 807+ 'cn_templates.tmp_name',
809808 ),
810809 array(
811810 'cn_notices.not_name' => $notice,
@@ -827,8 +826,9 @@
828827 wfMsg ( "centralnotice-weight" ) );
829828 $htmlOut .= Xml::element( 'th', array( 'align' => 'left', 'width' => '70%' ),
830829 wfMsg ( "centralnotice-templates" ) );
831 - // Find dups
832 - $templatesAssigned = $this->selectTemplatesAssigned( $notice );
 830+
 831+ // Find dups
 832+ $templatesAssigned = $this->selectTemplatesAssigned( $notice );
833833
834834 // Build rows
835835 while ( $row = $dbr->fetchObject( $res ) ) {
Index: trunk/extensions/CentralNotice/SpecialNoticeTemplate.php
@@ -183,9 +183,9 @@
184184 if( $this->editable ) {
185185 $htmlOut .= Xml::closeElement( 'form' );
186186
187 - // Show add link
188 - $newPage = SpecialPage::getTitleFor( 'NoticeTemplate/add' );
189 - $htmlOut .= $sk->makeLinkObj( $newPage, wfMsgHtml( 'centralnotice-add-template' ) );
 187+ $htmlOut .= Xml::element( 'p' );
 188+ $newPage = SpecialPage::getTitleFor( 'NoticeTemplate/add' );
 189+ $htmlOut .= $sk->makeLinkObj( $newPage, wfMsgHtml( 'centralnotice-add-template' ) );
190190 }
191191
192192 // Output HTML
Index: trunk/extensions/CentralNotice/CentralNotice.i18n.php
@@ -81,8 +81,7 @@
8282 'centralnotice-no-notices-exist' => 'No notices exist.
8383 Add one below',
8484 'centralnotice-no-templates-translate' => 'There are not any templates to edit translations for',
85 - 'centralnotice-no-templates' => 'There are no templates in the system.
86 -Create one',
 85+ 'centralnotice-no-templates' => 'There are no templates in the system',
8786 'centralnotice-number-uses' => 'Uses',
8887 'centralnotice-edit-template' => 'Edit template',
8988 'centralnotice-message' => 'Message',

Comments

#Comment by Aaron Schulz (talk | contribs)   15:47, 3 November 2008

That p tag doesn't look closed. Is that ok XHTML?

#Comment by Aaron Schulz (talk | contribs)   09:09, 13 November 2008

Nevermind, xml class will output

, not

Status & tagging log