set_focus('tab', 'fields', null);
if (!can_perform('canadminfields'))
{
admin_login();
}
// ###################################################################
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'modify';
}
// ###################################################################
if ($_REQUEST['do'] == 'kill')
{
$severity = new SeverityAPI();
$severity->set('severityid', $input->in['severityid']);
$severity->set_condition();
$severity->delete();
$admin->redirect('severity.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'delete')
{
$admin->page_confirm(T('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', 'kill', array('severityid' => $input->inputClean('severityid', TYPE_UINT)));
}
// ###################################################################
if ($_POST['do'] == 'insert')
{
$severity = new SeverityAPI();
$severity->set('severity', $input->in['severity']);
$severity->set('displayorder', $input->in['displayorder']);
$severity->insert();
$admin->redirect('severity.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'add')
{
NavLinks::severitiesAdd();
$navigator->set_focus('link', 'severities-add', 'severities');
$admin->page_start(T('Add New Severity'));
$admin->form_start('severity.php', 'insert');
$admin->table_start();
$admin->table_head(T('New Severity'));
$admin->row_input(T('Severity Title
The title of this severity flag (eg: `Major` or `Critical`)
'), 'severity');
$admin->row_input(T('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')
{
$severity = new SeverityAPI();
$severity->set('severityid', $input->in['severityid']);
$severity->set_condition();
$severity->set('severity', $input->in['severity']);
$severity->set('displayorder', $input->in['displayorder']);
$severity->update();
$admin->redirect('severity.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'edit')
{
NavLinks::severitiesEdit($input->in['severityid']);
$navigator->set_focus('link', 'fields-pages-severities', 'fields-pages');
$severity = new SeverityAPI();
$severity->set('severityid', $input->in['severityid']);
$severity->set_condition();
$severity->fetch();
$admin->page_start(T('Edit Severity'));
$admin->form_start('severity.php', 'update');
$admin->form_hidden_field('severityid', $severity->record['severityid']);
$admin->table_start();
$admin->table_head(sprintf(T('Edit Severity - %1$s (id: %2$s)'), $severity->record['severity'], $severity->record['severityid']));
$admin->row_input(T('Severity TitleThe title of this severity flag (eg: `Major` or `Critical`)
'), 'severity', $severity->record['severity']);
$admin->row_input(T('Display OrderThe order in which the severities are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder', $severity->record['displayorder']);
$admin->row_submit();
$admin->table_end();
$admin->form_end();
$admin->page_end();
}
// ###################################################################
if ($_REQUEST['do'] == 'modify')
{
NavLinks::severitiesAdd();
$navigator->set_focus('link', 'fields-pages-severities', 'fields-pages');
$admin->page_start(T('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(T('Severity Manager'));
foreach ($severities as $severity)
{
$admin->row_text("$severity[displayorder]: $severity[severity]", "(severityid: $severity[severityid]) [" . T('Edit') . "] [" . T('Delete') . "]");
}
$db->free_result($severities);
$admin->table_end();
$admin->form_end();
$admin->page_end();
}
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>