2 /***************************************************************
5 * (c) 1999-2011 Kasper Skårhøj (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!
32 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj
35 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
40 require_once (PATH_typo3
.'/class.db_list.inc');
41 require_once (PATH_typo3
.'/class.db_list_extra.inc');
47 * Local version of the record list.
49 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
53 class TBE_browser_recordList
extends localRecordList
{
54 var $thisScript = 'browse_links.php';
57 * Initializes the script path
61 function __construct() {
62 parent
::__construct();
63 $this->thisScript
= t3lib_div
::getIndpEnv('SCRIPT_NAME');
67 * Creates the URL for links
69 * @param mixed If not blank string, this is used instead of $this->id as the id value.
70 * @param string If this is "-1" then $this->table is used, otherwise the value of the input variable.
71 * @param string Commalist of fields NOT to pass as parameters (currently "sortField" and "sortRev")
72 * @return string Query-string for URL
74 function listURL($altId='',$table=-1,$exclList='') {
75 return $this->thisScript
.
76 '?id='.(strcmp($altId,'')?
$altId:$this->id
).
77 '&table='.rawurlencode($table==-1?
$this->table
:$table).
78 ($this->thumbs?
'&imagemode='.$this->thumbs
:'').
79 ($this->searchString?
'&search_field='.rawurlencode($this->searchString
):'').
80 ($this->searchLevels?
'&search_levels='.rawurlencode($this->searchLevels
):'').
81 ((!$exclList ||
!t3lib_div
::inList($exclList,'sortField')) && $this->sortField?
'&sortField='.rawurlencode($this->sortField
):'').
82 ((!$exclList ||
!t3lib_div
::inList($exclList,'sortRev')) && $this->sortRev?
'&sortRev='.rawurlencode($this->sortRev
):'').
89 * Returns additional, local GET parameters to include in the links of the record list.
94 $str = '&act='.$GLOBALS['SOBE']->browser
->act
.
95 '&mode='.$GLOBALS['SOBE']->browser
->mode
.
96 '&expandPage='.$GLOBALS['SOBE']->browser
->expandPage
.
97 '&bparams='.rawurlencode($GLOBALS['SOBE']->browser
->bparams
);
102 * 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...)
104 * @param string Table name
105 * @param integer UID (not used here)
106 * @param string Title string
107 * @param array Records array (from table name)
110 function linkWrapItems($table,$uid,$code,$row) {
112 $code = '<i>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</i>';
114 $code = t3lib_BEfunc
::getRecordTitlePrep($code, $this->fixedL
);
117 $title = t3lib_BEfunc
::getRecordTitle($table,$row,FALSE,TRUE);
118 $ficon = t3lib_iconWorks
::getIcon($table,$row);
119 $aOnClick = "return insertElement('".$table."', '".$row['uid']."', 'db', ".t3lib_div
::quoteJSvalue($title).", '', '', '".$ficon."');";
120 $ATag = '<a href="#" onclick="'.$aOnClick.'">';
121 $ATag_alt = substr($ATag,0,-4).',\'\',1);">';
125 '<img' . t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') .
126 ' title="' . $GLOBALS['LANG']->getLL('addToList', 1) . '" alt="" />' .
134 * Local version that sets allFields to TRUE to support userFieldSelect
137 * @see fieldSelectBox
139 function generateList() {
140 $this->allFields
= TRUE;
141 parent
::generateList();
151 * Class which generates the page tree
153 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
157 class localPageTree
extends t3lib_browseTree
{
160 * whether the page ID should be shown next to the title, activate through userTSconfig (options.pageTree.showPageIdWithTitle)
163 public $ext_showPageId = FALSE;
166 * Constructor. Just calling init()
170 function __construct() {
171 $this->thisScript
= t3lib_div
::getIndpEnv('SCRIPT_NAME');
175 $this->clause
= ' AND doktype!=' . t3lib_pageSelect
::DOKTYPE_RECYCLER
. $this->clause
;
179 * Wrapping the title in a link, if applicable.
181 * @param string Title, (must be ready for output, that means it must be htmlspecialchars()'ed).
182 * @param array The record
183 * @param boolean (Ignore)
184 * @return string Wrapping title string.
186 function wrapTitle($title,$v,$ext_pArrPages='') {
187 if ($this->ext_isLinkable($v['doktype'],$v['uid'])) {
188 $aOnClick = "return link_typo3Page('".$v['uid']."');";
189 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
191 return '<span style="color: #666666;">'.$title.'</span>';
196 * Create the page navigation tree in HTML
198 * @param array Tree array
199 * @return string HTML output.
201 function printTree($treeArr='') {
202 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
203 if (!is_array($treeArr)) $treeArr=$this->tree
;
208 foreach($treeArr as $k => $v) {
210 $bgColorClass = ($c+
1)%2 ?
'bgColor' : 'bgColor-10';
211 if ($GLOBALS['SOBE']->browser
->curUrlInfo
['act']=='page' && $GLOBALS['SOBE']->browser
->curUrlInfo
['pageid']==$v['row']['uid'] && $GLOBALS['SOBE']->browser
->curUrlInfo
['pageid']) {
212 $arrCol='<td><img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
213 $bgColorClass='bgColor4';
218 $aOnClick = 'return jumpToUrl(\''.$this->thisScript
.'?act='.$GLOBALS['SOBE']->browser
->act
.'&mode='.$GLOBALS['SOBE']->browser
->mode
.'&expandPage='.$v['row']['uid'].'\');';
219 $cEbullet = $this->ext_isLinkable($v['row']['doktype'],$v['row']['uid']) ?
220 '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' :
223 <tr class="'.$bgColorClass.'">
224 <td nowrap="nowrap"'.($v['row']['_CSSCLASS'] ?
' class="'.$v['row']['_CSSCLASS'].'"' : '').'>'.
226 $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$this->ext_pArrPages
).
229 '<td>'.$cEbullet.'</td>
236 Navigation Page Tree:
238 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
245 * Returns TRUE if a doktype can be linked.
247 * @param integer Doktype value to test
248 * @param integer uid to test.
251 function ext_isLinkable($doktype,$uid) {
252 if ($uid && $doktype<199) {
258 * Wrap the plus/minus icon in a link
260 * @param string HTML string to wrap, probably an image tag.
261 * @param string Command for 'PM' get var
262 * @param boolean If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
263 * @return string Link-wrapped input string
265 function PM_ATagWrap($icon,$cmd,$bMark='') {
267 $anchor = '#'.$bMark;
268 $name=' name="'.$bMark.'"';
270 $aOnClick = "return jumpToUrl('".$this->thisScript
.'?PM='.$cmd."','".$anchor."');";
272 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
276 * Wrapping the image tag, $icon, for the row, $row
278 * @param string The image tag for the icon
279 * @param array The row for the current element
280 * @return string The processed icon input value.
282 function wrapIcon($icon, $row) {
283 $content = $this->addTagAttributes($icon, ' title="id=' . $row['uid'] . '"');
284 if ($this->ext_showPageId
) {
285 $content .= '[' . $row['uid'] . '] ';
299 * Page tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
301 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
305 class rtePageTree
extends localPageTree
{
316 * For TBE record browser
318 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
322 class TBE_PageTree
extends localPageTree
{
325 * Returns TRUE if a doktype can be linked (which is always the case here).
327 * @param integer Doktype value to test
328 * @param integer uid to test.
331 function ext_isLinkable($doktype,$uid) {
336 * Wrapping the title in a link, if applicable.
338 * @param string Title, ready for output.
339 * @param array The record
340 * @param boolean If set, pages clicked will return immediately, otherwise reload page.
341 * @return string Wrapping title string.
343 function wrapTitle($title,$v,$ext_pArrPages) {
344 if ($ext_pArrPages) {
345 $ficon=t3lib_iconWorks
::getIcon('pages',$v);
346 $onClick = "return insertElement('pages', '".$v['uid']."', 'db', ".t3lib_div
::quoteJSvalue($v['title']).", '', '', '".$ficon."','',1);";
348 $onClick = htmlspecialchars('return jumpToUrl(\''.$this->thisScript
.'?act='.$GLOBALS['SOBE']->browser
->act
.'&mode='.$GLOBALS['SOBE']->browser
->mode
.'&expandPage='.$v['uid'].'\');');
350 return '<a href="#" onclick="'.$onClick.'">'.$title.'</a>';
362 * Base extension class which generates the folder tree.
363 * Used directly by the RTE.
364 * also used for the linkpicker on files
366 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
370 class localFolderTree
extends t3lib_folderTree
{
375 * Initializes the script path
379 function __construct() {
380 $this->thisScript
= t3lib_div
::getIndpEnv('SCRIPT_NAME');
381 parent
::__construct();
385 * Wrapping the title in a link, if applicable.
387 * @param string $title Title, ready for output.
388 * @param t3lib_file_Folder $folderObject The "record"
389 * @return string Wrapping title string.
391 function wrapTitle($title, t3lib_file_Folder
$folderObject) {
392 if ($this->ext_isLinkable($folderObject)) {
393 $aOnClick = 'return jumpToUrl(\''.$this->thisScript
.'?act='.$GLOBALS['SOBE']->browser
->act
.'&mode='.$GLOBALS['SOBE']->browser
->mode
.'&expandFolder='.rawurlencode($folderObject->getCombinedIdentifier()).'\');';
394 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
396 return '<span class="typo3-dimmed">'.$title.'</span>';
401 * Returns TRUE if the input "record" contains a folder which can be linked.
403 * @param t3lib_file_Folder $folderObject Object with information about the folder element. Contains keys like title, uid, path, _title
404 * @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
406 function ext_isLinkable(t3lib_file_Folder
$folderObject) {
407 if (!$folderObject->getStorage()->isPublic() ||
strstr($folderObject->getIdentifier(), '_recycler_') ||
strstr($folderObject->getIdentifier(), '_temp_')) {
415 * Wrap the plus/minus icon in a link
417 * @param string HTML string to wrap, probably an image tag.
418 * @param string Command for 'PM' get var
419 * @param boolean If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
420 * @return string Link-wrapped input string
423 function PM_ATagWrap($icon,$cmd,$bMark='') {
425 $anchor = '#'.$bMark;
426 $name=' name="'.$bMark.'"';
428 $aOnClick = 'return jumpToUrl(\''.$this->thisScript
.'?PM='.$cmd.'\',\''.$anchor.'\');';
429 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
439 * Folder tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
441 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
445 class rteFolderTree
extends localFolderTree
{
455 * For TBE File Browser
457 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
461 class TBE_FolderTree
extends localFolderTree
{
462 var $ext_noTempRecyclerDirs=0; // If file-drag mode is set, temp and recycler folders are filtered out.
465 * Returns TRUE if the input "record" contains a folder which can be linked.
467 * @param t3lib_file_Folder $folderObject object with information about the folder element. Contains keys like title, uid, path, _title
468 * @return boolean TRUE is returned if the path is NOT a recycler or temp folder AND if ->ext_noTempRecyclerDirs is not set.
470 function ext_isLinkable($folderObject) {
471 if ($this->ext_noTempRecyclerDirs
&& (substr($folderObject->getIdentifier(), -7)=='_temp_/' ||
substr($folderObject->getIdentifier(),-11)=='_recycler_/')) {
479 * Wrapping the title in a link, if applicable.
481 * @param string $title Title, ready for output.
482 * @param t3lib_file_Folder $folderObject The folderObject 'record'
483 * @return string Wrapping title string.
485 function wrapTitle($title, $folderObject) {
486 if ($this->ext_isLinkable($folderObject)) {
487 $aOnClick = 'return jumpToUrl(\'' . $this->thisScript
. '?act=' . $GLOBALS['SOBE']->browser
->act
. '&mode=' . $GLOBALS['SOBE']->browser
->mode
.'&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier()) . '\');';
488 return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
490 return '<span class="typo3-dimmed">' . $title . '</span>';
500 * class for the Element Browser window.
502 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
509 var $siteURL; // Current site URL (Frontend)
510 var $thisScript; // the script to link to
511 var $thisConfig; // RTE specific TSconfig
512 var $setTarget; // Target (RTE specific)
513 var $setClass; // CSS Class (RTE specific)
514 var $setTitle; // title (RTE specific)
515 var $doc; // Backend template object
516 var $elements = array(); // Holds information about files
518 // GPvars: (Input variables from outside)
520 * The mode determines the main kind of output from the element browser.
521 * There are these options for values: rte, db, file, filedrag, wizard.
522 * "rte" will show the link selector for the Rich Text Editor (see main_rte())
523 * "db" will allow you to browse for pages or records in the page tree (for TCEforms, see main_db())
524 * "file"/"filedrag" will allow you to browse for files or folders in the folder mounts (for TCEforms, main_file())
525 * "wizard" will allow you to browse for links (like "rte") which are passed back to TCEforms (see main_rte(1))
532 * Link selector action.
533 * page,file,url,mail,spec are allowed values.
534 * These are only important with the link selector function and in that case they switch between the various menu options.
539 * 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")
544 * 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/"
549 * the folder object of a parent folder that was selected
550 * @param t3lib_file_Folder
552 protected $selectedFolder;
555 * TYPO3 Element Browser, wizard mode parameters. There is a heap of parameters there, better debug() them out if you need something... :-)
560 * 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.
561 * Example value: "data[pages][39][bodytext]|||tt_content|" or "data[tt_content][NEW3fba56fde763d][image]|||gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai|"
564 * 0: form field name reference, eg. "data[tt_content][123][image]"
565 * 1: htlmArea RTE parameters: editorNo:contentTypo3Language:contentTypo3Charset
566 * 2: RTE config parameters: RTEtsConfigParams
567 * 3: allowed types. Eg. "tt_content" or "gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai"
568 * 4: IRRE uniqueness: target level object-id to perform actions/checks on, eg. "data[79][tt_address][1][<field>][<foreign_table>]"
569 * 5: IRRE uniqueness: name of function in opener window that checks if element is already used, eg. "inline.checkUniqueElement"
570 * 6: IRRE uniqueness: name of function in opener window that performs some additional(!) action, eg. "inline.setUniqueElement"
571 * 7: IRRE uniqueness: name of function in opener window that performs action instead of using addElement/insertElement, eg. "inline.importElement"
573 * $pArr = explode('|',$this->bparams);
574 * $formFieldName = $pArr[0];
575 * $allowedTablesOrFileTypes = $pArr[3];
580 * Used with the Rich Text Editor.
581 * Example value: "tt_content:NEW3fba58c969f5c:bodytext:23:text:23:"
583 var $RTEtsConfigParams;
589 * Plus/Minus icon value. Used by the tree class to open/close notes on the trees.
594 * Pointer, used when browsing a long list of records etc.
602 * 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.
607 * 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.
612 * array which holds hook objects (initialised in init() )
614 protected $hookObjects = array();
618 * object for t3lib_basicFileFunctions
620 public $fileProcessor;
624 * Initializes a lot of variables, setting JavaScript functions in header etc.
630 $this->pointer
= t3lib_div
::_GP('pointer');
631 $this->bparams
= t3lib_div
::_GP('bparams');
632 $this->P
= t3lib_div
::_GP('P');
633 $this->RTEtsConfigParams
= t3lib_div
::_GP('RTEtsConfigParams');
634 $this->expandPage
= t3lib_div
::_GP('expandPage');
635 $this->expandFolder
= t3lib_div
::_GP('expandFolder');
636 $this->PM
= t3lib_div
::_GP('PM');
639 $this->mode
= t3lib_div
::_GP('mode');
643 // Creating backend template object:
644 $this->doc
= t3lib_div
::makeInstance('template');
645 $this->doc
->backPath
= $GLOBALS['BACK_PATH'];
646 // Load the Prototype library and browse_links.js
647 $this->doc
->getPageRenderer()->loadPrototype();
648 $this->doc
->loadJavascriptLib('js/browse_links.js');
649 $this->doc
->loadJavascriptLib('js/tree.js');
651 // init hook objects:
652 $this->hookObjects
= array();
653 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'])) {
654 foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'] as $classData) {
655 $processObject = t3lib_div
::getUserObj($classData);
657 if(!($processObject instanceof t3lib_browseLinksHook
)) {
658 throw new UnexpectedValueException('$processObject must implement interface t3lib_browseLinksHook', 1195039394);
661 $parameters = array();
662 $processObject->init($this, $parameters);
663 $this->hookObjects
[] = $processObject;
668 $this->siteURL
= t3lib_div
::getIndpEnv('TYPO3_SITE_URL'); // Current site url
670 // the script to link to
671 $this->thisScript
= t3lib_div
::getIndpEnv('SCRIPT_NAME');
673 // init fileProcessor
674 $this->fileProcessor
= t3lib_div
::makeInstance('t3lib_basicFileFunctions');
675 $this->fileProcessor
->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
678 // CurrentUrl - the current link url must be passed around if it exists
679 if ($this->mode
== 'wizard') {
680 $currentValues = t3lib_div
::trimExplode(LF
, trim($this->P
['currentValue']));
681 if (count($currentValues) > 0) {
682 $currentValue = array_pop($currentValues);
687 $currentLinkParts = t3lib_div
::unQuoteFilenames($currentValue, TRUE);
689 $initialCurUrlArray = array (
690 'href' => $currentLinkParts[0],
691 'target' => $currentLinkParts[1],
692 'class' => $currentLinkParts[2],
693 'title' => $currentLinkParts[3],
694 'params' => $currentLinkParts[4]
697 $this->curUrlArray
= (is_array(t3lib_div
::_GP('curUrl'))) ?
698 array_merge($initialCurUrlArray, t3lib_div
::_GP('curUrl')) :
701 // additional fields for page links
702 if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendUrlArray']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendUrlArray'])) {
705 'linkParts' => $currentLinkParts
707 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendUrlArray'] as $objRef) {
708 $processor = &t3lib_div
::getUserObj($objRef);
709 $processor->extendUrlArray( $_params, $this);
713 $this->curUrlInfo
= $this->parseCurUrl($this->siteURL
.'?id='.$this->curUrlArray
['href'], $this->siteURL
);
714 if ($this->curUrlInfo
['pageid'] == 0 && $this->curUrlArray
['href']) { // pageid == 0 means that this is not an internal (page) link
715 // check if there is the FAL API
716 if (t3lib_div
::isFirstPartOfStr($this->curUrlArray
['href'], 'file:')) {
717 $this->curUrlInfo
= $this->parseCurUrl($this->curUrlArray
['href'], $this->siteURL
);
718 $currentLinkParts[0] = rawurldecode(substr($this->curUrlArray
['href'], 5)); // remove the "file:" prefix
720 // check if this is a link to a file
721 } elseif (file_exists(PATH_site
.rawurldecode($this->curUrlArray
['href']))) {
722 if (t3lib_div
::isFirstPartOfStr($this->curUrlArray
['href'], PATH_site
)) {
723 $currentLinkParts[0] = substr($this->curUrlArray
['href'], strlen(PATH_site
));
725 $this->curUrlInfo
= $this->parseCurUrl($this->siteURL
.$this->curUrlArray
['href'], $this->siteURL
);
726 } elseif (strstr($this->curUrlArray
['href'], '@')) { // check for email link
727 if (t3lib_div
::isFirstPartOfStr($this->curUrlArray
['href'], 'mailto:')) {
728 $currentLinkParts[0] = substr($this->curUrlArray
['href'], 7);
730 $this->curUrlInfo
= $this->parseCurUrl('mailto:'.$this->curUrlArray
['href'], $this->siteURL
);
731 } else { // nothing of the above. this is an external link
732 if(strpos($this->curUrlArray
['href'], '://') === FALSE) {
733 $currentLinkParts[0] = 'http://' . $this->curUrlArray
['href'];
735 $this->curUrlInfo
= $this->parseCurUrl($currentLinkParts[0], $this->siteURL
);
737 } elseif (!$this->curUrlArray
['href']) {
738 $this->curUrlInfo
= array();
741 $this->curUrlInfo
= $this->parseCurUrl($this->siteURL
.'?id='.$this->curUrlArray
['href'], $this->siteURL
);
744 $this->curUrlArray
= t3lib_div
::_GP('curUrl');
745 if ($this->curUrlArray
['all']) {
746 $this->curUrlArray
=t3lib_div
::get_tag_attributes($this->curUrlArray
['all']);
748 $this->curUrlInfo
=$this->parseCurUrl($this->curUrlArray
['href'],$this->siteURL
);
751 // Determine nature of current url:
752 $this->act
=t3lib_div
::_GP('act');
754 $this->act
=$this->curUrlInfo
['act'];
757 // Rich Text Editor specific configuration:
759 if ((string)$this->mode
== 'rte') {
760 $RTEtsConfigParts = explode(':',$this->RTEtsConfigParams
);
761 $addPassOnParams.='&RTEtsConfigParams='.rawurlencode($this->RTEtsConfigParams
);
762 $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc
::getPagesTSconfig($RTEtsConfigParts[5]));
763 $this->thisConfig
= t3lib_BEfunc
::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
766 // Initializing the target value (RTE)
767 $this->setTarget
= ($this->curUrlArray
['target'] != '-') ?
rawurlencode($this->curUrlArray
['target']) : '';
768 if ($this->thisConfig
['defaultLinkTarget'] && !isset($this->curUrlArray
['target'])) {
769 $this->setTarget
=$this->thisConfig
['defaultLinkTarget'];
772 // Initializing the class value (RTE)
773 $this->setClass
= ($this->curUrlArray
['class'] != '-') ?
rawurlencode($this->curUrlArray
['class']) : '';
775 // Initializing the title value (RTE)
777 $this->setTitle
= ($this->curUrlArray
['title'] != '-') ?
rawurlencode($this->curUrlArray
['title']) : '';
778 // Initializing the params value
779 $this->setParams
= ($this->curUrlArray
['params'] != '-') ?
rawurlencode($this->curUrlArray
['params']) : '';
781 // BEGIN accumulation of header JavaScript:
783 // This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...
784 var add_href="'.($this->curUrlArray
['href']?
'&curUrl[href]='.rawurlencode($this->curUrlArray
['href']):'').'";
785 var add_target="'.($this->setTarget?
'&curUrl[target]='.rawurlencode($this->setTarget
):'').'";
786 var add_class="'.($this->setClass ?
'&curUrl[class]='.rawurlencode($this->setClass
) : '').'";
787 var add_title="'.($this->setTitle?
'&curUrl[title]='.rawurlencode($this->setTitle
):'').'";
788 var add_params="'.($this->bparams?
'&bparams='.rawurlencode($this->bparams
):'').'";
790 var cur_href="' . ($this->curUrlArray
['href'] ?
rawurlencode($this->curUrlArray
['href']) : '') . '";
791 var cur_target="'.($this->setTarget?
$this->setTarget
:'').'";
792 var cur_class = "' . ($this->setClass ?
$this->setClass
: '') . '";
793 var cur_title="'.($this->setTitle?
$this->setTitle
:'').'";
794 var cur_params="' . ($this->setParams ?
$this->setParams
: '') . '";
796 function browse_links_setTarget(target) { //
798 add_target="&curUrl[target]="+escape(target);
800 function browse_links_setClass(cssClass) { //
801 cur_class = cssClass;
802 add_class = "&curUrl[class]=" + escape(cssClass);
804 function browse_links_setTitle(title) { //
806 add_title="&curUrl[title]="+escape(title);
808 function browse_links_setValue(value) { //
810 add_href="&curUrl[href]="+value;
812 function browse_links_setParams(params) { //
814 add_params="&curUrl[params]="+escape(params);
818 if ($this->mode
== 'wizard') { // Functions used, if the link selector is in wizard mode (= TCEforms fields)
819 if (!$this->areFieldChangeFunctionsValid() && !$this->areFieldChangeFunctionsValid(TRUE)) {
820 $this->P
['fieldChangeFunc'] = array();
822 unset($this->P
['fieldChangeFunc']['alert']);
824 foreach ($this->P
['fieldChangeFunc'] as $k => $v) {
830 $P2['itemName']=$this->P
['itemName'];
831 $P2['formName']=$this->P
['formName'];
832 $P2['fieldChangeFunc']=$this->P
['fieldChangeFunc'];
833 $P2['fieldChangeFuncHash'] = t3lib_div
::hmac(serialize($this->P
['fieldChangeFunc']));
834 $P2['params']['allowedExtensions']=$this->P
['params']['allowedExtensions'];
835 $P2['params']['blindLinkOptions']=$this->P
['params']['blindLinkOptions'];
836 $P2['params']['blindLinkFields'] = $this->P
['params']['blindLinkFields'];
837 $addPassOnParams.=t3lib_div
::implodeArrayForUrl('P',$P2);
840 function link_typo3Page(id,anchor) { //
841 updateValueInMainForm(id + (anchor ? anchor : ""));
845 function link_folder(folder) { //
846 updateValueInMainForm(folder);
850 function link_current() { //
851 if (cur_href!="http://" && cur_href!="mailto:") {
852 returnBeforeCleaned = cur_href;
853 if (returnBeforeCleaned.substr(0, 7) == "http://") {
854 returnToMainFormValue = returnBeforeCleaned.substr(7);
855 } else if (returnBeforeCleaned.substr(0, 7) == "mailto:") {
856 if (returnBeforeCleaned.substr(0, 14) == "mailto:mailto:") {
857 returnToMainFormValue = returnBeforeCleaned.substr(14);
859 returnToMainFormValue = returnBeforeCleaned.substr(7);
862 returnToMainFormValue = returnBeforeCleaned;
864 updateValueInMainForm(returnToMainFormValue);
869 function checkReference() { //
870 if (window.opener && window.opener.document && window.opener.document.'.$this->P
['formName'].' && window.opener.document.'.$this->P
['formName'].'["'.$this->P
['itemName'].'"] ) {
871 return window.opener.document.'.$this->P
['formName'].'["'.$this->P
['itemName'].'"];
876 function updateValueInMainForm(input) { //
877 var field = checkReference();
879 if (cur_target == "" && (cur_class != "" || cur_title != "" || cur_params != "")) {
882 if (cur_class == "" && (cur_title != "" || cur_params != "")) {
885 cur_class = cur_class.replace(/[\'\"]/g, "");
886 if (cur_class.indexOf(" ") != -1) {
887 cur_class = "\"" + cur_class + "\"";
889 if (cur_title == "" && cur_params != "") {
892 cur_title = cur_title.replace(/(^\")|(\"$)/g, "");
893 if (cur_title.indexOf(" ") != -1) {
894 cur_title = "\"" + cur_title + "\"";
897 cur_params = cur_params.replace(/\bid\=.*?(\&|$)/, "");
899 input = input + " " + cur_target + " " + cur_class + " " + cur_title + " " + cur_params;
900 if(field.value && field.className.search(/textarea/) != -1) {
901 field.value += "\n" + input;
909 } else { // Functions used, if the link selector is in RTE mode:
911 function link_typo3Page(id,anchor) { //
912 var theLink = \''.$this->siteURL
.'?id=\'+id+(anchor?anchor:"");
913 self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
916 function link_folder(folder) { //
917 var theLink = \''.$this->siteURL
.'\'+folder;
918 self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
921 function link_spec(theLink) { //
922 self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
925 function link_current() { //
926 if (cur_href!="http://" && cur_href!="mailto:") {
927 self.parent.parent.renderPopup_addLink(cur_href, cur_target, cur_class, cur_title);
934 // General "jumpToUrl" function:
936 function jumpToUrl(URL,anchor) { //
937 var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act
.'" : "";
938 var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$this->mode
.'" : "";
939 var theLocation = URL + add_act + add_mode + add_href + add_target + add_class + add_title + add_params'.($addPassOnParams?
'+"'.$addPassOnParams.'"':'').'+(anchor?anchor:"");
940 window.location.href = theLocation;
947 * Splits parts of $this->bparams
950 $pArr = explode('|',$this->bparams
);
952 // This is JavaScript especially for the TBE Element Browser!
953 $formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';
955 // insertElement - Call check function (e.g. for uniqueness handling):
956 if ($pArr[4] && $pArr[5]) {
958 // Call a check function in the opener window (e.g. for uniqueness handling):
959 if (parent.window.opener) {
960 var res = parent.window.opener.'.$pArr[5].'("'.addslashes($pArr[4]).'",table,uid,type);
962 if (res.message) alert(res.message);
963 performAction = false;
966 alert("Error - reference to main window is not set properly!");
971 // insertElement - Call helper function:
972 if ($pArr[4] && $pArr[6]) {
974 // Call helper function to manage data in the opener window:
975 if (parent.window.opener) {
976 parent.window.opener.'.$pArr[6].'("'.addslashes($pArr[4]).'",table,uid,type,"'.addslashes($pArr[0]).'");
978 alert("Error - reference to main window is not set properly!");
983 // insertElement - perform action commands:
984 if ($pArr[4] && $pArr[7]) {
985 // Call user defined action function:
987 if (parent.window.opener) {
988 parent.window.opener.'.$pArr[7].'("'.addslashes($pArr[4]).'",table,uid,type);
989 if (close) { focusOpenerAndClose(close); }
991 alert("Error - reference to main window is not set properly!");
992 if (close) { parent.close(); }
995 $JScodeActionMultiple = '
996 // Call helper function to manage data in the opener window:
997 if (parent.window.opener) {
998 parent.window.opener.' . $pArr[7] . 'Multiple("' . addslashes($pArr[4]) . '",table,uid,type,"' . addslashes($pArr[0]) . '");
1000 alert("Error - reference to main window is not set properly!");
1004 } elseif ($pArr[0] && !$pArr[1] && !$pArr[2]) {
1006 addElement(filename,table+"_"+uid,fp,close);
1010 if (setReferences()) {
1011 parent.window.opener.group_change("add","'.$pArr[0].'","'.$pArr[1].'","'.$pArr[2].'",elRef,targetDoc);
1013 alert("Error - reference to main window is not set properly!");
1015 focusOpenerAndClose(close);
1023 function launchView(url) { //
1024 var thePreviewWindow="";
1025 thePreviewWindow = window.open("'.$GLOBALS['BACK_PATH'].'show_item.php?table="+url,"ShowItem","height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
1026 if (thePreviewWindow && thePreviewWindow.focus) {
1027 thePreviewWindow.focus();
1030 function setReferences() { //
1031 if (parent.window.opener && parent.window.opener.content && parent.window.opener.content.document.editform && parent.window.opener.content.document.editform["'.$formFieldName.'"]) {
1032 targetDoc = parent.window.opener.content.document;
1033 elRef = targetDoc.editform["'.$formFieldName.'"];
1039 function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close) { //
1040 var performAction = true;
1042 // Call performing function and finish this action:
1043 if (performAction) {
1044 '.$JScodeHelper.$JScodeAction.'
1048 function insertMultiple(table, uid) {
1050 ' . $JScodeActionMultiple . '
1053 function addElement(elName,elValue,altElValue,close) { //
1054 if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin) {
1055 parent.window.opener.setFormValueFromBrowseWin("'.$pArr[0].'",altElValue?altElValue:elValue,elName);
1056 focusOpenerAndClose(close);
1058 alert("Error - reference to main window is not set properly!");
1062 function focusOpenerAndClose(close) { //
1063 BrowseLinks.focusOpenerAndClose(close);
1067 // extends JavaScript code
1068 if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendJScode']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendJScode'])) {
1071 'wizardUpdate' => $update,
1072 'addPassOnParams' => $addPassOnParams
1074 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendJScode'] as $objRef) {
1075 $processor = &t3lib_div
::getUserObj($objRef);
1076 $JScode .= $processor->extendJScode( $_params, $this);
1080 // Finally, add the accumulated JavaScript to the template object:
1081 $this->doc
->JScode
.= $this->doc
->wrapScriptTags($JScode);
1084 if (FALSE) debug(array(
1085 'pointer' => $this->pointer
,
1086 'act' => $this->act
,
1087 'mode' => $this->mode
,
1088 'curUrlInfo' => $this->curUrlInfo
,
1089 'curUrlArray' => $this->curUrlArray
,
1091 'bparams' => $this->bparams
,
1092 'RTEtsConfigParams' => $this->RTEtsConfigParams
,
1093 'expandPage' => $this->expandPage
,
1094 'expandFolder' => $this->expandFolder
,
1096 ),'Internal variables of Script Class:');
1101 * Session data for this class can be set from outside with this method.
1104 * @param array Session data array
1105 * @return array Session data and boolean which indicates that data needs to be stored in session because it's changed
1107 function processSessionData($data) {
1110 switch((string)$this->mode
) {
1112 if (isset($this->expandPage
)) {
1113 $data['expandPage']=$this->expandPage
;
1116 $this->expandPage
=$data['expandPage'];
1122 if (isset($this->expandFolder
)) {
1123 $data['expandFolder']=$this->expandFolder
;
1126 $this->expandFolder
=$data['expandFolder'];
1131 return array($data, $store);
1137 /******************************************************************
1141 ******************************************************************/
1144 * Rich Text Editor (RTE) link selector (MAIN function)
1145 * Generates the link selector for the Rich Text Editor.
1146 * Can also be used to select links for the TCEforms (see $wiz)
1148 * @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
1149 * @return string Modified content variable.
1151 function main_rte($wiz=0) {
1152 // Starting content:
1153 $content=$this->doc
->startPage('RTE link');
1155 // Initializing the action value, possibly removing blinded values etc:
1156 $allowedItems = array_diff(
1157 explode(',','page,file,folder,url,mail,spec'),
1158 t3lib_div
::trimExplode(',',$this->thisConfig
['blindLinkOptions'],1)
1160 $allowedItems = array_diff(
1162 t3lib_div
::trimExplode(',',$this->P
['params']['blindLinkOptions'])
1165 //call hook for extra options
1166 foreach($this->hookObjects
as $hookObject) {
1167 $allowedItems = $hookObject->addAllowedItems($allowedItems);
1170 // Removing link fields if configured
1171 $allowedFields = array_diff(
1172 array('target', 'title', 'class', 'params'),
1173 t3lib_div
::trimExplode(',', $this->thisConfig
['blindLinkFields'], TRUE),
1174 t3lib_div
::trimExplode(',', $this->P
['params']['blindLinkFields'], TRUE)
1177 // if $this->act is not allowed, default to first allowed
1178 if (!in_array($this->act
, $allowedItems)) {
1179 $this->act
= reset($allowedItems);
1182 // Making menu in top:
1185 $menuDef['removeLink']['isActive'] = $this->act
=='removeLink';
1186 $menuDef['removeLink']['label'] = $GLOBALS['LANG']->getLL('removeLink', 1);
1187 $menuDef['removeLink']['url'] = '#';
1188 $menuDef['removeLink']['addParams'] = 'onclick="self.parent.parent.renderPopup_unLink();return false;"';
1190 if (in_array('page',$allowedItems)) {
1191 $menuDef['page']['isActive'] = $this->act
=='page';
1192 $menuDef['page']['label'] = $GLOBALS['LANG']->getLL('page', 1);
1193 $menuDef['page']['url'] = '#';
1194 $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page\');return false;"';
1196 if (in_array('file',$allowedItems)){
1197 $menuDef['file']['isActive'] = $this->act
=='file';
1198 $menuDef['file']['label'] = $GLOBALS['LANG']->getLL('file', 1);
1199 $menuDef['file']['url'] = '#';
1200 $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file\');return false;"';
1202 if (in_array('folder',$allowedItems)){
1203 $menuDef['folder']['isActive'] = $this->act
== 'folder';
1204 $menuDef['folder']['label'] = $GLOBALS['LANG']->getLL('folder', 1);
1205 $menuDef['folder']['url'] = '#';
1206 $menuDef['folder']['addParams'] = 'onclick="jumpToUrl(\'?act=folder\');return false;"';
1208 if (in_array('url',$allowedItems)) {
1209 $menuDef['url']['isActive'] = $this->act
=='url';
1210 $menuDef['url']['label'] = $GLOBALS['LANG']->getLL('extUrl', 1);
1211 $menuDef['url']['url'] = '#';
1212 $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url\');return false;"';
1214 if (in_array('mail',$allowedItems)) {
1215 $menuDef['mail']['isActive'] = $this->act
=='mail';
1216 $menuDef['mail']['label'] = $GLOBALS['LANG']->getLL('email', 1);
1217 $menuDef['mail']['url'] = '#';
1218 $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail\');return false;"';
1220 if (is_array($this->thisConfig
['userLinks.']) && in_array('spec',$allowedItems)) {
1221 $menuDef['spec']['isActive'] = $this->act
=='spec';
1222 $menuDef['spec']['label'] = $GLOBALS['LANG']->getLL('special', 1);
1223 $menuDef['spec']['url'] = '#';
1224 $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec\');return false;"';
1227 // call hook for extra options
1228 foreach($this->hookObjects
as $hookObject) {
1229 $menuDef = $hookObject->modifyMenuDefinition($menuDef);
1232 $content .= $this->doc
->getTabMenuRaw($menuDef);
1234 // Adding the menu and header to the top of page:
1235 $content.=$this->printCurrentUrl($this->curUrlInfo
['info']).'<br />';
1237 // Depending on the current action we will create the actual module content for selecting a link:
1238 switch($this->act
) {
1245 <form action="" name="lurlform" id="lurlform">
1246 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail">
1248 <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('emailAddress', 1) . ':</td>
1249 <td><input type="text" name="lemail"'.$this->doc
->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo
['act']=='mail'?
$this->curUrlInfo
['info']:'').'" /> '.
1250 '<input type="submit" value="' . $GLOBALS['LANG']->getLL('setLink', 1) . '" onclick="browse_links_setTarget(\'\');browse_links_setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td>
1262 <form action="" name="lurlform" id="lurlform">
1263 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL">
1265 <td style="width: 96px;">URL:</td>
1266 <td><input type="text" name="lurl"'.$this->doc
->formWidth(30).' value="'.htmlspecialchars($this->curUrlInfo
['act']=='url'?
$this->curUrlInfo
['info']:'http://').'" /> '.
1267 '<input type="submit" value="' . $GLOBALS['LANG']->getLL('setLink', 1) . '" onclick="browse_links_setValue(document.lurlform.lurl.value); return link_current();" /></td>
1275 $foldertree = t3lib_div
::makeInstance('rteFolderTree');
1276 $foldertree->thisScript
= $this->thisScript
;
1277 $tree = $foldertree->getBrowsableTree();
1279 if (!$this->curUrlInfo
['value'] ||
$this->curUrlInfo
['act'] != $this->act
) {
1282 $cmpPath = $this->curUrlInfo
['value'];
1283 if (!isset($this->expandFolder
)) {
1284 $this->expandFolder
= $cmpPath;
1288 if ($this->expandFolder
) {
1289 $selectedFolder = FALSE;
1291 $fileOrFolderObject = t3lib_file_Factory
::getInstance()->retrieveFileOrFolderObject($this->expandFolder
);
1293 if ($fileOrFolderObject instanceof t3lib_file_Folder
) {
1294 $selectedFolder = $fileOrFolderObject;
1296 } elseif ($fileOrFolderObject instanceof t3lib_file_FileInterface
) {
1297 // @todo: find the parent folder, right now done a bit ugly, because the file does not
1298 // support finding the parent folder of a file on purpose
1299 $folderIdentifier = dirname($fileOrFolderObject->getIdentifier());
1300 $selectedFolder = $fileOrFolderObject->getStorage()->getFolder($folderIdentifier);
1303 // render the filelist if there is a folder selected
1304 if ($selectedFolder) {
1305 $files = $this->expandFolder(
1307 $this->P
['params']['allowedExtensions']
1311 $this->doc
->JScode
.= $this->doc
->wrapScriptTags('
1312 Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";
1317 Wrapper table for folder tree / file/folder list:
1319 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkFiles">
1321 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
1322 <td class="c-wCell" valign="top">'.$files.'</td>
1328 if (is_array($this->thisConfig
['userLinks.'])) {
1330 $v=$this->thisConfig
['userLinks.'];
1331 foreach ($v as $k2 => $value) {
1333 if (substr($k2,-1)=='.' && is_array($v[$k2i.'.'])) {
1336 $title = trim($v[$k2i]);
1338 $title=$v[$k2i.'.']['url'];
1340 $title = $GLOBALS['LANG']->sL($title);
1343 $description = ($v[$k2i . '.']['description'] ?
$GLOBALS['LANG']->sL($v[$k2i . '.']['description'], 1) . '<br />' : '');
1345 // URL + onclick event:
1347 if (isset($v[$k2i.'.']['target'])) $onClickEvent.="browse_links_setTarget('".$v[$k2i.'.']['target']."');";
1348 $v[$k2i.'.']['url'] = str_replace('###_URL###',$this->siteURL
,$v[$k2i.'.']['url']);
1349 if (substr($v[$k2i.'.']['url'],0,7)=='http://' ||
substr($v[$k2i.'.']['url'],0,7)=='mailto:') {
1350 $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();";
1352 $onClickEvent.="link_spec(unescape('".$this->siteURL
.rawurlencode($v[$k2i.'.']['url'])."'));";
1356 $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>');
1358 // Adding link to menu of user defined links:
1361 <td class="bgColor4">'.$A[0].'<strong>'.htmlspecialchars($title).($this->curUrlInfo
['info']==$v[$k2i.'.']['url']?
'<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" />':'').'</strong><br />'.$description.$A[1].'</td>
1369 // Add menu to content:
1373 Special userdefined menu:
1375 <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
1377 <td class="bgColor5" class="c-wCell" valign="top"><strong>' . $GLOBALS['LANG']->getLL('special', 1) . '</strong></td>
1379 '.implode('',$subcats).'
1385 $pagetree = t3lib_div
::makeInstance('rtePageTree');
1386 $pagetree->thisScript
= $this->thisScript
;
1387 $pagetree->ext_showPageId
= $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle');
1388 $pagetree->ext_showNavTitle
= $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
1389 $pagetree->addField('nav_title');
1390 $tree=$pagetree->getBrowsableTree();
1391 $cElements = $this->expandPage();
1393 // Outputting Temporary DB mount notice:
1394 if (intval($GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint'))) {
1395 $link = '<a href="' . htmlspecialchars(t3lib_div
::linkThisScript(array('setTempDBmount' => 0))) . '">' .
1396 $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.temporaryDBmount', 1) .
1398 $flashMessage = t3lib_div
::makeInstance(
1399 't3lib_FlashMessage',
1402 t3lib_FlashMessage
::INFO
1404 $dbmount = $flashMessage->render();
1410 Wrapper table for page tree / record list:
1412 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages">
1414 <td class="c-wCell" valign="top">' . $this->barheader($GLOBALS['LANG']->getLL('pageTree') . ':') . $dbmount . $tree . '</td>
1415 <td class="c-wCell" valign="top">'.$cElements.'</td>
1422 foreach($this->hookObjects
as $hookObject) {
1423 $content .= $hookObject->getTab($this->act
);
1428 if (in_array('params', $allowedFields, TRUE)) {
1431 Selecting params for link:
1433 <form action="" name="lparamsform" id="lparamsform">
1434 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkParams">
1436 <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('params', 1) . '</td>
1437 <td><input type="text" name="lparams" class="typo3-link-input" onchange="browse_links_setParams(this.value);" value="' . htmlspecialchars($this->setParams
) . '" /></td>
1444 if (in_array('class', $allowedFields, TRUE)) {
1447 Selecting class for link:
1449 <form action="" name="lclassform" id="lclassform">
1450 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkClass">
1452 <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('class', 1) . '</td>
1453 <td><input type="text" name="lclass" class="typo3-link-input" onchange="browse_links_setClass(this.value);" value="' . htmlspecialchars($this->setClass
) . '" /></td>
1460 if (in_array('title', $allowedFields, TRUE)) {
1463 Selecting title for link:
1465 <form action="" name="ltitleform" id="ltitleform">
1466 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTitle">
1468 <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('title', 1) . '</td>
1469 <td><input type="text" name="ltitle" class="typo3-link-input" onchange="browse_links_setTitle(this.value);" value="' . htmlspecialchars($this->setTitle
) . '" /></td>
1476 // additional fields for page links
1477 if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['addFields_PageLink']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['addFields_PageLink'])) {
1481 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['addFields_PageLink'] as $objRef) {
1482 $processor = &t3lib_div
::getUserObj($objRef);
1483 $content .= $processor->addFields( $_params, $this);
1489 if ($this->act
!= 'mail' && in_array('target', $allowedFields, TRUE)) {
1495 Selecting target for link:
1497 <form action="" name="ltargetform" id="ltargetform">
1498 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
1500 <td>'.$GLOBALS['LANG']->getLL('target',1).':</td>
1501 <td><input type="text" name="ltarget" onchange="browse_links_setTarget(this.value);" value="' . htmlspecialchars($this->setTarget
) . '"' . $this->doc
->formWidth(10) . ' /></td>
1503 <select name="ltarget_type" onchange="browse_links_setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
1505 <option value="_top">'.$GLOBALS['LANG']->getLL('top',1).'</option>
1506 <option value="_blank">'.$GLOBALS['LANG']->getLL('newWindow',1).'</option>
1510 if (($this->curUrlInfo
['act'] == 'page' ||
$this->curUrlInfo
['act'] == 'file' ||
$this->curUrlInfo
['act'] == 'folder') && $this->curUrlArray
['href'] && $this->curUrlInfo
['act'] == $this->act
) {
1512 <input type="submit" value="'.$GLOBALS['LANG']->getLL('update',1).'" onclick="return link_current();" />';
1516 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) {
1517 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;
1518 browse_links_setTarget(document.ltargetform.ltarget.value);
1519 browse_links_setClass(document.lclassform.lclass.value);
1520 browse_links_setTitle(document.ltitleform.ltitle.value);
1521 browse_links_setParams(document.lparamsform.lparams.value);
1522 document.ltargetform.popup_width.selectedIndex=0;
1523 document.ltargetform.popup_height.selectedIndex=0;
1530 <td>'.$GLOBALS['LANG']->getLL('target_popUpWindow',1).':</td>
1532 <select name="popup_width" onchange="'.htmlspecialchars($selectJS).'">
1533 <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_width',1).'</option>
1534 <option value="300">300</option>
1535 <option value="400">400</option>
1536 <option value="500">500</option>
1537 <option value="600">600</option>
1538 <option value="700">700</option>
1539 <option value="800">800</option>
1542 <select name="popup_height" onchange="'.htmlspecialchars($selectJS).'">
1543 <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_height',1).'</option>
1544 <option value="200">200</option>
1545 <option value="300">300</option>
1546 <option value="400">400</option>
1547 <option value="500">500</option>
1548 <option value="600">600</option>
1555 // Add "target selector" box to content:
1559 $content.='<br /><br />';
1562 // End page, return content:
1563 $content.= $this->doc
->endPage();
1564 $content = $this->doc
->insertStylesAndJS($content);
1569 * TYPO3 Element Browser: Showing a page tree and allows you to browse for records
1571 * @return string HTML content for the module
1573 function main_db() {
1575 // Starting content:
1576 $content=$this->doc
->startPage('TBE record selector');
1579 $pArr = explode('|',$this->bparams
);
1581 // Making the browsable pagetree:
1582 $pagetree = t3lib_div
::makeInstance('TBE_PageTree');
1583 $pagetree->thisScript
=$this->thisScript
;
1584 $pagetree->ext_pArrPages
= !strcmp($pArr[3],'pages')?
1:0;
1585 $pagetree->ext_showNavTitle
= $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
1586 $pagetree->ext_showPageId
= $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle');
1587 $pagetree->addField('nav_title');
1588 $tree=$pagetree->getBrowsableTree();
1590 // Making the list of elements, if applicable:
1591 $cElements = $this->TBE_expandPage($pArr[3]);
1593 // Putting the things together, side by side:
1597 Wrapper table for page tree / record list:
1599 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBrecords">
1601 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
1602 <td class="c-wCell" valign="top">'.$cElements.'</td>
1608 $content.='<br /><br />';
1610 // End page, return content:
1611 $content.= $this->doc
->endPage();
1612 $content = $this->doc
->insertStylesAndJS($content);
1617 * TYPO3 Element Browser: Showing a folder tree, allowing you to browse for files.
1619 * @return string HTML content for the module
1621 function main_file() {
1622 // include JS files and set prefs for foldertree
1623 $this->doc
->getDragDropCode('folders');
1624 $this->doc
->JScode
.= $this->doc
->wrapScriptTags('
1625 Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";
1628 // Starting content:
1629 $content = $this->doc
->startPage('TBE file selector');
1633 $pArr = explode('|',$this->bparams
);
1634 // Create upload/create folder forms, if a path is given:
1635 if ($this->expandFolder
) {
1636 $this->selectedFolder
= t3lib_file_Factory
::getInstance()->getFolderObjectFromCombinedIdentifier($this->expandFolder
);
1639 // @todo implement upload stuff (default upload folder of a storaget etc)
1640 if (!$this->selectedFolder
) {
1641 $fileStorages = $GLOBALS['BE_USER']->getFileStorages();
1642 $fileStorage = reset($fileStorages);
1643 $this->selectedFolder
= $fileStorage->getRootLevelFolder();
1646 if ($this->selectedFolder
) {
1647 $uploadForm = $this->uploadForm($this->selectedFolder
);
1648 $createFolder = $this->createFolder($this->selectedFolder
);
1650 $uploadForm = $createFolder = '';
1653 if ($GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
1654 $content .= $uploadForm;
1657 // Getting flag for showing/not showing thumbnails:
1658 $noThumbs = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
1661 // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
1662 $_MOD_MENU = array('displayThumbs' => '');
1663 $_MCONF['name']='file_list';
1664 $_MOD_SETTINGS = t3lib_BEfunc
::getModuleData($_MOD_MENU, t3lib_div
::_GP('SET'), $_MCONF['name']);
1666 $noThumbs = $noThumbs ?
$noThumbs : !$_MOD_SETTINGS['displayThumbs'];
1668 // Create folder tree:
1669 $foldertree = t3lib_div
::makeInstance('TBE_FolderTree');
1670 $foldertree->thisScript
=$this->thisScript
;
1671 $foldertree->ext_noTempRecyclerDirs
= ($this->mode
== 'filedrag');
1672 $tree=$foldertree->getBrowsableTree();
1674 list(,,$specUid) = explode('_',$this->PM
);
1676 if ($this->mode
=='filedrag') {
1677 $files = $this->TBE_dragNDrop($this->selectedFolder
, $pArr[3]);
1679 $files = $this->TBE_expandFolder($this->selectedFolder
, $pArr[3], $noThumbs);
1682 // Putting the parts together, side by side:
1686 Wrapper table for folder tree / file list:
1688 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles">
1690 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
1691 <td class="c-wCell" valign="top">'.$files.'</td>
1696 // Adding create folder + upload forms if applicable:
1697 if (!$GLOBALS['BE_USER']->getTSConfigVal('options.uploadFieldsInTopOfEB')) {
1698 $content .= $uploadForm;
1700 if ($GLOBALS['BE_USER']->isAdmin() ||
$GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
1701 $content .= $createFolder;
1705 $content.='<br /><br />';
1707 // Setup indexed elements:
1708 $this->doc
->JScode
.= $this->doc
->wrapScriptTags('BrowseLinks.addElements(' . json_encode($this->elements
) . ');');
1709 // Ending page, returning content:
1710 $content.= $this->doc
->endPage();
1711 $content = $this->doc
->insertStylesAndJS($content);
1717 * TYPO3 Element Browser: Showing a folder tree, allowing you to browse for folders.
1719 * @return string HTML content for the module
1721 function main_folder() {
1724 $this->doc
->getDragDropCode('folders');
1726 // setting prefs for foldertree
1727 $this->doc
->JScode
.= $this->doc
->wrapScriptTags('
1728 Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";
1731 // Starting content:
1732 $content = $this->doc
->startPage('TBE folder selector');
1735 $parameters = explode('|', $this->bparams
);
1737 if ($this->expandFolder
) {
1738 $this->selectedFolder
= t3lib_file_Factory
::getInstance()->getFolderObjectFromCombinedIdentifier($this->expandFolder
);
1741 if ($this->selectedFolder
) {
1742 $createFolder = $this->createFolder($this->selectedFolder
);
1747 // Create folder tree:
1748 $foldertree = t3lib_div
::makeInstance('TBE_FolderTree');
1749 $foldertree->thisScript
= $this->thisScript
;
1750 $foldertree->ext_noTempRecyclerDirs
= ($this->mode
== 'filedrag');
1751 $tree = $foldertree->getBrowsableTree(FALSE);
1753 list(, , $specUid) = explode('_', $this->PM
);
1755 if($this->mode
== 'filedrag') {
1756 $folders = $this->TBE_dragNDrop($this->selectedFolder
, $parameters[3]);
1758 $folders = $this->TBE_expandSubFolders($this->selectedFolder
);
1761 // Putting the parts together, side by side:
1765 Wrapper table for folder tree / folder list:
1767 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles">
1769 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
1770 <td class="c-wCell" valign="top">'.$folders.'</td>
1775 // Adding create folder if applicable:
1776 if ($GLOBALS['BE_USER']->isAdmin() ||
$GLOBALS['BE_USER']->getTSConfigVal('options.createFoldersInEB')) {
1777 $content .= $createFolder;
1781 $content .= '<br /><br />';
1783 // Ending page, returning content:
1784 $content.= $this->doc
->endPage();
1785 $content = $this->doc
->insertStylesAndJS($content);
1806 /******************************************************************
1810 ******************************************************************/
1812 * For RTE: This displays all content elements on a page and lets you create a link to the element.
1814 * @return string HTML output. Returns content only if the ->expandPage value is set (pointing to a page uid to show tt_content records from ...)
1816 function expandPage() {
1818 $expPageId = $this->expandPage
; // Set page id (if any) to expand
1820 // If there is an anchor value (content element reference) in the element reference, then force an ID to expand:
1821 if (!$this->expandPage
&& $this->curUrlInfo
['cElement']) {
1822 $expPageId = $this->curUrlInfo
['pageid']; // Set to the current link page id.
1825 // Draw the record list IF there is a page id to expand:
1826 if ($expPageId && t3lib_utility_Math
::canBeInterpretedAsInteger($expPageId) && $GLOBALS['BE_USER']->isInWebMount($expPageId)) {
1829 $out.=$this->barheader($GLOBALS['LANG']->getLL('contentElements').':');
1831 // Create header for listing, showing the page title/icon:
1832 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
1833 $mainPageRec = t3lib_BEfunc
::getRecordWSOL('pages',$expPageId);
1834 $picon = t3lib_iconWorks
::getSpriteIconForRecord('pages', $mainPageRec);
1835 $picon .= t3lib_BEfunc
::getRecordTitle('pages', $mainPageRec, TRUE);
1836 $out.=$picon.'<br />';
1838 // Look up tt_content elements from the expanded page:
1839 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1840 'uid,header,hidden,starttime,endtime,fe_group,CType,colPos,bodytext',
1842 'pid='.intval($expPageId).
1843 t3lib_BEfunc
::deleteClause('tt_content').
1844 t3lib_BEfunc
::versioningPlaceholderClause('tt_content'),
1848 $cc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
1850 // Traverse list of records:
1852 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1854 $icon = t3lib_iconWorks
::getSpriteIconForRecord('tt_content', $row);
1855 if ($this->curUrlInfo
['act']=='page' && $this->curUrlInfo
['cElement']==$row['uid']) {
1856 $arrCol='<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
1860 // Putting list element HTML together:
1861 $out.='<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/ol/join'.($c==$cc?
'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
1863 '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.$row['uid'].'\');">'.
1865 t3lib_BEfunc
::getRecordTitle('tt_content', $row, TRUE) .
1868 // Finding internal anchor points:
1869 if (t3lib_div
::inList('text,textpic', $row['CType'])) {
1870 $split = preg_split('/(<a[^>]+name=[\'"]?([^"\'>[:space:]]+)[\'"]?[^>]*>)/i', $row['bodytext'], -1, PREG_SPLIT_DELIM_CAPTURE
);
1872 foreach($split as $skey => $sval) {
1874 // Putting list element HTML together:
1875 $sval = substr($sval,0,100);
1876 $out.='<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/ol/line.gif','width="18" height="16"').' alt="" />'.
1877 '<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/ol/join'.($skey+
3>count($split)?
'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
1878 '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.rawurlencode($sval).'\');">'.
1879 htmlspecialchars(' <A> '.$sval).
1890 * For TYPO3 Element Browser: This lists all content elements from the given list of tables
1892 * @param string Commalist of tables. Set to "*" if you want all tables.
1893 * @return string HTML output.
1895 function TBE_expandPage($tables) {
1897 if ($this->expandPage
>= 0 && t3lib_utility_Math
::canBeInterpretedAsInteger($this->expandPage
) && $GLOBALS['BE_USER']->isInWebMount($this->expandPage
)) {
1899 // Set array with table names to list:
1900 if (!strcmp(trim($tables),'*')) {
1901 $tablesArr = array_keys($GLOBALS['TCA']);
1903 $tablesArr = t3lib_div
::trimExplode(',',$tables,1);
1907 // Headline for selecting records:
1908 $out.=$this->barheader($GLOBALS['LANG']->getLL('selectRecords').':');
1910 // Create the header, showing the current page for which the listing is. Includes link to the page itself, if pages are amount allowed tables.
1911 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
1912 $mainPageRec = t3lib_BEfunc
::getRecordWSOL('pages',$this->expandPage
);
1917 if (is_array($mainPageRec)) {
1918 $picon = t3lib_iconWorks
::getSpriteIconForRecord('pages', $mainPageRec);
1919 if (in_array('pages', $tablesArr)) {
1920 $ATag = "<a href=\"#\" onclick=\"return insertElement('pages', '" . $mainPageRec['uid'] .
1921 "', 'db', " . t3lib_div
::quoteJSvalue($mainPageRec['title']) . ", '', '', '','',1);\">";
1922 $ATag2 = "<a href=\"#\" onclick=\"return insertElement('pages', '" . $mainPageRec['uid'] .
1923 "', 'db', " . t3lib_div
::quoteJSvalue($mainPageRec['title']) . ", '', '', '','',0);\">";
1924 $ATag_alt = substr($ATag, 0, -4) . ",'',1);\">";
1928 $pBicon = ($ATag2 ?
'<img' . t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' alt="" />' : '');
1929 $pText=htmlspecialchars(t3lib_div
::fixed_lgd_cs($mainPageRec['title'],$titleLen));
1930 $out.=$picon.$ATag2.$pBicon.$ATag_e.$ATag.$pText.$ATag_e.'<br />';
1932 // Initialize the record listing:
1933 $id = $this->expandPage
;
1934 $pointer = t3lib_utility_Math
::forceIntegerInRange($this->pointer
,0,100000);
1935 $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
1936 $pageinfo = t3lib_BEfunc
::readPageAccess($id,$perms_clause);
1939 // Generate the record list:
1940 /** @var $dblist TBE_browser_recordList */
1941 $dblist = t3lib_div
::makeInstance('TBE_browser_recordList');
1942 $dblist->thisScript
=$this->thisScript
;
1943 $dblist->backPath
= $GLOBALS['BACK_PATH'];
1944 $dblist->thumbs
= 0;
1945 $dblist->calcPerms
= $GLOBALS['BE_USER']->calcPerms($pageinfo);
1946 $dblist->noControlPanels
=1;
1947 $dblist->clickMenuEnabled
=0;
1948 $dblist->tableList
=implode(',',$tablesArr);
1950 $dblist->start($id,t3lib_div
::_GP('table'),$pointer,
1951 t3lib_div
::_GP('search_field'),
1952 t3lib_div
::_GP('search_levels'),
1953 t3lib_div
::_GP('showLimit')
1955 $dblist->setDispFields();
1956 $dblist->generateList();
1957 $dblist->writeBottom();
1959 // Add the HTML for the record list to output variable:
1960 $out.=$dblist->HTMLcode
;
1962 // Add support for fieldselectbox in singleTableMode
1963 if ($dblist->table
) {
1964 $out.= $dblist->fieldSelectBox($dblist->table
);
1967 $out.=$dblist->getSearchBox();
1970 // Return accumulated content:
1976 * Render list of folders inside a folder.
1978 * @param string string of the current folder
1979 * @return string HTML output
1981 function TBE_expandSubFolders(t3lib_file_Folder
$folder) {
1984 if ($folder->checkActionPermission('browse')) {
1985 $content .= $this->folderList($folder);
1988 // Return accumulated content for folderlisting:
2002 /******************************************************************
2006 ******************************************************************/
2008 * For RTE: This displays all files from folder. No thumbnails shown
2010 * @param string The folder path to expand
2011 * @param string List of fileextensions to show
2012 * @return string HTML output
2014 function expandFolder(t3lib_file_Folder
$folder, $extensionList='') {
2016 $renderFolders = ($this->act
=== 'folder');
2017 if ($folder->checkActionPermission('browse')) {
2019 // Create header for filelisting:
2020 $out .= $this->barheader($GLOBALS['LANG']->getLL('files').':');
2022 // Prepare current path value for comparison (showing red arrow)
2023 $currentIdentifier = '';
2024 if ($this->curUrlInfo
['value']) {
2025 $currentIdentifier = $this->curUrlInfo
['info'];
2029 // Create header element; The folder from which files are listed.
2030 $titleLen = intval($GLOBALS['BE_USER']->uc
['titleLen']);
2032 $folderIcon = t3lib_iconWorks
::getSpriteIconForFile('folder');
2033 $folderIcon .= htmlspecialchars(t3lib_div
::fixed_lgd_cs($folder->getIdentifier(), $titleLen));
2035 $picon='<a href="#" onclick="return link_folder(\'file:'.$folder->getCombinedIdentifier().'\');">' . $folderIcon . '</a>';
2036 if ($this->curUrlInfo
['act'] == 'folder' && $currentIdentifier == $folder->getCombinedIdentifier()) {
2037 $out.= '<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
2039 $out.=$picon.'<br />';
2041 // Get files from the folder:
2042 if ($renderFolders) {
2043 $items = $folder->getSubfolders();
2045 $items = $folder->getFiles($extensionList);
2049 $totalItems = count($items);
2050 foreach ($items as $fileOrFolderObject) {
2053 if ($renderFolders) {
2054 $fileIdentifier = $fileOrFolderObject->getCombinedIdentifier();
2055 $icon = t3lib_iconWorks
::getSpriteIconForFile('folder');
2056 $itemUid = 'file:' . $fileIdentifier;
2058 $fileIdentifier = $fileOrFolderObject->getUid();
2060 $fileExtension = $fileOrFolderObject->getExtension();
2061 // Get size and icon:
2062 $size = ' (' . t3lib_div
::formatSize($fileOrFolderObject->getSize()) . 'bytes)';
2063 $icon = t3lib_iconWorks
::getSpriteIconForFile($fileExtension, array('title' => $fileOrFolderObject->getName() . $size));
2064 $itemUid = 'file:' . $fileIdentifier;
2067 // If the listed file turns out to be the CURRENT file, then show blinking arrow:
2068 if (($this->curUrlInfo
['act'] == 'file' ||
$this->curUrlInfo
['act'] == 'folder') && $currentIdentifier == $fileIdentifier) {
2069 $arrCol='<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
2074 // Put it all together for the file element:
2075 $out.='<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/ol/join'.($c == $totalItems ?
'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
2077 '<a href="#" onclick="return link_folder(\'' . $itemUid . '\');">'.
2079 htmlspecialchars(t3lib_div
::fixed_lgd_cs($fileOrFolderObject->getName(), $titleLen)).
2087 * For TYPO3 Element Browser: Expand folder of files.
2089 * @param t3lib_file_Folder $folder The folder path to expand
2090 * @param string $extensionList List of fileextensions to show
2091 * @param boolean $noThumbs Whether to show thumbnails or not. If set, no thumbnails are shown.
2092 * @return string HTML output
2094 function TBE_expandFolder(t3lib_file_Folder
$folder, $extensionList = '', $noThumbs = 0) {
2095 $extensionList = ($extensionList == '*') ?
'' : $extensionList;
2097 if ($folder->checkActionPermission('browse')) {
2098 // Listing the files:
2099 $files = $folder->getFiles($extensionList);
2100 $content = $this->fileList($files, $folder, $noThumbs);
2102 // Return accumulated content for filelisting:
2107 * Render list of files.
2109 * @param array $filed List of files. See t3lib_div::getFilesInDir
2110 * @param string t3lib_file_Folder If set a header with a folder icon and folder name are shown
2111 * @param boolean $noThumbs Whether to show thumbnails or not. If set, no thumbnails are shown.
2112 * @return string HTML output
2114 function fileList(array $files, t3lib_file_Folder
$folder = NULL, $noThumbs=0) {
2116 // Listing the files:
2117 if (is_array($files)) {
2120 // Create headline (showing number of files):
2121 $filesCount = count($files);
2122 $out .= $this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):', $filesCount));
2123 $out .= '<div id="filelist">';
2124 $out .= $this->getBulkSelector($filesCount);
2126 $titleLen = intval($GLOBALS['BE_USER']->uc
['titleLen']);
2128 // Create the header of current folder:
2130 $folderIcon = t3lib_iconWorks
::getSpriteIconForFile('folder');
2131 $lines[] = '<tr class="t3-row-header">
2132 <td colspan="4">' . $folderIcon . htmlspecialchars(t3lib_div
::fixed_lgd_cs($folder->getIdentifier(), $titleLen)) . '</td>
2136 if ($filesCount == 0) {
2138 <tr class="file_list_normal">
2139 <td colspan="4">No files found.</td>
2143 // Init graphic object for reading file dimensions:
2144 /** @var $imgObj t3lib_stdGraphic */
2145 $imgObj = t3lib_div
::makeInstance('t3lib_stdGraphic');
2147 $imgObj->mayScaleUp
= 0;
2148 $imgObj->tempPath
= PATH_site
. $imgObj->tempPath
;
2150 // Traverse the file list:
2151 foreach ($files as $fileObject) {
2152 $fileExtension = $fileObject->getExtension();
2153 // Thumbnail/size generation:
2154 if (t3lib_div
::inList(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']), strtolower($fileExtension)) && !$noThumbs) {
2155 $imageUrl = $fileObject->process(
2156 t3lib_file_ProcessedFile
::CONTEXT_IMAGEPREVIEW
,
2157 array('width' => 64, 'height' => 64)
2158 )->getPublicUrl(TRUE);
2160 $imgInfo = $imgObj->getImageDimensions($fileObject->getForLocalProcessing(FALSE));
2161 $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
2162 $clickIcon = '<img src="' . $imageUrl . '" hspace="5" vspace="5" border="1"';
2168 // Create file icon:
2169 $size = ' ('.t3lib_div
::formatSize($fileObject->getSize()) . 'bytes' . ($pDim ?
', ' . $pDim : '') . ')';
2170 $icon = t3lib_iconWorks
::getSpriteIconForFile($fileExtension, array('title' => $fileObject->getName() . $size));
2172 // Create links for adding the file:
2173 $filesIndex = count($this->elements
);
2174 $this->elements
['file_' . $filesIndex] = array(
2176 'table' => 'sys_file',
2177 'uid' => $fileObject->getUid(),
2178 'fileName' => $fileObject->getName(),
2179 'filePath' => $fileObject->getUid(),
2180 'fileExt' => $fileExtension,
2181 'fileIcon' => $icon,
2183 $ATag = "<a href=\"#\" onclick=\"return BrowseLinks.File.insertElement('file_$filesIndex');\">";
2184 $ATag_alt = substr($ATag,0,-4).",1);\">";
2185 $bulkCheckBox = '<input type="checkbox" class="typo3-bulk-item" name="file_'.$filesIndex.'" value="0" /> ';
2189 // Create link to showing details about the file in a window:
2190 $Ahref = $GLOBALS['BACK_PATH'].'show_item.php?type=file&table=_FILE&uid='.rawurlencode($fileObject->getCombinedIdentifier()).'&returnUrl='.rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI'));
2191 $ATag2='<a href="'.htmlspecialchars($Ahref).'">';
2194 // Combine the stuff:
2195 $filenameAndIcon = $bulkCheckBox . $ATag_alt . $icon . htmlspecialchars(t3lib_div
::fixed_lgd_cs($fileObject->getName(), $titleLen)) . $ATag_e;
2198 if ($pDim) { // Image...
2200 <tr class="file_list_normal">
2201 <td nowrap="nowrap">'.$filenameAndIcon.' </td>
2202 <td>' . $ATag . '<img' . t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList',1) . '" alt="" />' . $ATag_e . '</td>
2203 <td nowrap="nowrap">' . ($ATag2 . '<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $GLOBALS['LANG']->getLL('info', 1) . '" alt="" /> ' . $GLOBALS['LANG']->getLL('info', 1) . $ATag2_e) . '</td>
2204 <td nowrap="nowrap"> '.$pDim.'</td>
2208 <td class="filelistThumbnail" colspan="4">' . $ATag_alt . $clickIcon . $ATag_e . '</td>
2212 <tr class="file_list_normal">
2213 <td nowrap="nowrap">'.$filenameAndIcon.' </td>
2214 <td>' . $ATag . '<img' . t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif','width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList',1) . '" alt="" />' . $ATag_e . '</td>
2215 <td nowrap="nowrap">' . ($ATag2 . '<img' . t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/zoom2.gif','width="12" height="12"') . ' title="' . $GLOBALS['LANG']->getLL('info', 1) . '" alt="" /> ' . $GLOBALS['LANG']->getLL('info', 1) . $ATag2_e) . '</td>
2221 // Wrap all the rows in table tags:
2229 <table cellpadding="0" cellspacing="0" id="typo3-filelist">
2230 '.implode('',$lines).'
2233 // Return accumulated content for filelisting:
2239 * Render list of folders.
2241 * @param array List of folders. See t3lib_div::get_dirs
2242 * @param string If set a header with a folder icon and folder name are shown
2243 * @return string HTML output
2245 function folderList($baseFolder, $folders) {
2248 // Create headline (showing number of folders):
2249 $content.=$this->barheader(
2250 sprintf($GLOBALS['LANG']->getLL('folders').' (%s):',count($folders))
2253 $titleLength = intval($GLOBALS['BE_USER']->uc
['titleLen']);
2255 // Create the header of current folder:
2257 if (strstr($baseFolder, ',') ||
strstr($baseFolder, '|')) {
2258 // In case an invalid character is in the filepath, display error message:
2259 $errorMessage = $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('invalidChar'), ', |'));
2260 $aTag = $aTag_alt = "<a href=\"#\" onclick=\"alert(".$errorMessage.");return false;\">";
2262 // If foldername is OK, just add it:
2263 $aTag = "<a href=\"#\" onclick=\"return insertElement('','".rawurlencode($baseFolder)."', 'folder', '".rawurlencode($baseFolder)."', unescape('".rawurlencode($baseFolder)."'), '".$fI['extension']."', '".$ficon."');\">";
2264 $aTag_alt = substr($aTag,0,-4).",'',1);\">";
2268 // add the foder icon
2269 $folderIcon = $aTag_alt;
2270 $folderIcon.= '<img'.t3lib_iconWorks
::skinImg(
2271 $GLOBALS['BACK_PATH'],
2272 'gfx/i/_icon_webfolders.gif','width="18" height="16"'
2274 $folderIcon.= htmlspecialchars(
2275 t3lib_div
::fixed_lgd_cs(basename($baseFolder),$titleLength)
2277 $folderIcon.= $aTag_e;
2279 $content.=$folderIcon.'<br />';
2282 // Listing the folders:
2283 if(is_array($folders)) {
2284 if(count($folders) > 0) {
2285 // Traverse the folder list:
2287 foreach($folders as $folderPath) {
2288 $pathInfo = pathinfo($folderPath);
2290 // Create folder icon:
2291 $icon = '<img src="clear.gif" width="16" height="16" alt="" /><img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'], 'gfx/i/_icon_webfolders.gif','width="16" height="16"').' title="'.htmlspecialchars($pathInfo['basename'].$size).'" class="absmiddle" alt="" />';
2293 // Create links for adding the folder:
2294 if($this->P
['itemName'] != '' && $this->P
['formName'] != '') {
2295 $aTag = "<a href=\"#\" onclick=\"return set_folderpath(unescape('".rawurlencode($folderPath)."'));\">";
2297 $aTag = "<a href=\"#\" onclick=\"return insertElement('','".rawurlencode($folderPath)."', 'folder', '".rawurlencode($folderPath)."', unescape('".rawurlencode($folderPath)."'), '".$pathInfo['extension']."', '".$ficon."');\">";
2300 if (strstr($folderPath,',') ||
strstr($folderPath,'|')) {
2301 // In case an invalid character is in the filepath, display error message:
2302 $errorMessage = $GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('invalidChar'), ', |'));
2303 $aTag = $aTag_alt = "<a href=\"#\" onclick=\"alert(".$errorMessage.");return false;\">";
2305 // If foldername is OK, just add it:
2306 $aTag_alt = substr($aTag,0,-4).",'',1);\">";
2310 // Combine icon and folderpath:
2311 $foldernameAndIcon = $aTag_alt.$icon.htmlspecialchars(
2312 t3lib_div
::fixed_lgd_cs(basename($folderPath),$titleLength)
2315 if($this->P
['itemName'] != '') {
2317 <tr class="bgColor4">
2318 <td nowrap="nowrap">'.$foldernameAndIcon.' </td>
2323 <tr class="bgColor4">
2324 <td nowrap="nowrap">'.$foldernameAndIcon.' </td>
2325 <td>' . $aTag . '<img' . t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $GLOBALS['LANG']->getLL('addToList', 1) . '" alt="" />' . $aTag_e .' </td>
2332 <td colspan="3"><img src="clear.gif" width="1" height="3" alt="" /></td>
2337 // Wrap all the rows in table tags:
2343 <table border="0" cellpadding="0" cellspacing="1" id="typo3-folderList">
2344 '.implode('', $lines).'
2348 // Return accumulated content for folderlisting:
2353 * For RTE: This displays all IMAGES (gif,png,jpg) (from extensionList) from folder. Thumbnails are shown for images.
2354 * This listing is of images located in the web-accessible paths ONLY - the listing is for drag-n-drop use in the RTE
2356 * @param t3lib_file_Folder $folder The folder path to expand
2357 * @param string $extensionList List of fileextensions to show
2358 * @return string HTML output
2360 function TBE_dragNDrop(t3lib_file_Folder
$folder, $extensionList='') {
2361 $extensionList = ($extensionList == '*') ?
'' : $extensionList;
2364 if ($folder->getStorage()->isPublic()) {
2366 // Read files from directory:
2367 $files = $folder->getFiles($extensionList);
2368 if (is_array($files)) {
2369 $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):', count($files)));
2371 $titleLen = intval($GLOBALS['BE_USER']->uc
['titleLen']);
2372 $picon = '<img' . t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'], 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
2373 $picon .= htmlspecialchars(t3lib_div
::fixed_lgd_cs(basename($folder->getName()), $titleLen));
2374 $out .= $picon . '<br />';
2379 // Add "drag-n-drop" message:
2382 <td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
2386 foreach ($files as $fileObject) {
2387 $fileInfo = $fileObject->getStorage()->getFileInfo($fileObject);
2390 $iUrl = t3lib_div
::rawurlencodeFP($fileObject->getPublicUrl(TRUE));
2392 // Show only web-images
2393 $fileExtension = strtolower($fileObject->getExtension());
2394 if (t3lib_div
::inList('gif,jpeg,jpg,png', $fileExtension)) {
2395 $imgInfo = @getimagesize
($fileObject->getForLocalProcessing(FALSE));
2396 $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels';
2398 $size = ' ('.t3lib_div
::formatSize($fileObject->getSize()) . 'bytes' . ($pDim ?
', ' . $pDim : '') . ')';
2399 $filenameAndIcon = t3lib_iconWorks
::getSpriteIconForFile($fileExtension, array('title' => $fileObject->getName() . $size));
2401 if (t3lib_div
::_GP('noLimit')) {
2411 $IH=ceil($IH/$IW*$maxW);
2415 $IW=ceil($IW/$IH*$maxH);
2421 <tr class="bgColor4">
2422 <td nowrap="nowrap">'.$filenameAndIcon.' </td>
2423 <td nowrap="nowrap">'.
2424 ($imgInfo[0]!=$IW ?
'<a href="'.htmlspecialchars(t3lib_div
::linkThisScript(array('noLimit'=>'1'))).'">'.
2425 '<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/icon_warning2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('clickToRedrawFullSize',1).'" alt="" />'.
2432 <td colspan="2"><img src="' . $iUrl . '" data-htmlarea-file-uid="' . $fileObject->getUid() . '" width="'.$IW.'" height="'.$IH.'" border="1" alt="" /></td>
2436 <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
2441 // Finally, wrap all rows in a table tag:
2446 File listing / Drag-n-drop
2448 <table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
2449 '.implode('',$lines).'
2453 // Print this warning if the folder is NOT a web folder:
2454 $out.=$this->barheader($GLOBALS['LANG']->getLL('files'));
2455 $out.=$this->getMsgBox($GLOBALS['LANG']->getLL('noWebFolder'),'icon_warning2');
2472 /******************************************************************
2474 * Miscellaneous functions
2476 ******************************************************************/
2480 * Verifies that a path is a web-folder:
2482 * @param string Absolute filepath
2483 * @return boolean If the input path is found in PATH_site then it returns TRUE.
2485 function isWebFolder($folder) {
2486 $folder = rtrim($folder, '/').'/';
2487 return t3lib_div
::isFirstPartOfStr($folder,PATH_site
) ?
TRUE : FALSE;
2491 * Checks, if a path is within the mountpoints of the backend user
2493 * @param string Absolute filepath
2494 * @return boolean If the input path is found in the backend users filemounts, then return TRUE.
2496 function checkFolder($folder) {
2497 return $this->fileProcessor
->checkPathAgainstMounts(rtrim($folder, '/') . '/') ?
TRUE : FALSE;
2501 * Checks, if a path is within a read-only mountpoint of the backend user
2503 * @param string Absolute filepath
2504 * @return boolean If the input path is found in the backend users filemounts and if the filemount is of type readonly, then return TRUE.
2506 function isReadOnlyFolder($folder) {
2507 return ($GLOBALS['FILEMOUNTS'][$this->fileProcessor
->checkPathAgainstMounts(rtrim($folder, '/') . '/')]['type'] == 'readonly');
2511 * Prints a 'header' where string is in a tablecell
2513 * @param string The string to print in the header. The value is htmlspecialchars()'ed before output.
2514 * @return string The header HTML (wrapped in a table)
2516 function barheader($str) {
2518 <!-- Bar header: -->
2519 <h3>' . htmlspecialchars($str) . '</h3>
2524 * Displays a message box with the input message
2526 * @param string Input message to show (will be htmlspecialchars()'ed inside of this function)
2527 * @param string Icon filename body from gfx/ (default is "icon_note") - meant to allow change to warning type icons...
2528 * @return string HTML for the message (wrapped in a table).
2530 function getMsgBox($in_msg,$icon='icon_note') {
2531 $msg = '<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/'.$icon.'.gif','width="18" height="16"').' alt="" />'.htmlspecialchars($in_msg);
2537 <table cellspacing="0" class="bgColor4" id="typo3-msgBox">
2547 * For RTE/link: This prints the 'currentUrl'
2549 * @param string $str URL value. The value is htmlspecialchars()'ed before output.
2550 * @return string HTML content, wrapped in a table.
2552 function printCurrentUrl($str) {
2553 // output the folder or file identifier, when working with files
2554 if ($str && $this->act
== 'file' ||
$this->act
== 'folder') {
2556 $fileObject = t3lib_file_Factory
::getInstance()->retrieveFileOrFolderObject($str);
2557 if (is_object($fileObject)) {
2558 $str = $fileObject->getIdentifier();
2560 } catch (t3lib_file_exception_FileDoesNotExistException
$e) {
2567 <!-- Print current URL -->
2568 <table border="0" cellpadding="0" cellspacing="0" id="typo3-curUrl">
2570 <td>' . $GLOBALS['LANG']->getLL('currentLink',1) . ': ' .htmlspecialchars(rawurldecode($str)) . '</td>
2579 * For RTE/link: Parses the incoming URL and determines if it's a page, file, external or mail address.
2581 * @param string HREF value tp analyse
2582 * @param string The URL of the current website (frontend)
2583 * @return array Array with URL information stored in assoc. keys: value, act (page, file, spec, mail), pageid, cElement, info
2585 function parseCurUrl($href, $siteUrl) {
2586 $href = trim($href);
2590 // Default is "url":
2591 $info['value']=$href;
2594 $specialParts = explode('#_SPECIAL',$href);
2595 if (count($specialParts)==2) { // Special kind (Something RTE specific: User configurable links through: "userLinks." from ->thisConfig)
2596 $info['value']='#_SPECIAL'.$specialParts[1];
2597 $info['act']='spec';
2598 // is a FAL resource/identifier
2599 } elseif (strpos($href, 'file:') !== FALSE) {
2600 $rel = substr($href, strpos($href, 'file:')+
5);
2601 $rel = rawurldecode($rel);
2603 // resolve FAL-api "file:UID-of-sys_file-record" and "file:combined-identifier"
2604 $fileOrFolderObject = t3lib_file_Factory
::getInstance()->retrieveFileOrFolderObject($rel);
2606 if ($fileOrFolderObject instanceof t3lib_file_Folder
) {
2607 $info['act'] = 'folder';
2608 $info['value'] = $fileOrFolderObject->getCombinedIdentifier();
2609 } elseif ($fileOrFolderObject instanceof t3lib_file_FileInterface
) {
2610 $info['act'] = 'file';
2611 $info['value'] = $fileOrFolderObject->getUid();
2613 $info['value'] = $rel;
2616 } elseif (t3lib_div
::isFirstPartOfStr($href,$siteUrl)) { // If URL is on the current frontend website:
2617 if (file_exists(PATH_site
.rawurldecode($href))) { // URL is a file, which exists:
2618 $info['value']=rawurldecode($href);
2619 if (@is_dir
(PATH_site
. $info['value'])) {
2620 $info['act'] = 'folder';
2622 $info['act'] = 'file';
2624 } else { // URL is a page (id parameter)
2625 $uP=parse_url($rel);
2626 if (!trim($uP['path'])) {
2627 $pp = preg_split('/^id=/', $uP['query']);
2628 $pp[1] = preg_replace( '/&id=[^&]*/', '', $pp[1]);
2629 $parameters = explode('&', $pp[1]);
2630 $id = array_shift($parameters);
2632 // Checking if the id-parameter is an alias.
2633 if (!t3lib_utility_Math
::canBeInterpretedAsInteger($id)) {
2634 list($idPartR) = t3lib_BEfunc
::getRecordsByField('pages','alias',$id);
2635 $id=intval($idPartR['uid']);
2638 $pageRow = t3lib_BEfunc
::getRecordWSOL('pages',$id);
2639 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
2640 $info['value']=$GLOBALS['LANG']->getLL('page',1)." '".htmlspecialchars(t3lib_div
::fixed_lgd_cs($pageRow['title'],$titleLen))."' (ID:".$id.($uP['fragment']?
', #'.$uP['fragment']:'').')';
2641 $info['pageid']=$id;
2642 $info['cElement']=$uP['fragment'];
2643 $info['act']='page';
2644 $info['query'] = $parameters[0]?
'&'.implode('&', $parameters):'';
2648 } else { // Email link:
2649 if (strtolower(substr($href,0,7))=='mailto:') {
2650 $info['value']=trim(substr($href,7));
2651 $info['act']='mail';
2654 $info['info'] = $info['value'];
2655 } else { // NO value inputted:
2657 $info['info']=$GLOBALS['LANG']->getLL('none');
2659 $info['act']='page';
2662 // let the hook have a look
2663 foreach($this->hookObjects
as $hookObject) {
2664 $info = $hookObject->parseCurrentUrl($href, $siteUrl, $info);
2671 * For TBE: Makes an upload form for uploading files to the filemount the user is browsing.
2672 * The files are uploaded to the tce_file.php script in the core which will handle the upload.
2674 * @param t3lib_file_Folder $folderObject Absolute filepath on server to which to upload.
2675 * @return string HTML for an upload form.
2677 function uploadForm(t3lib_file_Folder
$folderObject) {
2678 if (!$folderObject->checkActionPermission('write')) {
2682 // Read configuration of upload field count
2683 $userSetting = $GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.uploadFieldsInLinkBrowser');
2684 $count = isset($userSetting) ?
$userSetting : 3;
2685 if ($count === '0') {
2688 $count = intval($count) == 0 ?
3 : intval($count);
2690 // Create header, showing upload path:
2691 $header = $folderObject->getIdentifier();
2695 Form, for uploading files:
2697 <form action="' . $GLOBALS['BACK_PATH'] . 'tce_file.php" method="post" name="editform" id="typo3-uplFilesForm" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">
2698 <table border="0" cellpadding="0" cellspacing="0" id="typo3-uplFiles">
2700 <td>' . $this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.pagetitle', 1) . ':') . '</td>
2703 <td class="c-wCell c-hCell"><strong>' . $GLOBALS['LANG']->getLL('path', 1) . ':</strong> ' . htmlspecialchars($header) . '</td>
2706 <td class="c-wCell c-hCell">';
2708 // Traverse the number of upload fields (default is 3):
2709 for ($a=1;$a<=$count;$a++
) {
2710 $code.='<input type="file" multiple="multiple" name="upload_'.$a.'"'.$this->doc
->formWidth(35).' size="50" />
2711 <input type="hidden" name="file[upload]['.$a.'][target]" value="'.htmlspecialchars($folderObject->getCombinedIdentifier()).'" />
2712 <input type="hidden" name="file[upload]['.$a.'][data]" value="'.$a.'" /><br />';
2715 // Make footer of upload form, including the submit button:
2716 $redirectValue = $this->thisScript
.'?act='.$this->act
.'&mode='.$this->mode
.'&expandFolder='.rawurlencode($folderObject->getCombinedIdentifier()).'&bparams='.rawurlencode($this->bparams
);
2717 $code .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($redirectValue) . '" />';
2720 <div id="c-override">
2721 <label><input type="checkbox" name="overwriteExistingFiles" id="overwriteExistingFiles" value="1" /> ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:overwriteExistingFiles', 1) . '</label>
2723 <input type="submit" name="submit" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit', 1) . '" />
2736 * For TBE: Makes a form for creating new folders in the filemount the user is browsing.
2737 * The folder creation request is sent to the tce_file.php script in the core which will handle the creation.
2739 * @param t3lib_file_Folder $folderObject Absolute filepath on server in which to create the new folder.
2740 * @return string HTML for the create folder form.
2742 function createFolder(t3lib_file_Folder
$folderObject) {
2743 if (!$folderObject->checkActionPermission('write')) {
2747 // Don't show Folder-create form if it's denied
2748 if ($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.hideCreateFolder')) {
2751 // Create header, showing upload path:
2752 $header = $folderObject->getIdentifier();
2756 Form, for creating new folders:
2758 <form action="' . $GLOBALS['BACK_PATH'] . 'tce_file.php" method="post" name="editform2" id="typo3-crFolderForm">
2759 <table border="0" cellpadding="0" cellspacing="0" id="typo3-crFolder">
2761 <td>' . $this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle') . ':') . '</td>
2764 <td class="c-wCell c-hCell"><strong>' . $GLOBALS['LANG']->getLL('path', 1) . ':</strong> ' . htmlspecialchars($header) . '</td>
2767 <td class="c-wCell c-hCell">';
2769 // Create the new-folder name field:
2771 $code.='<input'.$this->doc
->formWidth(20).' type="text" name="file[newfolder]['.$a.'][data]" />'.
2772 '<input type="hidden" name="file[newfolder]['.$a.'][target]" value="'.htmlspecialchars($folderObject->getCombinedIdentifier()).'" />';
2774 // Make footer of upload form, including the submit button:
2775 $redirectValue = $this->thisScript
.'?act='.$this->act
.'&mode='.$this->mode
.'&expandFolder='.rawurlencode($folderObject->getCombinedIdentifier()).'&bparams='.rawurlencode($this->bparams
);
2776 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
2777 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.submit',1).'" />';
2788 * Get the HTML data required for a bulk selection of files of the TYPO3 Element Browser.
2790 * @param integer $filesCount: Number of files currently displayed
2791 * @return string HTML data required for a bulk selection of files - if $filesCount is 0, nothing is returned
2793 function getBulkSelector($filesCount) {
2795 $labelToggleSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.php:toggleSelection',1);
2796 $labelImportSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.php:importSelection',1);
2798 // Getting flag for showing/not showing thumbnails:
2799 $noThumbsInEB = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
2801 $out = $this->doc
->spacer(10).'<div>' .
2802 '<a href="#" onclick="BrowseLinks.Selector.handle()">' .
2803 '<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/import.gif','width="12" height="12"').' title="'.$labelImportSelection.'" alt="" /> ' .
2804 $labelImportSelection.'</a> ' .
2805 '<a href="#" onclick="BrowseLinks.Selector.toggle()">' .
2806 '<img'.t3lib_iconWorks
::skinImg($GLOBALS['BACK_PATH'],'gfx/clip_select.gif','width="12" height="12"').' title="'.$labelToggleSelection.'" alt="" /> ' .
2807 $labelToggleSelection.'</a>' .
2810 $thumbNailCheck = '';
2811 if (!$noThumbsInEB && $this->selectedFolder
) {
2813 // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
2814 $_MOD_MENU = array('displayThumbs' => '');
2815 $_MCONF['name'] = 'file_list';
2816 $_MOD_SETTINGS = t3lib_BEfunc
::getModuleData($_MOD_MENU, t3lib_div
::_GP('SET'), $_MCONF['name']);
2817 $addParams = '&act=' . $this->act
. '&mode=' . $this->mode
. '&expandFolder=' . rawurlencode($this->selectedFolder
->getCombinedIdentifier()) . '&bparams=' . rawurlencode($this->bparams
);
2818 $thumbNailCheck = t3lib_BEfunc
::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'], $this->thisScript
, $addParams, 'id="checkDisplayThumbs"') . ' <label for="checkDisplayThumbs">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.php:displayThumbs', 1) . '</label>';
2819 $out .= $this->doc
->spacer(5) . $thumbNailCheck . $this->doc
->spacer(15);
2821 $out .= $this->doc
->spacer(15);
2828 * Determines whether submitted field change functions are valid
2829 * and are coming from the system and not from an external abuse.
2831 * @param boolean $allowFlexformSections Whether to handle flexform sections differently
2832 * @return boolean Whether the submitted field change functions are valid
2834 protected function areFieldChangeFunctionsValid($handleFlexformSections = FALSE) {
2837 if (isset($this->P
['fieldChangeFunc']) && is_array($this->P
['fieldChangeFunc']) && isset($this->P
['fieldChangeFuncHash'])) {
2839 $pattern = '#\[el\]\[(([^]-]+-[^]-]+-)(idx\d+-)([^]]+))\]#i';
2841 $fieldChangeFunctions = $this->P
['fieldChangeFunc'];
2843 // Special handling of flexform sections:
2844 // Field change functions are modified in JavaScript, thus the hash is always invalid
2845 if ($handleFlexformSections && preg_match($pattern, $this->P
['itemName'], $matches)) {
2846 $originalName = $matches[1];
2847 $cleanedName = $matches[2] . $matches[4];
2849 foreach ($fieldChangeFunctions as &$value) {
2850 $value = str_replace($originalName, $cleanedName, $value);
2855 $result = ($this->P
['fieldChangeFuncHash'] === t3lib_div
::hmac(serialize($fieldChangeFunctions)));