[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/ -> news_edit_page.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 core.php
  24   * @uses access_api.php
  25   * @uses config_api.php
  26   * @uses current_user_api.php
  27   * @uses form_api.php
  28   * @uses gpc_api.php
  29   * @uses helper_api.php
  30   * @uses html_api.php
  31   * @uses lang_api.php
  32   * @uses news_api.php
  33   * @uses print_api.php
  34   * @uses project_api.php
  35   * @uses string_api.php
  36   */
  37  
  38  /**
  39   * MantisBT Core API's
  40   */
  41  require_once ( 'core.php' );
  42  require_api( 'access_api.php' );
  43  require_api( 'config_api.php' );
  44  require_api( 'current_user_api.php' );
  45  require_api( 'form_api.php' );
  46  require_api( 'gpc_api.php' );
  47  require_api( 'helper_api.php' );
  48  require_api( 'html_api.php' );
  49  require_api( 'lang_api.php' );
  50  require_api( 'news_api.php' );
  51  require_api( 'print_api.php' );
  52  require_api( 'project_api.php' );
  53  require_api( 'string_api.php' );
  54  
  55  news_ensure_enabled();
  56  
  57  $f_news_id = gpc_get_int( 'news_id' );
  58  $f_action = gpc_get_string( 'action', '' );
  59  
  60  # If deleting item redirect to delete script
  61  if ( 'delete' == $f_action ) {
  62      form_security_validate( 'news_delete' );
  63  
  64      $row = news_get_row( $f_news_id );
  65  
  66      # This check is to allow deleting of news items that were left orphan due to bug #3723
  67      if ( project_exists( $row['project_id'] ) ) {
  68          access_ensure_project_level( config_get( 'manage_news_threshold' ), $row['project_id'] );
  69      }
  70  
  71      helper_ensure_confirmed( lang_get( 'delete_news_sure_msg' ), lang_get( 'delete_news_item_button' ) );
  72  
  73      news_delete( $f_news_id );
  74  
  75      form_security_purge( 'news_delete' );
  76  
  77      print_header_redirect( 'news_menu_page.php', true );
  78  }
  79  
  80  # Retrieve news item data and prefix with v_
  81  $row = news_get_row( $f_news_id );
  82  if ( $row ) {
  83      extract( $row, EXTR_PREFIX_ALL, 'v' );
  84  }
  85  
  86  access_ensure_project_level( config_get( 'manage_news_threshold' ), $v_project_id );
  87  
  88  $v_headline = string_attribute( $v_headline );
  89  $v_body     = string_textarea( $v_body );
  90  
  91  html_page_top( lang_get( 'edit_news_title' ) );
  92  
  93  # Edit News Form BEGIN
  94  ?>
  95  
  96  <div id="news-update-div" class="form-container">
  97      <form id="news-update-form" method="post" action="news_update.php">
  98          <fieldset class="has-required">
  99              <legend><span><?php echo lang_get( 'headline' ) ?></span></legend>
 100              <div class="section-link"><?php print_bracket_link( 'news_menu_page.php', lang_get( 'go_back' ) ) ?></div>
 101              <?php echo form_security_field( 'news_update' ); ?>
 102              <input type="hidden" name="news_id" value="<?php echo $v_id ?>" />
 103              <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
 104                  <label for="news-update-headline" class="required"><span><?php echo lang_get( 'headline' ) ?></span></label>
 105                  <span class="input"><input type="text" id="news-update-headline" name="headline" size="64" maxlength="64" value="<?php echo $v_headline ?>" /></span>
 106                  <span class="label-style"></span>
 107              </div>
 108              <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
 109                  <label for="news-update-body" class="required"><span><?php echo lang_get( 'body' ) ?></span></label>
 110                  <span class="textarea"><textarea id="news-update-body" name="body" cols="60" rows="10"><?php echo $v_body ?></textarea></span>
 111                  <span class="label-style"></span>
 112              </div>
 113              <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
 114                  <label for=""><span><?php echo lang_get( 'post_to' ) ?></span></label>
 115                  <span class="select">
 116                      <select name="project_id"><?php
 117                          $t_sitewide = false;
 118                          if ( current_user_is_administrator() ) {
 119                              $t_sitewide = true;
 120                          }
 121                          print_project_option_list( $v_project_id, $t_sitewide ); ?>
 122                      </select>
 123                  </span>
 124                  <span class="label-style"></span>
 125              </div>
 126              <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
 127                  <label for="news-update-announcement"><span><?php echo lang_get( 'announcement' ) ?></span> <span class="help-text"><?php echo lang_get( 'stays_on_top' ) ?></span></label>
 128                  <span class="checkbox"><input type="checkbox" id="news-update-announcement" name="announcement" <?php check_checked( $v_announcement, 1 ); ?> /></span>
 129                  <span class="label-style"></span>
 130              </div>
 131              <div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
 132                  <label for=""><span><?php echo lang_get( 'view_status' ) ?></span></label>
 133                  <span class="select">
 134                      <select name="view_state">
 135                          <?php print_enum_string_option_list( 'view_state', $v_view_state ) ?>
 136                      </select>
 137                  </span>
 138                  <span class="label-style"></span>
 139              </div>
 140              <span class="submit-button"><input type="submit" class="button" value="<?php echo lang_get( 'update_news_button' ) ?>" /></span>
 141          </fieldset>
 142      </form>
 143  </div><?php
 144  # Edit News Form END
 145  
 146  html_page_bottom();


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