* Fixes and features to htmlArea RTE extension (see details in local ChangeLog)
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / mod4 / class.tx_rtehtmlarea_dam_browse_media.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
6 * (c) 2004-2006 Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
7 * All rights reserved
8 *
9 * This script is part of the TYPO3 project. The TYPO3 project is
10 * free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * The GNU General Public License can be found at
16 * http://www.gnu.org/copyleft/gpl.html.
17 * A copy is found in the textfile GPL.txt and important notices to the license
18 * from the author is found in LICENSE.txt distributed with these scripts.
19 *
20 *
21 * This script is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * This copyright notice MUST APPEAR in all copies of the script!
27 ***************************************************************/
28 /**
29 * Displays image selector for the RTE
30 *
31 * @author Kasper Skaarhoj <kasper@typo3.com>
32 * @author Stanislas Rolland <stanislas.rolland(arobas)fructifor.ca>
33 *
34 * $Id$ *
35 */
36 require_once(PATH_t3lib.'class.t3lib_stdgraphic.php');
37 require_once(PATH_t3lib.'class.t3lib_basicfilefunc.php');
38 require_once(t3lib_extMgm::extPath('dam').'class.tx_dam_browse_media.php');
39
40 /**
41 * Script Class
42 *
43 * @author Kasper Skaarhoj <kasper@typo3.com>
44 * @package TYPO3
45 * @subpackage tx_rte
46 */
47 class tx_rtehtmlarea_dam_browse_media extends tx_dam_browse_media {
48 var $extKey = 'rtehtmlarea';
49 var $content;
50 var $act;
51 var $allowedItems;
52 var $plainMaxWidth;
53 var $plainMaxHeight;
54 var $magicMaxWidth;
55 var $magicMaxHeight;
56 var $imgPath;
57 var $imgTitleDAMColumn = '';
58 var $classesImageJSOptions;
59 var $editorNo;
60 var $sys_language_content;
61 var $buttonConfig = array();
62
63 /**
64 * Check if this object should be rendered.
65 *
66 * @param string $type Type: "file", ...
67 * @param object $pObj Parent object.
68 * @return boolean
69 * @see SC_browse_links::main()
70 */
71 function isValid($type, &$pObj) {
72 $isValid = false;
73
74 $pArr = explode('|', t3lib_div::_GP('bparams'));
75
76 if ($type=='rte' && $pObj->button == 'image') {
77 $isValid = true;
78 }
79
80 return $isValid;
81 }
82
83 /**
84 * Rendering
85 * Called in SC_browse_links::main() when isValid() returns true;
86 *
87 * @param string $type Type: "file", ...
88 * @param object $pObj Parent object.
89 * @return string Rendered content
90 * @see SC_browse_links::main()
91 */
92 function render($type, &$pObj) {
93 global $LANG, $BE_USER, $BACK_PATH;
94
95 $this->pObj = &$pObj;
96
97 // init class browse_links
98 $this->init();
99
100 switch((string)$this->mode) {
101 case 'rte':
102 $content = $this->main_rte();
103 break;
104 // case 'wizard':
105 // $content = $this->main_rte(1);
106 // break;
107 default:
108 $content = '';
109 break;
110 }
111
112 return $content;
113 }
114
115 /**
116 * Initialisation
117 *
118 * @return [type] ...
119 */
120 function init() {
121 global $BE_USER,$BACK_PATH,$TYPO3_CONF_VARS;
122
123 // Main GPvars:
124 $this->siteUrl = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
125 $this->act = t3lib_div::_GP('act');
126 $this->expandPage = t3lib_div::_GP('expandPage');
127 $this->expandFolder = t3lib_div::_GP('expandFolder');
128
129 // Find RTE parameters
130 $this->bparams = t3lib_div::_GP('bparams');
131 $this->editorNo = t3lib_div::_GP('editorNo');
132 $this->sys_language_content = t3lib_div::_GP('sys_language_content');
133 $this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
134 if (!$this->editorNo) {
135 $pArr = explode('|', $this->bparams);
136 $pRteArr = explode(':', $pArr[1]);
137 $this->editorNo = $pRteArr[0];
138 $this->sys_language_content = $pRteArr[1];
139 $this->RTEtsConfigParams = $pArr[2];
140 }
141
142 // Find "mode"
143 $this->mode = t3lib_div::_GP('mode');
144 if (!$this->mode) {
145 $this->mode='rte';
146 }
147
148 // Site URL
149 $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL'); // Current site url
150
151 // the script to link to
152 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
153
154 if (!$this->act) {
155 $this->act='magic';
156 }
157
158 $RTEtsConfigParts = explode(':', $this->RTEtsConfigParams);
159 $RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
160 $this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
161 $this->imgPath = $RTEtsConfigParts[6];
162
163 if (is_array($this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.']['image.'])) {
164 $this->buttonConfig = $this->thisConfig['buttons.']['image.'];
165 }
166
167 $this->allowedItems = explode(',','magic,plain,dragdrop,image,upload');
168 if (is_array($this->buttonConfig['options.']) && $this->buttonConfig['options.']['removeItems']) {
169 $this->allowedItems = array_diff($this->allowedItems,t3lib_div::trimExplode(',',$this->buttonConfig['options.']['removeItems'],1));
170 } else {
171 $this->allowedItems = array_diff($this->allowedItems,t3lib_div::trimExplode(',',$this->thisConfig['blindImageOptions'],1));
172 }
173
174 reset($this->allowedItems);
175 if (!in_array($this->act,$this->allowedItems)) {
176 $this->act = current($this->allowedItems);
177 }
178
179 if ($this->act == 'magic') {
180 if (is_array($this->buttonConfig['options.']) && is_array($this->buttonConfig['options.']['magic.'])) {
181 if ($this->buttonConfig['options.']['magic.']['maxWidth']) $this->magicMaxWidth = $this->buttonConfig['options.']['magic.']['maxWidth'];
182 if ($this->buttonConfig['options.']['magic.']['maxHeight']) $this->magicMaxHeight = $this->buttonConfig['options.']['magic.']['maxHeight'];
183 }
184 // These defaults allow 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
185 if (!$this->magicMaxWidth) $this->magicMaxWidth = 300;
186 if (!$this->magicMaxHeight) $this->magicMaxHeight = 1000;
187 } elseif ($this->act == 'plain') {
188 if ($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['plainImageMaxWidth']) $this->plainMaxWidth = $TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['plainImageMaxWidth'];
189 if ($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['plainImageMaxHeight']) $this->plainMaxHeight = $TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['plainImageMaxHeight'];
190 if (is_array($this->buttonConfig['options.']) && is_array($this->buttonConfig['options.']['plain.'])) {
191 if ($this->buttonConfig['options.']['plain.']['maxWidth']) $this->plainMaxWidth = $this->buttonConfig['options.']['plain.']['maxWidth'];
192 if ($this->buttonConfig['options.']['plain.']['maxHeight']) $this->plainMaxHeight = $this->buttonConfig['options.']['plain.']['maxHeight'];
193 }
194 if (!$this->plainMaxWidth) $this->plainMaxWidth = 640;
195 if (!$this->plainMaxHeight) $this->plainMaxHeight = 680;
196 }
197
198 if ($this->thisConfig['classesImage']) {
199 $classesImageArray = t3lib_div::trimExplode(',',$this->thisConfig['classesImage'],1);
200 $this->classesImageJSOptions = '<option value=""></option>';
201 reset($classesImageArray);
202 while(list(,$class)=each($classesImageArray)) {
203 $this->classesImageJSOptions .= '<option value="' .$class . '">' . $class . '</option>';
204 }
205 }
206
207 // init the DAM object
208 $this->initDAM();
209
210 $this->getModSettings();
211
212 $this->processParams();
213
214 // Insert the image if we are done
215 $this->imageInsert();
216
217 // Creating backend template object:
218 $this->doc = t3lib_div::makeInstance('template');
219 $this->doc->docType= 'xhtml_trans';
220 $this->doc->backPath = $BACK_PATH;
221
222 $this->getJSCode();
223 }
224
225 /**
226 * [Describe function...]
227 *
228 * @return [type] ...
229 */
230 function rteImageStorageDir() {
231 $dir = $this->imgPath ? $this->imgPath : $GLOBALS['TYPO3_CONF_VARS']['BE']['RTE_imageStorageDir'];;
232 return $dir;
233 }
234
235 /**
236 * [Describe function...]
237 *
238 * @return [type] ...
239 */
240 function imageInsert() {
241 global $TCA,$TYPO3_CONF_VARS;
242
243 if (t3lib_div::_GP('insertImage')) {
244 $filepath = t3lib_div::_GP('insertImage');
245
246 $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
247 $imgObj->init();
248 $imgObj->mayScaleUp=0;
249 $imgObj->tempPath=PATH_site.$imgObj->tempPath;
250 $imgInfo = $imgObj->getImageDimensions($filepath);
251
252 t3lib_div::loadTCA('tx_dam');
253 if (is_array($this->buttonConfig['title.']) && is_array($TCA['tx_dam']['columns'][$this->buttonConfig['title.']['useDAMColumn']])) {
254 $this->imgTitleDAMColumn = $this->buttonConfig['title.']['useDAMColumn'];
255 }
256 if (!$this->imgTitleDAMColumn) $this->imgTitleDAMColumn = 'caption';
257 $imgMetaData = tx_dam::meta_getDataForFile($filepath,'uid,pid,alt_text,hpixels,vpixels,'.$this->imgTitleDAMColumn.','.$TCA['tx_dam']['ctrl']['languageField']);
258 $imgMetaData = $this->getRecordOverlay('tx_dam',$imgMetaData,$this->sys_language_content);
259
260 switch ($this->act) {
261 case 'magic':
262 if (is_array($imgInfo) && count($imgInfo)==4 && $this->rteImageStorageDir() && is_array($imgMetaData)) {
263 $fI=pathinfo($imgInfo[3]);
264 $fileFunc = t3lib_div::makeInstance('t3lib_basicFileFunctions');
265 $basename = $fileFunc->cleanFileName('RTEmagicP_'.$fI['basename']);
266 $destPath =PATH_site.$this->rteImageStorageDir();
267 if (@is_dir($destPath)) {
268 $destName = $fileFunc->getUniqueName($basename,$destPath);
269 @copy($imgInfo[3],$destName);
270
271 $cWidth = t3lib_div::intInRange(t3lib_div::_GP('cWidth'),0,$this->magicMaxWidth);
272 $cHeight = t3lib_div::intInRange(t3lib_div::_GP('cHeight'),0,$this->magicMaxHeight);
273 if (!$cWidth) $cWidth = $this->magicMaxWidth;
274 if (!$cHeight) $cHeight = $this->magicMaxHeight;
275
276 $imgI = $imgObj->imageMagickConvert($filepath,'WEB',$cWidth.'m',$cHeight.'m'); // ($imagefile,$newExt,$w,$h,$params,$frame,$options,$mustCreate=0)
277 if ($imgI[3]) {
278 $fI=pathinfo($imgI[3]);
279 $mainBase='RTEmagicC_'.substr(basename($destName),10).'.'.$fI['extension'];
280 $destName = $fileFunc->getUniqueName($mainBase,$destPath);
281 @copy($imgI[3],$destName);
282 $iurl = $this->siteUrl.substr($destName,strlen(PATH_site));
283 $this->imageInsertJS($iurl,$imgI[0],$imgI[1],$imgMetaData['alt_text'],$imgMetaData[$this->imgTitleDAMColumn],substr($imgInfo[3],strlen(PATH_site)));
284 }
285 }
286 }
287 exit;
288 break;
289 case 'plain':
290 if (is_array($imgInfo) && count($imgInfo)==4 && is_array($imgMetaData)) {
291 $iurl = $this->siteUrl.substr($imgInfo[3],strlen(PATH_site));
292 $this->imageInsertJS($iurl,$imgMetaData['hpixels'],$imgMetaData['vpixels'],$imgMetaData['alt_text'],$imgMetaData[$this->imgTitleDAMColumn],substr($imgInfo[3],strlen(PATH_site)));
293 }
294 exit;
295 break;
296 }
297 }
298 }
299
300 function imageInsertJS($url,$width,$height,$altText,$titleText,$origFile) {
301 global $TYPO3_CONF_VARS;
302
303 echo'
304 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
305 <html>
306 <head>
307 <title>Untitled</title>
308 </head>
309 <script language="javascript" type="text/javascript">
310 /*<![CDATA[*/
311 var editor = window.opener.RTEarea[' . $this->editorNo . ']["editor"];
312 var HTMLArea = window.opener.HTMLArea;
313 function insertImage(file,width,height,alt,title,origFile) {
314 var styleWidth, styleHeight;
315 styleWidth = parseInt(width);
316 if (isNaN(styleWidth) || styleWidth == 0) {
317 styleWidth = "auto";
318 } else {
319 styleWidth += "px";
320 }
321 styleHeight = parseInt(height);
322 if (isNaN(styleHeight) || styleHeight == 0) {
323 styleHeight = "auto";
324 } else {
325 styleHeight += "px";
326 }
327 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"':'').' />\');
328 }
329 /*]]>*/
330 </script>
331 <body>
332 <script type="text/javascript">
333 /*<![CDATA[*/
334 insertImage('.t3lib_div::quoteJSvalue($url,1).','.$width.','.$height.','.t3lib_div::quoteJSvalue($altText,1).','.t3lib_div::quoteJSvalue($titleText,1).','.t3lib_div::quoteJSvalue($origFile,1).');
335 /*]]>*/
336 </script>
337 </body>
338 </html>';
339 }
340
341 /**
342 * [Describe function...]
343 *
344 * @return [type] ...
345 */
346 function getJSCode() {
347 global $LANG,$BACK_PATH,$TYPO3_CONF_VARS;
348
349 $JScode='
350 var editor = window.opener.RTEarea[' . $this->editorNo . ']["editor"];
351 var HTMLArea = window.opener.HTMLArea;
352 function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close) {
353 return jumpToUrl(\''.$this->thisScript.'?act='.$this->act.'&mode='.$this->mode.'&bparams='.$this->bparams.'&insertImage='.'\'+fp);
354 }
355 function jumpToUrl(URL,anchor) { //
356 var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : "";
357 var add_editorNo = URL.indexOf("editorNo=")==-1 ? "&editorNo='.$this->editorNo.'" : "";
358 var add_sys_language_content = URL.indexOf("sys_language_content=")==-1 ? "&sys_language_content='.$this->sys_language_content.'" : "";
359 var RTEtsConfigParams = "&RTEtsConfigParams='.rawurlencode(t3lib_div::_GP('RTEtsConfigParams')).'";
360
361 var cur_width = selectedImageRef ? "&cWidth="+selectedImageRef.style.width : "";
362 var cur_height = selectedImageRef ? "&cHeight="+selectedImageRef.style.height : "";
363
364 var theLocation = URL+add_act+add_editorNo+add_sys_language_content+RTEtsConfigParams+cur_width+cur_height+(anchor?anchor:"");
365 window.location.href = theLocation;
366 return false;
367 }
368 function launchView(url) {
369 var thePreviewWindow="";
370 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");
371 if (thePreviewWindow && thePreviewWindow.focus) {
372 thePreviewWindow.focus();
373 }
374 }
375 function getCurrentImageRef() {
376 if (editor._selectedImage) {
377 return editor._selectedImage;
378 } else {
379 return null;
380 }
381 }
382 function printCurrentImageOptions() {
383 var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . ';
384 if(classesImage) var styleSelector=\'<select name="iClass" style="width:140px;">' . $this->classesImageJSOptions . '</select>\';
385 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>\';
386 var bgColor=\' class="bgColor4"\';
387 var sz="";
388 sz+=\'<table border=0 cellpadding=1 cellspacing=1><form action="" name="imageData">\';
389 if(classesImage) {
390 sz+=\'<tr><td\'+bgColor+\'>'.$LANG->getLL('class').': </td><td>\'+styleSelector+\'</td></tr>\';
391 }
392 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>\';
393 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>\';
394 sz+=\'<tr><td\'+bgColor+\'><label for="iBorder">'.$LANG->getLL('border').': </label></td><td><input type="checkbox" name="iBorder" id="iBorder" value="1" /></td></tr>\';
395 sz+=\'<tr><td\'+bgColor+\'><label for="iFloat">'.$LANG->getLL('float').': </label></td><td>\'+floatSelector+\'</td></tr>\';
396 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>\';
397 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>\';
398 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>\';
399 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>\';
400 '.(($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>\';':'').'
401 sz+=\'<tr><td><input type="submit" value="'.$LANG->getLL('update').'" onClick="return setImageProperties();"></td></tr>\';
402 sz+=\'</form></table>\';
403 return sz;
404 }
405 function setImageProperties() {
406 var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . ';
407 if (selectedImageRef) {
408 if(document.imageData.iWidth.value && document.imageData.iWidth.value != "auto") {
409 selectedImageRef.style.width = document.imageData.iWidth.value + "px";
410 } else {
411 selectedImageRef.style.width = "auto";
412 }
413 selectedImageRef.removeAttribute("width");
414 if(document.imageData.iHeight.value && document.imageData.iHeight.value != "auto") {
415 selectedImageRef.style.height=document.imageData.iHeight.value + "px";
416 } else {
417 selectedImageRef.style.height = "auto";
418 }
419 selectedImageRef.removeAttribute("height");
420
421 selectedImageRef.style.paddingTop = "0px";
422 selectedImageRef.style.paddingBottom = "0px";
423 selectedImageRef.style.paddingRight = "0px";
424 selectedImageRef.style.paddingLeft = "0px";
425 selectedImageRef.style.padding = ""; // this statement ignored by Mozilla 1.3.1
426 if(document.imageData.iVspace.value != "" && !isNaN(parseInt(document.imageData.iVspace.value))) {
427 selectedImageRef.style.paddingTop = parseInt(document.imageData.iVspace.value) + "px";
428 selectedImageRef.style.paddingBottom = selectedImageRef.style.paddingTop;
429 }
430 if(document.imageData.iHspace.value != "" && !isNaN(parseInt(document.imageData.iHspace.value))) {
431 selectedImageRef.style.paddingRight = parseInt(document.imageData.iHspace.value) + "px";
432 selectedImageRef.style.paddingLeft = selectedImageRef.style.paddingRight;
433 }
434 selectedImageRef.removeAttribute("vspace");
435 selectedImageRef.removeAttribute("hspace");
436
437 selectedImageRef.title=document.imageData.iTitle.value;
438 selectedImageRef.alt=document.imageData.iAlt.value;
439
440 selectedImageRef.style.borderStyle = "none";
441 selectedImageRef.style.borderWidth = "0px";
442 selectedImageRef.style.border = ""; // this statement ignored by Mozilla 1.3.1
443 if(document.imageData.iBorder.checked) {
444 selectedImageRef.style.borderStyle = "solid";
445 selectedImageRef.style.borderWidth = "thin";
446 }
447 selectedImageRef.removeAttribute("border");
448
449 var iFloat = document.imageData.iFloat.options[document.imageData.iFloat.selectedIndex].value;
450 if (iFloat || selectedImageRef.style.cssFloat || selectedImageRef.style.styleFloat) {
451 if(document.all) {
452 selectedImageRef.style.styleFloat = iFloat;
453 } else {
454 selectedImageRef.style.cssFloat = iFloat;
455 }
456 }
457
458 if(classesImage) {
459 var iClass = document.imageData.iClass.options[document.imageData.iClass.selectedIndex].value;
460 if (iClass || (selectedImageRef.attributes["class"] && selectedImageRef.attributes["class"].value)) {
461 selectedImageRef.className = iClass;
462 }
463 }
464
465 '.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?'
466 if (document.imageData.iClickEnlarge && document.imageData.iClickEnlarge.checked) selectedImageRef.setAttribute("clickenlarge","1");
467 else selectedImageRef.setAttribute("clickenlarge","0");':'').'
468
469 HTMLArea.edHidePopup();
470 }
471 return false;
472 }
473 function insertImagePropertiesInForm() {
474 var classesImage = ' . ($this->thisConfig['classesImage']?'true':'false') . ';
475 if (selectedImageRef) {
476 var styleWidth, styleHeight, paddingTop, paddingRight;
477 styleWidth = selectedImageRef.style.width ? selectedImageRef.style.width : selectedImageRef.width;
478 styleWidth = parseInt(styleWidth);
479 if (isNaN(styleWidth) || styleWidth == 0) { styleWidth = "auto"; }
480 document.imageData.iWidth.value = styleWidth;
481 styleHeight = selectedImageRef.style.height ? selectedImageRef.style.height : selectedImageRef.height;
482 styleHeight = parseInt(styleHeight);
483 if (isNaN(styleHeight) || styleHeight == 0) { styleHeight = "auto"; }
484 document.imageData.iHeight.value = styleHeight;
485
486 paddingTop = selectedImageRef.style.paddingTop ? selectedImageRef.style.paddingTop : selectedImageRef.vspace;
487 paddingTop = parseInt(paddingTop);
488 if (isNaN(paddingTop) || paddingTop < 0) { paddingTop = ""; }
489 document.imageData.iVspace.value = paddingTop;
490 paddingRight = selectedImageRef.style.paddingRight ? selectedImageRef.style.paddingRight : selectedImageRef.hspace;
491 paddingRight = parseInt(paddingRight);
492 if (isNaN(paddingRight) || paddingRight < 0) { paddingRight = ""; }
493 document.imageData.iHspace.value = paddingRight;
494
495 document.imageData.iTitle.value = selectedImageRef.title;
496 document.imageData.iAlt.value = selectedImageRef.alt;
497
498 if((selectedImageRef.style.borderStyle && selectedImageRef.style.borderStyle != "none" && selectedImageRef.style.borderStyle != "none none none none") || selectedImageRef.border) {
499 document.imageData.iBorder.checked = 1;
500 }
501
502 var fObj=document.imageData.iFloat;
503 var value = (selectedImageRef.style.cssFloat ? selectedImageRef.style.cssFloat : selectedImageRef.style.styleFloat);
504 var l=fObj.length;
505 for (a=0;a<l;a++) {
506 if (fObj.options[a].value == value) {
507 fObj.selectedIndex = a;
508 }
509 }
510
511 if(classesImage) {
512 var fObj=document.imageData.iClass;
513 var value=selectedImageRef.className;
514 var l=fObj.length;
515 for (a=0;a<l;a++) {
516 if (fObj.options[a].value == value) {
517 fObj.selectedIndex = a;
518 }
519 }
520 }
521
522 '.(($TYPO3_CONF_VARS['EXTCONF'][$this->extKey]['enableClickEnlarge'] && !(is_array($this->buttonConfig['clickEnlarge.']) && $this->buttonConfig['clickEnlarge.']['disabled']))?'if (selectedImageRef.getAttribute("clickenlargesrc")) {
523 if (selectedImageRef.getAttribute("clickenlarge") == "1") document.imageData.iClickEnlarge.checked = 1;
524 else document.imageData.iClickEnlarge.removeAttribute("checked");
525 }':'').'
526 }
527 return false;
528 }
529
530 function openDragDrop() {
531 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");
532 window.opener.browserWin = window.open(url,"Typo3WinBrowser","height=350,width=600,status=0,menubar=0,resizable=1,scrollbars=1");
533 HTMLArea.edHidePopup();
534 }
535
536 var selectedImageRef = getCurrentImageRef(); // Setting this to a reference to the image object.
537
538 '.($this->act=='dragdrop'?'openDragDrop();':'');
539
540 // Finally, add the accumulated JavaScript to the template object:
541 $this->doc->JScode = $this->doc->wrapScriptTags($JScode);
542 }
543
544 function reinitParams() {
545 // We need to pass along some RTE parameters
546 if ($this->editorNo) {
547 $pArr = explode('|', $this->bparams);
548 $pArr[1] = implode(':', array($this->editorNo, $this->sys_language_content));
549 $pArr[2] = $this->RTEtsConfigParams;
550 $this->bparams = implode('|', $pArr);
551
552 }
553 // We need to pass along some RTE parameters
554 parent::reinitParams();
555 }
556
557 /**
558 * Return true or false whether thumbs should be displayed or not
559 *
560 * @return boolean
561 */
562 function displayThumbs() {
563 global $BE_USER;
564 // Honor options.noThumbsInRTEimageSelect
565 return parent::displayThumbs() && !$BE_USER->getTSConfigVal('options.noThumbsInRTEimageSelect');
566 // Honor options.noThumbsInRTEimageSelect
567 }
568
569 /**
570 * Create HTML checkbox to enable/disable thumbnail display
571 *
572 * @return string HTML code
573 */
574 function addDisplayOptions() {
575 global $BE_USER;
576
577 // Getting flag for showing/not showing thumbnails:
578 // Honor options.noThumbsInRTEimageSelect
579 $noThumbs = $BE_USER->getTSConfigVal('options.noThumbsInEB') || ($this->mode == 'rte' && $BE_USER->getTSConfigVal('options.noThumbsInRTEimageSelect'));
580 // Honor options.noThumbsInRTEimageSelect
581 if ($noThumbs) {
582 $thumbNailCheckbox = '';
583 } else {
584
585 $thumbNailCheckbox = t3lib_BEfunc::getFuncCheck('', 'SET[displayThumbs]',$this->displayThumbs(), $this->thisScript, t3lib_div::implodeArrayForUrl('',$this->addParams));
586 $description = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:displayThumbs',1);
587 $id = 'l'.uniqid('tx_dam_scbase');
588 $idAttr = ' id="'.$id.'"';
589 $thumbNailCheckbox = str_replace('<input', '<input'.$idAttr, $thumbNailCheckbox);
590 $thumbNailCheckbox .= ' <label for="'.$id.'">'.$description.'</label>';
591 $this->damSC->addOption('html', 'thumbnailCheckbox', $thumbNailCheckbox);
592 }
593 $this->damSC->addOption('funcCheck', 'extendedInfo', $GLOBALS['LANG']->getLL('displayExtendedInfo',1));
594 }
595
596 /**
597 * Render list of files.
598 *
599 * @param array List of files. See t3lib_div::getFilesInDir
600 * @param string $mode EB mode: "db", "file", ...
601 * @return string HTML output
602 */
603 function renderFileList($files, $mode='file') {
604 global $LANG;
605
606 $out = '';
607
608 // Listing the files:
609 if (is_array($files) AND count($files)) {
610
611 $displayThumbs = $this->displayThumbs();
612
613 // Traverse the file list:
614 $lines=array();
615 foreach($files as $fI) {
616
617 if (!$fI['__exists']) {
618 continue;
619 }
620
621 // Create file icon:
622 $titleAttrib = tx_dam_guiFunc::icon_getTitleAttribute($fI);
623 $iconFile = tx_dam::icon_getFileType($fI);
624 $iconTag = tx_dam_guiFunc::icon_getFileTypeImgTag($fI);
625 $iconAndFilename = $iconTag.htmlspecialchars(t3lib_div::fixed_lgd_cs($fI['file_title'], $GLOBALS['BE_USER']->uc['titleLen']));
626
627
628 // Create links for adding the file:
629 if (strstr($fI['file_name_absolute'], ',') || strstr($fI['file_name_absolute'], '|')) { // In case an invalid character is in the filepath, display error message:
630 $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'), ', |'));
631 $ATag_insert = '<a href="#" onclick="alert('.$eMsg.');return false;">';
632
633 // If filename is OK, just add it:
634 } else {
635
636 // JS: insertElement(table, uid, type, filename, fpath, filetype, imagefile ,action, close)
637 $onClick_params = implode (', ', array(
638 "'".$fI['_ref_table']."'",
639 "'".$fI['_ref_id']."'",
640 "'".$mode."'",
641 $this->quoteJSvalue($fI['file_name']),
642 $this->quoteJSvalue($fI['_ref_file_path']),
643 "'".$fI['file_type']."'",
644 "'".$iconFile."'")
645 );
646 $onClick = 'return insertElement('.$onClick_params.');';
647 $ATag_add = '<a href="#" onclick="'.htmlspecialchars($onClick).'"'.$titleAttrib.'>';
648 $onClick = 'return insertElement('.$onClick_params.', \'\', 1);';
649 $ATag_insert = '<a href="#" onclick="'.htmlspecialchars($onClick).'"'.$titleAttrib.'>';
650 }
651
652 // Create link to showing details about the file in a window:
653 if ($fI['__exists']) {
654 $Ahref = $GLOBALS['BACK_PATH'].'show_item.php?table='.rawurlencode($fI['file_name_absolute']).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
655 $ATag_info = '<a href="'.htmlspecialchars($Ahref).'">';
656 $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>';
657
658 } else {
659 $info = '&nbsp;';
660 }
661
662 // Thumbnail/size generation:
663 $clickThumb = '';
664 if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fI['file_type']) AND $displayThumbs AND is_file($fI['file_name_absolute'])) {
665 // adding $GLOBALS['BACK_PATH']
666 $clickThumb = t3lib_BEfunc::getThumbNail($GLOBALS['BACK_PATH'].'thumbs.php', $fI['file_path_absolute'].$fI['file_name'], '');
667 // adding $GLOBALS['BACK_PATH']
668 $clickThumb = '<div style="width:56px; overflow:auto; padding: 5px; background-color:#fff; border:solid 1px #ccc;">'.$ATag_insert.$clickThumb.'</a>'.'</div>';
669 } elseif ($displayThumbs) {
670 $clickThumb = '<div style="width:68px"></div>';
671 }
672
673
674 // Show element:
675 $lines[] = '
676 <tr class="bgColor4">
677 <td valign="top" nowrap="nowrap" style="min-width:20em">'.$ATag_insert.$iconAndFilename.'</a>'.'&nbsp;</td>
678 <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>
679 <td valign="top" nowrap="nowrap" width="1%">'.$info.'</td>
680 </tr>';
681
682
683 $infoText = '';
684 if ($this->getModSettings('extendedInfo')) {
685 $infoText = tx_dam_guiFunc::meta_compileInfoData ($fI, 'file_name, file_size:filesize, _dimensions, caption:truncate:50, instructions', 'table');
686 $infoText = str_replace('<table>', '<table border="0" cellpadding="0" cellspacing="1">', $infoText);
687 $infoText = str_replace('<strong>', '<strong style="font-weight:normal;">', $infoText);
688 $infoText = str_replace('</td><td>', '</td><td class="bgColor-10">', $infoText);
689 }
690
691
692 if ($displayThumbs AND $infoText) {
693 $lines[] = '
694 <tr class="bgColor">
695 <td valign="top" colspan="3">
696 <table border="0" cellpadding="0" cellspacing="0"><tr>
697 <td valign="top">'.$clickThumb.'</td>
698 <td valign="top" style="padding-left:1em">'.$infoText.'</td></tr>
699 </table>
700 <div style="height:0.5em;"></div>
701 </td>
702 </tr>';
703 } elseif ($clickThumb OR $infoText) {
704 $lines[] = '
705 <tr class="bgColor">
706 <td valign="top" colspan="3" style="padding-left:22px">
707 '.$clickThumb.$infoText.'
708 <div style="height:0.5em;"></div>
709 </td>
710 </tr>';
711 }
712
713 $lines[] = '
714 <tr>
715 <td colspan="3"><div style="height:0.5em;"></div></td>
716 </tr>';
717 }
718
719 // Wrap all the rows in table tags:
720 $out .= '
721
722
723
724 <!--
725 File listing
726 -->
727 <table border="0" cellpadding="1" cellspacing="1" id="typo3-fileList">
728 '.implode('',$lines).'
729 </table>';
730 }
731
732 // Return accumulated content for filelisting:
733 return $out;
734 }
735
736 /**
737 * Makes a DAM db query and collects data to be used in EB display
738 *
739 * @param string $allowedFileTypes Comma list of allowed file types
740 * @param string $disallowedFileTypes Comma list of disallowed file types
741 * @param string $mode EB mode: "db", "file", ...
742 * @return array Array of file elements
743 */
744 function getFileListArr($allowedFileTypes, $disallowedFileTypes, $mode) {
745 global $TYPO3_CONF_VARS;
746
747 $filearray = array();
748
749 //
750 // Use the current selection to create a query and count selected records
751 //
752
753 $this->damSC->selection->addSelectionToQuery();
754 $this->damSC->selection->qg->query['FROM']['tx_dam'] = tx_dam_db::getMetaInfoFieldList(true, array('hpixels','vpixels','caption'));
755 #$this->damSC->selection->qg->addSelectFields(...
756 if ($allowedFileTypes) {
757 $extList = '"'.implode ('","', explode(',',$allowedFileTypes)).'"';
758 $this->damSC->selection->qg->addWhere('AND tx_dam.file_type IN ('.$extList.')', 'WHERE', 'tx_dam.file_type');
759 }
760 if ($disallowedFileTypes) {
761 $extList = '"'.implode ('","', explode(',',$disallowedFileTypes)).'"';
762 $this->damSC->selection->qg->addWhere('AND NOT tx_dam.file_type IN ('.$extList.')', 'WHERE', 'NOT tx_dam.file_type');
763 }
764 // selection with limited dimensions
765 if ($this->act == 'plain') {
766 $this->damSC->selection->qg->addWhere('AND tx_dam.hpixels <= '.intval($this->plainMaxWidth), 'WHERE', 'tx_dam.hpixels');
767 $this->damSC->selection->qg->addWhere('AND tx_dam.vpixels <= '.intval($this->plainMaxHeight), 'WHERE', 'tx_dam.vpixels');
768 }
769 // selection with limited dimensions
770
771 $this->damSC->selection->execSelectionQuery(TRUE);
772
773 // any records found?
774 if($this->damSC->selection->pointer->countTotal) {
775
776 // limit query for browsing
777 $this->damSC->selection->addLimitToQuery();
778 $this->damSC->selection->execSelectionQuery();
779
780 if($this->damSC->selection->res) {
781 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($this->damSC->selection->res)) {
782
783 $row['file_title'] = $row['title'] ? $row['title'] : $row['file_name'];
784 $row['file_path_absolute'] = tx_dam::path_makeAbsolute($row['file_path']);
785 $row['file_name_absolute'] = $row['file_path_absolute'].$row['file_name'];
786 $row['__exists'] = @is_file($row['file_name_absolute']);
787
788 if ($mode=='db') {
789 $row['_ref_table'] = 'tx_dam';
790 $row['_ref_id'] = $row['uid'];
791 $row['_ref_file_path'] = '';
792 } else {
793 $row['_ref_table'] = '';
794 $row['_ref_id'] = t3lib_div::shortMD5($row['file_name_absolute']);
795 $row['_ref_file_path'] = $row['file_name_absolute'];
796 }
797
798 $filearray[] = $row;
799 if (count($filearray) >= $this->damSC->selection->pointer->itemsPerPage) {
800 break;
801 }
802 }
803 }
804 }
805
806 return $filearray;
807 }
808
809 /**
810 * [Describe function...]
811 *
812 * @return [type] ...
813 */
814 function main_rte() {
815 global $LANG, $TYPO3_CONF_VARS, $FILEMOUNTS, $BE_USER;
816
817 $path = tx_dam::path_makeAbsolute($this->damSC->path);
818 if (!$path OR !@is_dir($path)) {
819 $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
820 $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
821 $path = $fileProcessor->findTempFolder().'/'; // The closest TEMP-path is found
822 }
823 $this->damSC->path = tx_dam::path_makeRelative($path); // mabe not needed
824
825 // Starting content:
826 $this->content = $this->doc->startPage($LANG->getLL('Insert Image',1));
827
828 $this->reinitParams();
829
830 // Making menu in top:
831 $menuDef = array();
832 if (in_array('image',$this->allowedItems) && ($this->act=='image' || t3lib_div::_GP('cWidth'))) {
833 $menuDef['page']['isActive'] = $this->act=='image';
834 $menuDef['page']['label'] = $LANG->getLL('currentImage',1);
835 $menuDef['page']['url'] = '#';
836 $menuDef['page']['addParams'] = 'onClick="jumpToUrl(\''.htmlspecialchars($this->thisScript.'?act=image&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"';
837 }
838 if (in_array('magic',$this->allowedItems)){
839 $menuDef['file']['isActive'] = $this->act=='magic';
840 $menuDef['file']['label'] = $LANG->getLL('magicImage',1);
841 $menuDef['file']['url'] = '#';
842 $menuDef['file']['addParams'] = 'onClick="jumpToUrl(\''.htmlspecialchars($this->thisScript.'?act=magic&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"';
843 }
844 if (in_array('plain',$this->allowedItems)) {
845 $menuDef['url']['isActive'] = $this->act=='plain';
846 $menuDef['url']['label'] = $LANG->getLL('plainImage',1);
847 $menuDef['url']['url'] = '#';
848 $menuDef['url']['addParams'] = 'onClick="jumpToUrl(\''.htmlspecialchars($this->thisScript.'?act=plain&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"';
849 }
850 if (in_array('dragdrop',$this->allowedItems)) {
851 $menuDef['mail']['isActive'] = $this->act=='dragdrop';
852 $menuDef['mail']['label'] = $LANG->getLL('dragDropImage',1);
853 $menuDef['mail']['url'] = '#';
854 $menuDef['mail']['addParams'] = 'onClick="openDragDrop();return false;"';
855 }
856 if (in_array('upload', $this->allowedItems)) {
857 $menuDef['upload']['isActive'] = ($this->act=='upload');
858 $menuDef['upload']['label'] = $LANG->getLL('tx_dam_file_upload.title',1);
859 $menuDef['upload']['url'] = '#';
860 $menuDef['upload']['addParams'] = 'onclick="jumpToUrl(\''.htmlspecialchars($this->thisScript.'?act=upload&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"';
861 }
862 $this->content .= $this->doc->getTabMenuRaw($menuDef);
863
864 switch($this->act) {
865 case 'image':
866 $JScode = '
867 document.write(printCurrentImageOptions());
868 insertImagePropertiesInForm();';
869 $this->content.= '<br />'.$this->doc->wrapScriptTags($JScode);
870 break;
871 case 'upload':
872 $this->content.= $this->dam_upload($this->allowedFileTypes, $this->disallowedFileTypes);
873 $this->content.= $this->damSC->getOptions();
874 $this->content.='<br /><br />';
875 if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB')) {
876 $this->content.= $this->createFolder($path);
877 $this->content.= '<br />';
878 }
879 break;
880 case 'plain':
881 $this->allowedFileTypes = 'jpg,jpeg,gif,png';
882 case 'magic':
883 $this->addDisplayOptions();
884 $this->content.= $this->dam_select($this->allowedFileTypes, $this->disallowedFileTypes);
885 $this->content.= $this->damSC->getOptions();
886
887 if ($this->act=='magic') {
888 $this->content .= $this->getMsgBox($LANG->getLL('magicImage_msg'));
889 }
890 if ($this->act=='plain') {
891 $this->content .= $this->getMsgBox(sprintf($LANG->getLL('plainImage_msg'), $this->plainMaxWidth, $this->plainMaxHeight));
892 }
893 break;
894 default:
895 break;
896 }
897 // Ending page, returning content:
898 $this->content.= $this->doc->endPage();
899 $this->content = $this->damSC->doc->insertStylesAndJS($this->content);
900 return $this->content;
901 }
902
903 /**
904 * Import from t3lib_page in order to create backend version
905 * Creates language-overlay for records in general (where translation is found in records from the same table)
906 *
907 * @param string Table name
908 * @param array Record to overlay. Must containt uid, pid and $table]['ctrl']['languageField']
909 * @param integer Pointer to the sys_language uid for content on the site.
910 * @param string Overlay mode. If "hideNonTranslated" then records without translation will not be returned un-translated but unset (and return value is false)
911 * @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.
912 */
913 function getRecordOverlay($table,$row,$sys_language_content,$OLmode='') {
914 global $TCA, $TYPO3_DB;
915 if ($row['uid']>0 && $row['pid']>0) {
916 if ($TCA[$table] && $TCA[$table]['ctrl']['languageField'] && $TCA[$table]['ctrl']['transOrigPointerField']) {
917 if (!$TCA[$table]['ctrl']['transOrigPointerTable']) {
918 // Will try to overlay a record only if the sys_language_content value is larger that zero.
919 if ($sys_language_content>0) {
920 // Must be default language or [All], otherwise no overlaying:
921 if ($row[$TCA[$table]['ctrl']['languageField']]<=0) {
922 // Select overlay record:
923 $res = $TYPO3_DB->exec_SELECTquery(
924 '*',
925 $table,
926 'pid='.intval($row['pid']).
927 ' AND '.$TCA[$table]['ctrl']['languageField'].'='.intval($sys_language_content).
928 ' AND '.$TCA[$table]['ctrl']['transOrigPointerField'].'='.intval($row['uid']).
929 t3lib_BEfunc::BEenableFields($table).
930 t3lib_BEfunc::deleteClause($table),
931 '',
932 '',
933 '1'
934 );
935 $olrow = $TYPO3_DB->sql_fetch_assoc($res);
936 //$this->versionOL($table,$olrow);
937
938 // Merge record content by traversing all fields:
939 if (is_array($olrow)) {
940 foreach($row as $fN => $fV) {
941 if ($fN!='uid' && $fN!='pid' && isset($olrow[$fN])) {
942 if ($TCA[$table]['l10n_mode'][$fN]!='exclude' && ($TCA[$table]['l10n_mode'][$fN]!='mergeIfNotBlank' || strcmp(trim($olrow[$fN]),''))) {
943 $row[$fN] = $olrow[$fN];
944 }
945 }
946 }
947 } 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.
948 unset($row);
949 }
950
951 // 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.
952 } elseif ($sys_language_content!=$row[$TCA[$table]['ctrl']['languageField']]) {
953 unset($row);
954 }
955 } else {
956 // When default language is displayed, we never want to return a record carrying another language!:
957 if ($row[$TCA[$table]['ctrl']['languageField']]>0) {
958 unset($row);
959 }
960 }
961 }
962 }
963 }
964
965 return $row;
966 }
967
968 }
969
970 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/class.tx_rtehtmlarea_dam_browse_media.php']) {
971 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/class.tx_rtehtmlarea_dam_browse_media.php']);
972 }
973
974 ?>