]> src.bluestatic.org Git - bugdar.git/blob - admin/severity.php
r315: - Changed trackerhome.tpl to use stylevars
[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::p('confirm_delete_severity'), '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::p('add_new_severity'));
58
59 $admin->form_start('severity.php', 'insert');
60 $admin->table_start();
61 $admin->table_head(lang::p('new_severity'));
62 $admin->row_input(lang::p('severity_title'), 'severity');
63 $admin->row_input(lang::p('severity_display_order'), '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::p('error_invalid_id'));
89 }
90
91 $admin->page_start(lang::p('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(lang::p('edit_severity_title', $severity['severity'], $severity['severityid']));
97 $admin->row_input(lang::p('severity_title'), 'severity', $severity['severity']);
98 $admin->row_input(lang::p('severity_display_order'), '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('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('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::p('edit_wraplink') . "</a> <a href=\"severity.php?do=delete&amp;severityid=$severity[severityid]\">" . lang::p('delete_wraplink') . "</a>");
121 }
122 $db->free_result($severityes);
123
124 $admin->row_span('<input type="button" name="addug" value=" ' . lang::p('add_new_severity') . ' " onclick="window.location = \'severity.php?do=add\';" />', '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 ?>