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