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
00041 require_once (PATH_typo3.'class.browse_links.php');
00042 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
00043
00044
00052 class tx_rtehtmlarea_pageTree extends rtePageTree {
00053
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
00113 class tx_rtehtmlarea_folderTree extends rteFolderTree {
00114
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
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
00200 class tx_rtehtmlarea_browse_links extends browse_links {
00201
00202
00203 var $setTarget;
00204 var $setClass;
00205 var $setTitle;
00206
00207 var $contentTypo3Language;
00208 var $contentTypo3Charset;
00209
00210 var $editorNo;
00211 var $buttonConfig = array();
00212
00219 function init() {
00220 global $BE_USER,$BACK_PATH,$LANG;
00221
00222
00223 $this->pointer = t3lib_div::_GP('pointer');
00224 $this->bparams = t3lib_div::_GP('bparams');
00225 $this->P = t3lib_div::_GP('P');
00226 $this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
00227 $this->expandPage = t3lib_div::_GP('expandPage');
00228 $this->expandFolder = t3lib_div::_GP('expandFolder');
00229 $this->PM = t3lib_div::_GP('PM');
00230 $this->contentTypo3Language = t3lib_div::_GP('typo3ContentLanguage');
00231 $this->contentTypo3Charset = t3lib_div::_GP('typo3ContentCharset');
00232 $this->editorNo = t3lib_div::_GP('editorNo');
00233
00234
00235 $this->mode=t3lib_div::_GP('mode');
00236 if (!$this->mode) {
00237 $this->mode='rte';
00238 }
00239
00240
00241 $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
00242
00243
00244 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
00245
00246
00247 if ($this->mode=='wizard') {
00248 $currentLinkParts = t3lib_div::trimExplode(' ',$this->P['currentValue']);
00249 $this->curUrlArray = array(
00250 'target' => $currentLinkParts[1]
00251 );
00252 $this->curUrlInfo=$this->parseCurUrl($this->siteURL.'?id='.$currentLinkParts[0],$this->siteURL);
00253 } else {
00254 $this->curUrlArray = t3lib_div::_GP('curUrl');
00255 if ($this->curUrlArray['all']) {
00256 $this->curUrlArray=t3lib_div::get_tag_attributes($this->curUrlArray['all']);
00257 }
00258 $this->curUrlInfo=$this->parseCurUrl($this->curUrlArray['href'],$this->siteURL);
00259 }
00260
00261
00262 $this->act=t3lib_div::_GP('act');
00263 if (!$this->act) {
00264 $this->act=$this->curUrlInfo['act'];
00265 }
00266
00267
00268 $this->setTitle = $LANG->csConvObj->conv($this->curUrlArray['title'], 'utf-8', $LANG->charSet);
00269
00270
00271 $addPassOnParams='';
00272 if ((string)$this->mode=='rte') {
00273 $RTEtsConfigParts = explode(':',$this->RTEtsConfigParams);
00274 $addPassOnParams .= '&RTEtsConfigParams='.rawurlencode($this->RTEtsConfigParams);
00275 $addPassOnParams .= ($this->contentTypo3Language ? '&typo3ContentLanguage=' . rawurlencode($this->contentTypo3Language) : '');
00276 $addPassOnParams .= ($this->contentTypo3Charset ? '&typo3ContentCharset=' . rawurlencode($this->contentTypo3Charset) : '');
00277 $RTEsetup = $BE_USER->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
00278 $this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
00279 if (is_array($this->thisConfig['buttons.']) && is_array($this->thisConfig['buttons.']['link.'])) {
00280 $this->buttonConfig = $this->thisConfig['buttons.']['link.'];
00281 }
00282 if($this->thisConfig['classesAnchor']) {
00283 $this->setClass = $this->curUrlArray['class'];
00284 $classesAnchorArray = t3lib_div::trimExplode(',',$this->thisConfig['classesAnchor'],1);
00285 $anchorTypes = array( 'page', 'url', 'file', 'mail', 'spec');
00286 $classesAnchor = array();
00287 $classesAnchorDefault = array();
00288 $this->classesAnchorDefaultTitle = array();
00289 $classesAnchor['all'] = array();
00290 if (is_array($RTEsetup['properties']['classesAnchor.'])) {
00291 reset($RTEsetup['properties']['classesAnchor.']);
00292 while(list($label,$conf)=each($RTEsetup['properties']['classesAnchor.'])) {
00293 $classesAnchor['all'][] = $conf['class'];
00294 if (in_array($conf['type'], $anchorTypes)) {
00295 $classesAnchor[$conf['type']][] = $conf['class'];
00296 if (is_array($this->thisConfig['classesAnchor.']) && is_array($this->thisConfig['classesAnchor.']['default.']) && $this->thisConfig['classesAnchor.']['default.'][$conf['type']] == $conf['class']) {
00297 $classesAnchorDefault[$conf['type']] = $conf['class'];
00298 if ($conf['titleText']) {
00299 $string = trim($conf['titleText']);
00300 if (substr($string,0,4)=='LLL:') {
00301 $arr = explode(':',$string);
00302 if($arr[0] == 'LLL' && $arr[1] == 'EXT') {
00303 $BE_lang = $LANG->lang;
00304 $BE_origCharset = $LANG->origCharSet;
00305 $LANG->lang = $this->contentTypo3Language;
00306 $LANG->origCharSet = $LANG->csConvObj->charSetArray[$this->contentTypo3Language];
00307 $LANG->origCharSet = $LANG->origCharSet ? $LANG->origCharSet : 'iso-8859-1';
00308 $string = $LANG->getLLL($arr[3], $LANG->readLLfile($arr[1].':'.$arr[2]), true);
00309 $LANG->lang = $BE_lang;
00310 $LANG->origCharSet = $BE_origCharset;
00311 }
00312 }
00313 $this->classesAnchorDefaultTitle[$conf['type']] = $string;
00314 }
00315 }
00316 }
00317 }
00318 }
00319 $this->classesAnchorJSOptions = array();
00320 reset($anchorTypes);
00321 while (list(, $anchorType) = each($anchorTypes) ) {
00322 reset($classesAnchorArray);
00323 while(list(,$class)=each($classesAnchorArray)) {
00324 if (!in_array($class, $classesAnchor['all']) || (in_array($class, $classesAnchor['all']) && is_array($classesAnchor[$anchorType]) && in_array($class, $classesAnchor[$anchorType]))) {
00325 $selected = '';
00326 if ($this->setClass == $class) $selected = 'selected="selected"';
00327 if (!$this->setClass && $classesAnchorDefault[$anchorType] == $class) {
00328 $selected = 'selected="selected"';
00329 }
00330 $this->classesAnchorJSOptions[$anchorType] .= '<option ' . $selected . ' value="' .$class . '">' . $class . '</option>';
00331 }
00332 }
00333 if ($this->classesAnchorJSOptions[$anchorType]) {
00334 $selected = '';
00335 if (!$this->setClass && !$classesAnchorDefault[$anchorType]) $selected = 'selected="selected"';
00336 $this->classesAnchorJSOptions[$anchorType] = '<option ' . $selected . ' value=""></option>' . $this->classesAnchorJSOptions[$anchorType];
00337 }
00338 }
00339 }
00340 }
00341
00342
00343 $this->setTarget = $this->curUrlArray['target'];
00344 if ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target'])) {
00345 $this->setTarget=$this->thisConfig['defaultLinkTarget'];
00346 }
00347
00348
00349 $this->doc = t3lib_div::makeInstance('template');
00350 $this->doc->docType= 'xhtml_trans';
00351 $this->doc->backPath = $BACK_PATH;
00352
00353
00354 $JScode = '';
00355 $JScode.= '
00356 if (window.opener) {
00357 var editor = window.opener.RTEarea[' . $this->editorNo . ']["editor"];
00358 var HTMLArea = window.opener.HTMLArea;
00359 }
00360
00361 var add_href="'.($this->curUrlArray['href']?'&curUrl[href]='.rawurlencode($this->curUrlArray['href']):'').'";
00362 var add_target="'.($this->setTarget?'&curUrl[target]='.rawurlencode($this->setTarget):'').'";
00363 var add_class="'.($this->setClass?'&curUrl[class]='.rawurlencode($this->setClass):'').'";
00364 var add_title="'.($this->setTitle?'&curUrl[title]='.rawurlencode($this->setTitle):'').'";
00365 var add_params="'.($this->bparams?'&bparams='.rawurlencode($this->bparams):'').'";
00366
00367 var cur_href="'.($this->curUrlArray['href']?$this->curUrlArray['href']:'').'";
00368 var cur_target="'.($this->setTarget?$this->setTarget:'').'";
00369 var cur_class="'.($this->setClass?$this->setClass:'').'";
00370 var cur_title="'.($this->setTitle?$this->setTitle:'').'";
00371
00372 function setTarget(value) {
00373 cur_target=value;
00374 add_target="&curUrl[target]="+encodeURIComponent(value);
00375 }
00376 function setClass(value) {
00377 cur_class=value;
00378 add_class="&curUrl[class]="+encodeURIComponent(value);
00379 }
00380 function setTitle(value) {
00381 cur_title=value;
00382 add_title="&curUrl[title]="+encodeURIComponent(value);
00383 }
00384 function setValue(value) {
00385 cur_href=value;
00386 add_href="&curUrl[href]="+value;
00387 }
00388 ';
00389
00390 if ($this->mode=='wizard') {
00391 unset($this->P['fieldChangeFunc']['alert']);
00392 reset($this->P['fieldChangeFunc']);
00393 $update='';
00394 while(list($k,$v)=each($this->P['fieldChangeFunc'])) {
00395
00396 $update.= '
00397 window.opener.'.$v;
00398 }
00399
00400 $P2=array();
00401 $P2['itemName']=$this->P['itemName'];
00402 $P2['formName']=$this->P['formName'];
00403 $P2['fieldChangeFunc']=$this->P['fieldChangeFunc'];
00404 $addPassOnParams.=t3lib_div::implodeArrayForUrl('P',$P2);
00405
00406 $JScode.='
00407 function link_typo3Page(id,anchor) {
00408 updateValueInMainForm(id+(anchor?anchor:"")+" "+cur_target);
00409 close();
00410 return false;
00411 }
00412 function link_folder(folder) {
00413 updateValueInMainForm(folder+" "+cur_target);
00414 close();
00415 return false;
00416 }
00417 function link_current() {
00418 if (cur_href!="http://" && cur_href!="mailto:") {
00419 var setValue = cur_href+" "+cur_target+" "+cur_class+" "+cur_title;
00420 if (setValue.substr(0,7)=="http://") setValue = setValue.substr(7);
00421 if (setValue.substr(0,7)=="mailto:") setValue = setValue.substr(7);
00422 updateValueInMainForm(setValue);
00423 close();
00424 }
00425 return false;
00426 }
00427 function checkReference() {
00428 if (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"] ) {
00429 return window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"];
00430 } else {
00431 close();
00432 }
00433 }
00434 function updateValueInMainForm(input) {
00435 var field = checkReference();
00436 if (field) {
00437 field.value = input;
00438 '.$update.'
00439 }
00440 }
00441 ';
00442 } else {
00443 $JScode.='
00444 function link_typo3Page(id,anchor) {
00445 var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"");
00446 if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
00447 if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
00448 editor.renderPopup_addLink(theLink,cur_target,cur_class,cur_title);
00449 return false;
00450 }
00451 function link_folder(folder) {
00452 var theLink = \''.$this->siteURL.'\'+folder;
00453 if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
00454 if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
00455 editor.renderPopup_addLink(theLink,cur_target,cur_class,cur_title);
00456 return false;
00457 }
00458 function link_spec(theLink) {
00459 if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
00460 if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
00461 editor.renderPopup_addLink(theLink,cur_target,cur_class,cur_title);
00462 return false;
00463 }
00464 function link_current() {
00465 if (document.ltargetform.anchor_title) setTitle(document.ltargetform.anchor_title.value);
00466 if (document.ltargetform.anchor_class) setClass(document.ltargetform.anchor_class.value);
00467 if (cur_href!="http://" && cur_href!="mailto:") {
00468 editor.renderPopup_addLink(cur_href,cur_target,cur_class,cur_title);
00469 }
00470 return false;
00471 }
00472 ';
00473 }
00474
00475
00476 $JScode.='
00477 function jumpToUrl(URL,anchor) {
00478 var add_editorNo = URL.indexOf("editorNo=")==-1 ? "&editorNo='.$this->editorNo.'" : "";
00479 var add_contentTypo3Language = URL.indexOf("contentTypo3Language=")==-1 ? "&contentTypo3Language='.$this->contentTypo3Language.'" : "";
00480 var add_contentTypo3Charset = URL.indexOf("contentTypo3Charset=")==-1 ? "&contentTypo3Charset='.$this->contentTypo3Charset.'" : "";
00481 var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : "";
00482 var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$this->mode.'" : "";
00483 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:"");
00484 window.location.href = theLocation;
00485 return false;
00486 }
00487 ';
00488
00489
00490 $pArr = explode('|',$this->bparams);
00491 $formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';
00492 $JScode.='
00493 var elRef="";
00494 var targetDoc="";
00495
00496 function launchView(url) {
00497 var thePreviewWindow="";
00498 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");
00499 if (thePreviewWindow && thePreviewWindow.focus) {
00500 thePreviewWindow.focus();
00501 }
00502 }
00503 function setReferences() {
00504 if (parent.window.opener
00505 && parent.window.opener.content
00506 && parent.window.opener.content.document.editform
00507 && parent.window.opener.content.document.editform["'.$formFieldName.'"]
00508 ) {
00509 targetDoc = parent.window.opener.content.document;
00510 elRef = targetDoc.editform["'.$formFieldName.'"];
00511 return true;
00512 } else {
00513 return false;
00514 }
00515 }
00516 function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close) {
00517 if (1=='.($pArr[0]&&!$pArr[1]&&!$pArr[2] ? 1 : 0).') {
00518 addElement(filename,table+"_"+uid,fp,close);
00519 } else {
00520 if (setReferences()) {
00521 parent.window.opener.group_change("add","'.$pArr[0].'","'.$pArr[1].'","'.$pArr[2].'",elRef,targetDoc);
00522 } else {
00523 alert("Error - reference to main window is not set properly!");
00524 }
00525 if (close) {
00526 parent.window.opener.focus();
00527 parent.close();
00528 }
00529 }
00530 return false;
00531 }
00532 function addElement(elName,elValue,altElValue,close) {
00533 if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin) {
00534 parent.window.opener.setFormValueFromBrowseWin("'.$pArr[0].'",altElValue?altElValue:elValue,elName);
00535 if (close) {
00536 parent.window.opener.focus();
00537 parent.close();
00538 }
00539 } else {
00540 alert("Error - reference to main window is not set properly!");
00541 parent.close();
00542 }
00543 }
00544 ';
00545
00546
00547 $this->doc->JScode = $this->doc->wrapScriptTags($JScode);
00548
00549
00550 if (FALSE) debug(array(
00551 'pointer' => $this->pointer,
00552 'act' => $this->act,
00553 'mode' => $this->mode,
00554 'curUrlInfo' => $this->curUrlInfo,
00555 'curUrlArray' => $this->curUrlArray,
00556 'P' => $this->P,
00557 'bparams' => $this->bparams,
00558 'RTEtsConfigParams' => $this->RTEtsConfigParams,
00559 'expandPage' => $this->expandPage,
00560 'expandFolder' => $this->expandFolder,
00561 'PM' => $this->PM,
00562 ),'Internal variables of Script Class:');
00563 }
00564
00565
00566
00567
00568
00569
00578 function main_rte($wiz=0) {
00579 global $LANG, $BE_USER, $BACK_PATH;
00580
00581
00582 $content=$this->doc->startPage($LANG->getLL('Insert/Modify Link',1));
00583
00584
00585 $allowedItems = explode(',','page,file,url,mail,spec');
00586 if (is_array($this->buttonConfig['options.']) && $this->buttonConfig['options.']['removeItems']) {
00587 $allowedItems = array_diff($allowedItems,t3lib_div::trimExplode(',',$this->buttonConfig['options.']['removeItems'],1));
00588 } else {
00589 $allowedItems = array_diff($allowedItems,t3lib_div::trimExplode(',',$this->thisConfig['blindLinkOptions'],1));
00590 }
00591 reset($allowedItems);
00592 if (!in_array($this->act,$allowedItems)) {
00593 $this->act = current($allowedItems);
00594 }
00595
00596
00597 $menuDef = array();
00598 if (!$wiz) {
00599 $menuDef['removeLink']['isActive'] = $this->act=='removeLink';
00600 $menuDef['removeLink']['label'] = $LANG->getLL('removeLink',1);
00601 $menuDef['removeLink']['url'] = '#';
00602 $menuDef['removeLink']['addParams'] = 'onclick="editor.renderPopup_unLink();return false;"';
00603 }
00604 if (in_array('page',$allowedItems)) {
00605 $menuDef['page']['isActive'] = $this->act=='page';
00606 $menuDef['page']['label'] = $LANG->getLL('page',1);
00607 $menuDef['page']['url'] = '#';
00608 $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page&editorNo='.$this->editorNo.'&contentTypo3Language='.$this->contentTypo3Language.'&contentTypo3Charset='.$this->contentTypo3Charset.'\');return false;"';
00609 }
00610 if (in_array('file',$allowedItems)){
00611 $menuDef['file']['isActive'] = $this->act=='file';
00612 $menuDef['file']['label'] = $LANG->getLL('file',1);
00613 $menuDef['file']['url'] = '#';
00614 $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file&editorNo='.$this->editorNo.'&contentTypo3Language='.$this->contentTypo3Language.'&contentTypo3Charset='.$this->contentTypo3Charset.'\');return false;"';
00615 }
00616 if (in_array('url',$allowedItems)) {
00617 $menuDef['url']['isActive'] = $this->act=='url';
00618 $menuDef['url']['label'] = $LANG->getLL('extUrl',1);
00619 $menuDef['url']['url'] = '#';
00620 $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url&editorNo='.$this->editorNo.'&contentTypo3Language='.$this->contentTypo3Language.'&contentTypo3Charset='.$this->contentTypo3Charset.'\');return false;"';
00621 }
00622 if (in_array('mail',$allowedItems)) {
00623 $menuDef['mail']['isActive'] = $this->act=='mail';
00624 $menuDef['mail']['label'] = $LANG->getLL('email',1);
00625 $menuDef['mail']['url'] = '#';
00626 $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail&editorNo='.$this->editorNo.'&contentTypo3Language='.$this->contentTypo3Language.'&contentTypo3Charset='.$this->contentTypo3Charset.'\');return false;"';
00627 }
00628 if (is_array($this->thisConfig['userLinks.']) && in_array('spec',$allowedItems)) {
00629 $menuDef['spec']['isActive'] = $this->act=='spec';
00630 $menuDef['spec']['label'] = $LANG->getLL('special',1);
00631 $menuDef['spec']['url'] = '#';
00632 $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec&editorNo='.$this->editorNo.'&contentTypo3Language='.$this->contentTypo3Language.'&contentTypo3Charset='.$this->contentTypo3Charset.'\');return false;"';
00633 }
00634 $content .= $this->doc->getTabMenuRaw($menuDef);
00635
00636
00637 $content.=$this->printCurrentUrl($this->curUrlInfo['info']).'<br />';
00638
00639
00640 switch($this->act) {
00641 case 'mail':
00642 $extUrl='
00643 <!--
00644 Enter mail address:
00645 -->
00646 <form action="" name="lurlform" id="lurlform">
00647 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail">
00648 <tr>
00649 <td>'.$LANG->getLL('emailAddress',1).':</td>
00650 <td><input type="text" name="lemail"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='mail'?$this->curUrlInfo['info']:'').'" /> '.
00651 '<input type="submit" value="'.$LANG->getLL('setLink',1).'" onclick="setTarget(\'\');setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td>
00652 </tr>
00653 </table>
00654 </form>';
00655 $content.=$extUrl;
00656 $content.=$this->addAttributesForm();
00657 break;
00658 case 'url':
00659 $extUrl='
00660 <!--
00661 Enter External URL:
00662 -->
00663 <form action="" name="lurlform" id="lurlform">
00664 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL">
00665 <tr>
00666 <td>URL:</td>
00667 <td><input type="text" name="lurl"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='url'?$this->curUrlInfo['info']:'http://').'" /> '.
00668 '<input type="submit" value="'.$LANG->getLL('setLink',1).'" onclick="setValue(document.lurlform.lurl.value); return link_current();" /></td>
00669 </tr>
00670 </table>
00671 </form>';
00672 $content.=$extUrl;
00673 $content.=$this->addAttributesForm();
00674 break;
00675 case 'file':
00676 $content.=$this->addAttributesForm();
00677
00678 $foldertree = t3lib_div::makeInstance('tx_rtehtmlarea_folderTree');
00679 $tree=$foldertree->getBrowsableTree();
00680
00681 if (!$this->curUrlInfo['value'] || $this->curUrlInfo['act']!='file') {
00682 $cmpPath='';
00683 } elseif (substr(trim($this->curUrlInfo['info']),-1)!='/') {
00684 $cmpPath=PATH_site.dirname($this->curUrlInfo['info']).'/';
00685 if (!isset($this->expandFolder)) $this->expandFolder = $cmpPath;
00686 } else {
00687 $cmpPath=PATH_site.$this->curUrlInfo['info'];
00688 }
00689
00690 list(,,$specUid) = explode('_',$this->PM);
00691 $files = $this->expandFolder($foldertree->specUIDmap[$specUid]);
00692
00693
00694 if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
00695 $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
00696 $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
00697 $path=$this->expandFolder;
00698 if (!$path || !@is_dir($path)) {
00699 $path = $fileProcessor->findTempFolder().'/';
00700 }
00701 if ($path!='/' && @is_dir($path)) {
00702 $uploadForm=$this->uploadForm($path);
00703 $createFolder=$this->createFolder($path);
00704 } else {
00705 $createFolder='';
00706 $uploadForm='';
00707 }
00708 $content.=$uploadForm;
00709 if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB')) {
00710 $content.=$createFolder;
00711 }
00712 }
00713
00714 $content.= '
00715 <!--
00716 Wrapper table for folder tree / file list:
00717 -->
00718 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkFiles">
00719 <tr>
00720 <td class="c-wCell" valign="top">'.$this->barheader($LANG->getLL('folderTree').':').$tree.'</td>
00721 <td class="c-wCell" valign="top">'.$files.'</td>
00722 </tr>
00723 </table>
00724 ';
00725 break;
00726 case 'spec':
00727 if (is_array($this->thisConfig['userLinks.'])) {
00728 $subcats=array();
00729 $v=$this->thisConfig['userLinks.'];
00730 reset($v);
00731 while(list($k2)=each($v)) {
00732 $k2i = intval($k2);
00733 if (substr($k2,-1)=='.' && is_array($v[$k2i.'.'])) {
00734
00735
00736 $title = trim($v[$k2i]);
00737 if (!$title) {
00738 $title=$v[$k2i.'.']['url'];
00739 } else {
00740 $title=$LANG->sL($title);
00741 }
00742
00743 $description=$v[$k2i.'.']['description'] ? $LANG->sL($v[$k2i.'.']['description'],1).'<br />' : '';
00744
00745
00746 $onClickEvent='';
00747 if (isset($v[$k2i.'.']['target'])) $onClickEvent.="setTarget('".$v[$k2i.'.']['target']."');";
00748 $v[$k2i.'.']['url'] = str_replace('###_URL###',$this->siteURL,$v[$k2i.'.']['url']);
00749 if (substr($v[$k2i.'.']['url'],0,7)=="http://" || substr($v[$k2i.'.']['url'],0,7)=='mailto:') {
00750 $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();";
00751 } else {
00752 $onClickEvent.="link_spec(unescape('".$this->siteURL.rawurlencode($v[$k2i.'.']['url'])."'));";
00753 }
00754
00755
00756 $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>');
00757
00758
00759 $subcats[$k2i]='
00760 <tr>
00761 <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>
00762 </tr>';
00763 }
00764 }
00765
00766
00767 ksort($subcats);
00768
00769
00770 $content.= '
00771 <!--
00772 Special userdefined menu:
00773 -->
00774 <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
00775 <tr>
00776 <td class="bgColor5" class="c-wCell" valign="top"><strong>'.$LANG->getLL('special',1).'</strong></td>
00777 </tr>
00778 '.implode('',$subcats).'
00779 </table>
00780 ';
00781 }
00782 break;
00783 case 'page':
00784 default:
00785 $content.=$this->addAttributesForm();
00786
00787 $pagetree = t3lib_div::makeInstance('tx_rtehtmlarea_pageTree');
00788 $tree=$pagetree->getBrowsableTree();
00789 $cElements = $this->expandPage();
00790 $content.= '
00791 <!--
00792 Wrapper table for page tree / record list:
00793 -->
00794 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages">
00795 <tr>
00796 <td class="c-wCell" valign="top">'.$this->barheader($LANG->getLL('pageTree').':').$tree.'</td>
00797 <td class="c-wCell" valign="top">'.$cElements.'</td>
00798 </tr>
00799 </table>
00800 ';
00801 break;
00802 }
00803
00804
00805 $content.= $this->doc->endPage();
00806 return $content;
00807 }
00808
00809 function addAttributesForm() {
00810 $ltargetForm = '';
00811
00812 $ltarget = $this->addTargetSelector();
00813 $lclass = $this->addClassSelector();
00814 $ltitle = $this->addTitleSelector();
00815 if ($ltarget || $lclass || $ltitle) {
00816 $ltargetForm = $this->wrapInForm($ltarget.$lclass.$ltitle);
00817 }
00818 return $ltargetForm;
00819 }
00820
00821 function wrapInForm($string) {
00822 global $LANG;
00823
00824 $form = '
00825 <!--
00826 Selecting target for link:
00827 -->
00828 <form action="" name="ltargetform" id="ltargetform">
00829 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">'. $string;
00830 if ((($this->act == 'page' && $this->curUrlInfo['act']=='page') || ($this->act == 'file' && $this->curUrlInfo['act']=='file') || ($this->act == 'url' && $this->curUrlInfo['act']!='page')) && $this->curUrlArray['href']) {
00831 $form .='
00832 <tr>
00833 <td>
00834 </td>
00835 <td colspan="3">
00836 <input type="submit" value="'.$LANG->getLL('update',1).'" onclick="return link_current();" />
00837 </td>
00838 </tr>';
00839 }
00840 $form .= '
00841 </table>
00842 </form>';
00843 return $form;
00844 }
00845
00846 function addTargetSelector() {
00847 global $LANG;
00848
00849 $targetSelectorConfig = array();
00850 $popupSelectorConfig = array();
00851 if (is_array($this->buttonConfig['targetSelector.'])) {
00852 $targetSelectorConfig = $this->buttonConfig['targetSelector.'];
00853 }
00854 if (is_array($this->buttonConfig['popupSelector.'])) {
00855 $popupSelectorConfig = $this->buttonConfig['popupSelector.'];
00856 }
00857
00858 $ltarget = '';
00859 if ($this->act != 'mail') {
00860 if (!($targetSelectorConfig['disabled'] && $popupSelectorConfig['disabled'])) {
00861 $ltarget .= '
00862 <tr>
00863 <td>'.$LANG->getLL('target',1).':</td>
00864 <td><input type="text" name="ltarget" onchange="setTarget(this.value);" value="'.htmlspecialchars($this->setTarget).'"'.$this->doc->formWidth(10).' /></td>';
00865 $ltarget .= '
00866 <td colspan="2">';
00867 if (!$targetSelectorConfig['disabled']) {
00868 $ltarget .= '
00869 <select name="ltarget_type" onchange="setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
00870 <option></option>
00871 <option value="_top">'.$LANG->getLL('top',1).'</option>
00872 <option value="_blank">'.$LANG->getLL('newWindow',1).'</option>
00873 </select>';
00874 }
00875 $ltarget .= '
00876 </td>';
00877 }
00878
00879 $ltarget .= '
00880 </tr>';
00881 if (!$popupSelectorConfig['disabled']) {
00882
00883 $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) {
00884 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;
00885 setTarget(document.ltargetform.ltarget.value);
00886 document.ltargetform.popup_width.selectedIndex=0;
00887 document.ltargetform.popup_height.selectedIndex=0;
00888 }';
00889
00890 $ltarget.='
00891 <tr>
00892 <td>'.$LANG->getLL('target_popUpWindow',1).':</td>
00893 <td colspan="3">
00894 <select name="popup_width" onchange="'.$selectJS.'">
00895 <option value="0">'.$LANG->getLL('target_popUpWindow_width',1).'</option>
00896 <option value="300">300</option>
00897 <option value="400">400</option>
00898 <option value="500">500</option>
00899 <option value="600">600</option>
00900 <option value="700">700</option>
00901 <option value="800">800</option>
00902 </select>
00903 x
00904 <select name="popup_height" onchange="'.$selectJS.'">
00905 <option value="0">'.$LANG->getLL('target_popUpWindow_height',1).'</option>
00906 <option value="200">200</option>
00907 <option value="300">300</option>
00908 <option value="400">400</option>
00909 <option value="500">500</option>
00910 <option value="600">600</option>
00911 </select>
00912 </td>
00913 </tr>';
00914 }
00915 }
00916 return $ltarget;
00917 }
00918
00919 function addClassSelector() {
00920 global $LANG;
00921
00922 $selectClass = '';
00923 if ($this->classesAnchorJSOptions[$this->act]) {
00924 $selectClassJS = '
00925 document.ltargetform.anchor_class.value = document.ltargetform.anchor_class.options[document.ltargetform.anchor_class.selectedIndex].value;
00926 if(document.ltargetform.anchor_class.value && editor.classesAnchorSetup) {
00927 for (var i = editor.classesAnchorSetup.length; --i >= 0;) {
00928 var anchorClass = editor.classesAnchorSetup[i];
00929 if (anchorClass[\'name\'] == document.ltargetform.anchor_class.value) {
00930 if(anchorClass[\'titleText\'] && document.ltargetform.anchor_title) document.ltargetform.anchor_title.value = anchorClass[\'titleText\'];
00931 break;
00932 }
00933 }
00934 }
00935 setClass(document.ltargetform.anchor_class.value);
00936 ';
00937 $selectClass ='
00938 <tr>
00939 <td>'.$LANG->getLL('anchor_class',1).':</td>
00940 <td colspan="3">
00941 <select name="anchor_class" onchange="'.$selectClassJS.'">
00942 ' . $this->classesAnchorJSOptions[$this->act] . '
00943 </select>
00944 </td>
00945 </tr>';
00946 }
00947 return $selectClass;
00948 }
00949
00950 function addTitleSelector() {
00951 global $LANG;
00952
00953 return '
00954 <tr>
00955 <td>'.$LANG->getLL('anchor_title',1).':</td>
00956 <td colspan="3">
00957 <input type="text" name="anchor_title" value="' . ($this->setTitle?$this->setTitle:($this->thisConfig['classesAnchor']?$this->classesAnchorDefaultTitle[$this->act]:'')) . '" ' . $this->doc->formWidth(30) . ' />
00958 </td>
00959 </tr>';
00960 }
00961
00969 function uploadForm($path) {
00970 global $BACK_PATH;
00971 $count=3;
00972
00973
00974 $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
00975 $code=$this->barheader($GLOBALS['LANG']->getLL('uploadImage').':');
00976 $code.='
00977
00978 <!--
00979 Form, for uploading files:
00980 -->
00981 <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">
00982 <table border="0" cellpadding="0" cellspacing="3" id="typo3-uplFiles">
00983 <tr>
00984 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
00985 </tr>
00986 <tr>
00987 <td>';
00988
00989
00990 for ($a=1;$a<=$count;$a++) {
00991 $code.='<input type="file" name="upload_'.$a.'"'.$this->doc->formWidth(35).' size="50" />
00992 <input type="hidden" name="file[upload]['.$a.'][target]" value="'.htmlspecialchars($path).'" />
00993 <input type="hidden" name="file[upload]['.$a.'][data]" value="'.$a.'" /><br />';
00994 }
00995
00996
00997 $redirectValue = $this->thisScript.'?act='.$this->act.'&editorNo='.$this->editorNo.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
00998 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
00999 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />';
01000
01001 $code.='
01002 <div id="c-override">
01003 <input type="checkbox" name="overwriteExistingFiles" value="1" /> '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:overwriteExistingFiles',1).'
01004 </div>
01005 ';
01006
01007
01008 $code.='</td>
01009 </tr>
01010 </table>
01011 </form>';
01012
01013 return $code;
01014 }
01015
01023 function createFolder($path) {
01024 global $BACK_PATH;
01025
01026 $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
01027 $code=$this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle').':');
01028 $code.='
01029
01030 <!--
01031 Form, for creating new folders:
01032 -->
01033 <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform2">
01034 <table border="0" cellpadding="0" cellspacing="3" id="typo3-crFolder">
01035 <tr>
01036 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
01037 </tr>
01038 <tr>
01039 <td>';
01040
01041
01042 $a=1;
01043 $code.='<input'.$this->doc->formWidth(20).' type="text" name="file[newfolder]['.$a.'][data]" />'.
01044 '<input type="hidden" name="file[newfolder]['.$a.'][target]" value="'.htmlspecialchars($path).'" />';
01045
01046
01047 $redirectValue = $this->thisScript.'?act='.$this->act.'&editorNo='.$this->editorNo.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
01048 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
01049 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.submit',1).'" />';
01050
01051 $code.='</td>
01052 </tr>
01053 </table>
01054 </form>';
01055
01056 return $code;
01057 }
01058
01059 }
01060
01061 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php']) {
01062 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod3/class.tx_rtehtmlarea_browse_links.php']);
01063 }
01064
01065 ?>