Fixed bug #65: Thumbnails in Element Browser are only displayed if fileSuffix is...
[Packages/TYPO3.CMS.git] / typo3 / class.browse_links.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
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.
13 *
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.
18 *
19 *
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.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
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!
31 *
32 * $Id$
33 * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
34 * XHTML compliant
35 *
36 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
37 */
38 /**
39 * [CLASS/FUNCTION INDEX of SCRIPT]
40 *
41 *
42 *
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)
49 *
50 *
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)
58 *
59 *
60 * 400: class rtePageTree extends localPageTree
61 *
62 *
63 * 417: class TBE_PageTree extends localPageTree
64 * 426: function ext_isLinkable($doktype,$uid)
65 * 438: function wrapTitle($title,$v,$ext_pArrPages)
66 *
67 *
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='')
74 *
75 *
76 * 599: class rteFolderTree extends localFolderTree
77 *
78 *
79 * 615: class TBE_FolderTree extends localFolderTree
80 * 624: function ext_isLinkable($v)
81 * 637: function wrapTitle($title,$v)
82 *
83 *
84 * 658: class browse_links
85 * 764: function init()
86 * 1034: function processSessionData($data)
87 *
88 * SECTION: Main functions
89 * 1077: function main_rte($wiz=0)
90 * 1379: function main_db()
91 * 1424: function main_file()
92 *
93 * SECTION: Record listing
94 * 1534: function expandPage()
95 * 1615: function TBE_expandPage($tables)
96 *
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='')
102 *
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)
112 *
113 * TOTAL FUNCTIONS: 39
114 * (This index is automatically created/updated by the extension "extdeveval")
115 *
116 */
117
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');
122
123
124 // Include classes
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');
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149 /**
150 * Local version of the record list.
151 *
152 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
153 * @package TYPO3
154 * @subpackage core
155 */
156 class TBE_browser_recordList extends localRecordList {
157 var $thisScript = 'browse_links.php';
158
159 /**
160 * Initializes the script path
161 *
162 * @return void
163 */
164 function TBE_browser_recordList () {
165 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
166 }
167
168 /**
169 * Creates the URL for links
170 *
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
175 */
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):'').
185 // extra:
186 $this->ext_addP()
187 ;
188 }
189
190 /**
191 * Returns additional, local GET parameters to include in the links of the record list.
192 *
193 * @return string
194 */
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);
200 return $str;
201 }
202
203 /**
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...)
205 *
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)
210 * @return string
211 */
212 function linkWrapItems($table,$uid,$code,$row) {
213 global $TCA, $BACK_PATH;
214
215 if (!$code) {
216 $code = '<i>['.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.no_title',1).']</i>';
217 } else {
218 $code = htmlspecialchars(t3lib_div::fixed_lgd_cs($code,$this->fixedL));
219 }
220
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);">';
226 $ATag_e = '</a>';
227
228 return $ATag.
229 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('addToList',1).'" alt="" />'.
230 $ATag_e.
231 $ATag_alt.
232 $code.
233 $ATag_e;
234 }
235
236 /**
237 * Local version that sets allFields to true to support userFieldSelect
238 *
239 * @return void
240 * @see fieldSelectBox
241 */
242 function generateList() {
243 $this->allFields = true;
244 parent::generateList();
245 }
246 }
247
248
249
250
251
252
253 /**
254 * Class which generates the page tree
255 *
256 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
257 * @package TYPO3
258 * @subpackage core
259 */
260 class localPageTree extends t3lib_browseTree {
261
262 /**
263 * Constructor. Just calling init()
264 *
265 * @return void
266 */
267 function localPageTree() {
268 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
269
270 $this->init();
271
272 $this->clause = ' AND doktype!=255'.$this->clause;
273 }
274
275 /**
276 * Wrapping the title in a link, if applicable.
277 *
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.
282 */
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>';
287 } else {
288 return '<span style="color: #666666;">'.$title.'</span>';
289 }
290 }
291
292 /**
293 * Create the page navigation tree in HTML
294 *
295 * @param array Tree array
296 * @return string HTML output.
297 */
298 function printTree($treeArr='') {
299 global $BACK_PATH;
300 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
301 if (!is_array($treeArr)) $treeArr=$this->tree;
302
303 $out='';
304 $c=0;
305
306 foreach($treeArr as $k => $v) {
307 $c++;
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';
312 } else {
313 $arrCol='<td></td>';
314 }
315
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>' :
319 '';
320 $out.='
321 <tr class="'.$bgColorClass.'">
322 <td nowrap="nowrap"'.($v['row']['_CSSCLASS'] ? ' class="'.$v['row']['_CSSCLASS'].'"' : '').'>'.
323 $v['HTML'].
324 $this->wrapTitle($this->getTitleStr($v['row'],$titleLen),$v['row'],$this->ext_pArrPages).
325 '</td>'.
326 $arrCol.
327 '<td>'.$cEbullet.'</td>
328 </tr>';
329 }
330 $out='
331
332
333 <!--
334 Navigation Page Tree:
335 -->
336 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
337 '.$out.'
338 </table>';
339 return $out;
340 }
341
342 /**
343 * Returns true if a doktype can be linked.
344 *
345 * @param integer Doktype value to test
346 * @param integer uid to test.
347 * @return boolean
348 */
349 function ext_isLinkable($doktype,$uid) {
350 if ($uid && $doktype<199) {
351 return true;
352 }
353 }
354
355 /**
356 * Wrap the plus/minus icon in a link
357 *
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
362 */
363 function PM_ATagWrap($icon,$cmd,$bMark='') {
364 if ($bMark) {
365 $anchor = '#'.$bMark;
366 $name=' name="'.$bMark.'"';
367 }
368 $aOnClick = "return jumpToUrl('".$this->thisScript.'?PM='.$cmd."','".$anchor."');";
369
370 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
371 }
372
373 /**
374 * Wrapping the image tag, $icon, for the row, $row
375 *
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.
379 */
380 function wrapIcon($icon,$row) {
381 return $this->addTagAttributes($icon,' title="id='.$row['uid'].'"');
382 }
383 }
384
385
386
387
388
389
390
391
392 /**
393 * Page tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
394 *
395 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
396 * @package TYPO3
397 * @subpackage core
398 */
399 class rtePageTree extends localPageTree {
400 }
401
402
403
404
405
406
407
408
409 /**
410 * For TBE record browser
411 *
412 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
413 * @package TYPO3
414 * @subpackage core
415 */
416 class TBE_PageTree extends localPageTree {
417
418 /**
419 * Returns true if a doktype can be linked (which is always the case here).
420 *
421 * @param integer Doktype value to test
422 * @param integer uid to test.
423 * @return boolean
424 */
425 function ext_isLinkable($doktype,$uid) {
426 return true;
427 }
428
429 /**
430 * Wrapping the title in a link, if applicable.
431 *
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.
436 */
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);";
441 } else {
442 $onClick = htmlspecialchars('return jumpToUrl(\''.$this->thisScript.'?act='.$GLOBALS['SOBE']->browser->act.'&mode='.$GLOBALS['SOBE']->browser->mode.'&expandPage='.$v['uid'].'\');');
443 }
444 return '<a href="#" onclick="'.$onClick.'">'.$title.'</a>';
445 }
446 }
447
448
449
450
451
452
453
454
455 /**
456 * Base extension class which generates the folder tree.
457 * Used directly by the RTE.
458 *
459 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
460 * @package TYPO3
461 * @subpackage core
462 */
463 class localFolderTree extends t3lib_folderTree {
464 var $ext_IconMode=1;
465
466
467 /**
468 * Initializes the script path
469 *
470 * @return void
471 */
472 function localFolderTree() {
473 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
474 $this->t3lib_folderTree();
475 }
476
477 /**
478 * Wrapping the title in a link, if applicable.
479 *
480 * @param string Title, ready for output.
481 * @param array The "record"
482 * @return string Wrapping title string.
483 */
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>';
488 } else {
489 return '<span class="typo3-dimmed">'.$title.'</span>';
490 }
491 }
492
493 /**
494 * Returns true if the input "record" contains a folder which can be linked.
495 *
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
498 */
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') {
502 return 0;
503 }
504 return 1;
505 }
506
507 /**
508 * Wrap the plus/minus icon in a link
509 *
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
514 * @access private
515 */
516 function PM_ATagWrap($icon,$cmd,$bMark='') {
517 if ($bMark) {
518 $anchor = '#'.$bMark;
519 $name=' name="'.$bMark.'"';
520 }
521 $aOnClick = 'return jumpToUrl(\''.$this->thisScript.'?PM='.$cmd.'\',\''.$anchor.'\');';
522 return '<a href="#"'.$name.' onclick="'.htmlspecialchars($aOnClick).'">'.$icon.'</a>';
523 }
524
525 /**
526 * Create the folder navigation tree in HTML
527 *
528 * @param mixed Input tree array. If not array, then $this->tree is used.
529 * @return string HTML output of the tree.
530 */
531 function printTree($treeArr='') {
532 global $BACK_PATH;
533 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
534
535 if (!is_array($treeArr)) $treeArr=$this->tree;
536
537 $out='';
538 $c=0;
539
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']) {
542 $cmpPath='';
543 } else if (substr(trim($GLOBALS['SOBE']->browser->curUrlInfo['info']),-1)!='/') {
544 $cmpPath=PATH_site.dirname($GLOBALS['SOBE']->browser->curUrlInfo['info']).'/';
545 } else {
546 $cmpPath=PATH_site.$GLOBALS['SOBE']->browser->curUrlInfo['info'];
547 }
548
549 // Traverse rows for the tree and print them into table rows:
550 foreach($treeArr as $k => $v) {
551 $c++;
552 $bgColorClass=($c+1)%2 ? 'bgColor' : 'bgColor-10';
553
554 // Creating blinking arrow, if applicable:
555 if ($GLOBALS['SOBE']->browser->curUrlInfo['act']=='file' && $cmpPath==$v['row']['path']) {
556 $arrCol='<td><img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_right.gif','width="5" height="9"').' class="c-blinkArrowR" alt="" /></td>';
557 $bgColorClass='bgColor4';
558 } else {
559 $arrCol='<td></td>';
560 }
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>' : '';
564
565 // Put table row with folder together:
566 $out.='
567 <tr class="'.$bgColorClass.'">
568 <td nowrap="nowrap">'.$v['HTML'].$this->wrapTitle(t3lib_div::fixed_lgd_cs($v['row']['title'],$titleLen),$v['row']).'</td>
569 '.$arrCol.'
570 <td>'.$cEbullet.'</td>
571 </tr>';
572 }
573
574 $out='
575
576 <!--
577 Folder tree:
578 -->
579 <table border="0" cellpadding="0" cellspacing="0" id="typo3-tree">
580 '.$out.'
581 </table>';
582 return $out;
583 }
584 }
585
586
587
588
589
590
591 /**
592 * Folder tree for the RTE - totally the same, no changes needed. (Just for the sake of beauty - or confusion... :-)
593 *
594 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
595 * @package TYPO3
596 * @subpackage core
597 */
598 class rteFolderTree extends localFolderTree {
599 }
600
601
602
603
604
605
606
607 /**
608 * For TBE File Browser
609 *
610 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
611 * @package TYPO3
612 * @subpackage core
613 */
614 class TBE_FolderTree extends localFolderTree {
615 var $ext_noTempRecyclerDirs=0; // If file-drag mode is set, temp and recycler folders are filtered out.
616
617 /**
618 * Returns true if the input "record" contains a folder which can be linked.
619 *
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.
622 */
623 function ext_isLinkable($v) {
624 if ($this->ext_noTempRecyclerDirs && (substr($v['path'],-7)=='_temp_/' || substr($v['path'],-11)=='_recycler_/')) {
625 return 0;
626 } return 1;
627 }
628
629 /**
630 * Wrapping the title in a link, if applicable.
631 *
632 * @param string Title, ready for output.
633 * @param array The 'record'
634 * @return string Wrapping title string.
635 */
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>';
640 } else {
641 return '<span class="typo3-dimmed">'.$title.'</span>';
642 }
643 }
644 }
645
646
647
648
649
650 /**
651 * class for the Element Browser window.
652 *
653 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
654 * @package TYPO3
655 * @subpackage core
656 */
657 class browse_links {
658
659 // Internal, static:
660 var $siteURL; // Current site URL (Frontend)
661 var $thisScript; // the script to link to
662 var $thisConfig; // RTE specific TSconfig
663 var $setTarget; // Target (RTE specific)
664 var $setTitle; // title (RTE specific)
665 var $doc; // Backend template object
666
667 // GPvars: (Input variables from outside)
668 /**
669 * The mode determines the main kind of output from the element browser.
670 * There are these options for values: rte, db, file, filedrag, wizard.
671 * "rte" will show the link selector for the Rich Text Editor (see main_rte())
672 * "db" will allow you to browse for pages or records in the page tree (for TCEforms, see main_db())
673 * "file"/"filedrag" will allow you to browse for files or folders in the folder mounts (for TCEforms, main_file())
674 * "wizard" will allow you to browse for links (like "rte") which are passed back to TCEforms (see main_rte(1))
675 *
676 * @see main()
677 */
678 var $mode;
679
680 /**
681 * Link selector action.
682 * page,file,url,mail,spec are allowed values.
683 * These are only important with the link selector function and in that case they switch between the various menu options.
684 */
685 var $act;
686
687 /**
688 * When you click a page title/expand icon to see the content of a certain page, this value will contain that value (the ID of the expanded page). If the value is NOT set, then it will be restored from the module session data (see main(), mode="db")
689 */
690 var $expandPage;
691
692 /**
693 * When you click a folder name/expand icon to see the content of a certain file folder, this value will contain that value (the path of the expanded file folder). If the value is NOT set, then it will be restored from the module session data (see main(), mode="file"/"filedrag"). Example value: "/www/htdocs/typo3/32/3dsplm/fileadmin/css/"
694 */
695 var $expandFolder;
696
697
698
699 /**
700 * TYPO3 Element Browser, wizard mode parameters. There is a heap of parameters there, better debug() them out if you need something... :-)
701 */
702 var $P;
703
704 /**
705 * Active with TYPO3 Element Browser: Contains the name of the form field for which this window opens - thus allows us to make references back to the main window in which the form is.
706 * Example value: "data[pages][39][bodytext]|||tt_content|" or "data[tt_content][NEW3fba56fde763d][image]|||gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai|"
707 *
708 * Values:
709 * 0: form field name reference, eg. "data[tt_content][123][image]"
710 * 1: old/unused?
711 * 2: old/unused?
712 * 3: allowed types. Eg. "tt_content" or "gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai"
713 * 4: IRRE uniqueness: target level object-id to perform actions/checks on, eg. "data[79][tt_address][1][<field>][<foreign_table>]"
714 * 5: IRRE uniqueness: name of function in opener window that checks if element is already used, eg. "inline.checkUniqueElement"
715 * 6: IRRE uniqueness: name of function in opener window that performs some additional(!) action, eg. "inline.setUniqueElement"
716 * 7: IRRE uniqueness: name of function in opener window that performs action instead of using addElement/insertElement, eg. "inline.importElement"
717 *
718 * $pArr = explode('|',$this->bparams);
719 * $formFieldName = $pArr[0];
720 * $allowedTablesOrFileTypes = $pArr[3];
721 */
722 var $bparams;
723
724 /**
725 * Used with the Rich Text Editor.
726 * Example value: "tt_content:NEW3fba58c969f5c:bodytext:23:text:23:"
727 */
728 var $RTEtsConfigParams;
729
730
731
732
733 /**
734 * Plus/Minus icon value. Used by the tree class to open/close notes on the trees.
735 */
736 var $PM;
737
738 /**
739 * Pointer, used when browsing a long list of records etc.
740 */
741 var $pointer;
742
743
744
745
746 /**
747 * Used with the link selector: Contains the GET input information about the CURRENT link in the RTE/TCEform field. This consists of "href", "target" and "title" keys. This information is passed around in links.
748 */
749 var $curUrlArray;
750
751 /**
752 * 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.
753 */
754 var $curUrlInfo;
755
756
757
758
759
760
761 /**
762 * Constructor:
763 * Initializes a lot of variables, setting JavaScript functions in header etc.
764 *
765 * @return void
766 */
767 function init() {
768 global $BE_USER,$BACK_PATH;
769
770 // Main GPvars:
771 $this->pointer = t3lib_div::_GP('pointer');
772 $this->bparams = t3lib_div::_GP('bparams');
773 $this->P = t3lib_div::_GP('P');
774 $this->RTEtsConfigParams = t3lib_div::_GP('RTEtsConfigParams');
775 $this->expandPage = t3lib_div::_GP('expandPage');
776 $this->expandFolder = t3lib_div::_GP('expandFolder');
777 $this->PM = t3lib_div::_GP('PM');
778
779 // Find "mode"
780 $this->mode=t3lib_div::_GP('mode');
781 if (!$this->mode) {
782 $this->mode='rte';
783 }
784
785 // Site URL
786 $this->siteURL = t3lib_div::getIndpEnv('TYPO3_SITE_URL'); // Current site url
787
788 // the script to link to
789 $this->thisScript = t3lib_div::getIndpEnv('SCRIPT_NAME');
790
791 // CurrentUrl - the current link url must be passed around if it exists
792 if ($this->mode=='wizard') {
793 $currentLinkParts = t3lib_div::trimExplode(' ',$this->P['currentValue']);
794 $this->curUrlArray = array(
795 'target' => $currentLinkParts[1]
796 );
797 $this->curUrlInfo=$this->parseCurUrl($this->siteURL.'?id='.$currentLinkParts[0],$this->siteURL);
798 } else {
799 $this->curUrlArray = t3lib_div::_GP('curUrl');
800 if ($this->curUrlArray['all']) {
801 $this->curUrlArray=t3lib_div::get_tag_attributes($this->curUrlArray['all']);
802 }
803 $this->curUrlInfo=$this->parseCurUrl($this->curUrlArray['href'],$this->siteURL);
804 }
805
806 // Determine nature of current url:
807 $this->act=t3lib_div::_GP('act');
808 if (!$this->act) {
809 $this->act=$this->curUrlInfo['act'];
810 }
811
812 // Rich Text Editor specific configuration:
813 $addPassOnParams='';
814 if ((string)$this->mode=='rte') {
815 $RTEtsConfigParts = explode(':',$this->RTEtsConfigParams);
816 $addPassOnParams.='&RTEtsConfigParams='.rawurlencode($this->RTEtsConfigParams);
817 $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE',t3lib_BEfunc::getPagesTSconfig($RTEtsConfigParts[5]));
818 $this->thisConfig = t3lib_BEfunc::RTEsetup($RTEsetup['properties'],$RTEtsConfigParts[0],$RTEtsConfigParts[2],$RTEtsConfigParts[4]);
819 }
820
821 // Initializing the target value (RTE)
822 $this->setTarget = $this->curUrlArray['target'];
823 if ($this->thisConfig['defaultLinkTarget'] && !isset($this->curUrlArray['target'])) {
824 $this->setTarget=$this->thisConfig['defaultLinkTarget'];
825 }
826
827 // Initializing the title value (RTE)
828 $this->setTitle = $this->curUrlArray['title'];
829
830
831
832 // Creating backend template object:
833 $this->doc = t3lib_div::makeInstance('template');
834 $this->doc->docType= 'xhtml_trans';
835 $this->doc->backPath = $BACK_PATH;
836
837 // BEGIN accumulation of header JavaScript:
838 $JScode = '';
839 $JScode.= '
840 // This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...
841 var add_href="'.($this->curUrlArray['href']?'&curUrl[href]='.rawurlencode($this->curUrlArray['href']):'').'";
842 var add_target="'.($this->setTarget?'&curUrl[target]='.rawurlencode($this->setTarget):'').'";
843 var add_title="'.($this->setTitle?'&curUrl[title]='.rawurlencode($this->setTitle):'').'";
844 var add_params="'.($this->bparams?'&bparams='.rawurlencode($this->bparams):'').'";
845
846 var cur_href="'.($this->curUrlArray['href']?$this->curUrlArray['href']:'').'";
847 var cur_target="'.($this->setTarget?$this->setTarget:'').'";
848 var cur_title="'.($this->setTitle?$this->setTitle:'').'";
849
850 function setTarget(target) { //
851 cur_target=target;
852 add_target="&curUrl[target]="+escape(target);
853 }
854 function setTitle(title) { //
855 cur_title=title;
856 add_title="&curUrl[title]="+escape(title);
857 }
858 function setValue(value) { //
859 cur_href=value;
860 add_href="&curUrl[href]="+value;
861 }
862 ';
863
864
865 if ($this->mode=='wizard') { // Functions used, if the link selector is in wizard mode (= TCEforms fields)
866 unset($this->P['fieldChangeFunc']['alert']);
867 reset($this->P['fieldChangeFunc']);
868 $update='';
869 while(list($k,$v)=each($this->P['fieldChangeFunc'])) {
870 $update.= '
871 window.opener.'.$v;
872 }
873
874 $P2=array();
875 $P2['itemName']=$this->P['itemName'];
876 $P2['formName']=$this->P['formName'];
877 $P2['fieldChangeFunc']=$this->P['fieldChangeFunc'];
878 $addPassOnParams.=t3lib_div::implodeArrayForUrl('P',$P2);
879
880 $JScode.='
881 function link_typo3Page(id,anchor) { //
882 updateValueInMainForm(id+(anchor?anchor:"")+" "+cur_target);
883 close();
884 return false;
885 }
886 function link_folder(folder) { //
887 updateValueInMainForm(folder+" "+cur_target);
888 close();
889 return false;
890 }
891 function link_current() { //
892 if (cur_href!="http://" && cur_href!="mailto:") {
893 var setValue = cur_href+" "+cur_target+" "+cur_title;
894 if (setValue.substr(0,7)=="http://") setValue = setValue.substr(7);
895 if (setValue.substr(0,7)=="mailto:") setValue = setValue.substr(7);
896 updateValueInMainForm(setValue);
897 close();
898 }
899 return false;
900 }
901 function checkReference() { //
902 if (window.opener && window.opener.document && window.opener.document.'.$this->P['formName'].' && window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"] ) {
903 return window.opener.document.'.$this->P['formName'].'["'.$this->P['itemName'].'"];
904 } else {
905 close();
906 }
907 }
908 function updateValueInMainForm(input) { //
909 var field = checkReference();
910 if (field) {
911 field.value = input;
912 '.$update.'
913 }
914 }
915 ';
916 } else { // Functions used, if the link selector is in RTE mode:
917 $JScode.='
918 function link_typo3Page(id,anchor) { //
919 var theLink = \''.$this->siteURL.'?id=\'+id+(anchor?anchor:"");
920 self.parent.parent.renderPopup_addLink(theLink,cur_target,cur_title);
921 return false;
922 }
923 function link_folder(folder) { //
924 var theLink = \''.$this->siteURL.'\'+folder;
925 self.parent.parent.renderPopup_addLink(theLink,cur_target,cur_title);
926 return false;
927 }
928 function link_spec(theLink) { //
929 self.parent.parent.renderPopup_addLink(theLink,cur_target,cur_title);
930 return false;
931 }
932 function link_current() { //
933 if (cur_href!="http://" && cur_href!="mailto:") {
934 self.parent.parent.renderPopup_addLink(cur_href,cur_target,cur_title);
935 }
936 return false;
937 }
938 ';
939 }
940
941 // General "jumpToUrl" function:
942 $JScode.='
943 function jumpToUrl(URL,anchor) { //
944 var add_act = URL.indexOf("act=")==-1 ? "&act='.$this->act.'" : "";
945 var add_mode = URL.indexOf("mode=")==-1 ? "&mode='.$this->mode.'" : "";
946 var theLocation = URL+add_act+add_mode+add_href+add_target+add_title+add_params'.($addPassOnParams?'+"'.$addPassOnParams.'"':'').'+(anchor?anchor:"");
947 window.location.href = theLocation;
948 return false;
949 }
950 ';
951
952
953 /**
954 * Splits parts of $this->bparams
955 * @see $bparams
956 */
957 $pArr = explode('|',$this->bparams);
958
959 // This is JavaScript especially for the TBE Element Browser!
960 $formFieldName = 'data['.$pArr[0].']['.$pArr[1].']['.$pArr[2].']';
961
962 // insertElement - Call check function (e.g. for uniqueness handling):
963 if ($pArr[4] && $pArr[5]) {
964 $JScodeCheck = '
965 // Call a check function in the opener window (e.g. for uniqueness handling):
966 if (parent.window.opener) {
967 var res = parent.window.opener.'.$pArr[5].'("'.addslashes($pArr[4]).'",table,uid,type);
968 if (!res.passed) {
969 if (res.message) alert(res.message);
970 performAction = false;
971 }
972 } else {
973 alert("Error - reference to main window is not set properly!");
974 parent.close();
975 }
976 ';
977 }
978 // insertElement - Call helper function:
979 if ($pArr[4] && $pArr[6]) {
980 $JScodeHelper = '
981 // Call helper function to manage data in the opener window:
982 if (parent.window.opener) {
983 parent.window.opener.'.$pArr[6].'("'.addslashes($pArr[4]).'",table,uid,type,"'.addslashes($pArr[0]).'");
984 } else {
985 alert("Error - reference to main window is not set properly!");
986 parent.close();
987 }
988 ';
989 }
990 // insertElement - perform action commands:
991 if ($pArr[4] && $pArr[7]) {
992 // Call user defined action function:
993 $JScodeAction = '
994 if (parent.window.opener) {
995 parent.window.opener.'.$pArr[7].'("'.addslashes($pArr[4]).'",table,uid,type);
996 focusOpenerAndClose(close);
997 } else {
998 alert("Error - reference to main window is not set properly!");
999 parent.close();
1000 }
1001 ';
1002 } else if ($pArr[0] && !$pArr[1] && !$pArr[2]) {
1003 $JScodeAction = '
1004 addElement(filename,table+"_"+uid,fp,close);
1005 ';
1006 } else {
1007 $JScodeAction = '
1008 if (setReferences()) {
1009 parent.window.opener.group_change("add","'.$pArr[0].'","'.$pArr[1].'","'.$pArr[2].'",elRef,targetDoc);
1010 } else {
1011 alert("Error - reference to main window is not set properly!");
1012 }
1013 focusOpenerAndClose(close);
1014 ';
1015 }
1016
1017 $JScode.='
1018 var elRef="";
1019 var targetDoc="";
1020
1021 function launchView(url) { //
1022 var thePreviewWindow="";
1023 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");
1024 if (thePreviewWindow && thePreviewWindow.focus) {
1025 thePreviewWindow.focus();
1026 }
1027 }
1028 function setReferences() { //
1029 if (parent.window.opener
1030 && parent.window.opener.content
1031 && parent.window.opener.content.document.editform
1032 && parent.window.opener.content.document.editform["'.$formFieldName.'"]
1033 ) {
1034 targetDoc = parent.window.opener.content.document;
1035 elRef = targetDoc.editform["'.$formFieldName.'"];
1036 return true;
1037 } else {
1038 return false;
1039 }
1040 }
1041 function insertElement(table, uid, type, filename,fp,filetype,imagefile,action, close) { //
1042 var performAction = true;
1043 '.$JScodeCheck.'
1044 // Call performing function and finish this action:
1045 if (performAction) {
1046 '.$JScodeHelper.$JScodeAction.'
1047 }
1048 return false;
1049 }
1050 function addElement(elName,elValue,altElValue,close) { //
1051 if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin) {
1052 parent.window.opener.setFormValueFromBrowseWin("'.$pArr[0].'",altElValue?altElValue:elValue,elName);
1053 focusOpenerAndClose(close);
1054 } else {
1055 alert("Error - reference to main window is not set properly!");
1056 parent.close();
1057 }
1058 }
1059 function focusOpenerAndClose(close) { //
1060 if (close) {
1061 parent.window.opener.focus();
1062 parent.close();
1063 }
1064 }
1065 ';
1066
1067 // Finally, add the accumulated JavaScript to the template object:
1068 $this->doc->JScode = $this->doc->wrapScriptTags($JScode);
1069
1070 // Debugging:
1071 if (FALSE) debug(array(
1072 'pointer' => $this->pointer,
1073 'act' => $this->act,
1074 'mode' => $this->mode,
1075 'curUrlInfo' => $this->curUrlInfo,
1076 'curUrlArray' => $this->curUrlArray,
1077 'P' => $this->P,
1078 'bparams' => $this->bparams,
1079 'RTEtsConfigParams' => $this->RTEtsConfigParams,
1080 'expandPage' => $this->expandPage,
1081 'expandFolder' => $this->expandFolder,
1082 'PM' => $this->PM,
1083 ),'Internal variables of Script Class:');
1084 }
1085
1086
1087 /**
1088 * Session data for this class can be set from outside with this method.
1089 * Call after init()
1090 *
1091 * @param array Session data array
1092 * @return array Session data and boolean which indicates that data needs to be stored in session because it's changed
1093 */
1094 function processSessionData($data) {
1095 $store = false;
1096
1097 switch((string)$this->mode) {
1098 case 'db':
1099 if (isset($this->expandPage)) {
1100 $data['expandPage']=$this->expandPage;
1101 $store = true;
1102 } else {
1103 $this->expandPage=$data['expandPage'];
1104 }
1105 break;
1106 case 'file':
1107 case 'filedrag':
1108 if (isset($this->expandFolder)) {
1109 $data['expandFolder']=$this->expandFolder;
1110 $store = true;
1111 } else {
1112 $this->expandFolder=$data['expandFolder'];
1113 }
1114 break;
1115 }
1116
1117 return array($data, $store);
1118 }
1119
1120
1121
1122
1123 /******************************************************************
1124 *
1125 * Main functions
1126 *
1127 ******************************************************************/
1128
1129 /**
1130 * Rich Text Editor (RTE) link selector (MAIN function)
1131 * Generates the link selector for the Rich Text Editor.
1132 * Can also be used to select links for the TCEforms (see $wiz)
1133 *
1134 * @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
1135 * @return string Modified content variable.
1136 */
1137 function main_rte($wiz=0) {
1138 global $LANG, $BACK_PATH;
1139
1140 // Starting content:
1141 $content=$this->doc->startPage('RTE link');
1142
1143 // Initializing the action value, possibly removing blinded values etc:
1144 $allowedItems = array_diff(explode(',','page,file,url,mail,spec'),t3lib_div::trimExplode(',',$this->thisConfig['blindLinkOptions'],1));
1145 reset($allowedItems);
1146 if (!in_array($this->act,$allowedItems)) $this->act = current($allowedItems);
1147
1148 // Making menu in top:
1149 $menuDef = array();
1150 if (!$wiz) {
1151 $menuDef['removeLink']['isActive'] = $this->act=='removeLink';
1152 $menuDef['removeLink']['label'] = $LANG->getLL('removeLink',1);
1153 $menuDef['removeLink']['url'] = '#';
1154 $menuDef['removeLink']['addParams'] = 'onclick="self.parent.parent.renderPopup_unLink();return false;"';
1155 }
1156 if (in_array('page',$allowedItems)) {
1157 $menuDef['page']['isActive'] = $this->act=='page';
1158 $menuDef['page']['label'] = $LANG->getLL('page',1);
1159 $menuDef['page']['url'] = '#';
1160 $menuDef['page']['addParams'] = 'onclick="jumpToUrl(\'?act=page\');return false;"';
1161 }
1162 if (in_array('file',$allowedItems)){
1163 $menuDef['file']['isActive'] = $this->act=='file';
1164 $menuDef['file']['label'] = $LANG->getLL('file',1);
1165 $menuDef['file']['url'] = '#';
1166 $menuDef['file']['addParams'] = 'onclick="jumpToUrl(\'?act=file\');return false;"';
1167 }
1168 if (in_array('url',$allowedItems)) {
1169 $menuDef['url']['isActive'] = $this->act=='url';
1170 $menuDef['url']['label'] = $LANG->getLL('extUrl',1);
1171 $menuDef['url']['url'] = '#';
1172 $menuDef['url']['addParams'] = 'onclick="jumpToUrl(\'?act=url\');return false;"';
1173 }
1174 if (in_array('mail',$allowedItems)) {
1175 $menuDef['mail']['isActive'] = $this->act=='mail';
1176 $menuDef['mail']['label'] = $LANG->getLL('email',1);
1177 $menuDef['mail']['url'] = '#';
1178 $menuDef['mail']['addParams'] = 'onclick="jumpToUrl(\'?act=mail\');return false;"';
1179 }
1180 if (is_array($this->thisConfig['userLinks.']) && in_array('spec',$allowedItems)) {
1181 $menuDef['spec']['isActive'] = $this->act=='spec';
1182 $menuDef['spec']['label'] = $LANG->getLL('special',1);
1183 $menuDef['spec']['url'] = '#';
1184 $menuDef['spec']['addParams'] = 'onclick="jumpToUrl(\'?act=spec\');return false;"';
1185 }
1186 $content .= $this->doc->getTabMenuRaw($menuDef);
1187
1188 // Adding the menu and header to the top of page:
1189 $content.=$this->printCurrentUrl($this->curUrlInfo['info']).'<br />';
1190
1191
1192 // Depending on the current action we will create the actual module content for selecting a link:
1193 switch($this->act) {
1194 case 'mail':
1195 $extUrl='
1196
1197 <!--
1198 Enter mail address:
1199 -->
1200 <form action="" name="lurlform" id="lurlform">
1201 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkMail">
1202 <tr>
1203 <td>'.$GLOBALS['LANG']->getLL('emailAddress',1).':</td>
1204 <td><input type="text" name="lemail"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='mail'?$this->curUrlInfo['info']:'').'" /> '.
1205 '<input type="submit" value="'.$GLOBALS['LANG']->getLL('setLink',1).'" onclick="setTarget(\'\');setValue(\'mailto:\'+document.lurlform.lemail.value); return link_current();" /></td>
1206 </tr>
1207 </table>
1208 </form>';
1209 $content.=$extUrl;
1210 break;
1211 case 'url':
1212 $extUrl='
1213
1214 <!--
1215 Enter External URL:
1216 -->
1217 <form action="" name="lurlform" id="lurlform">
1218 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkURL">
1219 <tr>
1220 <td>URL:</td>
1221 <td><input type="text" name="lurl"'.$this->doc->formWidth(20).' value="'.htmlspecialchars($this->curUrlInfo['act']=='url'?$this->curUrlInfo['info']:'http://').'" /> '.
1222 '<input type="submit" value="'.$GLOBALS['LANG']->getLL('setLink',1).'" onclick="setValue(document.lurlform.lurl.value); return link_current();" /></td>
1223 </tr>
1224 </table>
1225 </form>';
1226 $content.=$extUrl;
1227 break;
1228 case 'file':
1229 $foldertree = t3lib_div::makeInstance('rteFolderTree');
1230 $foldertree->thisScript = $this->thisScript;
1231 $tree=$foldertree->getBrowsableTree();
1232
1233 if (!$this->curUrlInfo['value'] || $this->curUrlInfo['act']!='file') {
1234 $cmpPath='';
1235 } elseif (substr(trim($this->curUrlInfo['info']),-1)!='/') {
1236 $cmpPath=PATH_site.dirname($this->curUrlInfo['info']).'/';
1237 if (!isset($this->expandFolder)) $this->expandFolder = $cmpPath;
1238 } else {
1239 $cmpPath=PATH_site.$this->curUrlInfo['info'];
1240 }
1241
1242 list(,,$specUid) = explode('_',$this->PM);
1243 $files = $this->expandFolder($foldertree->specUIDmap[$specUid]);
1244
1245 $content.= '
1246
1247 <!--
1248 Wrapper table for folder tree / file list:
1249 -->
1250 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkFiles">
1251 <tr>
1252 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
1253 <td class="c-wCell" valign="top">'.$files.'</td>
1254 </tr>
1255 </table>
1256 ';
1257 break;
1258 case 'spec':
1259 if (is_array($this->thisConfig['userLinks.'])) {
1260 $subcats=array();
1261 $v=$this->thisConfig['userLinks.'];
1262 reset($v);
1263 while(list($k2)=each($v)) {
1264 $k2i = intval($k2);
1265 if (substr($k2,-1)=='.' && is_array($v[$k2i.'.'])) {
1266
1267 // Title:
1268 $title = trim($v[$k2i]);
1269 if (!$title) {
1270 $title=$v[$k2i.'.']['url'];
1271 } else {
1272 $title=$LANG->sL($title);
1273 }
1274 // Description:
1275 $description=$v[$k2i.'.']['description'] ? $LANG->sL($v[$k2i.'.']['description'],1).'<br />' : '';
1276
1277 // URL + onclick event:
1278 $onClickEvent='';
1279 if (isset($v[$k2i.'.']['target'])) $onClickEvent.="setTarget('".$v[$k2i.'.']['target']."');";
1280 $v[$k2i.'.']['url'] = str_replace('###_URL###',$this->siteURL,$v[$k2i.'.']['url']);
1281 if (substr($v[$k2i.'.']['url'],0,7)=='http://' || substr($v[$k2i.'.']['url'],0,7)=='mailto:') {
1282 $onClickEvent.="cur_href=unescape('".rawurlencode($v[$k2i.'.']['url'])."');link_current();";
1283 } else {
1284 $onClickEvent.="link_spec(unescape('".$this->siteURL.rawurlencode($v[$k2i.'.']['url'])."'));";
1285 }
1286
1287 // Link:
1288 $A=array('<a href="#" onclick="'.htmlspecialchars($onClickEvent).'return false;">','</a>');
1289
1290 // Adding link to menu of user defined links:
1291 $subcats[$k2i]='
1292 <tr>
1293 <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>
1294 </tr>';
1295 }
1296 }
1297
1298 // Sort by keys:
1299 ksort($subcats);
1300
1301 // Add menu to content:
1302 $content.= '
1303
1304 <!--
1305 Special userdefined menu:
1306 -->
1307 <table border="0" cellpadding="1" cellspacing="1" id="typo3-linkSpecial">
1308 <tr>
1309 <td class="bgColor5" class="c-wCell" valign="top"><strong>'.$LANG->getLL('special',1).'</strong></td>
1310 </tr>
1311 '.implode('',$subcats).'
1312 </table>
1313 ';
1314 }
1315 break;
1316 case 'page':
1317 default:
1318 $pagetree = t3lib_div::makeInstance('rtePageTree');
1319 $pagetree->thisScript = $this->thisScript;
1320 $tree=$pagetree->getBrowsableTree();
1321 $cElements = $this->expandPage();
1322 $content.= '
1323
1324 <!--
1325 Wrapper table for page tree / record list:
1326 -->
1327 <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages">
1328 <tr>
1329 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
1330 <td class="c-wCell" valign="top">'.$cElements.'</td>
1331 </tr>
1332 </table>
1333 ';
1334 break;
1335 }
1336
1337 $content .= '
1338
1339
1340
1341 <!--
1342 Selecting title for link:
1343 -->
1344 <form action="" name="ltitleform" id="ltargetform">
1345 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
1346 <tr>
1347 <td>'.$GLOBALS['LANG']->getLL('title',1).'</td>
1348 <td><input type="text" name="ltitle" onchange="setTitle(this.value);" value="'.htmlspecialchars($this->setTitle).'"'.$this->doc->formWidth(10).' /></td>
1349 <td><input type="submit" value="'.$GLOBALS['LANG']->getLL('update',1).'" onclick="return link_current();" /></td>
1350 </tr>
1351 </table>
1352 </form>
1353 ';
1354
1355 // Target:
1356 if ($this->act!='mail') {
1357 $ltarget='
1358
1359
1360
1361 <!--
1362 Selecting target for link:
1363 -->
1364 <form action="" name="ltargetform" id="ltargetform">
1365 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
1366 <tr>
1367 <td>'.$GLOBALS['LANG']->getLL('target',1).':</td>
1368 <td><input type="text" name="ltarget" onchange="setTarget(this.value);" value="'.htmlspecialchars($this->setTarget).'"'.$this->doc->formWidth(10).' /></td>
1369 <td>
1370 <select name="ltarget_type" onchange="setTarget(this.options[this.selectedIndex].value);document.ltargetform.ltarget.value=this.options[this.selectedIndex].value;this.selectedIndex=0;">
1371 <option></option>
1372 <option value="_top">'.$GLOBALS['LANG']->getLL('top',1).'</option>
1373 <option value="_blank">'.$GLOBALS['LANG']->getLL('newWindow',1).'</option>
1374 </select>
1375 </td>
1376 <td>';
1377
1378 if (($this->curUrlInfo['act']=="page" || $this->curUrlInfo['act']=='file') && $this->curUrlArray['href']) {
1379 $ltarget.='
1380 <input type="submit" value="'.$GLOBALS['LANG']->getLL('update',1).'" onclick="return link_current();" />';
1381 }
1382
1383 $selectJS = '
1384 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) {
1385 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;
1386 setTarget(document.ltargetform.ltarget.value);
1387 setTitle(document.ltitleform.ltitle.value);
1388 document.ltargetform.popup_width.selectedIndex=0;
1389 document.ltargetform.popup_height.selectedIndex=0;
1390 }
1391 ';
1392
1393 $ltarget.=' </td>
1394 </tr>
1395 <tr>
1396 <td>'.$GLOBALS['LANG']->getLL('target_popUpWindow',1).':</td>
1397 <td colspan="3">
1398 <select name="popup_width" onchange="'.htmlspecialchars($selectJS).'">
1399 <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_width',1).'</option>
1400 <option value="300">300</option>
1401 <option value="400">400</option>
1402 <option value="500">500</option>
1403 <option value="600">600</option>
1404 <option value="700">700</option>
1405 <option value="800">800</option>
1406 </select>
1407 x
1408 <select name="popup_height" onchange="'.htmlspecialchars($selectJS).'">
1409 <option value="0">'.$GLOBALS['LANG']->getLL('target_popUpWindow_height',1).'</option>
1410 <option value="200">200</option>
1411 <option value="300">300</option>
1412 <option value="400">400</option>
1413 <option value="500">500</option>
1414 <option value="600">600</option>
1415 </select>
1416 </td>
1417 </tr>
1418 </table>
1419 </form>';
1420
1421 // Add "target selector" box to content:
1422 $content.=$ltarget;
1423
1424 // Add some space
1425 $content.='<br /><br />';
1426 }
1427
1428 // End page, return content:
1429 $content.= $this->doc->endPage();
1430 $content = $this->doc->insertStylesAndJS($content);
1431 return $content;
1432 }
1433
1434 /**
1435 * TYPO3 Element Browser: Showing a page tree and allows you to browse for records
1436 *
1437 * @return string HTML content for the module
1438 */
1439 function main_db() {
1440
1441 // Starting content:
1442 $content=$this->doc->startPage('TBE record selector');
1443
1444 // Init variable:
1445 $pArr = explode('|',$this->bparams);
1446
1447 // Making the browsable pagetree:
1448 $pagetree = t3lib_div::makeInstance('TBE_PageTree');
1449 $pagetree->thisScript=$this->thisScript;
1450 $pagetree->ext_pArrPages = !strcmp($pArr[3],'pages')?1:0;
1451 $pagetree->ext_showNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
1452 $pagetree->addField('nav_title');
1453 $tree=$pagetree->getBrowsableTree();
1454
1455 // Making the list of elements, if applicable:
1456 $cElements = $this->TBE_expandPage($pArr[3]);
1457
1458 // Putting the things together, side by side:
1459 $content.= '
1460
1461 <!--
1462 Wrapper table for page tree / record list:
1463 -->
1464 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBrecords">
1465 <tr>
1466 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('pageTree').':').$tree.'</td>
1467 <td class="c-wCell" valign="top">'.$cElements.'</td>
1468 </tr>
1469 </table>
1470 ';
1471
1472 // Add some space
1473 $content.='<br /><br />';
1474
1475 // End page, return content:
1476 $content.= $this->doc->endPage();
1477 $content = $this->doc->insertStylesAndJS($content);
1478 return $content;
1479 }
1480
1481 /**
1482 * TYPO3 Element Browser: Showing a folder tree, allowing you to browse for files.
1483 *
1484 * @return string HTML content for the module
1485 */
1486 function main_file() {
1487 global $BE_USER;
1488
1489 // Starting content:
1490 $content.=$this->doc->startPage('TBE file selector');
1491
1492 // Init variable:
1493 $pArr = explode('|',$this->bparams);
1494
1495 // Create upload/create folder forms, if a path is given:
1496 $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
1497 $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
1498 $path=$this->expandFolder;
1499 if (!$path || !@is_dir($path)) {
1500 $path = $fileProcessor->findTempFolder().'/'; // The closest TEMP-path is found
1501 }
1502 if ($path!='/' && @is_dir($path)) {
1503 $uploadForm=$this->uploadForm($path);
1504 $createFolder=$this->createFolder($path);
1505 } else {
1506 $createFolder='';
1507 $uploadForm='';
1508 }
1509 if ($BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) $content.=$uploadForm;
1510
1511 // Getting flag for showing/not showing thumbnails:
1512 $noThumbs = $GLOBALS['BE_USER']->getTSConfigVal('options.noThumbsInEB');
1513
1514 if (!$noThumbs) {
1515 // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
1516 $_MOD_MENU = array('displayThumbs' => '');
1517 $_MCONF['name']='file_list';
1518 $_MOD_SETTINGS = t3lib_BEfunc::getModuleData($_MOD_MENU, t3lib_div::_GP('SET'), $_MCONF['name']);
1519 $addParams = '&act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
1520 $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>';
1521 } else {
1522 $thumbNailCheck='';
1523 }
1524 $noThumbs = $noThumbs ? $noThumbs : !$_MOD_SETTINGS['displayThumbs'];
1525
1526 // Create folder tree:
1527 $foldertree = t3lib_div::makeInstance('TBE_FolderTree');
1528 $foldertree->thisScript=$this->thisScript;
1529 $foldertree->ext_noTempRecyclerDirs = ($this->mode == 'filedrag');
1530 $tree=$foldertree->getBrowsableTree();
1531
1532 list(,,$specUid) = explode('_',$this->PM);
1533
1534 if ($this->mode=='filedrag') {
1535 $files = $this->TBE_dragNDrop($foldertree->specUIDmap[$specUid],$pArr[3]);
1536 } else {
1537 $files = $this->TBE_expandFolder($foldertree->specUIDmap[$specUid],$pArr[3],$noThumbs);
1538 }
1539
1540 // Putting the parts together, side by side:
1541 $content.= '
1542
1543 <!--
1544 Wrapper table for folder tree / file list:
1545 -->
1546 <table border="0" cellpadding="0" cellspacing="0" id="typo3-EBfiles">
1547 <tr>
1548 <td class="c-wCell" valign="top">'.$this->barheader($GLOBALS['LANG']->getLL('folderTree').':').$tree.'</td>
1549 <td class="c-wCell" valign="top">'.$files.'</td>
1550 </tr>
1551 </table>
1552 ';
1553 $content.= $thumbNailCheck;
1554
1555 // Adding create folder + upload forms if applicable:
1556 if (!$BE_USER->getTSConfigVal('options.uploadFieldsInTopOfEB')) $content.=$uploadForm;
1557 if ($BE_USER->isAdmin() || $BE_USER->getTSConfigVal('options.createFoldersInEB')) $content.=$createFolder;
1558
1559 // Add some space
1560 $content.='<br /><br />';
1561
1562 // Ending page, returning content:
1563 $content.= $this->doc->endPage();
1564 $content = $this->doc->insertStylesAndJS($content);
1565 return $content;
1566 }
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586 /******************************************************************
1587 *
1588 * Record listing
1589 *
1590 ******************************************************************/
1591 /**
1592 * For RTE: This displays all content elements on a page and lets you create a link to the element.
1593 *
1594 * @return string HTML output. Returns content only if the ->expandPage value is set (pointing to a page uid to show tt_content records from ...)
1595 */
1596 function expandPage() {
1597 global $BE_USER, $BACK_PATH;
1598
1599 $out='';
1600 $expPageId = $this->expandPage; // Set page id (if any) to expand
1601
1602 // If there is an anchor value (content element reference) in the element reference, then force an ID to expand:
1603 if (!$this->expandPage && $this->curUrlInfo['cElement']) {
1604 $expPageId = $this->curUrlInfo['pageid']; // Set to the current link page id.
1605 }
1606
1607 // Draw the record list IF there is a page id to expand:
1608 if ($expPageId && t3lib_div::testInt($expPageId) && $BE_USER->isInWebMount($expPageId)) {
1609
1610 // Set header:
1611 $out.=$this->barheader($GLOBALS['LANG']->getLL('contentElements').':');
1612
1613 // Create header for listing, showing the page title/icon:
1614 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
1615 $mainPageRec = t3lib_BEfunc::getRecordWSOL('pages',$expPageId);
1616 $picon=t3lib_iconWorks::getIconImage('pages',$mainPageRec,'','');
1617 $picon.= htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'],$titleLen));
1618 $out.=$picon.'<br />';
1619
1620 // Look up tt_content elements from the expanded page:
1621 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1622 'uid,header,hidden,starttime,endtime,fe_group,CType,colpos,bodytext',
1623 'tt_content',
1624 'pid='.intval($expPageId).
1625 t3lib_BEfunc::deleteClause('tt_content').
1626 t3lib_BEfunc::versioningPlaceholderClause('tt_content'),
1627 '',
1628 'colpos,sorting'
1629 );
1630 $cc = $GLOBALS['TYPO3_DB']->sql_num_rows($res);
1631
1632 // Traverse list of records:
1633 $c=0;
1634 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1635 $c++;
1636 $icon=t3lib_iconWorks::getIconImage('tt_content',$row,$BACK_PATH,'');
1637 if ($this->curUrlInfo['act']=='page' && $this->curUrlInfo['cElement']==$row['uid']) {
1638 $arrCol='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
1639 } else {
1640 $arrCol='';
1641 }
1642 // Putting list element HTML together:
1643 $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
1644 $arrCol.
1645 '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.$row['uid'].'\');">'.
1646 $icon.
1647 htmlspecialchars(t3lib_div::fixed_lgd_cs($row['header'],$titleLen)).
1648 '</a><br />';
1649
1650 // Finding internal anchor points:
1651 if (t3lib_div::inList('text,textpic', $row['CType'])) {
1652 $split = preg_split('/(<a[^>]+name=[\'"]?([^"\'>[:space:]]+)[\'"]?[^>]*>)/i', $row['bodytext'], -1, PREG_SPLIT_DELIM_CAPTURE);
1653
1654 foreach($split as $skey => $sval) {
1655 if (($skey%3)==2) {
1656 // Putting list element HTML together:
1657 $sval = substr($sval,0,100);
1658 $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/line.gif','width="18" height="16"').' alt="" />'.
1659 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($skey+3>count($split)?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
1660 '<a href="#" onclick="return link_typo3Page(\''.$expPageId.'\',\'#'.rawurlencode($sval).'\');">'.
1661 htmlspecialchars(' <A> '.$sval).
1662 '</a><br />';
1663 }
1664 }
1665 }
1666 }
1667 }
1668 return $out;
1669 }
1670
1671 /**
1672 * For TYPO3 Element Browser: This lists all content elements from the given list of tables
1673 *
1674 * @param string Commalist of tables. Set to "*" if you want all tables.
1675 * @return string HTML output.
1676 */
1677 function TBE_expandPage($tables) {
1678 global $TCA,$BE_USER, $BACK_PATH;
1679
1680 $out='';
1681 if ($this->expandPage>=0 && t3lib_div::testInt($this->expandPage) && $BE_USER->isInWebMount($this->expandPage)) {
1682
1683 // Set array with table names to list:
1684 if (!strcmp(trim($tables),'*')) {
1685 $tablesArr = array_keys($TCA);
1686 } else {
1687 $tablesArr = t3lib_div::trimExplode(',',$tables,1);
1688 }
1689 reset($tablesArr);
1690
1691 // Headline for selecting records:
1692 $out.=$this->barheader($GLOBALS['LANG']->getLL('selectRecords').':');
1693
1694 // Create the header, showing the current page for which the listing is. Includes link to the page itself, if pages are amount allowed tables.
1695 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
1696 $mainPageRec = t3lib_BEfunc::getRecordWSOL('pages',$this->expandPage);
1697 $ATag='';
1698 $ATag_e='';
1699 $ATag2='';
1700 if (in_array('pages',$tablesArr)) {
1701 $ficon=t3lib_iconWorks::getIcon('pages',$mainPageRec);
1702 $ATag="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', ".t3lib_div::quoteJSvalue($mainPageRec['title']).", '', '', '".$ficon."','',1);\">";
1703 $ATag2="<a href=\"#\" onclick=\"return insertElement('pages', '".$mainPageRec['uid']."', 'db', ".t3lib_div::quoteJSvalue($mainPageRec['title']).", '', '', '".$ficon."','',0);\">";
1704 $ATag_alt=substr($ATag,0,-4).",'',1);\">";
1705 $ATag_e='</a>';
1706 }
1707 $picon=t3lib_iconWorks::getIconImage('pages',$mainPageRec,$BACK_PATH,'');
1708 $pBicon=$ATag2?'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' alt="" />':'';
1709 $pText=htmlspecialchars(t3lib_div::fixed_lgd_cs($mainPageRec['title'],$titleLen));
1710 $out.=$picon.$ATag2.$pBicon.$ATag_e.$ATag.$pText.$ATag_e.'<br />';
1711
1712 // Initialize the record listing:
1713 $id = $this->expandPage;
1714 $pointer = t3lib_div::intInRange($this->pointer,0,100000);
1715 $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
1716 $pageinfo = t3lib_BEfunc::readPageAccess($id,$perms_clause);
1717 $table='';
1718
1719 // Generate the record list:
1720 $dblist = t3lib_div::makeInstance('TBE_browser_recordList');
1721 $dblist->thisScript=$this->thisScript;
1722 $dblist->backPath = $GLOBALS['BACK_PATH'];
1723 $dblist->thumbs = 0;
1724 $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo);
1725 $dblist->noControlPanels=1;
1726 $dblist->clickMenuEnabled=0;
1727 $dblist->tableList=implode(',',$tablesArr);
1728
1729 $dblist->start($id,t3lib_div::_GP('table'),$pointer,
1730 t3lib_div::_GP('search_field'),
1731 t3lib_div::_GP('search_levels'),
1732 t3lib_div::_GP('showLimit')
1733 );
1734 $dblist->setDispFields();
1735 $dblist->generateList();
1736 $dblist->writeBottom();
1737
1738 // Add the HTML for the record list to output variable:
1739 $out.=$dblist->HTMLcode;
1740
1741 // Add support for fieldselectbox in singleTableMode
1742 if ($dblist->table) {
1743 $out.= $dblist->fieldSelectBox($dblist->table);
1744 }
1745
1746 $out.=$dblist->getSearchBox();
1747 }
1748
1749 // Return accumulated content:
1750 return $out;
1751 }
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764 /******************************************************************
1765 *
1766 * File listing
1767 *
1768 ******************************************************************/
1769 /**
1770 * For RTE: This displays all files from folder. No thumbnails shown
1771 *
1772 * @param string The folder path to expand
1773 * @param string List of fileextensions to show
1774 * @return string HTML output
1775 */
1776 function expandFolder($expandFolder=0,$extensionList='') {
1777 global $BACK_PATH;
1778
1779 $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
1780 $out='';
1781 if ($expandFolder && $this->checkFolder($expandFolder)) {
1782
1783 // Create header for filelisting:
1784 $out.=$this->barheader($GLOBALS['LANG']->getLL('files').':');
1785
1786 // Prepare current path value for comparison (showing red arrow)
1787 if (!$this->curUrlInfo['value']) {
1788 $cmpPath='';
1789 } else {
1790 $cmpPath=PATH_site.$this->curUrlInfo['info'];
1791 }
1792
1793
1794 // Create header element; The folder from which files are listed.
1795 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
1796 $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
1797 $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder),$titleLen));
1798 $picon='<a href="#" onclick="return link_folder(\''.t3lib_div::rawUrlEncodeFP(substr($expandFolder,strlen(PATH_site))).'\');">'.$picon.'</a>';
1799 $out.=$picon.'<br />';
1800
1801 // Get files from the folder:
1802 $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order='')
1803 $c=0;
1804 $cc=count($files);
1805
1806 if (is_array($files)) {
1807 foreach($files as $filepath) {
1808 $c++;
1809 $fI=pathinfo($filepath);
1810
1811 // File icon:
1812 $icon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
1813
1814 // If the listed file turns out to be the CURRENT file, then show blinking arrow:
1815 if ($this->curUrlInfo['act']=="file" && $cmpPath==$filepath) {
1816 $arrCol='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/blinkarrow_left.gif','width="5" height="9"').' class="c-blinkArrowL" alt="" />';
1817 } else {
1818 $arrCol='';
1819 }
1820
1821 // Get size and icon:
1822 $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes)';
1823 $icon = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/fileicons/'.$icon.'','width="18" height="16"').' title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
1824
1825 // Put it all together for the file element:
1826 $out.='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/ol/join'.($c==$cc?'bottom':'').'.gif','width="18" height="16"').' alt="" />'.
1827 $arrCol.
1828 '<a href="#" onclick="return link_folder(\''.t3lib_div::rawUrlEncodeFP(substr($filepath,strlen(PATH_site))).'\');">'.
1829 $icon.
1830 htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen)).
1831 '</a><br />';
1832 }
1833 }
1834 }
1835 return $out;
1836 }
1837
1838 /**
1839 * For TYPO3 Element Browser: Expand folder of files.
1840 *
1841 * @param string The folder path to expand
1842 * @param string List of fileextensions to show
1843 * @param boolean Whether to show thumbnails or not. If set, no thumbnails are shown.
1844 * @return string HTML output
1845 */
1846 function TBE_expandFolder($expandFolder=0,$extensionList='',$noThumbs=0) {
1847 global $LANG;
1848
1849 $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
1850 $out='';
1851 if ($expandFolder && $this->checkFolder($expandFolder)) {
1852 // Listing the files:
1853 $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order='')
1854 $out.= $this->fileList($files, $expandFolder, $noThumbs);
1855 }
1856
1857 // Return accumulated content for filelisting:
1858 return $out;
1859 }
1860
1861 /**
1862 * Render list of files.
1863 *
1864 * @param array List of files. See t3lib_div::getFilesInDir
1865 * @param string If set a header with a folder icon and folder name are shown
1866 * @param boolean Whether to show thumbnails or not. If set, no thumbnails are shown.
1867 * @return string HTML output
1868 */
1869 function fileList($files, $folderName='', $noThumbs=0) {
1870 global $LANG, $BACK_PATH;
1871
1872 $out='';
1873
1874 // Listing the files:
1875 if (is_array($files)) {
1876
1877 // Create headline (showing number of files):
1878 $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files)));
1879
1880 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
1881
1882 // Create the header of current folder:
1883 if($folderName) {
1884 $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
1885 $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($folderName),$titleLen));
1886 $out.=$picon.'<br />';
1887 }
1888
1889 // Init graphic object for reading file dimensions:
1890 $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic');
1891 $imgObj->init();
1892 $imgObj->mayScaleUp=0;
1893 $imgObj->tempPath=PATH_site.$imgObj->tempPath;
1894
1895 // Traverse the file list:
1896 $lines=array();
1897 foreach($files as $filepath) {
1898 $fI=pathinfo($filepath);
1899
1900 // Thumbnail/size generation:
1901 if (t3lib_div::inList(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),strtolower($fI['extension'])) && !$noThumbs) {
1902 $imgInfo = $imgObj->getImageDimensions($filepath);
1903 $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
1904 $clickIcon = t3lib_BEfunc::getThumbNail($BACK_PATH.'thumbs.php',$filepath,'hspace="5" vspace="5" border="1"');
1905 } else {
1906 $clickIcon = '';
1907 $pDim = '';
1908 }
1909
1910 // Create file icon:
1911 $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
1912 $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes'.($pDim?', '.$pDim:'').')';
1913 $icon = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/fileicons/'.$ficon,'width="18" height="16"').' title="'.htmlspecialchars($fI['basename'].$size).'" class="absmiddle" alt="" />';
1914
1915 // Create links for adding the file:
1916 if (strstr($filepath,',') || strstr($filepath,'|')) { // In case an invalid character is in the filepath, display error message:
1917 $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'),', |'));
1918 $ATag = $ATag_alt = "<a href=\"#\" onclick=\"alert(".$eMsg.");return false;\">";
1919 } else { // If filename is OK, just add it:
1920 $ATag = "<a href=\"#\" onclick=\"return insertElement('','".t3lib_div::shortMD5($filepath)."', 'file', ".t3lib_div::quoteJSvalue($fI['basename']).", ".t3lib_div::quoteJSvalue($filepath).", '".$fI['extension']."', '".$ficon."');\">";
1921 $ATag_alt = substr($ATag,0,-4).",'',1);\">";
1922 }
1923 $ATag_e='</a>';
1924
1925 // Create link to showing details about the file in a window:
1926 $Ahref = $BACK_PATH.'show_item.php?table='.rawurlencode($filepath).'&returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
1927 $ATag2='<a href="'.htmlspecialchars($Ahref).'">';
1928 $ATag2_e='</a>';
1929
1930 // Combine the stuff:
1931 $filenameAndIcon=$ATag_alt.$icon.htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen)).$ATag_e;
1932
1933 // Show element:
1934 if ($pDim) { // Image...
1935 $lines[]='
1936 <tr class="bgColor4">
1937 <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
1938 <td>'.$ATag.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
1939 <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>
1940 <td nowrap="nowrap">&nbsp;'.$pDim.'</td>
1941 </tr>';
1942 $lines[]='
1943 <tr>
1944 <td colspan="4">'.$ATag_alt.$clickIcon.$ATag_e.'</td>
1945 </tr>';
1946 } else {
1947 $lines[]='
1948 <tr class="bgColor4">
1949 <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
1950 <td>'.$ATag.'<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/plusbullet2.gif','width="18" height="16"').' title="'.$LANG->getLL('addToList',1).'" alt="" />'.$ATag_e.'</td>
1951 <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>
1952 <td>&nbsp;</td>
1953 </tr>';
1954 }
1955 $lines[]='
1956 <tr>
1957 <td colspan="3"><img src="clear.gif" width="1" height="3" alt="" /></td>
1958 </tr>';
1959 }
1960
1961 // Wrap all the rows in table tags:
1962 $out.='
1963
1964
1965
1966 <!--
1967 File listing
1968 -->
1969 <table border="0" cellpadding="0" cellspacing="1" id="typo3-fileList">
1970 '.implode('',$lines).'
1971 </table>';
1972 }
1973
1974 // Return accumulated content for filelisting:
1975 return $out;
1976 }
1977
1978 /**
1979 * For RTE: This displays all IMAGES (gif,png,jpg) (from extensionList) from folder. Thumbnails are shown for images.
1980 * This listing is of images located in the web-accessible paths ONLY - the listing is for drag-n-drop use in the RTE
1981 *
1982 * @param string The folder path to expand
1983 * @param string List of fileextensions to show
1984 * @return string HTML output
1985 */
1986 function TBE_dragNDrop($expandFolder=0,$extensionList='') {
1987 global $BACK_PATH;
1988
1989 $expandFolder = $expandFolder ? $expandFolder : $this->expandFolder;
1990 $out='';
1991 if ($expandFolder && $this->checkFolder($expandFolder)) {
1992 if ($this->isWebFolder($expandFolder)) {
1993
1994 // Read files from directory:
1995 $files = t3lib_div::getFilesInDir($expandFolder,$extensionList,1,1); // $extensionList="",$prependPath=0,$order='')
1996 if (is_array($files)) {
1997 $out.=$this->barheader(sprintf($GLOBALS['LANG']->getLL('files').' (%s):',count($files)));
1998
1999 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
2000 $picon='<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/i/_icon_webfolders.gif','width="18" height="16"').' alt="" />';
2001 $picon.=htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($expandFolder),$titleLen));
2002 $out.=$picon.'<br />';
2003
2004 // Init row-array:
2005 $lines=array();
2006
2007 // Add "drag-n-drop" message:
2008 $lines[]='
2009 <tr>
2010 <td colspan="2">'.$this->getMsgBox($GLOBALS['LANG']->getLL('findDragDrop')).'</td>
2011 </tr>';
2012
2013 // Fraverse files:
2014 while(list(,$filepath)=each($files)) {
2015 $fI=pathinfo($filepath);
2016
2017 // URL of image:
2018 $iurl = $this->siteURL.t3lib_div::rawurlencodeFP(substr($filepath,strlen(PATH_site)));
2019
2020 // Show only web-images
2021 if (t3lib_div::inList('gif,jpeg,jpg,png',$fI['extension'])) {
2022 $imgInfo = @getimagesize($filepath);
2023 $pDim = $imgInfo[0].'x'.$imgInfo[1].' pixels';
2024
2025 $ficon = t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
2026 $size=' ('.t3lib_div::formatSize(filesize($filepath)).'bytes'.($pDim?', '.$pDim:'').')';
2027 $icon = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/fileicons/'.$ficon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
2028 $filenameAndIcon=$icon.htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($filepath),$titleLen));
2029
2030 if (t3lib_div::_GP('noLimit')) {
2031 $maxW=10000;
2032 $maxH=10000;
2033 } else {
2034 $maxW=380;
2035 $maxH=500;
2036 }
2037 $IW = $imgInfo[0];
2038 $IH = $imgInfo[1];
2039 if ($IW>$maxW) {
2040 $IH=ceil($IH/$IW*$maxW);
2041 $IW=$maxW;
2042 }
2043 if ($IH>$maxH) {
2044 $IW=ceil($IW/$IH*$maxH);
2045 $IH=$maxH;
2046 }
2047
2048 // Make row:
2049 $lines[]='
2050 <tr class="bgColor4">
2051 <td nowrap="nowrap">'.$filenameAndIcon.'&nbsp;</td>
2052 <td nowrap="nowrap">'.
2053 ($imgInfo[0]!=$IW ? '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('noLimit'=>'1'))).'">'.
2054 '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/icon_warning2.gif','width="18" height="16"').' title="'.$GLOBALS['LANG']->getLL('clickToRedrawFullSize',1).'" alt="" />'.
2055 '</a>':'').
2056 $pDim.'&nbsp;</td>
2057 </tr>';
2058
2059 $lines[]='
2060 <tr>
2061 <td colspan="2"><img src="'.$iurl.'" width="'.$IW.'" height="'.$IH.'" border="1" alt="" /></td>
2062 </tr>';
2063 $lines[]='
2064 <tr>
2065 <td colspan="2"><img src="clear.gif" width="1" height="3" alt="" /></td>
2066 </tr>';
2067 }
2068 }
2069
2070 // Finally, wrap all rows in a table tag:
2071 $out.='
2072
2073
2074 <!--
2075 File listing / Drag-n-drop
2076 -->
2077 <table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
2078 '.implode('',$lines).'
2079 </table>';
2080 }
2081 } else {
2082 // Print this warning if the folder is NOT a web folder:
2083 $out.=$this->barheader($GLOBALS['LANG']->getLL('files'));
2084 $out.=$this->getMsgBox($GLOBALS['LANG']->getLL('noWebFolder'),'icon_warning2');
2085 }
2086 }
2087 return $out;
2088 }
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101 /******************************************************************
2102 *
2103 * Miscellaneous functions
2104 *
2105 ******************************************************************/
2106
2107
2108 /**
2109 * Verifies that a path is a web-folder:
2110 *
2111 * @param string Absolute filepath
2112 * @return boolean If the input path is found in PATH_site then it returns true.
2113 */
2114 function isWebFolder($folder) {
2115 $folder = ereg_replace('\/$','',$folder).'/';
2116 return t3lib_div::isFirstPartOfStr($folder,PATH_site) ? TRUE : FALSE;
2117 }
2118
2119 /**
2120 * Checks, if a path is within the mountpoints of the backend user
2121 *
2122 * @param string Absolute filepath
2123 * @return boolean If the input path is found in the backend users filemounts, then return true.
2124 */
2125 function checkFolder($folder) {
2126 $fileProcessor = t3lib_div::makeInstance('t3lib_basicFileFunctions');
2127 $fileProcessor->init($GLOBALS['FILEMOUNTS'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']);
2128
2129 return $fileProcessor->checkPathAgainstMounts(ereg_replace('\/$','',$folder).'/') ? TRUE : FALSE;
2130 }
2131
2132 /**
2133 * Prints a 'header' where string is in a tablecell
2134 *
2135 * @param string The string to print in the header. The value is htmlspecialchars()'ed before output.
2136 * @return string The header HTML (wrapped in a table)
2137 */
2138 function barheader($str) {
2139 return '
2140
2141 <!--
2142 Bar header:
2143 -->
2144 <h3 class="bgColor5">'.htmlspecialchars($str).'</h3>
2145 ';
2146 }
2147
2148 /**
2149 * Displays a message box with the input message
2150 *
2151 * @param string Input message to show (will be htmlspecialchars()'ed inside of this function)
2152 * @param string Icon filename body from gfx/ (default is "icon_note") - meant to allow change to warning type icons...
2153 * @return string HTML for the message (wrapped in a table).
2154 */
2155 function getMsgBox($in_msg,$icon='icon_note') {
2156 global $BACK_PATH;
2157
2158 $msg = '<img'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/'.$icon.'.gif','width="18" height="16"').' alt="" />'.htmlspecialchars($in_msg);
2159 $msg = '
2160
2161 <!--
2162 Message box:
2163 -->
2164 <table cellspacing="0" class="bgColor4" id="typo3-msgBox">
2165 <tr>
2166 <td>'.$msg.'</td>
2167 </tr>
2168 </table>
2169 ';
2170 return $msg;
2171 }
2172
2173 /**
2174 * For RTE/link: This prints the 'currentUrl'
2175 *
2176 * @param string URL value. The value is htmlspecialchars()'ed before output.
2177 * @return string HTML content, wrapped in a table.
2178 */
2179 function printCurrentUrl($str) {
2180 return '
2181
2182 <!--
2183 Print current URL
2184 -->
2185 <table border="0" cellpadding="0" cellspacing="0" class="bgColor5" id="typo3-curUrl">
2186 <tr>
2187 <td>'.$GLOBALS['LANG']->getLL('currentLink',1).': '.htmlspecialchars(rawurldecode($str)).'</td>
2188 </tr>
2189 </table>';
2190 }
2191
2192 /**
2193 * For RTE/link: Parses the incoming URL and determines if it's a page, file, external or mail address.
2194 *
2195 * @param string HREF value tp analyse
2196 * @param string The URL of the current website (frontend)
2197 * @return array Array with URL information stored in assoc. keys: value, act (page, file, spec, mail), pageid, cElement, info
2198 */
2199 function parseCurUrl($href,$siteUrl) {
2200 $href = trim($href);
2201 if ($href) {
2202 $info=array();
2203
2204 // Default is "url":
2205 $info['value']=$href;
2206 $info['act']='url';
2207
2208 $specialParts = explode('#_SPECIAL',$href);
2209 if (count($specialParts)==2) { // Special kind (Something RTE specific: User configurable links through: "userLinks." from ->thisConfig)
2210 $info['value']='#_SPECIAL'.$specialParts[1];
2211 $info['act']='spec';
2212 } elseif (t3lib_div::isFirstPartOfStr($href,$siteUrl)) { // If URL is on the current frontend website:
2213 $rel = substr($href,strlen($siteUrl));
2214 if (@file_exists(PATH_site.rawurldecode($rel))) { // URL is a file, which exists:
2215 $info['value']=rawurldecode($rel);
2216 $info['act']='file';
2217 } else { // URL is a page (id parameter)
2218 $uP=parse_url($rel);
2219 if (!trim($uP['path'])) {
2220 $pp = explode('id=',$uP['query']);
2221 $id = $pp[1];
2222 if ($id) {
2223 // Checking if the id-parameter is an alias.
2224 if (!t3lib_div::testInt($id)) {
2225 list($idPartR) = t3lib_BEfunc::getRecordsByField('pages','alias',$id);
2226 $id=intval($idPartR['uid']);
2227 }
2228
2229 $pageRow = t3lib_BEfunc::getRecordWSOL('pages',$id);
2230 $titleLen=intval($GLOBALS['BE_USER']->uc['titleLen']);
2231 $info['value']=$GLOBALS['LANG']->getLL('page',1)." '".htmlspecialchars(t3lib_div::fixed_lgd_cs($pageRow['title'],$titleLen))."' (ID:".$id.($uP['fragment']?', #'.$uP['fragment']:'').')';
2232 $info['pageid']=$id;
2233 $info['cElement']=$uP['fragment'];
2234 $info['act']='page';
2235 }
2236 }
2237 }
2238 } else { // Email link:
2239 if (strtolower(substr($href,0,7))=='mailto:') {
2240 $info['value']=trim(substr($href,7));
2241 $info['act']='mail';
2242 }
2243 }
2244 $info['info'] = $info['value'];
2245 } else { // NO value inputted:
2246 $info=array();
2247 $info['info']=$GLOBALS['LANG']->getLL('none');
2248 $info['value']='';
2249 $info['act']='page';
2250 }
2251 return $info;
2252 }
2253
2254 /**
2255 * For TBE: Makes an upload form for uploading files to the filemount the user is browsing.
2256 * The files are uploaded to the tce_file.php script in the core which will handle the upload.
2257 *
2258 * @param string Absolute filepath on server to which to upload.
2259 * @return string HTML for an upload form.
2260 */
2261 function uploadForm($path) {
2262 global $BACK_PATH;
2263 $count=3;
2264
2265 // Create header, showing upload path:
2266 $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
2267 $code=$this->barheader($GLOBALS['LANG']->getLL('uploadImage').':');
2268 $code.='
2269
2270 <!--
2271 Form, for uploading files:
2272 -->
2273 <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform" enctype="'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'].'">
2274 <table border="0" cellpadding="0" cellspacing="3" id="typo3-uplFiles">
2275 <tr>
2276 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
2277 </tr>
2278 <tr>
2279 <td>';
2280
2281 // Traverse the number of upload fields (default is 3):
2282 for ($a=1;$a<=$count;$a++) {
2283 $code.='<input type="file" name="upload_'.$a.'"'.$this->doc->formWidth(35).' size="50" />
2284 <input type="hidden" name="file[upload]['.$a.'][target]" value="'.htmlspecialchars($path).'" />
2285 <input type="hidden" name="file[upload]['.$a.'][data]" value="'.$a.'" /><br />';
2286 }
2287
2288 // Make footer of upload form, including the submit button:
2289 $redirectValue = $this->thisScript.'?act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
2290 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
2291 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_upload.php.submit',1).'" />';
2292
2293 $code.='
2294 <div id="c-override">
2295 <input type="checkbox" name="overwriteExistingFiles" id="overwriteExistingFiles" value="1" /> <label for="overwriteExistingFiles">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:overwriteExistingFiles',1).'</label>
2296 </div>
2297 ';
2298
2299
2300 $code.='</td>
2301 </tr>
2302 </table>
2303 </form>';
2304
2305 return $code;
2306 }
2307
2308 /**
2309 * For TBE: Makes a form for creating new folders in the filemount the user is browsing.
2310 * The folder creation request is sent to the tce_file.php script in the core which will handle the creation.
2311 *
2312 * @param string Absolute filepath on server in which to create the new folder.
2313 * @return string HTML for the create folder form.
2314 */
2315 function createFolder($path) {
2316 global $BACK_PATH;
2317 // Create header, showing upload path:
2318 $header = t3lib_div::isFirstPartOfStr($path,PATH_site)?substr($path,strlen(PATH_site)):$path;
2319 $code=$this->barheader($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.pagetitle').':');
2320 $code.='
2321
2322 <!--
2323 Form, for creating new folders:
2324 -->
2325 <form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform2">
2326 <table border="0" cellpadding="0" cellspacing="3" id="typo3-crFolder">
2327 <tr>
2328 <td><strong>'.$GLOBALS['LANG']->getLL('path',1).':</strong> '.htmlspecialchars($header).'</td>
2329 </tr>
2330 <tr>
2331 <td>';
2332
2333 // Create the new-folder name field:
2334 $a=1;
2335 $code.='<input'.$this->doc->formWidth(20).' type="text" name="file[newfolder]['.$a.'][data]" />'.
2336 '<input type="hidden" name="file[newfolder]['.$a.'][target]" value="'.htmlspecialchars($path).'" />';
2337
2338 // Make footer of upload form, including the submit button:
2339 $redirectValue = $this->thisScript.'?act='.$this->act.'&mode='.$this->mode.'&expandFolder='.rawurlencode($path).'&bparams='.rawurlencode($this->bparams);
2340 $code.='<input type="hidden" name="redirect" value="'.htmlspecialchars($redirectValue).'" />'.
2341 '<input type="submit" name="submit" value="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:file_newfolder.php.submit',1).'" />';
2342
2343 $code.='</td>
2344 </tr>
2345 </table>
2346 </form>';
2347
2348 return $code;
2349 }
2350 }
2351
2352 // Include extension?
2353 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.browse_links.php']) {
2354 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.browse_links.php']);
2355 }
2356
2357
2358 ?>