2 /***************************************************************
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Displays the page/file tree for browsing database records or files.
29 * Used from TCEFORMS an other elements
30 * In other words: This is the ELEMENT BROWSER!
33 * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
36 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
39 * [CLASS/FUNCTION INDEX of SCRIPT]
43 * 155: class TBE_browser_recordList extends localRecordList
44 * 163: function TBE_browser_recordList ()
45 * 175: function listURL($altId='',$table=-1,$exclList='')
46 * 194: function ext_addP()
47 * 211: function linkWrapItems($table,$uid,$code,$row)
48 * 244: function linkWrapTable($table,$code)
51 * 261: class localPageTree extends t3lib_browseTree
52 * 268: function localPageTree()
53 * 284: function wrapTitle($title,$v,$ext_pArrPages='')
54 * 299: function printTree($treeArr='')
55 * 350: function ext_isLinkable($doktype,$uid)
56 * 364: function PM_ATagWrap($icon,$cmd,$bMark='')
57 * 381: function wrapIcon($icon,$row)
60 * 400: class rtePageTree extends localPageTree
63 * 417: class TBE_PageTree extends localPageTree
64 * 426: function ext_isLinkable($doktype,$uid)
65 * 438: function wrapTitle($title,$v,$ext_pArrPages)
68 * 464: class localFolderTree extends t3lib_folderTree
69 * 473: function localFolderTree()
70 * 485: function wrapTitle($title,$v)
71 * 500: function ext_isLinkable($v)
72 * 517: function PM_ATagWrap($icon,$cmd,$bMark='')
73 * 532: function printTree($treeArr='')
76 * 599: class rteFolderTree extends localFolderTree
79 * 615: class TBE_FolderTree extends localFolderTree
80 * 624: function ext_isLinkable($v)
81 * 637: function wrapTitle($title,$v)
84 * 658: class browse_links
85 * 764: function init()
86 * 1034: function processSessionData($data)
88 * SECTION: Main functions
89 * 1077: function main_rte($wiz=0)
90 * 1379: function main_db()
91 * 1424: function main_file()
93 * SECTION: Record listing
94 * 1534: function expandPage()
95 * 1615: function TBE_expandPage($tables)
97 * SECTION: File listing
98 * 1708: function expandFolder($expandFolder=0,$extensionList='')
99 * 1778: function TBE_expandFolder($expandFolder=0,$extensionList='',$noThumbs=0)
100 * 1801: function fileList($files, $folderName='', $noThumbs=0)
101 * 1918: function TBE_dragNDrop($expandFolder=0,$extensionList='')
103 * SECTION: Miscellaneous functions
104 * 2046: function isWebFolder($folder)
105 * 2057: function checkFolder($folder)
106 * 2070: function barheader($str)
107 * 2087: function getMsgBox($in_msg,$icon='icon_note')
108 * 2111: function printCurrentUrl($str)
109 * 2131: function parseCurUrl($href,$siteUrl)
110 * 2193: function uploadForm($path)
111 * 2247: function createFolder($path)
113 * TOTAL FUNCTIONS: 39
114 * (This index is automatically created/updated by the extension "extdeveval")
118 require_once (PATH_t3lib
.'class.t3lib_browsetree.php');
119 require_once (PATH_t3lib
.'class.t3lib_foldertree.php');
120 require_once (PATH_t3lib
.'class.t3lib_stdgraphic.php');
121 require_once (PATH_t3lib
.'class.t3lib_basicfilefunc.php');
125 require_once (PATH_t3lib
.'class.t3lib_page.php');
126 require_once (PATH_t3lib
.'class.t3lib_recordlist.php');
127 require_once (PATH_typo3
.'/class.db_list.inc');
128 require_once (PATH_typo3
.'/class.db_list_extra.inc');
129 require_once (PATH_t3lib
.'/class.t3lib_pagetree.php');
150 * Local version of the record list.
152 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
156 class TBE_browser_recordList
extends localRecordList
{
157 var $thisScript = 'browse_links.php';
160 * Initializes the script path
164 function TBE_browser_recordList () {
165 $this->thisScript
= t3lib_div
::getIndpEnv('SCRIPT_NAME');
169 * Creates the URL for links
171 * @param mixed If not blank string, this is used instead of $this->id as the id value.
172 * @param string If this is "-1" then $this->table is used, otherwise the value of the input variable.
173 * @param string Commalist of fields NOT to pass as parameters (currently "sortField" and "sortRev")
174 * @return string Query-string for URL
176 function listURL($altId='',$table=-1,$exclList='') {
177 return $this->thisScript
.
178 '?id='.(strcmp($altId,'')?
$altId:$this->id
).
179 '&table='.rawurlencode($table==-1?
$this->table
:$table).
180 ($this->thumbs?
'&imagemode='.$this->thumbs
:'').
181 ($this->searchString?
'&search_field='.rawurlencode($this->searchString
):'').
182 ($this->searchLevels?
'&search_levels='.rawurlencode($this->searchLevels
):'').
183 ((!$exclList ||
!t3lib_div
::inList($exclList,'sortField')) && $this->sortField?
'&sortField='.rawurlencode($this->sortField
):'').
184 ((!$exclList ||
!t3lib_div
::inList($exclList,'sortRev')) && $this->sortRev?
'&sortRev='.rawurlencode($this->sortRev
):'').
191 * Returns additional, local GET parameters to include in the links of the record list.
195 function ext_addP() {
196 $str = '&act='.$GLOBALS['SOBE']->browser
->act
.
197 '&mode='.$GLOBALS['SOBE']->browser
->mode
.
198 '&expandPage='.$GLOBALS['SOBE']->browser
->expandPage
.
199 '&bparams='.rawurlencode($GLOBALS['SOBE']->browser
->bparams
);
204 * Returns the title (based on $code) of a record (from table $table) with the proper link around (that is for "pages"-records a link to the level of that record...)
206 * @param string Table name
207 * @param integer UID (not used here)
208 * @param string Title string
209 * @param array Records array (from table name)
212 function linkWrapItems($table,$uid,$code,$row) {
213 global $TCA, $BACK_PATH;
216 $code = '<i>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</i>';
218 $code = htmlspecialchars(t3lib_div
::fixed_lgd_cs($code,$this->fixedL
));
221 $title = t3lib_BEfunc
::getRecordTitle($table,$row,FALSE,TRUE);
222 $ficon = t3lib_iconWorks
::getIcon($table,$row);
223 $aOnClick = "return insertElement('".$table."', '".$row['uid']."', 'db', ".t3lib_div
::quoteJSvalue($title).", '', '', '".$ficon."');";
224 $ATag = '<a href="#" onclick="'.$aOnClick.'">';
225 $ATag_alt = substr($ATag,0,-4).',\'\',1);">';
229 '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('addToList',1).'" alt="" />'.
237 * Returns the title (based on $code) of a table ($table) without a link
239 * @param string Table name
240 * @param string Table label
241 * @return string The linked table label
243 function linkWrapTable($table,$code) {
254 * Class which generates the page tree
256 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
260 class localPageTree
extends t3lib_browseTree
{
263 * Constructor. Just calling init()
267 function localPageTree() {
268 $this->thisScript
= t3lib_div
::getIndpEnv('SCRIPT_NAME');
272 $this->clause
= ' AND doktype!=255'.$this->clause
;
276 * Wrapping the title in a link, if applicable.
278 * @param string Title, (must be ready for output, that means it must be htmlspecialchars()'ed).
279 * @param array The record
280 * @param boolean (Ignore)
281 * @return string Wrapping title string.
283 function wrapTitle($title,$v,$ext_pArrPages='') {
284 if ($this->ext_isLinkable($v['doktype'],$v['uid'])) {
285 $aOnClick = "return link_typo3Page('".$v['uid']."');";
286 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
288 return '<span style="color: #666666;">'.$title.'</span>';
293 * Create the page navigation tree in HTML
295 * @param array Tree array
296 * @return string HTML output.
298 function printTree($treeArr='') {
300 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
301 if (!is_array($treeArr)) $treeArr=$this->tree
;
306 foreach($treeArr as $k => $v) {
308 $bgColorClass = ($c+
1)%2 ?
'bgColor' : 'bgColor-10';
309 if ($GLOBALS['SOBE']->browser
->curUrlInfo
['act']=='page' && $GLOBALS['SOBE']->browser
->curUrlInfo
['pageid']==$v['row']['uid'] && $GLOBALS['SOBE']->browser
->curUrlInfo
['pageid']) {
310 $arrCol='<td><img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
311 $bgColorClass='bgColor4';
316 $aOnClick = 'return jumpToUrl(\''.$this->thisScript
.'?act='.$GLOBALS['SOBE']->browser
->act
.'&mode='.$GLOBALS['SOBE']->browser
->mode
.'&expandPage='.$v['row']['uid'].'\');';
317 $cEbullet = $this->ext_isLinkable($v['row']['doktype'],$v['row']['uid']) ?
318 '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' :
321 <tr class="'.$bgColorClass.'">
322 <td nowrap="nowrap"'.($v['row']['_CSSCLASS'] ?
' class="'.$v['row']['_CSSCLASS'].'"' : '').'>'.
324 $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$this->ext_pArrPages
).
327 '<td>'.$cEbullet.'</td>
334 Navigation Page Tree:
336 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
343 * Returns true if a doktype can be linked.
345 * @param integer Doktype value to test
346 * @param integer uid to test.
349 function ext_isLinkable($doktype,$uid) {
350 if ($uid && $doktype<199) {
356 * Wrap the plus/minus icon in a link
358 * @param string HTML string to wrap, probably an image tag.
359 * @param string Command for 'PM' get var
360 * @param boolean If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
361 * @return string Link-wrapped input string
363 function PM_ATagWrap($icon,$cmd,$bMark='') {
365 $anchor = '#'.$bMark;
366 $name=' name="'.$bMark.'"';
368 $aOnClick = "return jumpToUrl('".$this->thisScript
.'?PM='.$cmd."','".$anchor."');";
370 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
374 * Wrapping the image tag, $icon, for the row, $row
376 * @param string The image tag for the icon
377 * @param array The row for the current element
378 * @return string The processed icon input value.
380 function wrapIcon($icon,$row) {
381 return $this->addTagAttributes($icon,' title="id='.$row['uid'].'"');
393 * Page tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
395 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
399 class rtePageTree
extends localPageTree
{
410 * For TBE record browser
412 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
416 class TBE_PageTree
extends localPageTree
{
419 * Returns true if a doktype can be linked (which is always the case here).
421 * @param integer Doktype value to test
422 * @param integer uid to test.
425 function ext_isLinkable($doktype,$uid) {
430 * Wrapping the title in a link, if applicable.
432 * @param string Title, ready for output.
433 * @param array The record
434 * @param boolean If set, pages clicked will return immediately, otherwise reload page.
435 * @return string Wrapping title string.
437 function wrapTitle($title,$v,$ext_pArrPages) {
438 if ($ext_pArrPages) {
439 $ficon=t3lib_iconWorks
::getIcon('pages',$v);
440 $onClick = "return insertElement('pages', '".$v['uid']."', 'db', ".t3lib_div
::quoteJSvalue($v['title']).", '', '', '".$ficon."','',1);";
442 $onClick = htmlspecialchars('return jumpToUrl(\''.$this->thisScript
.'?act='.$GLOBALS['SOBE']->browser
->act
.'&mode='.$GLOBALS['SOBE']->browser
->mode
.'&expandPage='.$v['uid'].'\');');
444 return '<a href="#" onclick="'.$onClick.'">'.$title.'</a>';
456 * Base extension class which generates the folder tree.
457 * Used directly by the RTE.
459 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
463 class localFolderTree
extends t3lib_folderTree
{
468 * Initializes the script path
472 function localFolderTree() {
473 $this->thisScript
= t3lib_div
::getIndpEnv('SCRIPT_NAME');
474 $this->t3lib_folderTree();
478 * Wrapping the title in a link, if applicable.
480 * @param string Title, ready for output.
481 * @param array The "record"
482 * @return string Wrapping title string.
484 function wrapTitle($title,$v) {
485 if ($this->ext_isLinkable($v)) {
486 $aOnClick = 'return jumpToUrl(\''.$this->thisScript
.'?act='.$GLOBALS['SOBE']->browser
->act
.'&mode='.$GLOBALS['SOBE']->browser
->mode
.'&expandFolder='.rawurlencode($v['path']).'\');';
487 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
489 return '<span class="typo3-dimmed">'.$title.'</span>';
494 * Returns true if the input "record" contains a folder which can be linked.
496 * @param array Array with information about the folder element. Contains keys like title, uid, path, _title
497 * @return boolean True is returned if the path is found in the web-part of the server and is NOT a recycler or temp folder
499 function ext_isLinkable($v) {
500 $webpath=t3lib_BEfunc
::getPathType_web_nonweb($v['path']); // Checking, if the input path is a web-path.
501 if (strstr($v['path'],'_recycler_') ||
strstr($v['path'],'_temp_') ||
$webpath!='web') {
508 * Wrap the plus/minus icon in a link
510 * @param string HTML string to wrap, probably an image tag.
511 * @param string Command for 'PM' get var
512 * @param boolean If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
513 * @return string Link-wrapped input string
516 function PM_ATagWrap($icon,$cmd,$bMark='') {
518 $anchor = '#'.$bMark;
519 $name=' name="'.$bMark.'"';
521 $aOnClick = 'return jumpToUrl(\''.$this->thisScript
.'?PM='.$cmd.'\',\''.$anchor.'\');';
522 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
526 * Create the folder navigation tree in HTML
528 * @param mixed Input tree array. If not array, then $this->tree is used.
529 * @return string HTML output of the tree.
531 function printTree($treeArr='') {
533 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
535 if (!is_array($treeArr)) $treeArr=$this->tree
;
540 // Preparing the current-path string (if found in the listing we will see a red blinking arrow).
541 if (!$GLOBALS['SOBE']->browser
->curUrlInfo
['value']) {
543 } else if (substr(trim($GLOBALS['SOBE']->browser
->curUrlInfo
['info']),-1)!='/') {
544 $cmpPath=PATH_site
.dirname($GLOBALS['SOBE']->browser
->curUrlInfo
['info']).'/';
546 $cmpPath=PATH_site
.$GLOBALS['SOBE']->browser
->curUrlInfo
['info'];
549 // Traverse rows for the tree and print them into table rows:
550 foreach($treeArr as $k => $v) {
552 $bgColorClass=($c+
1)%2 ?
'bgColor' : 'bgColor-10';
554 // Creating blinking arrow, if applicable:
555 if ($GLOBALS['SOBE']->browser
->curUrlInfo
['act']=='file' && $cmpPath==$v['row']['path']) {
556 $arrCol='<td><img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
557 $bgColorClass='bgColor4';
561 // Create arrow-bullet for file listing (if folder path is linkable):
562 $aOnClick = 'return jumpToUrl(\''.$this->thisScript
.'?act='.$GLOBALS['SOBE']->browser
->act
.'&mode='.$GLOBALS['SOBE']->browser
->mode
.'&expandFolder='.rawurlencode($v['row']['path']).'\');';
563 $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>' : '';
565 // Put table row with folder together:
567 <tr class="'.$bgColorClass.'">
568 <td nowrap="nowrap">'.$v['HTML'].$this->wrapTitle(t3lib_div
::fixed_lgd_cs($v['row']['title'],$titleLen),$v['row']).'</td>
570 <td>'.$cEbullet.'</td>
579 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
592 * Folder tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
594 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
598 class rteFolderTree
extends localFolderTree
{
608 * For TBE File Browser
610 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
614 class TBE_FolderTree
extends localFolderTree
{
615 var $ext_noTempRecyclerDirs=0; // If file-drag mode is set, temp and recycler folders are filtered out.
618 * Returns true if the input "record" contains a folder which can be linked.
620 * @param array Array with information about the folder element. Contains keys like title, uid, path, _title
621 * @return boolean True is returned if the path is NOT a recycler or temp folder AND if ->ext_noTempRecyclerDirs is not set.
623 function ext_isLinkable($v) {
624 if ($this->ext_noTempRecyclerDirs
&& (substr($v['path'],-7)=='_temp_/' ||
substr($v['path'],-11)=='_recycler_/')) {
630 * Wrapping the title in a link, if applicable.
632 * @param string Title, ready for output.
633 * @param array The 'record'
634 * @return string Wrapping title string.
636 function wrapTitle($title,$v) {
637 if ($this->ext_isLinkable($v)) {
638 $aOnClick = 'return jumpToUrl(\''.$this->thisScript
.'?act='.$GLOBALS['SOBE']->browser
->act
.'&mode='.$GLOBALS['SOBE']->browser
->mode
.'&expandFolder='.rawurlencode($v['path']).'\');';
639 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
641 return '<span class="typo3-dimmed">'.$title.'</span>';
651 * class for the Element Browser window.
653 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
660 var $siteURL; // Current site URL (Frontend)
661 var $thisScript; // the script to link to
662 var $thisConfig; // RTE specific TSconfig
663 var $setTarget; // Target (RTE specific)
664 var $setTitle; // title (RTE specific)
665 var $doc; // Backend template object
667 // GPvars: (Input variables from outside)
669 * The mode determines the main kind of output from the element browser.
670 * There are these options for values: rte, db, file, filedrag, wizard.
671 * "rte" will show the link selector for the Rich Text Editor (see main_rte())
672 * "db" will allow you to browse for pages or records in the page tree (for TCEforms, see main_db())
673 * "file"/"filedrag" will allow you to browse for files or folders in the folder mounts (for TCEforms, main_file())
674 * "wizard" will allow you to browse for links (like "rte") which are passed back to TCEforms (see main_rte(1))
681 * Link selector action.
682 * page,file,url,mail,spec are allowed values.
683 * These are only important with the link selector function and in that case they switch between the various menu options.
688 * When you click a page title/expand icon to see the content of a certain page, this value will contain that value (the ID of the expanded page). If the value is NOT set, then it will be restored from the module session data (see main(), mode="db")
693 * When you click a folder name/expand icon to see the content of a certain file folder, this value will contain that value (the path of the expanded file folder). If the value is NOT set, then it will be restored from the module session data (see main(), mode="file"/"filedrag"). Example value: "/www/htdocs/typo3/32/3dsplm/fileadmin/css/"
700 * TYPO3 Element Browser, wizard mode parameters. There is a heap of parameters there, better debug() them out if you need something... :-)
705 * Active with TYPO3 Element Browser: Contains the name of the form field for which this window opens - thus allows us to make references back to the main window in which the form is.
706 * Example value: "data[pages][39][bodytext]|||tt_content|" or "data[tt_content][NEW3fba56fde763d][image]|||gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai|"
709 * 0: form field name reference
712 * 3: allowed types. Eg. "tt_content" or "gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai"
714 * $pArr = explode('|',$this->bparams);
715 * $formFieldName = $pArr[0];
716 * $allowedTablesOrFileTypes = $pArr[3];
721 * Used with the Rich Text Editor.
722 * Example value: "tt_content:NEW3fba58c969f5c:bodytext:23:text:23:"
724 var $RTEtsConfigParams;
730 * Plus/Minus icon value. Used by the tree class to open/close notes on the trees.
735 * Pointer, used when browsing a long list of records etc.
743 * Used with the link selector: Contains the GET input information about the CURRENT link in the RTE/TCEform field. This consists of "href", "target" and "title" keys. This information is passed around in links.
748 * Used with the link selector: Contains a processed version of the input values from curUrlInfo. This is splitted into pageid, content element id, label value etc. This is used for the internal processing of that information.
759 * Initializes a lot of variables, setting JavaScript functions in header etc.
764 global $BE_USER,$BACK_PATH;
767 $this->pointer
= t3lib_div
::_GP('pointer');
768 $this->bparams
= t3lib_div
::_GP('bparams');
769 $this->P
= t3lib_div
::_GP('P');
770 $this->RTEtsConfigParams
= t3lib_div
::_GP('RTEtsConfigParams');
771 $this->expandPage
= t3lib_div
::_GP('expandPage');
772 $this->expandFolder
= t3lib_div
::_GP('expandFolder');
773 $this->PM
= t3lib_div
::_GP('PM');
776 $this->mode
=t3lib_div
::_GP('mode');
782 $this->siteURL
= t3lib_div
::getIndpEnv('TYPO3_SITE_URL'); // Current site url
784 // the script to link to
785 $this->thisScript
= t3lib_div
::getIndpEnv('SCRIPT_NAME');
787 // CurrentUrl - the current link url must be passed around if it exists
788 if ($this->mode
=='wizard') {
789 $currentLinkParts = t3lib_div
::trimExplode(' ',$this->P
['currentValue']);
790 $this->curUrlArray
= array(
791 'target' => $currentLinkParts[1]
793 $this->curUrlInfo
=$this->parseCurUrl($this->siteURL
.'?id='.$currentLinkParts[0],$this->siteURL
);
795 $this->curUrlArray
= t3lib_div
::_GP('curUrl');
796 if ($this->curUrlArray
['all']) {
797 $this->curUrlArray
=t3lib_div
::get_tag_attributes($this->curUrlArray
['all']);
799 $this->curUrlInfo
=$this->parseCurUrl($this->curUrlArray
['href'],$this->siteURL
);
802 // Determine nature of current url:
803 $this->act
=t3lib_div
::_GP('act');
805 $this->act
=$this->curUrlInfo
['act'];
808 // Rich Text Editor specific configuration:
810 if ((string)$this->mode
=='rte') {
811 $RTEtsConfigParts = explode(':',$this->RTEtsConfigParams
);
812 $addPassOnParams.='&RTEtsConfigParams='.rawurlencode($this->RTEtsConfigParams
);
813 $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc
::getPagesTSconfig($RTEtsConfigParts[5]));
814 $this->thisConfig
= t3lib_BEfunc
::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
817 // Initializing the target value (RTE)
818 $this->setTarget
= $this->curUrlArray
['target'];
819 if ($this->thisConfig
['defaultLinkTarget'] && !isset($this->curUrlArray
['target'])) {
820 $this->setTarget
=$this->thisConfig
['defaultLinkTarget'];
823 // Initializing the title value (RTE)
824 $this->setTitle
= $this->curUrlArray
['title'];
828 // Creating backend template object:
829 $this->doc
= t3lib_div
::makeInstance('template');
830 $this->doc
->docType
= 'xhtml_trans';
831 $this->doc
->backPath
= $BACK_PATH;
833 // BEGIN accumulation of header JavaScript:
836 // This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...
837 var add_href="'.($this->curUrlArray
['href']?
'&curUrl[href]='.rawurlencode($this->curUrlArray
['href']):'').'";
838 var add_target="'.($this->setTarget?
'&curUrl[target]='.rawurlencode($this->setTarget
):'').'";
839 var add_title="'.($this->setTitle?
'&curUrl[title]='.rawurlencode($this->setTitle
):'').'";
840 var add_params="'.($this->bparams?
'&bparams='.rawurlencode($this->bparams
):'').'";
842 var cur_href="'.($this->curUrlArray
['href']?
$this->curUrlArray
['href']:'').'";
843 var cur_target="'.($this->setTarget?
$this->setTarget
:'').'";
844 var cur_title="'.($this->setTitle?
$this->setTitle
:'').'";
846 function setTarget(target) { //
848 add_target="&curUrl[target]="+escape(target);
850 function setTitle(title) { //
852 add_title="&curUrl[title]="+escape(title);
854 function setValue(value) { //
856 add_href="&curUrl[href]="+value;
861 if ($this->mode
=='wizard') { // Functions used, if the link selector is in wizard mode (= TCEforms fields)
862 unset($this->P
['fieldChangeFunc']['alert']);
863 reset($this->P
['fieldChangeFunc']);
865 while(list($k,$v)=each($this->P
['fieldChangeFunc'])) {
871 $P2['itemName']=$this->P
['itemName'];
872 $P2['formName']=$this->P
['formName'];
873 $P2['fieldChangeFunc']=$this->P
['fieldChangeFunc'];
874 $addPassOnParams.=t3lib_div
::implodeArrayForUrl('P',$P2);
877 function link_typo3Page(id,anchor) { //
878 updateValueInMainForm(id+(anchor?anchor:"")+" "+cur_target);
882 function link_folder(folder) { //
883 updateValueInMainForm(folder+" "+cur_target);
887 function link_current() { //
888 if (cur_href!="http://" && cur_href!="mailto:") {
889 var setValue = cur_href+" "+cur_target+" "+cur_title;
890 if (setValue.substr(0,7)=="http://") setValue = setValue.substr(7);
891 if (setValue.substr(0,7)=="mailto:") setValue = setValue.substr(7);
892 updateValueInMainForm(setValue);
897 function checkReference() { //
898 if (window.opener && window.opener.document && window.opener.document.'.$this->P
['formName'].' && window.opener.document.'.$this->P
['formName'].'["'.$this->P
['itemName'].'"] ) {
899 return window.opener.document.'.$this->P
['formName'].'["'.$this->P
['itemName'].'"];
904 function updateValueInMainForm(input) { //
905 var field = checkReference();
912 } else { // Functions used, if the link selector is in RTE mode:
914 function link_typo3Page(id,anchor) { //
915 var theLink = \''.$this->siteURL
.'?id=\'+id+(anchor?anchor:"");
916 self.parent.parent.renderPopup_addLink(theLink,cur_target,cur_title);
919 function link_folder(folder) { //
920 var theLink = \''.$this->siteURL
.'\'+folder;
921 self.parent.parent.renderPopup_addLink(theLink,cur_target,cur_title);
924 function link_spec(theLink) { //
925 self.parent.parent.renderPopup_addLink(theLink,cur_target,cur_title);
928 function link_current() { //
929 if (cur_href!="http://" && cur_href!="mailto:") {
930 self.parent.parent.renderPopup_addLink(cur_href,cur_target,cur_title);
937 // General "jumpToUrl" function:
939 function jumpToUrl(URL,anchor) { //
940 var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act
.'" : "";
941 var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$this->mode
.'" : "";
942 var theLocation = URL+add_act+add_mode+add_href+add_target+add_title+add_params'.($addPassOnParams?
'+"'.$addPassOnParams.'"':'').'+(anchor?anchor:"");
943 window.location.href = theLocation;
949 // This is JavaScript especially for the TBE Element Browser!
950 $pArr = explode('|',$this->bparams
);
951 $formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';
956 function launchView(url) { //
957 var thePreviewWindow="";
958 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");
959 if (thePreviewWindow && thePreviewWindow.focus) {
960 thePreviewWindow.focus();
963 function setReferences() { //
964 if (parent.window.opener
965 && parent.window.opener.content
966 && parent.window.opener.content.document.editform
967 && parent.window.opener.content.document.editform["'.$formFieldName.'"]
969 targetDoc = parent.window.opener.content.document;
970 elRef = targetDoc.editform["'.$formFieldName.'"];
976 function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close) { //
977 if (1=='.($pArr[0]&&!$pArr[1]&&!$pArr[2] ?
1 : 0).') {
978 addElement(filename,table+"_"+uid,fp,close);
980 if (setReferences()) {
981 parent.window.opener.group_change("add","'.$pArr[0].'","'.$pArr[1].'","'.$pArr[2].'",elRef,targetDoc);
983 alert("Error - reference to main window is not set properly!");
986 parent.window.opener.focus();
992 function addElement(elName,elValue,altElValue,close) { //
993 if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin) {
994 parent.window.opener.setFormValueFromBrowseWin("'.$pArr[0].'",altElValue?altElValue:elValue,elName);
996 parent.window.opener.focus();
1000 alert("Error - reference to main window is not set properly!");
1006 // Finally, add the accumulated JavaScript to the template object:
1007 $this->doc
->JScode
= $this->doc
->wrapScriptTags($JScode);
1010 if (FALSE) debug(array(
1011 'pointer' => $this->pointer
,
1012 'act' => $this->act
,
1013 'mode' => $this->mode
,
1014 'curUrlInfo' => $this->curUrlInfo
,
1015 'curUrlArray' => $this->curUrlArray
,
1017 'bparams' => $this->bparams
,
1018 'RTEtsConfigParams' => $this->RTEtsConfigParams
,
1019 'expandPage' => $this->expandPage
,
1020 'expandFolder' => $this->expandFolder
,
1022 ),'Internal variables of Script Class:');
1027 * Session data for this class can be set from outside with this method.
1030 * @param array Session data array
1031 * @return array Session data and boolean which indicates that data needs to be stored in session because it's changed
1033 function processSessionData($data) {
1036 switch((string)$this->mode
) {
1038 if (isset($this->expandPage
)) {
1039 $data['expandPage']=$this->expandPage
;
1042 $this->expandPage
=$data['expandPage'];
1047 if (isset($this->expandFolder
)) {
1048 $data['expandFolder']=$this->expandFolder
;
1051 $this->expandFolder
=$data['expandFolder'];
1056 return array($data, $store);
1062 /******************************************************************
1066 ******************************************************************/
1069 * Rich Text Editor (RTE) link selector (MAIN function)
1070 * Generates the link selector for the Rich Text Editor.
1071 * Can also be used to select links for the TCEforms (see $wiz)
1073 * @param boolean If set, the "remove link" is not shown in the menu: Used for the "Select link" wizard which is used by the TCEforms
1074 * @return string Modified content variable.
1076 function main_rte($wiz=0) {
1077 global $LANG, $BACK_PATH;
1079 // Starting content:
1080 $content=$this->doc
->startPage('RTE link');
1082 // Initializing the action value, possibly removing blinded values etc:
1083 $allowedItems = array_diff(explode(',','page,file,url,mail,spec'),t3lib_div
::trimExplode(',',$this->thisConfig
['blindLinkOptions'],1));
1084 reset($allowedItems);
1085 if (!in_array($this->act
,$allowedItems)) $this->act
= current($allowedItems);
1087 // Making menu in top:
1090 $menuDef['removeLink']['isActive'] = $this->act
=='removeLink';
1091 $menuDef['removeLink']['label'] = $LANG->getLL('removeLink',1);
1092 $menuDef['removeLink']['url'] = '#';
1093 $menuDef['removeLink']['addParams'] = 'onclick="self.parent.parent.renderPopup_unLink();return false;"';
1095 if (in_array('page',$allowedItems)) {
1096 $menuDef['page']['isActive'] = $this->act
=='page';
1097 $menuDef['page']['label'] = $LANG->getLL('page',1);
1098 $menuDef['page']['url'] = '#';
1099 $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page\');return false;"';
1101 if (in_array('file',$allowedItems)){
1102 $menuDef['file']['isActive'] = $this->act
=='file';
1103 $menuDef['file']['label'] = $LANG->getLL('file',1);
1104 $menuDef['file']['url'] = '#';
1105 $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file\');return false;"';
1107 if (in_array('url',$allowedItems)) {
1108 $menuDef['url']['isActive'] = $this->act
=='url';
1109 $menuDef['url']['label'] = $LANG->getLL('extUrl',1);
1110 $menuDef['url']['url'] = '#';
1111 $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url\');return false;"';
1113 if (in_array('mail',$allowedItems)) {
1114 $menuDef['mail']['isActive'] = $this->act
=='mail';
1115 $menuDef['mail']['label'] = $LANG->getLL('email',1);
1116 $menuDef['mail']['url'] = '#';
1117 $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail\');return false;"';
1119 if (is_array($this->thisConfig
['userLinks.']) && in_array('spec',$allowedItems)) {
1120 $menuDef['spec']['isActive'] = $this->act
=='spec';
1121 $menuDef['spec']['label'] = $LANG->getLL('special',1);
1122 $menuDef['spec']['url'] = '#';
1123 $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec\');return false;"';
1125 $content .= $this->doc
->getTabMenuRaw($menuDef);
1127 // Adding the menu and header to the top of page:
1128 $content.=$this->printCurrentUrl($this->curUrlInfo
['info']).'<br />';
1131 // Depending on the current action we will create the actual module content for selecting a link:
1132 switch($this->act
) {
1139 <form action="" name="lurlform" id="lurlform">
1140 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail">
1142 <td>'.$GLOBALS['LANG']->getLL('emailAddress',1).':</td>
1143 <td><input type="text" name="lemail"'.$this->doc
->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo
['act']=='mail'?
$this->curUrlInfo
['info']:'').'" /> '.
1144 '<input type="submit" value="'.$GLOBALS['LANG']->getLL('setLink',1).'" onclick="setTarget(\'\');setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td>
1156 <form action="" name="lurlform" id="lurlform">
1157 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL">
1160 <td><input type="text" name="lurl"'.$this->doc
->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo
['act']=='url'?
$this->curUrlInfo
['info']:'http://').'" /> '.
1161 '<input type="submit" value="'.$GLOBALS['LANG']->getLL('setLink',1).'" onclick="setValue(document.lurlform.lurl.value); return link_current();" /></td>
1168 $foldertree = t3lib_div
::makeInstance('rteFolderTree');
1169 $foldertree->thisScript
= $this->thisScript
;
1170 $tree=$foldertree->getBrowsableTree();
1172 if (!$this->curUrlInfo
['value'] ||
$this->curUrlInfo
['act']!='file') {
1174 } elseif (substr(trim($this->curUrlInfo
['info']),-1)!='/') {
1175 $cmpPath=PATH_site
.dirname($this->curUrlInfo
['info']).'/';
1176 if (!isset($this->expandFolder
)) $this->expandFolder
= $cmpPath;
1178 $cmpPath=PATH_site
.$this->curUrlInfo
['info'];
1181 list(,,$specUid) = explode('_',$this->PM
);
1182 $files = $this->expandFolder($foldertree->specUIDmap
[$specUid]);
1187 Wrapper table for folder tree / file list:
1189 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkFiles">
1191 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
1192 <td class="c-wCell" valign="top">'.$files.'</td>
1198 if (is_array($this->thisConfig
['userLinks.'])) {
1200 $v=$this->thisConfig
['userLinks.'];
1202 while(list($k2)=each($v)) {
1204 if (substr($k2,-1)=='.' && is_array($v[$k2i.'.'])) {
1207 $title = trim($v[$k2i]);
1209 $title=$v[$k2i.'.']['url'];
1211 $title=$LANG->sL($title);
1214 $description=$v[$k2i.'.']['description'] ?
$LANG->sL($v[$k2i.'.']['description'],1).'<br />' : '';
1216 // URL + onclick event:
1218 if (isset($v[$k2i.'.']['target'])) $onClickEvent.="setTarget('".$v[$k2i.'.']['target']."');";
1219 $v[$k2i.'.']['url'] = str_replace('###_URL###',$this->siteURL
,$v[$k2i.'.']['url']);
1220 if (substr($v[$k2i.'.']['url'],0,7)=='http://' ||
substr($v[$k2i.'.']['url'],0,7)=='mailto:') {
1221 $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();";
1223 $onClickEvent.="link_spec(unescape('".$this->siteURL
.rawurlencode($v[$k2i.'.']['url'])."'));";
1227 $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>');
1229 // Adding link to menu of user defined links:
1232 <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>
1240 // Add menu to content:
1244 Special userdefined menu:
1246 <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
1248 <td class="bgColor5" class="c-wCell" valign="top"><strong>'.$LANG->getLL('special',1).'</strong></td>
1250 '.implode('',$subcats).'
1257 $pagetree = t3lib_div
::makeInstance('rtePageTree');
1258 $pagetree->thisScript
= $this->thisScript
;
1259 $tree=$pagetree->getBrowsableTree();
1260 $cElements = $this->expandPage();
1264 Wrapper table for page tree / record list:
1266 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages">
1268 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
1269 <td class="c-wCell" valign="top">'.$cElements.'</td>
1281 Selecting title for link:
1283 <form action="" name="ltitleform" id="ltargetform">
1284 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
1286 <td>'.$GLOBALS['LANG']->getLL('title',1).'</td>
1287 <td><input type="text" name="ltitle" onchange="setTitle(this.value);" value="'.htmlspecialchars($this->setTitle
).'"'.$this->doc
->formWidth(10).' /></td>
1288 <td><input type="submit" value="'.$GLOBALS['LANG']->getLL('update',1).'" onclick="return link_current();" /></td>
1295 if ($this->act
!='mail') {
1301 Selecting target for link:
1303 <form action="" name="ltargetform" id="ltargetform">
1304 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
1306 <td>'.$GLOBALS['LANG']->getLL('target',1).':</td>
1307 <td><input type="text" name="ltarget" onchange="setTarget(this.value);" value="'.htmlspecialchars($this->setTarget
).'"'.$this->doc
->formWidth(10).' /></td>
1309 <select name="ltarget_type" onchange="setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
1311 <option value="_top">'.$GLOBALS['LANG']->getLL('top',1).'</option>
1312 <option value="_blank">'.$GLOBALS['LANG']->getLL('newWindow',1).'</option>
1317 if (($this->curUrlInfo
['act']=="page" ||
$this->curUrlInfo
['act']=='file') && $this->curUrlArray
['href']) {
1319 <input type="submit" value="'.$GLOBALS['LANG']->getLL('update',1).'" onclick="return link_current();" />';
1323 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) {
1324 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;
1325 setTarget(document.ltargetform.ltarget.value);
1326 setTitle(document.ltitleform.ltitle.value);
1327 document.ltargetform.popup_width.selectedIndex=0;
1328 document.ltargetform.popup_height.selectedIndex=0;
1335 <td>'.$GLOBALS['LANG']->getLL('target_popUpWindow',1).':</td>
1337 <select name="popup_width" onchange="'.htmlspecialchars($selectJS).'">
1338 <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_width',1).'</option>
1339 <option value="300">300</option>
1340 <option value="400">400</option>
1341 <option value="500">500</option>
1342 <option value="600">600</option>
1343 <option value="700">700</option>
1344 <option value="800">800</option>
1347 <select name="popup_height" onchange="'.htmlspecialchars($selectJS).'">
1348 <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_height',1).'</option>
1349 <option value="200">200</option>
1350 <option value="300">300</option>
1351 <option value="400">400</option>
1352 <option value="500">500</option>
1353 <option value="600">600</option>
1360 // Add "target selector" box to content:
1364 $content.='<br /><br />';
1367 // End page, return content:
1368 $content.= $this->doc
->endPage();
1369 $content = $this->doc
->insertStylesAndJS($content);
1374 * TYPO3 Element Browser: Showing a page tree and allows you to browse for records
1376 * @return string HTML content for the module
1378 function main_db() {
1380 // Starting content:
1381 $content=$this->doc
->startPage('TBE file selector');
1384 $pArr = explode('|',$this->bparams
);
1386 // Making the browsable pagetree:
1387 $pagetree = t3lib_div
::makeInstance('TBE_PageTree');
1388 $pagetree->thisScript
=$this->thisScript
;
1389 $pagetree->ext_pArrPages
= !strcmp($pArr[3],'pages')?
1:0;
1390 $tree=$pagetree->getBrowsableTree();
1392 // Making the list of elements, if applicable:
1393 $cElements = $this->TBE_expandPage($pArr[3]);
1395 // Putting the things together, side by side:
1399 Wrapper table for page tree / record list:
1401 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBrecords">
1403 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
1404 <td class="c-wCell" valign="top">'.$cElements.'</td>
1410 $content.='<br /><br />';
1412 // End page, return content:
1413 $content.= $this->doc
->endPage();
1414 $content = $this->doc
->insertStylesAndJS($content);
1419 * TYPO3 Element Browser: Showing a folder tree, allowing you to browse for files.
1421 * @return string HTML content for the module
1423 function main_file() {
1426 // Starting content:
1427 $content.=$this->doc
->startPage('TBE file selector');
1430 $pArr = explode('|',$this->bparams
);
1432 // Create upload/create folder forms, if a path is given:
1433 $fileProcessor = t3lib_div
::makeInstance('t3lib_basicFileFunctions');
1434 $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
1435 $path=$this->expandFolder
;
1436 if (!$path ||
!@is_dir
($path)) {
1437 $path = $fileProcessor->findTempFolder().'/'; // The closest TEMP-path is found
1439 if ($path!='/' && @is_dir
($path)) {
1440 $uploadForm=$this->uploadForm($path);
1441 $createFolder=$this->createFolder($path);
1446 if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) $content.=$uploadForm;
1448 // Getting flag for showing/not showing thumbnails:
1449 $noThumbs = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
1452 // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
1453 $_MOD_MENU = array('displayThumbs' => '');
1454 $_MCONF['name']='file_list';
1455 $_MOD_SETTINGS = t3lib_BEfunc
::getModuleData($_MOD_MENU, t3lib_div
::_GP('SET'), $_MCONF['name']);
1456 $addParams = '&act='.$this->act
.'&mode='.$this->mode
.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams
);
1457 $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);
1461 $noThumbs = $noThumbs ?
$noThumbs : !$_MOD_SETTINGS['displayThumbs'];
1463 // Create folder tree:
1464 $foldertree = t3lib_div
::makeInstance('TBE_FolderTree');
1465 $foldertree->thisScript
=$this->thisScript
;
1466 $foldertree->ext_noTempRecyclerDirs
= ($this->mode
== 'filedrag');
1467 $tree=$foldertree->getBrowsableTree();
1469 list(,,$specUid) = explode('_',$this->PM
);
1471 if ($this->mode
=='filedrag') {
1472 $files = $this->TBE_dragNDrop($foldertree->specUIDmap
[$specUid],$pArr[3]);
1474 $files = $this->TBE_expandFolder($foldertree->specUIDmap
[$specUid],$pArr[3],$noThumbs);
1477 // Putting the parts together, side by side:
1481 Wrapper table for folder tree / file list:
1483 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles">
1485 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
1486 <td class="c-wCell" valign="top">'.$files.'</td>
1490 $content.= $thumbNailCheck;
1492 // Adding create folder + upload forms if applicable:
1493 if (!$BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) $content.=$uploadForm;
1494 if ($BE_USER->isAdmin() ||
$BE_USER->getTSConfigVal('options.createFoldersInEB')) $content.=$createFolder;
1497 $content.='<br /><br />';
1499 // Ending page, returning content:
1500 $content.= $this->doc
->endPage();
1501 $content = $this->doc
->insertStylesAndJS($content);
1523 /******************************************************************
1527 ******************************************************************/
1529 * For RTE: This displays all content elements on a page and lets you create a link to the element.
1531 * @return string HTML output. Returns content only if the ->expandPage value is set (pointing to a page uid to show tt_content records from ...)
1533 function expandPage() {
1534 global $BE_USER, $BACK_PATH;
1537 $expPageId = $this->expandPage
; // Set page id (if any) to expand
1539 // If there is an anchor value (content element reference) in the element reference, then force an ID to expand:
1540 if (!$this->expandPage
&& $this->curUrlInfo
['cElement']) {
1541 $expPageId = $this->curUrlInfo
['pageid']; // Set to the current link page id.
1544 // Draw the record list IF there is a page id to expand:
1545 if ($expPageId && t3lib_div
::testInt($expPageId) && $BE_USER->isInWebMount($expPageId)) {
1548 $out.=$this->barheader($GLOBALS['LANG']->getLL('contentElements').':');
1550 // Create header for listing, showing the page title/icon:
1551 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
1552 $mainPageRec = t3lib_BEfunc
::getRecordWSOL('pages',$expPageId);
1553 $picon=t3lib_iconWorks
::getIconImage('pages',$mainPageRec,'','');
1554 $picon.= htmlspecialchars(t3lib_div
::fixed_lgd_cs($mainPageRec['title'],$titleLen));
1555 $out.=$picon.'<br />';
1557 // Look up tt_content elements from the expanded page:
1558 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1559 'uid,header,hidden,starttime,endtime,fe_group,CType,colpos,bodytext',
1561 'pid='.intval($expPageId).
1562 t3lib_BEfunc
::deleteClause('tt_content').
1563 t3lib_BEfunc
::versioningPlaceholderClause('tt_content'),
1567 $cc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
1569 // Traverse list of records:
1571 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1573 $icon=t3lib_iconWorks
::getIconImage('tt_content',$row,$BACK_PATH,'');
1574 if ($this->curUrlInfo
['act']=='page' && $this->curUrlInfo
['cElement']==$row['uid']) {
1575 $arrCol='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
1579 // Putting list element HTML together:
1580 $out.='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?
'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
1582 '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.$row['uid'].'\');">'.
1584 htmlspecialchars(t3lib_div
::fixed_lgd_cs($row['header'],$titleLen)).
1587 // Finding internal anchor points:
1588 if (t3lib_div
::inList('text,textpic', $row['CType'])) {
1589 $split = preg_split('/(<a[^>]+name=[\'"]?([^"\'>[:space:]]+)[\'"]?[^>]*>)/i', $row['bodytext'], -1, PREG_SPLIT_DELIM_CAPTURE
);
1591 foreach($split as $skey => $sval) {
1593 // Putting list element HTML together:
1594 $sval = substr($sval,0,100);
1595 $out.='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/ol/line.gif','width="18" height="16"').' alt="" />'.
1596 '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/ol/join'.($skey+
3>count($split)?
'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
1597 '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.rawurlencode($sval).'\');">'.
1598 htmlspecialchars(' <A> '.$sval).
1609 * For TYPO3 Element Browser: This lists all content elements from the given list of tables
1611 * @param string Commalist of tables. Set to "*" if you want all tables.
1612 * @return string HTML output.
1614 function TBE_expandPage($tables) {
1615 global $TCA,$BE_USER, $BACK_PATH;
1618 if ($this->expandPage
>=0 && t3lib_div
::testInt($this->expandPage
) && $BE_USER->isInWebMount($this->expandPage
)) {
1620 // Set array with table names to list:
1621 if (!strcmp(trim($tables),'*')) {
1622 $tablesArr = array_keys($TCA);
1624 $tablesArr = t3lib_div
::trimExplode(',',$tables,1);
1628 // Headline for selecting records:
1629 $out.=$this->barheader($GLOBALS['LANG']->getLL('selectRecords').':');
1631 // Create the header, showing the current page for which the listing is. Includes link to the page itself, if pages are amount allowed tables.
1632 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
1633 $mainPageRec = t3lib_BEfunc
::getRecordWSOL('pages',$this->expandPage
);
1637 if (in_array('pages',$tablesArr)) {
1638 $ficon=t3lib_iconWorks
::getIcon('pages',$mainPageRec);
1639 $ATag="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', ".t3lib_div
::quoteJSvalue($mainPageRec['title']).", '', '', '".$ficon."','',1);\">";
1640 $ATag2="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', ".t3lib_div
::quoteJSvalue($mainPageRec['title']).", '', '', '".$ficon."','',0);\">";
1641 $ATag_alt=substr($ATag,0,-4).",'',1);\">";
1644 $picon=t3lib_iconWorks
::getIconImage('pages',$mainPageRec,$BACK_PATH,'');
1645 $pBicon=$ATag2?
'<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' alt="" />':'';
1646 $pText=htmlspecialchars(t3lib_div
::fixed_lgd_cs($mainPageRec['title'],$titleLen));
1647 $out.=$picon.$ATag2.$pBicon.$ATag_e.$ATag.$pText.$ATag_e.'<br />';
1649 // Initialize the record listing:
1650 $id = $this->expandPage
;
1651 $pointer = t3lib_div
::intInRange($this->pointer
,0,100000);
1652 $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
1653 $pageinfo = t3lib_BEfunc
::readPageAccess($id,$perms_clause);
1656 // Generate the record list:
1657 $dblist = t3lib_div
::makeInstance('TBE_browser_recordList');
1658 $dblist->thisScript
=$this->thisScript
;
1659 $dblist->backPath
= $GLOBALS['BACK_PATH'];
1660 $dblist->thumbs
= 0;
1661 $dblist->calcPerms
= $GLOBALS['BE_USER']->calcPerms($pageinfo);
1662 $dblist->noControlPanels
=1;
1663 $dblist->clickMenuEnabled
=0;
1664 $dblist->tableList
=implode(',',$tablesArr);
1666 $dblist->start($id,t3lib_div
::_GP('table'),$pointer,
1667 t3lib_div
::_GP('search_field'),
1668 t3lib_div
::_GP('search_levels'),
1669 t3lib_div
::_GP('showLimit')
1671 $dblist->setDispFields();
1672 $dblist->generateList();
1673 $dblist->writeBottom();
1675 // Add the HTML for the record list to output variable:
1676 $out.=$dblist->HTMLcode
;
1677 $out.=$dblist->getSearchBox();
1680 // Return accumulated content:
1695 /******************************************************************
1699 ******************************************************************/
1701 * For RTE: This displays all files from folder. No thumbnails shown
1703 * @param string The folder path to expand
1704 * @param string List of fileextensions to show
1705 * @return string HTML output
1707 function expandFolder($expandFolder=0,$extensionList='') {
1710 $expandFolder = $expandFolder ?
$expandFolder : $this->expandFolder
;
1712 if ($expandFolder && $this->checkFolder($expandFolder)) {
1714 // Create header for filelisting:
1715 $out.=$this->barheader($GLOBALS['LANG']->getLL('files').':');
1717 // Prepare current path value for comparison (showing red arrow)
1718 if (!$this->curUrlInfo
['value']) {
1721 $cmpPath=PATH_site
.$this->curUrlInfo
['info'];
1725 // Create header element; The folder from which files are listed.
1726 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
1727 $picon='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
1728 $picon.=htmlspecialchars(t3lib_div
::fixed_lgd_cs(basename($expandFolder),$titleLen));
1729 $picon='<a href="#" onclick="return link_folder(\''.t3lib_div
::rawUrlEncodeFP(substr($expandFolder,strlen(PATH_site
))).'\');">'.$picon.'</a>';
1730 $out.=$picon.'<br />';
1732 // Get files from the folder:
1733 $files = t3lib_div
::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order='')
1737 if (is_array($files)) {
1738 foreach($files as $filepath) {
1740 $fI=pathinfo($filepath);
1743 $icon = t3lib_BEfunc
::getFileIcon(strtolower($fI['extension']));
1745 // If the listed file turns out to be the CURRENT file, then show blinking arrow:
1746 if ($this->curUrlInfo
['act']=="file" && $cmpPath==$filepath) {
1747 $arrCol='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
1752 // Get size and icon:
1753 $size=' ('.t3lib_div
::formatSize(filesize($filepath)).'bytes)';
1754 $icon = '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/fileicons/'.$icon.'','width="18" height="16"').' title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
1756 // Put it all together for the file element:
1757 $out.='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?
'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
1759 '<a href="#" onclick="return link_folder(\''.t3lib_div
::rawUrlEncodeFP(substr($filepath,strlen(PATH_site
))).'\');">'.
1761 htmlspecialchars(t3lib_div
::fixed_lgd_cs(basename($filepath),$titleLen)).
1770 * For TYPO3 Element Browser: Expand folder of files.
1772 * @param string The folder path to expand
1773 * @param string List of fileextensions to show
1774 * @param boolean Whether to show thumbnails or not. If set, no thumbnails are shown.
1775 * @return string HTML output
1777 function TBE_expandFolder($expandFolder=0,$extensionList='',$noThumbs=0) {
1780 $expandFolder = $expandFolder ?
$expandFolder : $this->expandFolder
;
1782 if ($expandFolder && $this->checkFolder($expandFolder)) {
1783 // Listing the files:
1784 $files = t3lib_div
::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order='')
1785 $out.= $this->fileList($files, $expandFolder, $noThumbs);
1788 // Return accumulated content for filelisting:
1793 * Render list of files.
1795 * @param array List of files. See t3lib_div::getFilesInDir
1796 * @param string If set a header with a folder icon and folder name are shown
1797 * @param boolean Whether to show thumbnails or not. If set, no thumbnails are shown.
1798 * @return string HTML output
1800 function fileList($files, $folderName='', $noThumbs=0) {
1801 global $LANG, $BACK_PATH;
1805 // Listing the files:
1806 if (is_array($files)) {
1808 // Create headline (showing number of files):
1809 $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files)));
1811 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
1813 // Create the header of current folder:
1815 $picon='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
1816 $picon.=htmlspecialchars(t3lib_div
::fixed_lgd_cs(basename($folderName),$titleLen));
1817 $out.=$picon.'<br />';
1820 // Init graphic object for reading file dimensions:
1821 $imgObj = t3lib_div
::makeInstance('t3lib_stdGraphic');
1823 $imgObj->mayScaleUp
=0;
1824 $imgObj->tempPath
=PATH_site
.$imgObj->tempPath
;
1826 // Traverse the file list:
1828 foreach($files as $filepath) {
1829 $fI=pathinfo($filepath);
1831 // Thumbnail/size generation:
1832 if (t3lib_div
::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],$fI['extension']) && !$noThumbs) {
1833 $imgInfo = $imgObj->getImageDimensions($filepath);
1834 $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
1835 $clickIcon = t3lib_BEfunc
::getThumbNail($BACK_PATH.'thumbs.php',$filepath,'hspace="5" vspace="5" border="1"');
1841 // Create file icon:
1842 $ficon = t3lib_BEfunc
::getFileIcon(strtolower($fI['extension']));
1843 $size=' ('.t3lib_div
::formatSize(filesize($filepath)).'bytes'.($pDim?
', '.$pDim:'').')';
1844 $icon = '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/fileicons/'.$ficon,'width="18" height="16"').' title="'.htmlspecialchars($fI['basename'].$size).'" class="absmiddle" alt="" />';
1846 // Create links for adding the file:
1847 if (strstr($filepath,',') ||
strstr($filepath,'|')) { // In case an invalid character is in the filepath, display error message:
1848 $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
1849 $ATag = $ATag_alt = "<a href=\"#\" onclick=\"alert(".$eMsg.");return false;\">";
1850 } else { // If filename is OK, just add it:
1851 $ATag = "<a href=\"#\" onclick=\"return insertElement('','".t3lib_div
::shortMD5($filepath)."', 'file', ".t3lib_div
::quoteJSvalue($fI['basename']).", ".t3lib_div
::quoteJSvalue($filepath).", '".$fI['extension']."', '".$ficon."');\">";
1852 $ATag_alt = substr($ATag,0,-4).",'',1);\">";
1856 // Create link to showing details about the file in a window:
1857 $Ahref = $BACK_PATH.'show_item.php?table='.rawurlencode($filepath).'&returnUrl='.rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI'));
1858 $ATag2='<a href="'.htmlspecialchars($Ahref).'">';
1861 // Combine the stuff:
1862 $filenameAndIcon=$ATag_alt.$icon.htmlspecialchars(t3lib_div
::fixed_lgd_cs(basename($filepath),$titleLen)).$ATag_e;
1865 if ($pDim) { // Image...
1867 <tr class="bgColor4">
1868 <td nowrap="nowrap">'.$filenameAndIcon.' </td>
1869 <td>'.$ATag.'<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
1870 <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>
1871 <td nowrap="nowrap"> '.$pDim.'</td>
1875 <td colspan="4">'.$ATag_alt.$clickIcon.$ATag_e.'</td>
1879 <tr class="bgColor4">
1880 <td nowrap="nowrap">'.$filenameAndIcon.' </td>
1881 <td>'.$ATag.'<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
1882 <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>
1888 <td colspan="3"><img src="clear.gif" width="1" height="3" alt="" /></td>
1892 // Wrap all the rows in table tags:
1900 <table border="0" cellpadding="0" cellspacing="1" id="typo3-fileList">
1901 '.implode('',$lines).'
1905 // Return accumulated content for filelisting:
1910 * For RTE: This displays all IMAGES (gif,png,jpg) (from extensionList) from folder. Thumbnails are shown for images.
1911 * This listing is of images located in the web-accessible paths ONLY - the listing is for drag-n-drop use in the RTE
1913 * @param string The folder path to expand
1914 * @param string List of fileextensions to show
1915 * @return string HTML output
1917 function TBE_dragNDrop($expandFolder=0,$extensionList='') {
1920 $expandFolder = $expandFolder ?
$expandFolder : $this->expandFolder
;
1922 if ($expandFolder && $this->checkFolder($expandFolder)) {
1923 if ($this->isWebFolder($expandFolder)) {
1925 // Read files from directory:
1926 $files = t3lib_div
::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order='')
1927 if (is_array($files)) {
1928 $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files)));
1930 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
1931 $picon='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
1932 $picon.=htmlspecialchars(t3lib_div
::fixed_lgd_cs(basename($expandFolder),$titleLen));
1933 $out.=$picon.'<br />';
1938 // Add "drag-n-drop" message:
1941 <td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
1945 while(list(,$filepath)=each($files)) {
1946 $fI=pathinfo($filepath);
1949 $iurl = $this->siteURL
.t3lib_div
::rawurlencodeFP(substr($filepath,strlen(PATH_site
)));
1951 // Show only web-images
1952 if (t3lib_div
::inList('gif,jpeg,jpg,png',$fI['extension'])) {
1953 $imgInfo = @getimagesize
($filepath);
1954 $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
1956 $ficon = t3lib_BEfunc
::getFileIcon(strtolower($fI['extension']));
1957 $size=' ('.t3lib_div
::formatSize(filesize($filepath)).'bytes'.($pDim?
', '.$pDim:'').')';
1958 $icon = '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/fileicons/'.$ficon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
1959 $filenameAndIcon=$icon.htmlspecialchars(t3lib_div
::fixed_lgd_cs(basename($filepath),$titleLen));
1961 if (t3lib_div
::_GP('noLimit')) {
1971 $IH=ceil($IH/$IW*$maxW);
1975 $IW=ceil($IW/$IH*$maxH);
1981 <tr class="bgColor4">
1982 <td nowrap="nowrap">'.$filenameAndIcon.' </td>
1983 <td nowrap="nowrap">'.
1984 ($imgInfo[0]!=$IW ?
'<a href="'.htmlspecialchars(t3lib_div
::linkThisScript(array('noLimit'=>'1'))).'">'.
1985 '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/icon_warning2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('clickToRedrawFullSize',1).'" alt="" />'.
1992 <td colspan="2"><img src="'.$iurl.'" width="'.$IW.'" height="'.$IH.'" border="1" alt="" /></td>
1996 <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
2001 // Finally, wrap all rows in a table tag:
2006 File listing / Drag-n-drop
2008 <table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
2009 '.implode('',$lines).'
2013 // Print this warning if the folder is NOT a web folder:
2014 $out.=$this->barheader($GLOBALS['LANG']->getLL('files'));
2015 $out.=$this->getMsgBox($GLOBALS['LANG']->getLL('noWebFolder'),'icon_warning2');
2032 /******************************************************************
2034 * Miscellaneous functions
2036 ******************************************************************/
2040 * Verifies that a path is a web-folder:
2042 * @param string Absolute filepath
2043 * @return boolean If the input path is found in PATH_site then it returns true.
2045 function isWebFolder($folder) {
2046 $folder = ereg_replace('\/$','',$folder).'/';
2047 return t3lib_div
::isFirstPartOfStr($folder,PATH_site
) ?
TRUE : FALSE;
2051 * Checks, if a path is within the mountpoints of the backend user
2053 * @param string Absolute filepath
2054 * @return boolean If the input path is found in the backend users filemounts, then return true.
2056 function checkFolder($folder) {
2057 $fileProcessor = t3lib_div
::makeInstance('t3lib_basicFileFunctions');
2058 $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
2060 return $fileProcessor->checkPathAgainstMounts(ereg_replace('\/$','',$folder).'/') ?
TRUE : FALSE;
2064 * Prints a 'header' where string is in a tablecell
2066 * @param string The string to print in the header. The value is htmlspecialchars()'ed before output.
2067 * @return string The header HTML (wrapped in a table)
2069 function barheader($str) {
2075 <h3 class="bgColor5">'.htmlspecialchars($str).'</h3>
2080 * Displays a message box with the input message
2082 * @param string Input message to show (will be htmlspecialchars()'ed inside of this function)
2083 * @param string Icon filename body from gfx/ (default is "icon_note") - meant to allow change to warning type icons...
2084 * @return string HTML for the message (wrapped in a table).
2086 function getMsgBox($in_msg,$icon='icon_note') {
2089 $msg = '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/'.$icon.'.gif','width="18" height="16"').' alt="" />'.htmlspecialchars($in_msg);
2095 <table cellspacing="0" class="bgColor4" id="typo3-msgBox">
2105 * For RTE/link: This prints the 'currentUrl'
2107 * @param string URL value. The value is htmlspecialchars()'ed before output.
2108 * @return string HTML content, wrapped in a table.
2110 function printCurrentUrl($str) {
2116 <table border="0" cellpadding="0" cellspacing="0" class="bgColor5" id="typo3-curUrl">
2118 <td>'.$GLOBALS['LANG']->getLL('currentLink',1).': '.htmlspecialchars(rawurldecode($str)).'</td>
2124 * For RTE/link: Parses the incoming URL and determines if it's a page, file, external or mail address.
2126 * @param string HREF value tp analyse
2127 * @param string The URL of the current website (frontend)
2128 * @return array Array with URL information stored in assoc. keys: value, act (page, file, spec, mail), pageid, cElement, info
2130 function parseCurUrl($href,$siteUrl) {
2131 $href = trim($href);
2135 // Default is "url":
2136 $info['value']=$href;
2139 $specialParts = explode('#_SPECIAL',$href);
2140 if (count($specialParts)==2) { // Special kind (Something RTE specific: User configurable links through: "userLinks." from ->thisConfig)
2141 $info['value']='#_SPECIAL'.$specialParts[1];
2142 $info['act']='spec';
2143 } elseif (t3lib_div
::isFirstPartOfStr($href,$siteUrl)) { // If URL is on the current frontend website:
2144 $rel = substr($href,strlen($siteUrl));
2145 if (@file_exists
(PATH_site
.rawurldecode($rel))) { // URL is a file, which exists:
2146 $info['value']=rawurldecode($rel);
2147 $info['act']='file';
2148 } else { // URL is a page (id parameter)
2149 $uP=parse_url($rel);
2150 if (!trim($uP['path'])) {
2151 $pp = explode('id=',$uP['query']);
2154 // Checking if the id-parameter is an alias.
2155 if (!t3lib_div
::testInt($id)) {
2156 list($idPartR) = t3lib_BEfunc
::getRecordsByField('pages','alias',$id);
2157 $id=intval($idPartR['uid']);
2160 $pageRow = t3lib_BEfunc
::getRecordWSOL('pages',$id);
2161 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
2162 $info['value']=$GLOBALS['LANG']->getLL('page',1)." '".htmlspecialchars(t3lib_div
::fixed_lgd_cs($pageRow['title'],$titleLen))."' (ID:".$id.($uP['fragment']?
', #'.$uP['fragment']:'').')';
2163 $info['pageid']=$id;
2164 $info['cElement']=$uP['fragment'];
2165 $info['act']='page';
2169 } else { // Email link:
2170 if (strtolower(substr($href,0,7))=='mailto:') {
2171 $info['value']=trim(substr($href,7));
2172 $info['act']='mail';
2175 $info['info'] = $info['value'];
2176 } else { // NO value inputted:
2178 $info['info']=$GLOBALS['LANG']->getLL('none');
2180 $info['act']='page';
2186 * For TBE: Makes an upload form for uploading files to the filemount the user is browsing.
2187 * The files are uploaded to the tce_file.php script in the core which will handle the upload.
2189 * @param string Absolute filepath on server to which to upload.
2190 * @return string HTML for an upload form.
2192 function uploadForm($path) {
2196 // Create header, showing upload path:
2197 $header = t3lib_div
::isFirstPartOfStr($path,PATH_site
)?
substr($path,strlen(PATH_site
)):$path;
2198 $code=$this->barheader($GLOBALS['LANG']->getLL('uploadImage').':');
2202 Form, for uploading files:
2204 <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">
2205 <table border="0" cellpadding="0" cellspacing="3" id="typo3-uplFiles">
2207 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
2212 // Traverse the number of upload fields (default is 3):
2213 for ($a=1;$a<=$count;$a++
) {
2214 $code.='<input type="file" name="upload_'.$a.'"'.$this->doc
->formWidth(35).' size="50" />
2215 <input type="hidden" name="file[upload]['.$a.'][target]" value="'.htmlspecialchars($path).'" />
2216 <input type="hidden" name="file[upload]['.$a.'][data]" value="'.$a.'" /><br />';
2219 // Make footer of upload form, including the submit button:
2220 $redirectValue = $this->thisScript
.'?act='.$this->act
.'&mode='.$this->mode
.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams
);
2221 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
2222 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />';
2225 <div id="c-override">
2226 <input type="checkbox" name="overwriteExistingFiles" value="1" /> '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:overwriteExistingFiles',1).'
2240 * For TBE: Makes a form for creating new folders in the filemount the user is browsing.
2241 * The folder creation request is sent to the tce_file.php script in the core which will handle the creation.
2243 * @param string Absolute filepath on server in which to create the new folder.
2244 * @return string HTML for the create folder form.
2246 function createFolder($path) {
2248 // Create header, showing upload path:
2249 $header = t3lib_div
::isFirstPartOfStr($path,PATH_site
)?
substr($path,strlen(PATH_site
)):$path;
2250 $code=$this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle').':');
2254 Form, for creating new folders:
2256 <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform2">
2257 <table border="0" cellpadding="0" cellspacing="3" id="typo3-crFolder">
2259 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
2264 // Create the new-folder name field:
2266 $code.='<input'.$this->doc
->formWidth(20).' type="text" name="file[newfolder]['.$a.'][data]" />'.
2267 '<input type="hidden" name="file[newfolder]['.$a.'][target]" value="'.htmlspecialchars($path).'" />';
2269 // Make footer of upload form, including the submit button:
2270 $redirectValue = $this->thisScript
.'?act='.$this->act
.'&mode='.$this->mode
.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams
);
2271 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
2272 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.submit',1).'" />';
2283 // Include extension?
2284 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/class.browse_links.php']) {
2285 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/class.browse_links.php']);