r110247 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110246‎ | r110247 | r110248 >
Date:15:25, 29 January 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fix display or already exists warning and added missing method
Modified paths:
  • /trunk/extensions/EducationProgram/actions/EPEditAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/actions/EPHistoryAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/actions/EPViewAction.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/actions/EPViewAction.php
@@ -2,53 +2,7 @@
33
44 abstract class EPViewAction extends FormlessAction {
55
6 - public function onView() {
7 -
8 - }
9 -
106 /**
11 - * Show a message in an error box.
12 - *
13 - * @since 0.1
14 - *
15 - * @param Message $message
16 - */
17 - protected function showError( Message $message ) {
18 - $this->getOutput()->addHTML(
19 - '<p class="visualClear errorbox">' . $message->parse() . '</p>'
20 - . '<hr style="display: block; clear: both; visibility: hidden;" />'
21 - );
22 - }
23 -
24 - /**
25 - * Show a message in a warning box.
26 - *
27 - * @since 0.1
28 - *
29 - * @param Message $message
30 - */
31 - protected function showWarning( Message $message ) {
32 - $this->getOutput()->addHTML(
33 - '<p class="visualClear warningbox">' . $message->parse() . '</p>'
34 - . '<hr style="display: block; clear: both; visibility: hidden;" />'
35 - );
36 - }
37 -
38 - /**
39 - * Show a message in a success box.
40 - *
41 - * @since 0.1
42 - *
43 - * @param Message $message
44 - */
45 - protected function showSuccess( Message $message ) {
46 - $this->getOutput()->addHTML(
47 - '<div class="successbox"><strong><p>' . $message->parse() . '</p></strong></div>'
48 - . '<hr style="display: block; clear: both; visibility: hidden;" />'
49 - );
50 - }
51 -
52 - /**
537 * Adds a navigation menu with the provided links.
548 * Links should be provided in an array with:
559 * label => Title (object)
Index: trunk/extensions/EducationProgram/actions/EPHistoryAction.php
@@ -6,6 +6,7 @@
77
88 public function onView() {
99 $c = $this->getItemClass(); // Yeah, this is needed in PHP 5.3 >_>
 10+
1011 $object = $c::get( $this->getTitle()->getText() );
1112
1213 if ( $object === false ) {
Index: trunk/extensions/EducationProgram/actions/EPEditAction.php
@@ -10,6 +10,14 @@
1111 */
1212 protected $item = false;
1313
 14+ /**
 15+ * If the action is in insert mode rather then edit mode.
 16+ *
 17+ * @since 0.1
 18+ * @var boolean|null
 19+ */
 20+ protected $isNew = null;
 21+
1422 protected abstract function getItemClass();
1523
1624 public function onView() {
@@ -54,13 +62,27 @@
5563 $this->isNew = true;
5664 $object = new $c( $data, true );
5765 }
58 - else {
 66+ elseif ( $this->isNewPost() ) {
5967 $this->showWarning( wfMessage( 'educationprogram-' . strtolower( $this->getName() ) . '-exists-already' ) );
6068 }
6169
6270 $this->item = $object;
6371 $this->showForm();
6472 }
 73+
 74+ /**
 75+ * Show a message in a warning box.
 76+ *
 77+ * @since 0.1
 78+ *
 79+ * @param Message $message
 80+ */
 81+ protected function showWarning( Message $message ) {
 82+ $this->getOutput()->addHTML(
 83+ '<p class="visualClear warningbox">' . $message->parse() . '</p>'
 84+ . '<hr style="display: block; clear: both; visibility: hidden;" />'
 85+ );
 86+ }
6587
6688 /**
6789 * Returns if the page should work in insertion mode rather then modification mode.

Status & tagging log