Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php |
— | — | @@ -515,7 +515,7 @@ |
516 | 516 | } |
517 | 517 | |
518 | 518 | function listNoticeDetail( $notice ) { |
519 | | - global $wgOut, $wgRequest; |
| 519 | + global $wgOut, $wgRequest, $wgUser; |
520 | 520 | |
521 | 521 | if ( $wgRequest->wasPosted() ) { |
522 | 522 | // Handle removing of templates |
— | — | @@ -532,6 +532,7 @@ |
533 | 533 | $this->updateProjectName ( $notice, $projectName ); |
534 | 534 | } |
535 | 535 | |
| 536 | + // Handle new user language |
536 | 537 | $projectLang = $wgRequest->getVal( 'wpUserLanguage' ); |
537 | 538 | if ( isset( $projectLang ) ) { |
538 | 539 | $this->updateProjectLanguage( $notice, $projectLang ); |
— | — | @@ -562,43 +563,41 @@ |
563 | 564 | */ |
564 | 565 | $this->showAll = 'Y'; |
565 | 566 | |
566 | | - $output = $this->noticeDetailForm( $notice ); |
| 567 | + $output_detail = $this->noticeDetailForm( $notice ); |
| 568 | + $output_assigned = $this->assignedTemplatesForm( $notice ); |
| 569 | + $output_templates = $this->addTemplatesForm( $notice ); |
567 | 570 | |
568 | 571 | // No notices returned |
569 | | - if ( $output == '' ) { |
| 572 | + if ( $output_detail == '' ) { |
570 | 573 | $htmlOut .= wfMsg( 'centralnotice-no-notices-exist' ); |
571 | 574 | } else { |
572 | | - $htmlOut .= $output; |
| 575 | + $htmlOut .= $output_detail; |
573 | 576 | } |
574 | 577 | |
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 |
584 | 579 | if( $this->editable ) { |
585 | | - $output = $this->addTemplatesForm( $notice ); |
586 | | - |
587 | | - // No templates in the system |
588 | | - if ( $output == '' ) { |
| 580 | + if ( $output_assigned == '' && $output_templates == '' ) { |
589 | 581 | $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; |
590 | 590 | } else { |
591 | | - $htmlOut .= $output; |
| 591 | + $htmlOut .= $output_assigned; |
| 592 | + $htmlOut .= $output_templates; |
592 | 593 | } |
| 594 | + } |
| 595 | + $htmlOut .= Xml::tags( 'tr', null, |
| 596 | + Xml::tags( 'td', array( 'collspan' => 2 ), |
| 597 | + Xml::submitButton( wfMsg( 'centralnotice-modify' ) ) |
| 598 | + ) |
| 599 | + ); |
593 | 600 | |
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' ); |
603 | 602 | $wgOut->addHTML( $htmlOut ); |
604 | 603 | } |
605 | 604 | |
— | — | @@ -804,7 +803,7 @@ |
805 | 804 | 'cn_templates' |
806 | 805 | ), |
807 | 806 | array( |
808 | | - 'cn_templates.tmp_name', |
| 807 | + 'cn_templates.tmp_name', |
809 | 808 | ), |
810 | 809 | array( |
811 | 810 | 'cn_notices.not_name' => $notice, |
— | — | @@ -827,8 +826,9 @@ |
828 | 827 | wfMsg ( "centralnotice-weight" ) ); |
829 | 828 | $htmlOut .= Xml::element( 'th', array( 'align' => 'left', 'width' => '70%' ), |
830 | 829 | wfMsg ( "centralnotice-templates" ) ); |
831 | | - // Find dups |
832 | | - $templatesAssigned = $this->selectTemplatesAssigned( $notice ); |
| 830 | + |
| 831 | + // Find dups |
| 832 | + $templatesAssigned = $this->selectTemplatesAssigned( $notice ); |
833 | 833 | |
834 | 834 | // Build rows |
835 | 835 | while ( $row = $dbr->fetchObject( $res ) ) { |
Index: trunk/extensions/CentralNotice/SpecialNoticeTemplate.php |
— | — | @@ -183,9 +183,9 @@ |
184 | 184 | if( $this->editable ) { |
185 | 185 | $htmlOut .= Xml::closeElement( 'form' ); |
186 | 186 | |
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' ) ); |
190 | 190 | } |
191 | 191 | |
192 | 192 | // Output HTML |
Index: trunk/extensions/CentralNotice/CentralNotice.i18n.php |
— | — | @@ -81,8 +81,7 @@ |
82 | 82 | 'centralnotice-no-notices-exist' => 'No notices exist. |
83 | 83 | Add one below', |
84 | 84 | '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', |
87 | 86 | 'centralnotice-number-uses' => 'Uses', |
88 | 87 | 'centralnotice-edit-template' => 'Edit template', |
89 | 88 | 'centralnotice-message' => 'Message', |