00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 require_once (PATH_typo3.'class.browse_links.php');
00042 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 class tx_rtehtmlarea_pageTree extends rtePageTree {
00053
00054
00055
00056
00057
00058
00059
00060 function printTree($treeArr='') {
00061 global $BACK_PATH;
00062 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
00063 if (!is_array($treeArr)) $treeArr=$this->tree;
00064
00065 $out='';
00066 $c=0;
00067
00068 foreach($treeArr as $k => $v) {
00069 $c++;
00070 $bgColorClass = ($c+1)%2 ? 'bgColor' : 'bgColor-10';
00071 if ($GLOBALS['SOBE']->browser->curUrlInfo['act']=='page' && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']==$v['row']['uid'] && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']) {
00072 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
00073 $bgColorClass='bgColor4';
00074 } else {
00075 $arrCol='<td></td>';
00076 }
00077
00078 $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'].'\');';
00079 $cEbullet = $this->ext_isLinkable($v['row']['doktype'],$v['row']['uid']) ?
00080 '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' :
00081 '';
00082 $out.='
00083 <tr class="'.$bgColorClass.'">
00084 <td nowrap="nowrap"'.($v['row']['_CSSCLASS'] ? ' class="'.$v['row']['_CSSCLASS'].'"' : '').'>'.
00085 $v['HTML'].
00086 $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$this->ext_pArrPages).
00087 '</td>'.
00088 $arrCol.
00089 '<td>'.$cEbullet.'</td>
00090 </tr>';
00091 }
00092 $out='
00093
00094
00095 <!--
00096 Navigation Page Tree:
00097 -->
00098 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
00099 '.$out.'
00100 </table>';
00101 return $out;
00102 }
00103 }
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113 class tx_rtehtmlarea_folderTree extends rteFolderTree {
00114
00115
00116
00117
00118
00119
00120
00121
00122 function wrapTitle($title,$v) {
00123 if ($this->ext_isLinkable($v)) {
00124 $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']).'\');';
00125 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00126 } else {
00127 return '<span class="typo3-dimmed">'.$title.'</span>';
00128 }
00129 }
00130
00131
00132
00133
00134
00135
00136
00137 function printTree($treeArr='') {
00138 global $BACK_PATH;
00139 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
00140
00141 if (!is_array($treeArr)) $treeArr=$this->tree;
00142
00143 $out='';
00144 $c=0;
00145
00146
00147 if (!$GLOBALS['SOBE']->browser->curUrlInfo['value']) {
00148 $cmpPath='';
00149 } else if (substr(trim($GLOBALS['SOBE']->browser->curUrlInfo['info']),-1)!='/') {
00150 $cmpPath=PATH_site.dirname($GLOBALS['SOBE']->browser->curUrlInfo['info']).'/';
00151 } else {
00152 $cmpPath=PATH_site.$GLOBALS['SOBE']->browser->curUrlInfo['info'];
00153 }
00154
00155
00156 foreach($treeArr as $k => $v) {
00157 $c++;
00158 $bgColorClass=($c+1)%2 ? 'bgColor' : 'bgColor-10';
00159
00160
00161 if ($GLOBALS['SOBE']->browser->curUrlInfo['act']=='file' && $cmpPath==$v['row']['path']) {
00162 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
00163 $bgColorClass='bgColor4';
00164 } else {
00165 $arrCol='<td></td>';
00166 }
00167
00168 $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']).'\');';
00169 $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>' : '';
00170
00171
00172 $out.='
00173 <tr class="'.$bgColorClass.'">
00174 <td nowrap="nowrap">'.$v['HTML'].$this->wrapTitle(t3lib_div::fixed_lgd_cs($v['row']['title'],$titleLen),$v['row']).'</td>
00175 '.$arrCol.'
00176 <td>'.$cEbullet.'</td>
00177 </tr>';
00178 }
00179
00180 $out='
00181
00182 <!--
00183 Folder tree:
00184 -->
00185 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
00186 '.$out.'
00187 </table>';
00188 return $out;
00189 }
00190
00191 }
00192
00193
00194
00195
00196
00197
00198
00199
00200 class tx_rtehtmlarea_browse_links extends browse_links {
00201
00202 var $editorNo;
00203 var $contentTypo3Language;
00204 var $contentTypo3Charset;
00205 public $additionalAttributes = array();
00206 public $buttonConfig = array();
00207 public $RTEProperties = array();
00208
00209 public $anchorTypes = array( 'page', 'url', 'file', 'mail', 'spec');
00210 public $classesAnchorDefault = array();
00211 public $classesAnchorDefaultTitle = array();
00212 public $classesAnchorClassTitle = array();
00213 public $classesAnchorDefaultTarget = array();
00214 public $classesAnchorJSOptions = array();
00215
00216 public $allowedItems;
00217
00218
00219
00220
00221
00222
00223
00224 function init() {
00225
00226 $this->initVariables();
00227 $this->initConfiguration();
00228
00229
00230 $this->doc = t3lib_div::makeInstance('template');
00231 $this->doc->backPath = $GLOBALS['BACK_PATH'];
00232
00233 $this->doc->loadJavascriptLib('contrib/prototype/prototype.js');
00234 $this->doc->loadJavascriptLib('js/browse_links.js');
00235
00236 $this->doc->getContextMenuCode();
00237
00238 $this->fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
00239 $this->fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
00240
00241
00242 $this->initHookObjects('ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php');
00243
00244
00245 $this->curUrlArray = t3lib_div::_GP('curUrl');
00246 if ($this->curUrlArray['all']) {
00247 $this->curUrlArray=t3lib_div::get_tag_attributes($this->curUrlArray['all']);
00248 }
00249
00250 $this->curUrlInfo = $this->parseCurUrl($this->curUrlArray['href'],$this->siteURL);
00251
00252 $this->act = t3lib_div::_GP('act');
00253 if (!$this->act) {
00254 $this->act=$this->curUrlInfo['act'];
00255 }
00256
00257 $this->initLinkAttributes();
00258
00259
00260 $this->doc->bodyTagAdditions = $this->getBodyTagAdditions();
00261
00262 $this->doc->JScodeArray['rtehtmlarea'] = $this->getJSCode();
00263 }
00264
00265
00266
00267
00268
00269
00270 public function initVariables() {
00271
00272
00273 $this->bparams = t3lib_div::_GP('bparams');
00274 $pArr = explode('|', $this->bparams);
00275 $pRteArr = explode(':', $pArr[1]);
00276 $this->editorNo = $pRteArr[0];
00277 $this->contentTypo3Language = $pRteArr[1];
00278 $this->contentTypo3Charset = $pRteArr[2];
00279 $this->RTEtsConfigParams = $pArr[2];
00280 if (!$this->editorNo) {
00281 $this->editorNo = t3lib_div::_GP('editorNo');
00282 $this->contentTypo3Language = t3lib_div::_GP('contentTypo3Language');
00283 $this->contentTypo3Charset = t3lib_div::_GP('contentTypo3Charset');
00284 $this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
00285 }
00286 $this->pointer = t3lib_div::_GP('pointer');
00287 $this->expandPage = t3lib_div::_GP('expandPage');
00288 $this->expandFolder = t3lib_div::_GP('expandFolder');
00289 $this->P = t3lib_div::_GP('P');
00290 $this->PM = t3lib_div::_GP('PM');
00291 $pArr[1] = implode(':', array($this->editorNo, $this->contentTypo3Language, $this->contentTypo3Charset));
00292 $pArr[2] = $this->RTEtsConfigParams;
00293 $this->bparams = implode('|', $pArr);
00294
00295
00296 $this->mode = t3lib_div::_GP('mode');
00297 if (!$this->mode) {
00298 $this->mode = 'rte';
00299 }
00300
00301 $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
00302
00303
00304 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
00305 }
00306
00307
00308
00309
00310
00311
00312 public function initConfiguration() {
00313 $this->thisConfig = $this->getRTEConfig();
00314 $this->buttonConfig = $this->getButtonConfig('link');
00315 }
00316
00317
00318
00319
00320
00321
00322 protected function getRTEConfig() {
00323 global $BE_USER;
00324
00325 $RTEtsConfigParts = explode(':', $this->RTEtsConfigParams);
00326 $RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
00327 $this->RTEProperties = $RTEsetup['properties'];
00328 return t3lib_BEfunc::RTEsetup($this->RTEProperties, $RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
00329 }
00330
00331
00332
00333
00334
00335
00336
00337 protected function getButtonConfig($buttonName) {
00338 return ((is_array($this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.'][$buttonName.'.'])) ? $this->thisConfig['buttons.'][$buttonName.'.'] : array());
00339 }
00340
00341
00342
00343
00344
00345
00346 protected function initHookObjects($hookKey) {
00347 global $TYPO3_CONF_VARS;
00348 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS'][$hookKey]['browseLinksHook'])) {
00349 foreach ($TYPO3_CONF_VARS['SC_OPTIONS'][$hookKey]['browseLinksHook'] as $classData) {
00350 $processObject = &t3lib_div::getUserObj($classData);
00351 if(!($processObject instanceof t3lib_browseLinksHook)) {
00352 throw new UnexpectedValueException('$processObject must implement interface t3lib_browseLinksHook', 1195115652);
00353 }
00354 $parameters = array();
00355 $processObject->init($this, $parameters);
00356 $this->hookObjects[] = $processObject;
00357 }
00358 }
00359 }
00360
00361
00362
00363
00364
00365
00366 protected function initLinkAttributes() {
00367
00368
00369 $this->setTitle = $GLOBALS['LANG']->csConvObj->conv($this->curUrlArray['title'], 'utf-8', $GLOBALS['LANG']->charSet);
00370
00371
00372 $classSelected = array();
00373 if ($this->thisConfig['classesAnchor'] || $this->thisConfig['classesLinks']) {
00374 $this->setClass = $this->curUrlArray['class'];
00375 if ($this->thisConfig['classesAnchor']) {
00376 $classesAnchorArray = t3lib_div::trimExplode(',',$this->thisConfig['classesAnchor'], 1);
00377 } else {
00378 $classesAnchorArray = t3lib_div::trimExplode(',',$this->thisConfig['classesLinks'], 1);
00379 }
00380
00381 $classesAnchor = array();
00382 $classesAnchor['all'] = array();
00383 $titleReadOnly = $this->buttonConfig['properties.']['title.']['readOnly'] || $this->buttonConfig[$this->act.'.']['properties.']['title.']['readOnly'];
00384 if (is_array($this->RTEProperties['classesAnchor.'])) {
00385 foreach ($this->RTEProperties['classesAnchor.'] as $label => $conf) {
00386 if (in_array($conf['class'], $classesAnchorArray)) {
00387 $classesAnchor['all'][] = $conf['class'];
00388 if (in_array($conf['type'], $this->anchorTypes)) {
00389 $classesAnchor[$conf['type']][] = $conf['class'];
00390 if (is_array($this->thisConfig['classesAnchor.']) && is_array($this->thisConfig['classesAnchor.']['default.']) && $this->thisConfig['classesAnchor.']['default.'][$conf['type']] == $conf['class']) {
00391 $this->classesAnchorDefault[$conf['type']] = $conf['class'];
00392 if ($conf['titleText']) {
00393 $this->classesAnchorDefaultTitle[$conf['type']] = $this->getLLContent(trim($conf['titleText']));
00394 }
00395 if ($conf['target']) {
00396 $this->classesAnchorDefaultTarget[$conf['type']] = trim($conf['target']);
00397 }
00398 }
00399 }
00400 if ($titleReadOnly && $conf['titleText']) {
00401 $this->classesAnchorClassTitle[$conf['class']] = $this->classesAnchorDefaultTitle[$conf['type']] = $this->getLLContent(trim($conf['titleText']));
00402 }
00403 }
00404 }
00405 }
00406
00407 foreach ($this->anchorTypes as $anchorType) {
00408 foreach ($classesAnchorArray as $class) {
00409 if (!in_array($class, $classesAnchor['all']) || (in_array($class, $classesAnchor['all']) && is_array($classesAnchor[$anchorType]) && in_array($class, $classesAnchor[$anchorType]))) {
00410 $selected = '';
00411 if ($this->setClass == $class || (!$this->setClass && $this->classesAnchorDefault[$anchorType] == $class)) {
00412 $selected = 'selected="selected"';
00413 $classSelected[$anchorType] = true;
00414 }
00415 $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;
00416 $classStyle = (is_array($this->RTEProperties['classes.']) && is_array($this->RTEProperties['classes.'][$class.'.']) && $this->RTEProperties['classes.'][$class.'.']['value']) ? $this->RTEProperties['classes.'][$class.'.']['value'] : '';
00417 $this->classesAnchorJSOptions[$anchorType] .= '<option ' . $selected . ' value="' .$class . '"' . ($classStyle?' style="'.$classStyle.'"':'') . '>' . $classLabel . '</option>';
00418 }
00419 }
00420 if ($this->classesAnchorJSOptions[$anchorType] && !($this->buttonConfig['properties.']['class.']['required'] || $this->buttonConfig[$this->act.'.']['properties.']['class.']['required'])) {
00421 $selected = '';
00422 if (!$this->setClass && !$this->classesAnchorDefault[$anchorType]) $selected = 'selected="selected"';
00423 $this->classesAnchorJSOptions[$anchorType] = '<option ' . $selected . ' value=""></option>' . $this->classesAnchorJSOptions[$anchorType];
00424 }
00425 }
00426 }
00427
00428
00429
00430 $this->setTarget = (isset($this->curUrlArray['target'])
00431 && !(
00432 ($this->curUrlArray['target'] != $this->thisConfig['defaultLinkTarget'])
00433 && !$classSelected[$this->act]
00434 && is_array($this->buttonConfig['targetSelector.']) && $this->buttonConfig['targetSelector.']['disabled'] && is_array($this->buttonConfig['popupSelector.']) && $this->buttonConfig['popupSelector.']['disabled'])
00435 ) ? $this->curUrlArray['target'] : '';
00436 if ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target'])) {
00437 $this->setTarget=$this->thisConfig['defaultLinkTarget'];
00438 }
00439
00440 if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes']) {
00441 $addAttributes = t3lib_div::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 1);
00442 foreach ($addAttributes as $attribute) {
00443 $this->additionalAttributes[$attribute] = isset($this->curUrlArray[$attribute]) ? $this->curUrlArray[$attribute] : '';
00444 }
00445 }
00446 }
00447
00448
00449
00450
00451
00452
00453 public function getBodyTagAdditions() {
00454 $bodyTagAdditions = array();
00455
00456 foreach ($this->hookObjects as $hookObject) {
00457 if (method_exists($hookObject, 'addBodyTagAdditions')) {
00458 $bodyTagAdditions = $hookObject->addBodyTagAdditions($bodyTagAdditions);
00459 }
00460 }
00461 $bodyTagAdditions['onLoad'] = 'initDialog();' . $bodyTagAdditions['onLoad'];
00462 return t3lib_div::implodeAttributes($bodyTagAdditions, TRUE);
00463 }
00464
00465
00466
00467
00468
00469
00470 function getJSCode() {
00471 global $BACK_PATH;
00472
00473 $JScode = '';
00474 $JScode.= '
00475 var dialog = window.opener.HTMLArea.Dialog.TYPO3Link;
00476 var plugin = dialog.plugin;
00477 var HTMLArea = window.opener.HTMLArea;
00478
00479 function initDialog() {
00480 window.dialog = window.opener.HTMLArea.Dialog.TYPO3Link;
00481 window.plugin = dialog.plugin;
00482 window.HTMLArea = window.opener.HTMLArea;
00483 dialog.captureEvents("skipUnload");
00484 }
00485 var add_href="'.($this->curUrlArray['href']?'&curUrl[href]='.rawurlencode($this->curUrlArray['href']):'').'";
00486 var add_target="'.($this->setTarget?'&curUrl[target]='.rawurlencode($this->setTarget):'').'";
00487 var add_class="'.($this->setClass?'&curUrl[class]='.rawurlencode($this->setClass):'').'";
00488 var add_title="'.($this->setTitle?'&curUrl[title]='.rawurlencode($this->setTitle):'').'";
00489 var add_params="'.($this->bparams?'&bparams='.rawurlencode($this->bparams):'').'";
00490 var additionalValues = ' . (count($this->additionalAttributes) ? json_encode($this->additionalAttributes) : '{}') . ';';
00491
00492
00493 $JScode.= '
00494 var cur_href="'.($this->curUrlArray['href'] ? ($this->curUrlInfo['query'] ? substr($this->curUrlArray['href'], 0, -strlen($this->curUrlInfo['query'])) :$this->curUrlArray['href']):'').'";
00495 var cur_target="'.($this->setTarget?$this->setTarget:'').'";
00496 var cur_class="'.($this->setClass?$this->setClass:'').'";
00497 var cur_title="'.($this->setTitle?$this->setTitle:'').'";
00498
00499 function browse_links_setTarget(value) {
00500 cur_target=value;
00501 add_target="&curUrl[target]="+encodeURIComponent(value);
00502 }
00503 function browse_links_setClass(value) {
00504 cur_class=value;
00505 add_class="&curUrl[class]="+encodeURIComponent(value);
00506 }
00507 function browse_links_setTitle(value) {
00508 cur_title=value;
00509 add_title="&curUrl[title]="+encodeURIComponent(value);
00510 }
00511 function browse_links_setHref(value) {
00512 cur_href=value;
00513 add_href="&curUrl[href]="+value;
00514 }
00515 function browse_links_setAdditionalValue(name, value) {
00516 additionalValues[name] = value;
00517 }
00518 ';
00519
00520 $JScode.='
00521 function link_typo3Page(id,anchor) {
00522 var parameters = document.ltargetform.query_parameters ? (document.ltargetform.query_parameters.value.charAt(0) == "&"?"":"&") + document.ltargetform.query_parameters.value : "";
00523 var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"")+parameters;
00524 if (document.ltargetform.anchor_title) browse_links_setTitle(document.ltargetform.anchor_title.value);
00525 if (document.ltargetform.anchor_class) browse_links_setClass(document.ltargetform.anchor_class.value);
00526 if (document.ltargetform.ltarget) browse_links_setTarget(document.ltargetform.ltarget.value);
00527 plugin.createLink(theLink,cur_target,cur_class,cur_title,additionalValues);
00528 return false;
00529 }
00530 function link_folder(folder) {
00531 var theLink = \''.$this->siteURL.'\'+folder;
00532 if (document.ltargetform.anchor_title) browse_links_setTitle(document.ltargetform.anchor_title.value);
00533 if (document.ltargetform.anchor_class) browse_links_setClass(document.ltargetform.anchor_class.value);
00534 if (document.ltargetform.ltarget) browse_links_setTarget(document.ltargetform.ltarget.value);
00535 plugin.createLink(theLink,cur_target,cur_class,cur_title,additionalValues);
00536 return false;
00537 }
00538 function link_spec(theLink) {
00539 if (document.ltargetform.anchor_title) browse_links_setTitle(document.ltargetform.anchor_title.value);
00540 if (document.ltargetform.anchor_class) browse_links_setClass(document.ltargetform.anchor_class.value);
00541 if (document.ltargetform.ltarget) browse_links_setTarget(document.ltargetform.ltarget.value);
00542 plugin.createLink(theLink,cur_target,cur_class,cur_title,additionalValues);
00543 return false;
00544 }
00545 function link_current() {
00546 var parameters = document.ltargetform.query_parameters ? (document.ltargetform.query_parameters.value.charAt(0) == "&"?"":"&") + document.ltargetform.query_parameters.value : "";
00547 if (document.ltargetform.anchor_title) browse_links_setTitle(document.ltargetform.anchor_title.value);
00548 if (document.ltargetform.anchor_class) browse_links_setClass(document.ltargetform.anchor_class.value);
00549 if (document.ltargetform.ltarget) browse_links_setTarget(document.ltargetform.ltarget.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
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
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601 function main_rte($wiz=0) {
00602 global $LANG, $BE_USER, $BACK_PATH;
00603
00604
00605 $content=$this->doc->startPage($LANG->getLL('Insert/Modify Link',1));
00606
00607
00608 $this->allowedItems = explode(',','page,file,url,mail,spec');
00609
00610
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
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
00665 foreach($this->hookObjects as $hookObject) {
00666 $menuDef = $hookObject->modifyMenuDefinition($menuDef);
00667 }
00668
00669 $content .= $this->doc->getTabMenuRaw($menuDef);
00670
00671
00672 $content.=$this->printCurrentUrl($this->curUrlInfo['info']).'<br />';
00673
00674
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="browse_links_setHref(document.lurlform.lurl.value); 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
00729 if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
00730 $path=$this->expandFolder;
00731 if (!$path || !@is_dir($path)) {
00732 $path = $this->fileProcessor->findTempFolder().'/';
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 reset($v);
00766 while(list($k2)=each($v)) {
00767 $k2i = intval($k2);
00768 if (substr($k2,-1)=='.' && is_array($v[$k2i.'.'])) {
00769
00770
00771 $title = trim($v[$k2i]);
00772 if (!$title) {
00773 $title=$v[$k2i.'.']['url'];
00774 } else {
00775 $title=$LANG->sL($title);
00776 }
00777
00778 $description=$v[$k2i.'.']['description'] ? $LANG->sL($v[$k2i.'.']['description'],1).'<br />' : '';
00779
00780
00781 $onClickEvent='';
00782 if (isset($v[$k2i.'.']['target'])) $onClickEvent.="browse_links_setTarget('".$v[$k2i.'.']['target']."');";
00783 $v[$k2i.'.']['url'] = str_replace('###_URL###',$this->siteURL,$v[$k2i.'.']['url']);
00784 if (substr($v[$k2i.'.']['url'],0,7)=="http://" || substr($v[$k2i.'.']['url'],0,7)=='mailto:') {
00785 $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();";
00786 } else {
00787 $onClickEvent.="link_spec(unescape('".$this->siteURL.rawurlencode($v[$k2i.'.']['url'])."'));";
00788 }
00789
00790
00791 $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>');
00792
00793
00794 $subcats[$k2i]='
00795 <tr>
00796 <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>
00797 </tr>';
00798 }
00799 }
00800
00801
00802 ksort($subcats);
00803
00804
00805 $content.= '
00806 <!--
00807 Special userdefined menu:
00808 -->
00809 <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
00810 <tr>
00811 <td class="bgColor5" class="c-wCell" valign="top"><strong>'.$LANG->getLL('special',1).'</strong></td>
00812 </tr>
00813 '.implode('',$subcats).'
00814 </table>
00815 ';
00816 }
00817 break;
00818 case 'page':
00819 $content.=$this->addAttributesForm();
00820
00821 $pagetree = t3lib_div::makeInstance('tx_rtehtmlarea_pageTree');
00822 $pagetree->ext_showNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
00823 $pagetree->addField('nav_title');
00824 $tree=$pagetree->getBrowsableTree();
00825 $cElements = $this->expandPage();
00826 $content.= '
00827 <!--
00828 Wrapper table for page tree / record list:
00829 -->
00830 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages">
00831 <tr>
00832 <td class="c-wCell" valign="top">'.$this->barheader($LANG->getLL('pageTree').':').$tree.'</td>
00833 <td class="c-wCell" valign="top">'.$cElements.'</td>
00834 </tr>
00835 </table>
00836 ';
00837 break;
00838 default:
00839
00840 foreach($this->hookObjects as $hookObject) {
00841 $content .= $hookObject->getTab($this->act);
00842 }
00843
00844 break;
00845 }
00846
00847
00848 $content.= $this->doc->endPage();
00849 $content = $this->doc->insertStylesAndJS($content);
00850 return $content;
00851 }
00852
00853 function addAttributesForm() {
00854 $ltargetForm = '';
00855
00856 $lpageId = $this->addPageIdSelector();
00857 $queryParameters = $this->addQueryParametersSelector();
00858 $ltarget = $this->addTargetSelector();
00859 $lclass = $this->addClassSelector();
00860 $ltitle = $this->addTitleSelector();
00861 if ($lpageId || $queryParameters || $ltarget || $lclass || $ltitle) {
00862 $ltargetForm = $this->wrapInForm($lpageId.$queryParameters.$ltarget.$lclass.$ltitle);
00863 }
00864 return $ltargetForm;
00865 }
00866
00867 function wrapInForm($string) {
00868 global $LANG;
00869
00870 $form = '
00871 <!--
00872 Selecting target for link:
00873 -->
00874 <form action="" name="ltargetform" id="ltargetform">
00875 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">'. $string;
00876 if ($this->act == $this->curUrlInfo['act'] && $this->act != 'mail' && $this->curUrlArray['href']) {
00877 $form .='
00878 <tr>
00879 <td>
00880 </td>
00881 <td colspan="3">
00882 <input type="submit" value="'.$LANG->getLL('update',1).'" onclick="return link_current();" />
00883 </td>
00884 </tr>';
00885 }
00886 $form .= '
00887 </table>
00888 </form>';
00889 return $form;
00890 }
00891
00892 function addPageIdSelector() {
00893 global $LANG;
00894
00895 return ($this->act == 'page' && $this->buttonConfig && is_array($this->buttonConfig['pageIdSelector.']) && $this->buttonConfig['pageIdSelector.']['enabled'])?'
00896 <tr>
00897 <td>'.$LANG->getLL('page_id',1).':</td>
00898 <td colspan="3">
00899 <input type="text" size="6" name="luid" /> <input type="submit" value="'.$LANG->getLL('setLink',1).'" onclick="return link_typo3Page(document.ltargetform.luid.value);" />
00900 </td>
00901 </tr>':'';
00902 }
00903
00904 function addQueryParametersSelector() {
00905 global $LANG;
00906
00907 return ($this->act == 'page' && $this->buttonConfig && is_array($this->buttonConfig['queryParametersSelector.']) && $this->buttonConfig['queryParametersSelector.']['enabled'])?'
00908 <tr>
00909 <td>'.$LANG->getLL('query_parameters',1).':</td>
00910 <td colspan="3">
00911 <input type="text" name="query_parameters" value="' . ($this->curUrlInfo['query']?$this->curUrlInfo['query']:'') . '" ' . $this->doc->formWidth(30) . ' />
00912 </td>
00913 </tr>':'';
00914 }
00915
00916 function addTargetSelector() {
00917 global $LANG;
00918
00919 $targetSelectorConfig = array();
00920 $popupSelectorConfig = array();
00921 if (is_array($this->buttonConfig['targetSelector.'])) {
00922 $targetSelectorConfig = $this->buttonConfig['targetSelector.'];
00923 }
00924 if (is_array($this->buttonConfig['popupSelector.'])) {
00925 $popupSelectorConfig = $this->buttonConfig['popupSelector.'];
00926 }
00927
00928 $ltarget = '';
00929 if ($this->act != 'mail') {
00930 $ltarget .= '
00931 <tr id="ltargetrow"'. (($targetSelectorConfig['disabled'] && $popupSelectorConfig['disabled']) ? ' style="display: none;"' : '') . '>
00932 <td>'.$LANG->getLL('target',1).':</td>
00933 <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>';
00934 $ltarget .= '
00935 <td colspan="2">';
00936 if (!$targetSelectorConfig['disabled']) {
00937 $ltarget .= '
00938 <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;">
00939 <option></option>
00940 <option value="_top">'.$LANG->getLL('top',1).'</option>
00941 <option value="_blank">'.$LANG->getLL('newWindow',1).'</option>
00942 </select>';
00943 }
00944 $ltarget .= '
00945 </td>
00946 </tr>';
00947 if (!$popupSelectorConfig['disabled']) {
00948
00949 $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) {
00950 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;
00951 browse_links_setTarget(document.ltargetform.ltarget.value);
00952 document.ltargetform.popup_width.selectedIndex=0;
00953 document.ltargetform.popup_height.selectedIndex=0;
00954 }';
00955
00956 $ltarget.='
00957 <tr>
00958 <td>'.$LANG->getLL('target_popUpWindow',1).':</td>
00959 <td colspan="3">
00960 <select name="popup_width" onchange="'.$selectJS.'">
00961 <option value="0">'.$LANG->getLL('target_popUpWindow_width',1).'</option>
00962 <option value="300">300</option>
00963 <option value="400">400</option>
00964 <option value="500">500</option>
00965 <option value="600">600</option>
00966 <option value="700">700</option>
00967 <option value="800">800</option>
00968 </select>
00969 x
00970 <select name="popup_height" onchange="'.$selectJS.'">
00971 <option value="0">'.$LANG->getLL('target_popUpWindow_height',1).'</option>
00972 <option value="200">200</option>
00973 <option value="300">300</option>
00974 <option value="400">400</option>
00975 <option value="500">500</option>
00976 <option value="600">600</option>
00977 </select>
00978 </td>
00979 </tr>';
00980 }
00981 }
00982 return $ltarget;
00983 }
00984
00985
00986
00987
00988
00989
00990 public function addClassSelector() {
00991 $selectClass = '';
00992 if ($this->classesAnchorJSOptions[$this->act]) {
00993 $selectClass ='
00994 <tr>
00995 <td>'.$GLOBALS['LANG']->getLL('anchor_class',1).':</td>
00996 <td colspan="3">
00997 <select name="anchor_class" onchange="'.$this->getClassOnChangeJS().'">
00998 ' . $this->classesAnchorJSOptions[$this->act] . '
00999 </select>
01000 </td>
01001 </tr>';
01002 }
01003 return $selectClass;
01004 }
01005
01006
01007
01008
01009
01010
01011 public function getClassOnChangeJS() {
01012 return '
01013 if (document.ltargetform.anchor_class) {
01014 document.ltargetform.anchor_class.value = document.ltargetform.anchor_class.options[document.ltargetform.anchor_class.selectedIndex].value;
01015 if (document.ltargetform.anchor_class.value && HTMLArea.classesAnchorSetup) {
01016 for (var i = HTMLArea.classesAnchorSetup.length; --i >= 0;) {
01017 var anchorClass = HTMLArea.classesAnchorSetup[i];
01018 if (anchorClass[\'name\'] == document.ltargetform.anchor_class.value) {
01019 if (anchorClass[\'titleText\'] && document.ltargetform.anchor_title) {
01020 document.ltargetform.anchor_title.value = anchorClass[\'titleText\'];
01021 document.getElementById(\'rtehtmlarea-browse-links-title-readonly\').innerHTML = anchorClass[\'titleText\'];
01022 browse_links_setTitle(anchorClass[\'titleText\']);
01023 }
01024 if (anchorClass[\'target\']) {
01025 if (document.ltargetform.ltarget) {
01026 document.ltargetform.ltarget.value = anchorClass[\'target\'];
01027 }
01028 browse_links_setTarget(anchorClass[\'target\']);
01029 } else if (document.ltargetform.ltarget && document.getElementById(\'ltargetrow\').style.display == \'none\') {
01030
01031 document.ltargetform.ltarget.value = \''. ($this->thisConfig['defaultLinkTarget']?$this->thisConfig['defaultLinkTarget']:'') .'\';
01032 browse_links_setTarget(document.ltargetform.ltarget.value);
01033 }
01034 break;
01035 }
01036 }
01037 }
01038 browse_links_setClass(document.ltargetform.anchor_class.value);
01039 }
01040 ';
01041 }
01042
01043 function addTitleSelector() {
01044 $title = ($this->setTitle ? $this->setTitle : (($this->setClass || !$this->classesAnchorDefault[$this->act]) ? '' : $this->classesAnchorDefaultTitle[$this->act]));
01045 $readOnly = $this->buttonConfig['properties.']['title.']['readOnly'] || $this->buttonConfig[$this->act.'.']['properties.']['title.']['readOnly'];
01046 if ($readOnly) {
01047 $title = $this->setClass ? $this->classesAnchorClassTitle[$this->setClass] : $this->classesAnchorDefaultTitle[$this->act];
01048 }
01049 return '
<