]>
src.bluestatic.org Git - bugdar.git/blob - admin/severity.php
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_severity.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 $severity = new SeverityAPI ( $bugsys );
48 $severity- > set ( 'severityid' , $bugsys- > in
[ 'severityid' ]);
49 $severity- > set_condition ();
52 $admin- > redirect ( 'severity.php?do=modify' );
55 // ###################################################################
57 if ( $_REQUEST [ 'do' ] == 'delete' )
59 $admin- > page_confirm ( _ ( 'Are you sure you want to delete this severity? Doing so will revert all bugs to the default severity (which is set in the options panel)?' ), 'severity.php' , 'kill' , array ( 'severityid' => $bugsys- > input_clean ( 'severityid' , TYPE_UINT
)));
62 // ###################################################################
64 if ( $_POST [ 'do' ] == 'insert' )
66 $severity = new SeverityAPI ( $bugsys );
67 $severity- > set ( 'severity' , $bugsys- > in
[ 'severity' ]);
68 $severity- > set ( 'displayorder' , $bugsys- > in
[ 'displayorder' ]);
71 $admin- > redirect ( 'severity.php?do=modify' );
74 // ###################################################################
76 if ( $_REQUEST [ 'do' ] == 'add' )
78 NavLinks
:: severitiesAdd ();
79 $navigator- > set_focus ( 'link' , 'severities-add' , 'severities' );
81 $admin- > page_start ( _ ( 'Add New Severity' ));
83 $admin- > form_start ( 'severity.php' , 'insert' );
84 $admin- > table_start ();
85 $admin- > table_head ( _ ( 'New Severity' ));
86 $admin- > row_input ( _ ( 'Severity Title<div><dfn>The title of this severity flag (eg: `Major` or `Critical`)</dfn></div>' ), 'severity' );
87 $admin- > row_input ( _ ( 'Display Order<div><dfn>The order in which the severities are displayed. The higher the number, the lower down in the list it is.</dfn></div>' ), 'displayorder' );
95 // ###################################################################
97 if ( $_POST [ 'do' ] == 'update' )
99 $severity = new SeverityAPI ( $bugsys );
100 $severity- > set ( 'severityid' , $bugsys- > in
[ 'severityid' ]);
101 $severity- > set_condition ();
102 $severity- > set ( 'severity' , $bugsys- > in
[ 'severity' ]);
103 $severity- > set ( 'displayorder' , $bugsys- > in
[ 'displayorder' ]);
106 $admin- > redirect ( 'severity.php?do=modify' );
109 // ###################################################################
111 if ( $_REQUEST [ 'do' ] == 'edit' )
113 NavLinks
:: severitiesEdit ( $bugsys- > in
[ 'severityid' ]);
114 $navigator- > set_focus ( 'link' , 'fields-pages-severities' , 'fields-pages' );
116 $severity = new SeverityAPI ( $bugsys );
117 $severity- > set ( 'severityid' , $bugsys- > in
[ 'severityid' ]);
118 $severity- > set_condition ();
121 $admin- > page_start ( _ ( 'Edit Severity' ));
123 $admin- > form_start ( 'severity.php' , 'update' );
124 $admin- > form_hidden_field ( 'severityid' , $severity- > objdata
[ 'severityid' ]);
125 $admin- > table_start ();
126 $admin- > table_head ( sprintf ( _ ( 'Edit Severity - %1 $s (id: %2 $s )' ), $severity- > objdata
[ 'severity' ], $severity- > objdata
[ 'severityid' ]));
127 $admin- > row_input ( _ ( 'Severity Title<div><dfn>The title of this severity flag (eg: `Major` or `Critical`)</dfn></div>' ), 'severity' , $severity- > objdata
[ 'severity' ]);
128 $admin- > row_input ( _ ( 'Display Order<div><dfn>The order in which the severities are displayed. The higher the number, the lower down in the list it is.</dfn></div>' ), 'displayorder' , $severity- > objdata
[ 'displayorder' ]);
129 $admin- > row_submit ();
136 // ###################################################################
138 if ( $_REQUEST [ 'do' ] == 'modify' )
140 NavLinks
:: severitiesAdd ();
141 $navigator- > set_focus ( 'link' , 'fields-pages-severities' , 'fields-pages' );
143 $admin- > page_start ( _ ( 'Severity Manager' ));
145 $severities = $db- > query ( "SELECT * FROM " . TABLE_PREFIX
. "severity ORDER BY displayorder" );
147 $admin- > form_start ( 'severity.php' , 'null' );
148 $admin- > table_start ();
149 $admin- > table_head ( _ ( 'Severity Manager' ));
151 while ( $severity = $db- > fetch_array ( $severities ))
153 $admin- > row_text ( " $severity [displayorder]: <a href= \" severity.php?do=edit&severityid= $severity [severityid] \" > $severity [severity]</a>" , "(severityid: $severity [severityid]) <a href= \" severity.php?do=edit&severityid= $severity [severityid] \" >[" . _ ( 'Edit' ) . "]</a> <a href= \" severity.php?do=delete&severityid= $severity [severityid] \" >[" . _ ( 'Delete' ) . "]</a>" );
155 $db- > free_result ( $severities );
163 /*=====================================================================*\
164 || ###################################################################
167 || ###################################################################
168 \*=====================================================================*/