]>
src.bluestatic.org Git - bugdar.git/blob - admin/priority.php
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_priority.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 $priority = new PriorityAPI ();
48 $priority- > set ( 'priorityid' , $input- > in
[ 'priorityid' ]);
49 $priority- > set_condition ();
52 $admin- > redirect ( 'priority.php?do=modify' );
55 // ###################################################################
57 if ( $_REQUEST [ 'do' ] == 'delete' )
59 $admin- > page_confirm ( T ( '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' , 'kill' , array ( 'priorityid' => $input- > inputClean ( 'priorityid' , TYPE_UINT
)));
62 // ###################################################################
64 if ( $_POST [ 'do' ] == 'insert' )
66 $priority = new PriorityAPI ();
67 $priority- > set ( 'priority' , $input- > in
[ 'priority' ]);
68 $priority- > set ( 'displayorder' , $input- > in
[ 'displayorder' ]);
71 $admin- > redirect ( 'priority.php?do=modify' );
74 // ###################################################################
76 if ( $_REQUEST [ 'do' ] == 'add' )
78 NavLinks
:: prioritiesAdd ();
79 $navigator- > set_focus ( 'link' , 'priorities-add' , 'priorities' );
81 $admin- > page_start ( T ( 'Add New Priority' ));
83 $admin- > form_start ( 'priority.php' , 'insert' );
84 $admin- > table_start ();
85 $admin- > table_head ( T ( 'New Priority' ));
86 $admin- > row_input ( T ( 'Priority Title<div><dfn>The title of this priority flag (eg: `Slated for Development` or `Address Now`)</dfn></div>' ), 'priority' );
87 $admin- > row_input ( T ( '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' );
95 // ###################################################################
97 if ( $_POST [ 'do' ] == 'update' )
99 $priority = new PriorityAPI ();
100 $priority- > set ( 'priorityid' , $input- > in
[ 'priorityid' ]);
101 $priority- > set_condition ();
102 $priority- > set ( 'priority' , $input- > in
[ 'priority' ]);
103 $priority- > set ( 'displayorder' , $input- > in
[ 'displayorder' ]);
106 $admin- > redirect ( 'priority.php?do=modify' );
109 // ###################################################################
111 if ( $_REQUEST [ 'do' ] == 'edit' )
113 NavLinks
:: prioritiesEdit ( $input- > in
[ 'priorityid' ]);
114 $navigator- > set_focus ( 'link' , 'fields-pages-priorities' , 'fields-pages' );
116 $priority = new PriorityAPI ();
117 $priority- > set ( 'priorityid' , $input- > in
[ 'priorityid' ]);
118 $priority- > set_condition ();
121 $admin- > page_start ( T ( 'Edit Priority' ));
123 $admin- > form_start ( 'priority.php' , 'update' );
124 $admin- > form_hidden_field ( 'priorityid' , $priority- > record
[ 'priorityid' ]);
125 $admin- > table_start ();
126 $admin- > table_head ( sprintf ( T ( 'Edit Priority `%1 $s ` (id: %2 $s )' ), $priority- > record
[ 'priority' ], $priority- > record
[ 'priorityid' ]));
127 $admin- > row_input ( T ( 'Priority Title<div><dfn>The title of this priority flag (eg: `Slated for Development` or `Address Now`)</dfn></div>' ), 'priority' , $priority- > record
[ 'priority' ]);
128 $admin- > row_input ( T ( '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- > record
[ 'displayorder' ]);
129 $admin- > row_submit ();
136 // ###################################################################
138 if ( $_REQUEST [ 'do' ] == 'modify' )
140 NavLinks
:: prioritiesAdd ();
141 $navigator- > set_focus ( 'link' , 'fields-pages-priorities' , 'fields-pages' );
143 $admin- > page_start ( T ( 'Priority Manager' ));
145 $priorities = $db- > query ( "SELECT * FROM " . TABLE_PREFIX
. "priority ORDER BY displayorder" );
147 $admin- > form_start ( 'priority.php' , 'null' );
148 $admin- > table_start ();
149 $admin- > table_head ( T ( 'Priority Manager' ));
151 foreach ( $priorities as $priority )
153 $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] \" >[" . T ( 'Edit' ) . "]</a> <a href= \" priority.php?do=delete&priorityid= $priority [priorityid] \" >[" . T ( 'Delete' ) . "]</a>" );
155 $db- > free_result ( $priorities );
163 /*=====================================================================*\
164 || ###################################################################
167 || ###################################################################
168 \*=====================================================================*/