Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com) 00006 * (c) 2004-2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca> 00007 * All rights reserved 00008 * 00009 * This script is part of the TYPO3 project. The TYPO3 project is 00010 * free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * The GNU General Public License can be found at 00016 * http://www.gnu.org/copyleft/gpl.html. 00017 * A copy is found in the textfile GPL.txt and important notices to the license 00018 * from the author is found in LICENSE.txt distributed with these scripts. 00019 * 00020 * 00021 * This script is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 * GNU General Public License for more details. 00025 * 00026 * This copyright notice MUST APPEAR in all copies of the script! 00027 ***************************************************************/ 00069 error_reporting (E_ALL ^ E_NOTICE); 00070 unset($MCONF); 00071 require ('conf.php'); 00072 require ($BACK_PATH.'init.php'); 00073 require ($BACK_PATH.'template.php'); 00074 require_once (PATH_t3lib.'class.t3lib_foldertree.php'); 00075 require_once (PATH_t3lib.'class.t3lib_stdgraphic.php'); 00076 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php'); 00077 $LANG->includeLLFile('EXT:rtehtmlarea/mod4/locallang.xml'); 00078 00086 class tx_rtehtmlarea_image_localFolderTree extends t3lib_folderTree { 00087 var $ext_IconMode=1; 00088 00096 function wrapTitle($title,$v) { 00097 if ($this->ext_isLinkable($v)) { 00098 $aOnClick = 'return jumpToUrl(\'?expandFolder='.rawurlencode($v['path']).'\');'; 00099 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>'; 00100 } else { 00101 return '<span class="typo3-dimmed">'.$title.'</span>'; 00102 } 00103 } 00104 00111 function ext_isLinkable($v) { 00112 $webpath=t3lib_BEfunc::getPathType_web_nonweb($v['path']); 00113 if ($GLOBALS['SOBE']->act=='magic') return 1; //$webpath='web'; // The web/non-web path does not matter if the mode is 'magic' 00114 00115 if (strstr($v['path'],'_recycler_') || strstr($v['path'],'_temp_') || $webpath!='web') { 00116 return 0; 00117 } 00118 return 1; 00119 } 00120 00130 function PM_ATagWrap($icon,$cmd,$bMark='') { 00131 if ($bMark) { 00132 $anchor = '#'.$bMark; 00133 $name=' name="'.$bMark.'"'; 00134 } 00135 $aOnClick = 'return jumpToUrl(\'?PM='.$cmd.'\',\''.$anchor.'\');'; 00136 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>'; 00137 } 00138 00145 function printTree($treeArr='') { 00146 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']); 00147 00148 if (!is_array($treeArr)) $treeArr=$this->tree; 00149 00150 $out=''; 00151 $c=0; 00152 00153 // Traverse rows for the tree and print them into table rows: 00154 foreach($treeArr as $k => $v) { 00155 $c++; 00156 $bgColor=' class="'.(($c+1)%2 ? 'bgColor' : 'bgColor-10').'"'; 00157 $out.='<tr'.$bgColor.'><td nowrap="nowrap">'.$v['HTML'].$this->wrapTitle(t3lib_div::fixed_lgd($v['row']['title'],$titleLen),$v['row']).'</td></tr>'; 00158 } 00159 00160 $out='<table border="0" cellpadding="0" cellspacing="0">'.$out.'</table>'; 00161 return $out; 00162 } 00163 } 00164 00165 00173 class tx_rtehtmlarea_select_image { 00174 var $content; 00175 var $siteUrl; 00176 var $act; 00177 var $modData; 00178 var $thisConfig; 00179 var $allowedItems; 00180 var $doc; 00181 var $imgPath; 00182 var $classesImageJSOptions; 00183 00189 function preinit() { 00190 global $BE_USER; 00191 00192 // Current site url: 00193 $this->siteUrl = t3lib_div::getIndpEnv("TYPO3_SITE_URL"); 00194 00195 // Determine nature of current url: 00196 $this->act=t3lib_div::_GP("act"); 00197 00198 $this->modData = $BE_USER->getModuleData("select_image.php","ses"); 00199 if ($this->act!="image") { 00200 if (isset($this->act)) { 00201 $this->modData["act"]=$this->act; 00202 $BE_USER->pushModuleData("select_image.php",$this->modData); 00203 } else { 00204 $this->act=$this->modData["act"]; 00205 } 00206 } 00207 $expandPage = t3lib_div::_GP("expandFolder"); 00208 if (isset($expandPage)) { 00209 $this->modData["expandFolder"]=$expandPage; 00210 $BE_USER->pushModuleData("select_image.php",$this->modData); 00211 } else { 00212 t3lib_div::_GETset($this->modData["expandFolder"],'expandFolder'); 00213 } 00214 00215 if (!$this->act) { 00216 $this->act="magic"; 00217 } 00218 00219 $RTEtsConfigParts = explode(":",t3lib_div::_GP("RTEtsConfigParams")); 00220 // if (count($RTEtsConfigParts)<2) die("Error: The GET parameter 'RTEtsConfigParams' was missing. Close the window."); 00221 $RTEsetup = $GLOBALS["BE_USER"]->getTSConfig("RTE",t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5])); 00222 $this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup["properties"],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]); 00223 $this->imgPath = $RTEtsConfigParts[6]; 00224 00225 $this->allowedItems = array_diff(explode(",","magic,plain,dragdrop,image"),t3lib_div::trimExplode(",",$this->thisConfig["blindImageOptions"],1)); 00226 reset($this->allowedItems); 00227 if (!in_array($this->act,$this->allowedItems)) $this->act = current($this->allowedItems); 00228 00229 if($this->thisConfig['classesImage']) { 00230 $classesImageArray = t3lib_div::trimExplode(',',$this->thisConfig['classesImage'],1); 00231 $this->classesImageJSOptions = '<option value=""></option>'; 00232 reset($classesImageArray); 00233 while(list(,$class)=each($classesImageArray)) { 00234 $this->classesImageJSOptions .= '<option value="' .$class . '">' . $class . '</option>'; 00235 } 00236 } 00237 } 00238 00244 function rteImageStorageDir() { 00245 $dir = $this->imgPath ? $this->imgPath : $GLOBALS["TYPO3_CONF_VARS"]["BE"]["RTE_imageStorageDir"];; 00246 return $dir; 00247 } 00248 00254 function magicProcess() { 00255 00256 if ($this->act=="magic" && t3lib_div::_GP("insertMagicImage")) { 00257 $filepath = t3lib_div::_GP("insertMagicImage"); 00258 00259 $imgObj = t3lib_div::makeInstance("t3lib_stdGraphic"); 00260 $imgObj->init(); 00261 $imgObj->mayScaleUp=0; 00262 $imgObj->tempPath=PATH_site.$imgObj->tempPath; 00263 00264 $imgInfo = $imgObj->getImageDimensions($filepath); 00265 00266 if (is_array($imgInfo) && count($imgInfo)==4 && $this->rteImageStorageDir()) { 00267 $fI=pathinfo($imgInfo[3]); 00268 $fileFunc = t3lib_div::makeInstance("t3lib_basicFileFunctions"); 00269 $basename = $fileFunc->cleanFileName("RTEmagicP_".$fI["basename"]); 00270 $destPath =PATH_site.$this->rteImageStorageDir(); 00271 if (@is_dir($destPath)) { 00272 $destName = $fileFunc->getUniqueName($basename,$destPath); 00273 @copy($imgInfo[3],$destName); 00274 00275 $cHeight=t3lib_div::intInRange(t3lib_div::_GP("cHeight"),0,500); 00276 $cWidth=t3lib_div::intInRange(t3lib_div::_GP("cWidth"),0,500); 00277 if (!$cHeight) $cHeight=200; 00278 if (!$cWidth) $cWidth=300; 00279 // This thing allows images to be based on their width - to a certain degree - by setting a high height. Then we're almost certain the image will be based on the width 00280 $cHeight=1000; 00281 00282 // debug(array($cHeight,$cWidth)); 00283 //exit; 00284 $imgI = $imgObj->imageMagickConvert($filepath,"WEB",$cWidth."m",$cHeight."m"); // ($imagefile,$newExt,$w,$h,$params,$frame,$options,$mustCreate=0) 00285 // debug($imgI); 00286 if ($imgI[3]) { 00287 $fI=pathinfo($imgI[3]); 00288 $mainBase="RTEmagicC_".substr(basename($destName),10).".".$fI["extension"]; 00289 $destName = $fileFunc->getUniqueName($mainBase,$destPath); 00290 @copy($imgI[3],$destName); 00291 00292 $iurl = $this->siteUrl.substr($destName,strlen(PATH_site)); 00293 echo' 00294 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 00295 <html> 00296 <head> 00297 <title>Untitled</title> 00298 </head> 00299 <script language="javascript" type="text/javascript"> 00300 /*<![CDATA[*/ 00301 var editor = parent.editor; 00302 var HTMLArea = parent.HTMLArea; 00303 function insertImage(file,width,height) { 00304 var styleWidth, styleHeight; 00305 styleWidth = parseInt(width); 00306 if (isNaN(styleWidth) || styleWidth == 0) { 00307 styleWidth = "auto"; 00308 } else { 00309 styleWidth += "px"; 00310 } 00311 styleHeight = parseInt(height); 00312 if (isNaN(styleHeight) || styleHeight == 0) { 00313 styleHeight = "auto"; 00314 } else { 00315 styleHeight += "px"; 00316 } 00317 editor.renderPopup_insertImage(\'<img src="\'+file+\'" style="width: \'+styleWidth+\'; height: \'+styleHeight+\';" />\'); 00318 } 00319 /*]]>*/ 00320 </script> 00321 <body> 00322 <script language="javascript" type="text/javascript"> 00323 /*<![CDATA[*/ 00324 insertImage(\''.$iurl.'\','.$imgI[0].','.$imgI[1].'); 00325 /*]]>*/ 00326 </script> 00327 </body> 00328 </html>'; 00329 } 00330 00331 } 00332 } 00333 exit; 00334 } 00335 } 00336 00342 function init() { 00343 global $LANG,$BACK_PATH; 00344 00345 $this->doc = t3lib_div::makeInstance('template'); 00346 $this->doc->backPath = $BACK_PATH; 00347 $this->doc->JScode=' 00348 <script language="javascript" type="text/javascript"> 00349 /*<![CDATA[*/ 00350 var editor = parent.editor; 00351 var HTMLArea = parent.HTMLArea; 00352 function jumpToUrl(URL,anchor) { // 00353 var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : ""; 00354 var RTEtsConfigParams = "&RTEtsConfigParams='.rawurlencode(t3lib_div::_GP('RTEtsConfigParams')).'"; 00355 00356 var cur_width = selectedImageRef ? "&cWidth="+selectedImageRef.style.width : ""; 00357 var cur_height = selectedImageRef ? "&cHeight="+selectedImageRef.style.height : ""; 00358 00359 var theLocation = URL+add_act+RTEtsConfigParams+cur_width+cur_height+(anchor?anchor:""); 00360 window.location.href = theLocation; 00361 return false; 00362 } 00363 function insertImage(file,width,height) { 00364 var styleWidth, styleHeight; 00365 styleWidth = parseInt(width); 00366 if (isNaN(styleWidth) || styleWidth == 0) { 00367 styleWidth = "auto"; 00368 } else { 00369 styleWidth += "px"; 00370 } 00371 styleHeight = parseInt(height); 00372 if (isNaN(styleHeight) || styleHeight == 0) { 00373 styleHeight = "auto"; 00374 } else { 00375 styleHeight += "px"; 00376 } 00377 editor.renderPopup_insertImage(\'<img src="\'+file+\'" style="width: \'+styleWidth+\'; height: \'+styleHeight+\';" />\'); 00378 } 00379 function launchView(url) { 00380 var thePreviewWindow=""; 00381 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"); 00382 if (thePreviewWindow && thePreviewWindow.focus) { 00383 thePreviewWindow.focus(); 00384 } 00385 } 00386 function getCurrentImageRef() { 00387 if (editor._selectedImage) { 00388 return editor._selectedImage; 00389 } else { 00390 return null; 00391 } 00392 } 00393 function printCurrentImageOptions() { 00394 var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . '; 00395 if(classesImage) var styleSelector=\'<select name="iClass" style="width:140px;">' . $this->classesImageJSOptions . '</select>\'; 00396 // var alignSelector=\'<select name="iAlign" style="width:60px;"><option value=""></option><option value="left">Left</option><option value="right">Right</option></select>\'; 00397 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>\'; 00398 var bgColor=\' class="bgColor4"\'; 00399 var sz=""; 00400 sz+=\'<table border=0 cellpadding=1 cellspacing=1><form action="" name="imageData">\'; 00401 if(classesImage) { 00402 sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL("class").': \'+styleSelector+\'</td></tr>\'; 00403 } 00404 sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL("width").': <input type="text" name="iWidth" value=""'.$GLOBALS["TBE_TEMPLATE"]->formWidth(4).' /> '.$LANG->getLL("height").': <input type="text" name="iHeight" value=""'.$GLOBALS["TBE_TEMPLATE"]->formWidth(4).' /> '.$LANG->getLL("border").': <input type="checkbox" name="iBorder" value="1" /></td></tr>\'; 00405 sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL("float").': \'+floatSelector+\'</td></tr>\'; 00406 sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL("margin_lr").': <input type="text" name="iHspace" value=""'.$GLOBALS["TBE_TEMPLATE"]->formWidth(4).'> '.$LANG->getLL("margin_tb").': <input type="text" name="iVspace" value=""'.$GLOBALS["TBE_TEMPLATE"]->formWidth(4).' /></td></tr>\'; 00407 // sz+=\'<tr><td\'+bgColor+\'>Textwrapping: \'+alignSelector+\' Style: \'+styleSelector+\'</td></tr>\'; 00408 sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL("title").': <input type="text" name="iTitle"'.$GLOBALS["TBE_TEMPLATE"]->formWidth(20).' /></td></tr>\'; 00409 sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL("alt").': <input type="text" name="iAlt"'.$GLOBALS["TBE_TEMPLATE"]->formWidth(20).' /></td></tr>\'; 00410 sz+=\'<tr><td><input type="submit" value="'.$LANG->getLL("update").'" onClick="return setImageProperties();"></td></tr>\'; 00411 sz+=\'</form></table>\'; 00412 return sz; 00413 } 00414 function setImageProperties() { 00415 var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . '; 00416 if (selectedImageRef) { 00417 if(document.imageData.iWidth.value && document.imageData.iWidth.value != "auto") { 00418 selectedImageRef.style.width = document.imageData.iWidth.value + "px"; 00419 } else { 00420 selectedImageRef.style.width = "auto"; 00421 } 00422 selectedImageRef.removeAttribute("width"); 00423 if(document.imageData.iHeight.value && document.imageData.iHeight.value != "auto") { 00424 selectedImageRef.style.height=document.imageData.iHeight.value + "px"; 00425 } else { 00426 selectedImageRef.style.height = "auto"; 00427 } 00428 selectedImageRef.removeAttribute("height"); 00429 00430 selectedImageRef.style.paddingTop = "0px"; 00431 selectedImageRef.style.paddingBottom = "0px"; 00432 selectedImageRef.style.paddingRight = "0px"; 00433 selectedImageRef.style.paddingLeft = "0px"; 00434 selectedImageRef.style.padding = ""; // this statement ignored by Mozilla 1.3.1 00435 if(document.imageData.iVspace.value != "" && !isNaN(parseInt(document.imageData.iVspace.value))) { 00436 selectedImageRef.style.paddingTop = parseInt(document.imageData.iVspace.value) + "px"; 00437 selectedImageRef.style.paddingBottom = selectedImageRef.style.paddingTop; 00438 } 00439 if(document.imageData.iHspace.value != "" && !isNaN(parseInt(document.imageData.iHspace.value))) { 00440 selectedImageRef.style.paddingRight = parseInt(document.imageData.iHspace.value) + "px"; 00441 selectedImageRef.style.paddingLeft = selectedImageRef.style.paddingRight; 00442 } 00443 selectedImageRef.removeAttribute("vspace"); 00444 selectedImageRef.removeAttribute("hspace"); 00445 00446 selectedImageRef.title=document.imageData.iTitle.value; 00447 selectedImageRef.alt=document.imageData.iAlt.value; 00448 00449 selectedImageRef.style.borderStyle = "none"; 00450 selectedImageRef.style.borderWidth = "0px"; 00451 selectedImageRef.style.border = ""; // this statement ignored by Mozilla 1.3.1 00452 if(document.imageData.iBorder.checked) { 00453 selectedImageRef.style.borderStyle = "solid"; 00454 selectedImageRef.style.borderWidth = "thin"; 00455 } 00456 selectedImageRef.removeAttribute("border"); 00457 00458 var iFloat = document.imageData.iFloat.options[document.imageData.iFloat.selectedIndex].value; 00459 if (iFloat || selectedImageRef.style.cssFloat || selectedImageRef.style.styleFloat) { 00460 if(document.all) { 00461 selectedImageRef.style.styleFloat = iFloat; 00462 } else { 00463 selectedImageRef.style.cssFloat = iFloat; 00464 } 00465 } 00466 00467 /* 00468 var iAlign = document.imageData.iAlign.options[document.imageData.iAlign.selectedIndex].value; 00469 if (iAlign || selectedImageRef.align) { 00470 selectedImageRef.align=iAlign; 00471 } 00472 selectedImageRef.style.cssText=""; 00473 */ 00474 if(classesImage) { 00475 var iClass = document.imageData.iClass.options[document.imageData.iClass.selectedIndex].value; 00476 if (iClass || (selectedImageRef.attributes["class"] && selectedImageRef.attributes["class"].value)) { 00477 selectedImageRef.className = iClass; 00478 } 00479 } 00480 HTMLArea.edHidePopup(); 00481 } 00482 return false; 00483 } 00484 function insertImagePropertiesInForm() { 00485 var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . '; 00486 if (selectedImageRef) { 00487 var styleWidth, styleHeight, paddingTop, paddingRight; 00488 styleWidth = selectedImageRef.style.width ? selectedImageRef.style.width : selectedImageRef.width; 00489 styleWidth = parseInt(styleWidth); 00490 if (isNaN(styleWidth) || styleWidth == 0) { styleWidth = "auto"; } 00491 document.imageData.iWidth.value = styleWidth; 00492 styleHeight = selectedImageRef.style.height ? selectedImageRef.style.height : selectedImageRef.height; 00493 styleHeight = parseInt(styleHeight); 00494 if (isNaN(styleHeight) || styleHeight == 0) { styleHeight = "auto"; } 00495 document.imageData.iHeight.value = styleHeight; 00496 00497 paddingTop = selectedImageRef.style.paddingTop ? selectedImageRef.style.paddingTop : selectedImageRef.vspace; 00498 paddingTop = parseInt(paddingTop); 00499 if (isNaN(paddingTop) || paddingTop < 0) { paddingTop = ""; } 00500 document.imageData.iVspace.value = paddingTop; 00501 paddingRight = selectedImageRef.style.paddingRight ? selectedImageRef.style.paddingRight : selectedImageRef.hspace; 00502 paddingRight = parseInt(paddingRight); 00503 if (isNaN(paddingRight) || paddingRight < 0) { paddingRight = ""; } 00504 document.imageData.iHspace.value = paddingRight; 00505 00506 document.imageData.iTitle.value = selectedImageRef.title; 00507 document.imageData.iAlt.value = selectedImageRef.alt; 00508 00509 if((selectedImageRef.style.borderStyle && selectedImageRef.style.borderStyle != "none" && selectedImageRef.style.borderStyle != "none none none none") || selectedImageRef.border) { 00510 document.imageData.iBorder.checked = 1; 00511 } 00512 00513 var fObj=document.imageData.iFloat; 00514 var value = (selectedImageRef.style.cssFloat ? selectedImageRef.style.cssFloat : selectedImageRef.style.styleFloat); 00515 var l=fObj.length; 00516 for (a=0;a<l;a++) { 00517 if (fObj.options[a].value == value) { 00518 fObj.selectedIndex = a; 00519 } 00520 } 00521 00522 /* 00523 // Update align 00524 var fObj=document.imageData.iAlign; 00525 var value=selectedImageRef.align; 00526 var l=fObj.length; 00527 for (a=0;a<l;a++) { 00528 if (fObj.options[a].value == value) { 00529 fObj.selectedIndex = a; 00530 } 00531 } 00532 */ 00533 00534 if(classesImage) { 00535 var fObj=document.imageData.iClass; 00536 var value=selectedImageRef.className; 00537 var l=fObj.length; 00538 for (a=0;a<l;a++) { 00539 if (fObj.options[a].value == value) { 00540 fObj.selectedIndex = a; 00541 } 00542 } 00543 } 00544 00545 } 00546 return false; 00547 } 00548 00549 function openDragDrop() { 00550 var url = "' . $BACK_PATH . t3lib_extMgm::extRelPath('rtehtmlarea') . 'mod3/browse_links.php?mode=filedrag&bparams=|||"+escape("gif,jpg,jpeg,png"); 00551 parent.opener.browserWin = window.open(url,"Typo3WinBrowser","height=350,width=600,status=0,menubar=0,resizable=1,scrollbars=1"); 00552 HTMLArea.edHidePopup(); 00553 } 00554 00555 var selectedImageRef = getCurrentImageRef(); // Setting this to a reference to the image object. 00556 00557 '.($this->act=="dragdrop"?"openDragDrop();":"").' 00558 00559 // alert(selectedImageRef.href); 00560 /*]]>*/ 00561 </script> 00562 '; 00563 00564 // Starting content: 00565 $this->content=""; 00566 $this->content.=$this->doc->startPage("RTE image insert"); 00567 } 00568 00574 function main() { 00575 global $LANG, $TYPO3_CONF_VARS, $FILEMOUNTS, $BE_USER; 00576 00577 $menu='<table border=0 cellpadding=2 cellspacing=1><tr>'; 00578 $bgcolor=' class="bgColor4"'; 00579 $bgcolorA=' class="bgColor5"'; 00580 if ($this->act=="image" || t3lib_div::_GP("cWidth")) { // If $this->act is specifically set to "image" or if cWidth is passed around... 00581 $menu.='<td align=center nowrap="nowrap" width="25%"'.($this->act=="image"?$bgcolorA:$bgcolor).'><a href="#" onClick="jumpToUrl(\'?act=image\');return false;"><strong>'.$LANG->getLL("currentImage").'</strong></a></td>'; 00582 } 00583 if (in_array("magic",$this->allowedItems)) $menu.='<td align=center nowrap="nowrap" width="25%"'.($this->act=="magic"?$bgcolorA:$bgcolor).'><a href="#" onClick="jumpToUrl(\'?act=magic\');return false;"><strong>'.$LANG->getLL("magicImage").'</strong></a></td>'; 00584 if (in_array("plain",$this->allowedItems)) $menu.='<td align=center nowrap="nowrap" width="25%"'.($this->act=="plain"?$bgcolorA:$bgcolor).'><a href="#" onClick="jumpToUrl(\'?act=plain\');return false;"><strong>'.$LANG->getLL("plainImage").'</strong></a></td>'; 00585 if (in_array("dragdrop",$this->allowedItems)) $menu.='<td align=center nowrap="nowrap" width="25%"'.$bgcolor.'><a href="#" onClick="openDragDrop();return false;"><strong>'.$LANG->getLL("dragDropImage").'</strong></a></td>'; 00586 $menu.='</tr></table>'; 00587 00588 $this->content.='<img src=clear.gif width=1 height=2>'; 00589 $this->content.=$menu; 00590 $this->content.='<img src=clear.gif width=1 height=10>'; 00591 00592 if ($this->act!="image") { 00593 00594 // Getting flag for showing/not showing thumbnails: 00595 $noThumbs = $GLOBALS["BE_USER"]->getTSConfigVal("options.noThumbsInRTEimageSelect"); 00596 00597 if (!$noThumbs) { 00598 // MENU-ITEMS, fetching the setting for thumbnails from File>List module: 00599 $_MOD_MENU = array('displayThumbs' => ''); 00600 $_MCONF['name']='file_list'; 00601 $_MOD_SETTINGS = t3lib_BEfunc::getModuleData($_MOD_MENU, t3lib_div::_GP('SET'), $_MCONF['name']); 00602 $addParams = '&act='.$this->act.'&expandFolder='.rawurlencode($this->modData["expandFolder"]); 00603 $thumbNailCheck = t3lib_BEfunc::getFuncCheck('','SET[displayThumbs]',$_MOD_SETTINGS['displayThumbs'],'select_image.php',$addParams).' '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.php:displayThumbs',1); 00604 } else { 00605 $thumbNailCheck=''; 00606 } 00607 00608 // File-folders: 00609 $foldertree = t3lib_div::makeInstance("tx_rtehtmlarea_image_localFolderTree"); 00610 $tree=$foldertree->getBrowsableTree(); 00611 list(,,$specUid) = explode("_",t3lib_div::_GP("PM")); 00612 $files = $this->expandFolder($foldertree->specUIDmap[$specUid],$this->act=="plain",$noThumbs?$noThumbs:!$_MOD_SETTINGS['displayThumbs']); 00613 00614 $this->content.= '<table border=0 cellpadding=0 cellspacing=0> 00615 <tr> 00616 <td valign=top>'.$this->barheader($LANG->getLL("folderTree").':').$tree.'</td> 00617 <td> </td> 00618 <td valign=top>'.$files.'</td> 00619 </tr> 00620 </table> 00621 <BR>'.$thumbNailCheck; 00622 00623 /* 00624 00625 // Target: 00626 if ($this->act!="mail") { 00627 $ltarget='<table border=0 cellpadding=2 cellspacing=1><form name="ltargetform" id="ltargetform"><tr>'; 00628 $ltarget.='<td width=90>Target:</td>'; 00629 $ltarget.='<td><input type="text" name="ltarget" onChange="setTarget(this.value);" value="'.htmlspecialchars($curUrlArray["target"]).'"></td>'; 00630 $ltarget.='<td><select name="ltarget_type" onChange="setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;"> 00631 <option></option> 00632 <option value="_top">Top</option> 00633 <option value="_blank">New window</option> 00634 </select></td>'; 00635 if (($curUrlInfo["act"]=="page" || $curUrlInfo["act"]=="file") && $curUrlArray["href"]) { 00636 $ltarget.='<td><input type="submit" value="Update" onClick="return link_current();"></td>'; 00637 } 00638 $ltarget.='</tr></form></table>'; 00639 00640 $this->content.=$ltarget; 00641 } 00642 */ 00643 00644 // *************************** 00645 // Upload 00646 // *************************** 00647 // Adding upload forms if applicable: 00648 if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) { 00649 $fileProcessor = t3lib_div::makeInstance("t3lib_basicFileFunctions"); 00650 $fileProcessor->init($FILEMOUNTS, $TYPO3_CONF_VARS["BE"]["fileExtensions"]); 00651 $path=t3lib_div::_GP("expandFolder"); 00652 00653 if (!$path || $path=="/" || !@is_dir($path)) { 00654 $path = $fileProcessor->findTempFolder(); // The closest TEMP-path is found 00655 if ($path) $path.="/"; 00656 } 00657 if ($path && @is_dir($path)) { 00658 $this->content.=$this->uploadForm($path)."<BR>"; 00659 } 00660 } 00661 00662 // *************************** 00663 // Help 00664 // *************************** 00665 00666 if ($this->act=="magic") { 00667 $this->content.='<img src="'.$this->doc->backPath.'gfx/icon_note.gif" width="18" height="16" align=top>'.$LANG->getLL("magicImage_msg").'<BR>'; 00668 } 00669 if ($this->act=="plain") { 00670 $resolutionLimit_x = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plainImageMaxWidth'] ? $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plainImageMaxWidth'] : 640; 00671 $resolutionLimit_y = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plainImageMaxHeight'] ? $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plainImageMaxHeight'] : 680; 00672 $this->content.='<img src="'.$this->doc->backPath.'gfx/icon_note.gif" width="18" height="16" align=top>' . sprintf($LANG->getLL('plainImage_msg'), $resolutionLimit_x, $resolutionLimit_y) . '<br />'; 00673 00674 //$this->content.='<img src="'.$this->doc->backPath.'gfx/icon_note.gif" width="18" height="16" align=top>'.$LANG->getLL("plainImage_msg").'<BR>'; 00675 } 00676 } else { 00677 $this->content.=' 00678 <script language="javascript" type="text/javascript"> 00679 document.write(printCurrentImageOptions()); 00680 insertImagePropertiesInForm(); 00681 </script> 00682 '; 00683 } 00684 } 00685 00691 function printContent() { 00692 $this->content.= $this->doc->endPage(); 00693 echo $this->content; 00694 } 00695 00696 /*************************** 00697 * 00698 * OTHER FUNCTIONS: 00699 * 00700 ***************************/ 00706 function expandFolder($expandFolder=0,$plainFlag=0,$noThumbs=0) { 00707 global $LANG; 00708 00709 $expandFolder = $expandFolder ? $expandFolder :t3lib_div::_GP("expandFolder"); 00710 $out=""; 00711 00712 $resolutionLimit_x = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plainImageMaxWidth'] ? $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plainImageMaxWidth'] : 640; 00713 $resolutionLimit_y = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plainImageMaxHeight'] ? $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plainImageMaxHeight'] : 680; 00714 00715 if ($expandFolder) { 00716 $files = t3lib_div::getFilesInDir($expandFolder,($plainFlag?"jpg,jpeg,gif,png":$GLOBALS["TYPO3_CONF_VARS"]["GFX"]["imagefile_ext"]),1,1); // $extensionList="",$prependPath=0,$order="") 00717 if (is_array($files)) { 00718 reset($files); 00719 00720 $out.=$this->barheader(sprintf($LANG->getLL("images").' (%s):',count($files))); 00721 00722 $titleLen=intval($GLOBALS["BE_USER"]->uc["titleLen"]); 00723 $picon='<img src="'.$this->doc->backPath.'gfx/i/_icon_webfolders.gif" width="18" height="16" align=top>'; 00724 $picon.=htmlspecialchars(t3lib_div::fixed_lgd(basename($expandFolder),$titleLen)); 00725 $out.='<span class="nobr">'.$picon.'</span><BR>'; 00726 00727 $imgObj = t3lib_div::makeInstance("t3lib_stdGraphic"); 00728 $imgObj->init(); 00729 $imgObj->mayScaleUp=0; 00730 $imgObj->tempPath=PATH_site.$imgObj->tempPath; 00731 00732 $lines=array(); 00733 while(list(,$filepath)=each($files)) { 00734 $fI=pathinfo($filepath); 00735 00736 $iurl = $this->siteUrl.t3lib_div::rawUrlEncodeFP(substr($filepath,strlen(PATH_site))); 00737 $imgInfo = $imgObj->getImageDimensions($filepath); 00738 00739 $icon = t3lib_BEfunc::getFileIcon(strtolower($fI["extension"])); 00740 $pDim = $imgInfo[0]."x".$imgInfo[1]." pixels"; 00741 $size=" (".t3lib_div::formatSize(filesize($filepath))."bytes, ".$pDim.")"; 00742 $icon = '<img src="'.$this->doc->backPath.'gfx/fileicons/'.$icon.'" width=18 height=16 border=0 title="'.$fI["basename"].$size.'" class="absmiddle">'; 00743 if (!$plainFlag) { 00744 $ATag = '<a href="#" onclick="return jumpToUrl(\'?insertMagicImage='.rawurlencode($filepath).'\');">'; 00745 } else { 00746 $ATag = '<a href="#" onclick="return insertImage(\''.$iurl.'\','.$imgInfo[0].','.$imgInfo[1].');">'; 00747 } 00748 $ATag_e="</a>"; 00749 if ($plainFlag && ($imgInfo[0]>$resolutionLimit_x || $imgInfo[1]>$resolutionLimit_y)) { 00750 $ATag=""; 00751 $ATag_e=""; 00752 $ATag2=""; 00753 $ATag2_e=""; 00754 } else { 00755 $ATag2='<a href="#" onClick="launchView(\''.rawurlencode($filepath).'\'); return false;">'; 00756 $ATag2_e="</a>"; 00757 } 00758 00759 $filenameAndIcon=$ATag.$icon.htmlspecialchars(t3lib_div::fixed_lgd(basename($filepath),$titleLen)).$ATag_e; 00760 00761 00762 $lines[]='<tr class="bgColor4"><td nowrap="nowrap">'.$filenameAndIcon.' </td><td nowrap="nowrap">'.$pDim.' </td></tr>'; 00763 $lines[]='<tr><td colspan=2>'.( 00764 $noThumbs ? 00765 "" : 00766 $ATag2.t3lib_BEfunc::getThumbNail($this->doc->backPath.'thumbs.php',$filepath,'hspace="5" vspace="5" border="1"').$ATag2_e). 00767 '</td></tr>'; 00768 $lines[]='<tr><td colspan=2><img src="clear.gif" width=1 height=3></td></tr>'; 00769 } 00770 $out.='<table border=0 cellpadding=0 cellspacing=1>'.implode("",$lines).'</table>'; 00771 } 00772 } 00773 return $out; 00774 } 00775 00782 function uploadForm($path) { 00783 global $LANG,$SOBE; 00784 // debug($path); 00785 $count=1; 00786 $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path; 00787 $code=$this->barheader($LANG->getLL("uploadImage").":"); 00788 $code.='<table border=0 cellpadding=0 cellspacing=3><FORM action="'.$this->doc->backPath.'tce_file.php" method="post" name="editform" enctype="'.$GLOBALS["TYPO3_CONF_VARS"]["SYS"]["form_enctype"].'"><tr><td>'; 00789 $code.="<strong>".$LANG->getLL("path").":</strong> ".$header."</td></tr><tr><td>"; 00790 for ($a=1;$a<=$count;$a++) { 00791 $code.='<input type="File" name="upload_'.$a.'"'.$this->doc->formWidth(35).' size="50"> 00792 <input type="Hidden" name="file[upload]['.$a.'][target]" value="'.$path.'"> 00793 <input type="Hidden" name="file[upload]['.$a.'][data]" value="'.$a.'"><BR>'; 00794 } 00795 $code.=' 00796 <input type="Hidden" name="redirect" value="' . $BACK_PATH . t3lib_extMgm::extRelPath('rtehtmlarea').'mod4/select_image.php?act='.$this->act.'&expandFolder='.rawurlencode($path).'&RTEtsConfigParams='.rawurlencode(t3lib_div::_GP("RTEtsConfigParams")).'"> 00797 <input type="Submit" name="submit" value="'.$LANG->sL("LLL:EXT:lang/locallang_core.php:file_upload.php.submit").'"> 00798 <div id="c-override"> 00799 <input type="checkbox" name="overwriteExistingFiles" value="1" /> '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:overwriteExistingFiles',1).' 00800 </div> 00801 00802 </td> 00803 </tr> 00804 </FORM> 00805 </table>'; 00806 00807 return $code; 00808 } 00809 00816 function barheader($str) { 00817 global $LANG,$SOBE; 00818 00819 return '<table border=0 cellpadding=2 cellspacing=0 width=100% class="bgColor5"><tr><td><strong>'.$str.'</strong></td></tr></table>'; 00820 } 00821 00828 function printCurrentUrl($str) { 00829 global $LANG,$SOBE; 00830 00831 return '<table border=0 cellpadding=0 cellspacing=0 width=100% class="bgColor5"><tr><td><strong>Current Link:</strong> '.$str.'</td></tr></table>'; 00832 } 00833 } 00834 00835 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/select_image.php']) { 00836 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/select_image.php']); 00837 } 00838 00839 00840 00841 // Make instance: 00842 $SOBE = t3lib_div::makeInstance('tx_rtehtmlarea_select_image'); 00843 $SOBE->preinit(); 00844 $SOBE->magicProcess(); 00845 $SOBE->init(); 00846 $SOBE->main(); 00847 $SOBE->printContent(); 00848 00849 ?>