[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> manage_config_work_threshold_set.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: manage_config_work_threshold_set.php,v 1.10.2.1 2007-10-13 22:33:25 giallu Exp $
  22      # --------------------------------------------------------
  23  
  24      require_once ( 'core.php' );
  25  
  26      $t_core_path = config_get( 'core_path' );
  27      require_once( $t_core_path.'email_api.php' );
  28  
  29      auth_reauthenticate();
  30  
  31      $t_redirect_url = 'manage_config_work_threshold_page.php';
  32      $t_project = helper_get_current_project();
  33  
  34      html_page_top1( lang_get( 'manage_threshold_config' ) );
  35      html_meta_redirect( $t_redirect_url );
  36      html_page_top2();
  37  
  38      $t_access = current_user_get_access_level();
  39  
  40  	function set_capability_row( $p_threshold, $p_all_projects_only=false ) {
  41          global $t_access, $t_project;
  42  
  43          if ( ( $t_access >= config_get_access( $p_threshold ) )
  44                    && ( ( ALL_PROJECTS == $t_project ) || ! $p_all_projects_only ) ) {
  45              $f_threshold = gpc_get_int_array( 'flag_thres_' . $p_threshold, array( ) );
  46              $f_access = gpc_get_int( 'access_' . $p_threshold );
  47              # @@debug @@ echo "<br />for $p_threshold "; var_dump($f_threshold, $f_access); echo '<br />';
  48              $t_access_levels = get_enum_to_array( config_get( 'access_levels_enum_string' ) );
  49              ksort( $t_access_levels );
  50              reset( $t_access_levels );
  51  
  52              $t_lower_threshold = NOBODY;
  53              $t_array_threshold = array();
  54  
  55              foreach( $t_access_levels as $t_access_level => $t_level_name ) {
  56                  if ( in_array( $t_access_level, $f_threshold ) ) {
  57                      if ( NOBODY == $t_lower_threshold ) {
  58                          $t_lower_threshold = $t_access_level;
  59                      }
  60                      $t_array_threshold[] = $t_access_level;
  61                  } else {
  62                      if ( NOBODY <> $t_lower_threshold ) {
  63                          $t_lower_threshold = -1;
  64                      }
  65                  }
  66              # @@debug @@ var_dump($$t_access_level, $t_lower_threshold, $t_array_threshold); echo '<br />';
  67              }
  68              $t_existing_threshold = config_get( $p_threshold );
  69              if ( -1 == $t_lower_threshold ) {
  70                  if ( $t_existing_threshold != $t_array_threshold ) {
  71                      config_set( $p_threshold, $t_array_threshold, NO_USER, $t_project, $f_access );
  72                  }
  73              } else {
  74                  if ( $t_existing_threshold != $t_lower_threshold ) {
  75                      config_set( $p_threshold, $t_lower_threshold, NO_USER, $t_project, $f_access );
  76                  }
  77              }
  78          }
  79      }
  80  
  81  	function set_capability_boolean( $p_threshold, $p_all_projects_only=false ) {
  82          global $t_access, $t_project;
  83  
  84          if ( ( $t_access >= config_get_access( $p_threshold ) )
  85                    && ( ( ALL_PROJECTS == $t_project ) || ! $p_all_projects_only ) ) {
  86              $f_flag = gpc_get( 'flag_' . $p_threshold, OFF );
  87              $f_access = gpc_get_int( 'access_' . $p_threshold );
  88              $f_flag = ( OFF == $f_flag ) ? OFF : ON;
  89              # @@debug @@ echo "<br />for $p_threshold "; var_dump($f_flag, $f_access); echo '<br />';
  90  
  91              if ( $f_flag != config_get( $p_threshold ) ) {
  92                  config_set( $p_threshold, $f_flag, NO_USER, $t_project, $f_access );
  93              }
  94          }
  95      }
  96  
  97  	function set_capability_enum( $p_threshold, $p_all_projects_only=false ) {
  98          global $t_access, $t_project;
  99  
 100          if ( ( $t_access >= config_get_access( $p_threshold ) )
 101                    && ( ( ALL_PROJECTS == $t_project ) || ! $p_all_projects_only ) ) {
 102              $f_flag = gpc_get( 'flag_' . $p_threshold );
 103              $f_access = gpc_get_int( 'access_' . $p_threshold );
 104              # @@debug @@ echo "<br />for $p_threshold "; var_dump($f_flag, $f_access); echo '<br />';
 105  
 106              if ( $f_flag != config_get( $p_threshold ) ) {
 107                  config_set( $p_threshold, $f_flag, NO_USER, $t_project, $f_access );
 108              }
 109          }
 110      }
 111  
 112  
 113      # Issues
 114      set_capability_row( 'report_bug_threshold' );
 115      set_capability_enum( 'bug_submit_status' );
 116      set_capability_row( 'update_bug_threshold' );
 117      set_capability_boolean( 'allow_close_immediately' );
 118      set_capability_boolean( 'allow_reporter_close' );
 119      set_capability_row( 'monitor_bug_threshold' );
 120      set_capability_row( 'handle_bug_threshold' );
 121       set_capability_row( 'update_bug_assign_threshold' );
 122      set_capability_row( 'move_bug_threshold', true );
 123      set_capability_row( 'delete_bug_threshold' );
 124      set_capability_row( 'reopen_bug_threshold' );
 125      set_capability_boolean( 'allow_reporter_reopen' );
 126      set_capability_enum( 'bug_reopen_status' );
 127      set_capability_enum( 'bug_reopen_resolution' );
 128      set_capability_enum( 'bug_resolved_status_threshold' );
 129      set_capability_enum( 'bug_readonly_status_threshold' );
 130      set_capability_row( 'private_bug_threshold' );
 131      set_capability_row( 'update_readonly_bug_threshold' );
 132      set_capability_row( 'update_bug_status_threshold' );
 133      set_capability_row( 'set_view_status_threshold' );
 134      set_capability_row( 'change_view_status_threshold' );
 135      set_capability_row( 'show_monitor_list_threshold' );
 136      set_capability_boolean( 'auto_set_status_to_assigned' );
 137      set_capability_enum( 'bug_assigned_status' );
 138      set_capability_boolean( 'limit_reporters', true );
 139  
 140      # Notes
 141      set_capability_row( 'add_bugnote_threshold' );
 142      set_capability_row( 'update_bugnote_threshold' );
 143      set_capability_boolean( 'bugnote_allow_user_edit_delete' );
 144      set_capability_row( 'delete_bugnote_threshold' );
 145      set_capability_row( 'private_bugnote_threshold' );
 146  
 147  
 148      # Others
 149      set_capability_row( 'view_changelog_threshold' );
 150      set_capability_row( 'view_handler_threshold' );
 151      set_capability_row( 'view_history_threshold' );
 152      set_capability_row( 'bug_reminder_threshold' );
 153  
 154  ?>
 155  
 156  <br />
 157  <div align="center">
 158  <?php
 159      echo lang_get( 'operation_successful' ) . '<br />';
 160      print_bracket_link( $t_redirect_url, lang_get( 'proceed' ) );
 161  ?>
 162  </div>
 163  
 164  <?php html_page_bottom1( __FILE__ ) ?>


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