b2evolution PHP Cross Reference Blogging Systems

Source: /inc/files/views/_filetype_list.view.php - 152 lines - 4884 bytes - Summary - Text - Print

Description: This file implements the File types list. This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**
   3   * This file implements the File types list.
   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-2014 by Francois Planque - {@link http://fplanque.com/}
   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_list.view.php 6136 2014-03-08 07:59:48Z manuel $
  33   */
  34  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  35  
  36  
  37  global $rsc_url, $dispatcher;
  38  
  39  global $Session;
  40  
  41  // Create result set:
  42  $SQL = new SQL();
  43  $SQL->SELECT( '*' );
  44  $SQL->FROM( 'T_filetypes' );
  45  
  46  $Results = new Results( $SQL->get(), 'ftyp_' );
  47  $Results->Cache = & get_FiletypeCache();
  48  $Results->title = T_('File types list');
  49  
  50  $Results->cols[] = array(
  51                          'th' => T_('Icon'),
  52                          //'order' => 'ftyp_icon',
  53                          'th_class' => 'shrinkwrap',
  54                          'td_class' => 'shrinkwrap',
  55                          'td' => '% {Obj}->get_icon() %',
  56                      );
  57  
  58  if( $current_User->check_perm( 'options', 'edit', false ) )
  59  { // We have permission to modify:
  60      $Results->cols[] = array(
  61                              'th' => T_('Extensions'),
  62                              'order' => 'ftyp_extensions',
  63                              'td' => '<strong><a href="'.$dispatcher.'?ctrl=filetypes&amp;ftyp_ID=$ftyp_ID$&amp;action=edit" title="'.
  64                                              T_('Edit this file type...').'">$ftyp_extensions$</a></strong>',
  65                          );
  66  }
  67  else
  68  {    // View only:
  69      $Results->cols[] = array(
  70                              'th' => T_('Extensions'),
  71                              'order' => 'ftyp_extensions',
  72                              'td' => '<strong>$ftyp_extensions$</strong>',
  73                          );
  74  
  75  }
  76  
  77  $Results->cols[] = array(
  78                          'th' => T_('Name'),
  79                          'order' => 'ftyp_name',
  80                          'td' => '$ftyp_name$',
  81                      );
  82  
  83  $Results->cols[] = array(
  84                          'th' => T_('Mime type'),
  85                          'order' => 'ftyp_mimetype',
  86                          'td' => '$ftyp_mimetype$',
  87                      );
  88  
  89  $Results->cols[] = array(
  90                          'th' => T_('View type'),
  91                          'order' => 'ftyp_viewtype',
  92                          'td' => '$ftyp_viewtype$',
  93                      );
  94  /**
  95   * Display the permissions for the type file
  96   */
  97  function display_perm( $perm )
  98  {
  99      switch( $perm )
 100      {
 101          case 'any':
 102              $r = get_icon( 'file_allowed' );
 103              break;
 104          case 'registered':
 105              $r = get_icon( 'file_allowed_registered' );
 106              break;
 107          case 'admin':
 108              $r = get_icon( 'file_not_allowed' );
 109              break;
 110          default:
 111              debug_die( 'Wrong filetype allowed value!' );
 112      }
 113      return $r;
 114  }
 115  
 116  $Results->cols[] = array(
 117                          'th' => /* noun */ T_('Upload'),
 118                          'order' => 'ftyp_allowed',
 119                          'th_class' => 'shrinkwrap',
 120                          'td_class' => 'shrinkwrap',
 121                          'td' => '%display_perm( #ftyp_allowed# )%',
 122                      );
 123  
 124  if( $current_User->check_perm( 'options', 'edit', false ) )
 125  { // We have permission to modify:
 126  
 127      $Results->cols[] = array(
 128                              'th' => T_('Actions'),
 129                              'th_class' => 'shrinkwrap',
 130                              'td_class' => 'shrinkwrap',
 131                              'td' => action_icon( T_('Edit this file type...'), 'edit',
 132                              '%regenerate_url( \'action\', \'ftyp_ID=$ftyp_ID$&amp;action=edit\')%' )
 133                          .action_icon( T_('Duplicate this file type...'), 'copy',
 134                              '%regenerate_url( \'action\', \'ftyp_ID=$ftyp_ID$&amp;action=copy\')%' )
 135                          .action_icon( T_('Delete this file type!'), 'delete',
 136                              '%regenerate_url( \'action\', \'ftyp_ID=$ftyp_ID$&amp;action=delete&amp;'.url_crumb('filetype').'\')%' ),
 137                          );
 138  
 139    $Results->global_icon( T_('Create a new file type...'), 'new', regenerate_url( 'action', 'action=new'), T_('New file type').' &raquo;', 3, 4  );
 140  }
 141  
 142  $fadeout_id = $Session->get('fadeout_id');
 143  
 144  // if there happened something with a item, apply fadeout to the row:
 145  $highlight_fadeout = empty($fadeout_id) ? array() : array( 'ftyp_ID'=>array($fadeout_id) );
 146  
 147  $Results->display( NULL, $highlight_fadeout );
 148  
 149  //Flush fadeout
 150  $Session->delete( 'fadeout_id');
 151  
 152  ?>

title

Description

title

Description

title

Description

title

title

Body