[ 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_add_note_inc.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_add_note_inc.php,v 1.3.2.1 2007-10-13 22:32:31 giallu Exp $
  22      # --------------------------------------------------------
  23  
  24      /**
  25       * Prints the title for the custom action page.     
  26       */
  27  	function action_add_note_print_title() {
  28          echo '<tr class="form-title">';
  29          echo '<td colspan="2">';
  30          echo lang_get( 'add_bugnote_title' );
  31          echo '</td></tr>';        
  32      }
  33  
  34      /**
  35       * Prints the field within the custom action form.  This has an entry for
  36       * every field the user need to supply + the submit button.  The fields are
  37       * added as rows in a table that is already created by the calling code.
  38       * A row has two columns.              
  39       */
  40  	function action_add_note_print_fields() {
  41          echo '<tr class="row-1" valign="top"><td class="category">', lang_get( 'add_bugnote_title' ), '</td><td><textarea name="bugnote_text" cols="80" rows="10"></textarea></td></tr>';
  42      ?>
  43      <!-- View Status -->
  44      <tr class="row-2">
  45      <td class="category">
  46          <?php echo lang_get( 'view_status' ) ?>
  47      </td>
  48      <td>
  49  <?php
  50          if ( access_has_project_level( config_get( 'change_view_status_threshold' ) ) ) { ?>
  51              <select name="view_state">
  52                  <?php print_enum_string_option_list( 'view_state', $t_bug->view_state) ?>
  53              </select>
  54  <?php
  55          } else {
  56              echo get_enum_element( 'view_state', $t_bug->view_state );
  57              echo '<input type="hidden" name="view_state" value="', $t_bug->view_state, '" />';
  58          }
  59  ?>
  60      </td>
  61      </tr>
  62      <?php
  63          echo '<tr><td colspan="2"><center><input type="submit" class="button" value="' . lang_get( 'add_bugnote_button' ) . ' " /></center></td></tr>';
  64      }
  65  
  66      /**
  67       * Validates the action on the specified bug id.
  68       * 
  69       * @returns true    Action can be applied.
  70       * @returns array( bug_id => reason for failure )     
  71       */
  72  	function action_add_note_validate( $p_bug_id ) {
  73          $f_bugnote_text = gpc_get_string( 'bugnote_text' );
  74  
  75          if ( is_blank( $f_bugnote_text ) ) {
  76              error_parameters( lang_get( 'bugnote' ) );
  77              trigger_error( ERROR_EMPTY_FIELD, ERROR );
  78          }
  79  
  80          $t_failed_validation_ids = array();
  81          $t_add_bugnote_threshold = config_get( 'add_bugnote_threshold' );
  82          $t_bug_id = $p_bug_id;
  83  
  84          if ( bug_is_readonly( $t_bug_id ) ) {
  85              $t_failed_validation_ids[$t_bug_id] = lang_get( 'actiongroup_error_issue_is_readonly' );
  86              return $t_failed_validation_ids;
  87          }
  88  
  89          if ( !access_has_bug_level( $t_add_bugnote_threshold, $t_bug_id ) ) {
  90              $t_failed_validation_ids[$t_bug_id] = lang_get( 'access_denied' );
  91              return $t_failed_validation_ids;
  92          }
  93  
  94          return true;
  95      }
  96  
  97      /**
  98       * Executes the custom action on the specified bug id.
  99       * 
 100       * @param $p_bug_id  The bug id to execute the custom action on.
 101       * 
 102       * @returns true   Action executed successfully.
 103       * @returns array( bug_id => reason for failure )                    
 104       */
 105  	function action_add_note_process( $p_bug_id ) {
 106          $f_bugnote_text = gpc_get_string( 'bugnote_text' );
 107          $f_view_state = gpc_get_int( 'view_state' );
 108          bugnote_add ( $p_bug_id, $f_bugnote_text, '0:00', /* $p_private = */ $f_view_state != VS_PUBLIC  );
 109          return true;
 110      }
 111  ?>


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