Fixed bug #17211: Thumbnails in TCEforms have broken clickMenu
authorJigal van Hemert <jigal@xs4all.nl>
Sat, 22 Jan 2011 17:13:42 +0000 (17:13 +0000)
committerJigal van Hemert <jigal@xs4all.nl>
Sat, 22 Jan 2011 17:13:42 +0000 (17:13 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@10256 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_befunc.php
t3lib/class.t3lib_tceforms.php

index 6a2ffa2..c09ca52 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-01-22  Jigal van Hemert  <jigal@xs4all.nl>
+
+       * Fixed bug #17211: Thumbnails in TCEforms have broken clickMenu
+
 2011-01-22  Ingo Renner  <ingo@typo3.org>
 
        * Fixed incorrect english label for table tt_content from "Pagecontent" to "Page Content"
index de5deea..1839cce 100644 (file)
@@ -1907,9 +1907,23 @@ final class t3lib_BEfunc {
                                        $onClick = 'top.launchView(\'' . $theFile . '\',\'\',\'' . $backPath . '\');return false;';
                                        $thumbData .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '"><img src="' . htmlspecialchars($backPath . $url) . '" hspace="2" border="0" title="' . trim($theFile) . '"' . $tparams . ' alt="" /></a> ';
                                } else {
-                                       $icon = self::getFileIcon($ext);
-                                       $url = 'gfx/fileicons/' . $icon;
-                                       $thumbData .= '<img src="' . $backPath . $url . '" hspace="2" border="0" title="' . trim($theFile) . '"' . $tparams . ' alt="" /> ';
+                                               // Icon
+                                       $theFile_abs = PATH_site . ($uploaddir ? $uploaddir . '/' : '') . trim($theFile);
+                                       $theFile = ($abs ? '' : '../') . ($uploaddir ? $uploaddir . '/' : '') . trim($theFile);
+
+                                       $fileIcon = t3lib_iconWorks::getSpriteIconForFile(
+                                               strtolower($ext),
+                                               array('title' => htmlspecialchars(trim($theFile)))
+                                       );
+
+                                       $check = basename($theFile_abs) . ':' . filemtime($theFile_abs) . ':' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'];
+                                       $params = '&file=' . rawurlencode($theFile);
+                                       $params .= $size ? '&size=' . $size : '';
+                                       $params .= '&md5sum=' . t3lib_div::shortMD5($check);
+
+                                       $url = $thumbScript . '?&dummy=' . $GLOBALS['EXEC_TIME'] . $params;
+                                       $onClick = 'top.launchView(\'' . $theFile . '\',\'\',\'' . $backPath . '\');return false;';
+                                       $thumbData .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $fileIcon . '</a> ';
                                }
                        }
                }
index c7ef2e2..6436796 100644 (file)
@@ -2226,25 +2226,7 @@ class t3lib_TCEforms {
                                                $rowCopy = array();
                                                $rowCopy[$field] = $imgPath;
 
-                                                       // Icon + clickmenu:
-                                               $absFilePath = t3lib_div::getFileAbsFileName($config['uploadfolder'] ? $config['uploadfolder'] . '/' . $imgPath : $imgPath);
-
-                                               $fI = pathinfo($imgPath);
-                                               $fileIcon = t3lib_iconWorks::getSpriteIconForFile(
-                                                       strtolower($fI['extension']),
-                                                       array(
-                                                                'title' => htmlspecialchars(
-                                                                        $fI['basename'] .
-                                                                        ($absFilePath && @is_file($absFilePath)
-                                                                                        ? ' (' . t3lib_div::formatSize(filesize($absFilePath)) . 'bytes)' :
-                                                                                        ' - FILE NOT FOUND!'
-                                                                        )
-                                                                )
-                                                       )
-                                               );
-
                                                $imgs[] = '<span class="nobr">' . t3lib_BEfunc::thumbCode($rowCopy, $table, $field, $this->backPath, 'thumbs.php', $config['uploadfolder'], 0, ' align="middle"') .
-                                                                 ($absFilePath ? $this->getClickMenu($fileIcon, $absFilePath) : $fileIcon) .
                                                                  $imgPath .
                                                                  '</span>';
                                        }