[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> bug_actiongroup_page.php (source)

   1  <?php
   2  # Mantis - a php based bugtracking system
   3  
   4  # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
   5  # Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
   6  
   7  # Mantis 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, either version 2 of the License, or
  10  # (at your option) any later version.
  11  #
  12  # Mantis is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  #
  17  # You should have received a copy of the GNU General Public License
  18  # along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
  19  
  20      # --------------------------------------------------------
  21      # $Id: bug_actiongroup_page.php,v 1.55.2.1 2007-10-13 22:32:34 giallu Exp $
  22      # --------------------------------------------------------
  23  ?>
  24  <?php
  25      # This page allows actions to be performed on an array of bugs
  26  
  27      require_once ( 'core.php' );
  28  
  29      require_once( $t_core_path.'bug_group_action_api.php' );
  30  
  31      auth_ensure_user_authenticated();
  32  
  33      $f_action = gpc_get_string( 'action', '' );
  34      $f_bug_arr = gpc_get_int_array( 'bug_arr', array() );
  35  
  36      # redirects to all_bug_page if nothing is selected
  37      if ( is_blank( $f_action ) || ( 0 == sizeof( $f_bug_arr ) ) ) {
  38          print_header_redirect( 'view_all_bug_page.php' );
  39      }
  40  
  41      # run through the issues to see if they are all from one project
  42      $t_project_id = ALL_PROJECTS;
  43      $t_multiple_projects = false;
  44      foreach( $f_bug_arr as $t_bug_id ) {
  45          $t_bug = bug_get( $t_bug_id );
  46          if ( $t_project_id != $t_bug->project_id ) {
  47              if ( ( $t_project_id != ALL_PROJECTS ) && !$t_multiple_projects ) {
  48                  $t_multiple_projects = true;
  49              } else {
  50                  $t_project_id = $t_bug->project_id;
  51              }
  52          }
  53      }
  54      if ( $t_multiple_projects ) {
  55          $t_project_id = ALL_PROJECTS;
  56      }
  57      # override the project if necessary
  58      if( $t_project_id != helper_get_current_project() ) {
  59          # in case the current project is not the same project of the bug we are viewing...
  60          # ... override the current project. This to avoid problems with categories and handlers lists etc.
  61          $g_project_override = $t_project_id;
  62      }
  63  
  64      $t_finished = false;
  65      $t_request = '';
  66  
  67      $t_external_action_prefix = 'EXT_';
  68      if ( strpos( $f_action, $t_external_action_prefix ) === 0 ) {
  69          $t_form_page = 'bug_actiongroup_ext_page.php';
  70          require_once( $t_form_page );
  71          exit;
  72      }
  73  
  74      $t_custom_group_actions = config_get( 'custom_group_actions' );
  75      
  76      foreach( $t_custom_group_actions as $t_custom_group_action ) {
  77          if ( $f_action == $t_custom_group_action['action'] ) {
  78              require_once( $t_custom_group_action['form_page'] );
  79              exit;
  80          }
  81      }
  82  
  83      # Check if user selected to update a custom field.
  84      $t_custom_fields_prefix = 'custom_field_';
  85      if ( strpos( $f_action, $t_custom_fields_prefix ) === 0 ) {
  86          $t_custom_field_id = (int)substr( $f_action, strlen( $t_custom_fields_prefix ) );
  87          $f_action = 'CUSTOM';
  88      }
  89  
  90      switch ( $f_action )  {
  91          # Use a simple confirmation page, if close or delete...
  92          case 'CLOSE' :
  93              $t_finished             = true;
  94              $t_question_title         = lang_get( 'close_bugs_conf_msg' );
  95              $t_button_title         = lang_get( 'close_group_bugs_button' );
  96              break;
  97  
  98          case 'DELETE' :
  99              $t_finished             = true;
 100              $t_question_title        = lang_get( 'delete_bugs_conf_msg' );
 101              $t_button_title         = lang_get( 'delete_group_bugs_button' );
 102              break;
 103  
 104          case 'SET_STICKY' :
 105              $t_finished             = true;
 106              $t_question_title        = lang_get( 'set_sticky_bugs_conf_msg' );
 107              $t_button_title         = lang_get( 'set_sticky_group_bugs_button' );
 108              break;
 109  
 110          # ...else we define the variables used in the form
 111          case 'MOVE' :
 112              $t_question_title         = lang_get( 'move_bugs_conf_msg' );
 113              $t_button_title         = lang_get( 'move_group_bugs_button' );
 114              $t_form                    = 'project_id';
 115              break;
 116  
 117          case 'COPY' :
 118              $t_question_title         = lang_get( 'copy_bugs_conf_msg' );
 119              $t_button_title         = lang_get( 'copy_group_bugs_button' );
 120              $t_form                    = 'project_id';
 121              break;
 122  
 123          case 'ASSIGN' :
 124              $t_question_title         = lang_get( 'assign_bugs_conf_msg' );
 125              $t_button_title         = lang_get( 'assign_group_bugs_button' );
 126              $t_form                 = 'assign';
 127              break;
 128  
 129          case 'RESOLVE' :
 130              $t_question_title         = lang_get( 'resolve_bugs_conf_msg' );
 131              $t_button_title         = lang_get( 'resolve_group_bugs_button' );
 132              $t_form                 = 'resolution';
 133              $t_request                 = 'resolution'; # the "request" vars allow to display the adequate list
 134              if ( ALL_PROJECTS != $t_project_id ) {
 135                  $t_question_title2 = lang_get( 'fixed_in_version' );
 136                  $t_form2 = 'fixed_in_version';
 137              }
 138              break;
 139  
 140          case 'UP_PRIOR' :
 141              $t_question_title         = lang_get( 'priority_bugs_conf_msg' );
 142              $t_button_title         = lang_get( 'priority_group_bugs_button' );
 143              $t_form                 = 'priority';
 144              $t_request                 = 'priority';
 145              break;
 146  
 147          case 'UP_STATUS' :
 148              $t_question_title         = lang_get( 'status_bugs_conf_msg' );
 149              $t_button_title         = lang_get( 'status_group_bugs_button' );
 150              $t_form                 = 'status';
 151              $t_request                 = 'status';
 152              break;
 153  
 154          case 'UP_CATEGORY' :
 155              $t_question_title        = lang_get( 'category_bugs_conf_msg' );
 156              $t_button_title            = lang_get( 'category_group_bugs_button' );
 157              $t_form                    = 'category';
 158              $t_request                = 'category';
 159              break;
 160  
 161          case 'VIEW_STATUS' :
 162              $t_question_title        = lang_get( 'view_status_bugs_conf_msg' );
 163              $t_button_title            = lang_get( 'view_status_group_bugs_button' );
 164              $t_form                = 'view_status';
 165              $t_request            = 'view_status';
 166              break;
 167          
 168          case 'UP_FIXED_IN_VERSION':
 169              $t_question_title        = lang_get( 'fixed_in_version_bugs_conf_msg' );
 170              $t_button_title            = lang_get( 'fixed_in_version_group_bugs_button' );
 171              $t_form                    = 'fixed_in_version';
 172              $t_request                = 'fixed_in_version';
 173              break;
 174  
 175          case 'UP_TARGET_VERSION':
 176              $t_question_title        = lang_get( 'target_version_bugs_conf_msg' );
 177              $t_button_title            = lang_get( 'target_version_group_bugs_button' );
 178              $t_form                    = 'target_version';
 179              $t_request                = 'target_version';
 180              break;
 181  
 182          case 'CUSTOM' :
 183              $t_custom_field_def = custom_field_get_definition( $t_custom_field_id );
 184              $t_question_title = sprintf( lang_get( 'actiongroup_menu_update_field' ), lang_get_defaulted( $t_custom_field_def['name'] ) );
 185              $t_button_title = $t_question_title;
 186              $t_form = "custom_field_$t_custom_field_id";
 187              break;
 188  
 189          default:
 190              trigger_error( ERROR_GENERIC, ERROR );
 191      }
 192  
 193      bug_group_action_print_top();
 194      
 195      if ( $t_multiple_projects ) {
 196          echo '<p class="bold">' . lang_get( 'multiple_projects' ) . '</p>';
 197      }
 198  ?>
 199  
 200  <br />
 201  
 202  <div align="center">
 203  <form method="post" action="bug_actiongroup.php">
 204  <input type="hidden" name="action" value="<?php echo string_attribute( $f_action ) ?>" />
 205  <?php
 206      bug_group_action_print_hidden_fields( $f_bug_arr );
 207  
 208      if ( $f_action === 'CUSTOM' ) {
 209          echo "<input type=\"hidden\" name=\"custom_field_id\" value=\"$t_custom_field_id\" />";
 210      }
 211  ?>
 212  <table class="width75" cellspacing="1">
 213  <?php
 214  if ( !$t_finished ) {
 215  ?>
 216  <tr class="row-1">
 217      <td class="category">
 218          <?php echo $t_question_title ?>
 219      </td>
 220      <td>
 221      <?php
 222          if ( $f_action === 'CUSTOM' ) {
 223              $t_custom_field_def = custom_field_get_definition( $t_custom_field_id );
 224  
 225              $t_bug_id = null;
 226  
 227              # if there is only one issue, use its current value as default, otherwise,
 228              # use the default value specified in custom field definition.
 229              if ( sizeof( $f_bug_arr ) == 1 ) {
 230                  $t_bug_id = $f_bug_arr[0];
 231              }
 232  
 233              print_custom_field_input( $t_custom_field_def, $t_bug_id );
 234          } else {
 235              echo "<select name=\"$t_form\">";
 236  
 237              switch ( $f_action ) {
 238                  case 'COPY':
 239                  case 'MOVE':
 240                      print_project_option_list( null, false );
 241                      break;
 242                  case 'ASSIGN':
 243                      print_assign_to_option_list( 0, $t_project_id );
 244                      break;
 245                  case 'VIEW_STATUS':
 246                      print_enum_string_option_list( 'view_state', config_get( 'default_bug_view_status' ) );
 247                      break;
 248                  case 'UP_CATEGORY':
 249                      print_category_option_list();
 250                      break;
 251                  case 'UP_TARGET_VERSION':
 252                  case 'UP_FIXED_IN_VERSION':
 253                      print_version_option_list( '', $t_project_id, VERSION_ALL );
 254                      break;
 255              }
 256  
 257              # other forms use the same function to display the list
 258              if ( $t_request > '' ) {
 259                  print_enum_string_option_list( $t_request, FIXED );
 260              }
 261  
 262              echo '</select>';
 263          }
 264          ?>
 265      </td>
 266  </tr>
 267      <?php
 268      if ( isset( $t_question_title2 ) ) {
 269          switch ( $f_action ) {
 270              case 'RESOLVE':
 271                  $t_show_version = ( ON == config_get( 'show_product_version' ) )
 272                      || ( ( AUTO == config_get( 'show_product_version' ) )
 273                                  && ( count( version_get_all_rows( $t_project_id ) ) > 0 ) );
 274                  if ( $t_show_version ) {
 275      ?>
 276          <tr class="row-2">
 277              <td class="category">
 278                  <?php echo $t_question_title2 ?>
 279              </td>
 280              <td>
 281                  <select name="<?php echo $t_form2 ?>">
 282                      <?php print_version_option_list( '', null, VERSION_ALL );?>
 283                  </select>
 284              </td>
 285          </tr>
 286      <?php
 287                  }
 288                  break;
 289          }
 290      }
 291      ?>
 292  <?php
 293  } else {
 294  ?>
 295  
 296  <tr class="row-1">
 297      <td class="category" colspan="2">
 298          <?php echo $t_question_title; ?>
 299      </td>
 300  </tr>
 301  <?php
 302  }
 303  ?>
 304  
 305  <tr>
 306      <td class="center" colspan="2">
 307          <input type="submit" class="button" value="<?php echo $t_button_title ?>" />
 308      </td>
 309  </tr>
 310  </table>
 311  <br />
 312  
 313  <?php
 314      bug_group_action_print_bug_list( $f_bug_arr );
 315  ?>
 316  </form>
 317  </div>
 318  
 319  <?php
 320      bug_group_action_print_bottom();
 321  ?>


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics