"TYPO3 4.0.1: typo3_src-4.0.1/typo3/class.browse_links.php Source File", "datetime" => "Sat Dec 2 19:22:20 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?>

class.browse_links.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
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         // Include classes
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                                 // extra:
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                 $titleCol = $TCA[$table]['ctrl']['label'];
00222                 $title = $row[$titleCol];
00223 
00224                 $ficon = t3lib_iconWorks::getIcon($table,$row);
00225                 $aOnClick = "return insertElement('".$table."', '".$row['uid']."', 'db', ".t3lib_div::quoteJSvalue($title).", '', '', '".$ficon."');";
00226                 $ATag = '<a href="#" onclick="'.$aOnClick.'">';
00227                 $ATag_alt = substr($ATag,0,-4).',\'\',1);">';
00228                 $ATag_e = '</a>';
00229 
00230                 return $ATag.
00231                                 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('addToList',1).'" alt="" />'.
00232                                 $ATag_e.
00233                                 $ATag_alt.
00234                                 $code.
00235                                 $ATag_e;
00236         }
00237 
00245         function linkWrapTable($table,$code)    {
00246                 return $code;
00247         }
00248 }
00249 
00250 
00251 
00252 
00253 
00254 
00262 class localPageTree extends t3lib_browseTree {
00263 
00269         function localPageTree() {
00270                 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
00271 
00272                 $this->init();
00273 
00274                 $this->clause = ' AND doktype!=255'.$this->clause;
00275         }
00276 
00285         function wrapTitle($title,$v,$ext_pArrPages='') {
00286                 if ($this->ext_isLinkable($v['doktype'],$v['uid']))     {
00287                         $aOnClick = "return link_typo3Page('".$v['uid']."');";
00288                         return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00289                 } else {
00290                         return '<span style="color: #666666;">'.$title.'</span>';
00291                 }
00292         }
00293 
00300         function printTree($treeArr='') {
00301                 global $BACK_PATH;
00302                 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
00303                 if (!is_array($treeArr))        $treeArr=$this->tree;
00304 
00305                 $out='';
00306                 $c=0;
00307 
00308                 foreach($treeArr as $k => $v)   {
00309                         $c++;
00310                         $bgColorClass = ($c+1)%2 ? 'bgColor' : 'bgColor-10';
00311                         if ($GLOBALS['SOBE']->browser->curUrlInfo['act']=='page' && $GLOBALS['SOBE']->browser->curUrlInfo['pageid']==$v['row']['uid'] && $GLOBALS['SOBE']->browser->curUrlInfo['pageid'])       {
00312                                 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
00313                                 $bgColorClass='bgColor4';
00314                         } else {
00315                                 $arrCol='<td></td>';
00316                         }
00317 
00318                         $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandPage='.$v['row']['uid'].'\');';
00319                         $cEbullet = $this->ext_isLinkable($v['row']['doktype'],$v['row']['uid']) ?
00320                                                 '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' :
00321                                                 '';
00322                         $out.='
00323                                 <tr class="'.$bgColorClass.'">
00324                                         <td nowrap="nowrap"'.($v['row']['_CSSCLASS'] ? ' class="'.$v['row']['_CSSCLASS'].'"' : '').'>'.
00325                                         $v['HTML'].
00326                                         $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$this->ext_pArrPages).
00327                                         '</td>'.
00328                                         $arrCol.
00329                                         '<td>'.$cEbullet.'</td>
00330                                 </tr>';
00331                 }
00332                 $out='
00333 
00334 
00335                         <!--
00336                                 Navigation Page Tree:
00337                         -->
00338                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
00339                                 '.$out.'
00340                         </table>';
00341                 return $out;
00342         }
00343 
00351         function ext_isLinkable($doktype,$uid)  {
00352                 if ($uid && $doktype<199)       {
00353                         return true;
00354                 }
00355         }
00356 
00365         function PM_ATagWrap($icon,$cmd,$bMark='')      {
00366                 if ($bMark)     {
00367                         $anchor = '#'.$bMark;
00368                         $name=' name="'.$bMark.'"';
00369                 }
00370                 $aOnClick = "return jumpToUrl('".$this->thisScript.'?PM='.$cmd."','".$anchor."');";
00371 
00372                 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
00373         }
00374 
00382         function wrapIcon($icon,$row)   {
00383                 return $this->addTagAttributes($icon,' title="id='.$row['uid'].'"');
00384         }
00385 }
00386 
00387 
00388 
00389 
00390 
00391 
00392 
00393 
00401 class rtePageTree extends localPageTree {
00402 }
00403 
00404 
00405 
00406 
00407 
00408 
00409 
00410 
00418 class TBE_PageTree extends localPageTree {
00419 
00427         function ext_isLinkable($doktype,$uid)  {
00428                 return true;
00429         }
00430 
00439         function wrapTitle($title,$v,$ext_pArrPages)    {
00440                 if ($ext_pArrPages)     {
00441                         $ficon=t3lib_iconWorks::getIcon('pages',$v);
00442                         $onClick = "return insertElement('pages', '".$v['uid']."', 'db', ".t3lib_div::quoteJSvalue($v['title']).", '', '', '".$ficon."','',1);";
00443                 } else {
00444                         $onClick = htmlspecialchars('return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandPage='.$v['uid'].'\');');
00445                 }
00446                 return '<a href="#" onclick="'.$onClick.'">'.$title.'</a>';
00447         }
00448 }
00449 
00450 
00451 
00452 
00453 
00454 
00455 
00456 
00465 class localFolderTree extends t3lib_folderTree {
00466         var $ext_IconMode=1;
00467 
00468 
00474         function localFolderTree() {
00475                 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
00476                 $this->t3lib_folderTree();
00477         }
00478 
00486         function wrapTitle($title,$v)   {
00487                 if ($this->ext_isLinkable($v))  {
00488                         $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandFolder='.rawurlencode($v['path']).'\');';
00489                         return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00490                 } else {
00491                         return '<span class="typo3-dimmed">'.$title.'</span>';
00492                 }
00493         }
00494 
00501         function ext_isLinkable($v)     {
00502                 $webpath=t3lib_BEfunc::getPathType_web_nonweb($v['path']);      // Checking, if the input path is a web-path.
00503                 if (strstr($v['path'],'_recycler_') || strstr($v['path'],'_temp_') || $webpath!='web')  {
00504                         return 0;
00505                 }
00506                 return 1;
00507         }
00508 
00518         function PM_ATagWrap($icon,$cmd,$bMark='')      {
00519                 if ($bMark)     {
00520                         $anchor = '#'.$bMark;
00521                         $name=' name="'.$bMark.'"';
00522                 }
00523                 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?PM='.$cmd.'\',\''.$anchor.'\');';
00524                 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
00525         }
00526 
00533         function printTree($treeArr='') {
00534                 global $BACK_PATH;
00535                 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
00536 
00537                 if (!is_array($treeArr))        $treeArr=$this->tree;
00538 
00539                 $out='';
00540                 $c=0;
00541 
00542                         // Preparing the current-path string (if found in the listing we will see a red blinking arrow).
00543                 if (!$GLOBALS['SOBE']->browser->curUrlInfo['value'])    {
00544                         $cmpPath='';
00545                 } else if (substr(trim($GLOBALS['SOBE']->browser->curUrlInfo['info']),-1)!='/') {
00546                         $cmpPath=PATH_site.dirname($GLOBALS['SOBE']->browser->curUrlInfo['info']).'/';
00547                 } else {
00548                         $cmpPath=PATH_site.$GLOBALS['SOBE']->browser->curUrlInfo['info'];
00549                 }
00550 
00551                         // Traverse rows for the tree and print them into table rows:
00552                 foreach($treeArr as $k => $v)   {
00553                         $c++;
00554                         $bgColorClass=($c+1)%2 ? 'bgColor' : 'bgColor-10';
00555 
00556                                 // Creating blinking arrow, if applicable:
00557                         if ($GLOBALS['SOBE']->browser->curUrlInfo['act']=='file' && $cmpPath==$v['row']['path'])        {
00558                                 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
00559                                 $bgColorClass='bgColor4';
00560                         } else {
00561                                 $arrCol='<td></td>';
00562                         }
00563                                 // Create arrow-bullet for file listing (if folder path is linkable):
00564                         $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandFolder='.rawurlencode($v['row']['path']).'\');';
00565                         $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>' : '';
00566 
00567                                 // Put table row with folder together:
00568                         $out.='
00569                                 <tr class="'.$bgColorClass.'">
00570                                         <td nowrap="nowrap">'.$v['HTML'].$this->wrapTitle(t3lib_div::fixed_lgd_cs($v['row']['title'],$titleLen),$v['row']).'</td>
00571                                         '.$arrCol.'
00572                                         <td>'.$cEbullet.'</td>
00573                                 </tr>';
00574                 }
00575 
00576                 $out='
00577 
00578                         <!--
00579                                 Folder tree:
00580                         -->
00581                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
00582                                 '.$out.'
00583                         </table>';
00584                 return $out;
00585         }
00586 }
00587 
00588 
00589 
00590 
00591 
00592 
00600 class rteFolderTree extends localFolderTree {
00601 }
00602 
00603 
00604 
00605 
00606 
00607 
00608 
00616 class TBE_FolderTree extends localFolderTree {
00617         var $ext_noTempRecyclerDirs=0;          // If file-drag mode is set, temp and recycler folders are filtered out.
00618 
00625         function ext_isLinkable($v)     {
00626                 if ($this->ext_noTempRecyclerDirs && (substr($v['path'],-7)=='_temp_/' || substr($v['path'],-11)=='_recycler_/'))       {
00627                         return 0;
00628                 } return 1;
00629         }
00630 
00638         function wrapTitle($title,$v)   {
00639                 if ($this->ext_isLinkable($v))  {
00640                         $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandFolder='.rawurlencode($v['path']).'\');';
00641                         return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
00642                 } else {
00643                         return '<span class="typo3-dimmed">'.$title.'</span>';
00644                 }
00645         }
00646 }
00647 
00648 
00649 
00650 
00651 
00659 class browse_links {
00660 
00661                 // Internal, static:
00662         var $siteURL;                   // Current site URL (Frontend)
00663         var $thisScript;                // the script to link to
00664         var $thisConfig;                // RTE specific TSconfig
00665         var $setTarget;                 // Target (RTE specific)
00666         var $setTitle;                  // title (RTE specific)
00667         var $doc;                               // Backend template object
00668 
00669                 // GPvars:      (Input variables from outside)
00680         var $mode;
00681 
00687         var $act;
00688 
00692         var $expandPage;
00693 
00697         var $expandFolder;
00698 
00699 
00700 
00704         var $P;
00705 
00720         var $bparams;
00721 
00726         var $RTEtsConfigParams;
00727 
00728 
00729 
00730 
00734         var $PM;
00735 
00739         var $pointer;
00740 
00741 
00742 
00743 
00747         var $curUrlArray;
00748 
00752         var $curUrlInfo;
00753 
00754 
00755 
00756 
00757 
00758 
00765         function init() {
00766                 global $BE_USER,$BACK_PATH;
00767 
00768                         // Main GPvars:
00769                 $this->pointer = t3lib_div::_GP('pointer');
00770                 $this->bparams = t3lib_div::_GP('bparams');
00771                 $this->P = t3lib_div::_GP('P');
00772                 $this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
00773                 $this->expandPage = t3lib_div::_GP('expandPage');
00774                 $this->expandFolder = t3lib_div::_GP('expandFolder');
00775                 $this->PM = t3lib_div::_GP('PM');
00776 
00777                         // Find "mode"
00778                 $this->mode=t3lib_div::_GP('mode');
00779                 if (!$this->mode)       {
00780                         $this->mode='rte';
00781                 }
00782 
00783                         // Site URL
00784                 $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL');       // Current site url
00785 
00786                         // the script to link to
00787                 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
00788 
00789                         // CurrentUrl - the current link url must be passed around if it exists
00790                 if ($this->mode=='wizard')      {
00791                         $currentLinkParts = t3lib_div::trimExplode(' ',$this->P['currentValue']);
00792                         $this->curUrlArray = array(
00793                                 'target' => $currentLinkParts[1]
00794                         );
00795                         $this->curUrlInfo=$this->parseCurUrl($this->siteURL.'?id='.$currentLinkParts[0],$this->siteURL);
00796                 } else {
00797                         $this->curUrlArray = t3lib_div::_GP('curUrl');
00798                         if ($this->curUrlArray['all'])  {
00799                                 $this->curUrlArray=t3lib_div::get_tag_attributes($this->curUrlArray['all']);
00800                         }
00801                         $this->curUrlInfo=$this->parseCurUrl($this->curUrlArray['href'],$this->siteURL);
00802                 }
00803 
00804                         // Determine nature of current url:
00805                 $this->act=t3lib_div::_GP('act');
00806                 if (!$this->act)        {
00807                         $this->act=$this->curUrlInfo['act'];
00808                 }
00809 
00810                         // Rich Text Editor specific configuration:
00811                 $addPassOnParams='';
00812                 if ((string)$this->mode=='rte') {
00813                         $RTEtsConfigParts = explode(':',$this->RTEtsConfigParams);
00814                         $addPassOnParams.='&RTEtsConfigParams='.rawurlencode($this->RTEtsConfigParams);
00815                         $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
00816                         $this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
00817                 }
00818 
00819                         // Initializing the target value (RTE)
00820                 $this->setTarget = $this->curUrlArray['target'];
00821                 if ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target']))     {
00822                         $this->setTarget=$this->thisConfig['defaultLinkTarget'];
00823                 }
00824 
00825                         // Initializing the title value (RTE)
00826                 $this->setTitle = $this->curUrlArray['title'];
00827 
00828 
00829 
00830                         // Creating backend template object:
00831                 $this->doc = t3lib_div::makeInstance('template');
00832                 $this->doc->docType= 'xhtml_trans';
00833                 $this->doc->backPath = $BACK_PATH;
00834 
00835                         // BEGIN accumulation of header JavaScript:
00836                 $JScode = '';
00837                 $JScode.= '
00838                                 // This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...
00839                         var add_href="'.($this->curUrlArray['href']?'&curUrl[href]='.rawurlencode($this->curUrlArray['href']):'').'";
00840                         var add_target="'.($this->setTarget?'&curUrl[target]='.rawurlencode($this->setTarget):'').'";
00841                         var add_title="'.($this->setTitle?'&curUrl[title]='.rawurlencode($this->setTitle):'').'";
00842                         var add_params="'.($this->bparams?'&bparams='.rawurlencode($this->bparams):'').'";
00843 
00844                         var cur_href="'.($this->curUrlArray['href']?$this->curUrlArray['href']:'').'";
00845                         var cur_target="'.($this->setTarget?$this->setTarget:'').'";
00846                         var cur_title="'.($this->setTitle?$this->setTitle:'').'";
00847 
00848                         function setTarget(target)      {       //
00849                                 cur_target=target;
00850                                 add_target="&curUrl[target]="+escape(target);
00851                         }
00852                         function setTitle(title)        {       //
00853                                 cur_title=title;
00854                                 add_title="&curUrl[title]="+escape(title);
00855                         }
00856                         function setValue(value)        {       //
00857                                 cur_href=value;
00858                                 add_href="&curUrl[href]="+value;
00859                         }
00860                 ';
00861 
00862 
00863                 if ($this->mode=='wizard')      {       // Functions used, if the link selector is in wizard mode (= TCEforms fields)
00864                         unset($this->P['fieldChangeFunc']['alert']);
00865                         reset($this->P['fieldChangeFunc']);
00866                         $update='';
00867                         while(list($k,$v)=each($this->P['fieldChangeFunc']))    {
00868                                 $update.= '
00869                                 window.opener.'.$v;
00870                         }
00871 
00872                         $P2=array();
00873                         $P2['itemName']=$this->P['itemName'];
00874                         $P2['formName']=$this->P['formName'];
00875                         $P2['fieldChangeFunc']=$this->P['fieldChangeFunc'];
00876                         $addPassOnParams.=t3lib_div::implodeArrayForUrl('P',$P2);
00877 
00878                         $JScode.='
00879                                 function link_typo3Page(id,anchor)      {       //
00880                                         updateValueInMainForm(id+(anchor?anchor:"")+" "+cur_target);
00881                                         close();
00882                                         return false;
00883                                 }
00884                                 function link_folder(folder)    {       //
00885                                         updateValueInMainForm(folder+" "+cur_target);
00886                                         close();
00887                                         return false;
00888                                 }
00889                                 function link_current() {       //
00890                                         if (cur_href!="http://" && cur_href!="mailto:") {
00891                                                 var setValue = cur_href+" "+cur_target+" "+cur_title;
00892                                                 if (setValue.substr(0,7)=="http://")    setValue = setValue.substr(7);
00893                                                 if (setValue.substr(0,7)=="mailto:")    setValue = setValue.substr(7);
00894                                                 updateValueInMainForm(setValue);
00895                                                 close();
00896                                         }
00897                                         return false;
00898                                 }
00899                                 function checkReference()       {       //
00900                                         if (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"] ) {
00901                                                 return window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"];
00902                                         } else {
00903                                                 close();
00904                                         }
00905                                 }
00906                                 function updateValueInMainForm(input)   {       //
00907                                         var field = checkReference();
00908                                         if (field)      {
00909                                                 field.value = input;
00910                                                 '.$update.'
00911                                         }
00912                                 }
00913                         ';
00914                 } else {        // Functions used, if the link selector is in RTE mode:
00915                         $JScode.='
00916                                 function link_typo3Page(id,anchor)      {       //
00917                                         var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"");
00918                                         self.parent.parent.renderPopup_addLink(theLink,cur_target,cur_title);
00919                                         return false;
00920                                 }
00921                                 function link_folder(folder)    {       //
00922                                         var theLink = \''.$this->siteURL.'\'+folder;
00923                                         self.parent.parent.renderPopup_addLink(theLink,cur_target,cur_title);
00924                                         return false;
00925                                 }
00926                                 function link_spec(theLink)     {       //
00927                                         self.parent.parent.renderPopup_addLink(theLink,cur_target,cur_title);
00928                                         return false;
00929                                 }
00930                                 function link_current() {       //
00931                                         if (cur_href!="http://" && cur_href!="mailto:") {
00932                                                 self.parent.parent.renderPopup_addLink(cur_href,cur_target,cur_title);
00933                                         }
00934                                         return false;
00935                                 }
00936                         ';
00937                 }
00938 
00939                         // General "jumpToUrl" function:
00940                 $JScode.='
00941                         function jumpToUrl(URL,anchor)  {       //
00942                                 var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : "";
00943                                 var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$this->mode.'" : "";
00944                                 var theLocation = URL+add_act+add_mode+add_href+add_target+add_title+add_params'.($addPassOnParams?'+"'.$addPassOnParams.'"':'').'+(anchor?anchor:"");
00945                                 window.location.href = theLocation;
00946                                 return false;
00947                         }
00948                 ';
00949 
00950 
00951                         // This is JavaScript especially for the TBE Element Browser!
00952                 $pArr = explode('|',$this->bparams);
00953                 $formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';
00954                 $JScode.='
00955                         var elRef="";
00956                         var targetDoc="";
00957 
00958                         function launchView(url)        {       //
00959                                 var thePreviewWindow="";
00960                                 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");
00961                                 if (thePreviewWindow && thePreviewWindow.focus) {
00962                                         thePreviewWindow.focus();
00963                                 }
00964                         }
00965                         function setReferences()        {       //
00966                                 if (parent.window.opener
00967                                 && parent.window.opener.content
00968                                 && parent.window.opener.content.document.editform
00969                                 && parent.window.opener.content.document.editform["'.$formFieldName.'"]
00970                                                 ) {
00971                                         targetDoc = parent.window.opener.content.document;
00972                                         elRef = targetDoc.editform["'.$formFieldName.'"];
00973                                         return true;
00974                                 } else {
00975                                         return false;
00976                                 }
00977                         }
00978                         function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close)  {       //
00979                                 if (1=='.($pArr[0]&&!$pArr[1]&&!$pArr[2] ? 1 : 0).')    {
00980                                         addElement(filename,table+"_"+uid,fp,close);
00981                                 } else {
00982                                         if (setReferences())    {
00983                                                 parent.window.opener.group_change("add","'.$pArr[0].'","'.$pArr[1].'","'.$pArr[2].'",elRef,targetDoc);
00984                                         } else {
00985                                                 alert("Error - reference to main window is not set properly!");
00986                                         }
00987                                         if (close)      {
00988                                                 parent.window.opener.focus();
00989                                                 parent.close();
00990                                         }
00991                                 }
00992                                 return false;
00993                         }
00994                         function addElement(elName,elValue,altElValue,close)    {       //
00995                                 if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin)     {
00996                                         parent.window.opener.setFormValueFromBrowseWin("'.$pArr[0].'",altElValue?altElValue:elValue,elName);
00997                                         if (close)      {
00998                                                 parent.window.opener.focus();
00999                                                 parent.close();
01000                                         }
01001                                 } else {
01002                                         alert("Error - reference to main window is not set properly!");
01003                                         parent.close();
01004                                 }
01005                         }
01006                 ';
01007 
01008                         // Finally, add the accumulated JavaScript to the template object:
01009                 $this->doc->JScode = $this->doc->wrapScriptTags($JScode);
01010 
01011                         // Debugging:
01012                 if (FALSE) debug(array(
01013                         'pointer' => $this->pointer,
01014                         'act' => $this->act,
01015                         'mode' => $this->mode,
01016                         'curUrlInfo' => $this->curUrlInfo,
01017                         'curUrlArray' => $this->curUrlArray,
01018                         'P' => $this->P,
01019                         'bparams' => $this->bparams,
01020                         'RTEtsConfigParams' => $this->RTEtsConfigParams,
01021                         'expandPage' => $this->expandPage,
01022                         'expandFolder' => $this->expandFolder,
01023                         'PM' => $this->PM,
01024                 ),'Internal variables of Script Class:');
01025         }
01026 
01027 
01035         function processSessionData($data) {
01036                 $store = false;
01037 
01038                 switch((string)$this->mode)     {
01039                         case 'db':
01040                                 if (isset($this->expandPage))   {
01041                                         $data['expandPage']=$this->expandPage;
01042                                         $store = true;
01043                                 } else {
01044                                         $this->expandPage=$data['expandPage'];
01045                                 }
01046                         break;
01047                         case 'file':
01048                         case 'filedrag':
01049                                 if (isset($this->expandFolder)) {
01050                                         $data['expandFolder']=$this->expandFolder;
01051                                         $store = true;
01052                                 } else {
01053                                         $this->expandFolder=$data['expandFolder'];
01054                                 }
01055                         break;
01056                 }
01057 
01058                 return array($data, $store);
01059         }
01060 
01061 
01062 
01063 
01064         /******************************************************************
01065          *
01066          * Main functions
01067          *
01068          ******************************************************************/
01069 
01078         function main_rte($wiz=0)       {
01079                 global $LANG, $BACK_PATH;
01080 
01081                         // Starting content:
01082                 $content=$this->doc->startPage('RTE link');
01083 
01084                         // Initializing the action value, possibly removing blinded values etc:
01085                 $allowedItems = array_diff(explode(',','page,file,url,mail,spec'),t3lib_div::trimExplode(',',$this->thisConfig['blindLinkOptions'],1));
01086                 reset($allowedItems);
01087                 if (!in_array($this->act,$allowedItems))        $this->act = current($allowedItems);
01088 
01089                         // Making menu in top:
01090                 $menuDef = array();
01091                 if (!$wiz)      {
01092                         $menuDef['removeLink']['isActive'] = $this->act=='removeLink';
01093                         $menuDef['removeLink']['label'] = $LANG->getLL('removeLink',1);
01094                         $menuDef['removeLink']['url'] = '#';
01095                         $menuDef['removeLink']['addParams'] = 'onclick="self.parent.parent.renderPopup_unLink();return false;"';
01096                 }
01097                 if (in_array('page',$allowedItems)) {
01098                         $menuDef['page']['isActive'] = $this->act=='page';
01099                         $menuDef['page']['label'] = $LANG->getLL('page',1);
01100                         $menuDef['page']['url'] = '#';
01101                         $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page\');return false;"';
01102                 }
01103                 if (in_array('file',$allowedItems)){
01104                         $menuDef['file']['isActive'] = $this->act=='file';
01105                         $menuDef['file']['label'] = $LANG->getLL('file',1);
01106                         $menuDef['file']['url'] = '#';
01107                         $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file\');return false;"';
01108                 }
01109                 if (in_array('url',$allowedItems)) {
01110                         $menuDef['url']['isActive'] = $this->act=='url';
01111                         $menuDef['url']['label'] = $LANG->getLL('extUrl',1);
01112                         $menuDef['url']['url'] = '#';
01113                         $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url\');return false;"';
01114                 }
01115                 if (in_array('mail',$allowedItems)) {
01116                         $menuDef['mail']['isActive'] = $this->act=='mail';
01117                         $menuDef['mail']['label'] = $LANG->getLL('email',1);
01118                         $menuDef['mail']['url'] = '#';
01119                         $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail\');return false;"';
01120                 }
01121                 if (is_array($this->thisConfig['userLinks.']) && in_array('spec',$allowedItems)) {
01122                         $menuDef['spec']['isActive'] = $this->act=='spec';
01123                         $menuDef['spec']['label'] = $LANG->getLL('special',1);
01124                         $menuDef['spec']['url'] = '#';
01125                         $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec\');return false;"';
01126                 }
01127                 $content .= $this->doc->getTabMenuRaw($menuDef);
01128 
01129                         // Adding the menu and header to the top of page:
01130                 $content.=$this->printCurrentUrl($this->curUrlInfo['info']).'<br />';
01131 
01132 
01133                         // Depending on the current action we will create the actual module content for selecting a link:
01134                 switch($this->act)      {
01135                         case 'mail':
01136                                 $extUrl='
01137 
01138                         <!--
01139                                 Enter mail address:
01140                         -->
01141                                         <form action="" name="lurlform" id="lurlform">
01142                                                 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail">
01143                                                         <tr>
01144                                                                 <td>'.$GLOBALS['LANG']->getLL('emailAddress',1).':</td>
01145                                                                 <td><input type="text" name="lemail"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='mail'?$this->curUrlInfo['info']:'').'" /> '.
01146                                                                         '<input type="submit" value="'.$GLOBALS['LANG']->getLL('setLink',1).'" onclick="setTarget(\'\');setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td>
01147                                                         </tr>
01148                                                 </table>
01149                                         </form>';
01150                                 $content.=$extUrl;
01151                         break;
01152                         case 'url':
01153                                 $extUrl='
01154 
01155                         <!--
01156                                 Enter External URL:
01157                         -->
01158                                         <form action="" name="lurlform" id="lurlform">
01159                                                 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL">
01160                                                         <tr>
01161                                                                 <td>URL:</td>
01162                                                                 <td><input type="text" name="lurl"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='url'?$this->curUrlInfo['info']:'http://').'" /> '.
01163                                                                         '<input type="submit" value="'.$GLOBALS['LANG']->getLL('setLink',1).'" onclick="setValue(document.lurlform.lurl.value); return link_current();" /></td>
01164                                                         </tr>
01165                                                 </table>
01166                                         </form>';
01167                                 $content.=$extUrl;
01168                         break;
01169                         case 'file':
01170                                 $foldertree = t3lib_div::makeInstance('rteFolderTree');
01171                                 $foldertree->thisScript = $this->thisScript;
01172                                 $tree=$foldertree->getBrowsableTree();
01173 
01174                                 if (!$this->curUrlInfo['value'] || $this->curUrlInfo['act']!='file')    {
01175                                         $cmpPath='';
01176                                 } elseif (substr(trim($this->curUrlInfo['info']),-1)!='/')      {
01177                                         $cmpPath=PATH_site.dirname($this->curUrlInfo['info']).'/';
01178                                         if (!isset($this->expandFolder))                        $this->expandFolder = $cmpPath;
01179                                 } else {
01180                                         $cmpPath=PATH_site.$this->curUrlInfo['info'];
01181                                 }
01182 
01183                                 list(,,$specUid) = explode('_',$this->PM);
01184                                 $files = $this->expandFolder($foldertree->specUIDmap[$specUid]);
01185 
01186                                 $content.= '
01187 
01188                         <!--
01189                                 Wrapper table for folder tree / file list:
01190                         -->
01191                                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkFiles">
01192                                                 <tr>
01193                                                         <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
01194                                                         <td class="c-wCell" valign="top">'.$files.'</td>
01195                                                 </tr>
01196                                         </table>
01197                                         ';
01198                         break;
01199                         case 'spec':
01200                                 if (is_array($this->thisConfig['userLinks.']))  {
01201                                         $subcats=array();
01202                                         $v=$this->thisConfig['userLinks.'];
01203                                         reset($v);
01204                                         while(list($k2)=each($v))       {
01205                                                 $k2i = intval($k2);
01206                                                 if (substr($k2,-1)=='.' && is_array($v[$k2i.'.']))      {
01207 
01208                                                                 // Title:
01209                                                         $title = trim($v[$k2i]);
01210                                                         if (!$title)    {
01211                                                                 $title=$v[$k2i.'.']['url'];
01212                                                         } else {
01213                                                                 $title=$LANG->sL($title);
01214                                                         }
01215                                                                 // Description:
01216                                                         $description=$v[$k2i.'.']['description'] ? $LANG->sL($v[$k2i.'.']['description'],1).'<br />' : '';
01217 
01218                                                                 // URL + onclick event:
01219                                                         $onClickEvent='';
01220                                                         if (isset($v[$k2i.'.']['target']))      $onClickEvent.="setTarget('".$v[$k2i.'.']['target']."');";
01221                                                         $v[$k2i.'.']['url'] = str_replace('###_URL###',$this->siteURL,$v[$k2i.'.']['url']);
01222                                                         if (substr($v[$k2i.'.']['url'],0,7)=='http://' || substr($v[$k2i.'.']['url'],0,7)=='mailto:')   {
01223                                                                 $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();";
01224                                                         } else {
01225                                                                 $onClickEvent.="link_spec(unescape('".$this->siteURL.rawurlencode($v[$k2i.'.']['url'])."'));";
01226                                                         }
01227 
01228                                                                 // Link:
01229                                                         $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>');
01230 
01231                                                                 // Adding link to menu of user defined links:
01232                                                         $subcats[$k2i]='
01233                                                                 <tr>
01234                                                                         <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>
01235                                                                 </tr>';
01236                                                 }
01237                                         }
01238 
01239                                                 // Sort by keys:
01240                                         ksort($subcats);
01241 
01242                                                 // Add menu to content:
01243                                         $content.= '
01244 
01245                         <!--
01246                                 Special userdefined menu:
01247                         -->
01248                                                 <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
01249                                                         <tr>
01250                                                                 <td class="bgColor5" class="c-wCell" valign="top"><strong>'.$LANG->getLL('special',1).'</strong></td>
01251                                                         </tr>
01252                                                         '.implode('',$subcats).'
01253                                                 </table>
01254                                                 ';
01255                                 }
01256                         break;
01257                         case 'page':
01258                         default:
01259                                 $pagetree = t3lib_div::makeInstance('rtePageTree');
01260                                 $pagetree->thisScript = $this->thisScript;
01261                                 $tree=$pagetree->getBrowsableTree();
01262                                 $cElements = $this->expandPage();
01263                                 $content.= '
01264 
01265                         <!--
01266                                 Wrapper table for page tree / record list:
01267                         -->
01268                                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages">
01269                                                 <tr>
01270                                                         <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
01271                                                         <td class="c-wCell" valign="top">'.$cElements.'</td>
01272                                                 </tr>
01273                                         </table>
01274                                         ';
01275                         break;
01276                 }
01277 
01278                 $content .= '
01279 
01280 
01281 
01282                         <!--
01283                                 Selecting title for link:
01284                         -->
01285                                 <form action="" name="ltitleform" id="ltargetform">
01286                                         <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
01287                                                 <tr>
01288                                                         <td>'.$GLOBALS['LANG']->getLL('title',1).'</td>
01289                                                         <td><input type="text" name="ltitle" onchange="setTitle(this.value);" value="'.htmlspecialchars($this->setTitle).'"'.$this->doc->formWidth(10).' /></td>
01290                                                         <td><input type="submit" value="'.$GLOBALS['LANG']->getLL('update',1).'" onclick="return link_current();" /></td>
01291                                                 </tr>
01292                                         </table>
01293                                 </form>
01294 ';
01295 
01296                         // Target:
01297                 if ($this->act!='mail') {
01298                         $ltarget='
01299 
01300 
01301 
01302                         <!--
01303                                 Selecting target for link:
01304                         -->
01305                                 <form action="" name="ltargetform" id="ltargetform">
01306                                         <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
01307                                                 <tr>
01308                                                         <td>'.$GLOBALS['LANG']->getLL('target',1).':</td>
01309                                                         <td><input type="text" name="ltarget" onchange="setTarget(this.value);" value="'.htmlspecialchars($this->setTarget).'"'.$this->doc->formWidth(10).' /></td>
01310                                                         <td>
01311                                                                 <select name="ltarget_type" onchange="setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
01312                                                                         <option></option>
01313                                                                         <option value="_top">'.$GLOBALS['LANG']->getLL('top',1).'</option>
01314                                                                         <option value="_blank">'.$GLOBALS['LANG']->getLL('newWindow',1).'</option>
01315                                                                 </select>
01316                                                         </td>
01317                                                         <td>';
01318 
01319                         if (($this->curUrlInfo['act']=="page" || $this->curUrlInfo['act']=='file') && $this->curUrlArray['href'])       {
01320                                 $ltarget.='
01321                                                         <input type="submit" value="'.$GLOBALS['LANG']->getLL('update',1).'" onclick="return link_current();" />';
01322                         }
01323 
01324                         $selectJS = '
01325                                 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)     {
01326                                         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;
01327                                         setTarget(document.ltargetform.ltarget.value);
01328                                 setTitle(document.ltitleform.ltitle.value);
01329                                         document.ltargetform.popup_width.selectedIndex=0;
01330                                         document.ltargetform.popup_height.selectedIndex=0;
01331                                 }
01332                         ';
01333 
01334                         $ltarget.='             </td>
01335                                                 </tr>
01336                                                 <tr>
01337                                                         <td>'.$GLOBALS['LANG']->getLL('target_popUpWindow',1).':</td>
01338                                                         <td colspan="3">
01339                                                                 <select name="popup_width" onchange="'.htmlspecialchars($selectJS).'">
01340                                                                         <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_width',1).'</option>
01341                                                                         <option value="300">300</option>
01342                                                                         <option value="400">400</option>
01343                                                                         <option value="500">500</option>
01344                                                                         <option value="600">600</option>
01345                                                                         <option value="700">700</option>
01346                                                                         <option value="800">800</option>
01347                                                                 </select>
01348                                                                 x
01349                                                                 <select name="popup_height" onchange="'.htmlspecialchars($selectJS).'">
01350                                                                         <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_height',1).'</option>
01351                                                                         <option value="200">200</option>
01352                                                                         <option value="300">300</option>
01353                                                                         <option value="400">400</option>
01354                                                                         <option value="500">500</option>
01355                                                                         <option value="600">600</option>
01356                                                                 </select>
01357                                                         </td>
01358                                                 </tr>
01359                                         </table>
01360                                 </form>';
01361 
01362                                 // Add "target selector" box to content:
01363                         $content.=$ltarget;
01364 
01365                                 // Add some space
01366                         $content.='<br /><br />';
01367                 }
01368 
01369                         // End page, return content:
01370                 $content.= $this->doc->endPage();
01371                 $content = $this->doc->insertStylesAndJS($content);
01372                 return $content;
01373         }
01374 
01380         function main_db()      {
01381 
01382                         // Starting content:
01383                 $content=$this->doc->startPage('TBE file selector');
01384 
01385                         // Init variable:
01386                 $pArr = explode('|',$this->bparams);
01387 
01388                         // Making the browsable pagetree:
01389                 $pagetree = t3lib_div::makeInstance('TBE_PageTree');
01390                 $pagetree->thisScript=$this->thisScript;
01391                 $pagetree->ext_pArrPages = !strcmp($pArr[3],'pages')?1:0;
01392                 $tree=$pagetree->getBrowsableTree();
01393 
01394                         // Making the list of elements, if applicable:
01395                 $cElements = $this->TBE_expandPage($pArr[3]);
01396 
01397                         // Putting the things together, side by side:
01398                 $content.= '
01399 
01400                         <!--
01401                                 Wrapper table for page tree / record list:
01402                         -->
01403                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBrecords">
01404                                 <tr>
01405                                         <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
01406                                         <td class="c-wCell" valign="top">'.$cElements.'</td>
01407                                 </tr>
01408                         </table>
01409                         ';
01410 
01411                         // Add some space
01412                 $content.='<br /><br />';
01413 
01414                         // End page, return content:
01415                 $content.= $this->doc->endPage();
01416                 $content = $this->doc->insertStylesAndJS($content);
01417                 return $content;
01418         }
01419 
01425         function main_file()    {
01426                 global $BE_USER;
01427 
01428                         // Starting content:
01429                 $content.=$this->doc->startPage('TBE file selector');
01430 
01431                         // Init variable:
01432                 $pArr = explode('|',$this->bparams);
01433 
01434                         // Create upload/create folder forms, if a path is given:
01435                 $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
01436                 $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
01437                 $path=$this->expandFolder;
01438                 if (!$path || !@is_dir($path))  {
01439                         $path = $fileProcessor->findTempFolder().'/';   // The closest TEMP-path is found
01440                 }
01441                 if ($path!='/' && @is_dir($path))       {
01442                         $uploadForm=$this->uploadForm($path);
01443                         $createFolder=$this->createFolder($path);
01444                 } else {
01445                         $createFolder='';
01446                         $uploadForm='';
01447                 }
01448                 if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB'))  $content.=$uploadForm;
01449 
01450                         // Getting flag for showing/not showing thumbnails:
01451                 $noThumbs = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
01452 
01453                 if (!$noThumbs) {
01454                                 // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
01455                         $_MOD_MENU = array('displayThumbs' => '');
01456                         $_MCONF['name']='file_list';
01457                         $_MOD_SETTINGS = t3lib_BEfunc::getModuleData($_MOD_MENU, t3lib_div::_GP('SET'), $_MCONF['name']);
01458                         $addParams = '&act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
01459                         $thumbNailCheck = t3lib_BEfunc::getFuncCheck('','SET[displayThumbs]',$_MOD_SETTINGS['displayThumbs'],$this->thisScript,$addParams).' '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.php:displayThumbs',1);
01460                 } else {
01461                         $thumbNailCheck='';
01462                 }
01463                 $noThumbs = $noThumbs?$noThumbs:!$_MOD_SETTINGS['displayThumbs'];
01464 
01465                         // Create folder tree:
01466                 $foldertree = t3lib_div::makeInstance('TBE_FolderTree');
01467                 $foldertree->thisScript=$this->thisScript;
01468                 $foldertree->ext_noTempRecyclerDirs = ($this->mode == 'filedrag');
01469                 $tree=$foldertree->getBrowsableTree();
01470 
01471                 list(,,$specUid) = explode('_',$this->PM);
01472 
01473                 if ($this->mode=='filedrag')    {
01474                         $files = $this->TBE_dragNDrop($foldertree->specUIDmap[$specUid],$pArr[3]);
01475                 } else {
01476                         $files = $this->TBE_expandFolder($foldertree->specUIDmap[$specUid],$pArr[3],$noThumbs);
01477                 }
01478 
01479                         // Putting the parts together, side by side:
01480                 $content.= '
01481 
01482                         <!--
01483                                 Wrapper table for folder tree / file list:
01484                         -->
01485                         <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles">
01486                                 <tr>
01487                                         <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
01488                                         <td class="c-wCell" valign="top">'.$files.'</td>
01489                                 </tr>
01490                         </table>
01491                         ';
01492                 $content.=$thumbNailCheck;
01493 
01494                         // Adding create folder + upload forms if applicable:
01495                 if (!$BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) $content.=$uploadForm;
01496                 if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB'))       $content.=$createFolder;
01497 
01498                         // Add some space
01499                 $content.='<br /><br />';
01500 
01501                         // Ending page, returning content:
01502                 $content.= $this->doc->endPage();
01503                 $content = $this->doc->insertStylesAndJS($content);
01504                 return $content;
01505         }
01506 
01507 
01508 
01509 
01510 
01511 
01512 
01513 
01514 
01515 
01516 
01517 
01518 
01519 
01520 
01521 
01522 
01523 
01524 
01525         /******************************************************************
01526          *
01527          * Record listing
01528          *
01529          ******************************************************************/
01535         function expandPage()   {
01536                 global $BE_USER, $BACK_PATH;
01537 
01538                 $out='';
01539                 $expPageId = $this->expandPage;         // Set page id (if any) to expand
01540 
01541                         // If there is an anchor value (content element reference) in the element reference, then force an ID to expand:
01542                 if (!$this->expandPage && $this->curUrlInfo['cElement'])        {
01543                         $expPageId = $this->curUrlInfo['pageid'];       // Set to the current link page id.
01544                 }
01545 
01546                         // Draw the record list IF there is a page id to expand:
01547                 if ($expPageId && t3lib_div::testInt($expPageId) && $BE_USER->isInWebMount($expPageId)) {
01548 
01549                                 // Set header:
01550                         $out.=$this->barheader($GLOBALS['LANG']->getLL('contentElements').':');
01551 
01552                                 // Create header for listing, showing the page title/icon:
01553                         $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01554                         $mainPageRec = t3lib_BEfunc::getRecordWSOL('pages',$expPageId);
01555                         $picon=t3lib_iconWorks::getIconImage('pages',$mainPageRec,'','');
01556                         $picon.= htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'],$titleLen));
01557                         $out.=$picon.'<br />';
01558 
01559                                 // Look up tt_content elements from the expanded page:
01560                         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
01561                                                         'uid,header,hidden,starttime,endtime,fe_group,CType,colpos,bodytext',
01562                                                         'tt_content',
01563                                                         'pid='.intval($expPageId).
01564                                                                 t3lib_BEfunc::deleteClause('tt_content').
01565                                                                 t3lib_BEfunc::versioningPlaceholderClause('tt_content'),
01566                                                         '',
01567                                                         'colpos,sorting'
01568                                                 );
01569                         $cc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
01570 
01571                                 // Traverse list of records:
01572                         $c=0;
01573                         while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))       {
01574                                 $c++;
01575                                 $icon=t3lib_iconWorks::getIconImage('tt_content',$row,$BACK_PATH,'');
01576                                 if ($this->curUrlInfo['act']=='page' && $this->curUrlInfo['cElement']==$row['uid'])     {
01577                                         $arrCol='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
01578                                 } else {
01579                                         $arrCol='';
01580                                 }
01581                                         // Putting list element HTML together:
01582                                 $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
01583                                                 $arrCol.
01584                                                 '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.$row['uid'].'\');">'.
01585                                                 $icon.
01586                                                 htmlspecialchars(t3lib_div::fixed_lgd_cs($row['header'],$titleLen)).
01587                                                 '</a><br />';
01588 
01589                                         // Finding internal anchor points:
01590                                 if (t3lib_div::inList('text,textpic', $row['CType']))   {
01591                                         $split = preg_split('/(<a[^>]+name=[\'"]?([^"\'>[:space:]]+)[\'"]?[^>]*>)/i', $row['bodytext'], -1, PREG_SPLIT_DELIM_CAPTURE);
01592 
01593                                         foreach($split as $skey => $sval)       {
01594                                                 if (($skey%3)==2)       {
01595                                                                 // Putting list element HTML together:
01596                                                         $sval = substr($sval,0,100);
01597                                                         $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/line.gif','width="18" height="16"').' alt="" />'.
01598                                                                         '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($skey+3>count($split)?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
01599                                                                         '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.rawurlencode($sval).'\');">'.
01600                                                                         htmlspecialchars(' <A> '.$sval).
01601                                                                         '</a><br />';
01602                                                 }
01603                                         }
01604                                 }
01605                         }
01606                 }
01607                 return $out;
01608         }
01609 
01616         function TBE_expandPage($tables)        {
01617                 global $TCA,$BE_USER, $BACK_PATH;
01618 
01619                 $out='';
01620                 if ($this->expandPage>=0 && t3lib_div::testInt($this->expandPage) && $BE_USER->isInWebMount($this->expandPage)) {
01621 
01622                                 // Set array with table names to list:
01623                         if (!strcmp(trim($tables),'*')) {
01624                                 $tablesArr = array_keys($TCA);
01625                         } else {
01626                                 $tablesArr = t3lib_div::trimExplode(',',$tables,1);
01627                         }
01628                         reset($tablesArr);
01629 
01630                                 // Headline for selecting records:
01631                         $out.=$this->barheader($GLOBALS['LANG']->getLL('selectRecords').':');
01632 
01633                                 // Create the header, showing the current page for which the listing is. Includes link to the page itself, if pages are amount allowed tables.
01634                         $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01635                         $mainPageRec = t3lib_BEfunc::getRecordWSOL('pages',$this->expandPage);
01636                         $ATag='';
01637                         $ATag_e='';
01638                         $ATag2='';
01639                         if (in_array('pages',$tablesArr))       {
01640                                 $ficon=t3lib_iconWorks::getIcon('pages',$mainPageRec);
01641                                 $ATag="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', ".t3lib_div::quoteJSvalue($mainPageRec['title']).", '', '', '".$ficon."','',1);\">";
01642                                 $ATag2="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', ".t3lib_div::quoteJSvalue($mainPageRec['title']).", '', '', '".$ficon."','',0);\">";
01643                                 $ATag_alt=substr($ATag,0,-4).",'',1);\">";
01644                                 $ATag_e='</a>';
01645                         }
01646                         $picon=t3lib_iconWorks::getIconImage('pages',$mainPageRec,$BACK_PATH,'');
01647                         $pBicon=$ATag2?'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' alt="" />':'';
01648                         $pText=htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'],$titleLen));
01649                         $out.=$picon.$ATag2.$pBicon.$ATag_e.$ATag.$pText.$ATag_e.'<br />';
01650 
01651                                 // Initialize the record listing:
01652                         $id = $this->expandPage;
01653                         $pointer = t3lib_div::intInRange($this->pointer,0,100000);
01654                         $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
01655                         $pageinfo = t3lib_BEfunc::readPageAccess($id,$perms_clause);
01656                         $table='';
01657 
01658                                 // Generate the record list:
01659                         $dblist = t3lib_div::makeInstance('TBE_browser_recordList');
01660                         $dblist->thisScript=$this->thisScript;
01661                         $dblist->backPath = $GLOBALS['BACK_PATH'];
01662                         $dblist->thumbs = 0;
01663                         $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo);
01664                         $dblist->noControlPanels=1;
01665                         $dblist->clickMenuEnabled=0;
01666                         $dblist->tableList=implode(',',$tablesArr);
01667 
01668                         $dblist->start($id,t3lib_div::_GP('table'),$pointer,
01669                                 t3lib_div::_GP('search_field'),
01670                                 t3lib_div::_GP('search_levels'),
01671                                 t3lib_div::_GP('showLimit')
01672                         );
01673                         $dblist->setDispFields();
01674                         $dblist->generateList();
01675                         $dblist->writeBottom();
01676 
01677                                 //      Add the HTML for the record list to output variable:
01678                         $out.=$dblist->HTMLcode;
01679                         $out.=$dblist->getSearchBox();
01680                 }
01681 
01682                         // Return accumulated content:
01683                 return $out;
01684         }
01685 
01686 
01687 
01688 
01689 
01690 
01691 
01692 
01693 
01694 
01695 
01696 
01697         /******************************************************************
01698          *
01699          * File listing
01700          *
01701          ******************************************************************/
01709         function expandFolder($expandFolder=0,$extensionList='')        {
01710                 global $BACK_PATH;
01711 
01712                 $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
01713                 $out='';
01714                 if ($expandFolder && $this->checkFolder($expandFolder)) {
01715 
01716                                 // Create header for filelisting:
01717                         $out.=$this->barheader($GLOBALS['LANG']->getLL('files').':');
01718 
01719                                 // Prepare current path value for comparison (showing red arrow)
01720                         if (!$this->curUrlInfo['value'])        {
01721                                 $cmpPath='';
01722                         } else {
01723                                 $cmpPath=PATH_site.$this->curUrlInfo['info'];
01724                         }
01725 
01726 
01727                                 // Create header element; The folder from which files are listed.
01728                         $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01729                         $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
01730                         $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder),$titleLen));
01731                         $picon='<a href="#" onclick="return link_folder(\''.t3lib_div::rawUrlEncodeFP(substr($expandFolder,strlen(PATH_site))).'\');">'.$picon.'</a>';
01732                         $out.=$picon.'<br />';
01733 
01734                                 // Get files from the folder:
01735                         $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1);    // $extensionList="",$prependPath=0,$order='')
01736                         $c=0;
01737                         $cc=count($files);
01738 
01739                         if (is_array($files))   {
01740                                 foreach($files as $filepath)    {
01741                                         $c++;
01742                                         $fI=pathinfo($filepath);
01743 
01744                                                 // File icon:
01745                                         $icon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
01746 
01747                                                 // If the listed file turns out to be the CURRENT file, then show blinking arrow:
01748                                         if ($this->curUrlInfo['act']=="file" && $cmpPath==$filepath)    {
01749                                                 $arrCol='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
01750                                         } else {
01751                                                 $arrCol='';
01752                                         }
01753 
01754                                                 // Get size and icon:
01755                                         $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes)';
01756                                         $icon = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/fileicons/'.$icon.'','width="18" height="16"').' title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
01757 
01758                                                 // Put it all together for the file element:
01759                                         $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
01760                                                         $arrCol.
01761                                                         '<a href="#" onclick="return link_folder(\''.t3lib_div::rawUrlEncodeFP(substr($filepath,strlen(PATH_site))).'\');">'.
01762                                                         $icon.
01763                                                         htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen)).
01764                                                         '</a><br />';
01765                                 }
01766                         }
01767                 }
01768                 return $out;
01769         }
01770 
01779         function TBE_expandFolder($expandFolder=0,$extensionList='',$noThumbs=0)        {
01780                 global $LANG;
01781 
01782                 $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
01783                 $out='';
01784                 if ($expandFolder && $this->checkFolder($expandFolder)) {
01785                                 // Listing the files:
01786                         $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1);    // $extensionList="",$prependPath=0,$order='')
01787                         $out.= $this->fileList($files, $expandFolder, $noThumbs);
01788                 }
01789 
01790                         // Return accumulated content for filelisting:
01791                 return $out;
01792         }
01793 
01802         function fileList($files, $folderName='', $noThumbs=0) {
01803                 global $LANG, $BACK_PATH;
01804 
01805                 $out='';
01806 
01807                         // Listing the files:
01808                 if (is_array($files))   {
01809 
01810                                 // Create headline (showing number of files):
01811                         $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files)));
01812 
01813                         $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01814 
01815                                 // Create the header of current folder:
01816                         if($folderName) {
01817                                 $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
01818                                 $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($folderName),$titleLen));
01819                                 $out.=$picon.'<br />';
01820                         }
01821 
01822                                 // Init graphic object for reading file dimensions:
01823                         $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
01824                         $imgObj->init();
01825                         $imgObj->mayScaleUp=0;
01826                         $imgObj->tempPath=PATH_site.$imgObj->tempPath;
01827 
01828                                 // Traverse the file list:
01829                         $lines=array();
01830                         foreach($files as $filepath)    {
01831                                 $fI=pathinfo($filepath);
01832 
01833                                         // Thumbnail/size generation:
01834                                 if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],$fI['extension']) && !$noThumbs)      {
01835                                         $imgInfo = $imgObj->getImageDimensions($filepath);
01836                                         $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
01837                                         $clickIcon = t3lib_BEfunc::getThumbNail($BACK_PATH.'thumbs.php',$filepath,'hspace="5" vspace="5" border="1"');
01838                                 } else {
01839                                         $clickIcon = '';
01840                                         $pDim = '';
01841                                 }
01842 
01843                                         // Create file icon:
01844                                 $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
01845                                 $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes'.($pDim?', '.$pDim:'').')';
01846                                 $icon = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/fileicons/'.$ficon,'width="18" height="16"').' title="'.htmlspecialchars($fI['basename'].$size).'" class="absmiddle" alt="" />';
01847 
01848                                         // Create links for adding the file:
01849                                 if (strstr($filepath,',') || strstr($filepath,'|'))     {       // In case an invalid character is in the filepath, display error message:
01850                                         $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
01851                                         $ATag = $ATag_alt = "<a href=\"#\" onclick=\"alert(".$eMsg.");return false;\">";
01852                                 } else {        // If filename is OK, just add it:
01853                                         $ATag = "<a href=\"#\" onclick=\"return insertElement('','".t3lib_div::shortMD5($filepath)."', 'file', '".rawurlencode($fI['basename'])."', unescape('".rawurlencode($filepath)."'), '".$fI['extension']."', '".$ficon."');\">";
01854                                         $ATag_alt = substr($ATag,0,-4).",'',1);\">";
01855                                 }
01856                                 $ATag_e='</a>';
01857 
01858                                         // Create link to showing details about the file in a window:
01859                                 $Ahref = $BACK_PATH.'show_item.php?table='.rawurlencode($filepath).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
01860                                 $ATag2='<a href="'.htmlspecialchars($Ahref).'">';
01861                                 $ATag2_e='</a>';
01862 
01863                                         // Combine the stuff:
01864                                         $filenameAndIcon=$ATag_alt.$icon.htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen)).$ATag_e;
01865 
01866                                         // Show element:
01867                                 if ($pDim)      {               // Image...
01868                                         $lines[]='
01869                                                 <tr class="bgColor4">
01870                                                         <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
01871                                                         <td>'.$ATag.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
01872                                                         <td nowrap="nowrap">'.($ATag2.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/zoom2.gif','width="12" height="12"').' title="'.$LANG->getLL('info',1).'" alt="" /> '.$LANG->getLL('info',1).$ATag2_e).'</td>
01873                                                         <td nowrap="nowrap">&nbsp;'.$pDim.'</td>
01874                                                 </tr>';
01875                                         $lines[]='
01876                                                 <tr>
01877                                                         <td colspan="4">'.$ATag_alt.$clickIcon.$ATag_e.'</td>
01878                                                 </tr>';
01879                                 } else {
01880                                         $lines[]='
01881                                                 <tr class="bgColor4">
01882                                                         <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
01883                                                         <td>'.$ATag.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
01884                                                         <td nowrap="nowrap">'.($ATag2.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/zoom2.gif','width="12" height="12"').' title="'.$LANG->getLL('info',1).'" alt="" /> '.$LANG->getLL('info',1).$ATag2_e).'</td>
01885                                                         <td>&nbsp;</td>
01886                                                 </tr>';
01887                                 }
01888                                 $lines[]='
01889                                                 <tr>
01890                                                         <td colspan="3"><img src="clear.gif" width="1" height="3" alt="" /></td>
01891                                                 </tr>';
01892                         }
01893 
01894                                 // Wrap all the rows in table tags:
01895                         $out.='
01896 
01897 
01898 
01899                 <!--
01900                         File listing
01901                 -->
01902                                 <table border="0" cellpadding="0" cellspacing="1" id="typo3-fileList">
01903                                         '.implode('',$lines).'
01904                                 </table>';
01905                 }
01906 
01907                         // Return accumulated content for filelisting:
01908                 return $out;
01909         }
01910 
01919         function TBE_dragNDrop($expandFolder=0,$extensionList='')       {
01920                 global $BACK_PATH;
01921 
01922                 $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
01923                 $out='';
01924                 if ($expandFolder && $this->checkFolder($expandFolder)) {
01925                         if ($this->isWebFolder($expandFolder))  {
01926 
01927                                         // Read files from directory:
01928                                 $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1);    // $extensionList="",$prependPath=0,$order='')
01929                                 if (is_array($files))   {
01930                                         $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files)));
01931 
01932                                         $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
01933                                         $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
01934                                         $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder),$titleLen));
01935                                         $out.=$picon.'<br />';
01936 
01937                                                 // Init row-array:
01938                                         $lines=array();
01939 
01940                                                 // Add "drag-n-drop" message:
01941                                         $lines[]='
01942                                                 <tr>
01943                                                         <td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
01944                                                 </tr>';
01945 
01946                                                 // Fraverse files:
01947                                         while(list(,$filepath)=each($files))    {
01948                                                 $fI=pathinfo($filepath);
01949 
01950                                                         // URL of image:
01951                                                 $iurl = $this->siteURL.t3lib_div::rawurlencodeFP(substr($filepath,strlen(PATH_site)));
01952 
01953                                                         // Show only web-images
01954                                                 if (t3lib_div::inList('gif,jpeg,jpg,png',$fI['extension']))     {
01955                                                         $imgInfo = @getimagesize($filepath);
01956                                                         $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
01957 
01958                                                         $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
01959                                                         $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes'.($pDim?', '.$pDim:'').')';
01960                                                         $icon = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/fileicons/'.$ficon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
01961                                                         $filenameAndIcon=$icon.htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen));
01962 
01963                                                         if (t3lib_div::_GP('noLimit'))  {
01964                                                                 $maxW=10000;
01965                                                                 $maxH=10000;
01966                                                         } else {
01967                                                                 $maxW=380;
01968                                                                 $maxH=500;
01969                                                         }
01970                                                         $IW = $imgInfo[0];
01971                                                         $IH = $imgInfo[1];
01972                                                         if ($IW>$maxW)  {
01973                                                                 $IH=ceil($IH/$IW*$maxW);
01974                                                                 $IW=$maxW;
01975                                                         }
01976                                                         if ($IH>$maxH)  {
01977                                                                 $IW=ceil($IW/$IH*$maxH);
01978                                                                 $IH=$maxH;
01979                                                         }
01980 
01981                                                                 // Make row:
01982                                                         $lines[]='
01983                                                                 <tr class="bgColor4">
01984                                                                         <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
01985                                                                         <td nowrap="nowrap">'.
01986                                                                         ($imgInfo[0]!=$IW ? '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('noLimit'=>'1'))).'">'.
01987                                                                                                                 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/icon_warning2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('clickToRedrawFullSize',1).'" alt="" />'.
01988                                                                                                                 '</a>':'').
01989                                                                         $pDim.'&nbsp;</td>
01990                                                                 </tr>';
01991 
01992                                                         $lines[]='
01993                                                                 <tr>
01994                                                                         <td colspan="2"><img src="'.$iurl.'" width="'.$IW.'" height="'.$IH.'" border="1" alt="" /></td>
01995                                                                 </tr>';
01996                                                         $lines[]='
01997                                                                 <tr>
01998                                                                         <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
01999                                                                 </tr>';
02000                                                 }
02001                                         }
02002 
02003                                                 // Finally, wrap all rows in a table tag:
02004                                         $out.='
02005 
02006 
02007                         <!--
02008                                 File listing / Drag-n-drop
02009                         -->
02010                                                 <table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
02011                                                         '.implode('',$lines).'
02012                                                 </table>';
02013                                 }
02014                         } else {
02015                                         // Print this warning if the folder is NOT a web folder:
02016                                 $out.=$this->barheader($GLOBALS['LANG']->getLL('files'));
02017                                 $out.=$this->getMsgBox($GLOBALS['LANG']->getLL('noWebFolder'),'icon_warning2');
02018                         }
02019                 }
02020                 return $out;
02021         }
02022 
02023 
02024 
02025 
02026 
02027 
02028 
02029 
02030 
02031 
02032 
02033 
02034         /******************************************************************
02035          *
02036          * Miscellaneous functions
02037          *
02038          ******************************************************************/
02039 
02040 
02047         function isWebFolder($folder)   {
02048                 $folder = ereg_replace('\/$','',$folder).'/';
02049                 return t3lib_div::isFirstPartOfStr($folder,PATH_site) ? TRUE : FALSE;
02050         }
02051 
02058         function checkFolder($folder)   {
02059                 $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
02060                 $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
02061 
02062                 return $fileProcessor->checkPathAgainstMounts(ereg_replace('\/$','',$folder).'/') ? TRUE : FALSE;
02063         }
02064 
02071         function barheader($str)        {
02072                 return '
02073 
02074                         <!--
02075                                 Bar header:
02076                         -->
02077                         <h3 class="bgColor5">'.htmlspecialchars($str).'</h3>
02078                         ';
02079         }
02080 
02088         function getMsgBox($in_msg,$icon='icon_note')   {
02089                 global $BACK_PATH;
02090 
02091                 $msg = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/'.$icon.'.gif','width="18" height="16"').' alt="" />'.htmlspecialchars($in_msg);
02092                 $msg = '
02093 
02094                         <!--
02095                                 Message box:
02096                         -->
02097                         <table cellspacing="0" class="bgColor4" id="typo3-msgBox">
02098                                 <tr>
02099                                         <td>'.$msg.'</td>
02100                                 </tr>
02101                         </table>
02102                         ';
02103                 return $msg;
02104         }
02105 
02112         function printCurrentUrl($str)  {
02113                 return '
02114 
02115                         <!--
02116                                 Print current URL
02117                         -->
02118                         <table border="0" cellpadding="0" cellspacing="0" class="bgColor5" id="typo3-curUrl">
02119                                 <tr>
02120                                         <td>'.$GLOBALS['LANG']->getLL('currentLink',1).': '.htmlspecialchars(rawurldecode($str)).'</td>
02121                                 </tr>
02122                         </table>';
02123         }
02124 
02132         function parseCurUrl($href,$siteUrl)    {
02133                 $href = trim($href);
02134                 if ($href)      {
02135                         $info=array();
02136 
02137                                 // Default is "url":
02138                         $info['value']=$href;
02139                         $info['act']='url';
02140 
02141                         $specialParts = explode('#_SPECIAL',$href);
02142                         if (count($specialParts)==2)    {       // Special kind (Something RTE specific: User configurable links through: "userLinks." from ->thisConfig)
02143                                 $info['value']='#_SPECIAL'.$specialParts[1];
02144                                 $info['act']='spec';
02145                         } elseif (t3lib_div::isFirstPartOfStr($href,$siteUrl))  {       // If URL is on the current frontend website:
02146                                 $rel = substr($href,strlen($siteUrl));
02147                                 if (@file_exists(PATH_site.rawurldecode($rel))) {       // URL is a file, which exists:
02148                                         $info['value']=rawurldecode($rel);
02149                                         $info['act']='file';
02150                                 } else {        // URL is a page (id parameter)
02151                                         $uP=parse_url($rel);
02152                                         if (!trim($uP['path'])) {
02153                                                 $pp = explode('id=',$uP['query']);
02154                                                 $id = $pp[1];
02155                                                 if ($id)        {
02156                                                                 // Checking if the id-parameter is an alias.
02157                                                         if (!t3lib_div::testInt($id))   {
02158                                                                 list($idPartR) = t3lib_BEfunc::getRecordsByField('pages','alias',$id);
02159                                                                 $id=intval($idPartR['uid']);
02160                                                         }
02161 
02162                                                         $pageRow = t3lib_BEfunc::getRecordWSOL('pages',$id);
02163                                                         $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
02164                                                         $info['value']=$GLOBALS['LANG']->getLL('page',1)." '".htmlspecialchars(t3lib_div::fixed_lgd_cs($pageRow['title'],$titleLen))."' (ID:".$id.($uP['fragment']?', #'.$uP['fragment']:'').')';
02165                                                         $info['pageid']=$id;
02166                                                         $info['cElement']=$uP['fragment'];
02167                                                         $info['act']='page';
02168                                                 }
02169                                         }
02170                                 }
02171                         } else {        // Email link:
02172                                 if (strtolower(substr($href,0,7))=='mailto:')   {
02173                                         $info['value']=trim(substr($href,7));
02174                                         $info['act']='mail';
02175                                 }
02176                         }
02177                         $info['info'] = $info['value'];
02178                 } else {        // NO value inputted:
02179                         $info=array();
02180                         $info['info']=$GLOBALS['LANG']->getLL('none');
02181                         $info['value']='';
02182                         $info['act']='page';
02183                 }
02184                 return $info;
02185         }
02186 
02194         function uploadForm($path)      {
02195                 global $BACK_PATH;
02196                 $count=3;
02197 
02198                         // Create header, showing upload path:
02199                 $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
02200                 $code=$this->barheader($GLOBALS['LANG']->getLL('uploadImage').':');
02201                 $code.='
02202 
02203                         <!--
02204                                 Form, for uploading files:
02205                         -->
02206                         <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">
02207                                 <table border="0" cellpadding="0" cellspacing="3" id="typo3-uplFiles">
02208                                         <tr>
02209                                                 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
02210                                         </tr>
02211                                         <tr>
02212                                                 <td>';
02213 
02214                         // Traverse the number of upload fields (default is 3):
02215                 for ($a=1;$a<=$count;$a++)      {
02216                         $code.='<input type="file" name="upload_'.$a.'"'.$this->doc->formWidth(35).' size="50" />
02217                                 <input type="hidden" name="file[upload]['.$a.'][target]" value="'.htmlspecialchars($path).'" />
02218                                 <input type="hidden" name="file[upload]['.$a.'][data]" value="'.$a.'" /><br />';
02219                 }
02220 
02221                         // Make footer of upload form, including the submit button:
02222                 $redirectValue = $this->thisScript.'?act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
02223                 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
02224                                 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />';
02225 
02226                 $code.='
02227                         <div id="c-override">
02228                                 <input type="checkbox" name="overwriteExistingFiles" value="1" /> '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:overwriteExistingFiles',1).'
02229                         </div>
02230                 ';
02231 
02232 
02233                 $code.='</td>
02234                                         </tr>
02235                                 </table>
02236                         </form>';
02237 
02238                 return $code;
02239         }
02240 
02248         function createFolder($path)    {
02249                 global $BACK_PATH;
02250                         // Create header, showing upload path:
02251                 $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
02252                 $code=$this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle').':');
02253                 $code.='
02254 
02255                         <!--
02256                                 Form, for creating new folders:
02257                         -->
02258                         <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform2">
02259                                 <table border="0" cellpadding="0" cellspacing="3" id="typo3-crFolder">
02260                                         <tr>
02261                                                 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
02262                                         </tr>
02263                                         <tr>
02264                                                 <td>';
02265 
02266                         // Create the new-folder name field:
02267                 $a=1;
02268                 $code.='<input'.$this->doc->formWidth(20).' type="text" name="file[newfolder]['.$a.'][data]" />'.
02269                                 '<input type="hidden" name="file[newfolder]['.$a.'][target]" value="'.htmlspecialchars($path).'" />';
02270 
02271                         // Make footer of upload form, including the submit button:
02272                 $redirectValue = $this->thisScript.'?act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
02273                 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
02274                                 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.submit',1).'" />';
02275 
02276                 $code.='</td>
02277                                         </tr>
02278                                 </table>
02279                         </form>';
02280 
02281                 return $code;
02282         }
02283 }
02284 
02285 // Include extension?
02286 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.browse_links.php'])    {
02287         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.browse_links.php']);
02288 }
02289 
02290 
02291 ?>