r106409 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106408‎ | r106409 | r106410 >
Date:03:46, 16 December 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
follow up to r106407, added docs and messages
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEPFormPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/specials/SpecialEPFormPage.php
@@ -29,9 +29,22 @@
3030 * @var EPDBObject|false
3131 */
3232 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+ */
3440 protected $itemClass;
3541
 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+ */
3649 protected $listPage;
3750
3851 /**
@@ -58,7 +71,7 @@
5972 */
6073 public function getDescription() {
6174 $action = $this->isNew() ? 'add' : 'edit';
62 - return wfMsg( 'special-' . strtolower( $this->getName() ) . $action );
 75+ return wfMsg( 'special-' . strtolower( $this->getName() ) . '-' . $action );
6376 }
6477
6578 /**
@@ -106,8 +119,23 @@
107120 * @return boolean
108121 */
109122 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;
111130 }
 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+ }
112140
113141 /**
114142 * Show the form.
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -64,6 +64,12 @@
6565 'ep-institutions-newname' => 'Institution name:',
6666 'ep-institutions-add' => 'Add institution',
6767
 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+
6874 );
6975
7076 /** Message documentation (Message documentation)

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106407follow up to r106404 r106405 - cleanup and fixesjeroendedauw03:34, 16 December 2011

Status & tagging log