query("DELETE FROM " . TABLE_PREFIX . "severity WHERE severityid = " . intval($bugsys->in['serverityid']));
build_severities();
$admin->redirect('severity.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'delete')
{
$admin->page_confirm($lang->string('Are you sure you want to delete this severity? Doing so will revert all bugs to the default severity (which is set in the options panel)?'), 'severity.php?do=kill&severityid=' . intval($bugsys->in['severityid']));
}
// ###################################################################
if ($_POST['do'] == 'insert')
{
$db->query("INSERT INTO " . TABLE_PREFIX . "severity (severity, displayorder) VALUES ('" . $bugsys->in['severity'] . "', " . intval($bugsys->in['displayorder']) . ")");
build_severities();
$admin->redirect('severity.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'add')
{
$admin->page_start($lang->string('Add New Severity'));
$admin->form_start('severity.php', 'insert');
$admin->table_start();
$admin->table_head($lang->string('New Severity'));
$admin->row_input($lang->string('Severity Title
The title of this severity flag (eg: `Major` or `Critical`)
'), 'severity');
$admin->row_input($lang->string('Display OrderThe order in which the severities are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder');
$admin->row_submit();
$admin->table_end();
$admin->form_end();
$admin->page_end();
}
// ###################################################################
if ($_POST['do'] == 'update')
{
sanitize(array('severityid' => INT, 'severity' => STR, 'displayorder' => INT));
$db->query("UPDATE " . TABLE_PREFIX . "severity SET severity = '" . $bugsys->in['severity'] . "', displayorder = " . intval($bugsys->in['displayorder']) . " WHERE severityid = " . intval($bugsys->in['severityid']));
build_severities();
$admin->redirect('severity.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'edit')
{
$severity = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "severity WHERE severityid = " . intval($bugsys->in['severityid']));
if (!is_array($severity))
{
$admin->error($lang->getlex('error_invalid_id'));
}
$admin->page_start($lang->string('Edit Severity'));
$admin->form_start('severity.php', 'update');
$admin->form_hidden_field('severityid', $severity['severityid']);
$admin->table_start();
$admin->table_head(sprintf($lang->string('Edit Severity - %1$s (id: %2$s)', $severity['severity'], $severity['severityid'])));
$admin->row_input($lang->string('Severity TitleThe title of this severity flag (eg: `Major` or `Critical`)
'), 'severity', $severity['severity']);
$admin->row_input($lang->string('Display OrderThe order in which the severities are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder', $severity['displayorder']);
$admin->row_submit();
$admin->table_end();
$admin->form_end();
$admin->page_end();
}
// ###################################################################
if ($_REQUEST['do'] == 'modify')
{
$admin->page_start($lang->string('Severity Manager'));
$severities = $db->query("SELECT * FROM " . TABLE_PREFIX . "severity ORDER BY displayorder");
$admin->form_start('severity.php', 'null');
$admin->table_start();
$admin->table_head($lang->string('Severity Manager'));
while ($severity = $db->fetch_array($severities))
{
$admin->row_text("$severity[displayorder]: $severity[severity]", "(severityid: $severity[severityid]) [" . $lang->string('Edit') . "] [" . $lang->string('Delete') . "]");
}
$db->free_result($severityes);
$admin->row_span('[' . $lang->string('Add New Severity') . ']', 'tfoot', 'center', 3);
$admin->table_end();
$admin->form_end();
$admin->page_end();
}
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>