*** empty log message ***
[Packages/TYPO3.CMS.git] / typo3 / class.file_list.inc
1 <?php
2 /***************************************************************
3 *  Copyright notice
4 *
5 *  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
6 *  All rights reserved
7 *
8 *  This script is part of the TYPO3 project. The TYPO3 project is
9 *  free software; you can redistribute it and/or modify
10 *  it under the terms of the GNU General Public License as published by
11 *  the Free Software Foundation; either version 2 of the License, or
12 *  (at your option) any later version.
13 *
14 *  The GNU General Public License can be found at
15 *  http://www.gnu.org/copyleft/gpl.html.
16 *  A copy is found in the textfile GPL.txt and important notices to the license
17 *  from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 *  This script is distributed in the hope that it will be useful,
21 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 *  GNU General Public License for more details.
24 *
25 *  This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28  * Include file extending t3lib_recordList
29  *
30  * $Id$
31  * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
32  *
33  * @author      Kasper Skaarhoj <kasper@typo3.com>
34  */
35 /**
36  * [CLASS/FUNCTION INDEX of SCRIPT]
37  *
38  *
39  *
40  *   74: class fileList extends t3lib_recordList
41  *  111:     function start($path,$pointer,$sort,$sortRev,$clipBoard=0)
42  *  132:     function generateList()
43  *  145:     function writeTop($path)
44  *  204:     function linkClipboardHeaderIcon($string,$table,$cmd,$warning='')
45  *  218:     function getTable($files,$dirs,$rowlist)
46  *  306:     function formatDirList($items)
47  *  369:     function linkWrapDir($code,$path)
48  *  381:     function linkWrapFile($code,$path)
49  *  395:     function listURL()
50  *  405:     function dirData($theFile)
51  *  430:     function formatFileList($items)
52  *  504:     function isImage($ext)
53  *  516:     function linkWrapSort($code,$path,$col)
54  *  534:     function readDirectory($path,$type,$extList='')
55  *  588:     function makeClip($theData)
56  *
57  * TOTAL FUNCTIONS: 15
58  * (This index is automatically created/updated by the extension "extdeveval")
59  *
60  */
61
62
63
64
65
66
67 /**
68  * Class for rendering of File>Filelist
69  *
70  * @author      Kasper Skaarhoj <kasper@typo3.com>
71  * @package TYPO3
72  * @subpackage core
73  */
74 class fileList extends t3lib_recordList {
75         var $iLimit = 40;                                       // default Max items shown
76         var $thumbs = 0;                                        // Boolean. Thumbnails on records containing files (pictures)
77         var $widthGif = '<img src="clear.gif" width="1" height="1" hspace="165" alt="" />';
78         var $fixedL = 30;                                       // Max length of strings
79         var $script = 'file_list.php';
80         var $clickMenus=1;                                      // If true click menus are generated on files and folders
81
82         var $sort = '';                                         // The field to sort by...
83         var $sortRev = 1;                                       // Reverse sorting flag
84         var $firstElementNumber=0;
85         var $clipBoard = 0;
86
87                 // internal
88         var $JScode = '';
89         var $HTMLcode = '';
90         var $totalbytes=0;
91         var $dirs = Array();
92         var $files = Array();
93         var $path = '';
94         var $eCounter=0;                                        // Counting the elements no matter what...
95         var $totalItems='';
96
97         var $CBnames=array();
98
99
100
101         /**
102          * Initialization of class
103          *
104          * @param       string          The path to list
105          * @param       integer         Pointer
106          * @param       boolean         Sorting column
107          * @param       boolean         Sorting direction
108          * @param       boolean         Show clipboard flag
109          * @return      void
110          */
111         function start($path,$pointer,$sort,$sortRev,$clipBoard=0)      {
112                 $this->counter=0;
113                 $this->totalbytes=0;
114                 $this->JScode='';
115                 $this->HTMLcode='';
116                 $this->path = $path;
117                 $this->sort=$sort;
118                 $this->sortRev=$sortRev;
119                 $this->firstElementNumber=$pointer;
120                 $this->clipBoard = $clipBoard;
121
122                 if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails'])  {
123                         $this->thumbScript='gfx/notfound_thumb.gif';
124                 }
125         }
126
127         /**
128          * Reading files and directories, counting elements and generating the list in ->HTMLcode
129          *
130          * @return      void
131          */
132         function generateList() {
133                 $this->dirs = $this->readDirectory($this->path,'dir,link');
134                 $this->files = $this->readDirectory($this->path,'file');
135                 $this->totalItems=count($this->dirs['sorting'])+count($this->files['sorting']);
136                 $this->HTMLcode.=$this->getTable($this->files, $this->dirs, 'fileext,tstamp,size,rw');
137         }
138
139         /**
140          * Make the top of the list
141          *
142          * @param       string          The path to list.
143          * @return      void
144          */
145         function writeTop($path)        {
146                         // Makes the code for the foldericon in the top
147                 $path = $GLOBALS['SOBE']->basicFF->is_directory($path); // Cleaning name...
148
149                 if ($path)      {
150                         $out='';
151                         $theFile = $GLOBALS['SOBE']->basicFF->getTotalFileInfo($path);
152                         $root = $GLOBALS['SOBE']->basicFF->checkPathAgainstMounts($theFile['path']);
153                         $titleCol='path';
154                         $this->fieldArray = Array($titleCol,'up');
155
156                         list($title,$icon,$path) =  $this->dirData($theFile);
157
158                                 // Start compiling the HTML
159                         $theData = Array();
160                         $theData[$titleCol] = $this->widthGif;
161
162                         $title = $GLOBALS['SOBE']->basicFF->blindPath($path);
163                         $theData['up']='<a href="'.htmlspecialchars($this->listURL()).'">'.
164                                         '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/refresh_n.gif','width="14" height="14"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.reload',1).'" alt="" />'.
165                                         '</a>';
166
167                         if ($root)      {
168                                         // The icon with link
169                                 $theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,$icon,'width="18" height="16"').' title="'.htmlspecialchars($theFile['file']).'" alt="" />';
170                                 if ($this->clickMenus) $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon,$path);
171
172                                 $theData[$titleCol].='<br />'.t3lib_div::fixed_lgd_cs($title,-($this->fixedL+20));      // No HTML specialchars here - HTML like <b> </b> is allowed
173                                 $theData['up'].=$this->linkWrapDir('<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/folder_up.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel',1).'" alt="" />',$theFile['path']);
174                         } else {
175                                         // root:0
176                                 $theIcon='<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/i/_icon_ftp.gif','width="18" height="16"').' alt="" />';
177                                 $theData[$titleCol].='<br />'.htmlspecialchars(t3lib_div::fixed_lgd_cs($title,-($this->fixedL+20)));
178                         }
179
180                                 // Adding top element
181                         $out.=$this->addelement(1,'',$theData,'','',$theIcon);
182
183                         $this->HTMLcode.='
184
185                 <!--
186                         Page header for file list
187                 -->
188                                 <table border="0" cellpadding="0" cellspacing="0" id="typo3-filelist-top">
189                                         '.$out.'
190                                 </table>';
191                 }
192         }
193
194         /**
195          * Wrapping input string in a link with clipboard command.
196          *
197          * @param       string          String to be linked - must be htmlspecialchar'ed / prepared before.
198          * @param       string          table - NOT USED
199          * @param       string          "cmd" value
200          * @param       string          Warning for JS confirm message
201          * @return      string          Linked string
202          */
203         function linkClipboardHeaderIcon($string,$table,$cmd,$warning='')       {
204                 $onClickEvent = 'document.dblistForm.cmd.value=\''.$cmd.'\';document.dblistForm.submit();';
205                 if ($warning)   $onClickEvent = 'if (confirm('.$GLOBALS['LANG']->JScharCode($warning).')){'.$onClickEvent.'}';
206                 return '<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">'.$string.'</a>';
207         }
208
209         /**
210          * Returns a table with directories and files listed.
211          *
212          * @param       array           Array of files from path
213          * @param       array           Array of directories from path
214          * @param       string          List of rows to display horizontallyh
215          * @return      string          HTML-table
216          */
217         function getTable($files,$dirs,$rowlist)        {
218                         // Adds the code of files/dirs
219                 $out='';
220                 $titleCol = 'file';
221
222                         // Cleaning rowlist for duplicates and place the $titleCol as the first column always!
223                 $rowlist = t3lib_div::rmFromList($titleCol,$rowlist);
224                 $rowlist = t3lib_div::uniqueList($rowlist);
225                 $rowlist = $rowlist ? $titleCol.','.$rowlist : $titleCol;
226                 if ($this->clipBoard)   $rowlist.=',_CLIPBOARD_';
227                 $this->fieldArray = explode(',',$rowlist);
228
229                         // half line is drawn
230                 $theData = Array();
231                 $theData[$titleCol] = $this->widthGif;
232                 $out.=$this->addelement(0,'',$theData,'');
233
234
235
236                         // Directories are added
237                 $iOut = '';
238                 $iOut.= $this->formatDirList($dirs,$titleCol);
239
240                 if (count($dirs['sorting']))    {
241                                 // half line is drawn
242                         $theData = Array();
243                         $theData[$titleCol] = '';
244                         $iOut.=$this->addelement(0,'',$theData);
245                 }
246
247
248
249                         // Files are added
250                 $iOut.= $this->formatFileList($files,$titleCol);
251
252                         // Header line is drawn
253                 $theData = Array();
254                 reset($this->fieldArray);
255                 while(list(,$v)=each($this->fieldArray))        {
256                         if ($v=='_CLIPBOARD_')  {
257                                 $cells=array();
258                                 $table='_FILE';
259                                 $elFromTable = $this->clipObj->elFromTable($table);
260                                 if (count($elFromTable))        {
261                                         $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('_FILE',$this->path)).'" onclick="return '.htmlspecialchars($this->clipObj->confirmMsg('_FILE',$this->path,'into',$elFromTable)).'">'.
262                                                 '<img'.t3lib_iconWorks::skinImg('','gfx/clip_pasteafter.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->getLL('clip_paste',1).'" alt="" /></a>';
263                                 }
264                                 if ($this->clipObj->current!='normal' && $iOut) {
265                                         $cells[]=$this->linkClipboardHeaderIcon('<img'.t3lib_iconWorks::skinImg('','gfx/clip_copy.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->getLL('clip_selectMarked',1).'" alt="" />',$table,'setCB');
266                                         $cells[]=$this->linkClipboardHeaderIcon('<img'.t3lib_iconWorks::skinImg('','gfx/garbage.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->getLL('clip_deleteMarked',1).'" alt="" />',$table,'delete',$GLOBALS['LANG']->getLL('clip_deleteMarkedWarning'));
267                                         $onClick = 'checkOffCB(\''.implode(',',$this->CBnames).'\'); return false;';
268                                         $cells[]='<a href="#" onclick="'.htmlspecialchars($onClick).'">'.
269                                                         '<img'.t3lib_iconWorks::skinImg('','gfx/clip_select.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->getLL('clip_markRecords',1).'" alt="" />'.
270                                                         '</a>';
271                                 }
272
273                                 $theData[$v] = implode('',$cells);
274                         } else {        // Normal row:
275                                 $theT = $this->linkWrapSort($GLOBALS['LANG']->getLL('c_'.$v,1), $this->path,$v);
276                                 $theData[$v] = $theT;
277                         }
278                 }
279                 $out.=$this->addelement(1,'',$theData,' class="c-headLine"','');
280                 $out.=$iOut;
281
282                         // half line is drawn
283                 $theData = Array();
284                 $theData[$titleCol] = $this->counter.' File(s), '.t3lib_div::formatSize($this->totalbytes).'bytes';
285                 $out.=$this->addelement(1,'',$theData);
286
287                         // finish
288                 return '
289
290
291                 <!--
292                         File list table:
293                 -->
294                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-filelist">
295                                 '.$out.'
296                         </table>';
297         }
298
299         /**
300          * This returns tablerows for the directories in the array $items['sorting'].
301          *
302          * @param       array           Directory items
303          * @return      string          HTML table rows.
304          */
305         function formatDirList($items)  {
306                 $out='';
307
308                         // Files:
309                 if (count($items['sorting']))   {
310                         reset($items['sorting']);
311                         while (list($key,) = each($items['sorting']))   {
312                                 list($flag,$code) = $this->fwd_rwd_nav();
313                                 $out.=$code;
314                                 if ($flag)      {
315                                                 // Initialization
316                                         $theFile = $items['files'][$key];
317                                         $this->counter++;
318
319                                         list($title,$icon,$path) =  $this->dirData($theFile);
320
321                                                 // The icon with link
322                                         $theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,$icon,'width="18" height="16"').' title="'.htmlspecialchars($theFile['file']).'" alt="" />';
323                                         if ($this->clickMenus) $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon,$path);
324
325                                                 //      Preparing and getting the data-array
326                                         $theData = Array();
327                                         reset($this->fieldArray);
328                                         while(list(,$field)=each($this->fieldArray))    {
329                                                 switch($field)  {
330                                                         case 'size':
331         //                                                      $theData[$field]=t3lib_div::formatSize($theFile[$field]);
332                                                         break;
333                                                         case 'rw':
334                                                                 $theData[$field]= (($theFile['readable'])?'':'<span class="typo3-red"><b>R</b></span>').(($theFile['writeable'])?'':'<span class="typo3-red"><b>W</b></span>');
335                                                         break;
336                                                         case 'fileext':
337         //                                                      $theData[$field]=strtoupper($theFile['fileext']);
338                                                         break;
339                                                         case 'tstamp':
340                                                                 $theData[$field]=Date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $theFile['tstamp']);
341                                                         break;
342                                                         case 'file':
343                                                                 $theData[$field]= $this->linkWrapDir(t3lib_div::fixed_lgd($title,$this->fixedL),$path);
344                                                         break;
345                                                         case '_CLIPBOARD_':
346                                                                 $theData[$field]=$this->makeClip($theFile);
347                                                         break;
348                                                         default:
349                                                                 $theData[$field]=t3lib_div::fixed_lgd($theFile[$field],$this->fixedL);
350                                                         break;
351                                                 }
352                                         }
353                                         $out.=$this->addelement(1,$theIcon,$theData);
354                                 }
355                                 $this->eCounter++;
356                         }
357                 }
358                 return $out;
359         }
360
361         /**
362          * Wraps the directory-titles
363          *
364          * @param       string          String to be wrapped in links
365          * @param       string          ID (path)
366          * @return      string          HTML
367          */
368         function linkWrapDir($code,$path)       {
369                 $href = $this->script.'?id='.rawurlencode($path);
370                 return '<a href="'.htmlspecialchars($href).'">'.$code.'</a>';
371         }
372
373         /**
374          * Wraps filenames in links which opens them in a window IF they are in web-path.
375          *
376          * @param       string          String to be wrapped in links
377          * @param       string          ID (path)
378          * @return      string          HTML
379          */
380         function linkWrapFile($code,$path)      {
381                 if (t3lib_div::isFirstPartOfStr($path,t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT')))    {
382                         $href = substr($path,strlen(t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT')));
383                         $aOnClick = "return top.openUrlInWindow('".$href."','WebFile');";
384                         $code = '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$code.'</a>';
385                 }
386                 return $code;
387         }
388
389         /**
390          * Returns list URL; This is the URL of the current script with id and imagemode parameters, thats all.
391          *
392          * @return      string          URL
393          */
394         function listURL()      {
395                 return $this->script.'?id='.rawurlencode($this->path).'&imagemode='.$this->thumbs;
396         }
397
398         /**
399          * Returns some data specific for the directories...
400          *
401          * @param       array           File information array
402          * @return      array           (title, icon, path)
403          */
404         function dirData($theFile)      {
405                 $path = $theFile['path'].$theFile['file'].'/';
406                 $webpath=t3lib_BEfunc::getPathType_web_nonweb($path);
407
408                 $title=htmlspecialchars($theFile['file']);
409                 $icon = 'gfx/i/_icon_'.$webpath.'folders.gif';
410                 if ($title=='_temp_')   {
411                         $icon = 'gfx/i/sysf.gif';
412                         $title='<b>TEMP</b>';
413                 }
414                 if ($title=='_recycler_')       {
415                         $icon = 'gfx/i/recycler.gif';
416                         $title='<b>RECYCLER</b>';
417                 }
418                 $icon = $theFile['writable'] ? 'gfx/i/_icon_'.$webpath.'folders_ro.gif' : $icon;
419
420                 return Array($title,$icon,$path);
421         }
422
423         /**
424          * This returns tablerows for the files in the array $items['sorting'].
425          *
426          * @param       array           File items
427          * @return      string          HTML table rows.
428          */
429         function formatFileList($items) {
430                 $out='';
431
432                         // Files:
433                 if (count($items['sorting']))   {
434                         reset($items['sorting']);
435                         while (list($key,) = each($items['sorting']))   {
436                                 list($flag,$code) = $this->fwd_rwd_nav();
437                                 $out.=$code;
438                                 if ($flag)      {
439                                                 // Initialization
440                                         $theFile = $items['files'][$key];
441                                         $this->counter++;
442
443                                         $this->totalbytes+=$theFile['size'];
444                                         $ext = $items['files'][$key][fileext];
445                                         $icon = t3lib_BEfunc::getFileIcon($ext);
446
447                                                 // The icon with link
448                                         $theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/fileicons/'.$icon,'width="18" height="16"').' title="'.htmlspecialchars($theFile['file']).'" alt="" />';
449                                         if ($this->clickMenus) $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon,$theFile['path'].$theFile['file']);
450
451                                                 //      Preparing and getting the data-array
452                                         $theData = Array();
453                                         reset($this->fieldArray);
454                                         while(list(,$field)=each($this->fieldArray))    {
455                                                 switch($field)  {
456                                                         case 'size':
457                                                                 $theData[$field]=t3lib_div::formatSize($theFile[$field]);
458                                                         break;
459                                                         case 'rw':
460                                                                 $theData[$field]= (($theFile['readable'])?'':'<span class="typo3-red"><b>R</b></span>').(($theFile['writeable'])?'':'<span class="typo3-red"><b>W</b></span>');
461                                                         break;
462                                                         case 'fileext':
463                                                                 $theData[$field]=strtoupper($theFile[$field]);
464                                                         break;
465                                                         case 'tstamp':
466                                                                 $theData[$field]=Date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $theFile[$field]);
467                                                         break;
468                                                         case '_CLIPBOARD_':
469                                                                 $theData[$field]=$this->makeClip($theFile);
470                                                         break;
471                                                         case 'file':
472                                                                 $theData[$field] = $this->linkWrapFile(t3lib_div::fixed_lgd($theFile[$field],$this->fixedL),$theFile['path'].$theFile['file']);
473                                                         break;
474                                                         default:
475                                                                 $theData[$field]=t3lib_div::fixed_lgd($theFile[$field],$this->fixedL);
476                                                         break;
477                                                 }
478                                         }
479                                         $out.=$this->addelement(1,$theIcon,$theData);
480
481                                                 // Thumbsnails?
482                                         if ($this->thumbs && $this->isImage($theFile['fileext']))       {
483                                                 $thumbData=Array();
484                                                 $theFile_R = rawurlencode($theFile['path'].$theFile['file']);
485                                                 $titleCol=$this->fieldArray[0];
486                                                 $href = $this->backPath.$this->thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].'&file='.$theFile_R;
487                                                 $thumbData[$titleCol]='<img src="'.htmlspecialchars($href).'" hspace="2" title="'.htmlspecialchars(trim($theFile['file'])).'" alt="" />';
488                                                 $out.=$this->addelement(4,'',$thumbData);
489                                         }
490                                 }
491                                 $this->eCounter++;
492                         }
493                 }
494                 return $out;
495         }
496
497         /**
498          * Returns true if $ext is an image-extension according to $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
499          *
500          * @param       string          file extension
501          * @return      boolean
502          */
503         function isImage($ext)  {
504                 return t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],strtolower($ext));
505         }
506
507         /**
508          * Wraps the directory-titles ($code) in a link to file_list.php (id=$path) and sorting commands...
509          *
510          * @param       string          String to be wrapped
511          * @param       string          ID (path)
512          * @param       string          Sorting column
513          * @return      string          HTML
514          */
515         function linkWrapSort($code,$path,$col) {
516                 if ($this->sort==$col && !$this->sortRev)       {               // reverse sorting
517                         $params='&SET[sort]='.$col.'&SET[reverse]=1';
518                 } else {
519                         $params='&SET[sort]='.$col.'&SET[reverse]=0';
520                 }
521                 $href = $this->script.'?id='.rawurlencode($path).$params;
522                 return '<a href="'.htmlspecialchars($href).'">'.$code.'</a>';
523         }
524
525         /**
526          * Returns an array with file/dir items + an array with the sorted items
527          *
528          * @param       string          Path (absolute) to read
529          * @param       string          $type is the technical type; file,dir,link. empty is all kinds of stuff.
530          * @param       string          $extList: List of fileextensions to select. If empty, all are selected.
531          * @return      array           Array('files'=>array(), 'sorting'=>array());
532          */
533         function readDirectory($path,$type,$extList='') {
534                 $items = Array('files'=>array(), 'sorting'=>array());
535                 $path = $GLOBALS['SOBE']->basicFF->is_directory($path); // Cleaning name...
536
537                 if($path && $GLOBALS['SOBE']->basicFF->checkPathAgainstMounts($path.'/'))       {
538                         $d = @dir($path);
539                         $tempArray=Array();
540                         if (is_object($d))      {
541                                 while($entry=$d->read()) {
542                                         if ($entry!='.' && $entry!='..')        {
543                                                 $wholePath = $path.'/'.$entry;          // Because of odd PHP-error where  <br />-tag is sometimes placed after a filename!!
544                                                 if (@file_exists($wholePath) && (!$type || t3lib_div::inList($type,filetype($wholePath))))      {
545                                                         if ($extList)   {
546                                                                 $fI = t3lib_div::split_fileref($entry);
547                                                                 if (t3lib_div::inList($extList,$fI['fileext'])) {
548                                                                         $tempArray[] = $wholePath;
549                                                                 }
550                                                         } else {
551                                                                 $tempArray[] = $wholePath;
552                                                         }
553                                                 }
554                                         }
555                                 }
556                                 $d->close();
557                         }
558                                 // Get fileinfo
559                         reset($tempArray);
560                         while (list(,$val)=each($tempArray))    {
561                                 $temp = $GLOBALS['SOBE']->basicFF->getTotalFileInfo($val);
562                                 $items['files'][] = $temp;
563                                 if ($this->sort)        {
564                                         $items['sorting'][] = strtoupper($temp[$this->sort]);
565                                 } else {
566                                         $items['sorting'][] = '';
567                                 }
568                         }
569                                 // Sort if required
570                         if ($this->sort)        {
571                                 if (!$this->sortRev)    {
572                                         asort($items['sorting']);
573                                 } else {
574                                         arsort($items['sorting']);
575                                 }
576                         }
577                 }
578                 return $items;
579         }
580
581         /**
582          * Creates the clipboard control pad
583          *
584          * @param       array           Array with information about the file/directory for which to make the clipboard panel for the listing.
585          * @return      string          HTML-table
586          */
587         function makeClip($theData)     {
588                 $cells=array();
589                 $fullIdent = $theData['path'].$theData['file'];
590                 $md5=t3lib_div::shortmd5($fullIdent);
591
592                         // For normal clipboard, add copy/cut buttons:
593                 if ($this->clipObj->current=='normal')  {
594                         $isSel = $this->clipObj->isSelected('_FILE',$md5);
595                         $cells[]='<a href="'.htmlspecialchars($this->clipObj->selUrlFile($fullIdent,1,($isSel=='copy'))).'">'.
596                                                 '<img'.t3lib_iconWorks::skinImg('','gfx/clip_copy'.($isSel=='copy'?'_h':'').'.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.copy',1).'" alt="" />'.
597                                                 '</a>';
598                         $cells[]='<a href="'.htmlspecialchars($this->clipObj->selUrlFile($fullIdent,0,($isSel=='cut'))).'">'.
599                                                 '<img'.t3lib_iconWorks::skinImg('','gfx/clip_cut'.($isSel=='cut'?'_h':'').'.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.cut',1).'" alt="" />'.
600                                                 '</a>';
601                 } else {        // For numeric pads, add select checkboxes:
602                         $n='_FILE|'.$md5;
603                         $this->CBnames[]=$n;
604
605                         $checked = ($this->clipObj->isSelected('_FILE',$md5)?' checked="checked"':'');
606                         $cells[]='<input type="hidden" name="CBH['.$n.']" value="0" />'.
607                                         '<input type="checkbox" name="CBC['.$n.']" value="'.htmlspecialchars($fullIdent).'" class="smallCheckboxes"'.$checked.' />';
608                 }
609
610                         // Display PASTE button, if directory:
611                 $elFromTable = $this->clipObj->elFromTable('_FILE');
612                 if (@is_dir($fullIdent) && count($elFromTable)) {
613                         $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('_FILE',$fullIdent)).'" onclick="return '.htmlspecialchars($this->clipObj->confirmMsg('_FILE',$fullIdent,'into',$elFromTable)).'">'.
614                                                 '<img'.t3lib_iconWorks::skinImg('','gfx/clip_pasteinto.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->getLL('clip_pasteInto',1).'" alt="" />'.
615                                                 '</a>';
616                 }
617
618                         // Compile items into a DIV-element:
619                 return '                                                        <!-- CLIPBOARD PANEL: -->
620                                                                                         <div class="typo3-clipCtrl">
621                                                                                                 '.implode('
622                                                                                                 ',$cells).'
623                                                                                         </div>';
624         }
625 }
626
627
628
629 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.file_list.inc'])       {
630         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.file_list.inc']);
631 }
632 ?>