|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com) 00006 * (c) 2005-2011 Stanislas Rolland <typo3(arobas)sjbr.ca> 00007 * All rights reserved 00008 * 00009 * This script is part of the TYPO3 project. The TYPO3 project is 00010 * free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * The GNU General Public License can be found at 00016 * http://www.gnu.org/copyleft/gpl.html. 00017 * A copy is found in the textfile GPL.txt and important notices to the license 00018 * from the author is found in LICENSE.txt distributed with these scripts. 00019 * 00020 * 00021 * This script is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00024 * GNU General Public License for more details. 00025 * 00026 * This copyright notice MUST APPEAR in all copies of the script! 00027 ***************************************************************/ 00028 /** 00029 * Displays the page/file tree for browsing database records or files. 00030 * Used from TCEFORMS an other elements 00031 * In other words: This is the ELEMENT BROWSER! 00032 * 00033 * Adapted for htmlArea RTE by Stanislas Rolland 00034 * 00035 * $Id: class.tx_rtehtmlarea_browse_links.php 10120 2011-01-18 20:03:36Z ohader $ 00036 * 00037 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00038 * @author Stanislas Rolland <typo3(arobas)sjbr.ca> 00039 */ 00040 00041 require_once (PATH_typo3.'class.browse_links.php'); 00042 00043 00044 /** 00045 * Class which generates the page tree 00046 * 00047 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00048 * @package TYPO3 00049 * @subpackage core 00050 */ 00051 class tx_rtehtmlarea_pageTree extends rtePageTree { 00052 00053 /** 00054 * Create the page navigation tree in HTML 00055 * 00056 * @param array Tree array 00057 * @return string HTML output. 00058 */ 00059 function printTree($treeArr='') { 00060 global $BACK_PATH; 00061 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']); 00062 if (!is_array($treeArr)) $treeArr=$this->tree; 00063 00064 $out=''; 00065 $c=0; 00066 00067 foreach($treeArr as $k => $v) { 00068 $c++; 00069 $bgColorClass = ($c+1)%2 ? 'bgColor' : 'bgColor-10'; 00070 if ($GLOBALS['SOBE']->browser->curUrlInfo['act']=='page' && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']==$v['row']['uid'] && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']) { 00071 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>'; 00072 $bgColorClass='bgColor4'; 00073 } else { 00074 $arrCol='<td></td>'; 00075 } 00076 00077 $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'].'\');'; 00078 $cEbullet = $this->ext_isLinkable($v['row']['doktype'],$v['row']['uid']) ? 00079 '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' : 00080 ''; 00081 $out.=' 00082 <tr class="'.$bgColorClass.'"> 00083 <td nowrap="nowrap"'.($v['row']['_CSSCLASS'] ? ' class="'.$v['row']['_CSSCLASS'].'"' : '').'>'. 00084 $v['HTML']. 00085 $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$this->ext_pArrPages). 00086 '</td>'. 00087 $arrCol. 00088 '<td>'.$cEbullet.'</td> 00089 </tr>'; 00090 } 00091 $out=' 00092 00093 00094 <!-- 00095 Navigation Page Tree: 00096 --> 00097 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree"> 00098 '.$out.' 00099 </table>'; 00100 return $out; 00101 } 00102 } 00103 00104 /** 00105 * Base extension class which generates the folder tree. 00106 * Used directly by the RTE. 00107 * 00108 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00109 * @package TYPO3 00110 * @subpackage core 00111 */ 00112 class tx_rtehtmlarea_folderTree extends rteFolderTree { 00113 00114 /** 00115 * Wrapping the title in a link, if applicable. 00116 * 00117 * @param string Title, ready for output. 00118 * @param array The "record" 00119 * @return string Wrapping title string. 00120 */ 00121 function wrapTitle($title,$v) { 00122 $title = htmlspecialchars($title); 00123 00124 if ($this->ext_isLinkable($v)) { 00125 $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']).'\');'; 00126 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>'; 00127 } else { 00128 return '<span class="typo3-dimmed">'.$title.'</span>'; 00129 } 00130 } 00131 00132 /** 00133 * Create the folder navigation tree in HTML 00134 * 00135 * @param mixed Input tree array. If not array, then $this->tree is used. 00136 * @return string HTML output of the tree. 00137 */ 00138 function printTree($treeArr='') { 00139 global $BACK_PATH; 00140 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']); 00141 00142 if (!is_array($treeArr)) $treeArr=$this->tree; 00143 00144 $out=''; 00145 $c=0; 00146 00147 // Preparing the current-path string (if found in the listing we will see a red blinking arrow). 00148 if (!$GLOBALS['SOBE']->browser->curUrlInfo['value']) { 00149 $cmpPath=''; 00150 } else if (substr(trim($GLOBALS['SOBE']->browser->curUrlInfo['info']),-1)!='/') { 00151 $cmpPath=PATH_site.dirname($GLOBALS['SOBE']->browser->curUrlInfo['info']).'/'; 00152 } else { 00153 $cmpPath=PATH_site.$GLOBALS['SOBE']->browser->curUrlInfo['info']; 00154 } 00155 00156 // Traverse rows for the tree and print them into table rows: 00157 foreach($treeArr as $k => $v) { 00158 $c++; 00159 $bgColorClass=($c+1)%2 ? 'bgColor' : 'bgColor-10'; 00160 00161 // Creating blinking arrow, if applicable: 00162 if ($GLOBALS['SOBE']->browser->curUrlInfo['act']=='file' && $cmpPath==$v['row']['path']) { 00163 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>'; 00164 $bgColorClass='bgColor4'; 00165 } else { 00166 $arrCol='<td></td>'; 00167 } 00168 // Create arrow-bullet for file listing (if folder path is linkable): 00169 $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']).'\');'; 00170 $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>' : ''; 00171 00172 // Put table row with folder together: 00173 $out.=' 00174 <tr class="'.$bgColorClass.'"> 00175 <td nowrap="nowrap">'.$v['HTML'].$this->wrapTitle(t3lib_div::fixed_lgd_cs($v['row']['title'],$titleLen),$v['row']).'</td> 00176 '.$arrCol.' 00177 <td>'.$cEbullet.'</td> 00178 </tr>'; 00179 } 00180 00181 $out=' 00182 00183 <!-- 00184 Folder tree: 00185 --> 00186 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree"> 00187 '.$out.' 00188 </table>'; 00189 return $out; 00190 } 00191 00192 } 00193 00194 /** 00195 * Script class for the Element Browser window. 00196 * 00197 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00198 * @package TYPO3 00199 * @subpackage core 00200 */ 00201 class tx_rtehtmlarea_browse_links extends browse_links { 00202 00203 var $editorNo; 00204 var $contentTypo3Language; 00205 var $contentTypo3Charset; 00206 public $additionalAttributes = array(); 00207 public $buttonConfig = array(); 00208 public $RTEProperties = array(); 00209 00210 public $anchorTypes = array( 'page', 'url', 'file', 'mail', 'spec'); 00211 public $classesAnchorDefault = array(); 00212 public $classesAnchorDefaultTitle = array(); 00213 public $classesAnchorClassTitle = array(); 00214 public $classesAnchorDefaultTarget = array(); 00215 public $classesAnchorJSOptions = array(); 00216 00217 public $allowedItems; 00218 00219 /** 00220 * Constructor: 00221 * Initializes a lot of variables, setting JavaScript functions in header etc. 00222 * 00223 * @return void 00224 */ 00225 function init() { 00226 00227 $this->initVariables(); 00228 $this->initConfiguration(); 00229 00230 // Creating backend template object: 00231 $this->doc = t3lib_div::makeInstance('template'); 00232 $this->doc->backPath = $GLOBALS['BACK_PATH']; 00233 // Loading the Prototype library and browse_links.js 00234 $this->doc->getPageRenderer()->loadPrototype(); 00235 $this->doc->loadJavascriptLib('js/browse_links.js'); 00236 // Adding context menu code 00237 $this->doc->getContextMenuCode(); 00238 // Init fileProcessor 00239 $this->fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions'); 00240 $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']); 00241 00242 // Initializing hooking browsers 00243 $this->initHookObjects('ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php'); 00244 00245 // CurrentUrl - the current link url must be passed around if it exists 00246 $this->curUrlArray = t3lib_div::_GP('curUrl'); 00247 if ($this->curUrlArray['all']) { 00248 $this->curUrlArray = t3lib_div::get_tag_attributes($this->curUrlArray['all']); 00249 $this->curUrlArray['href'] = htmlspecialchars_decode($this->curUrlArray['href']); 00250 } 00251 // Note: parseCurUrl will invoke the hooks 00252 $this->curUrlInfo = $this->parseCurUrl($this->curUrlArray['href'],$this->siteURL); 00253 if (isset($this->curUrlArray['external']) && $this->curUrlInfo['act'] != 'mail') { 00254 $this->curUrlInfo['act'] = 'url'; 00255 $this->curUrlInfo['info'] = $this->curUrlArray['href']; 00256 } 00257 // Determine nature of current url: 00258 $this->act = t3lib_div::_GP('act'); 00259 if (!$this->act) { 00260 $this->act=$this->curUrlInfo['act']; 00261 } 00262 // Setting intial values for link attributes 00263 $this->initLinkAttributes(); 00264 00265 // Add attributes to body tag. Note: getBodyTagAdditions will invoke the hooks 00266 $this->doc->bodyTagAdditions = $this->getBodyTagAdditions(); 00267 // Adding RTE JS code 00268 $this->doc->JScodeArray['rtehtmlarea'] = $this->getJSCode(); 00269 } 00270 00271 /** 00272 * Initialize class variables 00273 * 00274 * @return void 00275 */ 00276 public function initVariables() { 00277 00278 // Process bparams 00279 $this->bparams = t3lib_div::_GP('bparams'); 00280 $pArr = explode('|', $this->bparams); 00281 $pRteArr = explode(':', $pArr[1]); 00282 $this->editorNo = $pRteArr[0]; 00283 $this->contentTypo3Language = $pRteArr[1]; 00284 $this->contentTypo3Charset = $pRteArr[2]; 00285 $this->RTEtsConfigParams = $pArr[2]; 00286 if (!$this->editorNo) { 00287 $this->editorNo = t3lib_div::_GP('editorNo'); 00288 $this->contentTypo3Language = t3lib_div::_GP('contentTypo3Language'); 00289 $this->contentTypo3Charset = t3lib_div::_GP('contentTypo3Charset'); 00290 $this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams'); 00291 } 00292 $this->pointer = t3lib_div::_GP('pointer'); 00293 $this->expandPage = t3lib_div::_GP('expandPage'); 00294 $this->expandFolder = t3lib_div::_GP('expandFolder'); 00295 $this->P = t3lib_div::_GP('P'); 00296 $this->PM = t3lib_div::_GP('PM'); 00297 $pArr[1] = implode(':', array($this->editorNo, $this->contentTypo3Language, $this->contentTypo3Charset)); 00298 $pArr[2] = $this->RTEtsConfigParams; 00299 $this->bparams = implode('|', $pArr); 00300 00301 // Find "mode" 00302 $this->mode = t3lib_div::_GP('mode'); 00303 if (!$this->mode) { 00304 $this->mode = 'rte'; 00305 } 00306 // Current site url 00307 $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL'); 00308 00309 // the script to link to 00310 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME'); 00311 } 00312 00313 /** 00314 * Initializes the configuration variables 00315 * 00316 * @return void 00317 */ 00318 public function initConfiguration() { 00319 $this->thisConfig = $this->getRTEConfig(); 00320 $this->buttonConfig = $this->getButtonConfig('link'); 00321 } 00322 00323 /** 00324 * Get the RTE configuration from Page TSConfig 00325 * 00326 * @return array RTE configuration array 00327 */ 00328 protected function getRTEConfig() { 00329 global $BE_USER; 00330 00331 $RTEtsConfigParts = explode(':', $this->RTEtsConfigParams); 00332 $RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5])); 00333 $this->RTEProperties = $RTEsetup['properties']; 00334 return t3lib_BEfunc::RTEsetup($this->RTEProperties, $RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]); 00335 } 00336 00337 /** 00338 * Get the configuration of the button 00339 * 00340 * @param string $buttonName: the name of the button 00341 * @return array the configuration array of the image button 00342 */ 00343 protected function getButtonConfig($buttonName) { 00344 return ((is_array($this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.'][$buttonName.'.'])) ? $this->thisConfig['buttons.'][$buttonName.'.'] : array()); 00345 } 00346 00347 /** 00348 * Initialize hook objects implementing interface t3lib_browseLinksHook 00349 * @param string $hookKey: the hook key 00350 * @return void 00351 */ 00352 protected function initHookObjects($hookKey) { 00353 global $TYPO3_CONF_VARS; 00354 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS'][$hookKey]['browseLinksHook'])) { 00355 foreach ($TYPO3_CONF_VARS['SC_OPTIONS'][$hookKey]['browseLinksHook'] as $classData) { 00356 $processObject = t3lib_div::getUserObj($classData); 00357 if(!($processObject instanceof t3lib_browseLinksHook)) { 00358 throw new UnexpectedValueException('$processObject must implement interface t3lib_browseLinksHook', 1195115652); 00359 } 00360 $parameters = array(); 00361 $processObject->init($this, $parameters); 00362 $this->hookObjects[] = $processObject; 00363 } 00364 } 00365 } 00366 00367 /** 00368 * Initialize the current or default values of the link attributes 00369 * 00370 * @return void 00371 */ 00372 protected function initLinkAttributes() { 00373 00374 // Initializing the title value 00375 $this->setTitle = $GLOBALS['LANG']->csConvObj->conv($this->curUrlArray['title'], 'utf-8', $GLOBALS['LANG']->charSet); 00376 00377 // Processing the classes configuration 00378 $classSelected = array(); 00379 if ($this->thisConfig['classesAnchor'] || $this->thisConfig['classesLinks']) { 00380 $this->setClass = $this->curUrlArray['class']; 00381 if ($this->thisConfig['classesAnchor']) { 00382 $classesAnchorArray = t3lib_div::trimExplode(',',$this->thisConfig['classesAnchor'], 1); 00383 } else { 00384 $classesAnchorArray = t3lib_div::trimExplode(',',$this->thisConfig['classesLinks'], 1); 00385 } 00386 // Collecting allowed classes and configured default values 00387 $classesAnchor = array(); 00388 $classesAnchor['all'] = array(); 00389 $titleReadOnly = $this->buttonConfig['properties.']['title.']['readOnly'] || $this->buttonConfig[$this->act.'.']['properties.']['title.']['readOnly']; 00390 if (is_array($this->RTEProperties['classesAnchor.'])) { 00391 foreach ($this->RTEProperties['classesAnchor.'] as $label => $conf) { 00392 if (in_array($conf['class'], $classesAnchorArray)) { 00393 $classesAnchor['all'][] = $conf['class']; 00394 if (in_array($conf['type'], $this->anchorTypes)) { 00395 $classesAnchor[$conf['type']][] = $conf['class']; 00396 if (is_array($this->thisConfig['classesAnchor.']) && is_array($this->thisConfig['classesAnchor.']['default.']) && $this->thisConfig['classesAnchor.']['default.'][$conf['type']] == $conf['class']) { 00397 $this->classesAnchorDefault[$conf['type']] = $conf['class']; 00398 if ($conf['titleText']) { 00399 $this->classesAnchorDefaultTitle[$conf['type']] = $this->getLLContent(trim($conf['titleText'])); 00400 } 00401 if ($conf['target']) { 00402 $this->classesAnchorDefaultTarget[$conf['type']] = trim($conf['target']); 00403 } 00404 } 00405 } 00406 if ($titleReadOnly && $conf['titleText']) { 00407 $this->classesAnchorClassTitle[$conf['class']] = $this->classesAnchorDefaultTitle[$conf['type']] = $this->getLLContent(trim($conf['titleText'])); 00408 } 00409 } 00410 } 00411 } 00412 // Constructing the class selector options 00413 foreach ($this->anchorTypes as $anchorType) { 00414 foreach ($classesAnchorArray as $class) { 00415 if (!in_array($class, $classesAnchor['all']) || (in_array($class, $classesAnchor['all']) && is_array($classesAnchor[$anchorType]) && in_array($class, $classesAnchor[$anchorType]))) { 00416 $selected = ''; 00417 if ($this->setClass == $class || (!$this->setClass && $this->classesAnchorDefault[$anchorType] == $class)) { 00418 $selected = 'selected="selected"'; 00419 $classSelected[$anchorType] = true; 00420 } 00421 $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; 00422 $classStyle = (is_array($this->RTEProperties['classes.']) && is_array($this->RTEProperties['classes.'][$class.'.']) && $this->RTEProperties['classes.'][$class.'.']['value']) ? $this->RTEProperties['classes.'][$class.'.']['value'] : ''; 00423 $this->classesAnchorJSOptions[$anchorType] .= '<option ' . $selected . ' value="' .$class . '"' . ($classStyle?' style="'.$classStyle.'"':'') . '>' . $classLabel . '</option>'; 00424 } 00425 } 00426 if ($this->classesAnchorJSOptions[$anchorType] && !($this->buttonConfig['properties.']['class.']['required'] || $this->buttonConfig[$this->act.'.']['properties.']['class.']['required'])) { 00427 $selected = ''; 00428 if (!$this->setClass && !$this->classesAnchorDefault[$anchorType]) $selected = 'selected="selected"'; 00429 $this->classesAnchorJSOptions[$anchorType] = '<option ' . $selected . ' value=""></option>' . $this->classesAnchorJSOptions[$anchorType]; 00430 } 00431 } 00432 } 00433 // Initializing the target value 00434 // 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 00435 // In other words, do not forward the target if we changed tab and the target field is not displayed 00436 $this->setTarget = (isset($this->curUrlArray['target']) 00437 && !( 00438 ($this->curUrlArray['target'] != $this->thisConfig['defaultLinkTarget']) 00439 && !$classSelected[$this->act] 00440 && is_array($this->buttonConfig['targetSelector.']) && $this->buttonConfig['targetSelector.']['disabled'] && is_array($this->buttonConfig['popupSelector.']) && $this->buttonConfig['popupSelector.']['disabled']) 00441 ) ? $this->curUrlArray['target'] : ''; 00442 if ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target'])) { 00443 $this->setTarget=$this->thisConfig['defaultLinkTarget']; 00444 } 00445 // Initializing additional attributes 00446 if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes']) { 00447 $addAttributes = t3lib_div::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 1); 00448 foreach ($addAttributes as $attribute) { 00449 $this->additionalAttributes[$attribute] = isset($this->curUrlArray[$attribute]) ? $this->curUrlArray[$attribute] : ''; 00450 } 00451 } 00452 } 00453 00454 /** 00455 * Provide the additional parameters to be included in the template body tag 00456 * 00457 * @return string the body tag additions 00458 */ 00459 public function getBodyTagAdditions() { 00460 $bodyTagAdditions = array(); 00461 // call hook for extra additions 00462 foreach ($this->hookObjects as $hookObject) { 00463 if (method_exists($hookObject, 'addBodyTagAdditions')) { 00464 $bodyTagAdditions = $hookObject->addBodyTagAdditions($bodyTagAdditions); 00465 } 00466 } 00467 return t3lib_div::implodeAttributes($bodyTagAdditions, TRUE); 00468 } 00469 00470 /** 00471 * Generate JS code to be used on the link insert/modify dialogue 00472 * 00473 * @return string the generated JS code 00474 */ 00475 function getJSCode() { 00476 global $BACK_PATH; 00477 // BEGIN accumulation of header JavaScript: 00478 $JScode = ''; 00479 $JScode.= ' 00480 var plugin = window.parent.RTEarea["' . $this->editorNo . '"].editor.getPlugin("TYPO3Link"); 00481 var HTMLArea = window.parent.HTMLArea; 00482 var add_href="'.($this->curUrlArray['href']?'&curUrl[href]='.rawurlencode($this->curUrlArray['href']):'').'"; 00483 var add_target="'.($this->setTarget?'&curUrl[target]='.rawurlencode($this->setTarget):'').'"; 00484 var add_class="'.($this->setClass?'&curUrl[class]='.rawurlencode($this->setClass):'').'"; 00485 var add_title="'.($this->setTitle?'&curUrl[title]='.rawurlencode($this->setTitle):'').'"; 00486 var add_params="'.($this->bparams?'&bparams='.rawurlencode($this->bparams):'').'"; 00487 var additionalValues = ' . (count($this->additionalAttributes) ? json_encode($this->additionalAttributes) : '{}') . ';'; 00488 00489 // Attributes setting functions 00490 $JScode.= ' 00491 var cur_href="'.($this->curUrlArray['href'] ? ($this->curUrlInfo['query'] ? substr($this->curUrlArray['href'], 0, -strlen($this->curUrlInfo['query'])) :$this->curUrlArray['href']):'').'"; 00492 var cur_target="'.($this->setTarget?$this->setTarget:'').'"; 00493 var cur_class="'.($this->setClass?$this->setClass:'').'"; 00494 var cur_title="'.($this->setTitle?$this->setTitle:'').'"; 00495 00496 function browse_links_setTarget(value) { 00497 cur_target=value; 00498 add_target="&curUrl[target]="+encodeURIComponent(value); 00499 } 00500 function browse_links_setClass(value) { 00501 cur_class=value; 00502 add_class="&curUrl[class]="+encodeURIComponent(value); 00503 } 00504 function browse_links_setTitle(value) { 00505 cur_title=value; 00506 add_title="&curUrl[title]="+encodeURIComponent(value); 00507 } 00508 function browse_links_setHref(value) { 00509 cur_href=value; 00510 add_href="&curUrl[href]="+value; 00511 } 00512 function browse_links_setAdditionalValue(name, value) { 00513 additionalValues[name] = value; 00514 } 00515 '; 00516 // Link setting functions 00517 $JScode.=' 00518 function link_typo3Page(id,anchor) { 00519 var parameters = (document.ltargetform.query_parameters && document.ltargetform.query_parameters.value) ? (document.ltargetform.query_parameters.value.charAt(0) == "&" ? "" : "&") + document.ltargetform.query_parameters.value : ""; 00520 var theLink = \'' . $this->siteURL . '?id=\' + id + parameters + (anchor ? anchor : ""); 00521 if (document.ltargetform.anchor_title) browse_links_setTitle(document.ltargetform.anchor_title.value); 00522 if (document.ltargetform.anchor_class) browse_links_setClass(document.ltargetform.anchor_class.value); 00523 if (document.ltargetform.ltarget) browse_links_setTarget(document.ltargetform.ltarget.value); 00524 if (document.ltargetform.lrel) browse_links_setAdditionalValue("rel", document.ltargetform.lrel.value); 00525 plugin.createLink(theLink,cur_target,cur_class,cur_title,additionalValues); 00526 return false; 00527 } 00528 function link_folder(folder) { 00529 var theLink = \''.$this->siteURL.'\'+folder; 00530 if (document.ltargetform.anchor_title) browse_links_setTitle(document.ltargetform.anchor_title.value); 00531 if (document.ltargetform.anchor_class) browse_links_setClass(document.ltargetform.anchor_class.value); 00532 if (document.ltargetform.ltarget) browse_links_setTarget(document.ltargetform.ltarget.value); 00533 if (document.ltargetform.lrel) browse_links_setAdditionalValue("rel", document.ltargetform.lrel.value); 00534 plugin.createLink(theLink,cur_target,cur_class,cur_title,additionalValues); 00535 return false; 00536 } 00537 function link_spec(theLink) { 00538 if (document.ltargetform.anchor_title) browse_links_setTitle(document.ltargetform.anchor_title.value); 00539 if (document.ltargetform.anchor_class) browse_links_setClass(document.ltargetform.anchor_class.value); 00540 if (document.ltargetform.ltarget) browse_links_setTarget(document.ltargetform.ltarget.value); 00541 plugin.createLink(theLink,cur_target,cur_class,cur_title,additionalValues); 00542 return false; 00543 } 00544 function link_current() { 00545 var parameters = (document.ltargetform.query_parameters && document.ltargetform.query_parameters.value) ? (document.ltargetform.query_parameters.value.charAt(0) == "&" ? "" : "&") + document.ltargetform.query_parameters.value : ""; 00546 if (document.ltargetform.anchor_title) browse_links_setTitle(document.ltargetform.anchor_title.value); 00547 if (document.ltargetform.anchor_class) browse_links_setClass(document.ltargetform.anchor_class.value); 00548 if (document.ltargetform.ltarget) browse_links_setTarget(document.ltargetform.ltarget.value); 00549 if (document.ltargetform.lrel) browse_links_setAdditionalValue("rel", document.ltargetform.lrel.value); 00550 if (cur_href!="http://" && cur_href!="mailto:") { 00551 plugin.createLink(cur_href + parameters,cur_target,cur_class,cur_title,additionalValues); 00552 } 00553 return false; 00554 } 00555 '; 00556 // General "jumpToUrl" and launchView functions: 00557 $JScode.=' 00558 function jumpToUrl(URL,anchor) { 00559 var add_editorNo = URL.indexOf("editorNo=")==-1 ? "&editorNo='.$this->editorNo.'" : ""; 00560 var add_contentTypo3Language = URL.indexOf("contentTypo3Language=")==-1 ? "&contentTypo3Language='.$this->contentTypo3Language.'" : ""; 00561 var add_contentTypo3Charset = URL.indexOf("contentTypo3Charset=")==-1 ? "&contentTypo3Charset='.$this->contentTypo3Charset.'" : ""; 00562 var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : ""; 00563 var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$this->mode.'" : ""; 00564 var add_additionalValues = ""; 00565 if (plugin.pageTSConfiguration && plugin.pageTSConfiguration.additionalAttributes) { 00566 var additionalAttributes = plugin.pageTSConfiguration.additionalAttributes.split(","); 00567 for (var i = additionalAttributes.length; --i >= 0;) { 00568 if (additionalValues[additionalAttributes[i]] != "") { 00569 add_additionalValues += "&curUrl[" + additionalAttributes[i] + "]=" + encodeURIComponent(additionalValues[additionalAttributes[i]]); 00570 } 00571 } 00572 } 00573 var theLocation = URL+add_act+add_editorNo+add_contentTypo3Language+add_contentTypo3Charset+add_mode+add_href+add_target+add_class+add_title+add_additionalValues+add_params+(anchor?anchor:""); 00574 window.location.href = theLocation; 00575 return false; 00576 } 00577 function launchView(url) { 00578 var thePreviewWindow=""; 00579 thePreviewWindow = window.open("' . $GLOBALS['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"); 00580 if (thePreviewWindow && thePreviewWindow.focus) { 00581 thePreviewWindow.focus(); 00582 } 00583 } 00584 '; 00585 return $JScode; 00586 } 00587 00588 /****************************************************************** 00589 * 00590 * Main functions 00591 * 00592 ******************************************************************/ 00593 /** 00594 * Rich Text Editor (RTE) link selector (MAIN function) 00595 * Generates the link selector for the Rich Text Editor. 00596 * Can also be used to select links for the TCEforms (see $wiz) 00597 * 00598 * @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 00599 * @return string Modified content variable. 00600 */ 00601 function main_rte($wiz=0) { 00602 global $LANG, $BE_USER, $BACK_PATH; 00603 00604 // Starting content: 00605 $content=$this->doc->startPage($LANG->getLL('Insert/Modify Link',1)); 00606 00607 // Initializing the action value, possibly removing blinded values etc: 00608 $this->allowedItems = explode(',','page,file,url,mail,spec'); 00609 00610 // Calling hook for extra options 00611 foreach($this->hookObjects as $hookObject) { 00612 $this->allowedItems = $hookObject->addAllowedItems($this->allowedItems); 00613 } 00614 00615 if (is_array($this->buttonConfig['options.']) && $this->buttonConfig['options.']['removeItems']) { 00616 $this->allowedItems = array_diff($this->allowedItems,t3lib_div::trimExplode(',',$this->buttonConfig['options.']['removeItems'],1)); 00617 } else { 00618 $this->allowedItems = array_diff($this->allowedItems,t3lib_div::trimExplode(',',$this->thisConfig['blindLinkOptions'],1)); 00619 } 00620 reset($this->allowedItems); 00621 if (!in_array($this->act,$this->allowedItems)) { 00622 $this->act = current($this->allowedItems); 00623 } 00624 00625 // Making menu in top: 00626 $menuDef = array(); 00627 if (!$wiz && $this->curUrlArray['href']) { 00628 $menuDef['removeLink']['isActive'] = $this->act=='removeLink'; 00629 $menuDef['removeLink']['label'] = $LANG->getLL('removeLink',1); 00630 $menuDef['removeLink']['url'] = '#'; 00631 $menuDef['removeLink']['addParams'] = 'onclick="plugin.unLink();return false;"'; 00632 } 00633 if (in_array('page',$this->allowedItems)) { 00634 $menuDef['page']['isActive'] = $this->act=='page'; 00635 $menuDef['page']['label'] = $LANG->getLL('page',1); 00636 $menuDef['page']['url'] = '#'; 00637 $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\''.htmlspecialchars('?act=page&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"'; 00638 } 00639 if (in_array('file',$this->allowedItems)){ 00640 $menuDef['file']['isActive'] = $this->act=='file'; 00641 $menuDef['file']['label'] = $LANG->getLL('file',1); 00642 $menuDef['file']['url'] = '#'; 00643 $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\''.htmlspecialchars('?act=file&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"'; 00644 } 00645 if (in_array('url',$this->allowedItems)) { 00646 $menuDef['url']['isActive'] = $this->act=='url'; 00647 $menuDef['url']['label'] = $LANG->getLL('extUrl',1); 00648 $menuDef['url']['url'] = '#'; 00649 $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\''.htmlspecialchars('?act=url&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"'; 00650 } 00651 if (in_array('mail',$this->allowedItems)) { 00652 $menuDef['mail']['isActive'] = $this->act=='mail'; 00653 $menuDef['mail']['label'] = $LANG->getLL('email',1); 00654 $menuDef['mail']['url'] = '#'; 00655 $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\''.htmlspecialchars('?act=mail&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"'; 00656 } 00657 if (is_array($this->thisConfig['userLinks.']) && in_array('spec',$this->allowedItems)) { 00658 $menuDef['spec']['isActive'] = $this->act=='spec'; 00659 $menuDef['spec']['label'] = $LANG->getLL('special',1); 00660 $menuDef['spec']['url'] = '#'; 00661 $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\''.htmlspecialchars('?act=spec&mode='.$this->mode.'&bparams='.$this->bparams).'\');return false;"'; 00662 } 00663 00664 // call hook for extra options 00665 foreach($this->hookObjects as $hookObject) { 00666 $menuDef = $hookObject->modifyMenuDefinition($menuDef); 00667 } 00668 00669 $content .= $this->doc->getTabMenuRaw($menuDef); 00670 00671 // Adding the menu and header to the top of page: 00672 $content.=$this->printCurrentUrl($this->curUrlInfo['info']).'<br />'; 00673 00674 // Depending on the current action we will create the actual module content for selecting a link: 00675 switch($this->act) { 00676 case 'mail': 00677 $extUrl=' 00678 <!-- 00679 Enter mail address: 00680 --> 00681 <form action="" name="lurlform" id="lurlform"> 00682 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail"> 00683 <tr> 00684 <td>'.$LANG->getLL('emailAddress',1).':</td> 00685 <td><input type="text" name="lemail"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='mail'?$this->curUrlInfo['info']:'').'" /> '. 00686 '<input type="submit" value="'.$LANG->getLL('setLink',1).'" onclick="browse_links_setTarget(\'\');browse_links_setHref(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td> 00687 </tr> 00688 </table> 00689 </form>'; 00690 $content.=$extUrl; 00691 $content.=$this->addAttributesForm(); 00692 break; 00693 case 'url': 00694 $extUrl=' 00695 <!-- 00696 Enter External URL: 00697 --> 00698 <form action="" name="lurlform" id="lurlform"> 00699 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL"> 00700 <tr> 00701 <td>URL:</td> 00702 <td><input type="text" name="lurl"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='url'?$this->curUrlInfo['info']:'http://').'" /> '. 00703 '<input type="submit" value="'.$LANG->getLL('setLink',1).'" onclick="if (/^[A-Za-z0-9_+]{1,8}:/.test(document.lurlform.lurl.value)) { browse_links_setHref(document.lurlform.lurl.value); } else { browse_links_setHref(\'http://\'+document.lurlform.lurl.value); }; browse_links_setAdditionalValue(\'external\', \'1\'); return link_current();" /></td> 00704 </tr> 00705 </table> 00706 </form>'; 00707 $content.=$extUrl; 00708 $content.=$this->addAttributesForm(); 00709 break; 00710 case 'file': 00711 $content.=$this->addAttributesForm(); 00712 00713 $foldertree = t3lib_div::makeInstance('tx_rtehtmlarea_folderTree'); 00714 $tree=$foldertree->getBrowsableTree(); 00715 00716 if (!$this->curUrlInfo['value'] || $this->curUrlInfo['act']!='file') { 00717 $cmpPath=''; 00718 } elseif (substr(trim($this->curUrlInfo['info']),-1)!='/') { 00719 $cmpPath=PATH_site.dirname($this->curUrlInfo['info']).'/'; 00720 if (!isset($this->expandFolder)) $this->expandFolder = $cmpPath; 00721 } else { 00722 $cmpPath=PATH_site.$this->curUrlInfo['info']; 00723 } 00724 00725 list(,,$specUid) = explode('_',$this->PM); 00726 $files = $this->expandFolder($foldertree->specUIDmap[$specUid]); 00727 00728 // Create upload/create folder forms, if a path is given: 00729 if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) { 00730 $path=$this->expandFolder; 00731 if (!$path || !@is_dir($path)) { 00732 $path = $this->fileProcessor->findTempFolder().'/'; // The closest TEMP-path is found 00733 } 00734 if ($path!='/' && @is_dir($path)) { 00735 $uploadForm=$this->uploadForm($path); 00736 $createFolder=$this->createFolder($path); 00737 } else { 00738 $createFolder=''; 00739 $uploadForm=''; 00740 } 00741 $content.=$uploadForm; 00742 if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB')) { 00743 $content.=$createFolder; 00744 } 00745 } 00746 00747 00748 00749 $content.= ' 00750 <!-- 00751 Wrapper table for folder tree / file list: 00752 --> 00753 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkFiles"> 00754 <tr> 00755 <td class="c-wCell" valign="top">'.$this->barheader($LANG->getLL('folderTree').':').$tree.'</td> 00756 <td class="c-wCell" valign="top">'.$files.'</td> 00757 </tr> 00758 </table> 00759 '; 00760 break; 00761 case 'spec': 00762 if (is_array($this->thisConfig['userLinks.'])) { 00763 $subcats=array(); 00764 $v=$this->thisConfig['userLinks.']; 00765 foreach ($v as $k2 => $dummyValue) { 00766 $k2i = intval($k2); 00767 if (substr($k2,-1)=='.' && is_array($v[$k2i.'.'])) { 00768 00769 // Title: 00770 $title = trim($v[$k2i]); 00771 if (!$title) { 00772 $title=$v[$k2i.'.']['url']; 00773 } else { 00774 $title=$LANG->sL($title); 00775 } 00776 // Description: 00777 $description=$v[$k2i.'.']['description'] ? $LANG->sL($v[$k2i.'.']['description'],1).'<br />' : ''; 00778 00779 // URL + onclick event: 00780 $onClickEvent=''; 00781 if (isset($v[$k2i.'.']['target'])) $onClickEvent.="browse_links_setTarget('".$v[$k2i.'.']['target']."');"; 00782 $v[$k2i.'.']['url'] = str_replace('###_URL###',$this->siteURL,$v[$k2i.'.']['url']); 00783 if (substr($v[$k2i.'.']['url'],0,7)=="http://" || substr($v[$k2i.'.']['url'],0,7)=='mailto:') { 00784 $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();"; 00785 } else { 00786 $onClickEvent.="link_spec(unescape('".$this->siteURL.rawurlencode($v[$k2i.'.']['url'])."'));"; 00787 } 00788 00789 // Link: 00790 $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>'); 00791 00792 // Adding link to menu of user defined links: 00793 $subcats[$k2i]=' 00794 <tr> 00795 <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> 00796 </tr>'; 00797 } 00798 } 00799 00800 // Sort by keys: 00801 ksort($subcats); 00802 00803 // Add menu to content: 00804 $content.= ' 00805 <!-- 00806 Special userdefined menu: 00807 --> 00808 <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial"> 00809 <tr> 00810 <td class="bgColor5" class="c-wCell" valign="top"><strong>'.$LANG->getLL('special',1).'</strong></td> 00811 </tr> 00812 '.implode('',$subcats).' 00813 </table> 00814 '; 00815 } 00816 break; 00817 case 'page': 00818 $content.=$this->addAttributesForm(); 00819 00820 $pagetree = t3lib_div::makeInstance('tx_rtehtmlarea_pageTree'); 00821 $pagetree->ext_showNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle'); 00822 $pagetree->ext_showPageId = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle'); 00823 $pagetree->addField('nav_title'); 00824 $tree=$pagetree->getBrowsableTree(); 00825 $cElements = $this->expandPage(); 00826 00827 00828 // Outputting Temporary DB mount notice: 00829 if (intval($GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint'))) { 00830 $link = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('setTempDBmount' => 0))) . '">' . 00831 $LANG->sl('LLL:EXT:lang/locallang_core.xml:labels.temporaryDBmount', 1) . 00832 '</a>'; 00833 $flashMessage = t3lib_div::makeInstance( 00834 't3lib_FlashMessage', 00835 $link, 00836 '', 00837 t3lib_FlashMessage::INFO 00838 ); 00839 $dbmount = $flashMessage->render(); 00840 } 00841 00842 $content .= ' 00843 <!-- 00844 Wrapper table for page tree / record list: 00845 --> 00846 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages"> 00847 <tr> 00848 <td class="c-wCell" valign="top">' . $this->barheader($LANG->getLL('pageTree') . ':') . $dbmount . $tree . '</td> 00849 <td class="c-wCell" valign="top">' . $cElements . '</td> 00850 </tr> 00851 </table> 00852 '; 00853 break; 00854 default: 00855 // call hook 00856 foreach($this->hookObjects as $hookObject) { 00857 $content .= $hookObject->getTab($this->act); 00858 } 00859 00860 break; 00861 } 00862 00863 // End page, return content: 00864 $content.= $this->doc->endPage(); 00865 $content = $this->doc->insertStylesAndJS($content); 00866 return $content; 00867 } 00868 00869 function addAttributesForm() { 00870 $ltargetForm = ''; 00871 // Add page id, target, class selector box, title and parameters fields: 00872 $lpageId = $this->addPageIdSelector(); 00873 $queryParameters = $this->addQueryParametersSelector(); 00874 $ltarget = $this->addTargetSelector(); 00875 $lclass = $this->addClassSelector(); 00876 $ltitle = $this->addTitleSelector(); 00877 $rel = $this->addRelField(); 00878 if ($lpageId || $queryParameters || $ltarget || $lclass || $ltitle || $rel) { 00879 $ltargetForm = $this->wrapInForm($lpageId.$queryParameters.$ltarget.$lclass.$ltitle.$rel); 00880 } 00881 return $ltargetForm; 00882 } 00883 00884 function wrapInForm($string) { 00885 global $LANG; 00886 00887 $form = ' 00888 <!-- 00889 Selecting target for link: 00890 --> 00891 <form action="" name="ltargetform" id="ltargetform"> 00892 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">'. $string; 00893 if ($this->act == $this->curUrlInfo['act'] && $this->act != 'mail' && $this->curUrlArray['href']) { 00894 $form .=' 00895 <tr> 00896 <td> 00897 </td> 00898 <td colspan="3"> 00899 <input type="submit" value="'.$LANG->getLL('update',1).'" onclick="' . (($this->act == 'url') ? 'browse_links_setAdditionalValue(\'external\', \'1\'); ' : '') .'return link_current();" /> 00900 </td> 00901 </tr>'; 00902 } 00903 $form .= ' 00904 </table> 00905 </form>'; 00906 return $form; 00907 } 00908 00909 function addPageIdSelector() { 00910 global $LANG; 00911 00912 return ($this->act == 'page' && $this->buttonConfig && is_array($this->buttonConfig['pageIdSelector.']) && $this->buttonConfig['pageIdSelector.']['enabled'])?' 00913 <tr> 00914 <td>'.$LANG->getLL('page_id',1).':</td> 00915 <td colspan="3"> 00916 <input type="text" size="6" name="luid" /> <input type="submit" value="'.$LANG->getLL('setLink',1).'" onclick="return link_typo3Page(document.ltargetform.luid.value);" /> 00917 </td> 00918 </tr>':''; 00919 } 00920 00921 function addRelField() { 00922 return (($this->act == 'page' || $this->act == 'url' || $this->act == 'file') && $this->buttonConfig && is_array($this->buttonConfig['relAttribute.']) && $this->buttonConfig['relAttribute.']['enabled'])?' 00923 <tr> 00924 <td>'.$GLOBALS['LANG']->getLL('linkRelationship',1).':</td> 00925 <td colspan="3"> 00926 <input type="text" name="lrel" value="' . $this->additionalAttributes['rel']. '" ' . $this->doc->formWidth(30) . ' /> 00927 </td> 00928 </tr>':''; 00929 } 00930 00931 function addQueryParametersSelector() { 00932 global $LANG; 00933 00934 return ($this->act == 'page' && $this->buttonConfig && is_array($this->buttonConfig['queryParametersSelector.']) && $this->buttonConfig['queryParametersSelector.']['enabled'])?' 00935 <tr> 00936 <td>'.$LANG->getLL('query_parameters',1).':</td> 00937 <td colspan="3"> 00938 <input type="text" name="query_parameters" value="' . ($this->curUrlInfo['query']?$this->curUrlInfo['query']:'') . '" ' . $this->doc->formWidth(30) . ' /> 00939 </td> 00940 </tr>':''; 00941 } 00942 00943 function addTargetSelector() { 00944 global $LANG; 00945 00946 $targetSelectorConfig = array(); 00947 $popupSelectorConfig = array(); 00948 if (is_array($this->buttonConfig['targetSelector.'])) { 00949 $targetSelectorConfig = $this->buttonConfig['targetSelector.']; 00950 } 00951 if (is_array($this->buttonConfig['popupSelector.'])) { 00952 $popupSelectorConfig = $this->buttonConfig['popupSelector.']; 00953 } 00954 00955 $ltarget = ''; 00956 if ($this->act != 'mail') { 00957 $ltarget .= ' 00958 <tr id="ltargetrow"'. (($targetSelectorConfig['disabled'] && $popupSelectorConfig['disabled']) ? ' style="display: none;"' : '') . '> 00959 <td>'.$LANG->getLL('target',1).':</td> 00960 <td><input type="text" name="ltarget" onchange="browse_links_setTarget(this.value);" value="'.htmlspecialchars($this->setTarget?$this->setTarget:(($this->setClass || !$this->classesAnchorDefault[$this->act])?'':$this->classesAnchorDefaultTarget[$this->act])).'"'.$this->doc->formWidth(10).' /></td>'; 00961 $ltarget .= ' 00962 <td colspan="2">'; 00963 if (!$targetSelectorConfig['disabled']) { 00964 $ltarget .= ' 00965 <select name="ltarget_type" onchange="browse_links_setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;"> 00966 <option></option> 00967 <option value="_top">'.$LANG->getLL('top',1).'</option> 00968 <option value="_blank">'.$LANG->getLL('newWindow',1).'</option> 00969 </select>'; 00970 } 00971 $ltarget .= ' 00972 </td> 00973 </tr>'; 00974 if (!$popupSelectorConfig['disabled']) { 00975 00976 $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) { 00977 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; 00978 browse_links_setTarget(document.ltargetform.ltarget.value); 00979 document.ltargetform.popup_width.selectedIndex=0; 00980 document.ltargetform.popup_height.selectedIndex=0; 00981 }'; 00982 00983 $ltarget.=' 00984 <tr> 00985 <td>'.$LANG->getLL('target_popUpWindow',1).':</td> 00986 <td colspan="3"> 00987 <select name="popup_width" onchange="'.$selectJS.'"> 00988 <option value="0">'.$LANG->getLL('target_popUpWindow_width',1).'</option> 00989 <option value="300">300</option> 00990 <option value="400">400</option> 00991 <option value="500">500</option> 00992 <option value="600">600</option> 00993 <option value="700">700</option> 00994 <option value="800">800</option> 00995 </select> 00996 x 00997 <select name="popup_height" onchange="'.$selectJS.'"> 00998 <option value="0">'.$LANG->getLL('target_popUpWindow_height',1).'</option> 00999 <option value="200">200</option> 01000 <option value="300">300</option> 01001 <option value="400">400</option> 01002 <option value="500">500</option> 01003 <option value="600">600</option> 01004 </select> 01005 </td> 01006 </tr>'; 01007 } 01008 } 01009 return $ltarget; 01010 } 01011 01012 /** 01013 * Return html code for the class selector 01014 * 01015 * @return string the html code to be added to the form 01016 */ 01017 public function addClassSelector() { 01018 $selectClass = ''; 01019 if ($this->classesAnchorJSOptions[$this->act]) { 01020 $selectClass =' 01021 <tr> 01022 <td>'.$GLOBALS['LANG']->getLL('anchor_class',1).':</td> 01023 <td colspan="3"> 01024 <select name="anchor_class" onchange="'.$this->getClassOnChangeJS().'"> 01025 ' . $this->classesAnchorJSOptions[$this->act] . ' 01026 </select> 01027 </td> 01028 </tr>'; 01029 } 01030 return $selectClass; 01031 } 01032 01033 /** 01034 * Return JS code for the class selector onChange event 01035 * 01036 * @return string class selector onChange JS code 01037 */ 01038 public function getClassOnChangeJS() { 01039 return ' 01040 if (document.ltargetform.anchor_class) { 01041 document.ltargetform.anchor_class.value = document.ltargetform.anchor_class.options[document.ltargetform.anchor_class.selectedIndex].value; 01042 if (document.ltargetform.anchor_class.value && HTMLArea.classesAnchorSetup) { 01043 for (var i = HTMLArea.classesAnchorSetup.length; --i >= 0;) { 01044 var anchorClass = HTMLArea.classesAnchorSetup[i]; 01045 if (anchorClass[\'name\'] == document.ltargetform.anchor_class.value) { 01046 if (anchorClass[\'titleText\'] && document.ltargetform.anchor_title) { 01047 document.ltargetform.anchor_title.value = anchorClass[\'titleText\']; 01048 document.getElementById(\'rtehtmlarea-browse-links-title-readonly\').innerHTML = anchorClass[\'titleText\']; 01049 browse_links_setTitle(anchorClass[\'titleText\']); 01050 } 01051 if (anchorClass[\'target\']) { 01052 if (document.ltargetform.ltarget) { 01053 document.ltargetform.ltarget.value = anchorClass[\'target\']; 01054 } 01055 browse_links_setTarget(anchorClass[\'target\']); 01056 } else if (document.ltargetform.ltarget && document.getElementById(\'ltargetrow\').style.display == \'none\') { 01057 // Reset target to default if field is not displayed and class has no configured target 01058 document.ltargetform.ltarget.value = \''. ($this->thisConfig['defaultLinkTarget']?$this->thisConfig['defaultLinkTarget']:'') .'\'; 01059 browse_links_setTarget(document.ltargetform.ltarget.value); 01060 } 01061 break; 01062 } 01063 } 01064 } 01065 browse_links_setClass(document.ltargetform.anchor_class.value); 01066 } 01067 '; 01068 } 01069 01070 function addTitleSelector() { 01071 $title = ($this->setTitle ? $this->setTitle : (($this->setClass || !$this->classesAnchorDefault[$this->act]) ? '' : $this->classesAnchorDefaultTitle[$this->act])); 01072 $readOnly = $this->buttonConfig['properties.']['title.']['readOnly'] || $this->buttonConfig[$this->act.'.']['properties.']['title.']['readOnly']; 01073 if ($readOnly) { 01074 $title = $this->setClass ? $this->classesAnchorClassTitle[$this->setClass] : $this->classesAnchorDefaultTitle[$this->act]; 01075 } 01076 return ' 01077 <tr> 01078 <td><label for="rtehtmlarea-browse-links-anchor_title" id="rtehtmlarea-browse-links-title-label">' . $GLOBALS['LANG']->getLL('anchor_title',1) . ':</label></td> 01079 <td colspan="3"> 01080 <span id="rtehtmlarea-browse-links-title-input" style="display: ' . ($readOnly ? 'none' : 'inline') . ';"> 01081 <input type="text" id="rtehtmlarea-browse-links-anchor_title" name="anchor_title" value="' . $title . '" ' . $this->doc->formWidth(30) . ' /> 01082 </span> 01083 <span id="rtehtmlarea-browse-links-title-readonly" style="display: ' . ($readOnly ? 'inline' : 'none') . ';">' . $title . '</span> 01084 </td> 01085 </tr>'; 01086 } 01087 01088 /** 01089 * Localize a string using the language of the content element rather than the language of the BE interface 01090 * 01091 * @param string string: the label to be localized 01092 * @return string Localized string. 01093 */ 01094 public function getLLContent($string) { 01095 global $LANG; 01096 01097 $BE_lang = $LANG->lang; 01098 $BE_origCharSet = $LANG->origCharSet; 01099 $BE_charSet = $LANG->charSet; 01100 01101 $LANG->lang = $this->contentTypo3Language; 01102 $LANG->origCharSet = $LANG->csConvObj->charSetArray[$this->contentTypo3Language]; 01103 $LANG->origCharSet = $LANG->origCharSet ? $LANG->origCharSet : 'iso-8859-1'; 01104 $LANG->charSet = $this->contentTypo3Charset; 01105 $LLString = $LANG->sL($string); 01106 01107 $LANG->lang = $BE_lang; 01108 $LANG->origCharSet = $BE_origCharSet; 01109 $LANG->charSet = $BE_charSet; 01110 return $LLString; 01111 } 01112 01113 /** 01114 * Localize a label obtained from Page TSConfig 01115 * 01116 * @param string string: the label to be localized 01117 * @return string Localized string. 01118 */ 01119 public function getPageConfigLabel($string,$JScharCode=1) { 01120 global $LANG; 01121 if (strcmp(substr($string,0,4),'LLL:')) { 01122 $label = $string; 01123 } else { 01124 $label = $LANG->sL(trim($string)); 01125 } 01126 $label = str_replace('"', '\"', str_replace('\\\'', '\'', $label)); 01127 $label = $JScharCode ? $LANG->JScharCode($label): $label; 01128 return $label; 01129 } 01130 01131 } 01132 01133 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php'])) { 01134 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php']); 01135 } 01136 01137 ?>
1.8.0