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