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', $bugsys->in['statusid']);
$status->set_condition();
$status->delete();
$admin->redirect('status.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'delete')
{
$admin->page_confirm(_('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' => $bugsys->input_clean('statusid', TYPE_UINT)));
}
// ###################################################################
if ($_POST['do'] == 'insert')
{
$status = new StatusAPI($bugsys);
$status->set('status', $bugsys->in['status']);
$status->set('color', $bugsys->in['color']);
$status->set('displayorder', $bugsys->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(_('Add New Status'));
$admin->form_start('status.php', 'insert');
$admin->table_start();
$admin->table_head(_('New Status'));
$admin->row_input(_('Status Title
The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)
'), 'status');
$admin->row_input(_('Display OrderThe order in which the statuses ar displayed.
'), 'displayorder');
$admin->row_input(_('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', $bugsys->in['statusid']);
$status->set_condition();
$status->set('status', $bugsys->in['status']);
$status->set('color', $bugsys->in['color']);
$status->set('displayorder', $bugsys->in['displayorder']);
$status->update();
$admin->redirect('status.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'edit')
{
NavLinks::statusesEdit($bugsys->in['statusid']);
$navigator->set_focus('link', 'fields-pages-statuses', 'fields-pages');
$status = new StatusAPI($bugsys);
$status->set('statusid', $bugsys->in['statusid']);
$status->set_condition();
$status->fetch();
$admin->page_start(_('Edit Status'));
$admin->form_start('status.php', 'update');
$admin->form_hidden_field('statusid', $status->objdata['statusid']);
$admin->table_start();
$admin->table_head(sprintf(_('Edit Status - %1$s (id: %2$s)'), $status->objdata['status'], $status->objdata['statusid']));
$admin->row_input(_('Status TitleThe title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)
'), 'status', $status->objdata['status']);
$admin->row_input(_('Display OrderThe order in which the statuses ar displayed.
'), 'displayorder', $status->objdata['displayorder']);
$admin->row_input(_('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->objdata['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(_('Status Manager'));
$statuses = $db->query("SELECT * FROM " . TABLE_PREFIX . "status");
$admin->table_start();
$admin->table_head(_('Status Manager'));
while ($status = $db->fetch_array($statuses))
{
$colorblock = '';
$admin->row_text("$colorblock$status[displayorder]: $status[status]", "(statusid: $status[statusid]) [" . _('Edit') . "] [" . _('Delete') . "]");
}
$db->free_result($statuses);
$admin->table_end();
$admin->page_end();
}
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>