Index: trunk/extensions/EducationProgram/actions/EPViewAction.php |
— | — | @@ -2,53 +2,7 @@ |
3 | 3 | |
4 | 4 | abstract class EPViewAction extends FormlessAction { |
5 | 5 | |
6 | | - public function onView() { |
7 | | - |
8 | | - } |
9 | | - |
10 | 6 | /** |
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 | | - /** |
53 | 7 | * Adds a navigation menu with the provided links. |
54 | 8 | * Links should be provided in an array with: |
55 | 9 | * label => Title (object) |
Index: trunk/extensions/EducationProgram/actions/EPHistoryAction.php |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | |
8 | 8 | public function onView() { |
9 | 9 | $c = $this->getItemClass(); // Yeah, this is needed in PHP 5.3 >_> |
| 10 | + |
10 | 11 | $object = $c::get( $this->getTitle()->getText() ); |
11 | 12 | |
12 | 13 | if ( $object === false ) { |
Index: trunk/extensions/EducationProgram/actions/EPEditAction.php |
— | — | @@ -10,6 +10,14 @@ |
11 | 11 | */ |
12 | 12 | protected $item = false; |
13 | 13 | |
| 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 | + |
14 | 22 | protected abstract function getItemClass(); |
15 | 23 | |
16 | 24 | public function onView() { |
— | — | @@ -54,13 +62,27 @@ |
55 | 63 | $this->isNew = true; |
56 | 64 | $object = new $c( $data, true ); |
57 | 65 | } |
58 | | - else { |
| 66 | + elseif ( $this->isNewPost() ) { |
59 | 67 | $this->showWarning( wfMessage( 'educationprogram-' . strtolower( $this->getName() ) . '-exists-already' ) ); |
60 | 68 | } |
61 | 69 | |
62 | 70 | $this->item = $object; |
63 | 71 | $this->showForm(); |
64 | 72 | } |
| 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 | + } |
65 | 87 | |
66 | 88 | /** |
67 | 89 | * Returns if the page should work in insertion mode rather then modification mode. |