ec87e98de65c466fc97f6fa1b7f34f37cca56dec
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 require_once('./global.php');
23 require_once('./includes/api_priority.php');
25 NavLinks
::fieldsPages();
26 $navigator->set_focus('tab', 'fields', null
);
28 if (!can_perform('canadminfields'))
33 // ###################################################################
35 if (empty($_REQUEST['do']))
37 $_REQUEST['do'] = 'modify';
40 // ###################################################################
42 if ($_REQUEST['do'] == 'kill')
44 $priority = new PriorityAPI($bugsys);
45 $priority->set('priorityid', $bugsys->in
['priorityid']);
46 $priority->set_condition();
49 $admin->redirect('priority.php?do=modify');
52 // ###################################################################
54 if ($_REQUEST['do'] == 'delete')
56 $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=' . $bugsys->input_clean('priorityid', TYPE_UINT
));
59 // ###################################################################
61 if ($_POST['do'] == 'insert')
63 $priority = new PriorityAPI($bugsys);
64 $priority->set('priority', $bugsys->in
['priority']);
65 $priority->set('displayorder', $bugsys->in
['displayorder']);
68 $admin->redirect('priority.php?do=modify');
71 // ###################################################################
73 if ($_REQUEST['do'] == 'add')
75 NavLinks
::prioritiesAdd();
76 $navigator->set_focus('link', 'priorities-add', 'priorities');
78 $admin->page_start($lang->string('Add New Priority'));
80 $admin->form_start('priority.php', 'insert');
81 $admin->table_start();
82 $admin->table_head($lang->string('New Priority'));
83 $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');
84 $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');
92 // ###################################################################
94 if ($_POST['do'] == 'update')
96 $priority = new PriorityAPI($bugsys);
97 $priority->set('priorityid', $bugsys->in
['priorityid']);
98 $priority->set_condition();
99 $priority->set('priority', $bugsys->in
['priority']);
100 $priority->set('displayorder', $bugsys->in
['displayorder']);
103 $admin->redirect('priority.php?do=modify');
106 // ###################################################################
108 if ($_REQUEST['do'] == 'edit')
110 NavLinks
::prioritiesEdit($bugsys->in
['priorityid']);
111 $navigator->set_focus('link', 'fields-pages-priorities', 'fields-pages');
113 $priority = new PriorityAPI($bugsys);
114 $priority->set('priorityid', $bugsys->in
['priorityid']);
115 $priority->set_condition();
118 $admin->page_start($lang->string('Edit Priority'));
120 $admin->form_start('priority.php', 'update');
121 $admin->form_hidden_field('priorityid', $priority->objdata
['priorityid']);
122 $admin->table_start();
123 $admin->table_head(sprintf($lang->string('Edit Priority `%1$s` (id: %2$s)'), $priority->objdata
['priority'], $priority->objdata
['priorityid']));
124 $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->objdata
['priority']);
125 $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->objdata
['displayorder']);
126 $admin->row_submit();
133 // ###################################################################
135 if ($_REQUEST['do'] == 'modify')
137 NavLinks
::prioritiesAdd();
138 $navigator->set_focus('link', 'fields-pages-priorities', 'fields-pages');
140 $admin->page_start($lang->string('Priority Manager'));
142 $priorities = $db->query("SELECT * FROM " . TABLE_PREFIX
. "priority ORDER BY displayorder");
144 $admin->form_start('priority.php', 'null');
145 $admin->table_start();
146 $admin->table_head($lang->string('Priority Manager'));
148 while ($priority = $db->fetch_array($priorities))
150 $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>");
152 $db->free_result($priorities);
160 /*=====================================================================*\
161 || ###################################################################
164 || ###################################################################
165 \*=====================================================================*/