[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> bug_actiongroup_update_product_build_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   */
  29  
  30  if ( !defined( 'BUG_ACTIONGROUP_UPDATE_PRODUCT_BUILD_INC_ALLOW' ) ) {
  31      return;
  32  }
  33  
  34  require_api( 'access_api.php' );
  35  require_api( 'bug_api.php' );
  36  require_api( 'config_api.php' );
  37  require_api( 'gpc_api.php' );
  38  require_api( 'lang_api.php' );
  39  
  40  /**
  41   * Prints the title for the custom action page.
  42   */
  43  function action_update_product_build_print_title() {
  44      echo '<tr class="form-title">';
  45      echo '<td colspan="2">';
  46      echo lang_get( 'product_build' );
  47      echo '</td></tr>';
  48  }
  49  
  50  /**
  51   * Prints the field within the custom action form.  This has an entry for
  52   * every field the user need to supply + the submit button.  The fields are
  53   * added as rows in a table that is already created by the calling code.
  54   * A row has two columns.
  55   */
  56  function action_update_product_build_print_fields() {
  57      echo '<tr class="row-1"><th class="category">', lang_get( 'product_build' ), '</th><td><input type="text" name="build" size="32" maxlength="32" /></td></tr>';
  58      echo '<tr><td colspan="2" class="center"><input type="submit" class="button" value="' . lang_get( 'actiongroup_menu_update_product_build' ) . ' " /></td></tr>';
  59  }
  60  
  61  /**
  62   * Validates the action on the specified bug id.
  63   *
  64   * @param $p_bug_id Bug ID
  65   * @return string|null On failure: the reason why the action could not be validated. On success: null.
  66   */
  67  function action_update_product_build_validate( $p_bug_id ) {
  68      $t_bug_id = (int)$p_bug_id;
  69  
  70      if ( bug_is_readonly( $t_bug_id ) ) {
  71          return lang_get( 'actiongroup_error_issue_is_readonly' );
  72      }
  73  
  74      if ( !access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) {
  75          return lang_get( 'access_denied' );
  76      }
  77  
  78      return null;
  79  }
  80  
  81  /**
  82   * Executes the custom action on the specified bug id.
  83   *
  84   * @param $p_bug_id  The bug id to execute the custom action on.
  85   * @return null Previous validation ensures that this function doesn't fail. Therefore we can always return null to indicate no errors occurred.
  86   */
  87  function action_update_product_build_process( $p_bug_id ) {
  88      $f_build = gpc_get_string( 'build' );
  89      $t_build = trim( $f_build );
  90  
  91      bug_set_field( $p_bug_id, 'build', $t_build );
  92      return null;
  93  }


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