Added the filtering of the non validated users by default.

This commit is contained in:
Loic d'Anterroches 2009-01-02 11:38:35 +01:00
parent 3aaf24d3bb
commit 404e2cd150
3 changed files with 31 additions and 3 deletions

View File

@ -147,10 +147,18 @@ class IDF_Views_Admin
* *
*/ */
public $users_precond = array('Pluf_Precondition::staffRequired'); public $users_precond = array('Pluf_Precondition::staffRequired');
public function users($request, $match) public function users($request, $match, $not_validated=false)
{ {
$title = __('User List');
$pag = new Pluf_Paginator(new Pluf_User()); $pag = new Pluf_Paginator(new Pluf_User());
$db =& Pluf::db();
$true = Pluf_DB_BooleanToDb(true, $db);
if ($not_validated) {
$pag->forced_where = new Pluf_SQL('first_name = \'---\' AND active!='.$true);
$title = __('Not Validated User List');
} else {
$pag->forced_where = new Pluf_SQL('first_name != \'---\' AND active='.$true);
$title = __('User List');
}
$pag->class = 'recent-issues'; $pag->class = 'recent-issues';
$pag->summary = __('This table shows the users in the forge.'); $pag->summary = __('This table shows the users in the forge.');
$pag->action = 'IDF_Views_Admin::users'; $pag->action = 'IDF_Views_Admin::users';
@ -164,7 +172,7 @@ class IDF_Views_Admin
array('active', 'IDF_Views_Admin_bool', __('Active')), array('active', 'IDF_Views_Admin_bool', __('Active')),
array('last_login', 'Pluf_Paginator_DateYMDHM', __('Last Login')), array('last_login', 'Pluf_Paginator_DateYMDHM', __('Last Login')),
); );
$pag->extra_classes = array('', 'a-c', 'a-c', 'a-c', 'a-c', 'a-c'); $pag->extra_classes = array('', '', 'a-c', 'a-c', 'a-c', 'a-c');
$pag->configure($list_display, array(), array('login')); $pag->configure($list_display, array(), array('login'));
$pag->items_per_page = 50; $pag->items_per_page = 50;
$pag->no_results_text = __('No users were found.'); $pag->no_results_text = __('No users were found.');
@ -173,9 +181,19 @@ class IDF_Views_Admin
array( array(
'page_title' => $title, 'page_title' => $title,
'users' => $pag, 'users' => $pag,
'not_validated' => $not_validated,
), ),
$request); $request);
} }
/**
* Not validated users.
*/
public $usersNotValidated_precond = array('Pluf_Precondition::staffRequired');
public function usersNotValidated($request, $match)
{
return $this->users($request, $match, true);
}
/** /**
* Edition of a user. * Edition of a user.

View File

@ -423,6 +423,12 @@ $ctl[] = array('regex' => '#^/admin/users/$#',
'model' => 'IDF_Views_Admin', 'model' => 'IDF_Views_Admin',
'method' => 'users'); 'method' => 'users');
$ctl[] = array('regex' => '#^/admin/users/notvalid/$#',
'base' => $base,
'priority' => 4,
'model' => 'IDF_Views_Admin',
'method' => 'usersNotValidated');
$ctl[] = array('regex' => '#^/admin/users/(\d+)/$#', $ctl[] = array('regex' => '#^/admin/users/(\d+)/$#',
'base' => $base, 'base' => $base,
'priority' => 4, 'priority' => 4,

View File

@ -6,6 +6,10 @@
{$users.render} {$users.render}
{/block} {/block}
{block context} {block context}
<p>{trans 'Number of users:'} <strong>{$users.nb_items}</strong></p>
{if !$not_validated}{aurl 'url', 'IDF_Views_Admin::usersNotValidated'}
<p class="helptext">{blocktrans}See <a href="{$url}">not validated users</a>.{/blocktrans}</p>
{/if}
<div class="issue-submit-info"> <div class="issue-submit-info">
{blocktrans}<p>You have here an overview of the users registered in the forge.</p>{/blocktrans} {blocktrans}<p>You have here an overview of the users registered in the forge.</p>{/blocktrans}
</div> </div>