[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> bug_actiongroup_update_severity_inc.php (source)

   1  <?php
   2  # MantisBT - A PHP based bugtracking system
   3  
   4  # MantisBT is free software: you can redistribute it and/or modify
   5  # it under the terms of the GNU General Public License as published by
   6  # the Free Software Foundation, either version 2 of the License, or
   7  # (at your option) any later version.
   8  #
   9  # MantisBT is distributed in the hope that it will be useful,
  10  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  # GNU General Public License for more details.
  13  #
  14  # You should have received a copy of the GNU General Public License
  15  # along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * @package MantisBT
  19   * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
  20   * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
  21   * @link http://www.mantisbt.org
  22   *
  23   * @uses access_api.php
  24   * @uses bug_api.php
  25   * @uses config_api.php
  26   * @uses gpc_api.php
  27   * @uses lang_api.php
  28   * @uses print_api.php
  29   */
  30  
  31  if ( !defined( 'BUG_ACTIONGROUP_UPDATE_SEVERITY_INC_ALLOW' ) ) {
  32      return;
  33  }
  34  
  35  require_api( 'access_api.php' );
  36  require_api( 'bug_api.php' );
  37  require_api( 'config_api.php' );
  38  require_api( 'gpc_api.php' );
  39  require_api( 'lang_api.php' );
  40  require_api( 'print_api.php' );
  41  
  42  /**
  43   * Prints the title for the custom action page.
  44   */
  45  function action_update_severity_print_title() {
  46      echo '<tr class="form-title">';
  47      echo '<td colspan="2">';
  48      echo lang_get( 'update_severity_title' );
  49      echo '</td></tr>';
  50  }
  51  
  52  /**
  53   * Prints the field within the custom action form.  This has an entry for
  54   * every field the user need to supply + the submit button.  The fields are
  55   * added as rows in a table that is already created by the calling code.
  56   * A row has two columns.
  57   */
  58  function action_update_severity_print_fields() {
  59      echo '<tr class="row-1"><th class="category">';
  60      echo lang_get( 'update_severity_msg' );
  61      echo '</th><td><select name="severity">';
  62      print_enum_string_option_list( 'severity' );
  63      echo '</select></td></tr>';
  64      echo '<tr><td colspan="2" class="center"><input type="submit" class="button" value="' . lang_get( 'update_severity_button' ) . ' " /></td></tr>';
  65  }
  66  
  67  /**
  68   * Validates the action on the specified bug id.
  69   *
  70   * @return string|null On failure: the reason why the action could not be validated. On success: null.
  71   */
  72  function action_update_severity_validate( $p_bug_id ) {
  73      $f_severity = gpc_get_string( 'severity' );
  74  
  75      $t_update_severity_threshold = config_get( 'update_bug_threshold' );
  76      $t_bug_id = $p_bug_id;
  77  
  78      if ( bug_is_readonly( $t_bug_id ) ) {
  79          return lang_get( 'actiongroup_error_issue_is_readonly' );
  80      }
  81  
  82      if ( !access_has_bug_level( $t_update_severity_threshold, $t_bug_id ) ) {
  83          return lang_get( 'access_denied' );
  84      }
  85  
  86      return null;
  87  }
  88  
  89  /**
  90   * Executes the custom action on the specified bug id.
  91   *
  92   * @param $p_bug_id  The bug id to execute the custom action on.
  93   *
  94   * @return null Previous validation ensures that this function doesn't fail. Therefore we can always return null to indicate no errors occurred.
  95   */
  96  function action_update_severity_process( $p_bug_id ) {
  97      $f_severity = gpc_get_string( 'severity' );
  98      bug_set_field( $p_bug_id, 'severity', $f_severity );
  99      return null;
 100  }


Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7