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