[BUGFIX] Pootle: Multi-line labels are not rendered properly
[Packages/TYPO3.CMS.git] / typo3 / alt_clickmenu.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2011 Kasper Skårhøj (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 * Context menu
29 *
30 * The script is called in the top frame of the backend typically by a click on an icon for which a context menu should appear.
31 * Either this script displays the context menu horizontally in the top frame or alternatively (default in MSIE, Mozilla) it writes the output to a <div>-layer in the calling document (which then appears as a layer/context sensitive menu)
32 * Writing content back into a <div>-layer is necessary if we want individualized context menus with any specific content for any specific element.
33 * Context menus can appear for either database elements or files
34 * The input to this script is basically the "&init" var which is divided by "|" - each part is a reference to table|uid|listframe-flag.
35 *
36 * If you want to integrate a context menu in your scripts, please see template::getContextMenuCode()
37 *
38 * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj
39 * XHTML compliant
40 *
41 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
42 */
43
44
45 require ('init.php');
46 require ('template.php');
47 $LANG->includeLLFile('EXT:lang/locallang_misc.xml');
48
49
50
51
52 /**
53 * Class for generating the click menu
54 *
55 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
56 * @package TYPO3
57 * @subpackage core
58 * @internal
59 */
60 class clickMenu {
61
62 // Internal, static: GPvar:
63 var $cmLevel=0; // Defines if the click menu is first level or second. Second means the click menu is triggered from another menu.
64 var $CB; // Clipboard array (submitted by eg. pressing the paste button)
65
66 // Internal, static:
67 var $backPath=''; // Backpath for scripts/images.
68 var $PH_backPath='###BACK_PATH###'; // BackPath place holder: We need different backPath set whether the clickmenu is written back to a frame which is not in typo3/ dir or if the clickmenu is shown in the top frame (no backpath)
69 var $listFrame=0; // If set, the calling document should be in the listframe of a frameset.
70 var $isDBmenu=0; // If set, the menu is about database records, not files. (set if part 2 [1] of the item-var is NOT blank)
71 var $alwaysContentFrame=0; // If TRUE, the "content" frame is always used for reference (when condensed mode is enabled)
72 var $iParts=array(); // Stores the parts of the input $item string, splitted by "|": [0] = table/file, [1] = uid/blank, [2] = flag: If set, listFrame, If "2" then "content frame" is forced [3] = ("+" prefix = disable all by default, enable these. Default is to disable) Items key list
73 var $disabledItems=array(); // Contains list of keywords of items to disable in the menu
74 var $dontDisplayTopFrameCM=0; // If TRUE, the context sensitive menu will not appear in the top frame, only as a layer.
75 var $leftIcons=0; // If TRUE, Show icons on the left.
76 var $extClassArray=array(); // Array of classes to be used for user processing of the menu content. This is for the API of adding items to the menu from outside.
77 var $ajax=0; // enable/disable ajax behavior
78
79 // Internal, dynamic:
80 var $elCount=0; // Counter for elements in the menu. Used to number the name / id of the mouse-over icon.
81 var $editPageIconSet=0; // Set, when edit icon is drawn.
82 var $editOK=0; // Set to TRUE, if editing of the element is OK.
83 var $rec=array();
84
85
86
87 /**
88 * Initialize click menu
89 *
90 * @return string The clickmenu HTML content
91 */
92 function init() {
93 // Setting GPvars:
94 $this->cmLevel = intval(t3lib_div::_GP('cmLevel'));
95 $this->CB = t3lib_div::_GP('CB');
96 if(t3lib_div::_GP('ajax')) {
97 $this->ajax = 1;
98 // XML has to be parsed, no parse errors allowed
99 @ini_set('display_errors', 0);
100 }
101
102 // Deal with Drag&Drop context menus
103 if (strcmp(t3lib_div::_GP('dragDrop'),'')) {
104 $CMcontent = $this->printDragDropClickMenu(t3lib_div::_GP('dragDrop'),t3lib_div::_GP('srcId'),t3lib_div::_GP('dstId'));
105 return $CMcontent;
106 }
107
108 // can be set differently as well
109 $this->iParts[0] = t3lib_div::_GP('table');
110 $this->iParts[1] = t3lib_div::_GP('uid');
111 $this->iParts[2] = t3lib_div::_GP('listFr');
112 $this->iParts[3] = t3lib_div::_GP('enDisItems');
113
114 // Setting flags:
115 if ($this->iParts[2]) $this->listFrame=1;
116 if ($GLOBALS['BE_USER']->uc['condensedMode'] || $this->iParts[2]==2) $this->alwaysContentFrame=1;
117 if (strcmp($this->iParts[1],'')) $this->isDBmenu=1;
118
119 $TSkey =($this->isDBmenu?'page':'folder').($this->listFrame?'List':'Tree');
120 $this->disabledItems = t3lib_div::trimExplode(',',$GLOBALS['BE_USER']->getTSConfigVal('options.contextMenu.'.$TSkey.'.disableItems'),1);
121 $this->leftIcons = $GLOBALS['BE_USER']->getTSConfigVal('options.contextMenu.options.leftIcons');
122
123 // &cmLevel flag detected (2nd level menu)
124 if (!$this->cmLevel) {
125 // Make 1st level clickmenu:
126 if ($this->isDBmenu) {
127 $CMcontent = $this->printDBClickMenu($this->iParts[0],$this->iParts[1]);
128 } else {
129 $CMcontent = $this->printFileClickMenu($this->iParts[0]);
130 }
131 } else {
132 // Make 2nd level clickmenu (only for DBmenus)
133 if ($this->isDBmenu) {
134 $CMcontent = $this->printNewDBLevel($this->iParts[0],$this->iParts[1]);
135 }
136 }
137
138 // Return clickmenu content:
139 return $CMcontent;
140 }
141
142 /**
143 * Returns TRUE if the menu should (also?) be displayed in topframe, not just <div>-layers
144 *
145 * @return boolean
146 */
147 function doDisplayTopFrameCM() {
148 if($this->ajax) {
149 return FALSE;
150 } else {
151 return !$GLOBALS['SOBE']->doc->isCMlayers() || !$this->dontDisplayTopFrameCM;
152 }
153 }
154
155
156
157
158
159
160
161
162
163
164
165
166 /***************************************
167 *
168 * DATABASE
169 *
170 ***************************************/
171
172 /**
173 * Make 1st level clickmenu:
174 *
175 * @param string Table name
176 * @param integer UID for the current record.
177 * @return string HTML content
178 */
179 function printDBClickMenu($table,$uid) {
180
181 // Get record:
182 $this->rec = t3lib_BEfunc::getRecordWSOL($table,$uid);
183 $menuItems=array();
184
185 $root=0;
186 $DBmount = FALSE;
187 if ($table=='pages' && !strcmp($uid,'0')) { // Rootlevel
188 $root=1;
189 }
190
191 if ($table=='pages' && in_array($uid,$GLOBALS['BE_USER']->returnWebmounts())) { // DB mount
192 $DBmount = TRUE;
193 }
194 // used to hide cut,copy icons for l10n-records
195 $l10nOverlay = FALSE;
196 // should only be performed for overlay-records within the same table
197 if (t3lib_BEfunc::isTableLocalizable($table) && !isset($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'])) {
198 $l10nOverlay = intval($this->rec[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']]) != 0;
199 }
200
201 // If record found (or root), go ahead and fill the $menuItems array which will contain data for the elements to render.
202 if (is_array($this->rec) || $root) {
203
204 // Get permissions
205 $lCP = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',($table=='pages'?$this->rec['uid']:$this->rec['pid'])));
206
207 // View
208 if (!in_array('view',$this->disabledItems)) {
209 if ($table=='pages') $menuItems['view']=$this->DB_view($uid);
210 if ($table==$GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']) {
211 $ws_rec = t3lib_BEfunc::getRecordWSOL($table, $this->rec['uid']);
212 $menuItems['view']=$this->DB_view($ws_rec['pid']);
213 }
214 }
215
216 // Edit:
217 if(!$root && ($GLOBALS['BE_USER']->isPSet($lCP, $table, 'edit') || $GLOBALS['BE_USER']->isPSet($lCP, $table, 'editcontent'))) {
218 if (!in_array('edit',$this->disabledItems)) $menuItems['edit']=$this->DB_edit($table,$uid);
219 $this->editOK=1;
220 }
221
222 // New:
223 if (!in_array('new',$this->disabledItems) && $GLOBALS['BE_USER']->isPSet($lCP,$table,'new')) {
224 $menuItems['new'] = $this->DB_new($table, $uid);
225 }
226
227 // Info:
228 if(!in_array('info',$this->disabledItems) && !$root) $menuItems['info']=$this->DB_info($table,$uid);
229
230 $menuItems['spacer1']='spacer';
231
232 // Copy:
233 if (!in_array('copy', $this->disabledItems) && !$root && !$DBmount && !$l10nOverlay) $menuItems['copy'] = $this->DB_copycut($table, $uid, 'copy');
234 // Cut:
235 if (!in_array('cut', $this->disabledItems) && !$root && !$DBmount && !$l10nOverlay) $menuItems['cut'] = $this->DB_copycut($table, $uid, 'cut');
236
237 // Paste:
238 $elFromAllTables = count($this->clipObj->elFromTable(''));
239 if (!in_array('paste',$this->disabledItems) && $elFromAllTables) {
240 $selItem = $this->clipObj->getSelectedRecord();
241 $elInfo=array(
242 t3lib_div::fixed_lgd_cs($selItem['_RECORD_TITLE'],
243 $GLOBALS['BE_USER']->uc['titleLen']),
244 ($root
245 ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']
246 : t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table,$this->rec), $GLOBALS['BE_USER']->uc['titleLen'])
247 ),
248 $this->clipObj->currentMode()
249 );
250 if ($table=='pages' && ($lCP & 8)) {
251 if ($elFromAllTables) $menuItems['pasteinto']=$this->DB_paste('',$uid,'into',$elInfo);
252 }
253
254 $elFromTable = count($this->clipObj->elFromTable($table));
255 if (!$root && !$DBmount && $elFromTable && $GLOBALS['TCA'][$table]['ctrl']['sortby']) $menuItems['pasteafter']=$this->DB_paste($table,-$uid,'after',$elInfo);
256 }
257
258 // Delete:
259 $elInfo=array(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table,$this->rec), $GLOBALS['BE_USER']->uc['titleLen']));
260 if(!in_array('delete', $this->disabledItems) && !$root && !$DBmount && $GLOBALS['BE_USER']->isPSet($lCP, $table, 'delete')) {
261 $menuItems['spacer2']='spacer';
262 $menuItems['delete']=$this->DB_delete($table,$uid,$elInfo);
263 }
264
265 if(!in_array('history',$this->disabledItems)) {
266 $menuItems['history']=$this->DB_history($table,$uid,$elInfo);
267 }
268 }
269
270 // Adding external elements to the menuItems array
271 $menuItems = $this->processingByExtClassArray($menuItems,$table,$uid);
272
273 // Processing by external functions?
274 $menuItems = $this->externalProcessingOfDBMenuItems($menuItems);
275
276 if (!is_array($this->rec)) {
277 $this->rec = array();
278 }
279
280 // Return the printed elements:
281 return $this->printItems($menuItems,
282 $root?
283 t3lib_iconWorks::getSpriteIcon('apps-pagetree-root') . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) :
284 t3lib_iconWorks::getSpriteIconForRecord($table, $this->rec, array('title'=> htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($this->rec, $table)))) . t3lib_BEfunc::getRecordTitle($table, $this->rec, TRUE)
285 );
286 }
287
288 /**
289 * Make 2nd level clickmenu (only for DBmenus)
290 *
291 * @param string Table name
292 * @param integer UID for the current record.
293 * @return string HTML content
294 */
295 function printNewDBLevel($table,$uid) {
296
297 // Setting internal record to the table/uid :
298 $this->rec = t3lib_BEfunc::getRecordWSOL($table,$uid);
299 $menuItems=array();
300 $root=0;
301 if ($table=='pages' && !strcmp($uid,'0')) { // Rootlevel
302 $root=1;
303 }
304
305 // If record was found, check permissions and get menu items.
306 if (is_array($this->rec) || $root) {
307 $lCP = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord(
308 'pages',
309 ($table=='pages' ? $this->rec['uid'] : $this->rec['pid']))
310 );
311 // Edit:
312 if (!$root && ($GLOBALS['BE_USER']->isPSet($lCP, $table, 'edit') || $GLOBALS['BE_USER']->isPSet($lCP, $table, 'editcontent'))) {
313 $this->editOK=1;
314 }
315
316 $menuItems = $this->processingByExtClassArray($menuItems,$table,$uid);
317 }
318
319 // Return the printed elements:
320 if (!is_array($menuItems)) $menuItems=array();
321 return $this->printItems($menuItems,
322 $root?
323 t3lib_iconWorks::getSpriteIcon('apps-pagetree-root') . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']):
324 t3lib_iconWorks::getSpriteIconForRecord($table, $this->rec,
325 array('title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($this->rec, $table)))) .
326 t3lib_BEfunc::getRecordTitle($table, $this->rec, TRUE)
327 );
328 }
329
330 /**
331 * Processing the $menuItems array (for extension classes) (DATABASE RECORDS)
332 *
333 * @param array $menuItems array for manipulation.
334 * @return array Processed $menuItems array
335 */
336 function externalProcessingOfDBMenuItems($menuItems) {
337 return $menuItems;
338 }
339
340 /**
341 * Processing the $menuItems array by external classes (typ. adding items)
342 *
343 * @param array $menuItems array for manipulation.
344 * @param string Table name
345 * @param integer UID for the current record.
346 * @return array Processed $menuItems array
347 */
348 function processingByExtClassArray($menuItems,$table,$uid) {
349 if (is_array($this->extClassArray)) {
350 foreach ($this->extClassArray as $conf) {
351 $obj=t3lib_div::makeInstance($conf['name']);
352 $menuItems = $obj->main($this,$menuItems,$table,$uid);
353 }
354 }
355 return $menuItems;
356 }
357
358 /**
359 * Returning JavaScript for the onClick event linking to the input URL.
360 *
361 * @param string The URL relative to TYPO3_mainDir
362 * @param string The return_url-parameter
363 * @param boolean If set, the "hideCM()" will be called
364 * @param string If set, gives alternative location to load in (for example top frame or somewhere else)
365 * @return string JavaScript for an onClick event.
366 */
367 function urlRefForCM($url,$retUrl='',$hideCM=1,$overrideLoc='') {
368 $loc = 'top.content.list_frame';
369 $editOnClick= ($overrideLoc ? 'var docRef='.$overrideLoc : 'var docRef=(top.content.list_frame)?top.content.list_frame:'.$loc).'; docRef.location.href=top.TS.PATH_typo3+\''.$url.'\''.
370 ($retUrl ? "+'&" . $retUrl . "='+top.rawurlencode(" . $this->frameLocation('docRef.document') . '.pathname+' . $this->frameLocation('docRef.document') . '.search)' : '') . ';' .
371 ($hideCM ? 'return hideCM();' : '');
372 return $editOnClick;
373 }
374
375 /**
376 * Adding CM element for Clipboard "copy" and "cut"
377 *
378 * @param string Table name
379 * @param integer UID for the current record.
380 * @param string Type: "copy" or "cut"
381 * @return array Item array, element in $menuItems
382 * @internal
383 */
384 function DB_copycut($table,$uid,$type) {
385 if ($this->clipObj->current=='normal') {
386 $isSel = $this->clipObj->isSelected($table,$uid);
387 }
388
389 $addParam = array();
390 if ($this->listFrame) {
391 $addParam['reloadListFrame'] = ($this->alwaysContentFrame ? 2 : 1);
392 }
393
394 return $this->linkItem(
395 $this->label($type),
396 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-edit-' . $type . ($isSel === $type ? '-release' : ''))),
397 "top.loadTopMenu('" . $this->clipObj->selUrlDB($table, $uid, ($type == 'copy' ? 1: 0), ($isSel==$type), $addParam) . "');return false;"
398 );
399 }
400
401 /**
402 * Adding CM element for Clipboard "paste into"/"paste after"
403 * NOTICE: $table and $uid should follow the special syntax for paste, see clipboard-class :: pasteUrl();
404 *
405 * @param string Table name
406 * @param integer UID for the current record. NOTICE: Special syntax!
407 * @param string Type: "into" or "after"
408 * @param array Contains instructions about whether to copy or cut an element.
409 * @return array Item array, element in $menuItems
410 * @see t3lib_clipboard::pasteUrl()
411 * @internal
412 */
413 function DB_paste($table,$uid,$type,$elInfo) {
414 $editOnClick = '';
415 $loc = 'top.content.list_frame';
416 if($GLOBALS['BE_USER']->jsConfirmation(2)) {
417 $conf = $loc.' && confirm('.$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.'.($elInfo[2]=='copy'?'copy':'move').'_'.$type),$elInfo[0],$elInfo[1])).')';
418 } else {
419 $conf = $loc;
420 }
421 $editOnClick = 'if(' . $conf . '){' . $loc . '.location.href=top.TS.PATH_typo3+\'' . $this->clipObj->pasteUrl($table, $uid, 0) . '&redirect=\'+top.rawurlencode(' . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . '.search); hideCM();}';
422
423 return $this->linkItem(
424 $this->label('paste'.$type),
425 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-paste-' . $type)),
426 $editOnClick.'return false;'
427 );
428 }
429
430 /**
431 * Adding CM element for Info
432 *
433 * @param string Table name
434 * @param integer UID for the current record.
435 * @return array Item array, element in $menuItems
436 * @internal
437 */
438 function DB_info($table,$uid) {
439 return $this->linkItem(
440 $this->label('info'),
441 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-info')),
442 "top.launchView('".$table."', '".$uid."'); return hideCM();"
443 );
444 }
445
446 /**
447 * Adding CM element for History
448 *
449 * @param string Table name
450 * @param integer UID for the current record.
451 * @return array Item array, element in $menuItems
452 * @internal
453 */
454 function DB_history($table,$uid) {
455 $url = 'show_rechis.php?element='.rawurlencode($table.':'.$uid);
456 return $this->linkItem(
457 $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_history')),
458 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-history-open')),
459 $this->urlRefForCM($url,'returnUrl'),
460 0
461 );
462 }
463
464 /**
465 * Adding CM element for Permission setting
466 *
467 * @param string Table name
468 * @param integer UID for the current record.
469 * @param array The "pages" record with "perms_*" fields inside.
470 * @return array Item array, element in $menuItems
471 * @internal
472 */
473 function DB_perms($table,$uid,$rec) {
474 if (!t3lib_extMgm::isLoaded('perm')) {
475 return '';
476 }
477 $url = t3lib_extMgm::extRelPath('perm') . 'mod1/index.php?id=' . $uid . ($rec['perms_userid'] == $GLOBALS['BE_USER']->user['uid'] || $GLOBALS['BE_USER']->isAdmin() ? '&return_id=' . $uid . '&edit=1' : '');
478 return $this->linkItem(
479 $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_perms')),
480 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('status-status-locked')),
481 $this->urlRefForCM($url),
482 0
483 );
484 }
485
486 /**
487 * Adding CM element for DBlist
488 *
489 * @param string Table name
490 * @param integer UID for the current record.
491 * @param array Record of the element (needs "pid" field if not pages-record)
492 * @return array Item array, element in $menuItems
493 * @internal
494 */
495 function DB_db_list($table,$uid,$rec) {
496 $urlParams = array();
497 $urlParams['id'] = ($table == 'pages') ? $uid : $rec['pid'];
498 $urlParams['table'] = $table == 'pages' ? '' : $table;
499 $url = t3lib_BEfunc::getModuleUrl('web_list', $urlParams, '', TRUE);
500 return $this->linkItem(
501 $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_db_list')),
502 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-system-list-open')),
503 "top.nextLoadModuleUrl='".$url."';top.goToModule('web_list',1);",
504 0
505 );
506 }
507
508 /**
509 * Adding CM element for Moving wizard
510 *
511 * @param string Table name
512 * @param integer UID for the current record.
513 * @param array Record. Needed for tt-content elements which will have the sys_language_uid sent
514 * @return array Item array, element in $menuItems
515 * @internal
516 */
517 function DB_moveWizard($table,$uid,$rec) {
518 $url = 'move_el.php?table=' . $table . '&uid=' . $uid .
519 ($table=='tt_content' ? '&sys_language_uid=' . intval($rec['sys_language_uid']) : ''); // Hardcoded field for tt_content elements.
520
521 return $this->linkItem(
522 $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_moveWizard' . ($table=='pages' ? '_page' : ''))),
523 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-' . ($table === 'pages' ? 'page' : 'document' ) . '-move')),
524 $this->urlRefForCM($url,'returnUrl'),
525 0
526 );
527 }
528
529 /**
530 * Adding CM element for Create new wizard (either db_new.php or sysext/cms/layout/db_new_content_el.php or custom wizard)
531 *
532 * @param string Table name
533 * @param integer UID for the current record.
534 * @param array Record.
535 * @return array Item array, element in $menuItems
536 * @internal
537 */
538 function DB_newWizard($table,$uid,$rec) {
539 // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
540 $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
541 $tmpTSc = $tmpTSc['properties']['newContentWiz.']['overrideWithExtension'];
542 $newContentWizScriptPath = t3lib_extMgm::isLoaded($tmpTSc) ? (t3lib_extMgm::extRelPath($tmpTSc).'mod1/db_new_content_el.php') : 'sysext/cms/layout/db_new_content_el.php';
543
544 $url = ($table=='pages' || !t3lib_extMgm::isLoaded('cms')) ? 'db_new.php?id='.$uid.'&pagesOnly=1' : $newContentWizScriptPath.'?id='.$rec['pid'].'&sys_language_uid='.intval($rec['sys_language_uid']);
545 return $this->linkItem(
546 $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_newWizard')),
547 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-' . ($table === 'pages' ? 'page' : 'document' ) . '-new')),
548 $this->urlRefForCM($url,'returnUrl'),
549 0
550 );
551 }
552
553 /**
554 * Adding CM element for Editing of the access related fields of a table (disable, starttime, endtime, fe_groups)
555 *
556 * @param string Table name
557 * @param integer UID for the current record.
558 * @return array Item array, element in $menuItems
559 * @internal
560 */
561 function DB_editAccess($table,$uid) {
562 $addParam='&columnsOnly='.rawurlencode(implode(',',$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']).($table=='pages' ? ',extendToSubpages' :''));
563 $url = 'alt_doc.php?edit['.$table.']['.$uid.']=edit'.$addParam;
564 return $this->linkItem(
565 $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_editAccess')),
566 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-edit-access')),
567 $this->urlRefForCM($url,'returnUrl'),
568 1 // no top frame CM!
569 );
570 }
571
572 /**
573 * Adding CM element for edit page properties
574 *
575 * @param integer page uid to edit (PID)
576 * @return array Item array, element in $menuItems
577 * @internal
578 */
579 function DB_editPageProperties($uid) {
580 $url = 'alt_doc.php?edit[pages]['.$uid.']=edit';
581 return $this->linkItem(
582 $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_editPageProperties')),
583 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-page-open')),
584 $this->urlRefForCM($url,'returnUrl'),
585 1 // no top frame CM!
586 );
587 }
588
589 /**
590 * Adding CM element for regular editing of the element!
591 *
592 * @param string Table name
593 * @param integer UID for the current record.
594 * @return array Item array, element in $menuItems
595 * @internal
596 */
597 function DB_edit($table,$uid) {
598
599 // If another module was specified, replace the default Page module with the new one
600 $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
601 $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
602
603 $editOnClick='';
604 $loc = 'top.content.list_frame';
605 $addParam='';
606 $theIcon = 'actions-document-open';
607 if (
608 $this->iParts[0]=='pages' &&
609 $this->iParts[1] &&
610 $GLOBALS['BE_USER']->check('modules', $pageModule)
611 ) {
612 $theIcon = 'actions-page-open';
613 $this->editPageIconSet=1;
614 if ($GLOBALS['BE_USER']->uc['classicPageEditMode'] || !t3lib_extMgm::isLoaded('cms')) {
615 $addParam='&editRegularContentFromId='.intval($this->iParts[1]);
616 } else {
617 $editOnClick='if(' . $loc . '){' . $loc . ".location.href=top.TS.PATH_typo3+'alt_doc.php?returnUrl='+top.rawurlencode(" . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . ".search)+'&edit[".$table."][".$uid."]=edit".$addParam."';}";
618 }
619 }
620 if (!$editOnClick) {
621 $editOnClick='if(' . $loc . '){' . $loc . ".location.href=top.TS.PATH_typo3+'alt_doc.php?returnUrl='+top.rawurlencode(" . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . ".search)+'&edit[".$table."][".$uid."]=edit".$addParam."';}";
622 }
623
624 return $this->linkItem(
625 $this->label('edit'),
626 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon($theIcon)),
627 $editOnClick.'return hideCM();'
628 );
629 }
630
631 /**
632 * Adding CM element for regular Create new element
633 *
634 * @param string Table name
635 * @param integer UID for the current record.
636 * @return array Item array, element in $menuItems
637 * @internal
638 */
639 function DB_new($table,$uid) {
640 $editOnClick='';
641 $loc = 'top.content.list_frame';
642 $editOnClick='if('.$loc.'){'.$loc.".location.href=top.TS.PATH_typo3+'".
643 ($this->listFrame?
644 "alt_doc.php?returnUrl='+top.rawurlencode(" . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . ".search)+'&edit[".$table."][-".$uid."]=new'":
645 'db_new.php?id='.intval($uid)."'").
646 ';}';
647
648 return $this->linkItem(
649 $this->label('new'),
650 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-' . ($table === 'pages' ? 'page' : 'document' ) . '-new')),
651 $editOnClick.'return hideCM();'
652 );
653 }
654
655 /**
656 * Adding CM element for Delete
657 *
658 * @param string Table name
659 * @param integer UID for the current record.
660 * @param array Label for including in the confirmation message, EXT:lang/locallang_core.php:mess.delete
661 * @return array Item array, element in $menuItems
662 * @internal
663 */
664 function DB_delete($table,$uid,$elInfo) {
665 $editOnClick='';
666 $loc = 'top.content.list_frame';
667 if($GLOBALS['BE_USER']->jsConfirmation(4)) {
668 $conf = "confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.delete'),$elInfo[0]) .
669 t3lib_BEfunc::referenceCount($table,$uid,' (There are %s reference(s) to this record!)') .
670 t3lib_BEfunc::translationCount($table, $uid, ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.translationsOfRecord'))
671 ) . ")";
672 } else {
673 $conf = '1==1';
674 }
675 $editOnClick = 'if(' . $loc . " && " . $conf . " ){" . $loc . ".location.href=top.TS.PATH_typo3+'tce_db.php?redirect='+top.rawurlencode(" . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . ".search)+'" .
676 "&cmd[" . $table . '][' . $uid . '][delete]=1&prErr=1&vC=' . $GLOBALS['BE_USER']->veriCode() . t3lib_BEfunc::getUrlToken('tceAction') . "';}hideCM();top.nav.refresh.defer(500, top.nav);";
677
678 return $this->linkItem(
679 $this->label('delete'),
680 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-edit-delete')),
681 $editOnClick.'return false;'
682 );
683 }
684
685 /**
686 * Adding CM element for View Page
687 *
688 * @param integer Page uid (PID)
689 * @param string Anchor, if any
690 * @return array Item array, element in $menuItems
691 * @internal
692 */
693 function DB_view($id,$anchor='') {
694 return $this->linkItem(
695 $this->label('view'),
696 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-view')),
697 t3lib_BEfunc::viewOnClick($id,$this->PH_backPath,t3lib_BEfunc::BEgetRootLine($id),$anchor).'return hideCM();'
698 );
699 }
700
701 /**
702 * Adding element for setting temporary mount point.
703 *
704 * @param integer Page uid (PID)
705 * @return array Item array, element in $menuItems
706 * @internal
707 */
708 function DB_tempMountPoint($page_id) {
709 return $this->linkItem(
710 $this->label('tempMountPoint'),
711 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('apps-pagetree-page-mountpoint')),
712 "if (top.content.nav_frame) {
713 var node = top.TYPO3.Backend.NavigationContainer.PageTree.getSelected();
714 if (node === null) {
715 return false;
716 }
717
718 var useNode = {
719 attributes: {
720 nodeData: {
721 id: " . intval($page_id) . "
722 }
723 }
724 };
725
726 node.ownerTree.commandProvider.mountAsTreeRoot(useNode, node.ownerTree);
727 }
728 return hideCM();
729 "
730 );
731 }
732
733 /**
734 * Adding CM element for hide/unhide of the input record
735 *
736 * @param string Table name
737 * @param array Record array
738 * @param string Name of the hide field
739 * @return array Item array, element in $menuItems
740 * @internal
741 */
742 function DB_hideUnhide($table,$rec,$hideField) {
743 return $this->DB_changeFlag($table, $rec, $hideField, $this->label(($rec[$hideField]?'un':'').'hide'), 'hide');
744 }
745
746 /**
747 * Adding CM element for a flag field of the input record
748 *
749 * @param string Table name
750 * @param array Record array
751 * @param string Name of the flag field
752 * @param string Menu item Title
753 * @param string Name of the item used for icons and labels
754 * @param string Icon path relative to typo3/ folder
755 * @return array Item array, element in $menuItems
756 */
757 function DB_changeFlag($table, $rec, $flagField, $title, $name, $iconRelPath='gfx/') {
758 $uid = $rec['_ORIG_uid'] ? $rec['_ORIG_uid'] : $rec['uid'];
759 $editOnClick='';
760 $loc = 'top.content.list_frame';
761 $editOnClick = 'if(' . $loc . '){' . $loc . ".location.href=top.TS.PATH_typo3+'tce_db.php?redirect='" .
762 "+top.rawurlencode(" . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . ".search)+'" .
763 "&data[" . $table . '][' . $uid . '][' . $flagField . ']=' .
764 ($rec[$flagField] ? 0 : 1) . '&prErr=1&vC=' . $GLOBALS['BE_USER']->veriCode() . t3lib_BEfunc::getUrlToken('tceAction') . "';}hideCM();top.nav.refresh.defer(500, top.nav);";
765
766 return $this->linkItem(
767 $title,
768 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-edit-' . ( $rec[$flagField] ? 'un' : '') . 'hide')),
769 $editOnClick.'return false;',
770 1
771 );
772 }
773
774
775
776
777
778
779
780
781 /***************************************
782 *
783 * FILE
784 *
785 ***************************************/
786
787 /**
788 * Make 1st level clickmenu:
789 *
790 * @param string The absolute path
791 * @return string HTML content
792 */
793 function printFileClickMenu($path) {
794 $menuItems=array();
795
796 if (file_exists($path) && t3lib_div::isAllowedAbsPath($path)) {
797 $fI = pathinfo($path);
798 $size=' ('.t3lib_div::formatSize(filesize($path)).'bytes)';
799 $icon = t3lib_iconWorks::getSpriteIconForFile(is_dir($path) ? 'folder' : strtolower($fI['extension']),
800 array('class'=>'absmiddle', 'title' => htmlspecialchars($fI['basename'] . $size)));
801
802 // edit
803 if (!in_array('edit',$this->disabledItems) && is_file($path) && t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'],$fI['extension'])) $menuItems['edit']=$this->FILE_launch($path,'file_edit.php','edit','edit_file.gif');
804 // rename
805 if (!in_array('rename',$this->disabledItems)) $menuItems['rename']=$this->FILE_launch($path,'file_rename.php','rename','rename.gif');
806 // upload
807 if (!in_array('upload',$this->disabledItems) && is_dir($path)) {
808 $menuItems['upload'] = $this->FILE_upload($path);
809 }
810
811 // new
812 if (!in_array('new',$this->disabledItems) && is_dir($path)) $menuItems['new']=$this->FILE_launch($path,'file_newfolder.php','new','new_file.gif');
813 // info
814 if (!in_array('info',$this->disabledItems)) $menuItems['info']=$this->DB_info($path,'');
815
816 $menuItems[]='spacer';
817
818 // copy:
819 if (!in_array('copy',$this->disabledItems)) $menuItems['copy']=$this->FILE_copycut($path,'copy');
820 // cut:
821 if (!in_array('cut',$this->disabledItems)) $menuItems['cut']=$this->FILE_copycut($path,'cut');
822
823 // Paste:
824 $elFromAllTables = count($this->clipObj->elFromTable('_FILE'));
825 if (!in_array('paste',$this->disabledItems) && $elFromAllTables && is_dir($path)) {
826 $elArr = $this->clipObj->elFromTable('_FILE');
827 $selItem = reset($elArr);
828 $elInfo=array(
829 basename($selItem),
830 basename($path),
831 $this->clipObj->currentMode()
832 );
833 $menuItems['pasteinto']=$this->FILE_paste($path,$selItem,$elInfo);
834 }
835
836 $menuItems[]='spacer';
837
838 // delete:
839 if (!in_array('delete',$this->disabledItems)) $menuItems['delete']=$this->FILE_delete($path);
840 }
841
842 // Adding external elements to the menuItems array
843 $menuItems = $this->processingByExtClassArray($menuItems,$path,0);
844
845 // Processing by external functions?
846 $menuItems = $this->externalProcessingOfFileMenuItems($menuItems);
847
848 // Return the printed elements:
849 return $this->printItems($menuItems,$icon.basename($path));
850 }
851
852
853 /**
854 * Processing the $menuItems array (for extension classes) (FILES)
855 *
856 * @param array $menuItems array for manipulation.
857 * @return array Processed $menuItems array
858 */
859 function externalProcessingOfFileMenuItems($menuItems) {
860 return $menuItems;
861 }
862
863 /**
864 * Multi-function for adding an entry to the $menuItems array
865 *
866 * @param string Path to the file/directory (target)
867 * @param string Script (eg. file_edit.php) to pass &target= to
868 * @param string "type" is the code which fetches the correct label for the element from "cm."
869 * @param string icon image-filename from "gfx/" (12x12 icon)
870 * @param boolean If set, the return URL parameter will not be set in the link
871 * @return array Item array, element in $menuItems
872 * @internal
873 */
874 function FILE_launch($path,$script,$type,$image,$noReturnUrl=FALSE) {
875 $loc = 'top.content.list_frame';
876
877 $editOnClick = 'if(' . $loc . '){' . $loc . ".location.href=top.TS.PATH_typo3+'".$script.'?target=' . rawurlencode($path) . ($noReturnUrl ? "'" : "&returnUrl='+top.rawurlencode(" . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . ".search)") . ";}";
878 return $this->linkItem(
879 $this->label($type),
880 $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/'.$image,'width="12" height="12"').' alt="" />'),
881 $editOnClick . 'top.nav.refresh();return hideCM();'
882 );
883 }
884
885 /**
886 * function for adding an upload entry to the $menuItems array
887 *
888 * @param string Path to the file/directory (target)
889 * @return array Item array, element in $menuItems
890 * @internal
891 */
892 function FILE_upload($path) {
893 $script = 'file_upload.php';
894 $type = 'upload';
895 $image = 'upload.gif';
896 if ($GLOBALS['BE_USER']->uc['enableFlashUploader']) {
897 $loc = 'top.content.list_frame';
898
899 $editOnClick = 'if (top.TYPO3.FileUploadWindow.isFlashAvailable()) { initFlashUploader("' . rawurlencode($path) . '"); } else if(' . $loc . '){' . $loc . ".location.href=top.TS.PATH_typo3+'".$script.'?target=' . rawurlencode($path) . "';}";
900
901 return $this->linkItem(
902 $this->label($type),
903 $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/'.$image,'width="12" height="12"').' alt="" />'),
904 $editOnClick . 'return hideCM();'
905 );
906 } else {
907 return $this->FILE_launch($path, $script, $type, $image, TRUE);
908 }
909 }
910
911 /**
912 * Returns element for copy or cut of files.
913 *
914 * @param string Path to the file/directory (target)
915 * @param string Type: "copy" or "cut"
916 * @return array Item array, element in $menuItems
917 * @internal
918 */
919 function FILE_copycut($path,$type) {
920 $table = '_FILE'; // Pseudo table name for use in the clipboard.
921 $uid = t3lib_div::shortmd5($path);
922 if ($this->clipObj->current=='normal') {
923 $isSel = $this->clipObj->isSelected($table,$uid);
924 }
925
926 $addParam = array();
927 if ($this->listFrame) {
928 $addParam['reloadListFrame'] = ($this->alwaysContentFrame ? 2 : 1);
929 }
930
931 return $this->linkItem(
932 $this->label($type),
933 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-edit-' . $type . ($isSel === $type ? '-release' : ''))),
934 "top.loadTopMenu('".$this->clipObj->selUrlFile($path,($type=='copy'?1:0),($isSel==$type),$addParam)."');return false;"
935 );
936 }
937
938 /**
939 * Creates element for deleting of target
940 *
941 * @param string Path to the file/directory (target)
942 * @return array Item array, element in $menuItems
943 * @internal
944 */
945 function FILE_delete($path) {
946 $editOnClick='';
947 $loc = 'top.content.list_frame';
948 if($GLOBALS['BE_USER']->jsConfirmation(4)) {
949 $conf = "confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.delete'),basename($path)).t3lib_BEfunc::referenceCount('_FILE',$path,' (There are %s reference(s) to this file!)')).")";
950 } else {
951 $conf = '1==1';
952 }
953 $editOnClick = 'if(' . $loc . " && " . $conf . " ){" . $loc . ".location.href=top.TS.PATH_typo3+'tce_file.php?redirect='+top.rawurlencode(" . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . ".search)+'" .
954 "&file[delete][0][data]=".rawurlencode($path).'&vC='.$GLOBALS['BE_USER']->veriCode()."';}hideCM();";
955
956 return $this->linkItem(
957 $this->label('delete'),
958 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-edit-delete')),
959 $editOnClick.'return false;'
960 );
961 }
962
963 /**
964 * Creates element for pasting files.
965 *
966 * @param string Path to the file/directory (target)
967 * @param string target - NOT USED.
968 * @param array Various values for the labels.
969 * @return array Item array, element in $menuItems
970 * @internal
971 */
972 function FILE_paste($path,$target,$elInfo) {
973 $editOnClick='';
974 $loc = 'top.content.list_frame';
975 if($GLOBALS['BE_USER']->jsConfirmation(2)) {
976 $conf=$loc." && confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.'.($elInfo[2]=='copy'?'copy':'move').'_into'),$elInfo[0],$elInfo[1])).")";
977 } else {
978 $conf=$loc;
979 }
980
981 $editOnClick='if('.$conf.'){'.$loc.".location.href=top.TS.PATH_typo3+'".$this->clipObj->pasteUrl('_FILE',$path,0).
982 "&redirect='+top.rawurlencode(" . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . '.search); }hideCM();top.nav.refresh();';
983
984 return $this->linkItem(
985 $this->label('pasteinto'),
986 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-paste-into')),
987 $editOnClick.'return false;'
988 );
989 }
990
991
992
993
994
995 /***************************************
996 *
997 * DRAG AND DROP
998 *
999 ***************************************/
1000
1001 /**
1002 * Make 1st level clickmenu:
1003 *
1004 * @param string The absolute path
1005 * @param integer UID for the current record.
1006 * @param integer Destination ID
1007 * @return string HTML content
1008 */
1009 function printDragDropClickMenu($table,$srcId,$dstId) {
1010 $menuItems=array();
1011
1012 // If the drag and drop menu should apply to PAGES use this set of menu items
1013 if ($table == 'pages') {
1014 // Move Into:
1015 $menuItems['movePage_into']=$this->dragDrop_copymovepage($srcId,$dstId,'move','into');
1016 // Move After:
1017 $menuItems['movePage_after']=$this->dragDrop_copymovepage($srcId,$dstId,'move','after');
1018 // Copy Into:
1019 $menuItems['copyPage_into']=$this->dragDrop_copymovepage($srcId,$dstId,'copy','into');
1020 // Copy After:
1021 $menuItems['copyPage_after']=$this->dragDrop_copymovepage($srcId,$dstId,'copy','after');
1022 }
1023
1024 // If the drag and drop menu should apply to FOLDERS use this set of menu items
1025 if ($table == 'folders') {
1026 // Move Into:
1027 $menuItems['moveFolder_into']=$this->dragDrop_copymovefolder($srcId,$dstId,'move');
1028 // Copy Into:
1029 $menuItems['copyFolder_into']=$this->dragDrop_copymovefolder($srcId,$dstId,'copy');
1030 }
1031
1032 // Adding external elements to the menuItems array
1033 $menuItems = $this->processingByExtClassArray($menuItems,"dragDrop_".$table,$srcId); // to extend this, you need to apply a Context Menu to a "virtual" table called "dragDrop_pages" or similar
1034
1035 // Processing by external functions?
1036 $menuItems = $this->externalProcessingOfDBMenuItems($menuItems);
1037
1038 // Return the printed elements:
1039 return $this->printItems($menuItems,
1040 t3lib_iconWorks::getSpriteIconForRecord($table,$this->rec,array('title'=> t3lib_BEfunc::getRecordTitle($table,$this->rec,TRUE)))
1041 );
1042 }
1043
1044
1045 /**
1046 * Processing the $menuItems array (for extension classes) (DRAG'N DROP)
1047 *
1048 * @param array $menuItems array for manipulation.
1049 * @return array Processed $menuItems array
1050 */
1051 function externalProcessingOfDragDropMenuItems($menuItems) {
1052 return $menuItems;
1053 }
1054
1055
1056 /**
1057 * Adding CM element for Copying/Moving a Page Into/After from a drag & drop action
1058 *
1059 * @param integer source UID code for the record to modify
1060 * @param integer destination UID code for the record to modify
1061 * @param string Action code: either "move" or "copy"
1062 * @param string Parameter code: either "into" or "after"
1063 * @return array Item array, element in $menuItems
1064 * @internal
1065 */
1066 function dragDrop_copymovepage($srcUid,$dstUid,$action,$into) {
1067 $negativeSign = ($into == 'into') ? '' : '-';
1068 $editOnClick='';
1069 $loc = 'top.content.list_frame';
1070 $editOnClick = 'if(' . $loc . '){' . $loc . '.document.location=top.TS.PATH_typo3+"tce_db.php?redirect="+top.rawurlencode(' . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . '.search)+"' .
1071 '&cmd[pages][' . $srcUid . '][' . $action . ']=' . $negativeSign . $dstUid . '&prErr=1&vC=' . $GLOBALS['BE_USER']->veriCode() . t3lib_BEfunc::getUrlToken('tceAction') . '";}hideCM();top.nav.refresh();';
1072
1073 return $this->linkItem(
1074 $this->label($action.'Page_'.$into),
1075 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('actions-document-paste-' . $into)),
1076 $editOnClick.'return false;',
1077 0
1078 );
1079 }
1080
1081
1082 /**
1083 * Adding CM element for Copying/Moving a Folder Into from a drag & drop action
1084 *
1085 * @param string source path for the record to modify
1086 * @param string destination path for the records to modify
1087 * @param string Action code: either "move" or "copy"
1088 * @return array Item array, element in $menuItems
1089 * @internal
1090 */
1091 function dragDrop_copymovefolder($srcPath,$dstPath,$action) {
1092 $editOnClick='';
1093 $loc = 'top.content.list_frame';
1094 $editOnClick = 'if(' . $loc . '){' . $loc . '.document.location=top.TS.PATH_typo3+"tce_file.php?redirect="+top.rawurlencode(' . $this->frameLocation($loc . '.document') . '.pathname+' . $this->frameLocation($loc . '.document') . '.search)+"' .
1095 '&file['.$action.'][0][data]='.$srcPath.'&file['.$action.'][0][target]='.$dstPath.'&prErr=1&vC='.$GLOBALS['BE_USER']->veriCode().'";}hideCM();top.nav.refresh();';
1096
1097 return $this->linkItem(
1098 $this->label($action.'Folder_into'),
1099 $this->excludeIcon(t3lib_iconWorks::getSpriteIcon('apps-pagetree-drag-move-into')),
1100 $editOnClick.'return false;',
1101 0
1102 );
1103 }
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113 /***************************************
1114 *
1115 * COMMON
1116 *
1117 **************************************/
1118
1119 /**
1120 * Prints the items from input $menuItems array - both as topframe menu AND the JS section for writing to the div-layers.
1121 * Of course the topframe menu will appear only if $this->doDisplayTopFrameCM() returns TRUE
1122 *
1123 * @param array $menuItems array
1124 * @param string HTML code for the element which was clicked - shown in the end of the horizontal menu in topframe after the close-button.
1125 * @return string HTML code
1126 */
1127 function printItems($menuItems,$item) {
1128
1129 $out='';
1130
1131 // Enable/Disable items:
1132 $menuItems = $this->enableDisableItems($menuItems);
1133
1134 // Clean up spacers:
1135 $menuItems = $this->cleanUpSpacers($menuItems);
1136
1137 // Adding topframe part (horizontal clickmenu)
1138 if ($this->doDisplayTopFrameCM()) {
1139 $out.= '
1140
1141 <!--
1142 Table, which contains the click menu when shown in the top frame of the backend:
1143 -->
1144 <table border="0" cellpadding="0" cellspacing="0" id="typo3-CSM-top">
1145 <tr>
1146
1147 <!-- Items: -->
1148 <td class="c-item">'.
1149 implode('</td>
1150 <td><img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/acm_spacer2.gif','width="8" height="12"').' alt="" /></td>
1151 <td class="c-item">',$this->menuItemsForTopFrame($menuItems)).
1152 '</td>
1153
1154 <!-- Close button: -->
1155 <td class="c-closebutton"><a href="#" onclick="hideCM();return false;">' .
1156 t3lib_iconWorks::getSpriteIcon('actions-document-close', array(
1157 'title'=> $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.close', 1)
1158 )) . '</a></td>
1159
1160 <!-- The item of the clickmenu: -->
1161 <td class="c-itemicon">'.$item.'</td>
1162 </tr>
1163 </table>
1164 ';
1165
1166 // Set remaining BACK_PATH to blank (if any)
1167 $out = str_replace($this->PH_backPath,'',$out);
1168 }
1169 // Adding JS part:
1170 $out.=$this->printLayerJScode($menuItems);
1171
1172 // Return the content
1173 return $out;
1174 }
1175
1176 /**
1177 * Create the JavaScript section
1178 *
1179 * @param array The $menuItems array to print
1180 * @return string The JavaScript section which will print the content of the CM to the div-layer in the target frame.
1181 */
1182 function printLayerJScode($menuItems) {
1183 $script='';
1184 if ($this->isCMlayers()) { // Clipboard must not be submitted - then it's probably a copy/cut situation.
1185 $frameName = '.'.($this->listFrame ? 'list_frame' : 'nav_frame');
1186 if ($this->alwaysContentFrame) $frameName='';
1187
1188 // Create the table displayed in the clickmenu layer:
1189 $CMtable = '
1190 <table border="0" cellpadding="0" cellspacing="0" class="typo3-CSM">
1191 '.implode('',$this->menuItemsForClickMenu($menuItems)).'
1192 </table>';
1193
1194 // Wrap the inner table in another table to create outer border:
1195 $CMtable = $this->wrapColorTableCM($CMtable);
1196
1197 // Set back path place holder to real back path
1198 $CMtable = str_replace($this->PH_backPath,$this->backPath,$CMtable);
1199 if ($this->ajax) {
1200 $innerXML = '<data><clickmenu><htmltable><![CDATA['.$CMtable.']]></htmltable><cmlevel>'.$this->cmLevel.'</cmlevel></clickmenu></data>';
1201 return $innerXML;
1202 } else {
1203 // Create JavaScript section:
1204 $script=$GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
1205
1206 if (top.content && top.content'.$frameName.' && top.content'.$frameName.'.Clickmenu) {
1207 top.content'.$frameName.'.Clickmenu.populateData(unescape("'.t3lib_div::rawurlencodeJS($CMtable).'"),'.$this->cmLevel.');
1208 }
1209 '.(!$this->doDisplayTopFrameCM()?'hideCM();':'')
1210 );
1211 return $script;
1212 }
1213 }
1214 }
1215
1216 /**
1217 * Wrapping the input string in a table with background color 4 and a black border style.
1218 * For the pop-up menu
1219 *
1220 * @param string HTML content to wrap in table.
1221 * @return string
1222 */
1223 function wrapColorTableCM($str) {
1224
1225 return '<div class="typo3-CSM-wrapperCM">
1226 ' . $str . '
1227 </div>';
1228 }
1229
1230 /**
1231 * Traverses the menuItems and generates an output array for implosion in the topframe horizontal menu
1232 *
1233 * @param array $menuItem array
1234 * @param array Array with HTML content to be imploded between <td>-tags
1235 * @return array Array of menu items for top frame.
1236 */
1237 function menuItemsForTopFrame($menuItems) {
1238 $out=array();
1239 foreach ($menuItems as $i) {
1240 if ($i[4]==1 && !$GLOBALS['SOBE']->doc->isCMlayers()) $i[4]=0; // IF the topbar is the ONLY means of the click menu, then items normally disabled from the top menu will appear anyways IF they are disabled with a "1" (2+ will still disallow them in the topbar)
1241 if (is_array($i) && !$i[4]) $out[]=$i[0];
1242 }
1243 return $out;
1244 }
1245
1246 /**
1247 * Traverses the menuItems and generates an output array for implosion in the CM div-layers table.
1248 *
1249 * @param array $menuItem array
1250 * @param array Array with HTML content to be imploded between <td>-tags
1251 * @return array array for implosion in the CM div-layers table.
1252 */
1253 function menuItemsForClickMenu($menuItems) {
1254 $out=array();
1255 foreach ($menuItems as $cc => $i) {
1256 if (is_string($i) && $i=='spacer') { // MAKE horizontal spacer
1257 $out[]='
1258 <tr class="bgColor2">
1259 <td colspan="2"><img src="clear.gif" width="1" height="1" alt="" /></td>
1260 </tr>';
1261 } else { // Just make normal element:
1262 $onClick=$i[3];
1263 $onClick=preg_replace('/return[[:space:]]+hideCM\(\)[[:space:]]*;/i','',$onClick);
1264 $onClick=preg_replace('/return[[:space:]]+false[[:space:]]*;/i','',$onClick);
1265 $onClick=preg_replace('/hideCM\(\);/i','',$onClick);
1266 if (!$i[5]) $onClick.='Clickmenu.hideAll();';
1267
1268 $CSM = ' oncontextmenu="'.htmlspecialchars($onClick).';return false;"';
1269
1270 $out[]='
1271 <tr class="typo3-CSM-itemRow" onclick="'.htmlspecialchars($onClick).'" onmouseover="this.bgColor=\''.$GLOBALS['TBE_TEMPLATE']->bgColor5.'\';" onmouseout="this.bgColor=\'\';"'.$CSM.'>
1272 '.(!$this->leftIcons?'<td class="typo3-CSM-item">'.$i[1].'</td><td align="center">'.$i[2].'</td>' : '<td align="center">'.$i[2].'</td><td class="typo3-CSM-item">'.$i[1].'</td>').'
1273 </tr>';
1274 }
1275 }
1276 return $out;
1277 }
1278
1279 /**
1280 * Adds or inserts a menu item
1281 * Can be used to set the position of new menu entries within the list of existing menu entries. Has this syntax: [cmd]:[menu entry key],[cmd].... cmd can be "after", "before" or "top" (or blank/"bottom" which is default). If "after"/"before" then menu items will be inserted after/before the existing entry with [menu entry key] if found. "after-spacer" and "before-spacer" do the same, but inserts before or after an item and a spacer. If not found, the bottom of list. If "top" the items are inserted in the top of the list.
1282 *
1283 * @param array Menu items array
1284 * @param array Menu items array to insert
1285 * @param string Position command string. Has this syntax: [cmd]:[menu entry key],[cmd].... cmd can be "after", "before" or "top" (or blank/"bottom" which is default). If "after"/"before" then menu items will be inserted after/before the existing entry with [menu entry key] if found. "after-spacer" and "before-spacer" do the same, but inserts before or after an item and a spacer. If not found, the bottom of list. If "top" the items are inserted in the top of the list.
1286 * @return array Menu items array, processed.
1287 */
1288 function addMenuItems($menuItems,$newMenuItems,$position='') {
1289 if (is_array($newMenuItems)) {
1290
1291 if($position) {
1292
1293 $posArr = t3lib_div::trimExplode(',', $position, 1);
1294 foreach($posArr as $pos) {
1295 list($place,$menuEntry) = t3lib_div::trimExplode(':', $pos, 1);
1296 list($place,$placeExtra) = t3lib_div::trimExplode('-', $place, 1);
1297
1298 // bottom
1299 $pointer = count($menuItems);
1300
1301 $found=FALSE;
1302
1303 if ($place) {
1304 switch(strtolower($place)) {
1305 case 'after':
1306 case 'before':
1307 if ($menuEntry) {
1308 $p=1;
1309 reset ($menuItems);
1310 while (TRUE) {
1311 if (!strcmp(key($menuItems), $menuEntry)) {
1312 $pointer = $p;
1313 $found=TRUE;
1314 break;
1315 }
1316 if (!next($menuItems)) break;
1317 $p++;
1318 }
1319 if (!$found) break;
1320
1321 if ($place=='before') {
1322 $pointer--;
1323 if ($placeExtra=='spacer' AND prev($menuItems)=='spacer') {
1324 $pointer--;
1325 }
1326 } elseif ($place=='after') {
1327 if ($placeExtra=='spacer' AND next($menuItems)=='spacer') {
1328 $pointer++;
1329 }
1330 }
1331 }
1332 break;
1333 default:
1334 if (strtolower($place)=='top') {
1335 $pointer = 0;
1336 } else {
1337 $pointer = count($menuItems);
1338 }
1339 $found=TRUE;
1340 break;
1341 }
1342 }
1343 if($found) break;
1344 }
1345 }
1346 $pointer=max(0,$pointer);
1347 $menuItemsBefore = array_slice($menuItems, 0, ($pointer?$pointer:0));
1348 $menuItemsAfter = array_slice($menuItems, $pointer);
1349 $menuItems = $menuItemsBefore + $newMenuItems + $menuItemsAfter;
1350 }
1351 return $menuItems;
1352 }
1353
1354 /**
1355 * Creating an array with various elements for the clickmenu entry
1356 *
1357 * @param string The label, htmlspecialchar'ed already
1358 * @param string <img>-tag for the icon
1359 * @param string JavaScript onclick event for label/icon
1360 * @param boolean ==1 and the element will NOT appear in clickmenus in the topframe (unless clickmenu is totally unavailable)! ==2 and the item will NEVER appear in top frame. (This is mostly for "less important" options since the top frame is not capable of holding so many elements horizontally)
1361 * @param boolean If set, the clickmenu layer will not hide itself onclick - used for secondary menus to appear...
1362 * @return array $menuItem entry with 6 numerical entries: [0] is the HTML for display of the element with link and icon an mouseover etc., [1]-[5] is simply the input params passed through!
1363 */
1364 function linkItem($str,$icon,$onClick,$onlyCM=0,$dontHide=0) {
1365 $this->elCount++;
1366 if($this->ajax) {
1367 $onClick = str_replace('top.loadTopMenu', 'showClickmenu_raw', $onClick);
1368 }
1369
1370
1371 return array(
1372 t3lib_iconWorks::getSpriteIcon('empty-empty', array(
1373 'class' => 'c-roimg',
1374 'id'=> 'roimg_' . $this->elCount
1375 )) .
1376 '<a href="#" onclick="'.htmlspecialchars($onClick).'" onmouseover="mo('.$this->elCount.');" onmouseout="mout('.$this->elCount.');">'.
1377 $str.$icon.
1378 '</a>',
1379 $str,
1380 $icon,
1381 $onClick,
1382 $onlyCM,
1383 $dontHide
1384 );
1385 }
1386
1387 /**
1388 * Returns the input string IF not a user setting has disabled display of icons.
1389 *
1390 * @param string The icon-image tag
1391 * @return string The icon-image tag prefixed with space char IF the icon should be printed at all due to user settings
1392 */
1393 function excludeIcon($iconCode) {
1394 return ($GLOBALS['BE_USER']->uc['noMenuMode'] && strcmp($GLOBALS['BE_USER']->uc['noMenuMode'],'icons')) ? '' : ' '.$iconCode;
1395 }
1396
1397 /**
1398 * Enabling / Disabling items based on list provided from GET var ($this->iParts[3])
1399 *
1400 * @param array Menu items array
1401 * @return array Menu items array, processed.
1402 */
1403 function enableDisableItems($menuItems) {
1404 if ($this->iParts[3]) {
1405
1406 // Detect "only" mode: (only showing listed items)
1407 if (substr($this->iParts[3],0,1)=='+') {
1408 $this->iParts[3] = substr($this->iParts[3],1);
1409 $only = TRUE;
1410 } else {
1411 $only = FALSE;
1412 }
1413
1414 // Do filtering:
1415 if ($only) { // Transfer ONLY elements which are mentioned (or are spacers)
1416 $newMenuArray = array();
1417 foreach($menuItems as $key => $value) {
1418 if (t3lib_div::inList($this->iParts[3], $key) || (is_string($value) && $value=='spacer')) {
1419 $newMenuArray[$key] = $value;
1420 }
1421 }
1422 $menuItems = $newMenuArray;
1423 } else { // Traverse all elements except those listed (just unsetting them):
1424 $elements = t3lib_div::trimExplode(',',$this->iParts[3],1);
1425 foreach($elements as $value) {
1426 unset($menuItems[$value]);
1427 }
1428 }
1429 }
1430
1431 // Return processed menu items:
1432 return $menuItems;
1433 }
1434
1435 /**
1436 * Clean up spacers; Will remove any spacers in the start/end of menu items array plus any duplicates.
1437 *
1438 * @param array Menu items array
1439 * @return array Menu items array, processed.
1440 */
1441 function cleanUpSpacers($menuItems) {
1442
1443 // Remove doubles:
1444 $prevItemWasSpacer = FALSE;
1445 foreach($menuItems as $key => $value) {
1446 if (is_string($value) && $value=='spacer') {
1447 if ($prevItemWasSpacer) {
1448 unset($menuItems[$key]);
1449 }
1450 $prevItemWasSpacer = TRUE;
1451 } else {
1452 $prevItemWasSpacer = FALSE;
1453 }
1454 }
1455
1456 // Remove first:
1457 reset($menuItems);
1458 $key = key($menuItems);
1459 $value = current($menuItems);
1460 if (is_string($value) && $value=='spacer') {
1461 unset($menuItems[$key]);
1462 }
1463
1464
1465 // Remove last:
1466 end($menuItems);
1467 $key = key($menuItems);
1468 $value = current($menuItems);
1469 if (is_string($value) && $value=='spacer') {
1470 unset($menuItems[$key]);
1471 }
1472
1473 // Return processed menu items:
1474 return $menuItems;
1475 }
1476
1477 /**
1478 * Get label from locallang_core.php:cm.*
1479 *
1480 * @param string The "cm."-suffix to get.
1481 * @return string
1482 */
1483 function label($label) {
1484 return $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.'.$label,1));
1485 }
1486
1487 /**
1488 * Returns TRUE if there should be writing to the div-layers (commands sent to clipboard MUST NOT write to div-layers)
1489 *
1490 * @return boolean
1491 */
1492 function isCMlayers() {
1493 if($this->ajax) {
1494 return !$this->CB;
1495 } else {
1496 return $GLOBALS['SOBE']->doc->isCMlayers() && !$this->CB;
1497 }
1498 }
1499
1500 /**
1501 * Appends ".location" to input string
1502 *
1503 * @param string Input string, probably a JavaScript document reference
1504 * @return string
1505 */
1506 function frameLocation($str) {
1507 return $str.'.location';
1508 }
1509 }
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523 /**
1524 * Script Class for the Context Sensitive Menu in TYPO3 (rendered in top frame, normally writing content dynamically to list frames).
1525 *
1526 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
1527 * @package TYPO3
1528 * @subpackage core
1529 * @see template::getContextMenuCode()
1530 */
1531 class SC_alt_clickmenu {
1532
1533 // Internal, static: GPvar:
1534 var $backPath; // Back path.
1535 var $item; // Definition of which item the click menu should be made for.
1536 var $reloadListFrame; // Defines the name of the document object for which to reload the URL.
1537
1538 // Internal:
1539 var $content=''; // Content accumulation
1540 var $doc; // Template object
1541 var $include_once=array(); // Files to include_once() - set in init() function
1542 var $extClassArray=array(); // Internal array of classes for extending the clickmenu
1543 var $dontDisplayTopFrameCM=0; // If set, then the clickmenu will NOT display in the top frame.
1544
1545 /**
1546 * Constructor function for script class.
1547 *
1548 * @return void
1549 */
1550 function init() {
1551
1552 // Setting GPvars:
1553 $this->backPath = t3lib_div::_GP('backPath');
1554 $this->item = t3lib_div::_GP('item');
1555 $this->reloadListFrame = t3lib_div::_GP('reloadListFrame');
1556
1557 // Setting pseudo module name
1558 $this->MCONF['name']='xMOD_alt_clickmenu.php';
1559
1560 // Takes the backPath as a parameter BUT since we are worried about someone forging a backPath (XSS security hole) we will check with sent md5 hash:
1561 $inputBP = explode('|',$this->backPath);
1562 if (count($inputBP)==2 && $inputBP[1]==t3lib_div::shortMD5($inputBP[0].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
1563 $this->backPath = $inputBP[0];
1564 } else {
1565 $this->backPath = $GLOBALS['BACK_PATH'];
1566 }
1567
1568 // Setting internal array of classes for extending the clickmenu:
1569 $this->extClassArray = $GLOBALS['TBE_MODULES_EXT']['xMOD_alt_clickmenu']['extendCMclasses'];
1570
1571 // Traversing that array and setting files for inclusion:
1572 if (is_array($this->extClassArray)) {
1573 foreach($this->extClassArray as $extClassConf) {
1574 if ($extClassConf['path']) $this->include_once[]=$extClassConf['path'];
1575 }
1576 }
1577
1578 // Initialize template object
1579 if (!$this->ajax) {
1580 $this->doc = t3lib_div::makeInstance('template');
1581 $this->doc->backPath = $GLOBALS['BACK_PATH'];
1582 }
1583
1584 // Setting mode for display and background image in the top frame
1585 $this->dontDisplayTopFrameCM= $this->doc->isCMlayers() && !$GLOBALS['BE_USER']->getTSConfigVal('options.contextMenu.options.alwaysShowClickMenuInTopFrame');
1586 if ($this->dontDisplayTopFrameCM) {
1587 $this->doc->bodyTagId.= '-notop';
1588 }
1589
1590 // Setting clickmenu timeout
1591 $secs = t3lib_utility_Math::forceIntegerInRange($GLOBALS['BE_USER']->getTSConfigVal('options.contextMenu.options.clickMenuTimeOut'), 1, 100, 5); // default is 5
1592
1593 // Setting the JavaScript controlling the timer on the page
1594 $listFrameDoc = $this->reloadListFrame!=2 ? 'top.content.list_frame' : 'top.content';
1595 $this->doc->JScode.=$this->doc->wrapScriptTags('
1596 var date = new Date();
1597 var mo_timeout = Math.floor(date.getTime()/1000);
1598
1599 roImg = "' . t3lib_iconWorks::getSpriteIconClasses('status-status-current') . '";
1600
1601 routImg = "t3-icon-empty";
1602
1603 function mo(c) { //
1604 var name="roimg_"+c;
1605 document.getElementById(name).className = roImg;
1606 updateTime();
1607 }
1608 function mout(c) { //
1609 var name="roimg_"+c;
1610 document[name].src = routImg;
1611 updateTime();
1612 }
1613 function updateTime() { //
1614 date = new Date();
1615 mo_timeout = Math.floor(date.getTime()/1000);
1616 }
1617 function timeout_func() { //
1618 date = new Date();
1619 if (Math.floor(date.getTime()/1000)-mo_timeout > '.$secs.') {
1620 hideCM();
1621 return false;
1622 } else {
1623 window.setTimeout("timeout_func();",1*1000);
1624 }
1625 }
1626 function hideCM() { //
1627 window.location.href="alt_topmenu_dummy.php";
1628 return false;
1629 }
1630
1631 // Start timer
1632 timeout_func();
1633
1634 '.($this->reloadListFrame ? '
1635 // Reload list frame:
1636 if('.$listFrameDoc.'){'.$listFrameDoc.'.location.href='.$listFrameDoc.'.location.href;}' :
1637 '').'
1638 ');
1639 }
1640
1641 /**
1642 * Main function - generating the click menu in whatever form it has.
1643 *
1644 * @return void
1645 */
1646 function main() {
1647 $this->ajax = t3lib_div::_GP('ajax') ? TRUE : FALSE;
1648
1649 // Initialize Clipboard object:
1650 $clipObj = t3lib_div::makeInstance('t3lib_clipboard');
1651 $clipObj->initializeClipboard();
1652 $clipObj->lockToNormal(); // This locks the clipboard to the Normal for this request.
1653
1654 // Update clipboard if some actions are sent.
1655 $CB = t3lib_div::_GET('CB');
1656 $clipObj->setCmd($CB);
1657 $clipObj->cleanCurrent();
1658 $clipObj->endClipboard(); // Saves
1659
1660 // Create clickmenu object
1661 $clickMenu = t3lib_div::makeInstance('clickMenu');
1662
1663 // Set internal vars in clickmenu object:
1664 $clickMenu->clipObj = $clipObj;
1665 $clickMenu->extClassArray = $this->extClassArray;
1666 $clickMenu->dontDisplayTopFrameCM = $this->dontDisplayTopFrameCM;
1667 $clickMenu->backPath = $this->backPath;
1668
1669 // Start page
1670 if(!$this->ajax) {
1671 $this->content.= $this->doc->startPage('Context Sensitive Menu');
1672 }
1673 // Set content of the clickmenu with the incoming var, "item"
1674 $this->content.= $clickMenu->init();
1675 }
1676
1677 /**
1678 * End page and output content.
1679 *
1680 * @return void
1681 */
1682 function printContent() {
1683 if (!$this->ajax) {
1684 $this->content.= $this->doc->endPage();
1685 $this->content = $this->doc->insertStylesAndJS($this->content);
1686 echo $this->content;
1687 } else {
1688 $this->content = $GLOBALS['LANG']->csConvObj->utf8_encode($this->content,$GLOBALS['LANG']->charSet);
1689 t3lib_ajax::outputXMLreply($this->content);
1690 }
1691 }
1692 }
1693
1694
1695 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_clickmenu.php'])) {
1696 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_clickmenu.php']);
1697 }
1698
1699
1700
1701 // Make instance:
1702 $SOBE = t3lib_div::makeInstance('SC_alt_clickmenu');
1703 $SOBE->init();
1704
1705 // Include files?
1706 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
1707
1708 $SOBE->main();
1709 $SOBE->printContent();
1710
1711 ?>