2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
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 require_once('./includes/class_api_error.php');
26 APIError(array(new API_Error_Handler($admin), 'admin_error'));
28 NavLinks
::fieldsPages();
29 $navigator->set_focus('tab', 'fields', null
);
31 if (!can_perform('canadminfields'))
36 // ###################################################################
38 if (empty($_REQUEST['do']))
40 $_REQUEST['do'] = 'modify';
43 // ###################################################################
45 if ($_REQUEST['do'] == 'kill')
47 $resolution = new ResolutionAPI($bugsys);
48 $resolution->set('resolutionid', $bugsys->in
['resolutionid']);
49 $resolution->set_condition();
50 $resolution->delete();
52 $admin->redirect('resolution.php?do=modify');
55 // ###################################################################
57 if ($_REQUEST['do'] == 'delete')
59 $admin->page_confirm(_('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', 'kill', array('resolutionid' => $bugsys->input_clean('resolutionid', TYPE_UINT
)));
62 // ###################################################################
64 if ($_POST['do'] == 'insert')
66 $resolution = new ResolutionAPI($bugsys);
67 $resolution->set('resolution', $bugsys->in
['resolution']);
68 $resolution->set('displayorder', $bugsys->in
['displayorder']);
69 $resolution->insert();
71 $admin->redirect('resolution.php?do=modify');
74 // ###################################################################
76 if ($_REQUEST['do'] == 'add')
78 NavLinks
::resolutionsAdd();
79 $navigator->set_focus('link', 'resolutions-add', 'resolutions');
81 $admin->page_start(_('Add New Resolution'));
83 $admin->form_start('resolution.php', 'insert');
84 $admin->table_start();
85 $admin->table_head(_('New Resolution'));
86 $admin->row_input(_('Resolution Title<div><dfn>The title of this resolution flag (eg: `Fixed` or `Bogus`)</dfn></div>'), 'resolution');
87 $admin->row_input(_('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');
95 // ###################################################################
97 if ($_POST['do'] == 'update')
99 $resolution = new ResolutionAPI($bugsys);
100 $resolution->set('resolutionid', $bugsys->in
['resolutionid']);
101 $resolution->set_condition();
102 $resolution->set('resolution', $bugsys->in
['resolution']);
103 $resolution->set('displayorder', $bugsys->in
['displayorder']);
104 $resolution->update();
106 $admin->redirect('resolution.php?do=modify');
109 // ###################################################################
111 if ($_REQUEST['do'] == 'edit')
113 NavLinks
::resolutionsEdit($bugsys->in
['resolutionid']);
114 $navigator->set_focus('link', 'fields-pages-resolutions', 'fields-pages');
116 $resolution = new ResolutionAPI($bugsys);
117 $resolution->set('resolutionid', $bugsys->in
['resolutionid']);
118 $resolution->set_condition();
119 $resolution->fetch();
121 $admin->page_start(_('Edit Resolution'));
123 $admin->form_start('resolution.php', 'update');
124 $admin->form_hidden_field('resolutionid', $resolution->objdata
['resolutionid']);
125 $admin->table_start();
126 $admin->table_head(sprintf(_('Edit Resolution - %1$s (id: %2$s)'), $resolution->objdata
['resolution'], $resolution->objdata
['resolutionid']));
127 $admin->row_input(_('Resolution Title<div><dfn>The title of this resolution flag (eg: `Fixed` or `Bogus`)</dfn></div>'), 'resolution', $resolution->objdata
['resolution']);
128 $admin->row_input(_('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']);
129 $admin->row_submit();
136 // ###################################################################
138 if ($_REQUEST['do'] == 'modify')
140 NavLinks
::resolutionsAdd();
141 $navigator->set_focus('link', 'fields-pages-resolutions', 'fields-pages');
143 $admin->page_start(_('Resolution Manager'));
145 $resolutions = $db->query("SELECT * FROM " . TABLE_PREFIX
. "resolution ORDER BY displayorder");
147 $admin->form_start('resolution.php', 'null');
148 $admin->table_start();
149 $admin->table_head(_('Resolution Manager'));
151 while ($resolution = $db->fetch_array($resolutions))
153 $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]\">[" . _('Edit') . "]</a> <a href=\"resolution.php?do=delete&resolutionid=$resolution[resolutionid]\">[" . _('Delete') . "]</a>");
155 $db->free_result($resolutions);
163 /*=====================================================================*\
164 || ###################################################################
167 || ###################################################################
168 \*=====================================================================*/