set_focus('tab', 'fields', null);
if (!can_perform('canadminfields'))
{
admin_login();
}
// ###################################################################
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'modify';
}
// ###################################################################
if ($_REQUEST['do'] == 'kill')
{
$status = new StatusAPI($bugsys);
$status->set('statusid', $input->in['statusid']);
$status->set_condition();
$status->delete();
$admin->redirect('status.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'delete')
{
$admin->page_confirm(T('Are you sure you want to delete this status? Doing so will revert all bugs to the default status (which is set in the options panel)?'), 'status.php', 'kill', array('statusid' => $input->inputClean('statusid', TYPE_UINT)));
}
// ###################################################################
if ($_POST['do'] == 'insert')
{
$status = new StatusAPI($bugsys);
$status->set('status', $input->in['status']);
$status->set('color', $input->in['color']);
$status->set('displayorder', $input->in['displayorder']);
$status->insert();
$admin->redirect('status.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'add')
{
NavLinks::statusesAdd();
$navigator->set_focus('link', 'statuses-add', 'statuses');
$admin->page_start(T('Add New Status'));
$admin->form_start('status.php', 'insert');
$admin->table_start();
$admin->table_head(T('New Status'));
$admin->row_input(T('Status Title
The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)
'), 'status');
$admin->row_input(T('Display OrderThe order in which the statuses ar displayed.
'), 'displayorder');
$admin->row_input(T('Status ColorThe color of the status. This will be displayed on bug listings page to make viewing easier. Note: you must enter the # sign if you are using HEX values.
'), 'color');
$admin->row_submit();
$admin->table_end();
$admin->form_end();
$admin->page_end();
}
// ###################################################################
if ($_POST['do'] == 'update')
{
$status = new StatusAPI($bugsys);
$status->set('statusid', $input->in['statusid']);
$status->set_condition();
$status->set('status', $input->in['status']);
$status->set('color', $input->in['color']);
$status->set('displayorder', $input->in['displayorder']);
$status->update();
$admin->redirect('status.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'edit')
{
NavLinks::statusesEdit($input->in['statusid']);
$navigator->set_focus('link', 'fields-pages-statuses', 'fields-pages');
$status = new StatusAPI($bugsys);
$status->set('statusid', $input->in['statusid']);
$status->set_condition();
$status->fetch();
$admin->page_start(T('Edit Status'));
$admin->form_start('status.php', 'update');
$admin->form_hidden_field('statusid', $status->record['statusid']);
$admin->table_start();
$admin->table_head(sprintf(T('Edit Status - %1$s (id: %2$s)'), $status->record['status'], $status->record['statusid']));
$admin->row_input(T('Status TitleThe title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)
'), 'status', $status->record['status']);
$admin->row_input(T('Display OrderThe order in which the statuses ar displayed.
'), 'displayorder', $status->record['displayorder']);
$admin->row_input(T('Status ColorThe color of the status. This will be displayed on bug listings page to make viewing easier. Note: you must enter the # sign if you are using HEX values.
'), 'color', $status->record['color']);
$admin->row_submit();
$admin->table_end();
$admin->form_end();
$admin->page_end();
}
// ###################################################################
if ($_REQUEST['do'] == 'modify')
{
NavLinks::statusesAdd();
$navigator->set_focus('link', 'fields-pages-statuses', 'fields-pages');
$admin->page_start(T('Status Manager'));
$statuses = $db->query("SELECT * FROM " . TABLE_PREFIX . "status");
$admin->table_start();
$admin->table_head(T('Status Manager'));
foreach ($statuses as $status)
{
$colorblock = '';
$admin->row_text("$colorblock$status[displayorder]: $status[status]", "(statusid: $status[statusid]) [" . T('Edit') . "] [" . T('Delete') . "]");
}
$db->free_result($statuses);
$admin->table_end();
$admin->page_end();
}
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>