6eebab523496808314cd2fcfc1a723ca9cc5e243
2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright ©2002-2007 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 2 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 APIError(array(new API_Error_Handler($admin), 'admin_error'));
27 NavLinks
::fieldsPages();
28 $navigator->set_focus('tab', 'fields', null
);
30 if (!can_perform('canadminfields'))
35 // ###################################################################
37 if (empty($_REQUEST['do']))
39 $_REQUEST['do'] = 'modify';
42 // ###################################################################
44 if ($_REQUEST['do'] == 'kill')
46 $resolution = new ResolutionAPI();
47 $resolution->set('resolutionid', $input->in
['resolutionid']);
48 $resolution->set_condition();
49 $resolution->delete();
51 $admin->redirect('resolution.php?do=modify');
54 // ###################################################################
56 if ($_REQUEST['do'] == 'delete')
58 $admin->page_confirm(T('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' => $input->inputClean('resolutionid', TYPE_UINT
)));
61 // ###################################################################
63 if ($_POST['do'] == 'insert')
65 $resolution = new ResolutionAPI();
66 $resolution->set('resolution', $input->in
['resolution']);
67 $resolution->set('displayorder', $input->in
['displayorder']);
68 $resolution->insert();
70 $admin->redirect('resolution.php?do=modify');
73 // ###################################################################
75 if ($_REQUEST['do'] == 'add')
77 NavLinks
::resolutionsAdd();
78 $navigator->set_focus('link', 'resolutions-add', 'resolutions');
80 $admin->page_start(T('Add New Resolution'));
82 $admin->form_start('resolution.php', 'insert');
83 $admin->table_start();
84 $admin->table_head(T('New Resolution'));
85 $admin->row_input(T('Resolution Title<div><dfn>The title of this resolution flag (eg: `Fixed` or `Bogus`)</dfn></div>'), 'resolution');
86 $admin->row_input(T('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');
94 // ###################################################################
96 if ($_POST['do'] == 'update')
98 $resolution = new ResolutionAPI();
99 $resolution->set('resolutionid', $input->in
['resolutionid']);
100 $resolution->set_condition();
101 $resolution->set('resolution', $input->in
['resolution']);
102 $resolution->set('displayorder', $input->in
['displayorder']);
103 $resolution->update();
105 $admin->redirect('resolution.php?do=modify');
108 // ###################################################################
110 if ($_REQUEST['do'] == 'edit')
112 NavLinks
::resolutionsEdit($input->in
['resolutionid']);
113 $navigator->set_focus('link', 'fields-pages-resolutions', 'fields-pages');
115 $resolution = new ResolutionAPI();
116 $resolution->set('resolutionid', $input->in
['resolutionid']);
117 $resolution->set_condition();
118 $resolution->fetch();
120 $admin->page_start(T('Edit Resolution'));
122 $admin->form_start('resolution.php', 'update');
123 $admin->form_hidden_field('resolutionid', $resolution->record
['resolutionid']);
124 $admin->table_start();
125 $admin->table_head(sprintf(T('Edit Resolution - %1$s (id: %2$s)'), $resolution->record
['resolution'], $resolution->record
['resolutionid']));
126 $admin->row_input(T('Resolution Title<div><dfn>The title of this resolution flag (eg: `Fixed` or `Bogus`)</dfn></div>'), 'resolution', $resolution->record
['resolution']);
127 $admin->row_input(T('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->record
['displayorder']);
128 $admin->row_submit();
135 // ###################################################################
137 if ($_REQUEST['do'] == 'modify')
139 NavLinks
::resolutionsAdd();
140 $navigator->set_focus('link', 'fields-pages-resolutions', 'fields-pages');
142 $admin->page_start(T('Resolution Manager'));
144 $resolutions = $db->query("SELECT * FROM " . TABLE_PREFIX
. "resolution ORDER BY displayorder");
146 $admin->form_start('resolution.php', 'null');
147 $admin->table_start();
148 $admin->table_head(T('Resolution Manager'));
150 foreach ($resolutions as $resolution)
152 $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]\">[" . T('Edit') . "]</a> <a href=\"resolution.php?do=delete&resolutionid=$resolution[resolutionid]\">[" . T('Delete') . "]</a>");
154 $db->free_result($resolutions);
162 /*=====================================================================*\
163 || ###################################################################
166 || ###################################################################
167 \*=====================================================================*/