[ 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/ -> _file_permissions.form.php (source)

   1  <?php
   2  /**

   3   * This file implements the UI for file permissions

   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)2004-2006 by Daniel HAHLER - {@link http://thequod.de/contact}.

  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   * Daniel HAHLER grants Francois PLANQUE the right to license

  22   * Daniel HAHLER'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 evocore

  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 blueyed: Daniel HAHLER

  31   *

  32   * @version $Id: _file_permissions.form.php,v 1.1 2007/06/25 11:00:03 fplanque Exp $

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

  38   * @global Filelist

  39   */
  40  global $selected_Filelist;
  41  
  42  global $more_than_one_selected_file, $perms_read_readonly, $field_options_read_readonly;
  43  
  44  
  45  $Form = & new Form( NULL, 'fm_perms_checkchanges' );
  46  
  47  $Form->global_icon( T_('Cancel editing!'), 'close', regenerate_url() );
  48  
  49  $Form->begin_form( 'fform', T_('Change permissions') );
  50      $Form->hidden_ctrl();
  51      $Form->hiddens_by_key( get_memorized() );
  52      $Form->hidden( 'action', 'edit_perms' );
  53  
  54      if( $more_than_one_selected_file )
  55      { // more than one file, provide default
  56          $Form->begin_fieldset( T_('Default') );
  57  
  58          if( $perms_read_readonly )
  59          {
  60              $Form->radio_input( 'edit_perms_default', $edit_perms_default, $field_options_read_readonly, T_('Default permissions') );
  61          }
  62          else
  63          {
  64              $Form->text_input( 'edit_perms_default', $edit_perms_default, 3, T_('Default permissions') );
  65          }
  66  
  67          $Form->info_field( '', '<a id="checkallspan_edit_perms_set" href="#" onclick="toggleCheckboxes(\'fm_perms_checkchanges\', \'use_default_perms[]\', \'edit_perms_set\'); return false;">'.T_('check all').'</a>' );
  68  
  69          $Form->end_fieldset();
  70      }
  71  
  72      if( $more_than_one_selected_file )
  73      { // generate checkbox input to use with every file
  74          $Form->output = false;
  75          $Form->switch_layout('none');
  76          $use_default_perms_checkbox = $Form->checkbox_input(
  77              'use_default_perms[]', $checked = 0, T_('Use default value'),
  78              array( 'value' => '%file_ID%', 'id' => 'use_default_perms_%file_ID%' ) );
  79          $Form->switch_layout(NULL);
  80          $Form->output = true;
  81      }
  82  
  83      $selected_Filelist->restart();
  84  
  85      $Form->begin_fieldset();
  86      while( $l_File = & $selected_Filelist->get_next() )
  87      {
  88          if( $perms_read_readonly )
  89          { // readonly/write only (WINDOWS): display radio inputs to change readonly/write
  90              $field_options = $field_options_read_readonly;
  91              $field_params = array();
  92              if( !empty($use_default_perms_checkbox) )
  93              {
  94                  $field_params['field_suffix'] = str_replace( '%file_ID%', $l_File->get_md5_ID(), $use_default_perms_checkbox );
  95              }
  96  
  97              $l_perms = $l_File->get_perms( 'octal' );
  98              if( $l_perms == 555 )
  99              {
 100                  $field_options[0]['checked'] = 'checked';
 101              }
 102              else
 103              {
 104                  $field_options[1]['checked'] = 'checked';
 105              }
 106              $Form->radio_input( 'perms['.$l_File->get_md5_ID().']', false, $field_options, $l_File->get_rdfp_rel_path(), $field_params );
 107          }
 108          else
 109          { // display a text input with UNIX perms
 110              $field_params = array();
 111              if( !empty($use_default_perms_checkbox) )
 112              {
 113                  $field_params['field_suffix'] = str_replace( '%file_ID%', $l_File->get_md5_ID(), $use_default_perms_checkbox );
 114              }
 115  
 116              $Form->text_input( 'perms['.$l_File->get_md5_ID().']', $l_File->get_perms( 'octal' ), 3, $l_File->get_rdfp_rel_path(), $field_params );
 117          }
 118      }
 119      $Form->end_fieldset();
 120  
 121  $Form->end_form( array(
 122          array( 'submit', 'submit', T_('Set new permissions'), 'ActionButton' ),
 123          array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
 124  
 125  
 126  /*

 127   * $Log: _file_permissions.form.php,v $

 128   * Revision 1.1  2007/06/25 11:00:03  fplanque

 129   * MODULES (refactored MVC)

 130   *

 131   * Revision 1.8  2007/04/26 00:11:10  fplanque

 132   * (c) 2007

 133   *

 134   * Revision 1.7  2007/03/09 15:18:42  blueyed

 135   * Removed bloated "params" usage in Form::radio_input() for $field_options. Now the attribs/params for each radio input are directly in the $field_options entry instead.

 136   *

 137   * Revision 1.6  2006/11/24 18:27:25  blueyed

 138   * Fixed link to b2evo CVS browsing interface in file docblocks

 139   */
 140  ?>


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