Fixed issue 105 point 2, added deletion of a project.

Note that the source code is not deleted at the moment.
This commit is contained in:
Loic d'Anterroches
2009-02-27 10:42:18 +01:00
parent f986184254
commit 7f4f14e78d
7 changed files with 257 additions and 2 deletions

View File

@@ -142,6 +142,39 @@ class IDF_Views_Admin
$request);
}
/**
* Deletion of a project.
*
* Only the forge administrator can perform this operation.
*/
public $projectDelete_precond = array('Pluf_Precondition::adminRequired');
public function projectDelete($request, $match)
{
$project = Pluf_Shortcuts_GetObjectOr404('IDF_Project', $match[1]);
$title = sprintf(__('Delete %s Project'), $project);
$extra = array('project' => $project,
'user' => $request->user);
if ($request->method == 'POST') {
$form = new IDF_Form_Admin_ProjectDelete($request->POST, $extra);
if ($form->isValid()) {
$project = $form->save();
$request->user->setMessage(__('The project has been deleted.'));
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Admin::projects');
return new Pluf_HTTP_Response_Redirect($url);
}
} else {
$form = new IDF_Form_Admin_ProjectDelete(null, $extra);
}
return Pluf_Shortcuts_RenderToResponse('idf/gadmin/projects/delete.html',
array(
'page_title' => $title,
'form' => $form,
'stats' => $project->getStats(),
'code' => $form->getCode(),
),
$request);
}
/**
* Users overview.
*