📄 class.tx_rtehtmlarea_dam_browse_media.php
字号:
} editor.renderPopup_insertImage(\'<img src="\'+file+\'" alt="\'+alt+\'" title="\'+title+\'" style="width: \'+styleWidth+\'; height: \'+styleHeight+\';"'.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?' clickenlargesrc="\'+origFile+\'" clickenlarge="0"':'').' />\'); }/*]]>*/</script><body><script type="text/javascript">/*<![CDATA[*/ insertImage('.t3lib_div::quoteJSvalue($url,1).','.$width.','.$height.','.t3lib_div::quoteJSvalue($altText,1).','.t3lib_div::quoteJSvalue($titleText,1).','.t3lib_div::quoteJSvalue($origFile,1).');/*]]>*/</script></body></html>'; } /** * [Describe function...] * * @return [type] ... */ function getJSCode() { global $LANG,$BACK_PATH,$TYPO3_CONF_VARS; $JScode=' var editor = window.opener.RTEarea[' . $this->editorNo . ']["editor"]; var HTMLArea = window.opener.HTMLArea; function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close) { return jumpToUrl(\''.$this->thisScript.'?act='.$this->act.'&mode='.$this->mode.'&bparams='.$this->bparams.'&insertImage='.'\'+fp); } function jumpToUrl(URL,anchor) { // var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : ""; var add_editorNo = URL.indexOf("editorNo=")==-1 ? "&editorNo='.$this->editorNo.'" : ""; var add_sys_language_content = URL.indexOf("sys_language_content=")==-1 ? "&sys_language_content='.$this->sys_language_content.'" : ""; var RTEtsConfigParams = "&RTEtsConfigParams='.rawurlencode(t3lib_div::_GP('RTEtsConfigParams')).'"; var cur_width = selectedImageRef ? "&cWidth="+selectedImageRef.style.width : ""; var cur_height = selectedImageRef ? "&cHeight="+selectedImageRef.style.height : ""; var theLocation = URL+add_act+add_editorNo+add_sys_language_content+RTEtsConfigParams+cur_width+cur_height+(anchor?anchor:""); window.location.href = theLocation; return false; } function launchView(url) { var thePreviewWindow=""; thePreviewWindow = window.open("'.$this->siteUrl.TYPO3_mainDir.'show_item.php?table="+url,"ShowItem","height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0"); if (thePreviewWindow && thePreviewWindow.focus) { thePreviewWindow.focus(); } } function getCurrentImageRef() { if (editor._selectedImage) { return editor._selectedImage; } else { return null; } } function printCurrentImageOptions() { var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . '; if(classesImage) var styleSelector=\'<select name="iClass" style="width:140px;">' . $this->classesImageJSOptions . '</select>\'; var floatSelector=\'<select name="iFloat" id="iFloat"><option value="">' . $LANG->getLL('notSet') . '</option><option value="none">' . $LANG->getLL('nonFloating') . '</option><option value="left">' . $LANG->getLL('left') . '</option><option value="right">' . $LANG->getLL('right') . '</option></select>\'; var bgColor=\' class="bgColor4"\'; var sz=""; sz+=\'<table border=0 cellpadding=1 cellspacing=1><form action="" name="imageData">\'; if(classesImage) { sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('class').': </td><td>\'+styleSelector+\'</td></tr>\'; } sz+=\'<tr><td\'+bgColor+\'><label for="iWidth">'.$LANG->getLL('width').': </label></td><td><input type="text" name="iWidth" id="iWidth" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\'; sz+=\'<tr><td\'+bgColor+\'><label for="iHeight">'.$LANG->getLL('height').': </label></td><td><input type="text" name="iHeight" id="iHeight" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\'; sz+=\'<tr><td\'+bgColor+\'><label for="iBorder">'.$LANG->getLL('border').': </label></td><td><input type="checkbox" name="iBorder" id="iBorder" value="1" /></td></tr>\'; sz+=\'<tr><td\'+bgColor+\'><label for="iFloat">'.$LANG->getLL('float').': </label></td><td>\'+floatSelector+\'</td></tr>\'; sz+=\'<tr><td\'+bgColor+\'><label for="iHspace">'.$LANG->getLL('margin_lr').': </label></td><td><input type="text" name="iHspace" id="iHspace" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).'></td></tr>\'; sz+=\'<tr><td\'+bgColor+\'><label for="iVspace">'.$LANG->getLL('margin_tb').': </label></td><td><input type="text" name="iVspace" id="iVspace" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\'; sz+=\'<tr><td\'+bgColor+\'><label for="iTitle">'.$LANG->getLL('title').': </label></td><td><input type="text" name="iTitle" id="iTitle"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /></td></tr>\'; sz+=\'<tr><td\'+bgColor+\'><label for="iAlt">'.$LANG->getLL('alt').': </label></td><td><input type="text" name="iAlt" id="iAlt"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /></td></tr>\'; '.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?'if (selectedImageRef && selectedImageRef.getAttribute("clickenlargesrc")) sz+=\'<tr><td\'+bgColor+\'><label for="iClickEnlarge">'.$LANG->sL('LLL:EXT:cms/locallang_ttc.php:image_zoom',1).' </label></td><td><input type="checkbox" name="iClickEnlarge" id="iClickEnlarge" value="1" /></td></tr>\';':'').' sz+=\'<tr><td><input type="submit" value="'.$LANG->getLL('update').'" onClick="return setImageProperties();"></td></tr>\'; sz+=\'</form></table>\'; return sz; } function setImageProperties() { var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . '; if (selectedImageRef) { if(document.imageData.iWidth.value && document.imageData.iWidth.value != "auto") { selectedImageRef.style.width = document.imageData.iWidth.value + "px"; } else { selectedImageRef.style.width = "auto"; } selectedImageRef.removeAttribute("width"); if(document.imageData.iHeight.value && document.imageData.iHeight.value != "auto") { selectedImageRef.style.height=document.imageData.iHeight.value + "px"; } else { selectedImageRef.style.height = "auto"; } selectedImageRef.removeAttribute("height"); selectedImageRef.style.paddingTop = "0px"; selectedImageRef.style.paddingBottom = "0px"; selectedImageRef.style.paddingRight = "0px"; selectedImageRef.style.paddingLeft = "0px"; selectedImageRef.style.padding = ""; // this statement ignored by Mozilla 1.3.1 if(document.imageData.iVspace.value != "" && !isNaN(parseInt(document.imageData.iVspace.value))) { selectedImageRef.style.paddingTop = parseInt(document.imageData.iVspace.value) + "px"; selectedImageRef.style.paddingBottom = selectedImageRef.style.paddingTop; } if(document.imageData.iHspace.value != "" && !isNaN(parseInt(document.imageData.iHspace.value))) { selectedImageRef.style.paddingRight = parseInt(document.imageData.iHspace.value) + "px"; selectedImageRef.style.paddingLeft = selectedImageRef.style.paddingRight; } selectedImageRef.removeAttribute("vspace"); selectedImageRef.removeAttribute("hspace"); selectedImageRef.title=document.imageData.iTitle.value; selectedImageRef.alt=document.imageData.iAlt.value; selectedImageRef.style.borderStyle = "none"; selectedImageRef.style.borderWidth = "0px"; selectedImageRef.style.border = ""; // this statement ignored by Mozilla 1.3.1 if(document.imageData.iBorder.checked) { selectedImageRef.style.borderStyle = "solid"; selectedImageRef.style.borderWidth = "thin"; } selectedImageRef.removeAttribute("border"); var iFloat = document.imageData.iFloat.options[document.imageData.iFloat.selectedIndex].value; if (iFloat || selectedImageRef.style.cssFloat || selectedImageRef.style.styleFloat) { if(document.all) { selectedImageRef.style.styleFloat = iFloat; } else { selectedImageRef.style.cssFloat = iFloat; } } if(classesImage) { var iClass = document.imageData.iClass.options[document.imageData.iClass.selectedIndex].value; if (iClass || (selectedImageRef.attributes["class"] && selectedImageRef.attributes["class"].value)) { selectedImageRef.className = iClass; } } '.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?' if (document.imageData.iClickEnlarge && document.imageData.iClickEnlarge.checked) selectedImageRef.setAttribute("clickenlarge","1"); else selectedImageRef.setAttribute("clickenlarge","0");':'').' HTMLArea.edHidePopup(); } return false; } function insertImagePropertiesInForm() { var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . '; if (selectedImageRef) { var styleWidth, styleHeight, paddingTop, paddingRight; styleWidth = selectedImageRef.style.width ? selectedImageRef.style.width : selectedImageRef.width; styleWidth = parseInt(styleWidth); if (isNaN(styleWidth) || styleWidth == 0) { styleWidth = "auto"; } document.imageData.iWidth.value = styleWidth; styleHeight = selectedImageRef.style.height ? selectedImageRef.style.height : selectedImageRef.height; styleHeight = parseInt(styleHeight); if (isNaN(styleHeight) || styleHeight == 0) { styleHeight = "auto"; } document.imageData.iHeight.value = styleHeight; paddingTop = selectedImageRef.style.paddingTop ? selectedImageRef.style.paddingTop : selectedImageRef.vspace; paddingTop = parseInt(paddingTop); if (isNaN(paddingTop) || paddingTop < 0) { paddingTop = ""; } document.imageData.iVspace.value = paddingTop; paddingRight = selectedImageRef.style.paddingRight ? selectedImageRef.style.paddingRight : selectedImageRef.hspace; paddingRight = parseInt(paddingRight); if (isNaN(paddingRight) || paddingRight < 0) { paddingRight = ""; } document.imageData.iHspace.value = paddingRight; document.imageData.iTitle.value = selectedImageRef.title; document.imageData.iAlt.value = selectedImageRef.alt; if((selectedImageRef.style.borderStyle && selectedImageRef.style.borderStyle != "none" && selectedImageRef.style.borderStyle != "none none none none") || selectedImageRef.border) { document.imageData.iBorder.checked = 1; } var fObj=document.imageData.iFloat; var value = (selectedImageRef.style.cssFloat ? selectedImageRef.style.cssFloat : selectedImageRef.style.styleFloat); var l=fObj.length; for (a=0;a<l;a++) { if (fObj.options[a].value == value) { fObj.selectedIndex = a; } } if(classesImage) { var fObj=document.imageData.iClass; var value=selectedImageRef.className; var l=fObj.length; for (a=0;a<l;a++) { if (fObj.options[a].value == value) { fObj.selectedIndex = a; } } } '.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?'if (selectedImageRef.getAttribute("clickenlargesrc")) { if (selectedImageRef.getAttribute("clickenlarge") == "1") document.imageData.iClickEnlarge.checked = 1; else document.imageData.iClickEnlarge.removeAttribute("checked"); }':'').' } return false; } function openDragDrop() { var url = "' . $BACK_PATH . 'browse_links.php?mode=filedrag&editorNo='.$this->editorNo.'&bparams=|'.implode(':', array($this->editorNo,$this->sys_language_content)).'||"+escape("gif,jpg,jpeg,png"); window.opener.browserWin = window.open(url,"Typo3WinBrowser","height=350,width=600,status=0,menubar=0,resizable=1,scrollbars=1"); HTMLArea.edHidePopup(); } var selectedImageRef = getCurrentImageRef(); // Setting this to a reference to the image object. '.($this->act=='dragdrop'?'openDragDrop();':''); // Finally, add the accumulated JavaScript to the template object: $this->doc->JScode = $this->doc->wrapScriptTags($JScode); } function reinitParams() {// We need to pass along some RTE parameters if ($this->editorNo) { $pArr = explode('|', $this->bparams); $pArr[1] = implode(':', array($this->editorNo, $this->sys_language_content)); $pArr[2] = $this->RTEtsConfigParams; $this->bparams = implode('|', $pArr); }// We need to pass along some RTE parameters parent::reinitParams(); } /** * Return true or false whether thumbs should be displayed or not * * @return boolean */ function displayThumbs() { global $BE_USER;// Honor options.noThumbsInRTEimageSelect return parent::displayThumbs() && !$BE_USER->getTSConfigVal('options.noThumbsInRTEimageSelect');// Honor options.noThumbsInRTEimageSelect } /** * Create HTML checkbox to enable/disable thumbnail display * * @return string HTML code */ function addDisplayOptions() { global $BE_USER; // Getting flag for showing/not showing thumbnails:// Honor options.noThumbsInRTEimageSelect $noThumbs = $BE_USER->getTSConfigVal('options.noThumbsInEB') || ($this->mode == 'rte' && $BE_USER->getTSConfigVal('options.noThumbsInRTEimageSelect'));// Honor options.noThumbsInRTEimageSelect if ($noThumbs) { $thumbNailCheckbox = ''; } else { $thumbNailCheckbox = t3lib_BEfunc::getFuncCheck('', 'SET[displayThumbs]',$this->displayThumbs(), $this->thisScript, t3lib_div::implodeArrayForUrl('',$this->addParams)); $description = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:displayThumbs',1); $id = 'l'.uniqid('tx_dam_scbase'); $idAttr = ' id="'.$id.'"'; $thumbNailCheckbox = str_replace('<input', '<input'.$idAttr, $thumbNailCheckbox); $thumbNailCheckbox .= ' <label for="'.$id.'">'.$description.'</label>'; $this->damSC->addOption('html', 'thumbnailCheckbox', $thumbNailCheckbox); } $this->damSC->addOption('funcCheck', 'extendedInfo', $GLOBALS['LANG']->getLL('displayExtendedInfo',1)); } /** * 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; $out = ''; // Listing the files: if (is_array($files) AND count($files)) { $displayThumbs = $this->displayThumbs(); // 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'], $GLOBALS['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.'>'; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -