]> src.bluestatic.org Git - bugdar.git/blob - admin/status.php
r496: Removing #submitrow from report.css to global.css
[bugdar.git] / admin / status.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 . "status WHERE statusid = " . intval($bugsys->in['statusid']));
33 build_statuses();
34 $admin->redirect('status.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 status? Doing so will revert all bugs to the default status (which is set in the options panel)?'), 'status.php?do=kill&amp;statusid=' . intval($bugsys->in['statusid']));
42 }
43
44 // ###################################################################
45
46 if ($_POST['do'] == 'insert')
47 {
48 $db->query("INSERT INTO " . TABLE_PREFIX . "status (status, displayorder, color) VALUES ('" . $bugsys->in['status'] . "', " . intval($bugsys->in['displayorder']) . ", '" . $bugsys->in['color'] . "')");
49 build_statuses();
50 $admin->redirect('status.php?do=modify');
51 }
52
53 // ###################################################################
54
55 if ($_REQUEST['do'] == 'add')
56 {
57 $admin->page_start($lang->string('Add New Status'));
58
59 $admin->form_start('status.php', 'insert');
60 $admin->table_start();
61 $admin->table_head($lang->string('New Status'));
62 $admin->row_input($lang->string('Status Title<div><dfn>The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)</dfn></div>'), 'status');
63 $admin->row_input($lang->string('Display Order<div><dfn>The order in which the statuses ar displayed.</dfn></div>'), 'displayorder');
64 $admin->row_input($lang->string('Status Colour<div><dfn>The colour of the status. This will be displayed on bug listings page to make viewing easier. Note: you must enter the # sign if you are using HEX values.</dfn></div>'), 'color');
65 $admin->row_submit();
66 $admin->table_end();
67 $admin->form_end();
68
69 $admin->page_end();
70 }
71
72 // ###################################################################
73
74 if ($_POST['do'] == 'update')
75 {
76 $db->query("UPDATE " . TABLE_PREFIX . "status SET status = '" . $bugsys->in['status'] . "', displayorder = " . intval($bugsys->in['displayorder']) . ", color = '" . $bugsys->in['color'] . "' WHERE statusid = " . intval($bugsys->in['statusid']));
77 build_statuses();
78 $admin->redirect('status.php?do=modify');
79 }
80
81 // ###################################################################
82
83 if ($_REQUEST['do'] == 'edit')
84 {
85 $status = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "status WHERE statusid = " . intval($bugsys->in['statusid']));
86 if (!is_array($status))
87 {
88 $admin->error($lang->getlex('error_invalid_id'));
89 }
90
91 $admin->page_start($lang->string('Edit Status'));
92
93 $admin->form_start('status.php', 'update');
94 $admin->form_hidden_field('statusid', $status['statusid']);
95 $admin->table_start();
96 $admin->table_head(sprintf($lang->string('Edit Status - %1$s (id: %2$s)'), $status['status'], $status['statusid']));
97 $admin->row_input($lang->string('Status Title<div><dfn>The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)</dfn></div>'), 'status', $status['status']);
98 $admin->row_input($lang->string('Display Order<div><dfn>The order in which the statuses ar displayed.</dfn></div>'), 'displayorder', $status['displayorder']);
99 $admin->row_input($lang->string('Status Colour<div><dfn>The colour of the status. This will be displayed on bug listings page to make viewing easier. Note: you must enter the # sign if you are using HEX values.</dfn></div>'), 'color', $status['color']);
100 $admin->row_submit();
101 $admin->table_end();
102 $admin->form_end();
103
104 $admin->page_end();
105 }
106
107 // ###################################################################
108
109 if ($_REQUEST['do'] == 'modify')
110 {
111 $admin->page_start($lang->string('Status Manager'));
112
113 $statuses = $db->query("SELECT * FROM " . TABLE_PREFIX . "status");
114
115 $admin->form_start('status.php', 'null');
116 $admin->table_start();
117 $admin->table_head($lang->string('Status Manager'));
118
119 while ($status = $db->fetch_array($statuses))
120 {
121 $colourblock = '<span style="float: right"><div style="height: 12px; width: 12px; background-color: ' . $status['color'] . '; border: 1px black solid"></div></span>';
122 $admin->row_text("$colourblock$status[displayorder]: <a href=\"status.php?do=edit&amp;statusid=$status[statusid]\">$status[status]</a>", "(statusid: $status[statusid]) <a href=\"status.php?do=edit&amp;statusid=$status[statusid]\">[" . $lang->string('Edit') . "]</a> <a href=\"status.php?do=delete&amp;statusid=$status[statusid]\">[" . $lang->string('Delete') . "]</a>");
123 }
124 $db->free_result($statuses);
125
126 $admin->row_span('<a href="status.php?do=add">[' . $lang->string('Add New Status') . ']</a>', 'tfoot', 'center', 3);
127 $admin->table_end();
128 $admin->form_end();
129
130 $admin->page_end();
131 }
132
133 /*=====================================================================*\
134 || ###################################################################
135 || # $HeadURL$
136 || # $Id$
137 || ###################################################################
138 \*=====================================================================*/
139 ?>