set_focus('tab', 'fields', null);
if (!can_perform('canadminfields'))
{
admin_login();
}
// ###################################################################
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'modify';
}
// ###################################################################
if ($_REQUEST['do'] == 'kill')
{
$priority = new PriorityAPI($bugsys);
$priority->set('priorityid', $bugsys->in['priorityid']);
$priority->set_condition();
$priority->delete();
$admin->redirect('priority.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'delete')
{
$admin->page_confirm(_('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', 'kill', array('priorityid' => $bugsys->input_clean('priorityid', TYPE_UINT)));
}
// ###################################################################
if ($_POST['do'] == 'insert')
{
$priority = new PriorityAPI($bugsys);
$priority->set('priority', $bugsys->in['priority']);
$priority->set('displayorder', $bugsys->in['displayorder']);
$priority->insert();
$admin->redirect('priority.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'add')
{
NavLinks::prioritiesAdd();
$navigator->set_focus('link', 'priorities-add', 'priorities');
$admin->page_start(_('Add New Priority'));
$admin->form_start('priority.php', 'insert');
$admin->table_start();
$admin->table_head(_('New Priority'));
$admin->row_input(_('Priority Title
The title of this priority flag (eg: `Slated for Development` or `Address Now`)
'), 'priority');
$admin->row_input(_('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')
{
$priority = new PriorityAPI($bugsys);
$priority->set('priorityid', $bugsys->in['priorityid']);
$priority->set_condition();
$priority->set('priority', $bugsys->in['priority']);
$priority->set('displayorder', $bugsys->in['displayorder']);
$priority->update();
$admin->redirect('priority.php?do=modify');
}
// ###################################################################
if ($_REQUEST['do'] == 'edit')
{
NavLinks::prioritiesEdit($bugsys->in['priorityid']);
$navigator->set_focus('link', 'fields-pages-priorities', 'fields-pages');
$priority = new PriorityAPI($bugsys);
$priority->set('priorityid', $bugsys->in['priorityid']);
$priority->set_condition();
$priority->fetch();
$admin->page_start(_('Edit Priority'));
$admin->form_start('priority.php', 'update');
$admin->form_hidden_field('priorityid', $priority->objdata['priorityid']);
$admin->table_start();
$admin->table_head(sprintf(_('Edit Priority `%1$s` (id: %2$s)'), $priority->objdata['priority'], $priority->objdata['priorityid']));
$admin->row_input(_('Priority TitleThe title of this priority flag (eg: `Slated for Development` or `Address Now`)
'), 'priority', $priority->objdata['priority']);
$admin->row_input(_('Display OrderThe order in which the priorities are displayed. The higher the number, the lower down in the list it is.
'), 'displayorder', $priority->objdata['displayorder']);
$admin->row_submit();
$admin->table_end();
$admin->form_end();
$admin->page_end();
}
// ###################################################################
if ($_REQUEST['do'] == 'modify')
{
NavLinks::prioritiesAdd();
$navigator->set_focus('link', 'fields-pages-priorities', 'fields-pages');
$admin->page_start(_('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(_('Priority Manager'));
while ($priority = $db->fetch_array($priorities))
{
$admin->row_text("$priority[displayorder]: $priority[priority]", "(priorityid: $priority[priorityid]) [" . _('Edit') . "] [" . _('Delete') . "]");
}
$db->free_result($priorities);
$admin->table_end();
$admin->form_end();
$admin->page_end();
}
/*=====================================================================*\
|| ###################################################################
|| # $HeadURL$
|| # $Id$
|| ###################################################################
\*=====================================================================*/
?>