]>
src.bluestatic.org Git - bugdar.git/blob - admin/severity.php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 require_once ( './global.php' );
14 require_once ( './includes/functions_datastore.php' );
16 if (! can_perform ( 'canadminfields' ))
21 // ###################################################################
23 if ( empty ( $_REQUEST [ 'do' ]))
25 $_REQUEST [ 'do' ] = 'modify' ;
28 // ###################################################################
30 if ( $_REQUEST [ 'do' ] == 'kill' )
32 $db- > query ( "DELETE FROM " . TABLE_PREFIX
. "severity WHERE severityid = " . intval ( $bugsys- > in
[ 'serverityid' ]));
34 $admin- > redirect ( 'severity.php?do=modify' );
37 // ###################################################################
39 if ( $_REQUEST [ 'do' ] == 'delete' )
41 $admin- > page_confirm ( $lang- > string ( '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?do=kill&severityid=' . intval ( $bugsys- > in
[ 'severityid' ]));
44 // ###################################################################
46 if ( $_POST [ 'do' ] == 'insert' )
48 $db- > query ( "INSERT INTO " . TABLE_PREFIX
. "severity (severity, displayorder) VALUES ('" . $bugsys- > in
[ 'severity' ] . "', " . intval ( $bugsys- > in
[ 'displayorder' ]) . ")" );
50 $admin- > redirect ( 'severity.php?do=modify' );
53 // ###################################################################
55 if ( $_REQUEST [ 'do' ] == 'add' )
57 $admin- > page_start ( $lang- > string ( 'Add New Severity' ));
59 $admin- > form_start ( 'severity.php' , 'insert' );
60 $admin- > table_start ();
61 $admin- > table_head ( $lang- > string ( 'New Severity' ));
62 $admin- > row_input ( $lang- > string ( 'Severity Title<div><dfn>The title of this severity flag (eg: `Major` or `Critical`)</dfn></div>' ), 'severity' );
63 $admin- > row_input ( $lang- > string ( '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' );
71 // ###################################################################
73 if ( $_POST [ 'do' ] == 'update' )
75 sanitize ( array ( 'severityid' => INT , 'severity' => STR
, 'displayorder' => INT ));
76 $db- > query ( "UPDATE " . TABLE_PREFIX
. "severity SET severity = '" . $bugsys- > in
[ 'severity' ] . "', displayorder = " . intval ( $bugsys- > in
[ 'displayorder' ]) . " WHERE severityid = " . intval ( $bugsys- > in
[ 'severityid' ]));
78 $admin- > redirect ( 'severity.php?do=modify' );
81 // ###################################################################
83 if ( $_REQUEST [ 'do' ] == 'edit' )
85 $severity = $db- > query_first ( "SELECT * FROM " . TABLE_PREFIX
. "severity WHERE severityid = " . intval ( $bugsys- > in
[ 'severityid' ]));
86 if (! is_array ( $severity ))
88 $admin- > error ( $lang- > getlex ( 'error_invalid_id' ));
91 $admin- > page_start ( $lang- > string ( 'Edit Severity' ));
93 $admin- > form_start ( 'severity.php' , 'update' );
94 $admin- > form_hidden_field ( 'severityid' , $severity [ 'severityid' ]);
95 $admin- > table_start ();
96 $admin- > table_head ( sprintf ( $lang- > string ( 'Edit Severity - %1 $s (id: %2 $s )' , $severity [ 'severity' ], $severity [ 'severityid' ])));
97 $admin- > row_input ( $lang- > string ( 'Severity Title<div><dfn>The title of this severity flag (eg: `Major` or `Critical`)</dfn></div>' ), 'severity' , $severity [ 'severity' ]);
98 $admin- > row_input ( $lang- > string ( '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 [ 'displayorder' ]);
106 // ###################################################################
108 if ( $_REQUEST [ 'do' ] == 'modify' )
110 $admin- > page_start ( $lang- > string ( 'Severity Manager' ));
112 $severities = $db- > query ( "SELECT * FROM " . TABLE_PREFIX
. "severity ORDER BY displayorder" );
114 $admin- > form_start ( 'severity.php' , 'null' );
115 $admin- > table_start ();
116 $admin- > table_head ( $lang- > string ( 'Severity Manager' ));
118 while ( $severity = $db- > fetch_array ( $severities ))
120 $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] \" >[" . $lang- > string ( 'Edit' ) . "]</a> <a href= \" severity.php?do=delete&severityid= $severity [severityid] \" >[" . $lang- > string ( 'Delete' ) . "]</a>" );
122 $db- > free_result ( $severityes );
124 $admin- > row_span ( '<a href="severity.php?do=add">[' . $lang- > string ( 'Add New Severity' ) . ']</a>' , 'tfoot' , 'center' , 3 );
131 /*=====================================================================*\
132 || ###################################################################
135 || ###################################################################
136 \*=====================================================================*/