]> src.bluestatic.org Git - bugdar.git/blob - admin/severity.php
r496: Removing #submitrow from report.css to global.css
[bugdar.git] / admin / severity.php
1 <?php
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 \*=====================================================================*/
12
13 require_once('./global.php');
14 require_once('./includes/functions_datastore.php');
15
16 if (!can_perform('canadminfields'))
17 {
18 admin_login();
19 }
20
21 // ###################################################################
22
23 if (empty($_REQUEST['do']))
24 {
25 $_REQUEST['do'] = 'modify';
26 }
27
28 // ###################################################################
29
30 if ($_REQUEST['do'] == 'kill')
31 {
32 $db->query("DELETE FROM " . TABLE_PREFIX . "severity WHERE severityid = " . intval($bugsys->in['serverityid']));
33 build_severities();
34 $admin->redirect('severity.php?do=modify');
35 }
36
37 // ###################################################################
38
39 if ($_REQUEST['do'] == 'delete')
40 {
41 $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&amp;severityid=' . intval($bugsys->in['severityid']));
42 }
43
44 // ###################################################################
45
46 if ($_POST['do'] == 'insert')
47 {
48 $db->query("INSERT INTO " . TABLE_PREFIX . "severity (severity, displayorder) VALUES ('" . $bugsys->in['severity'] . "', " . intval($bugsys->in['displayorder']) . ")");
49 build_severities();
50 $admin->redirect('severity.php?do=modify');
51 }
52
53 // ###################################################################
54
55 if ($_REQUEST['do'] == 'add')
56 {
57 $admin->page_start($lang->string('Add New Severity'));
58
59 $admin->form_start('severity.php', 'insert');
60 $admin->table_start();
61 $admin->table_head($lang->string('New Severity'));
62 $admin->row_input($lang->string('Severity Title<div><dfn>The title of this severity flag (eg: `Major` or `Critical`)</dfn></div>'), 'severity');
63 $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');
64 $admin->row_submit();
65 $admin->table_end();
66 $admin->form_end();
67
68 $admin->page_end();
69 }
70
71 // ###################################################################
72
73 if ($_POST['do'] == 'update')
74 {
75 sanitize(array('severityid' => INT, 'severity' => STR, 'displayorder' => INT));
76 $db->query("UPDATE " . TABLE_PREFIX . "severity SET severity = '" . $bugsys->in['severity'] . "', displayorder = " . intval($bugsys->in['displayorder']) . " WHERE severityid = " . intval($bugsys->in['severityid']));
77 build_severities();
78 $admin->redirect('severity.php?do=modify');
79 }
80
81 // ###################################################################
82
83 if ($_REQUEST['do'] == 'edit')
84 {
85 $severity = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "severity WHERE severityid = " . intval($bugsys->in['severityid']));
86 if (!is_array($severity))
87 {
88 $admin->error($lang->getlex('error_invalid_id'));
89 }
90
91 $admin->page_start($lang->string('Edit Severity'));
92
93 $admin->form_start('severity.php', 'update');
94 $admin->form_hidden_field('severityid', $severity['severityid']);
95 $admin->table_start();
96 $admin->table_head(sprintf($lang->string('Edit Severity - %1$s (id: %2$s)', $severity['severity'], $severity['severityid'])));
97 $admin->row_input($lang->string('Severity Title<div><dfn>The title of this severity flag (eg: `Major` or `Critical`)</dfn></div>'), 'severity', $severity['severity']);
98 $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['displayorder']);
99 $admin->row_submit();
100 $admin->table_end();
101 $admin->form_end();
102
103 $admin->page_end();
104 }
105
106 // ###################################################################
107
108 if ($_REQUEST['do'] == 'modify')
109 {
110 $admin->page_start($lang->string('Severity Manager'));
111
112 $severities = $db->query("SELECT * FROM " . TABLE_PREFIX . "severity ORDER BY displayorder");
113
114 $admin->form_start('severity.php', 'null');
115 $admin->table_start();
116 $admin->table_head($lang->string('Severity Manager'));
117
118 while ($severity = $db->fetch_array($severities))
119 {
120 $admin->row_text("$severity[displayorder]: <a href=\"severity.php?do=edit&amp;severityid=$severity[severityid]\">$severity[severity]</a>", "(severityid: $severity[severityid]) <a href=\"severity.php?do=edit&amp;severityid=$severity[severityid]\">[" . $lang->string('Edit') . "]</a> <a href=\"severity.php?do=delete&amp;severityid=$severity[severityid]\">[" . $lang->string('Delete') . "]</a>");
121 }
122 $db->free_result($severityes);
123
124 $admin->row_span('<a href="severity.php?do=add">[' . $lang->string('Add New Severity') . ']</a>', 'tfoot', 'center', 3);
125 $admin->table_end();
126 $admin->form_end();
127
128 $admin->page_end();
129 }
130
131 /*=====================================================================*\
132 || ###################################################################
133 || # $HeadURL$
134 || # $Id$
135 || ###################################################################
136 \*=====================================================================*/
137 ?>