[ Index ]
 

Code source de b2evolution 2.1.0-beta

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/blogs/inc/files/views/ -> _filetype.form.php (source)

   1  <?php
   2  /**

   3   * This file implements the File type form.

   4   *

   5   * This file is part of the evoCore framework - {@link http://evocore.net/}

   6   * See also {@link http://sourceforge.net/projects/evocms/}.

   7   *

   8   * @copyright (c)2003-2007 by Francois PLANQUE - {@link http://fplanque.net/}

   9   * Parts of this file are copyright (c)2005-2006 by PROGIDISTRI - {@link http://progidistri.com/}.

  10   *

  11   * {@internal License choice

  12   * - If you have received this file as part of a package, please find the license.txt file in

  13   *   the same folder or the closest folder above for complete license terms.

  14   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)

  15   *   then you must choose one of the following licenses before using the file:

  16   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php

  17   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php

  18   * }}

  19   *

  20   * {@internal Open Source relicensing agreement:

  21   * PROGIDISTRI S.A.S. grants Francois PLANQUE the right to license

  22   * PROGIDISTRI S.A.S.'s contributions to this file and the b2evolution project

  23   * under any OSI approved OSS license (http://www.opensource.org/licenses/).

  24   * }}

  25   *

  26   * @package admin

  27   *

  28   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}

  29   * @author fplanque: Francois PLANQUE.

  30   * @author mbruneau: Marc BRUNEAU / PROGIDISTRI

  31   *

  32   * @version $Id: _filetype.form.php,v 1.2 2007/10/08 08:31:59 fplanque Exp $

  33   */
  34  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  35  
  36  /**

  37   * @var FileType

  38   */
  39  global $edited_Filetype;
  40  
  41  global $force_upload_forbiddenext;
  42  global $rsc_path;
  43  
  44  // Determine if we are creating or updating...

  45  global $action;
  46  $creating = is_create_action( $action );
  47  
  48  
  49  $Form = & new Form( NULL, 'ftyp_checkchanges', 'post', 'compact' );
  50  
  51  $Form->global_icon( T_('Delete this filetype!'), 'delete', regenerate_url( 'action', 'action=delete' ) );
  52  $Form->global_icon( T_('Cancel editing!'), 'close', regenerate_url( 'action' ) );
  53  
  54  $Form->begin_form( 'fform', $creating ?  T_('New file type') : T_('File type') );
  55  
  56      $Form->hidden_ctrl();
  57      $Form->hidden( 'action', $creating ? 'create' : 'update' );
  58  
  59      if( ! $creating ) $Form->hidden( 'ftyp_ID', $edited_Filetype->ID );
  60  
  61      $Form->text_input( 'ftyp_extensions', $edited_Filetype->extensions, 40, T_('Extensions'), '', array( 'maxlength'=>80, 'required'=>true, 'note'=>sprintf('E.g. &laquo;%s&raquo;'.', '.T_('separated by whitespace'), 'html') ) );
  62  
  63      $Form->text_input( 'ftyp_name', $edited_Filetype->name, 40, T_('File type name'), sprintf('E.g. &laquo;%s&raquo;', 'HTML file'), array( 'maxlength'=> 80, 'required'=>true ) );
  64  
  65      $Form->text_input( 'ftyp_mimetype', $edited_Filetype->mimetype, 40, T_('Mime type'), sprintf('E.g. &laquo;%s&raquo;', 'text/html'), array( 'maxlength'=> 80, 'required'=>true ) );
  66  
  67      $Form->text( 'ftyp_icon', $edited_Filetype->icon, 20, T_('Icon'), sprintf( /* TRANS: %s is a filesystem path */T_('File name of the icon, must be in %s.'), rel_path_to_base($rsc_path.'icons/fileicons/') ), 40 );
  68  
  69      $Form->radio( 'ftyp_viewtype',
  70                                  $edited_Filetype->viewtype,
  71                                   array(
  72                                                  array( 'browser', T_( 'Open with browser (popup)' ), T_( 'Let the browser handle the file in a popup.' ) ),
  73                                                  array( 'text', T_( 'Open with text viewer (popup)' ), T_( 'Use the online text viewer (recommended for .txt)' ) ),
  74                                                  array( 'image', T_( 'Open with image viewer (popup)' ), T_( 'Use the online image viewer (recommended for .gif .png .jpg)' ) ),
  75                                                  array( 'external', T_( 'Open with external app (no popup)' ), T_( 'Let the browser handle the file in a popup. Note: if you do not want Word to open inside of IE, you must uncheck "browse in same window" in Windows\' file types.' ) ),
  76                                                  array( 'download', T_( 'Download to disk (no popup)' ), T_( 'Tell the browser to save the file to disk instead of displaying it.' ) )
  77                                              ),
  78                                      T_( 'View type' ),
  79                                      true // separate lines
  80                               );
  81  
  82      // Check if the extension is in the array of the not allowed upload extensions from _advanced.php

  83      $not_allowed = false;
  84      $extensions = explode ( ' ', $edited_Filetype->extensions );
  85      foreach($extensions as $extension)
  86      {
  87          if( in_array( $extension, $force_upload_forbiddenext ) )
  88          {
  89              $not_allowed = true;
  90              continue;
  91          }
  92      }
  93  
  94      $Form->checkbox( 'ftyp_allowed', $edited_Filetype->allowed, T_('Allow upload'),
  95                                      T_('Check to allow uploading and renaming of this file type'), '', 1, $not_allowed);
  96  
  97  if( $creating )
  98  {
  99      $Form->end_form( array( array( 'submit', 'submit', T_('Record'), 'SaveButton' ),
 100                                                      array( 'submit', 'submit', T_('Record, then Create New'), 'SaveButton' ),
 101                                                      array( 'submit', 'submit', T_('Record, then Create Similar'), 'SaveButton' ),
 102                                                      array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
 103  }
 104  else
 105  {
 106      $Form->end_form( array( array( 'submit', 'submit', T_('Update'), 'SaveButton' ),
 107                                                      array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
 108  }
 109  
 110  
 111  /*

 112   * $Log: _filetype.form.php,v $

 113   * Revision 1.2  2007/10/08 08:31:59  fplanque

 114   * nicer forms

 115   *

 116   * Revision 1.1  2007/06/25 11:00:08  fplanque

 117   * MODULES (refactored MVC)

 118   *

 119   */
 120  ?>


Généré le : Thu Nov 29 23:58:50 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics