Update the admin template

This commit is contained in:
William MARTIN 2011-04-01 14:17:56 +02:00
parent 587aa11cda
commit 9a93acd1a5
2 changed files with 53 additions and 1 deletions

View File

@ -265,6 +265,33 @@ class IDF_Views_Project
public $admin_precond = array('IDF_Precondition::projectOwner'); public $admin_precond = array('IDF_Precondition::projectOwner');
public function admin($request, $match) public function admin($request, $match)
{ {
$prj = $request->project;
$title = sprintf(__('%s Project Summary'), (string) $prj);
$extra = array('project' => $prj);
if ($request->method == 'POST') {
$form = new IDF_Form_ProjectConf(array_merge($request->POST,
$request->FILES),
$extra);
if ($form->isValid()) {
$form->save();
$request->user->setMessage(__('The project has been updated.'));
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Project::admin',
array($prj->shortname));
return new Pluf_HTTP_Response_Redirect($url);
}
} else {
$form = new IDF_Form_ProjectConf($prj->getData(), $extra);
}
return Pluf_Shortcuts_RenderToResponse('idf/admin/summary.html',
array(
'page_title' => $title,
'form' => $form,
'project' => $prj,
'upload_path' => Pluf::f('upload_path'),
),
$request);
/*
$prj = $request->project; $prj = $request->project;
$title = sprintf(__('%s Project Summary'), (string) $prj); $title = sprintf(__('%s Project Summary'), (string) $prj);
$form_fields = array('fields'=> array('name', 'shortdesc', $form_fields = array('fields'=> array('name', 'shortdesc',
@ -292,6 +319,7 @@ class IDF_Views_Project
'form' => $form, 'form' => $form,
), ),
$request); $request);
*/
} }
/** /**

View File

@ -9,7 +9,7 @@
{/if} {/if}
</div> </div>
{/if} {/if}
<form method="post" action="."> <form method="post" enctype="multipart/form-data" action=".">
<table class="form" summary=""> <table class="form" summary="">
<tr> <tr>
<th><strong>{$form.f.name.labelTag}:</strong></th> <th><strong>{$form.f.name.labelTag}:</strong></th>
@ -30,6 +30,30 @@
{$form.f.description|unsafe} {$form.f.description|unsafe}
</td> </td>
</tr> </tr>
<tr>
<th><strong>{trans 'Actual logo'}:</strong></th>
<td>
{if $project.logo}
<img src="{$upload_path}/{$project.logo}" alt="project logo" />
{else}
{trans 'Your project do not have a logo configured yet.'}
{/if}
</td>
</tr>
<tr>
<th><strong>{$form.f.logo.labelTag}:</strong></th>
<td>{if $form.f.logo.errors}{$form.f.logo.fieldErrors}{/if}
{$form.f.logo|unsafe}
</td>
</tr>
{if $project.logo}
<tr>
<th><strong>{$form.f.logo_remove.labelTag}:</strong></th>
<td>{if $form.f.logo_remove.errors}{$form.f.logo_remove.fieldErrors}{/if}
{$form.f.logo_remove|unsafe}
</td>
</tr>
{/if}
<tr><td>&nbsp;</td> <tr><td>&nbsp;</td>
<td> <td>
<input type="submit" name="submit" value="{trans 'Save Changes'}" /> <input type="submit" name="submit" value="{trans 'Save Changes'}" />