📄 class.tx_rtehtmlarea_select_image.php
字号:
<html><head> <title>Untitled</title></head><script language="javascript" type="text/javascript">/*<![CDATA[*/ var editor = window.opener.RTEarea[' . $this->editorNo . ']["editor"]; var HTMLArea = window.opener.HTMLArea; function insertImage(file,width,height,origFile) { var styleWidth, styleHeight; styleWidth = parseInt(width); if (isNaN(styleWidth) || styleWidth == 0) { styleWidth = "auto"; } else { styleWidth += "px"; } styleHeight = parseInt(height); if (isNaN(styleHeight) || styleHeight == 0) { styleHeight = "auto"; } else { styleHeight += "px"; } editor.renderPopup_insertImage(\'<img src="\'+file+\'" 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(\''.$iurl.'\','.$imgI[0].','.$imgI[1].',\''.substr($imgInfo[3],strlen(PATH_site)).'\');/*]]>*/</script></body></html>'; } } } exit; } } /** * [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 jumpToUrl(URL,anchor) { // var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : ""; var add_editorNo = URL.indexOf("editorNo=")==-1 ? "&editorNo='.$this->editorNo.'" : ""; 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+RTEtsConfigParams+cur_width+cur_height+(anchor?anchor:""); window.location.href = theLocation; return false; } function insertImage(file,width,height,origFile) { var styleWidth, styleHeight; styleWidth = parseInt(width); if (isNaN(styleWidth) || styleWidth == 0) { styleWidth = "auto"; } else { styleWidth += "px"; } styleHeight = parseInt(height); if (isNaN(styleHeight) || styleHeight == 0) { styleHeight = "auto"; } else { styleHeight += "px"; } editor.renderPopup_insertImage(\'<img src="\'+file+\'" 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"':'').' />\'); } 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"><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+\'>'.$LANG->getLL('width').': </td><td><input type="text" name="iWidth" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\'; sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('height').': </td><td><input type="text" name="iHeight" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\'; sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('border').': </td><td><input type="checkbox" name="iBorder" value="1" /></td></tr>\'; sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('float').': </td><td>\'+floatSelector+\'</td></tr>\'; sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('margin_lr').': </td><td><input type="text" name="iHspace" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).'></td></tr>\'; sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('margin_tb').': </td><td><input type="text" name="iVspace" value=""'.$GLOBALS['TBE_TEMPLATE']->formWidth(4).' /></td></tr>\'; sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('title').': </td><td><input type="text" name="iTitle"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' /></td></tr>\'; sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('alt').': </td><td><input type="text" name="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 . t3lib_extMgm::extRelPath($this->extKey) . 'mod3/browse_links.php?mode=filedrag&editorNo='.$this->editorNo.'&bparams=|||"+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); } /** * Session data for this class can be set from outside with this method. * Call after init() * * @param array Session data array * @return array Session data and boolean which indicates that data needs to be stored in session because it's changed */ function processSessionData($data) { $store = false; if ($this->act != 'image') { if (isset($this->act)) { $data['act'] = $this->act; $store = true; } else { $this->act = $data['act']; } } if (isset($this->expandFolder)) { $data['expandFolder'] = $this->expandFolder; $store = true; } else { $this->expandFolder = $data['expandFolder']; } return array($data, $store); } /** * [Describe function...] * * @return [type] ... */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -