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