Added the dash in the explanations of the allowed character in the project name

This is solving issue 148 correctly.
This commit is contained in:
Loic d'Anterroches 2009-03-27 05:45:30 +01:00
parent f25ebc1664
commit 9f673307e0

View File

@ -60,7 +60,7 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
array('required' => true, array('required' => true,
'label' => __('Shortname'), 'label' => __('Shortname'),
'initial' => '', 'initial' => '',
'help_text' => __('It must be unique for each project and composed only of letters and digits.'), 'help_text' => __('It must be unique for each project and composed only of letters, digits and dash (-) like "my-project".'),
)); ));
$this->fields['scm'] = new Pluf_Form_Field_Varchar( $this->fields['scm'] = new Pluf_Form_Field_Varchar(
@ -150,7 +150,7 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
{ {
$shortname = $this->cleaned_data['shortname']; $shortname = $this->cleaned_data['shortname'];
if (preg_match('/[^\-A-Za-z0-9]/', $shortname)) { if (preg_match('/[^\-A-Za-z0-9]/', $shortname)) {
throw new Pluf_Form_Invalid(__('This shortname contains illegal characters, please use only letters and digits.')); throw new Pluf_Form_Invalid(__('This shortname contains illegal characters, please use only letters, digits and dash (-).'));
} }
if (mb_substr($shortname, 0, 1) == '-') { if (mb_substr($shortname, 0, 1) == '-') {
throw new Pluf_Form_Invalid(__('The shortname cannot start with the dash (-) character.')); throw new Pluf_Form_Invalid(__('The shortname cannot start with the dash (-) character.'));