7c9799d09282ab8a6f590a62f97f1efbeaa6c69d
[Packages/TYPO3.CMS.git] / typo3 / class.file_list.inc
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@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 <kasperYYYY@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 * 203: function linkClipboardHeaderIcon($string,$table,$cmd,$warning='')
45 * 217: function getTable($files,$dirs,$rowlist)
46 * 305: function formatDirList($items)
47 * 368: function linkWrapDir($code,$path)
48 * 380: function linkWrapFile($code,$path)
49 * 394: function listURL()
50 * 404: function dirData($theFile)
51 * 429: function formatFileList($items)
52 * 503: function isImage($ext)
53 * 515: function linkWrapSort($code,$path,$col)
54 * 533: function readDirectory($path,$type,$extList='')
55 * 587: 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 <kasperYYYY@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['writable'])?'':'<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($title,$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).'" title="'.htmlspecialchars($code).'">'.t3lib_div::fixed_lgd($code,$this->fixedL).'</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
382 if (t3lib_div::isFirstPartOfStr($path,t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT'))) {
383 $href = substr($path,strlen(t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT')));
384 $aOnClick = "return top.openUrlInWindow('".$href."','WebFile');";
385 $code = '<a href="#" title="'.htmlspecialchars($code).'" onclick="'.htmlspecialchars($aOnClick).'">'.t3lib_div::fixed_lgd($code,$this->fixedL).'</a>';
386 }
387 return $code;
388 }
389
390 /**
391 * Returns list URL; This is the URL of the current script with id and imagemode parameters, thats all.
392 *
393 * @return string URL
394 */
395 function listURL() {
396 return $this->script.'?id='.rawurlencode($this->path).'&imagemode='.$this->thumbs;
397 }
398
399 /**
400 * Returns some data specific for the directories...
401 *
402 * @param array File information array
403 * @return array (title, icon, path)
404 */
405 function dirData($theFile) {
406 $path = $theFile['path'].$theFile['file'].'/';
407 $webpath=t3lib_BEfunc::getPathType_web_nonweb($path);
408
409 $title=htmlspecialchars($theFile['file']);
410 $icon = 'gfx/i/_icon_'.$webpath.'folders.gif';
411 if ($title=='_temp_') {
412 $icon = 'gfx/i/sysf.gif';
413 $title='<b>TEMP</b>';
414 }
415 if ($title=='_recycler_') {
416 $icon = 'gfx/i/recycler.gif';
417 $title='<b>RECYCLER</b>';
418 }
419 $icon = $theFile['writable'] ? 'gfx/i/_icon_'.$webpath.'folders_ro.gif' : $icon;
420
421 return Array($title,$icon,$path);
422 }
423
424 /**
425 * This returns tablerows for the files in the array $items['sorting'].
426 *
427 * @param array File items
428 * @return string HTML table rows.
429 */
430 function formatFileList($items) {
431 $out='';
432
433 // Files:
434 if (count($items['sorting'])) {
435 reset($items['sorting']);
436 while (list($key,) = each($items['sorting'])) {
437 list($flag,$code) = $this->fwd_rwd_nav();
438 $out.=$code;
439 if ($flag) {
440 // Initialization
441 $theFile = $items['files'][$key];
442 $this->counter++;
443
444 $this->totalbytes+=$theFile['size'];
445 $ext = $items['files'][$key][fileext];
446 $icon = t3lib_BEfunc::getFileIcon($ext);
447
448 // The icon with link
449 $theIcon = '<img'.t3lib_iconWorks::skinImg($this->backPath,'gfx/fileicons/'.$icon,'width="18" height="16"').' title="'.htmlspecialchars($theFile['file']).'" alt="" />';
450 if ($this->clickMenus) $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon,$theFile['path'].$theFile['file']);
451
452 // Preparing and getting the data-array
453 $theData = Array();
454 reset($this->fieldArray);
455 while(list(,$field)=each($this->fieldArray)) {
456 switch($field) {
457 case 'size':
458 $theData[$field]=t3lib_div::formatSize($theFile[$field]);
459 break;
460 case 'rw':
461 $theData[$field]= (($theFile['readable'])?'':'<span class="typo3-red"><b>R</b></span>').(($theFile['writable'])?'':'<span class="typo3-red"><b>W</b></span>');
462 break;
463 case 'fileext':
464 $theData[$field]=strtoupper($theFile[$field]);
465 break;
466 case 'tstamp':
467 $theData[$field]=Date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $theFile[$field]);
468 break;
469 case '_CLIPBOARD_':
470 $theData[$field]=$this->makeClip($theFile);
471 break;
472 case 'file':
473 $theData[$field] = $this->linkWrapFile($theFile[$field],$theFile['path'].$theFile['file']);
474 break;
475 default:
476 $theData[$field]=t3lib_div::fixed_lgd($theFile[$field],$this->fixedL);
477 break;
478 }
479 }
480 $out.=$this->addelement(1,$theIcon,$theData);
481
482 // Thumbsnails?
483 if ($this->thumbs && $this->isImage($theFile['fileext'])) {
484 $thumbData=Array();
485 $theFile_R = rawurlencode($theFile['path'].$theFile['file']);
486 $titleCol=$this->fieldArray[0];
487 $href = $this->backPath.$this->thumbScript.'?&dummy='.$GLOBALS['EXEC_TIME'].'&file='.$theFile_R;
488 $thumbData[$titleCol]='<img src="'.htmlspecialchars($href).'" hspace="2" title="'.htmlspecialchars(trim($theFile['file'])).'" alt="" />';
489 $out.=$this->addelement(4,'',$thumbData);
490 }
491 }
492 $this->eCounter++;
493 }
494 }
495 return $out;
496 }
497
498 /**
499 * Returns true if $ext is an image-extension according to $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
500 *
501 * @param string file extension
502 * @return boolean
503 */
504 function isImage($ext) {
505 return t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],strtolower($ext));
506 }
507
508 /**
509 * Wraps the directory-titles ($code) in a link to file_list.php (id=$path) and sorting commands...
510 *
511 * @param string String to be wrapped
512 * @param string ID (path)
513 * @param string Sorting column
514 * @return string HTML
515 */
516 function linkWrapSort($code,$path,$col) {
517 if ($this->sort==$col && !$this->sortRev) { // reverse sorting
518 $params='&SET[sort]='.$col.'&SET[reverse]=1';
519 } else {
520 $params='&SET[sort]='.$col.'&SET[reverse]=0';
521 }
522 $href = $this->script.'?id='.rawurlencode($path).$params;
523 return '<a href="'.htmlspecialchars($href).'">'.$code.'</a>';
524 }
525
526 /**
527 * Returns an array with file/dir items + an array with the sorted items
528 *
529 * @param string Path (absolute) to read
530 * @param string $type is the technical type; file,dir,link. empty is all kinds of stuff.
531 * @param string $extList: List of fileextensions to select. If empty, all are selected.
532 * @return array Array('files'=>array(), 'sorting'=>array());
533 */
534 function readDirectory($path,$type,$extList='') {
535 $items = Array('files'=>array(), 'sorting'=>array());
536 $path = $GLOBALS['SOBE']->basicFF->is_directory($path); // Cleaning name...
537
538 if($path && $GLOBALS['SOBE']->basicFF->checkPathAgainstMounts($path.'/')) {
539 $d = @dir($path);
540 $tempArray=Array();
541 if (is_object($d)) {
542 while($entry=$d->read()) {
543 if ($entry!='.' && $entry!='..') {
544 $wholePath = $path.'/'.$entry; // Because of odd PHP-error where <br />-tag is sometimes placed after a filename!!
545 if (@file_exists($wholePath) && (!$type || t3lib_div::inList($type,filetype($wholePath)))) {
546 if ($extList) {
547 $fI = t3lib_div::split_fileref($entry);
548 if (t3lib_div::inList($extList,$fI['fileext'])) {
549 $tempArray[] = $wholePath;
550 }
551 } else {
552 $tempArray[] = $wholePath;
553 }
554 }
555 }
556 }
557 $d->close();
558 }
559 // Get fileinfo
560 reset($tempArray);
561 while (list(,$val)=each($tempArray)) {
562 $temp = $GLOBALS['SOBE']->basicFF->getTotalFileInfo($val);
563 $items['files'][] = $temp;
564 if ($this->sort) {
565 $items['sorting'][] = strtoupper($temp[$this->sort]);
566 } else {
567 $items['sorting'][] = '';
568 }
569 }
570 // Sort if required
571 if ($this->sort) {
572 if (!$this->sortRev) {
573 asort($items['sorting']);
574 } else {
575 arsort($items['sorting']);
576 }
577 }
578 }
579 return $items;
580 }
581
582 /**
583 * Creates the clipboard control pad
584 *
585 * @param array Array with information about the file/directory for which to make the clipboard panel for the listing.
586 * @return string HTML-table
587 */
588 function makeClip($theData) {
589 $cells=array();
590 $fullIdent = $theData['path'].$theData['file'];
591 $md5=t3lib_div::shortmd5($fullIdent);
592
593 // For normal clipboard, add copy/cut buttons:
594 if ($this->clipObj->current=='normal') {
595 $isSel = $this->clipObj->isSelected('_FILE',$md5);
596 $cells[]='<a href="'.htmlspecialchars($this->clipObj->selUrlFile($fullIdent,1,($isSel=='copy'))).'">'.
597 '<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="" />'.
598 '</a>';
599 $cells[]='<a href="'.htmlspecialchars($this->clipObj->selUrlFile($fullIdent,0,($isSel=='cut'))).'">'.
600 '<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="" />'.
601 '</a>';
602 } else { // For numeric pads, add select checkboxes:
603 $n='_FILE|'.$md5;
604 $this->CBnames[]=$n;
605
606 $checked = ($this->clipObj->isSelected('_FILE',$md5)?' checked="checked"':'');
607 $cells[]='<input type="hidden" name="CBH['.$n.']" value="0" />'.
608 '<input type="checkbox" name="CBC['.$n.']" value="'.htmlspecialchars($fullIdent).'" class="smallCheckboxes"'.$checked.' />';
609 }
610
611 // Display PASTE button, if directory:
612 $elFromTable = $this->clipObj->elFromTable('_FILE');
613 if (@is_dir($fullIdent) && count($elFromTable)) {
614 $cells[]='<a href="'.htmlspecialchars($this->clipObj->pasteUrl('_FILE',$fullIdent)).'" onclick="return '.htmlspecialchars($this->clipObj->confirmMsg('_FILE',$fullIdent,'into',$elFromTable)).'">'.
615 '<img'.t3lib_iconWorks::skinImg('','gfx/clip_pasteinto.gif','width="12" height="12"').' title="'.$GLOBALS['LANG']->getLL('clip_pasteInto',1).'" alt="" />'.
616 '</a>';
617 }
618
619 // Compile items into a DIV-element:
620 return ' <!-- CLIPBOARD PANEL: -->
621 <div class="typo3-clipCtrl">
622 '.implode('
623 ',$cells).'
624 </div>';
625 }
626 }
627
628
629
630 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.file_list.inc']) {
631 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.file_list.inc']);
632 }
633 ?>