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($bugsys);
$severity->set('severityid', $bugsys->in['severityid']);
$severity->set_condition();
$severity->delete();
$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=' . $bugsys->input_clean('severityid', TYPE_UINT));
}
// ###################################################################
if ($_POST['do'] == 'insert')
{
$severity = new SeverityAPI($bugsys);
$severity->set('severity', $bugsys->in['severity']);
$severity->set('displayorder', $bugsys->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($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')
{
$severity = new SeverityAPI($bugsys);
$severity->set('severityid', $bugsys->in['severityid']);
$severity->set_condition();
$severity->set('severity', $bugsys->in['severity']);
$severity->set('displayorder', $bugsys->in['displayorder']);
$severity->update();
$admin->redirect('severity.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'edit')
{
NavLinks::severitiesEdit($bugsys->in['severityid']);
$navigator->set_focus('link', 'fields-pages-severities', 'fields-pages');
$severity = new SeverityAPI($bugsys);
$severity->set('severityid', $bugsys->in['severityid']);
$severity->set_condition();
$severity->fetch();
$admin->page_start($lang->string('Edit Severity'));
$admin->form_start('severity.php', 'update');
$admin->form_hidden_field('severityid', $severity->objdata['severityid']);
$admin->table_start();
$admin->table_head(sprintf($lang->string('Edit Severity - %1$s (id: %2$s)'), $severity->objdata['severity'], $severity->objdata['severityid']));
$admin->row_input($lang->string('Severity TitleThe title of this severity flag (eg: `Major` or `Critical`)
'), 'severity', $severity->objdata['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->objdata['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($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($severities);
$admin->table_end();
$admin->form_end();
$admin->page_end();
}
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>