Index: trunk/extensions/OpenStackManager/special/SpecialNovaInstance.php |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | $instanceInfo['instancename'] = array( |
92 | 92 | 'type' => 'text', |
93 | 93 | 'label-message' => 'openstackmanager-instancename', |
94 | | - 'validation-callback' => array( $this, 'validateInstanceName' ), |
| 94 | + 'validation-callback' => array( $this, 'validateText' ), |
95 | 95 | 'default' => '', |
96 | 96 | 'section' => 'instance/info', |
97 | 97 | 'name' => 'instancename', |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaAddress.php |
— | — | @@ -265,7 +265,7 @@ |
266 | 266 | $addressInfo['hostname'] = array( |
267 | 267 | 'type' => 'text', |
268 | 268 | 'default' => '', |
269 | | - 'validation-callback' => array( $this, 'validateHostName' ), |
| 269 | + 'validation-callback' => array( $this, 'validateText' ), |
270 | 270 | 'label-message' => 'openstackmanager-hostname', |
271 | 271 | 'name' => 'hostname', |
272 | 272 | ); |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaProject.php |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | $projectInfo['projectname'] = array( |
55 | 55 | 'type' => 'text', |
56 | 56 | 'label-message' => 'openstackmanager-projectname', |
57 | | - 'validation-callback' => array( $this, 'validateProjectName' ), |
| 57 | + 'validation-callback' => array( $this, 'validateText' ), |
58 | 58 | 'default' => '', |
59 | 59 | 'section' => 'project/info', |
60 | 60 | 'name' => 'projectname', |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaVolume.php |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | $volumeInfo['volumename'] = array( |
85 | 85 | 'type' => 'text', |
86 | 86 | 'label-message' => 'openstackmanager-volumename', |
87 | | - 'validation-callback' => array( $this, 'validateVolumeName' ), |
| 87 | + 'validation-callback' => array( $this, 'validateText' ), |
88 | 88 | 'default' => '', |
89 | 89 | 'section' => 'volume/info', |
90 | 90 | 'name' => 'volumename', |
Index: trunk/extensions/OpenStackManager/special/SpecialNova.php |
— | — | @@ -56,12 +56,14 @@ |
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | | - * @param $hostname |
| 60 | + * @param $resourcename |
| 61 | + * @param $error |
| 62 | + * @param $alldata |
61 | 63 | * @return bool|string |
62 | 64 | */ |
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' ) ); |
66 | 68 | } else { |
67 | 69 | return true; |
68 | 70 | } |
Index: trunk/extensions/OpenStackManager/OpenStackManager.i18n.php |
— | — | @@ -22,6 +22,8 @@ |
23 | 23 | 'openstackmanager-instance' => 'Manage instance', |
24 | 24 | 'openstackmanager-title' => 'OpenStackManager', |
25 | 25 | |
| 26 | + 'openstackmanager-badresourcename' => 'Bad resource name provided. Resource names start with a-z, and can only contain a-z, 0-9, -, and _ characters.', |
| 27 | + |
26 | 28 | 'specialpages-group-nova' => 'OpenStack Nova', |
27 | 29 | 'novaaddress' => 'Manage public IP addresses', |
28 | 30 | 'novadomain' => 'Manage DNS domains', |
— | — | @@ -127,7 +129,6 @@ |
128 | 130 | 'openstackmanager-deletevolume' => 'Delete Volume', |
129 | 131 | 'openstackmanager-deletevolumequestion' => 'Are you sure you wish to delete volume "$1"?', |
130 | 132 | 'openstackmanager-volumelist' => 'Volume List', |
131 | | - 'openstackmanager-badvolumename' => 'An invalid volume name was given.', |
132 | 133 | 'openstackmanager-novavolume-volume' => 'Volume', |
133 | 134 | 'openstackmanager-novavolume-info' => 'Volume Info', |
134 | 135 | 'openstackmanager-createdvolume' => 'Created volume $1.', |
— | — | @@ -173,7 +174,6 @@ |
174 | 175 | 'openstackmanager-action' => 'Action', |
175 | 176 | 'openstackmanager-createprojectfailed' => 'Failed to create project.', |
176 | 177 | '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.', |
178 | 178 | 'openstackmanager-projectlist' => 'Project list', |
179 | 179 | 'openstackmanager-backprojectlist' => 'Back to project list', |
180 | 180 | 'openstackmanager-deleteproject' => 'Delete project', |
— | — | @@ -183,7 +183,6 @@ |
184 | 184 | 'openstackmanager-failedtoadd' => 'Failed to add $1 to $2.', |
185 | 185 | 'openstackmanager-removedfrom' => 'Successfully removed $1 from $2.', |
186 | 186 | '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.', |
188 | 187 | 'openstackmanager-novaproject-project' => 'Project', |
189 | 188 | 'openstackmanager-novaproject-info' => 'Project information', |
190 | 189 | |