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/api_resolution.php');
25 if (!can_perform('canadminfields'))
30 // ###################################################################
32 if (empty($_REQUEST['do']))
34 $_REQUEST['do'] = 'modify';
37 // ###################################################################
39 if ($_REQUEST['do'] == 'kill')
41 $resolution = new ResolutionAPI($bugsys);
42 $resolution->set('resolutionid', $bugsys->in
['resolutionid']);
43 $resolution->set_condition();
44 $resolution->delete();
46 $admin->redirect('resolution.php?do=modify');
49 // ###################################################################
51 if ($_REQUEST['do'] == 'delete')
53 $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
));
56 // ###################################################################
58 if ($_POST['do'] == 'insert')
60 $resolution = new ResolutionAPI($bugsys);
61 $resolution->set('resolution', $bugsys->in
['resolution']);
62 $resolution->set('displayorder', $bugsys->in
['displayorder']);
63 $resolution->insert();
65 $admin->redirect('resolution.php?do=modify');
68 // ###################################################################
70 if ($_REQUEST['do'] == 'add')
72 $admin->page_start($lang->string('Add New Resolution'));
74 $admin->form_start('resolution.php', 'insert');
75 $admin->table_start();
76 $admin->table_head($lang->string('New Resolution'), 2, 'standard_bug_fields');
77 $admin->row_input($lang->string('Resolution Title<div><dfn>The title of this resolution flag (eg: `Fixed` or `Bogus`)</dfn></div>'), 'resolution');
78 $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');
86 // ###################################################################
88 if ($_POST['do'] == 'update')
90 $resolution = new ResolutionAPI($bugsys);
91 $resolution->set('resolutionid', $bugsys->in
['resolutionid']);
92 $resolution->set_condition();
93 $resolution->set('resolution', $bugsys->in
['resolution']);
94 $resolution->set('displayorder', $bugsys->in
['displayorder']);
95 $resolution->update();
97 $admin->redirect('resolution.php?do=modify');
100 // ###################################################################
102 if ($_REQUEST['do'] == 'edit')
104 $resolution = new ResolutionAPI($bugsys);
105 $resolution->set('resolutionid', $bugsys->in
['resolutionid']);
106 $resolution->set_condition();
107 $resolution->fetch();
109 $admin->page_start($lang->string('Edit Resolution'), 2, 'standard_bug_fields');
111 $admin->form_start('resolution.php', 'update');
112 $admin->form_hidden_field('resolutionid', $resolution->objdata
['resolutionid']);
113 $admin->table_start();
114 $admin->table_head(sprintf($lang->string('Edit Resolution - %1$s (id: %2$s)'), $resolution->objdata
['resolution'], $resolution->objdata
['resolutionid']));
115 $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']);
116 $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']);
117 $admin->row_submit();
124 // ###################################################################
126 if ($_REQUEST['do'] == 'modify')
128 $admin->page_start($lang->string('Resolution Manager'));
130 $resolutions = $db->query("SELECT * FROM " . TABLE_PREFIX
. "resolution ORDER BY displayorder");
132 $admin->form_start('resolution.php', 'null');
133 $admin->table_start();
134 $admin->table_head($lang->string('Resolution Manager'), 2, 'standard_bug_fields');
136 while ($resolution = $db->fetch_array($resolutions))
138 $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>");
140 $db->free_result($resolutiones);
142 $admin->row_span('<a href="resolution.php?do=add">[' . $lang->string('Add New Resolution') . ']</a>', 'tfoot', 'center', 3);
149 /*=====================================================================*\
150 || ###################################################################
153 || ###################################################################
154 \*=====================================================================*/