4236c20fb6f752b6f72e28acdba313619c4bf245
2 /***************************************************************
5 * (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 * Displays the page/file tree for browsing database records or files.
29 * Used from TCEFORMS an other elements
30 * In other words: This is the ELEMENT BROWSER!
33 * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
36 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
39 * [CLASS/FUNCTION INDEX of SCRIPT]
43 * 155: class TBE_browser_recordList extends localRecordList
44 * 163: function TBE_browser_recordList ()
45 * 175: function listURL($altId='',$table=-1,$exclList='')
46 * 194: function ext_addP()
47 * 211: function linkWrapItems($table,$uid,$code,$row)
48 * 244: function linkWrapTable($table,$code)
51 * 261: class localPageTree extends t3lib_browseTree
52 * 268: function localPageTree()
53 * 284: function wrapTitle($title,$v,$ext_pArrPages='')
54 * 299: function printTree($treeArr='')
55 * 350: function ext_isLinkable($doktype,$uid)
56 * 364: function PM_ATagWrap($icon,$cmd,$bMark='')
57 * 381: function wrapIcon($icon,$row)
60 * 400: class rtePageTree extends localPageTree
63 * 417: class TBE_PageTree extends localPageTree
64 * 426: function ext_isLinkable($doktype,$uid)
65 * 438: function wrapTitle($title,$v,$ext_pArrPages)
68 * 464: class localFolderTree extends t3lib_folderTree
69 * 473: function localFolderTree()
70 * 485: function wrapTitle($title,$v)
71 * 500: function ext_isLinkable($v)
72 * 517: function PM_ATagWrap($icon,$cmd,$bMark='')
73 * 532: function printTree($treeArr='')
76 * 599: class rteFolderTree extends localFolderTree
79 * 615: class TBE_FolderTree extends localFolderTree
80 * 624: function ext_isLinkable($v)
81 * 637: function wrapTitle($title,$v)
84 * 658: class browse_links
85 * 764: function init()
86 * 1034: function processSessionData($data)
88 * SECTION: Main functions
89 * 1077: function main_rte($wiz=0)
90 * 1379: function main_db()
91 * 1424: function main_file()
93 * SECTION: Record listing
94 * 1534: function expandPage()
95 * 1615: function TBE_expandPage($tables)
97 * SECTION: File listing
98 * 1708: function expandFolder($expandFolder=0,$extensionList='')
99 * 1778: function TBE_expandFolder($expandFolder=0,$extensionList='',$noThumbs=0)
100 * 1801: function fileList($files, $folderName='', $noThumbs=0)
101 * 1918: function TBE_dragNDrop($expandFolder=0,$extensionList='')
103 * SECTION: Miscellaneous functions
104 * 2046: function isWebFolder($folder)
105 * 2057: function checkFolder($folder)
106 * 2070: function barheader($str)
107 * 2087: function getMsgBox($in_msg,$icon='icon_note')
108 * 2111: function printCurrentUrl($str)
109 * 2131: function parseCurUrl($href,$siteUrl)
110 * 2193: function uploadForm($path)
111 * 2247: function createFolder($path)
113 * TOTAL FUNCTIONS: 39
114 * (This index is automatically created/updated by the extension "extdeveval")
118 require_once (PATH_t3lib
.'class.t3lib_browsetree.php');
119 require_once (PATH_t3lib
.'class.t3lib_foldertree.php');
120 require_once (PATH_t3lib
.'class.t3lib_stdgraphic.php');
121 require_once (PATH_t3lib
.'class.t3lib_basicfilefunc.php');
125 require_once (PATH_t3lib
.'class.t3lib_page.php');
126 require_once (PATH_t3lib
.'class.t3lib_recordlist.php');
127 require_once (PATH_typo3
.'/class.db_list.inc');
128 require_once (PATH_typo3
.'/class.db_list_extra.inc');
129 require_once (PATH_t3lib
.'/class.t3lib_pagetree.php');
150 * Local version of the record list.
152 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
156 class TBE_browser_recordList
extends localRecordList
{
157 var $thisScript = 'browse_links.php';
160 * Initializes the script path
164 function TBE_browser_recordList () {
165 $this->thisScript
= t3lib_div
::getIndpEnv('SCRIPT_NAME');
169 * Creates the URL for links
171 * @param mixed If not blank string, this is used instead of $this->id as the id value.
172 * @param string If this is "-1" then $this->table is used, otherwise the value of the input variable.
173 * @param string Commalist of fields NOT to pass as parameters (currently "sortField" and "sortRev")
174 * @return string Query-string for URL
176 function listURL($altId='',$table=-1,$exclList='') {
177 return $this->thisScript
.
178 '?id='.(strcmp($altId,'')?
$altId:$this->id
).
179 '&table='.rawurlencode($table==-1?
$this->table
:$table).
180 ($this->thumbs?
'&imagemode='.$this->thumbs
:'').
181 ($this->searchString?
'&search_field='.rawurlencode($this->searchString
):'').
182 ($this->searchLevels?
'&search_levels='.rawurlencode($this->searchLevels
):'').
183 ((!$exclList ||
!t3lib_div
::inList($exclList,'sortField')) && $this->sortField?
'&sortField='.rawurlencode($this->sortField
):'').
184 ((!$exclList ||
!t3lib_div
::inList($exclList,'sortRev')) && $this->sortRev?
'&sortRev='.rawurlencode($this->sortRev
):'').
191 * Returns additional, local GET parameters to include in the links of the record list.
195 function ext_addP() {
196 $str = '&act='.$GLOBALS['SOBE']->browser
->act
.
197 '&mode='.$GLOBALS['SOBE']->browser
->mode
.
198 '&expandPage='.$GLOBALS['SOBE']->browser
->expandPage
.
199 '&bparams='.rawurlencode($GLOBALS['SOBE']->browser
->bparams
);
204 * Returns the title (based on $code) of a record (from table $table) with the proper link around (that is for "pages"-records a link to the level of that record...)
206 * @param string Table name
207 * @param integer UID (not used here)
208 * @param string Title string
209 * @param array Records array (from table name)
212 function linkWrapItems($table,$uid,$code,$row) {
213 global $TCA, $BACK_PATH;
216 $code = '<i>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</i>';
218 $code = htmlspecialchars(t3lib_div
::fixed_lgd_cs($code,$this->fixedL
));
221 $title = t3lib_BEfunc
::getRecordTitle($table,$row,FALSE,TRUE);
222 $ficon = t3lib_iconWorks
::getIcon($table,$row);
223 $aOnClick = "return insertElement('".$table."', '".$row['uid']."', 'db', ".t3lib_div
::quoteJSvalue($title).", '', '', '".$ficon."');";
224 $ATag = '<a href="#" onclick="'.$aOnClick.'">';
225 $ATag_alt = substr($ATag,0,-4).',\'\',1);">';
229 '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('addToList',1).'" alt="" />'.
237 * Local version that sets allFields to true to support userFieldSelect
240 * @see fieldSelectBox
242 function generateList() {
243 $this->allFields
= true;
244 parent
::generateList();
254 * Class which generates the page tree
256 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
260 class localPageTree
extends t3lib_browseTree
{
263 * Constructor. Just calling init()
267 function localPageTree() {
268 $this->thisScript
= t3lib_div
::getIndpEnv('SCRIPT_NAME');
272 $this->clause
= ' AND doktype!=255'.$this->clause
;
276 * Wrapping the title in a link, if applicable.
278 * @param string Title, (must be ready for output, that means it must be htmlspecialchars()'ed).
279 * @param array The record
280 * @param boolean (Ignore)
281 * @return string Wrapping title string.
283 function wrapTitle($title,$v,$ext_pArrPages='') {
284 if ($this->ext_isLinkable($v['doktype'],$v['uid'])) {
285 $aOnClick = "return link_typo3Page('".$v['uid']."');";
286 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
288 return '<span style="color: #666666;">'.$title.'</span>';
293 * Create the page navigation tree in HTML
295 * @param array Tree array
296 * @return string HTML output.
298 function printTree($treeArr='') {
300 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
301 if (!is_array($treeArr)) $treeArr=$this->tree
;
306 foreach($treeArr as $k => $v) {
308 $bgColorClass = ($c+
1)%2 ?
'bgColor' : 'bgColor-10';
309 if ($GLOBALS['SOBE']->browser
->curUrlInfo
['act']=='page' && $GLOBALS['SOBE']->browser
->curUrlInfo
['pageid']==$v['row']['uid'] && $GLOBALS['SOBE']->browser
->curUrlInfo
['pageid']) {
310 $arrCol='<td><img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
311 $bgColorClass='bgColor4';
316 $aOnClick = 'return jumpToUrl(\''.$this->thisScript
.'?act='.$GLOBALS['SOBE']->browser
->act
.'&mode='.$GLOBALS['SOBE']->browser
->mode
.'&expandPage='.$v['row']['uid'].'\');';
317 $cEbullet = $this->ext_isLinkable($v['row']['doktype'],$v['row']['uid']) ?
318 '<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' :
321 <tr class="'.$bgColorClass.'">
322 <td nowrap="nowrap"'.($v['row']['_CSSCLASS'] ?
' class="'.$v['row']['_CSSCLASS'].'"' : '').'>'.
324 $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$this->ext_pArrPages
).
327 '<td>'.$cEbullet.'</td>
334 Navigation Page Tree:
336 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
343 * Returns true if a doktype can be linked.
345 * @param integer Doktype value to test
346 * @param integer uid to test.
349 function ext_isLinkable($doktype,$uid) {
350 if ($uid && $doktype<199) {
356 * Wrap the plus/minus icon in a link
358 * @param string HTML string to wrap, probably an image tag.
359 * @param string Command for 'PM' get var
360 * @param boolean If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
361 * @return string Link-wrapped input string
363 function PM_ATagWrap($icon,$cmd,$bMark='') {
365 $anchor = '#'.$bMark;
366 $name=' name="'.$bMark.'"';
368 $aOnClick = "return jumpToUrl('".$this->thisScript
.'?PM='.$cmd."','".$anchor."');";
370 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
374 * Wrapping the image tag, $icon, for the row, $row
376 * @param string The image tag for the icon
377 * @param array The row for the current element
378 * @return string The processed icon input value.
380 function wrapIcon($icon,$row) {
381 return $this->addTagAttributes($icon,' title="id='.$row['uid'].'"');
393 * Page tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
395 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
399 class rtePageTree
extends localPageTree
{
410 * For TBE record browser
412 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
416 class TBE_PageTree
extends localPageTree
{
419 * Returns true if a doktype can be linked (which is always the case here).
421 * @param integer Doktype value to test
422 * @param integer uid to test.
425 function ext_isLinkable($doktype,$uid) {
430 * Wrapping the title in a link, if applicable.
432 * @param string Title, ready for output.
433 * @param array The record
434 * @param boolean If set, pages clicked will return immediately, otherwise reload page.
435 * @return string Wrapping title string.
437 function wrapTitle($title,$v,$ext_pArrPages) {
438 if ($ext_pArrPages) {
439 $ficon=t3lib_iconWorks
::getIcon('pages',$v);
440 $onClick = "return insertElement('pages', '".$v['uid']."', 'db', ".t3lib_div
::quoteJSvalue($v['title']).", '', '', '".$ficon."','',1);";
442 $onClick = htmlspecialchars('return jumpToUrl(\''.$this->thisScript
.'?act='.$GLOBALS['SOBE']->browser
->act
.'&mode='.$GLOBALS['SOBE']->browser
->mode
.'&expandPage='.$v['uid'].'\');');
444 return '<a href="#" onclick="'.$onClick.'">'.$title.'</a>';
456 * Base extension class which generates the folder tree.
457 * Used directly by the RTE.
459 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
463 class localFolderTree
extends t3lib_folderTree
{
468 * Initializes the script path
472 function localFolderTree() {
473 $this->thisScript
= t3lib_div
::getIndpEnv('SCRIPT_NAME');
474 $this->t3lib_folderTree();
478 * Wrapping the title in a link, if applicable.
480 * @param string Title, ready for output.
481 * @param array The "record"
482 * @return string Wrapping title string.
484 function wrapTitle($title,$v) {
485 if ($this->ext_isLinkable($v)) {
486 $aOnClick = 'return jumpToUrl(\''.$this->thisScript
.'?act='.$GLOBALS['SOBE']->browser
->act
.'&mode='.$GLOBALS['SOBE']->browser
->mode
.'&expandFolder='.rawurlencode($v['path']).'\');';
487 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
489 return '<span class="typo3-dimmed">'.$title.'</span>';
494 * Returns true if the input "record" contains a folder which can be linked.
496 * @param array Array with information about the folder element. Contains keys like title, uid, path, _title
497 * @return boolean True is returned if the path is found in the web-part of the server and is NOT a recycler or temp folder
499 function ext_isLinkable($v) {
500 $webpath=t3lib_BEfunc
::getPathType_web_nonweb($v['path']); // Checking, if the input path is a web-path.
501 if (strstr($v['path'],'_recycler_') ||
strstr($v['path'],'_temp_') ||
$webpath!='web') {
508 * Wrap the plus/minus icon in a link
510 * @param string HTML string to wrap, probably an image tag.
511 * @param string Command for 'PM' get var
512 * @param boolean If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
513 * @return string Link-wrapped input string
516 function PM_ATagWrap($icon,$cmd,$bMark='') {
518 $anchor = '#'.$bMark;
519 $name=' name="'.$bMark.'"';
521 $aOnClick = 'return jumpToUrl(\''.$this->thisScript
.'?PM='.$cmd.'\',\''.$anchor.'\');';
522 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
526 * Create the folder navigation tree in HTML
528 * @param mixed Input tree array. If not array, then $this->tree is used.
529 * @return string HTML output of the tree.
531 function printTree($treeArr='') {
533 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
535 if (!is_array($treeArr)) $treeArr=$this->tree
;
540 // Preparing the current-path string (if found in the listing we will see a red blinking arrow).
541 if (!$GLOBALS['SOBE']->browser
->curUrlInfo
['value']) {
543 } else if (substr(trim($GLOBALS['SOBE']->browser
->curUrlInfo
['info']),-1)!='/') {
544 $cmpPath=PATH_site
.dirname($GLOBALS['SOBE']->browser
->curUrlInfo
['info']).'/';
546 $cmpPath=PATH_site
.$GLOBALS['SOBE']->browser
->curUrlInfo
['info'];
549 // Traverse rows for the tree and print them into table rows:
550 foreach($treeArr as $k => $v) {
552 $bgColorClass=($c+
1)%2 ?
'bgColor' : 'bgColor-10';
554 // Creating blinking arrow, if applicable:
555 if (($GLOBALS['SOBE']->browser
->curUrlInfo
['act'] == 'file' ||
$GLOBALS['SOBE']->browser
->curUrlInfo
['act'] == 'folder') && $cmpPath == $v['row']['path']) {
556 $arrCol='<td><img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
557 $bgColorClass='bgColor4';
561 // Create arrow-bullet for file listing (if folder path is linkable):
562 $aOnClick = 'return jumpToUrl(\''.$this->thisScript
.'?act='.$GLOBALS['SOBE']->browser
->act
.'&mode='.$GLOBALS['SOBE']->browser
->mode
.'&expandFolder='.rawurlencode($v['row']['path']).'\');';
563 $cEbullet = $this->ext_isLinkable($v['row']) ?
'<a href="#" onclick="'.htmlspecialchars($aOnClick).'"><img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/ol/arrowbullet.gif','width="18" height="16"').' alt="" /></a>' : '';
565 // Put table row with folder together:
567 <tr class="'.$bgColorClass.'">
568 <td nowrap="nowrap">'.$v['HTML'].$this->wrapTitle(t3lib_div
::fixed_lgd_cs($v['row']['title'],$titleLen),$v['row']).'</td>
570 <td>'.$cEbullet.'</td>
579 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
592 * Folder tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
594 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
598 class rteFolderTree
extends localFolderTree
{
608 * For TBE File Browser
610 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
614 class TBE_FolderTree
extends localFolderTree
{
615 var $ext_noTempRecyclerDirs=0; // If file-drag mode is set, temp and recycler folders are filtered out.
618 * Returns true if the input "record" contains a folder which can be linked.
620 * @param array Array with information about the folder element. Contains keys like title, uid, path, _title
621 * @return boolean True is returned if the path is NOT a recycler or temp folder AND if ->ext_noTempRecyclerDirs is not set.
623 function ext_isLinkable($v) {
624 if ($this->ext_noTempRecyclerDirs
&& (substr($v['path'],-7)=='_temp_/' ||
substr($v['path'],-11)=='_recycler_/')) {
630 * Wrapping the title in a link, if applicable.
632 * @param string Title, ready for output.
633 * @param array The 'record'
634 * @return string Wrapping title string.
636 function wrapTitle($title,$v) {
637 if ($this->ext_isLinkable($v)) {
638 $aOnClick = 'return jumpToUrl(\''.$this->thisScript
.'?act='.$GLOBALS['SOBE']->browser
->act
.'&mode='.$GLOBALS['SOBE']->browser
->mode
.'&expandFolder='.rawurlencode($v['path']).'\');';
639 return '<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$title.'</a>';
641 return '<span class="typo3-dimmed">'.$title.'</span>';
651 * class for the Element Browser window.
653 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
660 var $siteURL; // Current site URL (Frontend)
661 var $thisScript; // the script to link to
662 var $thisConfig; // RTE specific TSconfig
663 var $setTarget; // Target (RTE specific)
664 var $setClass; // CSS Class (RTE specific)
665 var $setTitle; // title (RTE specific)
666 var $doc; // Backend template object
667 var $elements = array(); // Holds information about files
669 // GPvars: (Input variables from outside)
671 * The mode determines the main kind of output from the element browser.
672 * There are these options for values: rte, db, file, filedrag, wizard.
673 * "rte" will show the link selector for the Rich Text Editor (see main_rte())
674 * "db" will allow you to browse for pages or records in the page tree (for TCEforms, see main_db())
675 * "file"/"filedrag" will allow you to browse for files or folders in the folder mounts (for TCEforms, main_file())
676 * "wizard" will allow you to browse for links (like "rte") which are passed back to TCEforms (see main_rte(1))
683 * Link selector action.
684 * page,file,url,mail,spec are allowed values.
685 * These are only important with the link selector function and in that case they switch between the various menu options.
690 * 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")
695 * 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/"
702 * TYPO3 Element Browser, wizard mode parameters. There is a heap of parameters there, better debug() them out if you need something... :-)
707 * 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.
708 * Example value: "data[pages][39][bodytext]|||tt_content|" or "data[tt_content][NEW3fba56fde763d][image]|||gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai|"
711 * 0: form field name reference, eg. "data[tt_content][123][image]"
712 * 1: htlmArea RTE parameters: editorNo:contentTypo3Language:contentTypo3Charset
713 * 2: RTE config parameters: RTEtsConfigParams
714 * 3: allowed types. Eg. "tt_content" or "gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai"
715 * 4: IRRE uniqueness: target level object-id to perform actions/checks on, eg. "data[79][tt_address][1][<field>][<foreign_table>]"
716 * 5: IRRE uniqueness: name of function in opener window that checks if element is already used, eg. "inline.checkUniqueElement"
717 * 6: IRRE uniqueness: name of function in opener window that performs some additional(!) action, eg. "inline.setUniqueElement"
718 * 7: IRRE uniqueness: name of function in opener window that performs action instead of using addElement/insertElement, eg. "inline.importElement"
720 * $pArr = explode('|',$this->bparams);
721 * $formFieldName = $pArr[0];
722 * $allowedTablesOrFileTypes = $pArr[3];
727 * Used with the Rich Text Editor.
728 * Example value: "tt_content:NEW3fba58c969f5c:bodytext:23:text:23:"
730 var $RTEtsConfigParams;
736 * Plus/Minus icon value. Used by the tree class to open/close notes on the trees.
741 * Pointer, used when browsing a long list of records etc.
749 * 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.
754 * Used with the link selector: Contains a processed version of the input values from curUrlInfo. This is splitted into pageid, content element id, label value etc. This is used for the internal processing of that information.
759 * array which holds hook objects (initialised in init() )
761 protected $hookObjects = array();
765 * object for t3lib_basicFileFunctions
767 public $fileProcessor;
772 * Initializes a lot of variables, setting JavaScript functions in header etc.
777 global $BE_USER,$BACK_PATH;
780 $this->pointer
= t3lib_div
::_GP('pointer');
781 $this->bparams
= t3lib_div
::_GP('bparams');
782 $this->P
= t3lib_div
::_GP('P');
783 $this->RTEtsConfigParams
= t3lib_div
::_GP('RTEtsConfigParams');
784 $this->expandPage
= t3lib_div
::_GP('expandPage');
785 $this->expandFolder
= t3lib_div
::_GP('expandFolder');
786 $this->PM
= t3lib_div
::_GP('PM');
789 $this->mode
= t3lib_div
::_GP('mode');
794 // init hook objects:
795 $this->hookObjects
= array();
796 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'])) {
797 foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['browseLinksHook'] as $classData) {
798 $processObject = &t3lib_div
::getUserObj($classData);
800 if(!($processObject instanceof t3lib_browseLinksHook
)) {
801 throw new UnexpectedValueException('$processObject must implement interface t3lib_browseLinksHook', 1195039394);
804 $parameters = array();
805 $processObject->init($this, $parameters);
806 $this->hookObjects
[] = $processObject;
811 $this->siteURL
= t3lib_div
::getIndpEnv('TYPO3_SITE_URL'); // Current site url
813 // the script to link to
814 $this->thisScript
= t3lib_div
::getIndpEnv('SCRIPT_NAME');
816 // init fileProcessor
817 $this->fileProcessor
= t3lib_div
::makeInstance('t3lib_basicFileFunctions');
818 $this->fileProcessor
->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
821 // CurrentUrl - the current link url must be passed around if it exists
822 if ($this->mode
== 'wizard') {
823 $currentLinkParts = t3lib_div
::trimExplode(' ',$this->P
['currentValue']);
824 $initialCurUrlArray = array (
825 'href' => $currentLinkParts[0],
826 'target' => $currentLinkParts[1],
827 'class' => $currentLinkParts[2],
828 'title' => $currentLinkParts[3],
830 $this->curUrlArray
= (is_array(t3lib_div
::_GP('curUrl'))) ?
831 array_merge($initialCurUrlArray, t3lib_div
::_GP('curUrl')) :
833 $this->curUrlInfo
= $this->parseCurUrl($this->siteURL
.'?id='.$this->curUrlArray
['href'], $this->siteURL
);
834 if ($this->curUrlInfo
['pageid'] == 0 && $this->curUrlArray
['href']) { // pageid == 0 means that this is not an internal (page) link
835 if (file_exists(PATH_site
.rawurldecode($this->curUrlArray
['href']))) { // check if this is a link to a file
836 if (t3lib_div
::isFirstPartOfStr($this->curUrlArray
['href'], PATH_site
)) {
837 $currentLinkParts[0] = substr($this->curUrlArray
['href'], strlen(PATH_site
));
839 $this->curUrlInfo
= $this->parseCurUrl($this->siteURL
.$this->curUrlArray
['href'], $this->siteURL
);
840 } elseif (strstr($this->curUrlArray
['href'], '@')) { // check for email link
841 if (t3lib_div
::isFirstPartOfStr($this->curUrlArray
['href'], 'mailto:')) {
842 $currentLinkParts[0] = substr($this->curUrlArray
['href'], 7);
844 $this->curUrlInfo
= $this->parseCurUrl('mailto:'.$this->curUrlArray
['href'], $this->siteURL
);
845 } else { // nothing of the above. this is an external link
846 if(strpos($this->curUrlArray
['href'], '://') === false) {
847 $currentLinkParts[0] = 'http://' . $this->curUrlArray
['href'];
849 $this->curUrlInfo
= $this->parseCurUrl($currentLinkParts[0], $this->siteURL
);
851 } elseif (!$this->curUrlArray
['href']) {
852 $this->curUrlInfo
= array();
855 $this->curUrlInfo
= $this->parseCurUrl($this->siteURL
.'?id='.$this->curUrlArray
['href'], $this->siteURL
);
858 $this->curUrlArray
= t3lib_div
::_GP('curUrl');
859 if ($this->curUrlArray
['all']) {
860 $this->curUrlArray
=t3lib_div
::get_tag_attributes($this->curUrlArray
['all']);
862 $this->curUrlInfo
=$this->parseCurUrl($this->curUrlArray
['href'],$this->siteURL
);
865 // Determine nature of current url:
866 $this->act
=t3lib_div
::_GP('act');
868 $this->act
=$this->curUrlInfo
['act'];
871 // Rich Text Editor specific configuration:
873 if ((string)$this->mode
== 'rte') {
874 $RTEtsConfigParts = explode(':',$this->RTEtsConfigParams
);
875 $addPassOnParams.='&RTEtsConfigParams='.rawurlencode($this->RTEtsConfigParams
);
876 $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc
::getPagesTSconfig($RTEtsConfigParts[5]));
877 $this->thisConfig
= t3lib_BEfunc
::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
880 // Initializing the target value (RTE)
881 $this->setTarget
= ($this->curUrlArray
['target'] != '-') ?
$this->curUrlArray
['target'] : '';
882 if ($this->thisConfig
['defaultLinkTarget'] && !isset($this->curUrlArray
['target'])) {
883 $this->setTarget
=$this->thisConfig
['defaultLinkTarget'];
886 // Initializing the class value (RTE)
887 $this->setClass
= ($this->curUrlArray
['class'] != '-') ?
$this->curUrlArray
['class'] : '';
889 // Initializing the title value (RTE)
890 $this->setTitle
= ($this->curUrlArray
['title'] != '-') ?
$this->curUrlArray
['title'] : '';
892 // Creating backend template object:
893 $this->doc
= t3lib_div
::makeInstance('template');
894 $this->doc
->backPath
= $BACK_PATH;
896 // Load the Prototype library and browse_links.js
897 $this->doc
->loadJavascriptLib('contrib/prototype/prototype.js');
898 $this->doc
->loadJavascriptLib('js/browse_links.js');
900 // BEGIN accumulation of header JavaScript:
902 // This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...
903 var add_href="'.($this->curUrlArray
['href']?
'&curUrl[href]='.rawurlencode($this->curUrlArray
['href']):'').'";
904 var add_target="'.($this->setTarget?
'&curUrl[target]='.rawurlencode($this->setTarget
):'').'";
905 var add_class="'.($this->setClass ?
'&curUrl[class]='.rawurlencode($this->setClass
) : '').'";
906 var add_title="'.($this->setTitle?
'&curUrl[title]='.rawurlencode($this->setTitle
):'').'";
907 var add_params="'.($this->bparams?
'&bparams='.rawurlencode($this->bparams
):'').'";
909 var cur_href="'.($this->curUrlArray
['href']?
$this->curUrlArray
['href']:'').'";
910 var cur_target="'.($this->setTarget?
$this->setTarget
:'').'";
911 var cur_class = "'.($this->setClass ?
$this->setClass
: '-').'";
912 var cur_title="'.($this->setTitle?
$this->setTitle
:'').'";
914 function browse_links_setTarget(target) { //
916 add_target="&curUrl[target]="+escape(target);
918 function browse_links_setClass(cssClass) { //
919 cur_class = cssClass;
920 add_class = "&curUrl[class]=" + escape(cssClass);
922 function browse_links_setTitle(title) { //
924 add_title="&curUrl[title]="+escape(title);
926 function browse_links_setValue(value) { //
928 add_href="&curUrl[href]="+value;
932 if ($this->mode
== 'wizard') { // Functions used, if the link selector is in wizard mode (= TCEforms fields)
933 unset($this->P
['fieldChangeFunc']['alert']);
934 reset($this->P
['fieldChangeFunc']);
936 while(list($k,$v)=each($this->P
['fieldChangeFunc'])) {
942 $P2['itemName']=$this->P
['itemName'];
943 $P2['formName']=$this->P
['formName'];
944 $P2['fieldChangeFunc']=$this->P
['fieldChangeFunc'];
945 $P2['params']['allowedExtensions']=$this->P
['params']['allowedExtensions'];
946 $P2['params']['blindLinkOptions']=$this->P
['params']['blindLinkOptions'];
947 $addPassOnParams.=t3lib_div
::implodeArrayForUrl('P',$P2);
950 function link_typo3Page(id,anchor) { //
951 updateValueInMainForm(id + (anchor ? anchor : ""));
955 function link_folder(folder) { //
956 updateValueInMainForm(folder);
960 function link_current() { //
961 if (cur_href!="http://" && cur_href!="mailto:") {
962 returnBeforeCleaned = cur_href;
963 if (returnBeforeCleaned.substr(0, 7) == "http://") {
964 returnToMainFormValue = returnBeforeCleaned.substr(7);
965 } else if (returnBeforeCleaned.substr(0, 7) == "mailto:") {
966 if (returnBeforeCleaned.substr(0, 14) == "mailto:mailto:") {
967 returnToMainFormValue = returnBeforeCleaned.substr(14);
969 returnToMainFormValue = returnBeforeCleaned.substr(7);
972 returnToMainFormValue = returnBeforeCleaned;
974 updateValueInMainForm(returnToMainFormValue);
979 function checkReference() { //
980 if (window.opener && window.opener.document && window.opener.document.'.$this->P
['formName'].' && window.opener.document.'.$this->P
['formName'].'["'.$this->P
['itemName'].'"] ) {
981 return window.opener.document.'.$this->P
['formName'].'["'.$this->P
['itemName'].'"];
986 function updateValueInMainForm(input) { //
987 var field = checkReference();
989 if (cur_target == "" && (cur_title != "" || cur_class != "-")) {
992 if (cur_title == "" && cur_class == "-") {
995 input = input + " " + cur_target + " " + cur_class + " " + cur_title;
1001 } else { // Functions used, if the link selector is in RTE mode:
1003 function link_typo3Page(id,anchor) { //
1004 var theLink = \''.$this->siteURL
.'?id=\'+id+(anchor?anchor:"");
1005 self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
1008 function link_folder(folder) { //
1009 var theLink = \''.$this->siteURL
.'\'+folder;
1010 self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
1013 function link_spec(theLink) { //
1014 self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
1017 function link_current() { //
1018 if (cur_href!="http://" && cur_href!="mailto:") {
1019 self.parent.parent.renderPopup_addLink(cur_href, cur_target, cur_class, cur_title);
1026 // General "jumpToUrl" function:
1028 function jumpToUrl(URL,anchor) { //
1029 var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act
.'" : "";
1030 var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$this->mode
.'" : "";
1031 var theLocation = URL + add_act + add_mode + add_href + add_target + add_class + add_title + add_params'.($addPassOnParams?
'+"'.$addPassOnParams.'"':'').'+(anchor?anchor:"");
1032 window.location.href = theLocation;
1039 * Splits parts of $this->bparams
1042 $pArr = explode('|',$this->bparams
);
1044 // This is JavaScript especially for the TBE Element Browser!
1045 $formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';
1047 // insertElement - Call check function (e.g. for uniqueness handling):
1048 if ($pArr[4] && $pArr[5]) {
1050 // Call a check function in the opener window (e.g. for uniqueness handling):
1051 if (parent.window.opener) {
1052 var res = parent.window.opener.'.$pArr[5].'("'.addslashes($pArr[4]).'",table,uid,type);
1054 if (res.message) alert(res.message);
1055 performAction = false;
1058 alert("Error - reference to main window is not set properly!");
1063 // insertElement - Call helper function:
1064 if ($pArr[4] && $pArr[6]) {
1066 // Call helper function to manage data in the opener window:
1067 if (parent.window.opener) {
1068 parent.window.opener.'.$pArr[6].'("'.addslashes($pArr[4]).'",table,uid,type,"'.addslashes($pArr[0]).'");
1070 alert("Error - reference to main window is not set properly!");
1075 // insertElement - perform action commands:
1076 if ($pArr[4] && $pArr[7]) {
1077 // Call user defined action function:
1079 if (parent.window.opener) {
1080 parent.window.opener.'.$pArr[7].'("'.addslashes($pArr[4]).'",table,uid,type);
1081 focusOpenerAndClose(close);
1083 alert("Error - reference to main window is not set properly!");
1087 } else if ($pArr[0] && !$pArr[1] && !$pArr[2]) {
1089 addElement(filename,table+"_"+uid,fp,close);
1093 if (setReferences()) {
1094 parent.window.opener.group_change("add","'.$pArr[0].'","'.$pArr[1].'","'.$pArr[2].'",elRef,targetDoc);
1096 alert("Error - reference to main window is not set properly!");
1098 focusOpenerAndClose(close);
1106 function launchView(url) { //
1107 var thePreviewWindow="";
1108 thePreviewWindow = window.open("'.$BACK_PATH.'show_item.php?table="+url,"ShowItem","height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
1109 if (thePreviewWindow && thePreviewWindow.focus) {
1110 thePreviewWindow.focus();
1113 function setReferences() { //
1114 if (parent.window.opener && parent.window.opener.content && parent.window.opener.content.document.editform && parent.window.opener.content.document.editform["'.$formFieldName.'"]) {
1115 targetDoc = parent.window.opener.content.document;
1116 elRef = targetDoc.editform["'.$formFieldName.'"];
1122 function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close) { //
1123 var performAction = true;
1125 // Call performing function and finish this action:
1126 if (performAction) {
1127 '.$JScodeHelper.$JScodeAction.'
1131 function addElement(elName,elValue,altElValue,close) { //
1132 if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin) {
1133 parent.window.opener.setFormValueFromBrowseWin("'.$pArr[0].'",altElValue?altElValue:elValue,elName);
1134 focusOpenerAndClose(close);
1136 alert("Error - reference to main window is not set properly!");
1140 function focusOpenerAndClose(close) { //
1141 BrowseLinks.focusOpenerAndClose(close);
1145 // Finally, add the accumulated JavaScript to the template object:
1146 $this->doc
->JScode
.= $this->doc
->wrapScriptTags($JScode);
1149 if (FALSE) debug(array(
1150 'pointer' => $this->pointer
,
1151 'act' => $this->act
,
1152 'mode' => $this->mode
,
1153 'curUrlInfo' => $this->curUrlInfo
,
1154 'curUrlArray' => $this->curUrlArray
,
1156 'bparams' => $this->bparams
,
1157 'RTEtsConfigParams' => $this->RTEtsConfigParams
,
1158 'expandPage' => $this->expandPage
,
1159 'expandFolder' => $this->expandFolder
,
1161 ),'Internal variables of Script Class:');
1166 * Session data for this class can be set from outside with this method.
1169 * @param array Session data array
1170 * @return array Session data and boolean which indicates that data needs to be stored in session because it's changed
1172 function processSessionData($data) {
1175 switch((string)$this->mode
) {
1177 if (isset($this->expandPage
)) {
1178 $data['expandPage']=$this->expandPage
;
1181 $this->expandPage
=$data['expandPage'];
1187 if (isset($this->expandFolder
)) {
1188 $data['expandFolder']=$this->expandFolder
;
1191 $this->expandFolder
=$data['expandFolder'];
1196 return array($data, $store);
1202 /******************************************************************
1206 ******************************************************************/
1209 * Rich Text Editor (RTE) link selector (MAIN function)
1210 * Generates the link selector for the Rich Text Editor.
1211 * Can also be used to select links for the TCEforms (see $wiz)
1213 * @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
1214 * @return string Modified content variable.
1216 function main_rte($wiz=0) {
1217 global $LANG, $BACK_PATH;
1219 // Starting content:
1220 $content=$this->doc
->startPage('RTE link');
1222 // Initializing the action value, possibly removing blinded values etc:
1223 $allowedItems = array_diff(
1224 explode(',','page,file,folder,url,mail,spec'),
1225 t3lib_div
::trimExplode(',',$this->thisConfig
['blindLinkOptions'],1)
1227 $allowedItems = array_diff(
1229 t3lib_div
::trimExplode(',',$this->P
['params']['blindLinkOptions'])
1232 //call hook for extra options
1233 foreach($this->hookObjects
as $hookObject) {
1234 $allowedItems = $hookObject->addAllowedItems($allowedItems);
1237 reset($allowedItems);
1238 if (!in_array($this->act
,$allowedItems)) $this->act
= current($allowedItems);
1240 // Making menu in top:
1243 $menuDef['removeLink']['isActive'] = $this->act
=='removeLink';
1244 $menuDef['removeLink']['label'] = $LANG->getLL('removeLink',1);
1245 $menuDef['removeLink']['url'] = '#';
1246 $menuDef['removeLink']['addParams'] = 'onclick="self.parent.parent.renderPopup_unLink();return false;"';
1248 if (in_array('page',$allowedItems)) {
1249 $menuDef['page']['isActive'] = $this->act
=='page';
1250 $menuDef['page']['label'] = $LANG->getLL('page',1);
1251 $menuDef['page']['url'] = '#';
1252 $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page\');return false;"';
1254 if (in_array('file',$allowedItems)){
1255 $menuDef['file']['isActive'] = $this->act
=='file';
1256 $menuDef['file']['label'] = $LANG->getLL('file',1);
1257 $menuDef['file']['url'] = '#';
1258 $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file\');return false;"';
1260 if (in_array('folder',$allowedItems)){
1261 $menuDef['folder']['isActive'] = $this->act
== 'folder';
1262 $menuDef['folder']['label'] = $LANG->getLL('folder', 1);
1263 $menuDef['folder']['url'] = '#';
1264 $menuDef['folder']['addParams'] = 'onclick="jumpToUrl(\'?act=folder\');return false;"';
1266 if (in_array('url',$allowedItems)) {
1267 $menuDef['url']['isActive'] = $this->act
=='url';
1268 $menuDef['url']['label'] = $LANG->getLL('extUrl',1);
1269 $menuDef['url']['url'] = '#';
1270 $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url\');return false;"';
1272 if (in_array('mail',$allowedItems)) {
1273 $menuDef['mail']['isActive'] = $this->act
=='mail';
1274 $menuDef['mail']['label'] = $LANG->getLL('email',1);
1275 $menuDef['mail']['url'] = '#';
1276 $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail\');return false;"';
1278 if (is_array($this->thisConfig
['userLinks.']) && in_array('spec',$allowedItems)) {
1279 $menuDef['spec']['isActive'] = $this->act
=='spec';
1280 $menuDef['spec']['label'] = $LANG->getLL('special',1);
1281 $menuDef['spec']['url'] = '#';
1282 $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec\');return false;"';
1285 // call hook for extra options
1286 foreach($this->hookObjects
as $hookObject) {
1287 $menuDef = $hookObject->modifyMenuDefinition($menuDef);
1290 $content .= $this->doc
->getTabMenuRaw($menuDef);
1292 // Adding the menu and header to the top of page:
1293 $content.=$this->printCurrentUrl($this->curUrlInfo
['info']).'<br />';
1295 // Depending on the current action we will create the actual module content for selecting a link:
1296 switch($this->act
) {
1303 <form action="" name="lurlform" id="lurlform">
1304 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail">
1306 <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('emailAddress', 1) . ':</td>
1307 <td><input type="text" name="lemail"'.$this->doc
->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo
['act']=='mail'?
$this->curUrlInfo
['info']:'').'" /> '.
1308 '<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>
1320 <form action="" name="lurlform" id="lurlform">
1321 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL">
1323 <td style="width: 96px;">URL:</td>
1324 <td><input type="text" name="lurl"'.$this->doc
->formWidth(30).' value="'.htmlspecialchars($this->curUrlInfo
['act']=='url'?
$this->curUrlInfo
['info']:'http://').'" /> '.
1325 '<input type="submit" value="' . $GLOBALS['LANG']->getLL('setLink', 1) . '" onclick="browse_links_setValue(document.lurlform.lurl.value); return link_current();" /></td>
1333 $foldertree = t3lib_div
::makeInstance('rteFolderTree');
1334 $foldertree->thisScript
= $this->thisScript
;
1335 $tree = $foldertree->getBrowsableTree();
1337 if (!$this->curUrlInfo
['value'] ||
$this->curUrlInfo
['act'] != $this->act
) {
1339 } elseif (substr(trim($this->curUrlInfo
['info']), -1) != '/') {
1340 $cmpPath = PATH_site
.dirname($this->curUrlInfo
['info']).'/';
1341 if (!isset($this->expandFolder
)) {
1342 $this->expandFolder
= $cmpPath;
1345 $cmpPath = PATH_site
.$this->curUrlInfo
['info'];
1346 if (!isset($this->expandFolder
) && $this->curUrlInfo
['act'] == 'folder') {
1347 $this->expandFolder
= $cmpPath;
1351 list(, , $specUid) = explode('_', $this->PM
);
1352 $files = $this->expandFolder(
1353 $foldertree->specUIDmap
[$specUid],
1354 $this->P
['params']['allowedExtensions']
1359 Wrapper table for folder tree / file/folder list:
1361 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkFiles">
1363 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
1364 <td class="c-wCell" valign="top">'.$files.'</td>
1370 if (is_array($this->thisConfig
['userLinks.'])) {
1372 $v=$this->thisConfig
['userLinks.'];
1374 while(list($k2)=each($v)) {
1376 if (substr($k2,-1)=='.' && is_array($v[$k2i.'.'])) {
1379 $title = trim($v[$k2i]);
1381 $title=$v[$k2i.'.']['url'];
1383 $title=$LANG->sL($title);
1386 $description=$v[$k2i.'.']['description'] ?
$LANG->sL($v[$k2i.'.']['description'],1).'<br />' : '';
1388 // URL + onclick event:
1390 if (isset($v[$k2i.'.']['target'])) $onClickEvent.="browse_links_setTarget('".$v[$k2i.'.']['target']."');";
1391 $v[$k2i.'.']['url'] = str_replace('###_URL###',$this->siteURL
,$v[$k2i.'.']['url']);
1392 if (substr($v[$k2i.'.']['url'],0,7)=='http://' ||
substr($v[$k2i.'.']['url'],0,7)=='mailto:') {
1393 $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();";
1395 $onClickEvent.="link_spec(unescape('".$this->siteURL
.rawurlencode($v[$k2i.'.']['url'])."'));";
1399 $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>');
1401 // Adding link to menu of user defined links:
1404 <td class="bgColor4">'.$A[0].'<strong>'.htmlspecialchars($title).($this->curUrlInfo
['info']==$v[$k2i.'.']['url']?
'<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" />':'').'</strong><br />'.$description.$A[1].'</td>
1412 // Add menu to content:
1416 Special userdefined menu:
1418 <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
1420 <td class="bgColor5" class="c-wCell" valign="top"><strong>'.$LANG->getLL('special',1).'</strong></td>
1422 '.implode('',$subcats).'
1428 $pagetree = t3lib_div
::makeInstance('rtePageTree');
1429 $pagetree->thisScript
= $this->thisScript
;
1430 $tree=$pagetree->getBrowsableTree();
1431 $cElements = $this->expandPage();
1435 Wrapper table for page tree / record list:
1437 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages">
1439 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
1440 <td class="c-wCell" valign="top">'.$cElements.'</td>
1447 foreach($this->hookObjects
as $hookObject) {
1448 $content .= $hookObject->getTab($this->act
);
1456 Selecting class for link:
1458 <form action="" name="lclassform" id="lclassform">
1459 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkClass">
1461 <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('class', 1) . '</td>
1462 <td><input type="text" name="lclass" onchange="browse_links_setClass(this.value);" value="' . htmlspecialchars($this->setClass
) . '"' . $this->doc
->formWidth(10) . ' /></td>
1468 Selecting title for link:
1470 <form action="" name="ltitleform" id="ltitleform">
1471 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTitle">
1473 <td style="width: 96px;">' . $GLOBALS['LANG']->getLL('title', 1) . '</td>
1474 <td><input type="text" name="ltitle" onchange="browse_links_setTitle(this.value);" value="' . htmlspecialchars($this->setTitle
) . '"' . $this->doc
->formWidth(10) . ' /></td>
1481 if ($this->act
!='mail') {
1487 Selecting target for link:
1489 <form action="" name="ltargetform" id="ltargetform">
1490 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
1492 <td>'.$GLOBALS['LANG']->getLL('target',1).':</td>
1493 <td><input type="text" name="ltarget" onchange="browse_links_setTarget(this.value);" value="' . htmlspecialchars($this->setTarget
) . '"' . $this->doc
->formWidth(10) . ' /></td>
1495 <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;">
1497 <option value="_top">'.$GLOBALS['LANG']->getLL('top',1).'</option>
1498 <option value="_blank">'.$GLOBALS['LANG']->getLL('newWindow',1).'</option>
1502 if (($this->curUrlInfo
['act'] == 'page' ||
$this->curUrlInfo
['act'] == 'file' ||
$this->curUrlInfo
['act'] == 'folder') && $this->curUrlArray
['href'] && $this->curUrlInfo
['act'] == $this->act
) {
1504 <input type="submit" value="'.$GLOBALS['LANG']->getLL('update',1).'" onclick="return link_current();" />';
1508 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) {
1509 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;
1510 browse_links_setTarget(document.ltargetform.ltarget.value);
1511 browse_links_setClass(document.lclassform.lclass.value);
1512 browse_links_setTitle(document.ltitleform.ltitle.value);
1513 document.ltargetform.popup_width.selectedIndex=0;
1514 document.ltargetform.popup_height.selectedIndex=0;
1521 <td>'.$GLOBALS['LANG']->getLL('target_popUpWindow',1).':</td>
1523 <select name="popup_width" onchange="'.htmlspecialchars($selectJS).'">
1524 <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_width',1).'</option>
1525 <option value="300">300</option>
1526 <option value="400">400</option>
1527 <option value="500">500</option>
1528 <option value="600">600</option>
1529 <option value="700">700</option>
1530 <option value="800">800</option>
1533 <select name="popup_height" onchange="'.htmlspecialchars($selectJS).'">
1534 <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_height',1).'</option>
1535 <option value="200">200</option>
1536 <option value="300">300</option>
1537 <option value="400">400</option>
1538 <option value="500">500</option>
1539 <option value="600">600</option>
1546 // Add "target selector" box to content:
1550 $content.='<br /><br />';
1553 // End page, return content:
1554 $content.= $this->doc
->endPage();
1555 $content = $this->doc
->insertStylesAndJS($content);
1560 * TYPO3 Element Browser: Showing a page tree and allows you to browse for records
1562 * @return string HTML content for the module
1564 function main_db() {
1566 // Starting content:
1567 $content=$this->doc
->startPage('TBE record selector');
1570 $pArr = explode('|',$this->bparams
);
1572 // Making the browsable pagetree:
1573 $pagetree = t3lib_div
::makeInstance('TBE_PageTree');
1574 $pagetree->thisScript
=$this->thisScript
;
1575 $pagetree->ext_pArrPages
= !strcmp($pArr[3],'pages')?
1:0;
1576 $pagetree->ext_showNavTitle
= $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
1577 $pagetree->addField('nav_title');
1578 $tree=$pagetree->getBrowsableTree();
1580 // Making the list of elements, if applicable:
1581 $cElements = $this->TBE_expandPage($pArr[3]);
1583 // Putting the things together, side by side:
1587 Wrapper table for page tree / record list:
1589 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBrecords">
1591 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
1592 <td class="c-wCell" valign="top">'.$cElements.'</td>
1598 $content.='<br /><br />';
1600 // End page, return content:
1601 $content.= $this->doc
->endPage();
1602 $content = $this->doc
->insertStylesAndJS($content);
1607 * TYPO3 Element Browser: Showing a folder tree, allowing you to browse for files.
1609 * @return string HTML content for the module
1611 function main_file() {
1614 // Starting content:
1615 $content.=$this->doc
->startPage('TBE file selector');
1618 $pArr = explode('|',$this->bparams
);
1620 // Create upload/create folder forms, if a path is given:
1621 $path=$this->expandFolder
;
1622 if (!$path ||
!@is_dir
($path)) {
1623 // The closest TEMP-path is found
1624 $path = $this->fileProcessor
->findTempFolder().'/';
1626 if ($path!='/' && @is_dir
($path)) {
1627 $uploadForm=$this->uploadForm($path);
1628 $createFolder=$this->createFolder($path);
1633 if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) $content.=$uploadForm;
1635 // Getting flag for showing/not showing thumbnails:
1636 $noThumbs = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
1639 // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
1640 $_MOD_MENU = array('displayThumbs' => '');
1641 $_MCONF['name']='file_list';
1642 $_MOD_SETTINGS = t3lib_BEfunc
::getModuleData($_MOD_MENU, t3lib_div
::_GP('SET'), $_MCONF['name']);
1643 $addParams = '&act='.$this->act
.'&mode='.$this->mode
.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams
);
1644 $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>';
1648 $noThumbs = $noThumbs ?
$noThumbs : !$_MOD_SETTINGS['displayThumbs'];
1650 // Create folder tree:
1651 $foldertree = t3lib_div
::makeInstance('TBE_FolderTree');
1652 $foldertree->thisScript
=$this->thisScript
;
1653 $foldertree->ext_noTempRecyclerDirs
= ($this->mode
== 'filedrag');
1654 $tree=$foldertree->getBrowsableTree();
1656 list(,,$specUid) = explode('_',$this->PM
);
1658 if ($this->mode
=='filedrag') {
1659 $files = $this->TBE_dragNDrop($foldertree->specUIDmap
[$specUid],$pArr[3]);
1661 $files = $this->TBE_expandFolder($foldertree->specUIDmap
[$specUid],$pArr[3],$noThumbs);
1664 // Putting the parts together, side by side:
1668 Wrapper table for folder tree / file list:
1670 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles">
1672 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
1673 <td class="c-wCell" valign="top">'.$files.'</td>
1677 $content.= $thumbNailCheck;
1679 // Adding create folder + upload forms if applicable:
1680 if (!$BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) $content.=$uploadForm;
1681 if ($BE_USER->isAdmin() ||
$BE_USER->getTSConfigVal('options.createFoldersInEB')) $content.=$createFolder;
1684 $content.='<br /><br />';
1686 // Setup indexed elements:
1687 $this->doc
->JScode
.= $this->doc
->wrapScriptTags('BrowseLinks.addElements('.t3lib_div
::array2json($this->elements
).');');
1688 // Ending page, returning content:
1689 $content.= $this->doc
->endPage();
1690 $content = $this->doc
->insertStylesAndJS($content);
1696 * TYPO3 Element Browser: Showing a folder tree, allowing you to browse for folders.
1698 * @return string HTML content for the module
1700 function main_folder() {
1703 // Starting content:
1704 $content = $this->doc
->startPage('TBE folder selector');
1707 $parameters = explode('|', $this->bparams
);
1710 $path = $this->expandFolder
;
1711 if (!$path ||
!@is_dir
($path)) {
1712 // The closest TEMP-path is found
1713 $path = $this->fileProcessor
->findTempFolder().'/';
1715 if ($path != '/' && @is_dir
($path)) {
1716 $createFolder = $this->createFolder($path);
1721 // Create folder tree:
1722 $foldertree = t3lib_div
::makeInstance('TBE_FolderTree');
1723 $foldertree->thisScript
= $this->thisScript
;
1724 $foldertree->ext_noTempRecyclerDirs
= ($this->mode
== 'filedrag');
1725 $tree = $foldertree->getBrowsableTree(false);
1727 list(, , $specUid) = explode('_', $this->PM
);
1729 if($this->mode
== 'filedrag') {
1730 $folders = $this->TBE_dragNDrop(
1731 $foldertree->specUIDmap
[$specUid],
1735 $folders = $this->TBE_expandSubFolders($foldertree->specUIDmap
[$specUid]);
1738 // Putting the parts together, side by side:
1742 Wrapper table for folder tree / folder list:
1744 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles">
1746 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
1747 <td class="c-wCell" valign="top">'.$folders.'</td>
1752 // Adding create folder if applicable:
1753 if($BE_USER->isAdmin() ||
$BE_USER->getTSConfigVal('options.createFoldersInEB')) {
1754 $content .= $createFolder;
1758 $content .= '<br /><br />';
1760 // Ending page, returning content:
1761 $content.= $this->doc
->endPage();
1762 $content = $this->doc
->insertStylesAndJS($content);
1783 /******************************************************************
1787 ******************************************************************/
1789 * For RTE: This displays all content elements on a page and lets you create a link to the element.
1791 * @return string HTML output. Returns content only if the ->expandPage value is set (pointing to a page uid to show tt_content records from ...)
1793 function expandPage() {
1794 global $BE_USER, $BACK_PATH;
1797 $expPageId = $this->expandPage
; // Set page id (if any) to expand
1799 // If there is an anchor value (content element reference) in the element reference, then force an ID to expand:
1800 if (!$this->expandPage
&& $this->curUrlInfo
['cElement']) {
1801 $expPageId = $this->curUrlInfo
['pageid']; // Set to the current link page id.
1804 // Draw the record list IF there is a page id to expand:
1805 if ($expPageId && t3lib_div
::testInt($expPageId) && $BE_USER->isInWebMount($expPageId)) {
1808 $out.=$this->barheader($GLOBALS['LANG']->getLL('contentElements').':');
1810 // Create header for listing, showing the page title/icon:
1811 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
1812 $mainPageRec = t3lib_BEfunc
::getRecordWSOL('pages',$expPageId);
1813 $picon = t3lib_iconWorks
::getIconImage('pages', $mainPageRec, $BACK_PATH, '');
1814 $picon.= htmlspecialchars(t3lib_div
::fixed_lgd_cs($mainPageRec['title'],$titleLen));
1815 $out.=$picon.'<br />';
1817 // Look up tt_content elements from the expanded page:
1818 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1819 'uid,header,hidden,starttime,endtime,fe_group,CType,colpos,bodytext',
1821 'pid='.intval($expPageId).
1822 t3lib_BEfunc
::deleteClause('tt_content').
1823 t3lib_BEfunc
::versioningPlaceholderClause('tt_content'),
1827 $cc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
1829 // Traverse list of records:
1831 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1833 $icon=t3lib_iconWorks
::getIconImage('tt_content',$row,$BACK_PATH,'');
1834 if ($this->curUrlInfo
['act']=='page' && $this->curUrlInfo
['cElement']==$row['uid']) {
1835 $arrCol='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
1839 // Putting list element HTML together:
1840 $out.='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?
'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
1842 '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.$row['uid'].'\');">'.
1844 htmlspecialchars(t3lib_div
::fixed_lgd_cs($row['header'],$titleLen)).
1847 // Finding internal anchor points:
1848 if (t3lib_div
::inList('text,textpic', $row['CType'])) {
1849 $split = preg_split('/(<a[^>]+name=[\'"]?([^"\'>[:space:]]+)[\'"]?[^>]*>)/i', $row['bodytext'], -1, PREG_SPLIT_DELIM_CAPTURE
);
1851 foreach($split as $skey => $sval) {
1853 // Putting list element HTML together:
1854 $sval = substr($sval,0,100);
1855 $out.='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/ol/line.gif','width="18" height="16"').' alt="" />'.
1856 '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/ol/join'.($skey+
3>count($split)?
'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
1857 '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.rawurlencode($sval).'\');">'.
1858 htmlspecialchars(' <A> '.$sval).
1869 * For TYPO3 Element Browser: This lists all content elements from the given list of tables
1871 * @param string Commalist of tables. Set to "*" if you want all tables.
1872 * @return string HTML output.
1874 function TBE_expandPage($tables) {
1875 global $TCA,$BE_USER, $BACK_PATH;
1878 if ($this->expandPage
>=0 && t3lib_div
::testInt($this->expandPage
) && $BE_USER->isInWebMount($this->expandPage
)) {
1880 // Set array with table names to list:
1881 if (!strcmp(trim($tables),'*')) {
1882 $tablesArr = array_keys($TCA);
1884 $tablesArr = t3lib_div
::trimExplode(',',$tables,1);
1888 // Headline for selecting records:
1889 $out.=$this->barheader($GLOBALS['LANG']->getLL('selectRecords').':');
1891 // Create the header, showing the current page for which the listing is. Includes link to the page itself, if pages are amount allowed tables.
1892 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
1893 $mainPageRec = t3lib_BEfunc
::getRecordWSOL('pages',$this->expandPage
);
1897 if (in_array('pages',$tablesArr)) {
1898 $ficon=t3lib_iconWorks
::getIcon('pages',$mainPageRec);
1899 $ATag="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', ".t3lib_div
::quoteJSvalue($mainPageRec['title']).", '', '', '".$ficon."','',1);\">";
1900 $ATag2="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', ".t3lib_div
::quoteJSvalue($mainPageRec['title']).", '', '', '".$ficon."','',0);\">";
1901 $ATag_alt=substr($ATag,0,-4).",'',1);\">";
1904 $picon=t3lib_iconWorks
::getIconImage('pages',$mainPageRec,$BACK_PATH,'');
1905 $pBicon=$ATag2?
'<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' alt="" />':'';
1906 $pText=htmlspecialchars(t3lib_div
::fixed_lgd_cs($mainPageRec['title'],$titleLen));
1907 $out.=$picon.$ATag2.$pBicon.$ATag_e.$ATag.$pText.$ATag_e.'<br />';
1909 // Initialize the record listing:
1910 $id = $this->expandPage
;
1911 $pointer = t3lib_div
::intInRange($this->pointer
,0,100000);
1912 $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
1913 $pageinfo = t3lib_BEfunc
::readPageAccess($id,$perms_clause);
1916 // Generate the record list:
1917 $dblist = t3lib_div
::makeInstance('TBE_browser_recordList');
1918 $dblist->thisScript
=$this->thisScript
;
1919 $dblist->backPath
= $GLOBALS['BACK_PATH'];
1920 $dblist->thumbs
= 0;
1921 $dblist->calcPerms
= $GLOBALS['BE_USER']->calcPerms($pageinfo);
1922 $dblist->noControlPanels
=1;
1923 $dblist->clickMenuEnabled
=0;
1924 $dblist->tableList
=implode(',',$tablesArr);
1926 $dblist->start($id,t3lib_div
::_GP('table'),$pointer,
1927 t3lib_div
::_GP('search_field'),
1928 t3lib_div
::_GP('search_levels'),
1929 t3lib_div
::_GP('showLimit')
1931 $dblist->setDispFields();
1932 $dblist->generateList();
1933 $dblist->writeBottom();
1935 // Add the HTML for the record list to output variable:
1936 $out.=$dblist->HTMLcode
;
1938 // Add support for fieldselectbox in singleTableMode
1939 if ($dblist->table
) {
1940 $out.= $dblist->fieldSelectBox($dblist->table
);
1943 $out.=$dblist->getSearchBox();
1946 // Return accumulated content:
1952 * Render list of folders inside a folder.
1954 * @param string string of the current folder
1955 * @return string HTML output
1957 function TBE_expandSubFolders($expandFolder=0) {
1960 $expandFolder = $expandFolder ?
1962 $this->expandFolder
;
1964 if($expandFolder && $this->checkFolder($expandFolder)) {
1965 if(t3lib_div
::isFirstPartOfStr($expandFolder, PATH_site
)) {
1966 $rootFolder = substr($expandFolder, strlen(PATH_site
));
1971 // Listing the folders:
1972 $folders = t3lib_div
::get_dirs($expandFolder);
1973 if(count($folders) > 0) {
1974 foreach($folders as $index => $folder) {
1975 $folders[$index] = $rootFolder.$folder.'/';
1978 $content.= $this->folderList($rootFolder, $folders);
1981 // Return accumulated content for folderlisting:
1995 /******************************************************************
1999 ******************************************************************/
2001 * For RTE: This displays all files from folder. No thumbnails shown
2003 * @param string The folder path to expand
2004 * @param string List of fileextensions to show
2005 * @return string HTML output
2007 function expandFolder($expandFolder=0,$extensionList='') {
2010 $expandFolder = $expandFolder ?
$expandFolder : $this->expandFolder
;
2012 if ($expandFolder && $this->checkFolder($expandFolder)) {
2014 // Create header for filelisting:
2015 $out.=$this->barheader($GLOBALS['LANG']->getLL('files').':');
2017 // Prepare current path value for comparison (showing red arrow)
2018 if (!$this->curUrlInfo
['value']) {
2021 $cmpPath=PATH_site
.$this->curUrlInfo
['info'];
2025 // Create header element; The folder from which files are listed.
2026 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
2027 $picon='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
2028 $picon.=htmlspecialchars(t3lib_div
::fixed_lgd_cs(basename($expandFolder),$titleLen));
2029 $picon='<a href="#" onclick="return link_folder(\''.t3lib_div
::rawUrlEncodeFP(substr($expandFolder,strlen(PATH_site
))).'\');">'.$picon.'</a>';
2030 if ($this->curUrlInfo
['act'] == 'folder' && $cmpPath == $expandFolder) {
2031 $out.= '<img'.t3lib_iconWorks
::skinImg($BACK_PATH, 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
2033 $out.=$picon.'<br />';
2035 // Get files from the folder:
2036 if ($this->mode
== 'wizard' && $this->act
== 'folder') {
2037 $files = t3lib_div
::get_dirs($expandFolder);
2039 $files = t3lib_div
::getFilesInDir($expandFolder, $extensionList, 1, 1); // $extensionList='', $prependPath=0, $order='')
2044 if (is_array($files)) {
2045 foreach($files as $filepath) {
2047 $fI=pathinfo($filepath);
2049 if ($this->mode
== 'wizard' && $this->act
== 'folder') {
2050 $filepath = $expandFolder.$filepath.'/';
2051 $icon = '<img' . t3lib_iconWorks
::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif', 'width="18" height="16"') . ' alt="" />';
2054 $icon = t3lib_BEfunc
::getFileIcon(strtolower($fI['extension']));
2056 // Get size and icon:
2057 $size = ' (' . t3lib_div
::formatSize(filesize($filepath)) . 'bytes)';
2058 $icon = '<img' . t3lib_iconWorks
::skinImg($BACK_PATH, 'gfx/fileicons/' . $icon . '', 'width="18" height="16"') . ' title="' . htmlspecialchars($fI['basename'] . $size) . '" alt="" />';
2061 // If the listed file turns out to be the CURRENT file, then show blinking arrow:
2062 if (($this->curUrlInfo
['act'] == 'file' ||
$this->curUrlInfo
['act'] == 'folder') && $cmpPath == $filepath) {
2063 $arrCol='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
2068 // Put it all together for the file element:
2069 $out.='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?
'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
2071 '<a href="#" onclick="return link_folder(\''.t3lib_div
::rawUrlEncodeFP(substr($filepath,strlen(PATH_site
))).'\');">'.
2073 htmlspecialchars(t3lib_div
::fixed_lgd_cs(basename($filepath),$titleLen)).
2082 * For TYPO3 Element Browser: Expand folder of files.
2084 * @param string The folder path to expand
2085 * @param string List of fileextensions to show
2086 * @param boolean Whether to show thumbnails or not. If set, no thumbnails are shown.
2087 * @return string HTML output
2089 function TBE_expandFolder($expandFolder=0,$extensionList='',$noThumbs=0) {
2092 $expandFolder = $expandFolder ?
$expandFolder : $this->expandFolder
;
2094 if ($expandFolder && $this->checkFolder($expandFolder)) {
2095 // Listing the files:
2096 $files = t3lib_div
::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order='')
2097 $out.= $this->fileList($files, $expandFolder, $noThumbs);
2100 // Return accumulated content for filelisting:
2105 * Render list of files.
2107 * @param array List of files. See t3lib_div::getFilesInDir
2108 * @param string If set a header with a folder icon and folder name are shown
2109 * @param boolean Whether to show thumbnails or not. If set, no thumbnails are shown.
2110 * @return string HTML output
2112 function fileList($files, $folderName='', $noThumbs=0) {
2113 global $LANG, $BACK_PATH;
2117 // Listing the files:
2118 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.=$this->getBulkSelector($filesCount);
2125 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
2127 // Create the header of current folder:
2129 $picon='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
2130 $picon.=htmlspecialchars(t3lib_div
::fixed_lgd_cs(basename($folderName),$titleLen));
2131 $out.=$picon.'<br />';
2134 // Init graphic object for reading file dimensions:
2135 $imgObj = t3lib_div
::makeInstance('t3lib_stdGraphic');
2137 $imgObj->mayScaleUp
=0;
2138 $imgObj->tempPath
=PATH_site
.$imgObj->tempPath
;
2140 // Traverse the file list:
2142 foreach($files as $filepath) {
2143 $fI=pathinfo($filepath);
2145 // Thumbnail/size generation:
2146 if (t3lib_div
::inList(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),strtolower($fI['extension'])) && !$noThumbs) {
2147 $imgInfo = $imgObj->getImageDimensions($filepath);
2148 $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
2149 $clickIcon = t3lib_BEfunc
::getThumbNail($BACK_PATH.'thumbs.php',$filepath,'hspace="5" vspace="5" border="1"');
2155 // Create file icon:
2156 $ficon = t3lib_BEfunc
::getFileIcon(strtolower($fI['extension']));
2157 $size=' ('.t3lib_div
::formatSize(filesize($filepath)).'bytes'.($pDim?
', '.$pDim:'').')';
2158 $icon = '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/fileicons/'.$ficon,'width="18" height="16"').' title="'.htmlspecialchars($fI['basename'].$size).'" class="absmiddle" alt="" />';
2160 // Create links for adding the file:
2161 if (strstr($filepath,',') ||
strstr($filepath,'|')) { // In case an invalid character is in the filepath, display error message:
2162 $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
2163 $ATag = $ATag_alt = "<a href=\"#\" onclick=\"alert(".$eMsg.");return false;\">";
2165 } else { // If filename is OK, just add it:
2166 $filesIndex = count($this->elements
);
2167 $this->elements
['file_'.$filesIndex] = array(
2168 'md5' => t3lib_div
::shortMD5($filepath),
2170 'fileName' => $fI['basename'],
2171 'filePath' => $filepath,
2172 'fileExt' => $fI['extension'],
2173 'fileIcon' => $ficon,
2175 $ATag = "<a href=\"#\" onclick=\"return BrowseLinks.File.insertElement('file_$filesIndex');\">";
2176 $ATag_alt = substr($ATag,0,-4).",1);\">";
2177 $bulkCheckBox = '<input type="checkbox" class="typo3-bulk-item" name="file_'.$filesIndex.'" value="0" /> ';
2181 // Create link to showing details about the file in a window:
2182 $Ahref = $BACK_PATH.'show_item.php?table='.rawurlencode($filepath).'&returnUrl='.rawurlencode(t3lib_div
::getIndpEnv('REQUEST_URI'));
2183 $ATag2='<a href="'.htmlspecialchars($Ahref).'">';
2186 // Combine the stuff:
2187 $filenameAndIcon=$bulkCheckBox.$ATag_alt.$icon.htmlspecialchars(t3lib_div
::fixed_lgd_cs(basename($filepath),$titleLen)).$ATag_e;
2190 if ($pDim) { // Image...
2192 <tr class="bgColor4">
2193 <td nowrap="nowrap">'.$filenameAndIcon.' </td>
2194 <td>'.$ATag.'<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
2195 <td nowrap="nowrap">'.($ATag2.'<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/zoom2.gif','width="12" height="12"').' title="'.$LANG->getLL('info',1).'" alt="" /> '.$LANG->getLL('info',1).$ATag2_e).'</td>
2196 <td nowrap="nowrap"> '.$pDim.'</td>
2200 <td colspan="4">'.$ATag_alt.$clickIcon.$ATag_e.'</td>
2204 <tr class="bgColor4">
2205 <td nowrap="nowrap">'.$filenameAndIcon.' </td>
2206 <td>'.$ATag.'<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
2207 <td nowrap="nowrap">'.($ATag2.'<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/zoom2.gif','width="12" height="12"').' title="'.$LANG->getLL('info',1).'" alt="" /> '.$LANG->getLL('info',1).$ATag2_e).'</td>
2213 <td colspan="3"><img src="clear.gif" width="1" height="3" alt="" /></td>
2217 // Wrap all the rows in table tags:
2225 <table border="0" cellpadding="0" cellspacing="1" id="typo3-fileList">
2226 '.implode('',$lines).'
2229 // Return accumulated content for filelisting:
2234 * Render list of folders.
2236 * @param array List of folders. See t3lib_div::get_dirs
2237 * @param string If set a header with a folder icon and folder name are shown
2238 * @return string HTML output
2240 function folderList($baseFolder, $folders) {
2241 global $LANG, $BACK_PATH;
2245 // Create headline (showing number of folders):
2246 $content.=$this->barheader(
2247 sprintf($GLOBALS['LANG']->getLL('folders').' (%s):',count($folders))
2250 $titleLength = intval($GLOBALS['BE_USER']->uc
['titleLen']);
2252 // Create the header of current folder:
2254 if (strstr($baseFolder, ',') ||
strstr($baseFolder, '|')) {
2255 // In case an invalid character is in the filepath, display error message:
2256 $errorMessage = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
2257 $aTag = $aTag_alt = "<a href=\"#\" onclick=\"alert(".$errorMessage.");return false;\">";
2259 // If foldername is OK, just add it:
2260 $aTag = "<a href=\"#\" onclick=\"return insertElement('','".rawurlencode($baseFolder)."', 'folder', '".rawurlencode($baseFolder)."', unescape('".rawurlencode($baseFolder)."'), '".$fI['extension']."', '".$ficon."');\">";
2261 $aTag_alt = substr($aTag,0,-4).",'',1);\">";
2265 // add the foder icon
2266 $folderIcon = $aTag_alt;
2267 $folderIcon.= '<img'.t3lib_iconWorks
::skinImg(
2269 'gfx/i/_icon_webfolders.gif','width="18" height="16"'
2271 $folderIcon.= htmlspecialchars(
2272 t3lib_div
::fixed_lgd_cs(basename($baseFolder),$titleLength)
2274 $folderIcon.= $aTag_e;
2276 $content.=$folderIcon.'<br />';
2279 // Listing the folders:
2280 if(is_array($folders)) {
2281 if(count($folders) > 0) {
2282 // Traverse the folder list:
2284 foreach($folders as $folderPath) {
2285 $pathInfo = pathinfo($folderPath);
2287 // Create folder icon:
2288 $icon = '<img src="clear.gif" width="16" height="16" alt="" /><img'.t3lib_iconWorks
::skinImg($BACK_PATH, 'gfx/i/_icon_webfolders.gif','width="16" height="16"').' title="'.htmlspecialchars($pathInfo['basename'].$size).'" class="absmiddle" alt="" />';
2290 // Create links for adding the folder:
2291 if($this->P
['itemName'] != '' && $this->P
['formName'] != '') {
2292 $aTag = "<a href=\"#\" onclick=\"return set_folderpath(unescape('".rawurlencode($folderPath)."'));\">";
2294 $aTag = "<a href=\"#\" onclick=\"return insertElement('','".rawurlencode($folderPath)."', 'folder', '".rawurlencode($folderPath)."', unescape('".rawurlencode($folderPath)."'), '".$pathInfo['extension']."', '".$ficon."');\">";
2297 if (strstr($folderPath,',') ||
strstr($folderPath,'|')) {
2298 // In case an invalid character is in the filepath, display error message:
2299 $errorMessage = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
2300 $aTag = $aTag_alt = "<a href=\"#\" onclick=\"alert(".$errorMessage.");return false;\">";
2302 // If foldername is OK, just add it:
2303 $aTag_alt = substr($aTag,0,-4).",'',1);\">";
2307 // Combine icon and folderpath:
2308 $foldernameAndIcon = $aTag_alt.$icon.htmlspecialchars(
2309 t3lib_div
::fixed_lgd_cs(basename($folderPath),$titleLength)
2312 if($this->P
['itemName'] != '') {
2314 <tr class="bgColor4">
2315 <td nowrap="nowrap">'.$foldernameAndIcon.' </td>
2320 <tr class="bgColor4">
2321 <td nowrap="nowrap">'.$foldernameAndIcon.' </td>
2322 <td>'.$aTag.'<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$aTag_e.'</td>
2329 <td colspan="3"><img src="clear.gif" width="1" height="3" alt="" /></td>
2334 // Wrap all the rows in table tags:
2340 <table border="0" cellpadding="0" cellspacing="1" id="typo3-folderList">
2341 '.implode('', $lines).'
2345 // Return accumulated content for folderlisting:
2350 * For RTE: This displays all IMAGES (gif,png,jpg) (from extensionList) from folder. Thumbnails are shown for images.
2351 * This listing is of images located in the web-accessible paths ONLY - the listing is for drag-n-drop use in the RTE
2353 * @param string The folder path to expand
2354 * @param string List of fileextensions to show
2355 * @return string HTML output
2357 function TBE_dragNDrop($expandFolder=0,$extensionList='') {
2360 $expandFolder = $expandFolder ?
$expandFolder : $this->expandFolder
;
2362 if ($expandFolder && $this->checkFolder($expandFolder)) {
2363 if ($this->isWebFolder($expandFolder)) {
2365 // Read files from directory:
2366 $files = t3lib_div
::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order='')
2367 if (is_array($files)) {
2368 $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files)));
2370 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
2371 $picon='<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
2372 $picon.=htmlspecialchars(t3lib_div
::fixed_lgd_cs(basename($expandFolder),$titleLen));
2373 $out.=$picon.'<br />';
2378 // Add "drag-n-drop" message:
2381 <td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
2385 while(list(,$filepath)=each($files)) {
2386 $fI = pathinfo($filepath);
2389 $iurl = $this->siteURL
.t3lib_div
::rawurlencodeFP(substr($filepath,strlen(PATH_site
)));
2391 // Show only web-images
2392 if (t3lib_div
::inList('gif,jpeg,jpg,png',strtolower($fI['extension']))) {
2393 $imgInfo = @getimagesize
($filepath);
2394 $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
2396 $ficon = t3lib_BEfunc
::getFileIcon(strtolower($fI['extension']));
2397 $size=' ('.t3lib_div
::formatSize(filesize($filepath)).'bytes'.($pDim?
', '.$pDim:'').')';
2398 $icon = '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/fileicons/'.$ficon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
2399 $filenameAndIcon=$icon.htmlspecialchars(t3lib_div
::fixed_lgd_cs(basename($filepath),$titleLen));
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($BACK_PATH,'gfx/icon_warning2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('clickToRedrawFullSize',1).'" alt="" />'.
2432 <td colspan="2"><img src="'.$iurl.'" 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 = ereg_replace('\/$','',$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(ereg_replace('\/$', '', $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(ereg_replace('\/$', '', $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) {
2522 <h3 class="bgColor5">'.htmlspecialchars($str).'</h3>
2527 * Displays a message box with the input message
2529 * @param string Input message to show (will be htmlspecialchars()'ed inside of this function)
2530 * @param string Icon filename body from gfx/ (default is "icon_note") - meant to allow change to warning type icons...
2531 * @return string HTML for the message (wrapped in a table).
2533 function getMsgBox($in_msg,$icon='icon_note') {
2536 $msg = '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/'.$icon.'.gif','width="18" height="16"').' alt="" />'.htmlspecialchars($in_msg);
2542 <table cellspacing="0" class="bgColor4" id="typo3-msgBox">
2552 * For RTE/link: This prints the 'currentUrl'
2554 * @param string URL value. The value is htmlspecialchars()'ed before output.
2555 * @return string HTML content, wrapped in a table.
2557 function printCurrentUrl($str) {
2563 <table border="0" cellpadding="0" cellspacing="0" class="bgColor5" id="typo3-curUrl">
2565 <td>'.$GLOBALS['LANG']->getLL('currentLink',1).': '.htmlspecialchars(rawurldecode($str)).'</td>
2571 * For RTE/link: Parses the incoming URL and determines if it's a page, file, external or mail address.
2573 * @param string HREF value tp analyse
2574 * @param string The URL of the current website (frontend)
2575 * @return array Array with URL information stored in assoc. keys: value, act (page, file, spec, mail), pageid, cElement, info
2577 function parseCurUrl($href,$siteUrl) {
2578 $href = trim($href);
2582 // Default is "url":
2583 $info['value']=$href;
2586 $specialParts = explode('#_SPECIAL',$href);
2587 if (count($specialParts)==2) { // Special kind (Something RTE specific: User configurable links through: "userLinks." from ->thisConfig)
2588 $info['value']='#_SPECIAL'.$specialParts[1];
2589 $info['act']='spec';
2590 } elseif (t3lib_div
::isFirstPartOfStr($href,$siteUrl)) { // If URL is on the current frontend website:
2591 $rel = substr($href,strlen($siteUrl));
2592 if (file_exists(PATH_site
.rawurldecode($rel))) { // URL is a file, which exists:
2593 $info['value']=rawurldecode($rel);
2594 if (@is_dir
(PATH_site
. $info['value'])) {
2595 $info['act'] = 'folder';
2597 $info['act'] = 'file';
2599 } else { // URL is a page (id parameter)
2600 $uP=parse_url($rel);
2601 if (!trim($uP['path'])) {
2602 $pp = explode('id=',$uP['query']);
2603 $parameters = explode('&', $pp[1]);
2604 $id = array_shift($parameters);
2606 // Checking if the id-parameter is an alias.
2607 if (!t3lib_div
::testInt($id)) {
2608 list($idPartR) = t3lib_BEfunc
::getRecordsByField('pages','alias',$id);
2609 $id=intval($idPartR['uid']);
2612 $pageRow = t3lib_BEfunc
::getRecordWSOL('pages',$id);
2613 $titleLen=intval($GLOBALS['BE_USER']->uc
['titleLen']);
2614 $info['value']=$GLOBALS['LANG']->getLL('page',1)." '".htmlspecialchars(t3lib_div
::fixed_lgd_cs($pageRow['title'],$titleLen))."' (ID:".$id.($uP['fragment']?
', #'.$uP['fragment']:'').')';
2615 $info['pageid']=$id;
2616 $info['cElement']=$uP['fragment'];
2617 $info['act']='page';
2618 $info['query'] = $parameters[0]?
'&'.implode('&', $parameters):'';
2622 } else { // Email link:
2623 if (strtolower(substr($href,0,7))=='mailto:') {
2624 $info['value']=trim(substr($href,7));
2625 $info['act']='mail';
2628 $info['info'] = $info['value'];
2629 } else { // NO value inputted:
2631 $info['info']=$GLOBALS['LANG']->getLL('none');
2633 $info['act']='page';
2636 // let the hook have a look
2637 foreach($this->hookObjects
as $hookObject) {
2638 $info = $hookObject->parseCurrentUrl($href, $siteUrl, $info);
2645 * For TBE: Makes an upload form for uploading files to the filemount the user is browsing.
2646 * The files are uploaded to the tce_file.php script in the core which will handle the upload.
2648 * @param string Absolute filepath on server to which to upload.
2649 * @return string HTML for an upload form.
2651 function uploadForm($path) {
2654 if ($this->isReadOnlyFolder($path)) return '';
2656 // Read configuration of upload field count
2657 $userSetting = $GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.uploadFieldsInLinkBrowser');
2658 $count = isset($userSetting) ?
$userSetting : 3;
2659 if ($count === '0') {
2662 $count = intval($count) == 0 ?
3 : intval($count);
2664 // Create header, showing upload path:
2665 $header = t3lib_div
::isFirstPartOfStr($path,PATH_site
)?
substr($path,strlen(PATH_site
)):$path;
2666 $code=$this->barheader($GLOBALS['LANG']->getLL('uploadImage').':');
2670 Form, for uploading files:
2672 <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">
2673 <table border="0" cellpadding="0" cellspacing="3" id="typo3-uplFiles">
2675 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
2680 // Traverse the number of upload fields (default is 3):
2681 for ($a=1;$a<=$count;$a++
) {
2682 $code.='<input type="file" name="upload_'.$a.'"'.$this->doc
->formWidth(35).' size="50" />
2683 <input type="hidden" name="file[upload]['.$a.'][target]" value="'.htmlspecialchars($path).'" />
2684 <input type="hidden" name="file[upload]['.$a.'][data]" value="'.$a.'" /><br />';
2687 // Make footer of upload form, including the submit button:
2688 $redirectValue = $this->thisScript
.'?act='.$this->act
.'&mode='.$this->mode
.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams
);
2689 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
2690 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />';
2693 <div id="c-override">
2694 <input type="checkbox" name="overwriteExistingFiles" id="overwriteExistingFiles" value="1" /> <label for="overwriteExistingFiles">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:overwriteExistingFiles',1).'</label>
2708 * For TBE: Makes a form for creating new folders in the filemount the user is browsing.
2709 * The folder creation request is sent to the tce_file.php script in the core which will handle the creation.
2711 * @param string Absolute filepath on server in which to create the new folder.
2712 * @return string HTML for the create folder form.
2714 function createFolder($path) {
2717 if ($this->isReadOnlyFolder($path)) return '';
2719 // Don't show Folder-create form if it's denied
2720 if ($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.hideCreateFolder')) {
2723 // Create header, showing upload path:
2724 $header = t3lib_div
::isFirstPartOfStr($path,PATH_site
)?
substr($path,strlen(PATH_site
)):$path;
2725 $code=$this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle').':');
2729 Form, for creating new folders:
2731 <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform2">
2732 <table border="0" cellpadding="0" cellspacing="3" id="typo3-crFolder">
2734 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
2739 // Create the new-folder name field:
2741 $code.='<input'.$this->doc
->formWidth(20).' type="text" name="file[newfolder]['.$a.'][data]" />'.
2742 '<input type="hidden" name="file[newfolder]['.$a.'][target]" value="'.htmlspecialchars($path).'" />';
2744 // Make footer of upload form, including the submit button:
2745 $redirectValue = $this->thisScript
.'?act='.$this->act
.'&mode='.$this->mode
.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams
);
2746 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
2747 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.submit',1).'" />';
2758 * Get the HTML data required for a bulk selection of files of the TYPO3 Element Browser.
2760 * @param integer $filesCount: Number of files currently displayed
2761 * @return string HTML data required for a bulk selection of files - if $filesCount is 0, nothing is returned
2763 function getBulkSelector($filesCount) {
2765 $labelToggleSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.php:toggleSelection',1);
2766 $labelImportSelection = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_browse_links.php:importSelection',1);
2768 $out = $this->doc
->spacer(15).'<div>' .
2769 '<a href="#" onclick="BrowseLinks.Selector.toggle()">' .
2770 '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/clip_select.gif','width="12" height="12"').' title="'.$labelToggleSelection.'" alt="" /> ' .
2771 $labelToggleSelection.'</a>'.$this->doc
->spacer(5) .
2772 '<a href="#" onclick="BrowseLinks.Selector.handle()">' .
2773 '<img'.t3lib_iconWorks
::skinImg($BACK_PATH,'gfx/import.gif','width="12" height="12"').' title="'.$labelImportSelection.'" alt="" /> ' .
2774 $labelImportSelection.'</a>' .
2775 '</div>'.$this->doc
->spacer(15);
2781 // Include extension?
2782 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/class.browse_links.php']) {
2783 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/class.browse_links.php']);