]>
src.bluestatic.org Git - bugdar.git/blob - admin/priority.php
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/functions_datastore.php' );
25 if (! can_perform ( 'canadminfields' ))
30 // ###################################################################
32 if ( empty ( $_REQUEST [ 'do' ]))
34 $_REQUEST [ 'do' ] = 'modify' ;
37 // ###################################################################
39 if ( $_REQUEST [ 'do' ] == 'kill' )
41 $db- > query ( "DELETE FROM " . TABLE_PREFIX
. "priority WHERE priorityid = " . intval ( $bugsys- > in
[ 'priorityid' ]));
43 $admin- > redirect ( 'priority.php?do=modify' );
46 // ###################################################################
48 if ( $_REQUEST [ 'do' ] == 'delete' )
50 $admin- > page_confirm ( $lang- > string ( 'Are you sure you want to delete this priority? Doing so will revert all bugs to the default priority (which is set in the options panel)?' ), 'priority.php?do=kill&priorityid=' . intval ( $bugsys- > in
[ 'priorityid' ]));
53 // ###################################################################
55 if ( $_POST [ 'do' ] == 'insert' )
57 $db- > query ( "INSERT INTO " . TABLE_PREFIX
. "priority (priority, displayorder) VALUES ('" . $bugsys- > in
[ 'priority' ] . "'," . intval ( $bugsys- > in
[ 'displayorder' ]) . ")" );
59 $admin- > redirect ( 'priority.php?do=modify' );
62 // ###################################################################
64 if ( $_REQUEST [ 'do' ] == 'add' )
66 $admin- > page_start ( $lang- > string ( 'Add New Priority' ));
68 $admin- > form_start ( 'priority.php' , 'insert' );
69 $admin- > table_start ();
70 $admin- > table_head ( $lang- > string ( 'New Priority' ), 2 , 'standard_bug_fields' );
71 $admin- > row_input ( $lang- > string ( 'Priority Title<div><dfn>The title of this priority flag (eg: `Slated for Development` or `Address Now`)</dfn></div>' ), 'priority' );
72 $admin- > row_input ( $lang- > string ( 'Display Order<div><dfn>The order in which the priorities are displayed. The higher the number, the lower down in the list it is.</dfn></div>' ), 'displayorder' );
80 // ###################################################################
82 if ( $_POST [ 'do' ] == 'update' )
84 $db- > query ( "UPDATE " . TABLE_PREFIX
. "priority SET priority = '" . $bugsys- > in
[ 'priority' ] . "', displayorder = " . intval ( $bugsys- > in
[ 'displayorder' ]) . " WHERE priorityid = " . intval ( $bugsys- > in
[ 'priorityid' ]));
86 $admin- > redirect ( 'priority.php?do=modify' );
89 // ###################################################################
91 if ( $_REQUEST [ 'do' ] == 'edit' )
93 $priority = $db- > query_first ( "SELECT * FROM " . TABLE_PREFIX
. "priority WHERE priorityid = " . intval ( $bugsys- > in
[ 'priorityid' ]));
94 if (! is_array ( $priority ))
96 $admin- > error ( $lang- > getlex ( 'error_invalid_id' ));
99 $admin- > page_start ( $lang- > string ( 'Edit Priority' ), 2 , 'standard_bug_fields' );
101 $admin- > form_start ( 'priority.php' , 'update' );
102 $admin- > form_hidden_field ( 'priorityid' , $priority [ 'priorityid' ]);
103 $admin- > table_start ();
104 $admin- > table_head ( sprintf ( $lang- > string ( 'Edit Priority `%1 $s ` (id: %2 $s )' ), $priority [ 'priority' ], $priority [ 'priorityid' ]));
105 $admin- > row_input ( $lang- > string ( 'Priority Title<div><dfn>The title of this priority flag (eg: `Slated for Development` or `Address Now`)</dfn></div>' ), 'priority' , $priority [ 'priority' ]);
106 $admin- > row_input ( $lang- > string ( 'Display Order<div><dfn>The order in which the priorities are displayed. The higher the number, the lower down in the list it is.</dfn></div>' ), 'displayorder' , $priority [ 'displayorder' ]);
107 $admin- > row_submit ();
114 // ###################################################################
116 if ( $_REQUEST [ 'do' ] == 'modify' )
118 $admin- > page_start ( $lang- > string ( 'Priority Manager' ));
120 $priorities = $db- > query ( "SELECT * FROM " . TABLE_PREFIX
. "priority ORDER BY displayorder" );
122 $admin- > form_start ( 'priority.php' , 'null' );
123 $admin- > table_start ();
124 $admin- > table_head ( $lang- > string ( 'Priority Manager' ), 2 , 'standard_bug_fields' );
126 while ( $priority = $db- > fetch_array ( $priorities ))
128 $admin- > row_text ( " $priority [displayorder]: <a href= \" priority.php?do=edit&priorityid= $priority [priorityid] \" > $priority [priority]</a>" , "(priorityid: $priority [priorityid]) <a href= \" priority.php?do=edit&priorityid= $priority [priorityid] \" >[" . $lang- > string ( 'Edit' ) . "]</a> <a href= \" priority.php?do=delete&priorityid= $priority [priorityid] \" >[" . $lang- > string ( 'Delete' ) . "]</a>" );
130 $db- > free_result ( $priorityes );
132 $admin- > row_span ( '<a href="priority.php?do=add">[' . $lang- > string ( 'Add New Priority' ) . ']</a>' , 'tfoot' , 'center' , 3 );
139 /*=====================================================================*\
140 || ###################################################################
143 || ###################################################################
144 \*=====================================================================*/