query("DELETE FROM " . TABLE_PREFIX . "status WHERE statusid = " . intval($bugsys->in['statusid']));
build_statuses();
$admin->redirect('status.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'delete')
{
$admin->page_confirm($lang->string('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?do=kill&statusid=' . intval($bugsys->in['statusid']));
}
// ###################################################################
if ($_POST['do'] == 'insert')
{
$db->query("INSERT INTO " . TABLE_PREFIX . "status (status, displayorder, color) VALUES ('" . $bugsys->in['status'] . "', " . intval($bugsys->in['displayorder']) . ", '" . $bugsys->in['color'] . "')");
build_statuses();
$admin->redirect('status.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'add')
{
$admin->page_start($lang->string('Add New Status'));
$admin->form_start('status.php', 'insert');
$admin->table_start();
$admin->table_head($lang->string('New Status'), 2, 'standard_bug_fields');
$admin->row_input($lang->string('Status Title
The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)
'), 'status');
$admin->row_input($lang->string('Display OrderThe order in which the statuses ar displayed.
'), 'displayorder');
$admin->row_input($lang->string('Status ColourThe colour 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')
{
$db->query("UPDATE " . TABLE_PREFIX . "status SET status = '" . $bugsys->in['status'] . "', displayorder = " . intval($bugsys->in['displayorder']) . ", color = '" . $bugsys->in['color'] . "' WHERE statusid = " . intval($bugsys->in['statusid']));
build_statuses();
$admin->redirect('status.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'edit')
{
$status = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "status WHERE statusid = " . intval($bugsys->in['statusid']));
if (!is_array($status))
{
$admin->error($lang->getlex('error_invalid_id'));
}
$admin->page_start($lang->string('Edit Status'));
$admin->form_start('status.php', 'update');
$admin->form_hidden_field('statusid', $status['statusid']);
$admin->table_start();
$admin->table_head(sprintf($lang->string('Edit Status - %1$s (id: %2$s)'), $status['status'], $status['statusid']), 2, 'standard_bug_fields');
$admin->row_input($lang->string('Status TitleThe title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)
'), 'status', $status['status']);
$admin->row_input($lang->string('Display OrderThe order in which the statuses ar displayed.
'), 'displayorder', $status['displayorder']);
$admin->row_input($lang->string('Status ColourThe colour 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['color']);
$admin->row_submit();
$admin->table_end();
$admin->form_end();
$admin->page_end();
}
// ###################################################################
if ($_REQUEST['do'] == 'modify')
{
$admin->page_start($lang->string('Status Manager'));
$statuses = $db->query("SELECT * FROM " . TABLE_PREFIX . "status");
$admin->table_start();
$admin->table_head($lang->string('Status Manager'), 2, 'standard_bug_fields');
while ($status = $db->fetch_array($statuses))
{
$colourblock = '';
$admin->row_text("$colourblock$status[displayorder]: $status[status]", "(statusid: $status[statusid]) [" . $lang->string('Edit') . "] [" . $lang->string('Delete') . "]");
}
$db->free_result($statuses);
$admin->row_span('[' . $lang->string('Add New Status') . ']', 'tfoot', 'center', 3);
$admin->table_end();
$admin->page_end();
}
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>