2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 require_once('./global.php');
14 require_once('./includes/functions_datastore.php');
16 if (!can_perform('canadminfields'))
21 // ###################################################################
23 if (empty($_REQUEST['do']))
25 $_REQUEST['do'] = 'modify';
28 // ###################################################################
30 if ($_REQUEST['do'] == 'kill')
32 $db->query("DELETE FROM " . TABLE_PREFIX
. "priority WHERE priorityid = " . intval($bugsys->in
['priorityid']));
34 $admin->redirect('priority.php?do=modify');
37 // ###################################################################
39 if ($_REQUEST['do'] == 'delete')
41 $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']));
44 // ###################################################################
46 if ($_POST['do'] == 'insert')
48 $db->query("INSERT INTO " . TABLE_PREFIX
. "priority (priority, displayorder) VALUES ('" . $bugsys->in
['priority'] . "'," . intval($bugsys->in
['displayorder']) . ")");
50 $admin->redirect('priority.php?do=modify');
53 // ###################################################################
55 if ($_REQUEST['do'] == 'add')
57 $admin->page_start($lang->string('Add New Priority'));
59 $admin->form_start('priority.php', 'insert');
60 $admin->table_start();
61 $admin->table_head($lang->string('New Priority'));
62 $admin->row_input($lang->string('Priority Title<div><dfn>The title of this priority flag (eg: `Slated for Development` or `Address Now`)</dfn></div>'), 'priority');
63 $admin->row_input($lang->string('Display Order<div><dfn>The order in which the priorities are displayed. The higher the number, the lower down in the list it is.</dfn></div>'), 'displayorder');
71 // ###################################################################
73 if ($_POST['do'] == 'update')
75 $db->query("UPDATE " . TABLE_PREFIX
. "priority SET priority = '" . $bugsys->in
['priority'] . "', displayorder = " . intval($bugsys->in
['displayorder']) . " WHERE priorityid = " . intval($bugsys->in
['priorityid']));
77 $admin->redirect('priority.php?do=modify');
80 // ###################################################################
82 if ($_REQUEST['do'] == 'edit')
84 $priority = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "priority WHERE priorityid = " . intval($bugsys->in
['priorityid']));
85 if (!is_array($priority))
87 $admin->error($lang->getlex('error_invalid_id'));
90 $admin->page_start($lang->string('Edit Priority'));
92 $admin->form_start('priority.php', 'update');
93 $admin->form_hidden_field('priorityid', $priority['priorityid']);
94 $admin->table_start();
95 $admin->table_head(sprintf($lang->string('Edit Priority `%1$s` (id: %2$s)', $priority['priority'], $priority['priorityid'])));
96 $admin->row_input($lang->string('Priority Title<div><dfn>The title of this priority flag (eg: `Slated for Development` or `Address Now`)</dfn></div>'), 'priority', $priority['priority']);
97 $admin->row_input($lang->string('Display Order<div><dfn>The order in which the priorities are displayed. The higher the number, the lower down in the list it is.</dfn></div>'), 'displayorder', $priority['displayorder']);
105 // ###################################################################
107 if ($_REQUEST['do'] == 'modify')
109 $admin->page_start($lang->string('Priority Manager'));
111 $priorities = $db->query("SELECT * FROM " . TABLE_PREFIX
. "priority ORDER BY displayorder");
113 $admin->form_start('priority.php', 'null');
114 $admin->table_start();
115 $admin->table_head($lang->string('Priority Manager'));
117 while ($priority = $db->fetch_array($priorities))
119 $admin->row_text("$priority[displayorder]: <a href=\"priority.php?do=edit&priorityid=$priority[priorityid]\">$priority[priority]</a>", "(priorityid: $priority[priorityid]) <a href=\"priority.php?do=edit&priorityid=$priority[priorityid]\">[" . $lang->string('Edit') . "]</a> <a href=\"priority.php?do=delete&priorityid=$priority[priorityid]\">[" . $lang->string('Delete') . "]</a>");
121 $db->free_result($priorityes);
123 $admin->row_span('<a href="priority.php?do=add">[' . $lang->string('Add New Priority') . ']</a>', 'tfoot', 'center', 3);
130 /*=====================================================================*\
131 || ###################################################################
134 || ###################################################################
135 \*=====================================================================*/