r84986 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84985‎ | r84986 | r84987 >
Date:22:28, 29 March 2011
Author:laner
Status:deferred
Tags:
Comment:
Follow up to r84646. Changed the validation callbacks to point to the correct function name, and fixed the function to accept the correct arguments. Changed the message to be generic, and removed the specific error messages.
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackManager.i18n.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNova.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaAddress.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaInstance.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaProject.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaVolume.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/special/SpecialNovaInstance.php
@@ -90,7 +90,7 @@
9191 $instanceInfo['instancename'] = array(
9292 'type' => 'text',
9393 'label-message' => 'openstackmanager-instancename',
94 - 'validation-callback' => array( $this, 'validateInstanceName' ),
 94+ 'validation-callback' => array( $this, 'validateText' ),
9595 'default' => '',
9696 'section' => 'instance/info',
9797 'name' => 'instancename',
Index: trunk/extensions/OpenStackManager/special/SpecialNovaAddress.php
@@ -265,7 +265,7 @@
266266 $addressInfo['hostname'] = array(
267267 'type' => 'text',
268268 'default' => '',
269 - 'validation-callback' => array( $this, 'validateHostName' ),
 269+ 'validation-callback' => array( $this, 'validateText' ),
270270 'label-message' => 'openstackmanager-hostname',
271271 'name' => 'hostname',
272272 );
Index: trunk/extensions/OpenStackManager/special/SpecialNovaProject.php
@@ -53,7 +53,7 @@
5454 $projectInfo['projectname'] = array(
5555 'type' => 'text',
5656 'label-message' => 'openstackmanager-projectname',
57 - 'validation-callback' => array( $this, 'validateProjectName' ),
 57+ 'validation-callback' => array( $this, 'validateText' ),
5858 'default' => '',
5959 'section' => 'project/info',
6060 'name' => 'projectname',
Index: trunk/extensions/OpenStackManager/special/SpecialNovaVolume.php
@@ -83,7 +83,7 @@
8484 $volumeInfo['volumename'] = array(
8585 'type' => 'text',
8686 'label-message' => 'openstackmanager-volumename',
87 - 'validation-callback' => array( $this, 'validateVolumeName' ),
 87+ 'validation-callback' => array( $this, 'validateText' ),
8888 'default' => '',
8989 'section' => 'volume/info',
9090 'name' => 'volumename',
Index: trunk/extensions/OpenStackManager/special/SpecialNova.php
@@ -56,12 +56,14 @@
5757 }
5858
5959 /**
60 - * @param $hostname
 60+ * @param $resourcename
 61+ * @param $error
 62+ * @param $alldata
6163 * @return bool|string
6264 */
63 - function validateText( $hostname, $error ) {
64 - if ( ! preg_match( "/^[a-z][a-z0-9\-]*$/", $hostname ) ) {
65 - return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( $error ) );
 65+ function validateText( $resourcename, $alldata ) {
 66+ if ( ! preg_match( "/^[a-z][a-z0-9\-]*$/", $resourcename ) ) {
 67+ return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'openstackmanager-badresourcename' ) );
6668 } else {
6769 return true;
6870 }
Index: trunk/extensions/OpenStackManager/OpenStackManager.i18n.php
@@ -22,6 +22,8 @@
2323 'openstackmanager-instance' => 'Manage instance',
2424 'openstackmanager-title' => 'OpenStackManager',
2525
 26+ 'openstackmanager-badresourcename' => 'Bad resource name provided. Resource names start with a-z, and can only contain a-z, 0-9, -, and _ characters.',
 27+
2628 'specialpages-group-nova' => 'OpenStack Nova',
2729 'novaaddress' => 'Manage public IP addresses',
2830 'novadomain' => 'Manage DNS domains',
@@ -127,7 +129,6 @@
128130 'openstackmanager-deletevolume' => 'Delete Volume',
129131 'openstackmanager-deletevolumequestion' => 'Are you sure you wish to delete volume "$1"?',
130132 'openstackmanager-volumelist' => 'Volume List',
131 - 'openstackmanager-badvolumename' => 'An invalid volume name was given.',
132133 'openstackmanager-novavolume-volume' => 'Volume',
133134 'openstackmanager-novavolume-info' => 'Volume Info',
134135 'openstackmanager-createdvolume' => 'Created volume $1.',
@@ -173,7 +174,6 @@
174175 'openstackmanager-action' => 'Action',
175176 'openstackmanager-createprojectfailed' => 'Failed to create project.',
176177 'openstackmanager-createdproject' => 'Created project.',
177 - 'openstackmanager-badprojectname' => 'Bad project name provided. Project names start with a-z, and can only contain a-z, 0-9, -, and _ characters.',
178178 'openstackmanager-projectlist' => 'Project list',
179179 'openstackmanager-backprojectlist' => 'Back to project list',
180180 'openstackmanager-deleteproject' => 'Delete project',
@@ -183,7 +183,6 @@
184184 'openstackmanager-failedtoadd' => 'Failed to add $1 to $2.',
185185 'openstackmanager-removedfrom' => 'Successfully removed $1 from $2.',
186186 'openstackmanager-failedtoremove' => 'Failed to remove $1 from $2.',
187 - 'openstackmanager-badinstancename' => 'Bad instance name provided. Instance names must start with a-z, and can only contain a-z, 0-9, and - characters.',
188187 'openstackmanager-novaproject-project' => 'Project',
189188 'openstackmanager-novaproject-info' => 'Project information',
190189

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r84646validateInstanceName and validateHostName are exact duplicates seemingly...reedy00:02, 24 March 2011

Status & tagging log