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