[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/ -> tag_attach.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: tag_attach.php,v 1.2.2.2 2007-10-18 15:33:22 nuclear_eclipse Exp $
  22      # --------------------------------------------------------
  23  
  24      require_once ( 'core.php' );
  25  
  26      $t_core_path = config_get( 'core_path' );
  27  
  28      require_once( $t_core_path . 'tag_api.php' );
  29  
  30      $f_bug_id = gpc_get_int( 'bug_id' );
  31      $f_tag_select = gpc_get_int( 'tag_select' );
  32      $t_user_id = auth_get_current_user_id();
  33  
  34      access_ensure_bug_level( config_get( 'tag_attach_threshold' ), $f_bug_id, $t_user_id );
  35  
  36      $t_tags = tag_parse_string( gpc_get_string( 'tag_string' ) );
  37      $t_can_create = access_has_global_level( config_get( 'tag_create_threshold' ) );
  38      
  39      $t_tags_create = array();
  40      $t_tags_attach = array();
  41      $t_tags_failed = array();
  42  
  43      foreach ( $t_tags as $t_tag_row ) {
  44          if ( -1 == $t_tag_row['id'] ) {
  45              if ( $t_can_create ) {
  46                  $t_tags_create[] = $t_tag_row;
  47              } else {
  48                  $t_tags_failed[] = $t_tag_row;
  49              }
  50          } elseif ( -2 == $t_tag_row['id'] ) {
  51              $t_tags_failed[] = $t_tag_row;
  52          } else {
  53              $t_tags_attach[] = $t_tag_row;
  54          }
  55      }
  56  
  57      if ( 0 < $f_tag_select && tag_exists( $f_tag_select ) ) {
  58          $t_tags_attach[] = tag_get( $f_tag_select );
  59      }
  60  
  61      if ( count( $t_tags_failed ) > 0 ) {
  62          html_page_top1( lang_get( 'tag_attach_long' ).' '.bug_format_summary( $f_bug_id, SUMMARY_CAPTION ) );
  63          html_page_top2();
  64  ?>
  65  <br/>
  66  <table class="width75" align="center">
  67      <tr class="row-category">
  68      <td colspan="2"><?php echo lang_get( 'tag_attach_failed' ) ?></td>
  69      </tr>
  70      <tr class="spacer"><td colspan="2"></td></tr>
  71  <?php        
  72          $t_tag_string = "";
  73          foreach( $t_tags_attach as $t_tag_row ) {
  74              if ( "" != $t_tag_string ) {
  75                  $t_tag_string .= config_get( 'tag_separator' );
  76              }
  77              $t_tag_string .= $t_tag_row['name'];
  78          }
  79  
  80          foreach( $t_tags_failed as $t_tag_row ) {
  81              echo '<tr ',helper_alternate_class(),'>';
  82              if ( -1 == $t_tag_row['id'] ) {
  83                  echo '<td class="category">',lang_get( 'tag_invalid_name' ),'</td>';
  84              } elseif ( -2 == $t_tag_row['id'] ) {
  85                  echo '<td class="category">',lang_get( 'tag_create_denied' ),'</td>';
  86              }
  87              echo '<td>',string_html_specialchars( $t_tag_row['name'] ),'</td></tr>';
  88              
  89              if ( "" != $t_tag_string ) {
  90                  $t_tag_string .= config_get( 'tag_separator' );
  91              }
  92              $t_tag_string .= $t_tag_row['name'];
  93          }
  94  ?>
  95      <tr class="spacer"><td colspan="2"></td></tr>
  96      <tr <?php echo helper_alternate_class() ?>>
  97      <td class="category"><?php echo lang_get( 'tag_attach_long' ) ?></td>
  98      <td>
  99  <?php
 100          print_tag_input( $f_bug_id, $t_tag_string );
 101  ?>    
 102      </td>
 103      </tr>
 104  </table>
 105  <?php
 106          html_page_bottom1(__FILE__);
 107      } else {
 108          foreach( $t_tags_create as $t_tag_row ) {
 109              $t_tag_row['id'] = tag_create( $t_tag_row['name'], $t_user_id );
 110              $t_tags_attach[] = $t_tag_row;
 111          }
 112  
 113          foreach( $t_tags_attach as $t_tag_row ) {
 114              if ( ! tag_bug_is_attached( $t_tag_row['id'], $f_bug_id ) ) {
 115                  tag_bug_attach( $t_tag_row['id'], $f_bug_id, $t_user_id );
 116              }
 117          }
 118  
 119          print_successful_redirect_to_bug( $f_bug_id );
 120      }


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