Added the ability to mark a project as private at creation time.

This commit is contained in:
Loic d'Anterroches 2009-01-01 22:11:23 +01:00
parent 99f82216dd
commit 2bfa4478e1
2 changed files with 15 additions and 1 deletions

View File

@ -49,10 +49,17 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
'initial' => '', 'initial' => '',
)); ));
$this->fields['private_project'] = new Pluf_Form_Field_Boolean(
array('required' => false,
'label' => __('Private project'),
'initial' => false,
'widget' => 'Pluf_Form_Widget_CheckboxInput',
));
$this->fields['shortname'] = new Pluf_Form_Field_Varchar( $this->fields['shortname'] = new Pluf_Form_Field_Varchar(
array('required' => true, array('required' => true,
'label' => __('Shortname'), 'label' => __('Shortname'),
'initial' => 'myproject', '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 and digits.'),
)); ));
@ -149,6 +156,7 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
$project = new IDF_Project(); $project = new IDF_Project();
$project->name = $this->cleaned_data['name']; $project->name = $this->cleaned_data['name'];
$project->shortname = $this->cleaned_data['shortname']; $project->shortname = $this->cleaned_data['shortname'];
$project->private = $this->cleaned_data['private_project'];
$project->description = __('Write your project description here.'); $project->description = __('Write your project description here.');
$project->create(); $project->create();
$conf = new IDF_Conf(); $conf = new IDF_Conf();

View File

@ -68,6 +68,12 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<th>{if $form.f.private_project.errors}{$form.f.private_project.fieldErrors}{/if}
{$form.f.private_project|unsafe}
</th>
<td>{$form.f.private_project.labelTag}</td>
</tr>
<tr>
<td>&nbsp;</td> <td>&nbsp;</td>
<td> <td>
<input type="submit" value="{trans 'Create Project'}" name="submit" /> <input type="submit" value="{trans 'Create Project'}" name="submit" />