0f5af342b8bd79e7a540a69bc152bb7cc0006f26
[Packages/TYPO3.CMS.git] / typo3 / sysext / rtehtmlarea / mod3 / class.tx_rtehtmlarea_browse_links.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 * (c) 2005-2008 Stanislas Rolland <typo3(arobas)sjbr.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 the page/file tree for browsing database records or files.
30 * Used from TCEFORMS an other elements
31 * In other words: This is the ELEMENT BROWSER!
32 *
33 * Adapted for htmlArea RTE by Stanislas Rolland
34 *
35 * $Id$
36 *
37 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
38 * @author Stanislas Rolland <typo3(arobas)sjbr.ca>
39 */
40
41 require_once (PATH_typo3.'class.browse_links.php');
42 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
43
44
45 /**
46 * Class which generates the page tree
47 *
48 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
49 * @package TYPO3
50 * @subpackage core
51 */
52 class tx_rtehtmlarea_pageTree extends rtePageTree {
53
54 /**
55 * Create the page navigation tree in HTML
56 *
57 * @param array Tree array
58 * @return string HTML output.
59 */
60 function printTree($treeArr='') {
61 global $BACK_PATH;
62 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
63 if (!is_array($treeArr)) $treeArr=$this->tree;
64
65 $out='';
66 $c=0;
67
68 foreach($treeArr as $k => $v) {
69 $c++;
70 $bgColorClass = ($c+1)%2 ? 'bgColor' : 'bgColor-10';
71 if ($GLOBALS['SOBE']->browser->curUrlInfo['act']=='page' && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']==$v['row']['uid'] && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']) {
72 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
73 $bgColorClass='bgColor4';
74 } else {
75 $arrCol='<td></td>';
76 }
77
78 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&editorNo='.$GLOBALS['SOBE']->browser->editorNo.'&contentTypo3Language='.$GLOBALS['SOBE']->browser->contentTypo3Language.'&contentTypo3Charset='.$GLOBALS['SOBE']->browser->contentTypo3Charset.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandPage='.$v['row']['uid'].'\');';
79 $cEbullet = $this->ext_isLinkable($v['row']['doktype'],$v['row']['uid']) ?
80 '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' :
81 '';
82 $out.='
83 <tr class="'.$bgColorClass.'">
84 <td nowrap="nowrap"'.($v['row']['_CSSCLASS'] ? ' class="'.$v['row']['_CSSCLASS'].'"' : '').'>'.
85 $v['HTML'].
86 $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$this->ext_pArrPages).
87 '</td>'.
88 $arrCol.
89 '<td>'.$cEbullet.'</td>
90 </tr>';
91 }
92 $out='
93
94
95 <!--
96 Navigation Page Tree:
97 -->
98 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
99 '.$out.'
100 </table>';
101 return $out;
102 }
103 }
104
105 /**
106 * Base extension class which generates the folder tree.
107 * Used directly by the RTE.
108 *
109 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
110 * @package TYPO3
111 * @subpackage core
112 */
113 class tx_rtehtmlarea_folderTree extends rteFolderTree {
114
115 /**
116 * Wrapping the title in a link, if applicable.
117 *
118 * @param string Title, ready for output.
119 * @param array The "record"
120 * @return string Wrapping title string.
121 */
122 function wrapTitle($title,$v) {
123 if ($this->ext_isLinkable($v)) {
124 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&editorNo='.$GLOBALS['SOBE']->browser->editorNo.'&contentTypo3Language='.$GLOBALS['SOBE']->browser->contentTypo3Language.'&contentTypo3Charset='.$GLOBALS['SOBE']->browser->contentTypo3Charset.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandFolder='.rawurlencode($v['path']).'\');';
125 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
126 } else {
127 return '<span class="typo3-dimmed">'.$title.'</span>';
128 }
129 }
130
131 /**
132 * Create the folder navigation tree in HTML
133 *
134 * @param mixed Input tree array. If not array, then $this->tree is used.
135 * @return string HTML output of the tree.
136 */
137 function printTree($treeArr='') {
138 global $BACK_PATH;
139 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
140
141 if (!is_array($treeArr)) $treeArr=$this->tree;
142
143 $out='';
144 $c=0;
145
146 // Preparing the current-path string (if found in the listing we will see a red blinking arrow).
147 if (!$GLOBALS['SOBE']->browser->curUrlInfo['value']) {
148 $cmpPath='';
149 } else if (substr(trim($GLOBALS['SOBE']->browser->curUrlInfo['info']),-1)!='/') {
150 $cmpPath=PATH_site.dirname($GLOBALS['SOBE']->browser->curUrlInfo['info']).'/';
151 } else {
152 $cmpPath=PATH_site.$GLOBALS['SOBE']->browser->curUrlInfo['info'];
153 }
154
155 // Traverse rows for the tree and print them into table rows:
156 foreach($treeArr as $k => $v) {
157 $c++;
158 $bgColorClass=($c+1)%2 ? 'bgColor' : 'bgColor-10';
159
160 // Creating blinking arrow, if applicable:
161 if ($GLOBALS['SOBE']->browser->curUrlInfo['act']=='file' && $cmpPath==$v['row']['path']) {
162 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
163 $bgColorClass='bgColor4';
164 } else {
165 $arrCol='<td></td>';
166 }
167 // Create arrow-bullet for file listing (if folder path is linkable):
168 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&editorNo='.$GLOBALS['SOBE']->browser->editorNo.'&contentTypo3Language='.$GLOBALS['SOBE']->browser->contentTypo3Language.'&contentTypo3Charset='.$GLOBALS['SOBE']->browser->contentTypo3Charset.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandFolder='.rawurlencode($v['row']['path']).'\');';
169 $cEbullet = $this->ext_isLinkable($v['row']) ? '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' : '';
170
171 // Put table row with folder together:
172 $out.='
173 <tr class="'.$bgColorClass.'">
174 <td nowrap="nowrap">'.$v['HTML'].$this->wrapTitle(t3lib_div::fixed_lgd_cs($v['row']['title'],$titleLen),$v['row']).'</td>
175 '.$arrCol.'
176 <td>'.$cEbullet.'</td>
177 </tr>';
178 }
179
180 $out='
181
182 <!--
183 Folder tree:
184 -->
185 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
186 '.$out.'
187 </table>';
188 return $out;
189 }
190
191 }
192
193 /**
194 * Script class for the Element Browser window.
195 *
196 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
197 * @package TYPO3
198 * @subpackage core
199 */
200 class tx_rtehtmlarea_browse_links extends browse_links {
201
202 var $editorNo;
203 var $contentTypo3Language;
204 var $contentTypo3Charset;
205 public $buttonConfig = array();
206 public $RTEProperties = array();
207
208 public $anchorTypes = array( 'page', 'url', 'file', 'mail', 'spec');
209 protected $classesAnchorDefault = array();
210 protected $classesAnchorDefaultTitle = array();
211 protected $classesAnchorDefaultTarget = array();
212 protected $classesAnchorJSOptions = array();
213
214 public $allowedItems;
215
216 /**
217 * Constructor:
218 * Initializes a lot of variables, setting JavaScript functions in header etc.
219 *
220 * @return void
221 */
222 function init() {
223 global $BACK_PATH,$LANG,$TYPO3_CONF_VARS;
224
225 $this->initVariables();
226 $this->initConfiguration();
227 $this->initHookObjects('ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php');
228
229 // Initializing the title value
230 $this->setTitle = $LANG->csConvObj->conv($this->curUrlArray['title'], 'utf-8', $LANG->charSet);
231
232 // Rich Text Editor specific configuration:
233 $addPassOnParams='';
234 $classSelected = array();
235 $addPassOnParams .= '&RTEtsConfigParams='.rawurlencode($this->RTEtsConfigParams);
236 $addPassOnParams .= ($this->contentTypo3Language ? '&contentTypo3Language=' . rawurlencode($this->contentTypo3Language) : '');
237 $addPassOnParams .= ($this->contentTypo3Charset ? '&contentTypo3Charset=' . rawurlencode($this->contentTypo3Charset) : '');
238 if ($this->thisConfig['classesAnchor'] || $this->thisConfig['classesLinks']) {
239 $this->setClass = $this->curUrlArray['class'];
240 if ($this->thisConfig['classesAnchor']) {
241 $classesAnchorArray = t3lib_div::trimExplode(',',$this->thisConfig['classesAnchor'], 1);
242 } else {
243 $classesAnchorArray = t3lib_div::trimExplode(',',$this->thisConfig['classesLinks'], 1);
244 }
245 $classesAnchor = array();
246 $classesAnchor['all'] = array();
247 if (is_array($this->RTEProperties['classesAnchor.'])) {
248 reset($this->RTEProperties['classesAnchor.']);
249 while(list($label,$conf)=each($this->RTEProperties['classesAnchor.'])) {
250 if (in_array($conf['class'], $classesAnchorArray)) {
251 $classesAnchor['all'][] = $conf['class'];
252 if (in_array($conf['type'], $this->anchorTypes)) {
253 $classesAnchor[$conf['type']][] = $conf['class'];
254 if (is_array($this->thisConfig['classesAnchor.']) && is_array($this->thisConfig['classesAnchor.']['default.']) && $this->thisConfig['classesAnchor.']['default.'][$conf['type']] == $conf['class']) {
255 $this->classesAnchorDefault[$conf['type']] = $conf['class'];
256 if ($conf['titleText']) {
257 $this->classesAnchorDefaultTitle[$conf['type']] = $this->getLLContent(trim($conf['titleText']));
258 }
259 if ($conf['target']) {
260 $this->classesAnchorDefaultTarget[$conf['type']] = trim($conf['target']);
261 }
262 }
263 }
264 }
265 }
266 }
267 foreach ($this->anchorTypes as $anchorType) {
268 foreach ($classesAnchorArray as $class) {
269 if (!in_array($class, $classesAnchor['all']) || (in_array($class, $classesAnchor['all']) && is_array($classesAnchor[$anchorType]) && in_array($class, $classesAnchor[$anchorType]))) {
270 $selected = '';
271 if ($this->setClass == $class || (!$this->setClass && $this->classesAnchorDefault[$anchorType] == $class)) {
272 $selected = 'selected="selected"';
273 $classSelected[$anchorType] = true;
274 }
275 $classLabel = (is_array($this->RTEProperties['classes.']) && is_array($this->RTEProperties['classes.'][$class.'.']) && $this->RTEProperties['classes.'][$class.'.']['name']) ? $this->getPageConfigLabel($this->RTEProperties['classes.'][$class.'.']['name'], 0) : $class;
276 $classStyle = (is_array($this->RTEProperties['classes.']) && is_array($this->RTEProperties['classes.'][$class.'.']) && $this->RTEProperties['classes.'][$class.'.']['value']) ? $this->RTEProperties['classes.'][$class.'.']['value'] : '';
277 $this->classesAnchorJSOptions[$anchorType] .= '<option ' . $selected . ' value="' .$class . '"' . ($classStyle?' style="'.$classStyle.'"':'') . '>' . $classLabel . '</option>';
278 }
279 }
280 if ($this->classesAnchorJSOptions[$anchorType]) {
281 $selected = '';
282 if (!$this->setClass && !$this->classesAnchorDefault[$anchorType]) $selected = 'selected="selected"';
283 $this->classesAnchorJSOptions[$anchorType] = '<option ' . $selected . ' value=""></option>' . $this->classesAnchorJSOptions[$anchorType];
284 }
285 }
286 }
287
288 // Initializing the target value
289 // Unset the target if it is set to a value different than default and if no class is selected and the target field is not displayed
290 // In other words, do not forward the target if we changed tab and the target field is not displayed
291 $this->setTarget = (isset($this->curUrlArray['target'])
292 && !(
293 ($this->curUrlArray['target'] != $this->thisConfig['defaultLinkTarget'])
294 && !$classSelected[$this->act]
295 && is_array($this->buttonConfig['targetSelector.']) && $this->buttonConfig['targetSelector.']['disabled'] && is_array($this->buttonConfig['popupSelector.']) && $this->buttonConfig['popupSelector.']['disabled'])
296 ) ? $this->curUrlArray['target'] : '';
297 if ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target'])) {
298 $this->setTarget=$this->thisConfig['defaultLinkTarget'];
299 }
300
301 // Creating backend template object:
302 $this->doc = t3lib_div::makeInstance('template');
303 $this->doc->bodyTagAdditions = 'onLoad="initDialog();"';
304 $this->doc->backPath = $BACK_PATH;
305
306 // BEGIN accumulation of header JavaScript:
307 $JScode = '';
308 $JScode.= '
309 var dialog = window.opener.HTMLArea.Dialog.TYPO3Link;
310 var plugin = dialog.plugin;
311 var HTMLArea = window.opener.HTMLArea;
312
313 function initDialog() {
314 window.dialog = window.opener.HTMLArea.Dialog.TYPO3Link;
315 window.plugin = dialog.plugin;
316 window.HTMLArea = window.opener.HTMLArea;
317 dialog.captureEvents("skipUnload");
318 }
319 // This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...
320 var add_href="'.($this->curUrlArray['href']?'&curUrl[href]='.rawurlencode($this->curUrlArray['href']):'').'";
321 var add_target="'.($this->setTarget?'&curUrl[target]='.rawurlencode($this->setTarget):'').'";
322 var add_class="'.($this->setClass?'&curUrl[class]='.rawurlencode($this->setClass):'').'";
323 var add_title="'.($this->setTitle?'&curUrl[title]='.rawurlencode($this->setTitle):'').'";
324 var add_params="'.($this->bparams?'&bparams='.rawurlencode($this->bparams):'').'";
325
326 var cur_href="'.($this->curUrlArray['href'] ? ($this->curUrlInfo['query'] ? substr($this->curUrlArray['href'], 0, -strlen($this->curUrlInfo['query'])) :$this->curUrlArray['href']):'').'";
327 var cur_target="'.($this->setTarget?$this->setTarget:'').'";
328 var cur_class="'.($this->setClass?$this->setClass:'').'";
329 var cur_title="'.($this->setTitle?$this->setTitle:'').'";
330
331 function setTarget(value) {
332 cur_target=value;
333 add_target="&curUrl[target]="+encodeURIComponent(value);
334 }
335 function setClass(value) {
336 cur_class=value;
337 add_class="&curUrl[class]="+encodeURIComponent(value);
338 }
339 function setTitle(value) {
340 cur_title=value;
341 add_title="&curUrl[title]="+encodeURIComponent(value);
342 }
343 function setValue(value) {
344 cur_href=value;
345 add_href="&curUrl[href]="+value;
346 }
347 ';
348
349 // Functions used, if the link selector is in RTE mode:
350 $JScode.='
351 function link_typo3Page(id,anchor) {
352 var parameters = document.ltargetform.query_parameters ? (document.ltargetform.query_parameters.value.charAt(0) == "&"?"":"&") + document.ltargetform.query_parameters.value : "";
353 var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"")+parameters;
354 if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
355 if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
356 if (document.ltargetform.ltarget) setTarget(document.ltargetform.ltarget.value);
357 plugin.createLink(theLink,cur_target,cur_class,cur_title);
358 return false;
359 }
360 function link_folder(folder) { //
361 var theLink = \''.$this->siteURL.'\'+folder;
362 if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
363 if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
364 if (document.ltargetform.ltarget) setTarget(document.ltargetform.ltarget.value);
365 plugin.createLink(theLink,cur_target,cur_class,cur_title);
366 return false;
367 }
368 function link_spec(theLink) { //
369 if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
370 if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
371 if (document.ltargetform.ltarget) setTarget(document.ltargetform.ltarget.value);
372 plugin.createLink(theLink,cur_target,cur_class,cur_title);
373 return false;
374 }
375 function link_current() { //
376 var parameters = document.ltargetform.query_parameters ? (document.ltargetform.query_parameters.value.charAt(0) == "&"?"":"&") + document.ltargetform.query_parameters.value : "";
377 if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
378 if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
379 if (document.ltargetform.ltarget) setTarget(document.ltargetform.ltarget.value);
380 if (cur_href!="http://" && cur_href!="mailto:") {
381 plugin.createLink(cur_href + parameters,cur_target,cur_class,cur_title);
382 }
383 return false;
384 }
385 ';
386
387 // General "jumpToUrl" function:
388 $JScode.='
389 function jumpToUrl(URL,anchor) { //
390 var add_editorNo = URL.indexOf("editorNo=")==-1 ? "&editorNo='.$this->editorNo.'" : "";
391 var add_contentTypo3Language = URL.indexOf("contentTypo3Language=")==-1 ? "&contentTypo3Language='.$this->contentTypo3Language.'" : "";
392 var add_contentTypo3Charset = URL.indexOf("contentTypo3Charset=")==-1 ? "&contentTypo3Charset='.$this->contentTypo3Charset.'" : "";
393 var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : "";
394 var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$this->mode.'" : "";
395 var theLocation = URL+add_act+add_editorNo+add_contentTypo3Language+add_contentTypo3Charset+add_mode+add_href+add_target+add_class+add_title+add_params'.($addPassOnParams?'+"'.$addPassOnParams.'"':'').'+(anchor?anchor:"");
396 window.location.href = theLocation;
397 return false;
398 }
399 ';
400 // This is JavaScript especially for the TBE Element Browser!
401 $pArr = explode('|',$this->bparams);
402 $formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';
403 $JScode.='
404 var elRef="";
405 var targetDoc="";
406
407 function launchView(url) { //
408 var thePreviewWindow="";
409 thePreviewWindow = window.open("' . $BACK_PATH . 'show_item.php?table="+url,"ShowItem","height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
410 if (thePreviewWindow && thePreviewWindow.focus) {
411 thePreviewWindow.focus();
412 }
413 }
414 function setReferences() { //
415 if (parent.window.opener
416 && parent.window.opener.content
417 && parent.window.opener.content.document.editform
418 && parent.window.opener.content.document.editform["'.$formFieldName.'"]
419 ) {
420 targetDoc = parent.window.opener.content.document;
421 elRef = targetDoc.editform["'.$formFieldName.'"];
422 return true;
423 } else {
424 return false;
425 }
426 }
427 function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close) { //
428 if (1=='.($pArr[0]&&!$pArr[1]&&!$pArr[2] ? 1 : 0).') {
429 addElement(filename,table+"_"+uid,fp,close);
430 } else {
431 if (setReferences()) {
432 parent.window.opener.group_change("add","'.$pArr[0].'","'.$pArr[1].'","'.$pArr[2].'",elRef,targetDoc);
433 } else {
434 alert("Error - reference to main window is not set properly!");
435 }
436 if (close) {
437 parent.window.opener.focus();
438 parent.close();
439 }
440 }
441 return false;
442 }
443 function addElement(elName,elValue,altElValue,close) { //
444 if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin) {
445 parent.window.opener.setFormValueFromBrowseWin("'.$pArr[0].'",altElValue?altElValue:elValue,elName);
446 if (close) {
447 parent.window.opener.focus();
448 parent.close();
449 }
450 } else {
451 alert("Error - reference to main window is not set properly!");
452 parent.close();
453 }
454 }
455 ';
456 // Finally, add the accumulated JavaScript to the template object:
457 $this->doc->JScode = $this->doc->wrapScriptTags($JScode);
458 }
459
460 /**
461 * Initialize class variables
462 *
463 * @return void
464 */
465 public function initVariables() {
466
467 // Process bparams
468 $this->bparams = t3lib_div::_GP('bparams');
469 $pArr = explode('|', $this->bparams);
470 $pRteArr = explode(':', $pArr[1]);
471 $this->editorNo = $pRteArr[0];
472 $this->contentTypo3Language = $pRteArr[1];
473 $this->contentTypo3Charset = $pRteArr[2];
474 $this->RTEtsConfigParams = $pArr[2];
475 if (!$this->editorNo) {
476 $this->editorNo = t3lib_div::_GP('editorNo');
477 $this->contentTypo3Language = t3lib_div::_GP('contentTypo3Language');
478 $this->contentTypo3Charset = t3lib_div::_GP('contentTypo3Charset');
479 $this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
480 }
481 $this->pointer = t3lib_div::_GP('pointer');
482 $this->expandPage = t3lib_div::_GP('expandPage');
483 $this->expandFolder = t3lib_div::_GP('expandFolder');
484 $this->P = t3lib_div::_GP('P');
485 $this->PM = t3lib_div::_GP('PM');
486 $pArr[1] = implode(':', array($this->editorNo, $this->contentTypo3Language, $this->contentTypo3Charset));
487 $pArr[2] = $this->RTEtsConfigParams;
488 $this->bparams = implode('|', $pArr);
489
490 // Find "mode"
491 $this->mode = t3lib_div::_GP('mode');
492 if (!$this->mode) {
493 $this->mode = 'rte';
494 }
495 // Current site url
496 $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
497
498 // the script to link to
499 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
500
501 // CurrentUrl - the current link url must be passed around if it exists
502 $this->curUrlArray = t3lib_div::_GP('curUrl');
503 if ($this->curUrlArray['all']) {
504 $this->curUrlArray=t3lib_div::get_tag_attributes($this->curUrlArray['all']);
505 }
506 $this->curUrlArray['href'] = utf8_decode($this->curUrlArray['href']);
507 $this->curUrlInfo = $this->parseCurUrl($this->curUrlArray['href'],$this->siteURL);
508
509 // Determine nature of current url:
510 $this->act = t3lib_div::_GP('act');
511 if (!$this->act) {
512 $this->act=$this->curUrlInfo['act'];
513 }
514 }
515
516 /**
517 * Initializes the configuration variables
518 *
519 * @return void
520 */
521 public function initConfiguration() {
522 $this->thisConfig = $this->getRTEConfig();
523 $this->buttonConfig = $this->getButtonConfig('link');
524 }
525
526 /**
527 * Get the RTE configuration from Page TSConfig
528 *
529 * @return array RTE configuration array
530 */
531 protected function getRTEConfig() {
532 global $BE_USER;
533
534 $RTEtsConfigParts = explode(':', $this->RTEtsConfigParams);
535 $RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
536 $this->RTEProperties = $RTEsetup['properties'];
537 return t3lib_BEfunc::RTEsetup($this->RTEProperties, $RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
538 }
539
540 /**
541 * Get the configuration of the button
542 *
543 * @param string $buttonName: the name of the button
544 * @return array the configuration array of the image button
545 */
546 protected function getButtonConfig($buttonName) {
547 return ((is_array($this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.'][$buttonName.'.'])) ? $this->thisConfig['buttons.'][$buttonName.'.'] : array());
548 }
549
550 /**
551 * Initialize hook objects implementing interface t3lib_browseLinksHook
552 * @param string $hookKey: the hook key
553 * @return void
554 */
555 protected function initHookObjects($hookKey) {
556 global $TYPO3_CONF_VARS;
557 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS'][$hookKey]['browseLinksHook'])) {
558 foreach ($TYPO3_CONF_VARS['SC_OPTIONS'][$hookKey]['browseLinksHook'] as $classData) {
559 $processObject = &t3lib_div::getUserObj($classData);
560 if(!($processObject instanceof t3lib_browseLinksHook)) {
561 throw new UnexpectedValueException('$processObject must implement interface t3lib_browseLinksHook', 1195115652);
562 }
563 $parameters = array();
564 $processObject->init($this, $parameters);
565 $this->hookObjects[] = $processObject;
566 }
567 }
568 }
569
570 /******************************************************************
571 *
572 * Main functions
573 *
574 ******************************************************************/
575 /**
576 * Rich Text Editor (RTE) link selector (MAIN function)
577 * Generates the link selector for the Rich Text Editor.
578 * Can also be used to select links for the TCEforms (see $wiz)
579 *
580 * @param boolean If set, the "remove link" is not shown in the menu: Used for the "Select link" wizard which is used by the TCEforms
581 * @return string Modified content variable.
582 */
583 function main_rte($wiz=0) {
584 global $LANG, $BE_USER, $BACK_PATH;
585
586 // Starting content:
587 $content=$this->doc->startPage($LANG->getLL('Insert/Modify Link',1));
588
589 // Initializing the action value, possibly removing blinded values etc:
590 $this->allowedItems = explode(',','page,file,url,mail,spec');
591
592 //call hook for extra options
593 foreach($this->hookObjects as $hookObject) {
594 $this->allowedItems = $hookObject->addAllowedItems($this->allowedItems);
595 }
596
597 if (is_array($this->buttonConfig['options.']) && $this->buttonConfig['options.']['removeItems']) {
598 $this->allowedItems = array_diff($this->allowedItems,t3lib_div::trimExplode(',',$this->buttonConfig['options.']['removeItems'],1));
599 } else {
600 $this->allowedItems = array_diff($this->allowedItems,t3lib_div::trimExplode(',',$this->thisConfig['blindLinkOptions'],1));
601 }
602 reset($this->allowedItems);
603 if (!in_array($this->act,$this->allowedItems)) {
604 $this->act = current($this->allowedItems);
605 }
606
607 // Making menu in top:
608 $menuDef = array();
609 if (!$wiz && $this->curUrlArray['href']) {
610 $menuDef['removeLink']['isActive'] = $this->act=='removeLink';
611 $menuDef['removeLink']['label'] = $LANG->getLL('removeLink',1);
612 $menuDef['removeLink']['url'] = '#';
613 $menuDef['removeLink']['addParams'] = 'onclick="plugin.unLink();return false;"';
614 }
615 if (in_array('page',$this->allowedItems)) {
616 $menuDef['page']['isActive'] = $this->act=='page';
617 $menuDef['page']['label'] = $LANG->getLL('page',1);
618 $menuDef['page']['url'] = '#';
619 $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\''.htmlspecialchars('?act=page&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"';
620 }
621 if (in_array('file',$this->allowedItems)){
622 $menuDef['file']['isActive'] = $this->act=='file';
623 $menuDef['file']['label'] = $LANG->getLL('file',1);
624 $menuDef['file']['url'] = '#';
625 $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\''.htmlspecialchars('?act=file&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"';
626 }
627 if (in_array('url',$this->allowedItems)) {
628 $menuDef['url']['isActive'] = $this->act=='url';
629 $menuDef['url']['label'] = $LANG->getLL('extUrl',1);
630 $menuDef['url']['url'] = '#';
631 $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\''.htmlspecialchars('?act=url&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"';
632 }
633 if (in_array('mail',$this->allowedItems)) {
634 $menuDef['mail']['isActive'] = $this->act=='mail';
635 $menuDef['mail']['label'] = $LANG->getLL('email',1);
636 $menuDef['mail']['url'] = '#';
637 $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\''.htmlspecialchars('?act=mail&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"';
638 }
639 if (is_array($this->thisConfig['userLinks.']) && in_array('spec',$this->allowedItems)) {
640 $menuDef['spec']['isActive'] = $this->act=='spec';
641 $menuDef['spec']['label'] = $LANG->getLL('special',1);
642 $menuDef['spec']['url'] = '#';
643 $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\''.htmlspecialchars('?act=spec&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"';
644 }
645
646 // call hook for extra options
647 foreach($this->hookObjects as $hookObject) {
648 $menuDef = $hookObject->modifyMenuDefinition($menuDef);
649 }
650
651 $content .= $this->doc->getTabMenuRaw($menuDef);
652
653 // Adding the menu and header to the top of page:
654 $content.=$this->printCurrentUrl($this->curUrlInfo['info']).'<br />';
655
656 // Depending on the current action we will create the actual module content for selecting a link:
657 switch($this->act) {
658 case 'mail':
659 $extUrl='
660 <!--
661 Enter mail address:
662 -->
663 <form action="" name="lurlform" id="lurlform">
664 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail">
665 <tr>
666 <td>'.$LANG->getLL('emailAddress',1).':</td>
667 <td><input type="text" name="lemail"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='mail'?$this->curUrlInfo['info']:'').'" /> '.
668 '<input type="submit" value="'.$LANG->getLL('setLink',1).'" onclick="setTarget(\'\');setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td>
669 </tr>
670 </table>
671 </form>';
672 $content.=$extUrl;
673 $content.=$this->addAttributesForm();
674 break;
675 case 'url':
676 $extUrl='
677 <!--
678 Enter External URL:
679 -->
680 <form action="" name="lurlform" id="lurlform">
681 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL">
682 <tr>
683 <td>URL:</td>
684 <td><input type="text" name="lurl"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='url'?$this->curUrlInfo['info']:'http://').'" /> '.
685 '<input type="submit" value="'.$LANG->getLL('setLink',1).'" onclick="setValue(document.lurlform.lurl.value); return link_current();" /></td>
686 </tr>
687 </table>
688 </form>';
689 $content.=$extUrl;
690 $content.=$this->addAttributesForm();
691 break;
692 case 'file':
693 $content.=$this->addAttributesForm();
694
695 $foldertree = t3lib_div::makeInstance('tx_rtehtmlarea_folderTree');
696 $tree=$foldertree->getBrowsableTree();
697
698 if (!$this->curUrlInfo['value'] || $this->curUrlInfo['act']!='file') {
699 $cmpPath='';
700 } elseif (substr(trim($this->curUrlInfo['info']),-1)!='/') {
701 $cmpPath=PATH_site.dirname($this->curUrlInfo['info']).'/';
702 if (!isset($this->expandFolder)) $this->expandFolder = $cmpPath;
703 } else {
704 $cmpPath=PATH_site.$this->curUrlInfo['info'];
705 }
706
707 list(,,$specUid) = explode('_',$this->PM);
708 $files = $this->expandFolder($foldertree->specUIDmap[$specUid]);
709
710 // Create upload/create folder forms, if a path is given:
711 if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
712 $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
713 $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
714 $path=$this->expandFolder;
715 if (!$path || !@is_dir($path)) {
716 $path = $fileProcessor->findTempFolder().'/'; // The closest TEMP-path is found
717 }
718 if ($path!='/' && @is_dir($path) && !$this->readOnly && count($GLOBALS['FILEMOUNTS'])) {
719 $uploadForm=$this->uploadForm($path);
720 $createFolder=$this->createFolder($path);
721 } else {
722 $createFolder='';
723 $uploadForm='';
724 }
725 $content.=$uploadForm;
726 if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB')) {
727 $content.=$createFolder;
728 }
729 }
730
731
732
733 $content.= '
734 <!--
735 Wrapper table for folder tree / file list:
736 -->
737 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkFiles">
738 <tr>
739 <td class="c-wCell" valign="top">'.$this->barheader($LANG->getLL('folderTree').':').$tree.'</td>
740 <td class="c-wCell" valign="top">'.$files.'</td>
741 </tr>
742 </table>
743 ';
744 break;
745 case 'spec':
746 if (is_array($this->thisConfig['userLinks.'])) {
747 $subcats=array();
748 $v=$this->thisConfig['userLinks.'];
749 reset($v);
750 while(list($k2)=each($v)) {
751 $k2i = intval($k2);
752 if (substr($k2,-1)=='.' && is_array($v[$k2i.'.'])) {
753
754 // Title:
755 $title = trim($v[$k2i]);
756 if (!$title) {
757 $title=$v[$k2i.'.']['url'];
758 } else {
759 $title=$LANG->sL($title);
760 }
761 // Description:
762 $description=$v[$k2i.'.']['description'] ? $LANG->sL($v[$k2i.'.']['description'],1).'<br />' : '';
763
764 // URL + onclick event:
765 $onClickEvent='';
766 if (isset($v[$k2i.'.']['target'])) $onClickEvent.="setTarget('".$v[$k2i.'.']['target']."');";
767 $v[$k2i.'.']['url'] = str_replace('###_URL###',$this->siteURL,$v[$k2i.'.']['url']);
768 if (substr($v[$k2i.'.']['url'],0,7)=="http://" || substr($v[$k2i.'.']['url'],0,7)=='mailto:') {
769 $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();";
770 } else {
771 $onClickEvent.="link_spec(unescape('".$this->siteURL.rawurlencode($v[$k2i.'.']['url'])."'));";
772 }
773
774 // Link:
775 $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>');
776
777 // Adding link to menu of user defined links:
778 $subcats[$k2i]='
779 <tr>
780 <td class="bgColor4">'.$A[0].'<strong>'.htmlspecialchars($title).($this->curUrlInfo['info']==$v[$k2i.'.']['url']?'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" />':'').'</strong><br />'.$description.$A[1].'</td>
781 </tr>';
782 }
783 }
784
785 // Sort by keys:
786 ksort($subcats);
787
788 // Add menu to content:
789 $content.= '
790 <!--
791 Special userdefined menu:
792 -->
793 <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
794 <tr>
795 <td class="bgColor5" class="c-wCell" valign="top"><strong>'.$LANG->getLL('special',1).'</strong></td>
796 </tr>
797 '.implode('',$subcats).'
798 </table>
799 ';
800 }
801 break;
802 case 'page':
803 $content.=$this->addAttributesForm();
804
805 $pagetree = t3lib_div::makeInstance('tx_rtehtmlarea_pageTree');
806 $pagetree->ext_showNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
807 $pagetree->addField('nav_title');
808 $tree=$pagetree->getBrowsableTree();
809 $cElements = $this->expandPage();
810 $content.= '
811 <!--
812 Wrapper table for page tree / record list:
813 -->
814 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages">
815 <tr>
816 <td class="c-wCell" valign="top">'.$this->barheader($LANG->getLL('pageTree').':').$tree.'</td>
817 <td class="c-wCell" valign="top">'.$cElements.'</td>
818 </tr>
819 </table>
820 ';
821 break;
822 default:
823 // call hook
824 foreach($this->hookObjects as $hookObject) {
825 $content .= $hookObject->getTab($this->act);
826 }
827
828 break;
829 }
830
831 // End page, return content:
832 $content.= $this->doc->endPage();
833 return $content;
834 }
835
836 function addAttributesForm() {
837 $ltargetForm = '';
838 // Add page id, target, class selector box, title and parameters fields:
839 $lpageId = $this->addPageIdSelector();
840 $queryParameters = $this->addQueryParametersSelector();
841 $ltarget = $this->addTargetSelector();
842 $lclass = $this->addClassSelector();
843 $ltitle = $this->addTitleSelector();
844 if ($lpageId || $queryParameters || $ltarget || $lclass || $ltitle) {
845 $ltargetForm = $this->wrapInForm($lpageId.$queryParameters.$ltarget.$lclass.$ltitle);
846 }
847 return $ltargetForm;
848 }
849
850 function wrapInForm($string) {
851 global $LANG;
852
853 $form = '
854 <!--
855 Selecting target for link:
856 -->
857 <form action="" name="ltargetform" id="ltargetform">
858 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">'. $string;
859 if ($this->act == $this->curUrlInfo['act'] && $this->act != 'mail' && $this->curUrlArray['href']) {
860 $form .='
861 <tr>
862 <td>
863 </td>
864 <td colspan="3">
865 <input type="submit" value="'.$LANG->getLL('update',1).'" onclick="return link_current();" />
866 </td>
867 </tr>';
868 }
869 $form .= '
870 </table>
871 </form>';
872 return $form;
873 }
874
875 function addPageIdSelector() {
876 global $LANG;
877
878 return ($this->act == 'page' && $this->buttonConfig && is_array($this->buttonConfig['pageIdSelector.']) && $this->buttonConfig['pageIdSelector.']['enabled'])?'
879 <tr>
880 <td>'.$LANG->getLL('page_id',1).':</td>
881 <td colspan="3">
882 <input type="text" size="6" name="luid" />&nbsp;<input type="submit" value="'.$LANG->getLL('setLink',1).'" onclick="return link_typo3Page(document.ltargetform.luid.value);" />
883 </td>
884 </tr>':'';
885 }
886
887 function addQueryParametersSelector() {
888 global $LANG;
889
890 return ($this->act == 'page' && $this->buttonConfig && is_array($this->buttonConfig['queryParametersSelector.']) && $this->buttonConfig['queryParametersSelector.']['enabled'])?'
891 <tr>
892 <td>'.$LANG->getLL('query_parameters',1).':</td>
893 <td colspan="3">
894 <input type="text" name="query_parameters" value="' . ($this->curUrlInfo['query']?$this->curUrlInfo['query']:'') . '" ' . $this->doc->formWidth(30) . ' />
895 </td>
896 </tr>':'';
897 }
898
899 function addTargetSelector() {
900 global $LANG;
901
902 $targetSelectorConfig = array();
903 $popupSelectorConfig = array();
904 if (is_array($this->buttonConfig['targetSelector.'])) {
905 $targetSelectorConfig = $this->buttonConfig['targetSelector.'];
906 }
907 if (is_array($this->buttonConfig['popupSelector.'])) {
908 $popupSelectorConfig = $this->buttonConfig['popupSelector.'];
909 }
910
911 $ltarget = '';
912 if ($this->act != 'mail') {
913 $ltarget .= '
914 <tr id="ltargetrow"'. (($targetSelectorConfig['disabled'] && $popupSelectorConfig['disabled']) ? ' style="display: none;"' : '') . '>
915 <td>'.$LANG->getLL('target',1).':</td>
916 <td><input type="text" name="ltarget" onchange="setTarget(this.value);" value="'.htmlspecialchars($this->setTarget?$this->setTarget:(($this->setClass || !$this->classesAnchorDefault[$this->act])?'':$this->classesAnchorDefaultTarget[$this->act])).'"'.$this->doc->formWidth(10).' /></td>';
917 $ltarget .= '
918 <td colspan="2">';
919 if (!$targetSelectorConfig['disabled']) {
920 $ltarget .= '
921 <select name="ltarget_type" onchange="setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
922 <option></option>
923 <option value="_top">'.$LANG->getLL('top',1).'</option>
924 <option value="_blank">'.$LANG->getLL('newWindow',1).'</option>
925 </select>';
926 }
927 $ltarget .= '
928 </td>
929 </tr>';
930 if (!$popupSelectorConfig['disabled']) {
931
932 $selectJS = 'if (document.ltargetform.popup_width.options[document.ltargetform.popup_width.selectedIndex].value>0 && document.ltargetform.popup_height.options[document.ltargetform.popup_height.selectedIndex].value>0) {
933 document.ltargetform.ltarget.value = document.ltargetform.popup_width.options[document.ltargetform.popup_width.selectedIndex].value+\'x\'+document.ltargetform.popup_height.options[document.ltargetform.popup_height.selectedIndex].value;
934 setTarget(document.ltargetform.ltarget.value);
935 document.ltargetform.popup_width.selectedIndex=0;
936 document.ltargetform.popup_height.selectedIndex=0;
937 }';
938
939 $ltarget.='
940 <tr>
941 <td>'.$LANG->getLL('target_popUpWindow',1).':</td>
942 <td colspan="3">
943 <select name="popup_width" onchange="'.$selectJS.'">
944 <option value="0">'.$LANG->getLL('target_popUpWindow_width',1).'</option>
945 <option value="300">300</option>
946 <option value="400">400</option>
947 <option value="500">500</option>
948 <option value="600">600</option>
949 <option value="700">700</option>
950 <option value="800">800</option>
951 </select>
952 x
953 <select name="popup_height" onchange="'.$selectJS.'">
954 <option value="0">'.$LANG->getLL('target_popUpWindow_height',1).'</option>
955 <option value="200">200</option>
956 <option value="300">300</option>
957 <option value="400">400</option>
958 <option value="500">500</option>
959 <option value="600">600</option>
960 </select>
961 </td>
962 </tr>';
963 }
964 }
965 return $ltarget;
966 }
967
968 function addClassSelector() {
969 global $LANG;
970
971 $selectClass = '';
972 if ($this->classesAnchorJSOptions[$this->act]) {
973 $selectClassJS = '
974 if (document.ltargetform.anchor_class) {
975 document.ltargetform.anchor_class.value = document.ltargetform.anchor_class.options[document.ltargetform.anchor_class.selectedIndex].value;
976 if (document.ltargetform.anchor_class.value && HTMLArea.classesAnchorSetup) {
977 for (var i = HTMLArea.classesAnchorSetup.length; --i >= 0;) {
978 var anchorClass = HTMLArea.classesAnchorSetup[i];
979 if (anchorClass[\'name\'] == document.ltargetform.anchor_class.value) {
980 if (anchorClass[\'titleText\'] && document.ltargetform.anchor_title) {
981 document.ltargetform.anchor_title.value = anchorClass[\'titleText\'];
982 setTitle(anchorClass[\'titleText\']);
983 }
984 if (anchorClass[\'target\']) {
985 if (document.ltargetform.ltarget) {
986 document.ltargetform.ltarget.value = anchorClass[\'target\'];
987 }
988 setTarget(anchorClass[\'target\']);
989 } else if (document.ltargetform.ltarget && document.getElementById(\'ltargetrow\').style.display == \'none\') {
990 // Reset target to default if field is not displayed and class has no configured target
991 document.ltargetform.ltarget.value = \''. ($this->thisConfig['defaultLinkTarget']?$this->thisConfig['defaultLinkTarget']:'') .'\';
992 setTarget(document.ltargetform.ltarget.value);
993 }
994 break;
995 }
996 }
997 }
998 setClass(document.ltargetform.anchor_class.value);
999 }
1000 ';
1001 $selectClass ='
1002 <tr>
1003 <td>'.$LANG->getLL('anchor_class',1).':</td>
1004 <td colspan="3">
1005 <select name="anchor_class" onchange="'.$selectClassJS.'">
1006 ' . $this->classesAnchorJSOptions[$this->act] . '
1007 </select>
1008 </td>
1009 </tr>';
1010 }
1011 return $selectClass;
1012 }
1013
1014 function addTitleSelector() {
1015 global $LANG;
1016
1017 return '
1018 <tr>
1019 <td>'.$LANG->getLL('anchor_title',1).':</td>
1020 <td colspan="3">
1021 <input type="text" name="anchor_title" value="' . ($this->setTitle?$this->setTitle:(($this->setClass || !$this->classesAnchorDefault[$this->act])?'':$this->classesAnchorDefaultTitle[$this->act])) . '" ' . $this->doc->formWidth(30) . ' />
1022 </td>
1023 </tr>';
1024 }
1025
1026 /**
1027 * Localize a string using the language of the content element rather than the language of the BE interface
1028 *
1029 * @param string string: the label to be localized
1030 * @return string Localized string.
1031 */
1032 public function getLLContent($string) {
1033 global $LANG;
1034
1035 $BE_lang = $LANG->lang;
1036 $BE_origCharSet = $LANG->origCharSet;
1037 $BE_charSet = $LANG->charSet;
1038
1039 $LANG->lang = $this->contentTypo3Language;
1040 $LANG->origCharSet = $LANG->csConvObj->charSetArray[$this->contentTypo3Language];
1041 $LANG->origCharSet = $LANG->origCharSet ? $LANG->origCharSet : 'iso-8859-1';
1042 $LANG->charSet = $this->contentTypo3Charset;
1043 $LLString = $LANG->sL($string);
1044
1045 $LANG->lang = $BE_lang;
1046 $LANG->origCharSet = $BE_origCharSet;
1047 $LANG->charSet = $BE_charSet;
1048 return $LLString;
1049 }
1050
1051 /**
1052 * Localize a label obtained from Page TSConfig
1053 *
1054 * @param string string: the label to be localized
1055 * @return string Localized string.
1056 */
1057 public function getPageConfigLabel($string,$JScharCode=1) {
1058 global $LANG;
1059 if (strcmp(substr($string,0,4),'LLL:')) {
1060 $label = $string;
1061 } else {
1062 $label = $LANG->sL(trim($string));
1063 }
1064 $label = str_replace('"', '\"', str_replace('\\\'', '\'', $label));
1065 $label = $JScharCode ? $LANG->JScharCode($label): $label;
1066 return $label;
1067 }
1068
1069 }
1070
1071 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php']) {
1072 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php']);
1073 }
1074
1075 ?>