Index: trunk/extensions/EducationProgram/specials/SpecialEPFormPage.php |
— | — | @@ -29,9 +29,22 @@ |
30 | 30 | * @var EPDBObject|false |
31 | 31 | */ |
32 | 32 | protected $item = false; |
33 | | - |
| 33 | + |
| 34 | + /** |
| 35 | + * Name of the class of the object being edited or created. |
| 36 | + * |
| 37 | + * @since 0.1 |
| 38 | + * @var string |
| 39 | + */ |
34 | 40 | protected $itemClass; |
35 | 41 | |
| 42 | + /** |
| 43 | + * Name of the special page listing the items. |
| 44 | + * For example, for "EditLolcat", it could be "Lolcats". |
| 45 | + * |
| 46 | + * @since 0.1 |
| 47 | + * @var string |
| 48 | + */ |
36 | 49 | protected $listPage; |
37 | 50 | |
38 | 51 | /** |
— | — | @@ -58,7 +71,7 @@ |
59 | 72 | */ |
60 | 73 | public function getDescription() { |
61 | 74 | $action = $this->isNew() ? 'add' : 'edit'; |
62 | | - return wfMsg( 'special-' . strtolower( $this->getName() ) . $action ); |
| 75 | + return wfMsg( 'special-' . strtolower( $this->getName() ) . '-' . $action ); |
63 | 76 | } |
64 | 77 | |
65 | 78 | /** |
— | — | @@ -106,8 +119,23 @@ |
107 | 120 | * @return boolean |
108 | 121 | */ |
109 | 122 | protected function isNew() { |
110 | | - return $this->getRequest()->wasPosted() && $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'newEditToken' ) ); |
| 123 | + static $isNew = null; |
| 124 | + |
| 125 | + if ( is_null( $isNew ) ) { |
| 126 | + $isNew = $this->getRequest()->wasPosted() && $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'newEditToken' ) ); |
| 127 | + } |
| 128 | + |
| 129 | + return $isNew; |
111 | 130 | } |
| 131 | + |
| 132 | + /** |
| 133 | + * (non-PHPdoc) |
| 134 | + * @see FormSpecialPage::alterForm() |
| 135 | + */ |
| 136 | + protected function alterForm( HTMLForm $form ) { |
| 137 | + $action = $this->isNew() ? 'add' : 'edit'; |
| 138 | + $form->setWrapperLegend( $this->msg( strtolower( $this->getName() ) . '-' . $action . '-legend' ) ); |
| 139 | + } |
112 | 140 | |
113 | 141 | /** |
114 | 142 | * Show the form. |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -64,6 +64,12 @@ |
65 | 65 | 'ep-institutions-newname' => 'Institution name:', |
66 | 66 | 'ep-institutions-add' => 'Add institution', |
67 | 67 | |
| 68 | + // Special:EditInstitution |
| 69 | + 'editinstitution-text' => 'Enter the institution details below and click submit to save your changes.', |
| 70 | + 'educationprogram-org-edit-name' => 'Institution name', |
| 71 | + 'editinstitution-add-legend' => 'Add institution', |
| 72 | + 'editinstitution-edit-legend' => 'Edit institution', |
| 73 | + |
68 | 74 | ); |
69 | 75 | |
70 | 76 | /** Message documentation (Message documentation) |