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
00118 require_once (PATH_t3lib.'class.t3lib_browsetree.php');
00119 require_once (PATH_t3lib.'class.t3lib_foldertree.php');
00120 require_once (PATH_t3lib.'class.t3lib_stdgraphic.php');
00121 require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
00122
00123
00124
00125 require_once (PATH_t3lib.'class.t3lib_page.php');
00126 require_once (PATH_t3lib.'class.t3lib_recordlist.php');
00127 require_once (PATH_typo3.'/class.db_list.inc');
00128 require_once (PATH_typo3.'/class.db_list_extra.inc');
00129 require_once (PATH_t3lib.'/class.t3lib_pagetree.php');
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00156 class TBE_browser_recordList extends localRecordList {
00157 var $thisScript = 'browse_links.php';
00158
00164 function TBE_browser_recordList () {
00165 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
00166 }
00167
00176 function listURL($altId='',$table=-1,$exclList='') {
00177 return $this->thisScript.
00178 '?id='.(strcmp($altId,'')?$altId:$this->id).
00179 '&table='.rawurlencode($table==-1?$this->table:$table).
00180 ($this->thumbs?'&imagemode='.$this->thumbs:'').
00181 ($this->searchString?'&search_field='.rawurlencode($this->searchString):'').
00182 ($this->searchLevels?'&search_levels='.rawurlencode($this->searchLevels):'').
00183 ((!$exclList || !t3lib_div::inList($exclList,'sortField')) && $this->sortField?'&sortField='.rawurlencode($this->sortField):'').
00184 ((!$exclList || !t3lib_div::inList($exclList,'sortRev')) && $this->sortRev?'&sortRev='.rawurlencode($this->sortRev):'').
00185
00186 $this->ext_addP()
00187 ;
00188 }
00189
00195 function ext_addP() {
00196 $str = '&act='.$GLOBALS['SOBE']->browser->act.
00197 '&mode='.$GLOBALS['SOBE']->browser->mode.
00198 '&expandPage='.$GLOBALS['SOBE']->browser->expandPage.
00199 '&bparams='.rawurlencode($GLOBALS['SOBE']->browser->bparams);
00200 return $str;
00201 }
00202
00212 function linkWrapItems($table,$uid,$code,$row) {
00213 global $TCA, $BACK_PATH;
00214
00215 if (!$code) {
00216 $code = '<i>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</i>';
00217 } else {
00218 $code = htmlspecialchars(t3lib_div::fixed_lgd_cs($code,$this->fixedL));
00219 }
00220
00221 $title = t3lib_BEfunc::getRecordTitle($table,$row,FALSE,TRUE);
00222 $ficon = t3lib_iconWorks::getIcon($table,$row);
00223 $aOnClick = "return insertElement('".$table."', '".$row['uid']."', 'db', ".t3lib_div::quoteJSvalue($title).", '', '', '".$ficon."');";
00224 $ATag = '<a href="#" onclick="'.$aOnClick.'">';
00225 $ATag_alt = substr($ATag,0,-4).',\'\',1);">';
00226 $ATag_e = '</a>';
00227
00228 return $ATag.
00229 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('addToList',1).'" alt="" />'.
00230 $ATag_e.
00231 $ATag_alt.
00232 $code.
00233 $ATag_e;
00234 }
00235
00243 function linkWrapTable($table,$code) {
00244 return $code;
00245 }
00246 }
00247
00248
00249
00250
00251
00252
00260 class localPageTree extends t3lib_browseTree {
00261
00267 function localPageTree() {
00268 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
00269
00270 $this->init();
00271
00272 $this->clause = ' AND doktype!=255'.$this->clause;
00273 }
00274
00283 function wrapTitle($title,$v,$ext_pArrPages='') {
00284 if ($this->ext_isLinkable($v['doktype'],$v['uid'])) {
00285 $aOnClick = "return link_typo3Page('".$v['uid']."');";
00286 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00287 } else {
00288 return '<span style="color: #666666;">'.$title.'</span>';
00289 }
00290 }
00291
00298 function printTree($treeArr='') {
00299 global $BACK_PATH;
00300 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
00301 if (!is_array($treeArr)) $treeArr=$this->tree;
00302
00303 $out='';
00304 $c=0;
00305
00306 foreach($treeArr as $k => $v) {
00307 $c++;
00308 $bgColorClass = ($c+1)%2 ? 'bgColor' : 'bgColor-10';
00309 if ($GLOBALS['SOBE']->browser->curUrlInfo['act']=='page' && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']==$v['row']['uid'] && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']) {
00310 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
00311 $bgColorClass='bgColor4';
00312 } else {
00313 $arrCol='<td></td>';
00314 }
00315
00316 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandPage='.$v['row']['uid'].'\');';
00317 $cEbullet = $this->ext_isLinkable($v['row']['doktype'],$v['row']['uid']) ?
00318 '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' :
00319 '';
00320 $out.='
00321 <tr class="'.$bgColorClass.'">
00322 <td nowrap="nowrap"'.($v['row']['_CSSCLASS'] ? ' class="'.$v['row']['_CSSCLASS'].'"' : '').'>'.
00323 $v['HTML'].
00324 $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$this->ext_pArrPages).
00325 '</td>'.
00326 $arrCol.
00327 '<td>'.$cEbullet.'</td>
00328 </tr>';
00329 }
00330 $out='
00331
00332
00333 <!--
00334 Navigation Page Tree:
00335 -->
00336 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
00337 '.$out.'
00338 </table>';
00339 return $out;
00340 }
00341
00349 function ext_isLinkable($doktype,$uid) {
00350 if ($uid && $doktype<199) {
00351 return true;
00352 }
00353 }
00354
00363 function PM_ATagWrap($icon,$cmd,$bMark='') {
00364 if ($bMark) {
00365 $anchor = '#'.$bMark;
00366 $name=' name="'.$bMark.'"';
00367 }
00368 $aOnClick = "return jumpToUrl('".$this->thisScript.'?PM='.$cmd."','".$anchor."');";
00369
00370 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
00371 }
00372
00380 function wrapIcon($icon,$row) {
00381 return $this->addTagAttributes($icon,' title="id='.$row['uid'].'"');
00382 }
00383 }
00384
00385
00386
00387
00388
00389
00390
00391
00399 class rtePageTree extends localPageTree {
00400 }
00401
00402
00403
00404
00405
00406
00407
00408
00416 class TBE_PageTree extends localPageTree {
00417
00425 function ext_isLinkable($doktype,$uid) {
00426 return true;
00427 }
00428
00437 function wrapTitle($title,$v,$ext_pArrPages) {
00438 if ($ext_pArrPages) {
00439 $ficon=t3lib_iconWorks::getIcon('pages',$v);
00440 $onClick = "return insertElement('pages', '".$v['uid']."', 'db', ".t3lib_div::quoteJSvalue($v['title']).", '', '', '".$ficon."','',1);";
00441 } else {
00442 $onClick = htmlspecialchars('return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandPage='.$v['uid'].'\');');
00443 }
00444 return '<a href="#" onclick="'.$onClick.'">'.$title.'</a>';
00445 }
00446 }
00447
00448
00449
00450
00451
00452
00453
00454
00463 class localFolderTree extends t3lib_folderTree {
00464 var $ext_IconMode=1;
00465
00466
00472 function localFolderTree() {
00473 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
00474 $this->t3lib_folderTree();
00475 }
00476
00484 function wrapTitle($title,$v) {
00485 if ($this->ext_isLinkable($v)) {
00486 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandFolder='.rawurlencode($v['path']).'\');';
00487 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00488 } else {
00489 return '<span class="typo3-dimmed">'.$title.'</span>';
00490 }
00491 }
00492
00499 function ext_isLinkable($v) {
00500 $webpath=t3lib_BEfunc::getPathType_web_nonweb($v['path']);
00501 if (strstr($v['path'],'_recycler_') || strstr($v['path'],'_temp_') || $webpath!='web') {
00502 return 0;
00503 }
00504 return 1;
00505 }
00506
00516 function PM_ATagWrap($icon,$cmd,$bMark='') {
00517 if ($bMark) {
00518 $anchor = '#'.$bMark;
00519 $name=' name="'.$bMark.'"';
00520 }
00521 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?PM='.$cmd.'\',\''.$anchor.'\');';
00522 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
00523 }
00524
00531 function printTree($treeArr='') {
00532 global $BACK_PATH;
00533 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
00534
00535 if (!is_array($treeArr)) $treeArr=$this->tree;
00536
00537 $out='';
00538 $c=0;
00539
00540
00541 if (!$GLOBALS['SOBE']->browser->curUrlInfo['value']) {
00542 $cmpPath='';
00543 } else if (substr(trim($GLOBALS['SOBE']->browser->curUrlInfo['info']),-1)!='/') {
00544 $cmpPath=PATH_site.dirname($GLOBALS['SOBE']->browser->curUrlInfo['info']).'/';
00545 } else {
00546 $cmpPath=PATH_site.$GLOBALS['SOBE']->browser->curUrlInfo['info'];
00547 }
00548
00549
00550 foreach($treeArr as $k => $v) {
00551 $c++;
00552 $bgColorClass=($c+1)%2 ? 'bgColor' : 'bgColor-10';
00553
00554
00555 if ($GLOBALS['SOBE']->browser->curUrlInfo['act']=='file' && $cmpPath==$v['row']['path']) {
00556 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
00557 $bgColorClass='bgColor4';
00558 } else {
00559 $arrCol='<td></td>';
00560 }
00561
00562 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandFolder='.rawurlencode($v['row']['path']).'\');';
00563 $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>' : '';
00564
00565
00566 $out.='
00567 <tr class="'.$bgColorClass.'">
00568 <td nowrap="nowrap">'.$v['HTML'].$this->wrapTitle(t3lib_div::fixed_lgd_cs($v['row']['title'],$titleLen),$v['row']).'</td>
00569 '.$arrCol.'
00570 <td>'.$cEbullet.'</td>
00571 </tr>';
00572 }
00573
00574 $out='
00575
00576 <!--
00577 Folder tree:
00578 -->
00579 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
00580 '.$out.'
00581 </table>';
00582 return $out;
00583 }
00584 }
00585
00586
00587
00588
00589
00590
00598 class rteFolderTree extends localFolderTree {
00599 }
00600
00601
00602
00603
00604
00605
00606
00614 class TBE_FolderTree extends localFolderTree {
00615 var $ext_noTempRecyclerDirs=0;
00616
00623 function ext_isLinkable($v) {
00624 if ($this->ext_noTempRecyclerDirs && (substr($v['path'],-7)=='_temp_/' || substr($v['path'],-11)=='_recycler_/')) {
00625 return 0;
00626 } return 1;
00627 }
00628
00636 function wrapTitle($title,$v) {
00637 if ($this->ext_isLinkable($v)) {
00638 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandFolder='.rawurlencode($v['path']).'\');';
00639 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00640 } else {
00641 return '<span class="typo3-dimmed">'.$title.'</span>';
00642 }
00643 }
00644 }
00645
00646
00647
00648
00649
00657 class browse_links {
00658
00659
00660 var $siteURL;
00661 var $thisScript;
00662 var $thisConfig;
00663 var $setTarget;
00664 var $setTitle;
00665 var $doc;
00666
00667
00678 var $mode;
00679
00685 var $act;
00686
00690 var $expandPage;
00691
00695 var $expandFolder;
00696
00697
00698
00702 var $P;
00703
00722 var $bparams;
00723
00728 var $RTEtsConfigParams;
00729
00730
00731
00732
00736 var $PM;
00737
00741 var $pointer;
00742
00743
00744
00745
00749 var $curUrlArray;
00750
00754 var $curUrlInfo;
00755
00756
00757
00758
00759
00760
00767 function init() {
00768 global $BE_USER,$BACK_PATH;
00769
00770
00771 $this->pointer = t3lib_div::_GP('pointer');
00772 $this->bparams = t3lib_div::_GP('bparams');
00773 $this->P = t3lib_div::_GP('P');
00774 $this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
00775 $this->expandPage = t3lib_div::_GP('expandPage');
00776 $this->expandFolder = t3lib_div::_GP('expandFolder');
00777 $this->PM = t3lib_div::_GP('PM');
00778
00779
00780 $this->mode=t3lib_div::_GP('mode');
00781 if (!$this->mode) {
00782 $this->mode='rte';
00783 }
00784
00785
00786 $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');
00787
00788
00789 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
00790
00791
00792 if ($this->mode=='wizard') {
00793 $currentLinkParts = t3lib_div::trimExplode(' ',$this->P['currentValue']);
00794 $this->curUrlArray = array(
00795 'target' => $currentLinkParts[1]
00796 );
00797 $this->curUrlInfo=$this->parseCurUrl($this->siteURL.'?id='.$currentLinkParts[0],$this->siteURL);
00798 } else {
00799 $this->curUrlArray = t3lib_div::_GP('curUrl');
00800 if ($this->curUrlArray['all']) {
00801 $this->curUrlArray=t3lib_div::get_tag_attributes($this->curUrlArray['all']);
00802 }
00803 $this->curUrlInfo=$this->parseCurUrl($this->curUrlArray['href'],$this->siteURL);
00804 }
00805
00806
00807 $this->act=t3lib_div::_GP('act');
00808 if (!$this->act) {
00809 $this->act=$this->curUrlInfo['act'];
00810 }
00811
00812
00813 $addPassOnParams='';
00814 if ((string)$this->mode=='rte') {
00815 $RTEtsConfigParts = explode(':',$this->RTEtsConfigParams);
00816 $addPassOnParams.='&RTEtsConfigParams='.rawurlencode($this->RTEtsConfigParams);
00817 $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
00818 $this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
00819 }
00820
00821
00822 $this->setTarget = $this->curUrlArray['target'];
00823 if ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target'])) {
00824 $this->setTarget=$this->thisConfig['defaultLinkTarget'];
00825 }
00826
00827
00828 $this->setTitle = $this->curUrlArray['title'];
00829
00830
00831
00832
00833 $this->doc = t3lib_div::makeInstance('template');
00834 $this->doc->docType= 'xhtml_trans';
00835 $this->doc->backPath = $BACK_PATH;
00836
00837
00838 $JScode = '';
00839 $JScode.= '
00840
00841 var add_href="'.($this->curUrlArray['href']?'&curUrl[href]='.rawurlencode($this->curUrlArray['href']):'').'";
00842 var add_target="'.($this->setTarget?'&curUrl[target]='.rawurlencode($this->setTarget):'').'";
00843 var add_title="'.($this->setTitle?'&curUrl[title]='.rawurlencode($this->setTitle):'').'";
00844 var add_params="'.($this->bparams?'&bparams='.rawurlencode($this->bparams):'').'";
00845
00846 var cur_href="'.($this->curUrlArray['href']?$this->curUrlArray['href']:'').'";
00847 var cur_target="'.($this->setTarget?$this->setTarget:'').'";
00848 var cur_title="'.($this->setTitle?$this->setTitle:'').'";
00849
00850 function setTarget(target) {
00851 cur_target=target;
00852 add_target="&curUrl[target]="+escape(target);
00853 }
00854 function setTitle(title) {
00855 cur_title=title;
00856 add_title="&curUrl[title]="+escape(title);
00857 }
00858 function setValue(value) {
00859 cur_href=value;
00860 add_href="&curUrl[href]="+value;
00861 }
00862 ';
00863
00864
00865 if ($this->mode=='wizard') {
00866 unset($this->P['fieldChangeFunc']['alert']);
00867 reset($this->P['fieldChangeFunc']);
00868 $update='';
00869 while(list($k,$v)=each($this->P['fieldChangeFunc'])) {
00870 $update.= '
00871 window.opener.'.$v;
00872 }
00873
00874 $P2=array();
00875 $P2['itemName']=$this->P['itemName'];
00876 $P2['formName']=$this->P['formName'];
00877 $P2['fieldChangeFunc']=$this->P['fieldChangeFunc'];
00878 $addPassOnParams.=t3lib_div::implodeArrayForUrl('P',$P2);
00879
00880 $JScode.='
00881 function link_typo3Page(id,anchor) {
00882 updateValueInMainForm(id+(anchor?anchor:"")+" "+cur_target);
00883 close();
00884 return false;
00885 }
00886 function link_folder(folder) {
00887 updateValueInMainForm(folder+" "+cur_target);
00888 close();
00889 return false;
00890 }
00891 function link_current() {
00892 if (cur_href!="http://" && cur_href!="mailto:") {
00893 var setValue = cur_href+" "+cur_target+" "+cur_title;
00894 if (setValue.substr(0,7)=="http://") setValue = setValue.substr(7);
00895 if (setValue.substr(0,7)=="mailto:") setValue = setValue.substr(7);
00896 updateValueInMainForm(setValue);
00897 close();
00898 }
00899 return false;
00900 }
00901 function checkReference() {
00902 if (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"] ) {
00903 return window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"];
00904 } else {
00905 close();
00906 }
00907 }
00908 function updateValueInMainForm(input) {
00909 var field = checkReference();
00910 if (field) {
00911 field.value = input;
00912 '.$update.'
00913 }
00914 }
00915 ';
00916 } else {
00917 $JScode.='
00918 function link_typo3Page(id,anchor) {
00919 var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"");
00920 self.parent.parent.renderPopup_addLink(theLink,cur_target,cur_title);
00921 return false;
00922 }
00923 function link_folder(folder) {
00924 var theLink = \''.$this->siteURL.'\'+folder;
00925 self.parent.parent.renderPopup_addLink(theLink,cur_target,cur_title);
00926 return false;
00927 }
00928 function link_spec(theLink) {
00929 self.parent.parent.renderPopup_addLink(theLink,cur_target,cur_title);
00930 return false;
00931 }
00932 function link_current() {
00933 if (cur_href!="http://" && cur_href!="mailto:") {
00934 self.parent.parent.renderPopup_addLink(cur_href,cur_target,cur_title);
00935 }
00936 return false;
00937 }
00938 ';
00939 }
00940
00941
00942 $JScode.='
00943 function jumpToUrl(URL,anchor) {
00944 var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : "";
00945 var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$this->mode.'" : "";
00946 var theLocation = URL+add_act+add_mode+add_href+add_target+add_title+add_params'.($addPassOnParams?'+"'.$addPassOnParams.'"':'').'+(anchor?anchor:"");
00947 window.location.href = theLocation;
00948 return false;
00949 }
00950 ';
00951
00952
00957 $pArr = explode('|',$this->bparams);
00958
00959
00960 $formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';
00961
00962
00963 if ($pArr[4] && $pArr[5]) {
00964 $JScodeCheck = '
00965
00966 if (parent.window.opener) {
00967 var res = parent.window.opener.'.$pArr[5].'("'.addslashes($pArr[4]).'",table,uid,type);
00968 if (!res.passed) {
00969 if (res.message) alert(res.message);
00970 performAction = false;
00971 }
00972 } else {
00973 alert("Error - reference to main window is not set properly!");
00974 parent.close();
00975 }
00976 ';
00977 }
00978
00979 if ($pArr[4] && $pArr[6]) {
00980 $JScodeHelper = '
00981
00982 if (parent.window.opener) {
00983 parent.window.opener.'.$pArr[6].'("'.addslashes($pArr[4]).'",table,uid,type,"'.addslashes($pArr[0]).'");
00984 } else {
00985 alert("Error - reference to main window is not set properly!");
00986 parent.close();
00987 }
00988 ';
00989 }
00990
00991 if ($pArr[4] && $pArr[7]) {
00992
00993 $JScodeAction = '
00994 if (parent.window.opener) {
00995 parent.window.opener.'.$pArr[7].'("'.addslashes($pArr[4]).'",table,uid,type);
00996 focusOpenerAndClose(close);
00997 } else {
00998 alert("Error - reference to main window is not set properly!");
00999 parent.close();
01000 }
01001 ';
01002 } else if ($pArr[0] && !$pArr[1] && !$pArr[2]) {
01003 $JScodeAction = '
01004 addElement(filename,table+"_"+uid,fp,close);
01005 ';
01006 } else {
01007 $JScodeAction = '
01008 if (setReferences()) {
01009 parent.window.opener.group_change("add","'.$pArr[0].'","'.$pArr[1].'","'.$pArr[2].'",elRef,targetDoc);
01010 } else {
01011 alert("Error - reference to main window is not set properly!");
01012 }
01013 focusOpenerAndClose(close);
01014 ';
01015 }
01016
01017 $JScode.='
01018 var elRef="";
01019 var targetDoc="";
01020
01021 function launchView(url) {
01022 var thePreviewWindow="";
01023 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");
01024 if (thePreviewWindow && thePreviewWindow.focus) {
01025 thePreviewWindow.focus();
01026 }
01027 }
01028 function setReferences() {
01029 if (parent.window.opener
01030 && parent.window.opener.content
01031 && parent.window.opener.content.document.editform
01032 && parent.window.opener.content.document.editform["'.$formFieldName.'"]
01033 ) {
01034 targetDoc = parent.window.opener.content.document;
01035 elRef = targetDoc.editform["'.$formFieldName.'"];
01036 return true;
01037 } else {
01038 return false;
01039 }
01040 }
01041 function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close) {
01042 var performAction = true;
01043 '.$JScodeCheck.'
01044
01045 if (performAction) {
01046 '.$JScodeHelper.$JScodeAction.'
01047 }
01048 return false;
01049 }
01050 function addElement(elName,elValue,altElValue,close) {
01051 if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin) {
01052 parent.window.opener.setFormValueFromBrowseWin("'.$pArr[0].'",altElValue?altElValue:elValue,elName);
01053 focusOpenerAndClose(close);
01054 } else {
01055 alert("Error - reference to main window is not set properly!");
01056 parent.close();
01057 }
01058 }
01059 function focusOpenerAndClose(close) {
01060 if (close) {
01061 parent.window.opener.focus();
01062 parent.close();
01063 }
01064 }
01065 ';
01066
01067
01068 $this->doc->JScode = $this->doc->wrapScriptTags($JScode);
01069
01070
01071 if (FALSE) debug(array(
01072 'pointer' => $this->pointer,
01073 'act' => $this->act,
01074 'mode' => $this->mode,
01075 'curUrlInfo' => $this->curUrlInfo,
01076 'curUrlArray' => $this->curUrlArray,
01077 'P' => $this->P,
01078 'bparams' => $this->bparams,
01079 'RTEtsConfigParams' => $this->RTEtsConfigParams,
01080 'expandPage' => $this->expandPage,
01081 'expandFolder' => $this->expandFolder,
01082 'PM' => $this->PM,
01083 ),'Internal variables of Script Class:');
01084 }
01085
01086
01094 function processSessionData($data) {
01095 $store = false;
01096
01097 switch((string)$this->mode) {
01098 case 'db':
01099 if (isset($this->expandPage)) {
01100 $data['expandPage']=$this->expandPage;
01101 $store = true;
01102 } else {
01103 $this->expandPage=$data['expandPage'];
01104 }
01105 break;
01106 case 'file':
01107 case 'filedrag':
01108 if (isset($this->expandFolder)) {
01109 $data['expandFolder']=$this->expandFolder;
01110 $store = true;
01111 } else {
01112 $this->expandFolder=$data['expandFolder'];
01113 }
01114 break;
01115 }
01116
01117 return array($data, $store);
01118 }
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01137 function main_rte($wiz=0) {
01138 global $LANG, $BACK_PATH;
01139
01140
01141 $content=$this->doc->startPage('RTE link');
01142
01143
01144 $allowedItems = array_diff(explode(',','page,file,url,mail,spec'),t3lib_div::trimExplode(',',$this->thisConfig['blindLinkOptions'],1));
01145 reset($allowedItems);
01146 if (!in_array($this->act,$allowedItems)) $this->act = current($allowedItems);
01147
01148
01149 $menuDef = array();
01150 if (!$wiz) {
01151 $menuDef['removeLink']['isActive'] = $this->act=='removeLink';
01152 $menuDef['removeLink']['label'] = $LANG->getLL('removeLink',1);
01153 $menuDef['removeLink']['url'] = '#';
01154 $menuDef['removeLink']['addParams'] = 'onclick="self.parent.parent.renderPopup_unLink();return false;"';
01155 }
01156 if (in_array('page',$allowedItems)) {
01157 $menuDef['page']['isActive'] = $this->act=='page';
01158 $menuDef['page']['label'] = $LANG->getLL('page',1);
01159 $menuDef['page']['url'] = '#';
01160 $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page\');return false;"';
01161 }
01162 if (in_array('file',$allowedItems)){
01163 $menuDef['file']['isActive'] = $this->act=='file';
01164 $menuDef['file']['label'] = $LANG->getLL('file',1);
01165 $menuDef['file']['url'] = '#';
01166 $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file\');return false;"';
01167 }
01168 if (in_array('url',$allowedItems)) {
01169 $menuDef['url']['isActive'] = $this->act=='url';
01170 $menuDef['url']['label'] = $LANG->getLL('extUrl',1);
01171 $menuDef['url']['url'] = '#';
01172 $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url\');return false;"';
01173 }
01174 if (in_array('mail',$allowedItems)) {
01175 $menuDef['mail']['isActive'] = $this->act=='mail';
01176 $menuDef['mail']['label'] = $LANG->getLL('email',1);
01177 $menuDef['mail']['url'] = '#';
01178 $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail\');return false;"';
01179 }
01180 if (is_array($this->thisConfig['userLinks.']) && in_array('spec',$allowedItems)) {
01181 $menuDef['spec']['isActive'] = $this->act=='spec';
01182 $menuDef['spec']['label'] = $LANG->getLL('special',1);
01183 $menuDef['spec']['url'] = '#';
01184 $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec\');return false;"';
01185 }
01186 $content .= $this->doc->getTabMenuRaw($menuDef);
01187
01188
01189 $content.=$this->printCurrentUrl($this->curUrlInfo['info']).'<br />';
01190
01191
01192
01193 switch($this->act) {
01194 case 'mail':
01195 $extUrl='
01196
01197 <!--
01198 Enter mail address:
01199 -->
01200 <form action="" name="lurlform" id="lurlform">
01201 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail">
01202 <tr>
01203 <td>'.$GLOBALS['LANG']->getLL('emailAddress',1).':</td>
01204 <td><input type="text" name="lemail"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='mail'?$this->curUrlInfo['info']:'').'" /> '.
01205 '<input type="submit" value="'.$GLOBALS['LANG']->getLL('setLink',1).'" onclick="setTarget(\'\');setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td>
01206 </tr>
01207 </table>
01208 </form>';
01209 $content.=$extUrl;
01210 break;
01211 case 'url':
01212 $extUrl='
01213
01214 <!--
01215 Enter External URL:
01216 -->
01217 <form action="" name="lurlform" id="lurlform">
01218 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL">
01219 <tr>
01220 <td>URL:</td>
01221 <td><input type="text" name="lurl"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='url'?$this->curUrlInfo['info']:'http://').'" /> '.
01222 '<input type="submit" value="'.$GLOBALS['LANG']->getLL('setLink',1).'" onclick="setValue(document.lurlform.lurl.value); return link_current();" /></td>
01223 </tr>
01224 </table>
01225 </form>';
01226 $content.=$extUrl;
01227 break;
01228 case 'file':
01229 $foldertree = t3lib_div::makeInstance('rteFolderTree');
01230 $foldertree->thisScript = $this->thisScript;
01231 $tree=$foldertree->getBrowsableTree();
01232
01233 if (!$this->curUrlInfo['value'] || $this->curUrlInfo['act']!='file') {
01234 $cmpPath='';
01235 } elseif (substr(trim($this->curUrlInfo['info']),-1)!='/') {
01236 $cmpPath=PATH_site.dirname($this->curUrlInfo['info']).'/';
01237 if (!isset($this->expandFolder)) $this->expandFolder = $cmpPath;
01238 } else {
01239 $cmpPath=PATH_site.$this->curUrlInfo['info'];
01240 }
01241
01242 list(,,$specUid) = explode('_',$this->PM);
01243 $files = $this->expandFolder($foldertree->specUIDmap[$specUid]);
01244
01245 $content.= '
01246
01247 <!--
01248 Wrapper table for folder tree / file list:
01249 -->
01250 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkFiles">
01251 <tr>
01252 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
01253 <td class="c-wCell" valign="top">'.$files.'</td>
01254 </tr>
01255 </table>
01256 ';
01257 break;
01258 case 'spec':
01259 if (is_array($this->thisConfig['userLinks.'])) {
01260 $subcats=array();
01261 $v=$this->thisConfig['userLinks.'];
01262 reset($v);
01263 while(list($k2)=each($v)) {
01264 $k2i = intval($k2);
01265 if (substr($k2,-1)=='.' && is_array($v[$k2i.'.'])) {
01266
01267
01268 $title = trim($v[$k2i]);
01269 if (!$title) {
01270 $title=$v[$k2i.'.']['url'];
01271 } else {
01272 $title=$LANG->sL($title);
01273 }
01274
01275 $description=$v[$k2i.'.']['description'] ? $LANG->sL($v[$k2i.'.']['description'],1).'<br />' : '';
01276
01277
01278 $onClickEvent='';
01279 if (isset($v[$k2i.'.']['target'])) $onClickEvent.="setTarget('".$v[$k2i.'.']['target']."');";
01280 $v[$k2i.'.']['url'] = str_replace('###_URL###',$this->siteURL,$v[$k2i.'.']['url']);
01281 if (substr($v[$k2i.'.']['url'],0,7)=='http:
01282 $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();";
01283 } else {
01284 $onClickEvent.="link_spec(unescape('".$this->siteURL.rawurlencode($v[$k2i.'.']['url'])."'));";
01285 }
01286
01287
01288 $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>');
01289
01290
01291 $subcats[$k2i]='
01292 <tr>
01293 <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>
01294 </tr>';
01295 }
01296 }
01297
01298
01299 ksort($subcats);
01300
01301
01302 $content.= '
01303
01304 <!--
01305 Special userdefined menu:
01306 -->
01307 <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
01308 <tr>
01309 <td class="bgColor5" class="c-wCell" valign="top"><strong>'.$LANG->getLL('special',1).'</strong></td>
01310 </tr>
01311 '.implode('',$subcats).'
01312 </table>
01313 ';
01314 }
01315 break;
01316 case 'page':
01317 default:
01318 $pagetree = t3lib_div::makeInstance('rtePageTree');
01319 $pagetree->thisScript = $this->thisScript;
01320 $tree=$pagetree->getBrowsableTree();
01321 $cElements = $this->expandPage();
01322 $content.= '
01323
01324 <!--
01325 Wrapper table for page tree / record list:
01326 -->
01327 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages">
01328 <tr>
01329 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
01330 <td class="c-wCell" valign="top">'.$cElements.'</td>
01331 </tr>
01332 </table>
01333 ';
01334 break;
01335 }
01336
01337 $content .= '
01338
01339
01340
01341 <!--
01342 Selecting title for link:
01343 -->
01344 <form action="" name="ltitleform" id="ltargetform">
01345 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
01346 <tr>
01347 <td>'.$GLOBALS['LANG']->getLL('title',1).'</td>
01348 <td><input type="text" name="ltitle" onchange="setTitle(this.value);" value="'.htmlspecialchars($this->setTitle).'"'.$this->doc->formWidth(10).' /></td>
01349 <td><input type="submit" value="'.$GLOBALS['LANG']->getLL('update',1).'" onclick="return link_current();" /></td>
01350 </tr>
01351 </table>
01352 </form>
01353 ';
01354
01355
01356 if ($this->act!='mail') {
01357 $ltarget='
01358
01359
01360
01361 <!--
01362 Selecting target for link:
01363 -->
01364 <form action="" name="ltargetform" id="ltargetform">
01365 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
01366 <tr>
01367 <td>'.$GLOBALS['LANG']->getLL('target',1).':</td>
01368 <td><input type="text" name="ltarget" onchange="setTarget(this.value);" value="'.htmlspecialchars($this->setTarget).'"'.$this->doc->formWidth(10).' /></td>
01369 <td>
01370 <select name="ltarget_type" onchange="setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
01371 <option></option>
01372 <option value="_top">'.$GLOBALS['LANG']->getLL('top',1).'</option>
01373 <option value="_blank">'.$GLOBALS['LANG']->getLL('newWindow',1).'</option>
01374 </select>
01375 </td>
01376 <td>';
01377
01378 if (($this->curUrlInfo['act']=="page" || $this->curUrlInfo['act']=='file') && $this->curUrlArray['href']) {
01379 $ltarget.='
01380 <input type="submit" value="'.$GLOBALS['LANG']->getLL('update',1).'" onclick="return link_current();" />';
01381 }
01382
01383 $selectJS = '
01384 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) {
01385 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;
01386 setTarget(document.ltargetform.ltarget.value);
01387 setTitle(document.ltitleform.ltitle.value);
01388 document.ltargetform.popup_width.selectedIndex=0;
01389 document.ltargetform.popup_height.selectedIndex=0;
01390 }
01391 ';
01392
01393 $ltarget.=' </td>
01394 </tr>
01395 <tr>
01396 <td>'.$GLOBALS['LANG']->getLL('target_popUpWindow',1).':</td>
01397 <td colspan="3">
01398 <select name="popup_width" onchange="'.htmlspecialchars($selectJS).'">
01399 <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_width',1).'</option>
01400 <option value="300">300</option>
01401 <option value="400">400</option>
01402 <option value="500">500</option>
01403 <option value="600">600</option>
01404 <option value="700">700</option>
01405 <option value="800">800</option>
01406 </select>
01407 x
01408 <select name="popup_height" onchange="'.htmlspecialchars($selectJS).'">
01409 <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_height',1).'</option>
01410 <option value="200">200</option>
01411 <option value="300">300</option>
01412 <option value="400">400</option>
01413 <option value="500">500</option>
01414 <option value="600">600</option>
01415 </select>
01416 </td>
01417 </tr>
01418 </table>
01419 </form>';
01420
01421
01422 $content.=$ltarget;
01423
01424
01425 $content.='<br /><br />';
01426 }
01427
01428
01429 $content.= $this->doc->endPage();
01430 $content = $this->doc->insertStylesAndJS($content);
01431 return $content;
01432 }
01433
01439 function main_db() {
01440
01441
01442 $content=$this->doc->startPage('TBE record selector');
01443
01444
01445 $pArr = explode('|',$this->bparams);
01446
01447
01448 $pagetree = t3lib_div::makeInstance('TBE_PageTree');
01449 $pagetree->thisScript=$this->thisScript;
01450 $pagetree->ext_pArrPages = !strcmp($pArr[3],'pages')?1:0;
01451 $tree=$pagetree->getBrowsableTree();
01452
01453
01454 $cElements = $this->TBE_expandPage($pArr[3]);
01455
01456
01457 $content.= '
01458
01459 <!--
01460 Wrapper table for page tree / record list:
01461 -->
01462 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBrecords">
01463 <tr>
01464 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
01465 <td class="c-wCell" valign="top">'.$cElements.'</td>
01466 </tr>
01467 </table>
01468 ';
01469
01470
01471 $content.='<br /><br />';
01472
01473
<