/** * Render list of files. * * @param array List of files. See t3lib_div::getFilesInDir * @param string If set a header with a folder icon and folder name are shown * @param boolean Whether to show thumbnails or not. If set, no thumbnails are shown. * @return string HTML output */ function fileList($files, $folderName = '', $noThumbs = 0) { global $LANG, $BACK_PATH; $out = ''; // Listing the files: if (is_array($files)) { // Create headline (showing number of files): $filesCount = count($files); $out .= $this->barheader(sprintf($GLOBALS['LANG']->getLL('files') . ' (%s):', $filesCount)); $out .= $this->getBulkSelector($filesCount); $titleLen = intval($GLOBALS['BE_USER']->uc['titleLen']); // Create the header of current folder: if ($folderName) { $picon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />'; $picon .= htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($folderName), $titleLen)); $out .= $picon . '<br />'; } // Init graphic object for reading file dimensions: $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic'); $imgObj->init(); $imgObj->mayScaleUp = 0; $imgObj->tempPath = PATH_site . $imgObj->tempPath; // Traverse the file list: $lines = array(); foreach ($files as $filepath) { $fI = pathinfo($filepath); // Thumbnail/size generation: if (t3lib_div::inList(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']), strtolower($fI['extension'])) && !$noThumbs) { $imgInfo = $imgObj->getImageDimensions($filepath); $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels'; $clickIcon = t3lib_BEfunc::getThumbNail($BACK_PATH . 'thumbs.php', $filepath, 'hspace="5" vspace="5" border="1"'); } else { $clickIcon = ''; $pDim = ''; } // Create file icon: $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension'])); $size = ' (' . t3lib_div::formatSize(filesize($filepath)) . 'bytes' . ($pDim ? ', ' . $pDim : '') . ')'; $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/fileicons/' . $ficon, 'width="18" height="16"') . ' title="' . htmlspecialchars($fI['basename'] . $size) . '" class="absmiddle" alt="" />'; // Create links for adding the file: if (strstr($filepath, ',') || strstr($filepath, '|')) { // In case an invalid character is in the filepath, display error message: $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'), ', |')); $ATag = $ATag_alt = "<a href=\"#\" onclick=\"alert(" . $eMsg . ");return false;\">"; $bulkCheckBox = ''; } else { // If filename is OK, just add it: $filesIndex = count($this->elements); $this->elements['file_' . $filesIndex] = array('md5' => t3lib_div::shortMD5($filepath), 'type' => 'file', 'fileName' => $fI['basename'], 'filePath' => $filepath, 'fileExt' => $fI['extension'], 'fileIcon' => $ficon); $ATag = "<a href=\"#\" onclick=\"return BrowseLinks.File.insertElement('file_{$filesIndex}');\">"; $ATag_alt = substr($ATag, 0, -4) . ",1);\">"; $bulkCheckBox = '<input type="checkbox" class="typo3-bulk-item" name="file_' . $filesIndex . '" value="0" /> '; } $ATag_e = '</a>'; // Create link to showing details about the file in a window: $Ahref = $BACK_PATH . 'show_item.php?table=' . rawurlencode($filepath) . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')); $ATag2 = '<a href="' . htmlspecialchars($Ahref) . '">'; $ATag2_e = '</a>'; // Combine the stuff: $filenameAndIcon = $bulkCheckBox . $ATag_alt . $icon . htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath), $titleLen)) . $ATag_e; // Show element: if ($pDim) { // Image... $lines[] = ' <tr class="bgColor4"> <td nowrap="nowrap">' . $filenameAndIcon . ' </td> <td>' . $ATag . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $LANG->getLL('addToList', 1) . '" alt="" />' . $ATag_e . '</td> <td nowrap="nowrap">' . ($ATag2 . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $LANG->getLL('info', 1) . '" alt="" /> ' . $LANG->getLL('info', 1) . $ATag2_e) . '</td> <td nowrap="nowrap"> ' . $pDim . '</td> </tr>'; $lines[] = ' <tr> <td colspan="4">' . $ATag_alt . $clickIcon . $ATag_e . '</td> </tr>'; } else { $lines[] = ' <tr class="bgColor4"> <td nowrap="nowrap">' . $filenameAndIcon . ' </td> <td>' . $ATag . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $LANG->getLL('addToList', 1) . '" alt="" />' . $ATag_e . '</td> <td nowrap="nowrap">' . ($ATag2 . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $LANG->getLL('info', 1) . '" alt="" /> ' . $LANG->getLL('info', 1) . $ATag2_e) . '</td> <td> </td> </tr>'; } $lines[] = ' <tr> <td colspan="3"><img src="clear.gif" width="1" height="3" alt="" /></td> </tr>'; } // Wrap all the rows in table tags: $out .= ' <!-- File listing --> <table cellpadding="0" cellspacing="0" id="typo3-fileList"> ' . implode('', $lines) . ' </table>'; } // Return accumulated content for filelisting: return $out; }
/** * Returns single image tag to thumbnail using a thumbnail script (like thumbs.php) * * @param string $theFile must be the proper reference to the file thumbs.php should show * @param string $tparams are additional attributes for the image tag * @param integer $size is the size of the thumbnail send along to "thumbs.php" * @return string Image tag */ function getThumbNail($theFile, $tparams = '', $size = '') { global $BACK_PATH; return t3lib_BEfunc::getThumbNail($this->thumbScript, $theFile, $tparams, $size); }
/** * Print the content on a pad. Called from ->printClipboard() * * @param string Pad reference * @return array Array with table rows for the clipboard. * @access private */ function printContentFromTab($pad) { global $TBE_TEMPLATE; $lines = array(); if (is_array($this->clipData[$pad]['el'])) { foreach ($this->clipData[$pad]['el'] as $k => $v) { if ($v) { list($table, $uid) = explode('|', $k); $bgColClass = $table == '_FILE' && $this->fileMode || $table != '_FILE' && !$this->fileMode ? 'bgColor4-20' : 'bgColor4'; if ($table == '_FILE') { // Rendering files/directories on the clipboard: if (file_exists($v) && t3lib_div::isAllowedAbsPath($v)) { $fI = pathinfo($v); $icon = is_dir($v) ? 'folder.gif' : t3lib_BEfunc::getFileIcon(strtolower($fI['extension'])); $size = ' (' . t3lib_div::formatSize(filesize($v)) . 'bytes)'; $icon = t3lib_iconWorks::getSpriteIconForFile(is_dir($v) ? 'folder' : strtolower($fI['extension']), array('style' => 'margin: 0 20px;', 'title' => htmlspecialchars($fI['basename'] . $size))); $thumb = $this->clipData['_setThumb'] ? t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fI['extension']) ? t3lib_BEfunc::getThumbNail($this->backPath . 'thumbs.php', $v, ' vspace="4"') : '' : ''; $lines[] = ' <tr> <td class="' . $bgColClass . '">' . $icon . '</td> <td class="' . $bgColClass . '" nowrap="nowrap" width="95%"> ' . $this->linkItemText(htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($v), $GLOBALS['BE_USER']->uc['titleLen'])), $v) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . ' ' . ($thumb ? '<br />' . $thumb : '') . '</td> <td class="' . $bgColClass . '" align="center" nowrap="nowrap">' . '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $v . '\', \'\'); return false;') . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a href="' . htmlspecialchars($this->removeUrl('_FILE', t3lib_div::shortmd5($v))) . '#clip_head">' . t3lib_iconWorks::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a>' . '</td> </tr>'; } else { // If the file did not exist (or is illegal) then it is removed from the clipboard immediately: unset($this->clipData[$pad]['el'][$k]); $this->changed = 1; } } else { // Rendering records: $rec = t3lib_BEfunc::getRecordWSOL($table, $uid); if (is_array($rec)) { $lines[] = ' <tr> <td class="' . $bgColClass . '">' . $this->linkItemText(t3lib_iconWorks::getSpriteIconForRecord($table, $rec, array('style' => 'margin: 0 20px;', 'title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($rec, $table)))), $rec, $table) . '</td> <td class="' . $bgColClass . '" nowrap="nowrap" width="95%"> ' . $this->linkItemText(htmlspecialchars(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table, $rec), $GLOBALS['BE_USER']->uc['titleLen'])), $rec, $table) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . ' </td> <td class="' . $bgColClass . '" align="center" nowrap="nowrap">' . '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . intval($uid) . '\'); return false;') . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a href="' . htmlspecialchars($this->removeUrl($table, $uid)) . '#clip_head">' . t3lib_iconWorks::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a>' . '</td> </tr>'; $localizationData = $this->getLocalizations($table, $rec, $bgColClass, $pad); if ($localizationData) { $lines[] = $localizationData; } } else { unset($this->clipData[$pad]['el'][$k]); $this->changed = 1; } } } } } if (!count($lines)) { $lines[] = ' <tr> <td class="bgColor4"><img src="clear.gif" width="56" height="1" alt="" /></td> <td colspan="2" class="bgColor4" nowrap="nowrap" width="95%"> <em>(' . $this->clLabel('clipNoEl') . ')</em> </td> </tr>'; } $this->endClipboard(); return $lines; }
/** * Render display of a Template Object * * @param array Template Object record to render * @param array Array of all Template Objects (passed by reference. From here records are unset) * @param integer Scope of DS * @param boolean If set, the function is asked to render children to template objects (and should not call it self recursively again). * @return string HTML content */ function renderTODisplay($toObj, $scope, $children=0) { // Put together the records icon including content sensitive menu link wrapped around it: $recordIcon = t3lib_iconWorks::getSpriteIconForRecord('tx_templavoila_tmplobj', array(), array('title' => $toObj->getKey())); $recordIcon = $this->doc->wrapClickMenuOnIcon($recordIcon, 'tx_templavoila_tmplobj', $toObj->getKey(), 1, '&callingScriptId='.rawurlencode($this->doc->scriptID)); // Preview icon: if ($toObj->getIcon()) { if (isset($this->modTSconfig['properties']['toPreviewIconThumb']) && $this->modTSconfig['properties']['toPreviewIconThumb'] != '0') { $path = realpath(dirname(__FILE__) . '/' . preg_replace('/\w+\/\.\.\//', '', $GLOBALS['BACK_PATH'] . $toObj->getIcon())); $path = str_replace(realpath(PATH_site) . '/', PATH_site, $path); if($path == FALSE) { $icon = $GLOBALS['LANG']->getLL('noicon', 1); } else { $icon = t3lib_BEfunc::getThumbNail($this->doc->backPath . 'thumbs.php', $path, 'hspace="5" vspace="5" border="1"', strpos($this->modTSconfig['properties']['toPreviewIconThumb'], 'x') ? $this->modTSconfig['properties']['toPreviewIconThumb'] : ''); } } else { $icon = '<img src="' . $this->doc->backPath . $toObj->getIcon() . '" alt="" />'; } } else { $icon = $GLOBALS['LANG']->getLL('noicon', 1); } // Mapping status / link: $linkUrl = '../cm1/index.php?table=tx_templavoila_tmplobj&uid=' . $toObj->getKey() . '&_reload_from=1&id=' . $this->id . '&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')); $fileReference = t3lib_div::getFileAbsFileName($toObj->getFileref()); if (@is_file($fileReference)) { $this->tFileList[$fileReference]++; $fileRef = '<a href="'.htmlspecialchars($this->doc->backPath.'../'.substr($fileReference,strlen(PATH_site))).'" target="_blank">'.htmlspecialchars($toObj->getFileref()).'</a>'; $fileMsg = ''; $fileMtime = filemtime($fileReference); } else { $fileRef = htmlspecialchars($toObj->getFileref()); $fileMsg = '<div class="typo3-red">ERROR: File not found</div>'; $fileMtime = 0; } $mappingStatus = $mappingStatus_index = ''; if ($fileMtime && $toObj->getFilerefMtime()) { if ($toObj->getFilerefMD5() != '') { $modified = (@md5_file($fileReference) != $toObj->getFilerefMD5()); } else { $modified = ($toObj->getFilerefMtime() != $fileMtime); } if ($modified) { $mappingStatus = $mappingStatus_index = t3lib_iconWorks::getSpriteIcon('status-dialog-warning'); $mappingStatus.= sprintf($GLOBALS['LANG']->getLL('towasupdated', 1), t3lib_BEfunc::datetime($toObj->getTstamp())); $this->setErrorLog($scope, 'warning', sprintf($GLOBALS['LANG']->getLL('warning_mappingstatus', 1), $mappingStatus, $toObj->getLabel())); } else { $mappingStatus = $mappingStatus_index = t3lib_iconWorks::getSpriteIcon('status-dialog-ok'); $mappingStatus.= $GLOBALS['LANG']->getLL('mapping_uptodate', 1); } $mappingStatus .= '<br/><input type="button" onclick="jumpToUrl(\'' . htmlspecialchars($linkUrl) . '\');" value="' . $GLOBALS['LANG']->getLL('update_mapping', 1) . '" />'; } elseif (!$fileMtime) { $mappingStatus = $mappingStatus_index = t3lib_iconWorks::getSpriteIcon('status-dialog-error'); $mappingStatus.= $GLOBALS['LANG']->getLL('notmapped', 1); $this->setErrorLog($scope, 'fatal', sprintf($GLOBALS['LANG']->getLL('warning_mappingstatus', 1), $mappingStatus, $toObj->getLabel())); $mappingStatus .= $GLOBALS['LANG']->getLL('updatemapping_info'); $mappingStatus .= '<br/><input type="button" onclick="jumpToUrl(\'' . htmlspecialchars($linkUrl) . '\');" value="' . $GLOBALS['LANG']->getLL('map', 1) . '" />'; } else { $mappingStatus = ''; $mappingStatus .= '<input type="button" onclick="jumpToUrl(\'' . htmlspecialchars($linkUrl) . '\');" value="' . $GLOBALS['LANG']->getLL('remap', 1) . '" />'; $mappingStatus .= ' <input type="button" onclick="jumpToUrl(\'' . htmlspecialchars($linkUrl . '&_preview=1') . '\');" value="' . $GLOBALS['LANG']->getLL('preview', 1) . '" />'; } if ($this->MOD_SETTINGS['set_details']) { $XMLinfo = $this->DSdetails($toObj->getLocalDataprotXML(TRUE)); } // Format XML if requested if ($this->MOD_SETTINGS['set_details']) { if ($toObj->getLocalDataprotXML(TRUE)) { require_once(PATH_t3lib.'class.t3lib_syntaxhl.php'); $hlObj = t3lib_div::makeInstance('t3lib_syntaxhl'); $lpXML = '<pre>'.str_replace(chr(9),' ',$hlObj->highLight_DS($toObj->getLocalDataprotXML(TRUE))).'</pre>'; } else $lpXML = ''; } $lpXML.= '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_tmplobj]['.$toObj->getKey().']=edit&columnsOnly=localprocessing',$this->doc->backPath)).'">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>'; // Compile info table: $tableAttribs = ' border="0" cellpadding="1" cellspacing="1" width="98%" style="margin-top: 3px;" class="lrPadding"'; // Links: $toTitle = '<a href="' . htmlspecialchars($linkUrl) . '">' . htmlspecialchars($GLOBALS['LANG']->sL($toObj->getLabel())) . '</a>'; $editLink = '<a href="#" onclick="'.htmlspecialchars(t3lib_BEfunc::editOnClick('&edit[tx_templavoila_tmplobj]['.$toObj->getKey().']=edit',$this->doc->backPath)).'">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a>'; $fRWTOUres = array(); if (!$children) { if ($this->MOD_SETTINGS['set_details']) { $fRWTOUres = $this->findRecordsWhereTOUsed($toObj,$scope); } $content.=' <table'.$tableAttribs.'> <tr class="bgColor4-20"> <td colspan="3">'. $recordIcon. $toTitle. $editLink. '</td> </tr> <tr class="bgColor4"> <td rowspan="'.($this->MOD_SETTINGS['set_details'] ? 7 : 4).'" style="width: 100px; text-align: center;">'.$icon.'</td> <td style="width:200px;">' . $GLOBALS['LANG']->getLL('filereference', 1) . ':</td> <td>'.$fileRef.$fileMsg.'</td> </tr> <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('description', 1) . ':</td> <td>'.htmlspecialchars($toObj->getDescription()).'</td> </tr> <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('mappingstatus', 1) . ':</td> <td>'.$mappingStatus.'</td> </tr> <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('localprocessing_xml') . ':</td> <td> '.$lpXML.($toObj->getLocalDataprotXML(TRUE) ? t3lib_div::formatSize(strlen($toObj->getLocalDataprotXML(TRUE))).' bytes'. ($this->MOD_SETTINGS['set_details'] ? '<hr/>'.$XMLinfo['HTML'] : '') : '').' </td> </tr>'.($this->MOD_SETTINGS['set_details'] ? ' <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('usedby', 1) . ':</td> <td>'.$fRWTOUres['HTML'].'</td> </tr> <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('created', 1) . ':</td> <td>' . t3lib_BEfunc::datetime($toObj->getCrdate()) . ' ' . $GLOBALS['LANG']->getLL('byuser', 1) . ' [' . $toObj->getCruser() . ']</td> </tr> <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('updated', 1) . ':</td> <td>'.t3lib_BEfunc::datetime($toObj->getTstamp()).'</td> </tr>' : '').' </table> '; } else { $content.=' <table'.$tableAttribs.'> <tr class="bgColor4-20"> <td colspan="3">'. $recordIcon. $toTitle. $editLink. '</td> </tr> <tr class="bgColor4"> <td style="width:200px;">' . $GLOBALS['LANG']->getLL('filereference', 1) . ':</td> <td>'.$fileRef.$fileMsg.'</td> </tr> <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('mappingstatus', 1) . ':</td> <td>'.$mappingStatus.'</td> </tr> <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('rendertype', 1) . ':</td> <td>' . $this->getProcessedValue('tx_templavoila_tmplobj', 'rendertype', $toObj->getRendertype()) . '</td> </tr> <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('language', 1) . ':</td> <td>' . $this->getProcessedValue('tx_templavoila_tmplobj', 'sys_language_uid', $toObj->getSyslang()) . '</td> </tr> <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('localprocessing_xml') . ':</td> <td> '.$lpXML.($toObj->getLocalDataprotXML(TRUE) ? t3lib_div::formatSize(strlen($toObj->getLocalDataprotXML(TRUE))).' bytes'. ($this->MOD_SETTINGS['set_details'] ? '<hr/>'.$XMLinfo['HTML'] : '') : '').' </td> </tr>'.($this->MOD_SETTINGS['set_details'] ? ' <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('created', 1) . ':</td> <td>'.t3lib_BEfunc::datetime($toObj->getCrdate()) . ' ' . $GLOBALS['LANG']->getLL('byuser', 1) . ' [' . $toObj->getCruser() . ']</td> </tr> <tr class="bgColor4"> <td>' . $GLOBALS['LANG']->getLL('updated', 1) . ':</td> <td>'.t3lib_BEfunc::datetime($toObj->getTstamp()).'</td> </tr>' : '').' </table> '; } // Traverse template objects which are not children of anything: if(!$childRen) { $toRepo = t3lib_div::makeInstance('tx_templavoila_templateRepository'); $toChildren = $toRepo->getTemplatesByParentTemplate($toObj); } else { $toChildren = array(); } if (!$children && count($toChildren)) { $TOchildrenContent = ''; foreach($toChildren as $toChild) { $rTODres = $this->renderTODisplay($toChild, $scope, 1); $TOchildrenContent.= $rTODres['HTML']; } $content.='<div style="margin-left: 102px;">'.$TOchildrenContent.'</div>'; } // Return content return array('HTML' => $content, 'mappingStatus' => $mappingStatus_index, 'usage' => $fRWTOUres['usage']); }
function getThumbNail($imagerow, $filepath = '../uploads/pics/') { file_exists(PATH_site . 'uploads/tx_templavoila/' . $imagerow) ? $filepath = '../uploads/tx_templavoila/' : ''; $BE_func = new t3lib_BEfunc(); foreach (explode(',', $imagerow) as $src) { if (file_exists(PATH_site . 'uploads/media/' . $src)) { $output .= $this->getPagename($src) . '<hr />'; } elseif (file_exists(PATH_typo3conf . $filepath . $src)) { $imgFile = PATH_typo3conf . $filepath . $src; $data = str_replace(urlencode(PATH_typo3conf), '', str_replace(PATH_typo3, t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'typo3/', $BE_func->getThumbNail(PATH_typo3 . 'thumbs.php', $imgFile, '', '100x100'))); $output .= str_replace('<img', '<img style="margin:2px 2px 2px 1px;border:1px solid;"', $data); } } return $output; }
/** * @param [type] $expandFolder: ... * @param [type] $plainFlag: ... * @return [type] ... */ function expandFolder($expandFolder = 0, $plainFlag = 0, $noThumbs = 0) { global $LANG; $expandFolder = $expandFolder ? $expandFolder : t3lib_div::_GP("expandFolder"); $out = ""; $resolutionLimit_x = $this->thisConfig['typo3filemanager.']['maxPlainImages.']['width']; $resolutionLimit_y = $this->thisConfig['typo3filemanager.']['maxPlainImages.']['height']; if ($expandFolder) { $files = t3lib_div::getFilesInDir($expandFolder, $plainFlag ? "jpg,jpeg,gif,png" : $GLOBALS["TYPO3_CONF_VARS"]["GFX"]["imagefile_ext"], 1, 1); // $extensionList="",$prependPath=0,$order="") if (is_array($files)) { reset($files); $titleLen = intval($GLOBALS["BE_USER"]->uc["titleLen"]); $picon = '<img src="' . $this->doc->backPath . 'gfx/i/_icon_webfolders.gif" width="18" height="16" alt="folder" />'; $picon .= htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder), $titleLen)); $out .= '<span class="nobr">' . $picon . '</span><br />'; $imgObj = t3lib_div::makeInstance("t3lib_stdGraphic"); $imgObj->init(); $imgObj->mayScaleUp = 0; $imgObj->tempPath = PATH_site . $imgObj->tempPath; $lines = array(); while (list(, $filepath) = each($files)) { $fI = pathinfo($filepath); //$iurl = $this->siteUrl.t3lib_div::rawUrlEncodeFP(substr($filepath,strlen(PATH_site))); $iurl = t3lib_div::rawUrlEncodeFP(substr($filepath, strlen(PATH_site))); $imgInfo = $imgObj->getImageDimensions($filepath); $icon = t3lib_BEfunc::getFileIcon(strtolower($fI["extension"])); $pDim = $imgInfo[0] . "x" . $imgInfo[1] . " pixels"; $size = " (" . t3lib_div::formatSize(filesize($filepath)) . "bytes, " . $pDim . ")"; $icon = '<img src="' . $this->doc->backPath . 'gfx/fileicons/' . $icon . '" style="width: 18px; height: 16px; border: none;" title="' . $fI["basename"] . $size . '" class="absmiddle" alt="' . $icon . '" />'; if (!$plainFlag) { $ATag = '<a href="#" onclick="return jumpToUrl(\'?insertMagicImage=' . rawurlencode($filepath) . '\');">'; } else { $ATag = '<a href="#" onclick="return insertImage(\'' . $iurl . '\',' . $imgInfo[0] . ',' . $imgInfo[1] . ');">'; } $ATag_e = "</a>"; if ($plainFlag && ($imgInfo[0] > $resolutionLimit_x || $imgInfo[1] > $resolutionLimit_y)) { $ATag = ""; $ATag_e = ""; $ATag2 = ""; $ATag2_e = ""; } else { $ATag2 = '<a href="#" onclick="launchView(\'' . rawurlencode($filepath) . '\'); return false;">'; $ATag2_e = "</a>"; } $filenameAndIcon = $ATag . $icon . htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath), $titleLen)) . $ATag_e; $lines[] = '<tr class="bgColor4"><td nowrap="nowrap">' . $filenameAndIcon . ' </td></tr><tr><td nowrap="nowrap" class="pixel">' . $pDim . ' </td></tr>'; $lines[] = '<tr><td>' . ($noThumbs ? "" : $ATag2 . t3lib_BEfunc::getThumbNail($this->doc->backPath . 'thumbs.php', $filepath, 'hspace="5" vspace="5" border="1"', $this->thisConfig['typo3filemanager.']['thumbs.']['width'] . 'x' . $this->thisConfig['typo3filemanager.']['thumbs.']['height']) . $ATag2_e) . '</td></tr>'; $lines[] = '<tr><td><img src="clear.gif" style="width: 1px; height: 3px;" alt="clear" /></td></tr>'; } $out .= '<table border="0" cellpadding="0" cellspacing="1">' . implode("", $lines) . '</table>'; } } return $out; }
/** * Returns rendered previewer * * @param array $row Meta data array * @param integer $size The maximum size of the previewer * @param string $type The wanted previewer type * @param array $conf Additional configuration values. Might be empty. * @return array True if this is the right previewer for the file */ function render($row, $size, $type, $conf = array()) { $outArr = array('htmlCode' => '', 'headerCode' => ''); $absFile = tx_dam::file_absolutePath($row['file_path'] . $row['file_name']); if ($row['hpixels'] > 160 or $row['vpixels'] > 160) { $width = $row['hpixels'] > 160 ? 160 : $row['hpixels']; $height = intval($row['vpixels'] * $width / $row['hpixels']); if ($height > 160) { $height = 160; $width = intval($row['hpixels'] * $height / $row['vpixels']); } $widthZoom = $width * 2; $widthZoom = $row['hpixels'] > $widthZoom ? $widthZoom : $row['hpixels']; $margin = 4; $diaPadding = 9; $outArr['headerCode'] = ' <style type="text/css"> /* Photo-Zoom */ /* MSIE z-index work-a-round */ /* reversing natural z-index */ .txdamPZWrapper { position:relative; z-index:900; } /* Mozilla z-index bliss */ .txdamPZWrapper a { z-index:0; } .txdamPZWrapper a:hover { position:absolute; z-index:900; } .txdamPZWrapper .txdamPZ { position:relative; } .txdamPZWrapper .txdamPZ a:hover { border:0; background:none; text-decoration:none; } .txdamPZ a { position:absolute; cursor:default; } .txdamPZ img { align: left; width:' . $width . 'px; height:' . $height . 'px; } /* ZoomOpen Positions */ .txdamPZ a:hover,.txdamPZ a:hover img { width:' . $widthZoom . 'px; height:auto;} .txdamPZWrapper .txdamPZ a:hover { left:-' . ($widthZoom - $width) . 'px; } /*MSIE-specific*/ .txdamPZWrapper>.txdamPZ a:hover { left:-' . ($widthZoom - $width) . 'px; } /*Mozilla-specific*/ /* End Photo-Zoom */ .txdamPZ img { padding:8px; background-color:#fff; border:solid #888 1px; } </style> '; $outArr['htmlCode'] = ' <!-- start Photo-Zoom code --> <div class="txdamPZDummy" style="height:' . ($height + $diaPadding + $diaPadding + $margin + $margin) . 'px; width:' . ($width + $diaPadding + $diaPadding + $margin + $margin) . 'px; "></div> <div class="txdamPZWrapper" style="text-align:left;top:-' . ($height + $diaPadding) . 'px; margin-left:' . $margin . 'px; margin-top:-1em; "> <p class="txdamPZ" > <a href="javascript:void(0)">' . t3lib_BEfunc::getThumbNail('thumbs.php', $absFile, '', $widthZoom) . '</a> </p> </div> <br /> <!-- end Photo-Zoom code --> '; } else { $outArr['htmlCode'] = '<div class="previewThumb">' . t3lib_BEfunc::getThumbNail('thumbs.php', $absFile, ' align="middle" style="border:solid 1px #ccc;"', 160) . '</div>'; } return $outArr; }
/** * @param [type] $expandFolder: ... * @param [type] $plainFlag: ... * @return [type] ... */ function expandFolder($expandFolder = 0, $plainFlag = 0, $noThumbs = 0) { global $LANG, $BE_USER, $BACK_PATH; $expandFolder = $expandFolder ? $expandFolder : t3lib_div::_GP('expandFolder'); $out = ''; if ($expandFolder && $this->checkFolder($expandFolder)) { $files = t3lib_div::getFilesInDir($expandFolder, $plainFlag ? 'jpg,jpeg,gif,png' : $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], 1, 1); // $extensionList="",$prependPath=0,$order="") if (is_array($files)) { $out .= $this->barheader(sprintf($LANG->getLL('images') . ' (%s):', count($files))); $titleLen = intval($BE_USER->uc['titleLen']); $picon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />'; $picon .= htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder), $titleLen)); $out .= '<span class="nobr">' . $picon . '</span><br />'; $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic'); $imgObj->init(); $imgObj->mayScaleUp = 0; $imgObj->tempPath = PATH_site . $imgObj->tempPath; $lines = array(); foreach ($files as $filepath) { $fI = pathinfo($filepath); $origFile = t3lib_div::rawUrlEncodeFP(substr($filepath, strlen(PATH_site))); $iurl = $this->siteURL . $origFile; $imgInfo = $imgObj->getImageDimensions($filepath); // File icon: $icon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension'])); $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' ' . $LANG->getLL('pixels', 1); $size = ' (' . t3lib_div::formatSize(filesize($filepath)) . $LANG->getLL('bytes', 1) . ', ' . $pDim . ')'; $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/fileicons/' . $icon . '', 'width="18" height="16"') . ' title="' . htmlspecialchars($fI['basename'] . $size) . '" alt="" />'; $ATag = '<a href="#" onclick="return jumpToUrl(\'?editorNo=' . $this->editorNo . '&insertImage=' . rawurlencode($filepath) . '\');">'; $ATag_e = '</a>'; if ($plainFlag && ($imgInfo[0] > $this->plainMaxWidth || $imgInfo[1] > $this->plainMaxHeight)) { $ATag = ''; $ATag_e = ''; $ATag2 = ''; $ATag2_e = ''; } else { $ATag2 = '<a href="#" onClick="launchView(\'' . rawurlencode($filepath) . '\'); return false;">'; $ATag2_e = '</a>'; } $filenameAndIcon = $ATag . $icon . htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath), $titleLen)) . $ATag_e; $lines[] = '<tr class="bgColor4"><td nowrap="nowrap">' . $filenameAndIcon . ' </td><td nowrap="nowrap">' . $pDim . ' </td></tr>'; $lines[] = '<tr><td colspan="2">' . ($noThumbs ? '' : $ATag2 . t3lib_BEfunc::getThumbNail($this->doc->backPath . 'thumbs.php', $filepath, 'hspace="5" vspace="5" border="1"') . $ATag2_e) . '</td></tr>'; $lines[] = '<tr><td colspan="2"><img src="clear.gif" width="1" height="3"></td></tr>'; } $out .= '<table border="0" cellpadding="0" cellspacing="1">' . implode('', $lines) . '</table>'; } } return $out; }
/** * Render list of files. * * @param array List of files. See t3lib_div::getFilesInDir * @param string $mode EB mode: "db", "file", ... * @return string HTML output */ function renderFileList($files, $mode = 'file') { global $LANG, $BACK_PATH, $BE_USER, $TYPO3_CONF_VARS; $out = ''; // Listing the files: if (is_array($files) and count($files)) { $displayThumbs = $this->displayThumbs(); $displayImage = $this->act === 'dragdrop'; // Traverse the file list: $lines = array(); foreach ($files as $fI) { if (!$fI['__exists']) { continue; } // Create file icon: $titleAttrib = tx_dam_guiFunc::icon_getTitleAttribute($fI); $iconFile = tx_dam::icon_getFileType($fI); $iconTag = tx_dam_guiFunc::icon_getFileTypeImgTag($fI); $iconAndFilename = $iconTag . htmlspecialchars(t3lib_div::fixed_lgd_cs($fI['file_title'], $BE_USER->uc['titleLen'])); // Create links for adding the file: if (strstr($fI['file_name_absolute'], ',') || strstr($fI['file_name_absolute'], '|')) { // In case an invalid character is in the filepath, display error message: $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'), ', |')); $ATag_insert = '<a href="#" onclick="alert(' . $eMsg . ');return false;">'; // If filename is OK, just add it: } else { // JS: insertElement(table, uid, type, filename, fpath, filetype, imagefile ,action, close) $onClick_params = implode(', ', array("'" . $fI['_ref_table'] . "'", "'" . $fI['_ref_id'] . "'", "'" . $mode . "'", $this->quoteJSvalue($fI['file_name']), $this->quoteJSvalue($fI['_ref_file_path']), "'" . $fI['file_type'] . "'", "'" . $iconFile . "'")); $onClick = 'return insertElement(' . $onClick_params . ');'; $ATag_add = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>'; $onClick = 'return insertElement(' . $onClick_params . ', \'\', 1);'; $ATag_insert = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>'; } // Create link to showing details about the file in a window: if ($fI['__exists']) { $Ahref = $BACK_PATH . 'show_item.php?table=' . rawurlencode($fI['file_name_absolute']) . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI')); $ATag_info = '<a href="' . htmlspecialchars($Ahref) . '">'; $info = $ATag_info . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $LANG->getLL('info', 1) . '" alt="" /> ' . $LANG->getLL('info', 1) . '</a>'; } else { $info = ' '; } // Thumbnail/size generation: $clickThumb = ''; if (t3lib_div::inList($TYPO3_CONF_VARS['GFX']['imagefile_ext'], $fI['file_type']) and $displayThumbs and is_file($fI['file_name_absolute'])) { $clickThumb = t3lib_BEfunc::getThumbNail($BACK_PATH . 'thumbs.php', $fI['file_path_absolute'] . $fI['file_name'], ''); $clickThumb = '<div style="width:56px; overflow:auto; padding: 5px; background-color:#fff; border:solid 1px #ccc;">' . $ATag_insert . $clickThumb . '</a>' . '</div>'; } elseif ($displayThumbs) { $clickThumb = '<div style="width:68px"></div>'; } // Drag & drop image if ($displayImage and t3lib_div::inList($TYPO3_CONF_VARS['GFX']['imagefile_ext'], $fI['file_type']) and is_file($fI['file_name_absolute'])) { if (t3lib_div::_GP('noLimit')) { $maxW = 10000; $maxH = 10000; } else { $maxW = 380; $maxH = 500; } $IW = $fI['hpixels']; $IH = $fI['vpixels']; if ($IW > $maxW) { $IH = ceil($IH / $IW * $maxW); $IW = $maxW; } if ($IH > $maxH) { $IW = ceil($IW / $IH * $maxH); $IH = $maxH; } $clickThumb = '<img src="' . $this->siteUrl . substr($fI['file_name_absolute'], strlen(PATH_site)) . '" width="' . $IW . '" height="' . $IH . '"' . ($this->defaultClass ? ' class="' . $this->defaultClass . '"' : '') . ' alt="' . $fI['alt_text'] . '" title="' . $fI[$this->imgTitleDAMColumn] . '" />'; $clickThumb = '<div style="width:380px; overflow:auto; padding: 5px; background-color:#fff; border:solid 1px #ccc;">' . $clickThumb . '</div>'; } // Show element: $lines[] = ' <tr class="bgColor4"> <td valign="top" nowrap="nowrap" style="min-width:20em">' . ($displayImage ? '' : $ATag_insert) . $iconAndFilename . '</a>' . ' </td> <td valign="top" width="1%">' . ($displayImage ? '' : $ATag_add) . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $LANG->getLL('addToList', 1) . '" alt="" /></a></td> <td valign="top" nowrap="nowrap" width="1%">' . $info . '</td> </tr>'; $infoText = ''; if ($this->getModSettings('extendedInfo')) { $infoText = tx_dam_guiFunc::meta_compileInfoData($fI, 'file_name, file_size:filesize, _dimensions, caption:truncate:50, instructions', 'table'); $infoText = str_replace('<table>', '<table border="0" cellpadding="0" cellspacing="1">', $infoText); $infoText = str_replace('<strong>', '<strong style="font-weight:normal;">', $infoText); $infoText = str_replace('</td><td>', '</td><td class="bgColor-10">', $infoText); } if ($displayThumbs || $displayImage and $infoText) { $lines[] = ' <tr class="bgColor"> <td valign="top" colspan="3"> <table border="0" cellpadding="0" cellspacing="0"><tr> <td valign="top">' . $clickThumb . '</td> <td valign="top" style="padding-left:1em">' . $infoText . '</td></tr> </table> <div style="height:0.5em;"></div> </td> </tr>'; } elseif ($clickThumb or $infoText) { $lines[] = ' <tr class="bgColor"> <td valign="top" colspan="3" style="padding-left:22px"> ' . $clickThumb . $infoText . ' <div style="height:0.5em;"></div> </td> </tr>'; } $lines[] = ' <tr> <td colspan="3"><div style="height:0.5em;"></div></td> </tr>'; } // Wrap all the rows in table tags: $out .= ' <!-- File listing --> <table cellpadding="0" cellspacing="0" id="typo3-fileList"> ' . implode('', $lines) . ' </table>'; } // Return accumulated content for filelisting: return $out; }
/** * Main function for TCEforms wizard. * * @param array Parameter array for "userFunc" wizard type * @param object Parent object * @return string HTML for the wizard. */ function main($PA, $pObj) { // Detect proper LR file source: $this->setLRfile($PA); // Load Lorem Ipsum sources from text file: $this->loadLoremIpsumArray(); switch ($PA['params']['type']) { case 'title': case 'header': case 'description': case 'word': case 'paragraph': case 'loremipsum': $onclick = $this->getHeaderTitleJS("document." . $PA['formName'] . "['" . $PA['itemName'] . "'].value", $PA['params']['type'], $PA['params']['endSequence'], $PA['params']['add'], t3lib_div::intInRange($PA['params']['count'], 2, 100, 10), "document." . $PA['formName'] . "['" . $PA['itemName'] . "']") . ';' . implode('', $PA['fieldChangeFunc']) . 'return false;'; $output .= '<a href="#" onclick="' . htmlspecialchars($onclick) . '">' . $this->getIcon($PA['params']['type'], $this->backPath) . '</a>'; break; case 'images': $ordA = ord('a'); $extPath = t3lib_extMgm::extPath('lorem_ipsum'); $this->extConfDummy = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['rzdummyimage']); $store_path = $this->extConfDummy['storePath']; if ($store_path == '') { $store_path = 'fileadmin/user_upload/rzdummyimage'; } $extPath2 = PATH_site . $store_path . '/'; $dh = opendir($extPath2); while (false !== ($filename = readdir($dh))) { if ($filename != "." && $filename != "..") { $files[] = $filename; } } $tRows = array(); $i = 0; $rowsNum = ceil(count($files) / 7); for ($a = 0; $a < $rowsNum; $a++) { //foreach ($files as $f) { $tCells = array(); $tdAttrib = array(); for ($b = 0; $b < 7; $b++) { //$absfile = $extPath.'images/'.chr($ordA+$a).($b+1).'.jpg'; $absfile = $extPath2 . $files[$i]; $i++; if (!is_file($absfile)) { $tCells[] .= ''; $tdAttrib[] = ' style="width: 56px;" align="center"'; continue; } else { $tdAttrib[] = ' style="width: 56px;" align="center" bgcolor="#cccccc"'; } $onclick = "setFormValueFromBrowseWin('" . $PA['itemName'] . "',unescape('" . rawurlencode($absfile) . "'),unescape('" . rawurlencode(basename($absfile)) . "')); return false;"; $tCells[] .= '<a href="#" onclick="' . htmlspecialchars($onclick) . '">' . t3lib_BEfunc::getThumbNail('thumbs.php', $absfile) . '</a>'; } $tRowsTemp = '<tr>'; foreach ($tCells as $key => $tCell) { $tRowsTemp .= '<td' . $tdAttrib[$key] . '>' . $tCell . '</td>'; } $tRowsTemp .= '</tr>'; $tRows[] = $tRowsTemp; /*$tRows[] = ' <tr> <td' . $tdAttrib . '> ' . implode('</td><td' . $tdAttrib . '>', $tCells) . ' </td> </tr>';*/ } $output = ' <table border="0" cellpadding="2" cellspacing="2" style="border: 1px solid black; margin-top: 5px; margin-bottom: 15px;"> <tr><td colspan="7" bgcolor="#aaaaaa"><b>Click a dummy image to select it:</b></td></tr> ' . implode('', $tRows) . ' </table>'; break; } return $output; }
function int_buildImageListForm2($imageArray, $pathArray) { $html = '<input name="ie_chooseImage" type="hidden" value="' . $this->curImageID . '" />'; for ($i = 0; $i < count($imageArray); $i++) { $imgPath = '../' . $pathArray[$i] . $imageArray[$i]; $image = t3lib_BEfunc::getThumbNail('thumbs.php', $imgPath, '', $this->config['menu']['showThumbnail_size']); $size = getimagesize($imgPath); $btn = '<button name="ie_chooseImage" class="' . ($this->curImageID == $i ? 'active' : '') . '" value="' . $i . '" onChange="document.getElementsByName(\'editform\')[0].submit();">' . ($this->config['menu']['showThumbnail'] == 1 ? '<div class="thumbnail">' . $image . '</div>' : '') . ($this->config['menu']['showImageName'] == 1 ? '<div class="thumbnail_text">' . $imageArray[$i] . '</div>' : '') . ($this->config['menu']['showResolution'] == 1 ? '<div class="size">' . $size[0] . 'x' . $size[1] . '</div>' : '') . '</button><br />'; $html .= $btn; } return '<br />' . $html; }