📄 class.tx_rtehtmlarea_dam_browse_media.php
字号:
// Create link to showing details about the file in a window: if ($fI['__exists']) { $Ahref = $GLOBALS['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($GLOBALS['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($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fI['file_type']) AND $displayThumbs AND is_file($fI['file_name_absolute'])) {// adding $GLOBALS['BACK_PATH'] $clickThumb = t3lib_BEfunc::getThumbNail($GLOBALS['BACK_PATH'].'thumbs.php', $fI['file_path_absolute'].$fI['file_name'], '');// adding $GLOBALS['BACK_PATH'] $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>'; } // Show element: $lines[] = ' <tr class="bgColor4"> <td valign="top" nowrap="nowrap" style="min-width:20em">'.$ATag_insert.$iconAndFilename.'</a>'.' </td> <td valign="top" width="1%">'.$ATag_add.'<img'.t3lib_iconWorks::skinImg($GLOBALS['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 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 border="0" cellpadding="1" cellspacing="1" id="typo3-fileList"> '.implode('',$lines).' </table>'; } // Return accumulated content for filelisting: return $out; } /** * Makes a DAM db query and collects data to be used in EB display * * @param string $allowedFileTypes Comma list of allowed file types * @param string $disallowedFileTypes Comma list of disallowed file types * @param string $mode EB mode: "db", "file", ... * @return array Array of file elements */ function getFileListArr($allowedFileTypes, $disallowedFileTypes, $mode) { global $TYPO3_CONF_VARS; $filearray = array(); // // Use the current selection to create a query and count selected records // $this->damSC->selection->addSelectionToQuery(); $this->damSC->selection->qg->query['FROM']['tx_dam'] = tx_dam_db::getMetaInfoFieldList(true, array('hpixels','vpixels','caption')); #$this->damSC->selection->qg->addSelectFields(... if ($allowedFileTypes) { $extList = '"'.implode ('","', explode(',',$allowedFileTypes)).'"'; $this->damSC->selection->qg->addWhere('AND tx_dam.file_type IN ('.$extList.')', 'WHERE', 'tx_dam.file_type'); } if ($disallowedFileTypes) { $extList = '"'.implode ('","', explode(',',$disallowedFileTypes)).'"'; $this->damSC->selection->qg->addWhere('AND NOT tx_dam.file_type IN ('.$extList.')', 'WHERE', 'NOT tx_dam.file_type'); }// selection with limited dimensions if ($this->act == 'plain') { $this->damSC->selection->qg->addWhere('AND tx_dam.hpixels <= '.intval($this->plainMaxWidth), 'WHERE', 'tx_dam.hpixels'); $this->damSC->selection->qg->addWhere('AND tx_dam.vpixels <= '.intval($this->plainMaxHeight), 'WHERE', 'tx_dam.vpixels'); }// selection with limited dimensions $this->damSC->selection->execSelectionQuery(TRUE); // any records found? if($this->damSC->selection->pointer->countTotal) { // limit query for browsing $this->damSC->selection->addLimitToQuery(); $this->damSC->selection->execSelectionQuery(); if($this->damSC->selection->res) { while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($this->damSC->selection->res)) { $row['file_title'] = $row['title'] ? $row['title'] : $row['file_name']; $row['file_path_absolute'] = tx_dam::path_makeAbsolute($row['file_path']); $row['file_name_absolute'] = $row['file_path_absolute'].$row['file_name']; $row['__exists'] = @is_file($row['file_name_absolute']); if ($mode=='db') { $row['_ref_table'] = 'tx_dam'; $row['_ref_id'] = $row['uid']; $row['_ref_file_path'] = ''; } else { $row['_ref_table'] = ''; $row['_ref_id'] = t3lib_div::shortMD5($row['file_name_absolute']); $row['_ref_file_path'] = $row['file_name_absolute']; } $filearray[] = $row; if (count($filearray) >= $this->damSC->selection->pointer->itemsPerPage) { break; } } } } return $filearray; } /** * [Describe function...] * * @return [type] ... */ function main_rte() { global $LANG, $TYPO3_CONF_VARS, $FILEMOUNTS, $BE_USER; $path = tx_dam::path_makeAbsolute($this->damSC->path); if (!$path OR !@is_dir($path)) { $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions'); $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']); $path = $fileProcessor->findTempFolder().'/'; // The closest TEMP-path is found } $this->damSC->path = tx_dam::path_makeRelative($path); // mabe not needed // Starting content: $this->content = $this->doc->startPage($LANG->getLL('Insert Image',1)); $this->reinitParams(); // Making menu in top: $menuDef = array(); if (in_array('image',$this->allowedItems) && ($this->act=='image' || t3lib_div::_GP('cWidth'))) { $menuDef['page']['isActive'] = $this->act=='image'; $menuDef['page']['label'] = $LANG->getLL('currentImage',1); $menuDef['page']['url'] = '#'; $menuDef['page']['addParams'] = 'onClick="jumpToUrl(\''.htmlspecialchars($this->thisScript.'?act=image&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"'; } if (in_array('magic',$this->allowedItems)){ $menuDef['file']['isActive'] = $this->act=='magic'; $menuDef['file']['label'] = $LANG->getLL('magicImage',1); $menuDef['file']['url'] = '#'; $menuDef['file']['addParams'] = 'onClick="jumpToUrl(\''.htmlspecialchars($this->thisScript.'?act=magic&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"'; } if (in_array('plain',$this->allowedItems)) { $menuDef['url']['isActive'] = $this->act=='plain'; $menuDef['url']['label'] = $LANG->getLL('plainImage',1); $menuDef['url']['url'] = '#'; $menuDef['url']['addParams'] = 'onClick="jumpToUrl(\''.htmlspecialchars($this->thisScript.'?act=plain&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"'; } if (in_array('dragdrop',$this->allowedItems)) { $menuDef['mail']['isActive'] = $this->act=='dragdrop'; $menuDef['mail']['label'] = $LANG->getLL('dragDropImage',1); $menuDef['mail']['url'] = '#'; $menuDef['mail']['addParams'] = 'onClick="openDragDrop();return false;"'; } if (in_array('upload', $this->allowedItems)) { $menuDef['upload']['isActive'] = ($this->act=='upload'); $menuDef['upload']['label'] = $LANG->getLL('tx_dam_file_upload.title',1); $menuDef['upload']['url'] = '#'; $menuDef['upload']['addParams'] = 'onclick="jumpToUrl(\''.htmlspecialchars($this->thisScript.'?act=upload&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"'; } $this->content .= $this->doc->getTabMenuRaw($menuDef); switch($this->act) { case 'image': $JScode = ' document.write(printCurrentImageOptions()); insertImagePropertiesInForm();'; $this->content.= '<br />'.$this->doc->wrapScriptTags($JScode); break; case 'upload': $this->content.= $this->dam_upload($this->allowedFileTypes, $this->disallowedFileTypes); $this->content.= $this->damSC->getOptions(); $this->content.='<br /><br />'; if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB')) { $this->content.= $this->createFolder($path); $this->content.= '<br />'; } break; case 'plain': $this->allowedFileTypes = 'jpg,jpeg,gif,png'; case 'magic': $this->addDisplayOptions(); $this->content.= $this->dam_select($this->allowedFileTypes, $this->disallowedFileTypes); $this->content.= $this->damSC->getOptions(); if ($this->act=='magic') { $this->content .= $this->getMsgBox($LANG->getLL('magicImage_msg')); } if ($this->act=='plain') { $this->content .= $this->getMsgBox(sprintf($LANG->getLL('plainImage_msg'), $this->plainMaxWidth, $this->plainMaxHeight)); } break; default: break; } // Ending page, returning content: $this->content.= $this->doc->endPage(); $this->content = $this->damSC->doc->insertStylesAndJS($this->content); return $this->content; } /** * Import from t3lib_page in order to create backend version * Creates language-overlay for records in general (where translation is found in records from the same table) * * @param string Table name * @param array Record to overlay. Must containt uid, pid and $table]['ctrl']['languageField'] * @param integer Pointer to the sys_language uid for content on the site. * @param string Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is false) * @return mixed Returns the input record, possibly overlaid with a translation. But if $OLmode is "hideNonTranslated" then it will return false if no translation is found. */ function getRecordOverlay($table,$row,$sys_language_content,$OLmode='') { global $TCA, $TYPO3_DB; if ($row['uid']>0 && $row['pid']>0) { if ($TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) { if (!$TCA[$table]['ctrl']['transOrigPointerTable']) { // Will try to overlay a record only if the sys_language_content value is larger that zero. if ($sys_language_content>0) { // Must be default language or [All], otherwise no overlaying: if ($row[$TCA[$table]['ctrl']['languageField']]<=0) { // Select overlay record: $res = $TYPO3_DB->exec_SELECTquery( '*', $table, 'pid='.intval($row['pid']). ' AND '.$TCA[$table]['ctrl']['languageField'].'='.intval($sys_language_content). ' AND '.$TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($row['uid']). t3lib_BEfunc::BEenableFields($table). t3lib_BEfunc::deleteClause($table), '', '', '1' ); $olrow = $TYPO3_DB->sql_fetch_assoc($res); //$this->versionOL($table,$olrow); // Merge record content by traversing all fields: if (is_array($olrow)) { foreach($row as $fN => $fV) { if ($fN!='uid' && $fN!='pid' && isset($olrow[$fN])) { if ($TCA[$table]['l10n_mode'][$fN]!='exclude' && ($TCA[$table]['l10n_mode'][$fN]!='mergeIfNotBlank' || strcmp(trim($olrow[$fN]),''))) { $row[$fN] = $olrow[$fN]; } } } } elseif ($OLmode==='hideNonTranslated' && $row[$TCA[$table]['ctrl']['languageField']]==0) { // Unset, if non-translated records should be hidden. ONLY done if the source record really is default language and not [All] in which case it is allowed. unset($row); } // Otherwise, check if sys_language_content is different from the value of the record - that means a japanese site might try to display french content. } elseif ($sys_language_content!=$row[$TCA[$table]['ctrl']['languageField']]) { unset($row); } } else { // When default language is displayed, we never want to return a record carrying another language!: if ($row[$TCA[$table]['ctrl']['languageField']]>0) { unset($row); } } } } } return $row; }}if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/class.tx_rtehtmlarea_dam_browse_media.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/class.tx_rtehtmlarea_dam_browse_media.php']);}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -