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/functions_datastore.php');
24 require_once('./includes/api_severity.php');
26 if (!can_perform('canadminfields'))
31 // ###################################################################
33 if (empty($_REQUEST['do']))
35 $_REQUEST['do'] = 'modify';
38 // ###################################################################
40 if ($_REQUEST['do'] == 'kill')
42 $severity = new SeverityAPI($bugsys);
43 $severity->set('severityid', $bugsys->in
['severityid']);
44 $severity->set_condition();
48 $admin->redirect('severity.php?do=modify');
51 // ###################################################################
53 if ($_REQUEST['do'] == 'delete')
55 $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
));
58 // ###################################################################
60 if ($_POST['do'] == 'insert')
62 $severity = new SeverityAPI($bugsys);
63 $severity->set('severity', $bugsys->in
['severity']);
64 $severity->set('displayorder', $bugsys->in
['displayorder']);
68 $admin->redirect('severity.php?do=modify');
71 // ###################################################################
73 if ($_REQUEST['do'] == 'add')
75 $admin->page_start($lang->string('Add New Severity'));
77 $admin->form_start('severity.php', 'insert');
78 $admin->table_start();
79 $admin->table_head($lang->string('New Severity'), 2, 'standard_bug_fields');
80 $admin->row_input($lang->string('Severity Title<div><dfn>The title of this severity flag (eg: `Major` or `Critical`)</dfn></div>'), 'severity');
81 $admin->row_input($lang->string('Display Order<div><dfn>The order in which the severities are displayed. The higher the number, the lower down in the list it is.</dfn></div>'), 'displayorder');
89 // ###################################################################
91 if ($_POST['do'] == 'update')
93 $severity = new SeverityAPI($bugsys);
94 $severity->set('severityid', $bugsys->in
['severityid']);
95 $severity->set_condition();
96 $severity->set('severity', $bugsys->in
['severity']);
97 $severity->set('displayorder', $bugsys->in
['displayorder']);
101 $admin->redirect('severity.php?do=modify');
104 // ###################################################################
106 if ($_REQUEST['do'] == 'edit')
108 $severity = new SeverityAPI($bugsys);
109 $severity->set('severityid', $bugsys->in
['severityid']);
110 $severity->set_condition();
113 $admin->page_start($lang->string('Edit Severity'));
115 $admin->form_start('severity.php', 'update');
116 $admin->form_hidden_field('severityid', $severity->objdata
['severityid']);
117 $admin->table_start();
118 $admin->table_head(sprintf($lang->string('Edit Severity - %1$s (id: %2$s)'), $severity->objdata
['severity'], $severity->objdata
['severityid']), 2, 'standard_bug_fields');
119 $admin->row_input($lang->string('Severity Title<div><dfn>The title of this severity flag (eg: `Major` or `Critical`)</dfn></div>'), 'severity', $severity->objdata
['severity']);
120 $admin->row_input($lang->string('Display Order<div><dfn>The order in which the severities are displayed. The higher the number, the lower down in the list it is.</dfn></div>'), 'displayorder', $severity->objdata
['displayorder']);
121 $admin->row_submit();
128 // ###################################################################
130 if ($_REQUEST['do'] == 'modify')
132 $admin->page_start($lang->string('Severity Manager'));
134 $severities = $db->query("SELECT * FROM " . TABLE_PREFIX
. "severity ORDER BY displayorder");
136 $admin->form_start('severity.php', 'null');
137 $admin->table_start();
138 $admin->table_head($lang->string('Severity Manager'), 2, 'standard_bug_fields');
140 while ($severity = $db->fetch_array($severities))
142 $admin->row_text("$severity[displayorder]: <a href=\"severity.php?do=edit&severityid=$severity[severityid]\">$severity[severity]</a>", "(severityid: $severity[severityid]) <a href=\"severity.php?do=edit&severityid=$severity[severityid]\">[" . $lang->string('Edit') . "]</a> <a href=\"severity.php?do=delete&severityid=$severity[severityid]\">[" . $lang->string('Delete') . "]</a>");
144 $db->free_result($severityes);
146 $admin->row_span('<a href="severity.php?do=add">[' . $lang->string('Add New Severity') . ']</a>', 'tfoot', 'center', 3);
153 /*=====================================================================*\
154 || ###################################################################
157 || ###################################################################
158 \*=====================================================================*/