82 if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX) {
83 $GLOBALS[
'LANG']->includeLLFile(
'EXT:lang/locallang_misc.xlf');
86 $loadModules->load(
$GLOBALS[
'TBE_MODULES']);
89 $this->shortcuts = array();
91 $this->shortcutGroups = array(
108 return (
bool)
$GLOBALS[
'BE_USER']->getTSConfigVal(
'options.enableBookmarks');
117 $title =
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarks', TRUE);
119 $shortcutMenu = array();
120 $shortcutMenu[] =
'<a href="#" class="toolbar-item">' .
IconUtility::getSpriteIcon(
'apps-toolbar-menu-shortcut', array(
'title' => $title)) .
'</a>';
121 $shortcutMenu[] =
'<div class="toolbar-item-menu" style="display: none;">';
123 $shortcutMenu[] =
'</div>';
124 return implode(LF, $shortcutMenu);
133 $shortcutGroup =
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarksGroup', TRUE);
134 $shortcutEdit =
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarksEdit', TRUE);
135 $shortcutDelete =
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarksDelete', TRUE);
136 $groupIcon =
'<img' .
IconUtility::skinImg($this->backPath,
'gfx/i/sysf.gif',
'width="18" height="16"') .
' title="' . $shortcutGroup .
'" alt="' . $shortcutGroup .
'" />';
137 $editIcon =
'<img' .
IconUtility::skinImg($this->backPath,
'gfx/edit2.gif',
'width="11" height="12"') .
' title="' . $shortcutEdit .
'" alt="' . $shortcutEdit .
'"';
138 $deleteIcon =
'<img' .
IconUtility::skinImg($this->backPath,
'gfx/garbage.gif',
'width="11" height="12"') .
' title="' . $shortcutDelete .
'" alt="' . $shortcutDelete .
'" />';
139 $shortcutMenu[] =
'<table border="0" cellspacing="0" cellpadding="0" class="shortcut-list">';
142 foreach ($noGroupShortcuts as $shortcut) {
144 <tr id="shortcut-' . $shortcut[
'raw'][
'uid'] .
'" class="shortcut"> 145 <td class="shortcut-icon">' . $shortcut[
'icon'] .
'</td> 146 <td class="shortcut-label"> 147 <a id="shortcut-label-' . $shortcut[
'raw'][
'uid'] .
'" href="#" onclick="' . $shortcut[
'action'] .
'; return false;">' . htmlspecialchars($shortcut[
'label']) .
'</a> 149 <td class="shortcut-edit">' . $editIcon .
' id="shortcut-edit-' . $shortcut[
'raw'][
'uid'] .
'" /></td> 150 <td class="shortcut-delete">' . $deleteIcon .
'</td> 155 krsort($groups, SORT_NUMERIC);
156 foreach ($groups as $groupId => $groupLabel) {
159 <tr class="shortcut-group" id="shortcut-group-' . $groupId .
'"> 160 <td class="shortcut-group-icon">' . $groupIcon .
'</td> 161 <td class="shortcut-group-label">' . $groupLabel .
'</td> 162 <td colspan="2"> </td> 170 $firstRow =
' first-row';
173 <tr id="shortcut-' . $shortcut[
'raw'][
'uid'] .
'" class="shortcut' . $firstRow .
'"> 174 <td class="shortcut-icon">' . $shortcut[
'icon'] .
'</td> 175 <td class="shortcut-label"> 176 <a id="shortcut-label-' . $shortcut[
'raw'][
'uid'] .
'" href="#" onclick="' . $shortcut[
'action'] .
'; return false;">' . htmlspecialchars($shortcut[
'label']) .
'</a> 178 <td class="shortcut-edit">' . $editIcon .
' id="shortcut-edit-' . $shortcut[
'raw'][
'uid'] .
'" /></td> 179 <td class="shortcut-delete">' . $deleteIcon .
'</td> 182 $shortcutMenu[] = $shortcutGroup;
185 if (count($shortcutMenu) == 1) {
187 $title =
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:toolbarItems.bookmarks', TRUE);
191 $label = str_replace(
'%icon%', $icon,
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_misc.xlf:bookmarkDescription'));
192 $shortcutMenu[] =
'<tr><td style="padding:1px 2px; color: #838383;">' . $label .
'</td></tr>';
194 $shortcutMenu[] =
'</table>';
195 $compiledShortcutMenu = implode(LF, $shortcutMenu);
196 return $compiledShortcutMenu;
208 $ajaxObj->addContent(
'shortcutMenu', $menuContent);
217 $this->backendReference->addJavascriptFile(
'sysext/backend/Resources/Public/JavaScript/shortcutmenu.js');
226 return 'id="shortcut-menu"';
236 $res =
$GLOBALS[
'TYPO3_DB']->exec_SELECTquery(
239 '(userid = ' . (
int)
$GLOBALS[
'BE_USER']->user[
'uid'] .
' AND sc_group>=0) OR sc_group IN (' . $globalGroupIdList .
')',
246 while ($row =
$GLOBALS[
'TYPO3_DB']->sql_fetch_assoc($res)) {
247 $shortcut = array(
'raw' => $row);
249 list($row[
'module_name'], $row[
'M_module_name']) = explode(
'|', $row[
'module_name']);
251 $queryParts = parse_url($row[
'url']);
253 if ($row[
'module_name'] ===
'xMOD_alt_doc.php' && is_array($queryParameters[
'edit'])) {
254 $shortcut[
'table'] = key($queryParameters[
'edit']);
255 $shortcut[
'recordid'] = key($queryParameters[
'edit'][$shortcut[
'table']]);
256 if ($queryParameters[
'edit'][$shortcut[
'table']][$shortcut[
'recordid']] ===
'edit') {
257 $shortcut[
'type'] =
'edit';
258 } elseif ($queryParameters[
'edit'][$shortcut[
'table']][$shortcut[
'recordid']] ===
'new') {
259 $shortcut[
'type'] =
'new';
261 if (substr($shortcut[
'recordid'], -1) ===
',') {
262 $shortcut[
'recordid'] = substr($shortcut[
'recordid'], 0, -1);
265 $shortcut[
'type'] =
'other';
268 $moduleName = $row[
'M_module_name'] ?: $row[
'module_name'];
270 if (!
$GLOBALS[
'BE_USER']->isAdmin()) {
278 if (!
$GLOBALS[
'BE_USER']->isInWebMount($pageId)) {
282 $pageRow = BackendUtility::getRecord(
'pages', $pageId);
283 if (!
$GLOBALS[
'BE_USER']->doesUserHaveAccess($pageRow, ($perms = 1))) {
289 $shortcutGroup = (int)$row[
'sc_group'];
290 if ($shortcutGroup && $lastGroup !== $shortcutGroup && $shortcutGroup !== self::SUPERGLOBAL_GROUP) {
293 $lastGroup = $shortcutGroup;
295 if ($row[
'description']) {
296 $shortcut[
'label'] = $row[
'description'];
300 $shortcut[
'group'] = $shortcutGroup;
302 $shortcut[
'iconTitle'] = $this->
getShortcutIconTitle($shortcut[
'label'], $row[
'module_name'], $row[
'M_module_name']);
317 $parsedUrl = parse_url($url);
322 $parsedReturnUrl = parse_url(
$parameters[
'returnUrl']);
323 parse_str($parsedReturnUrl[
'query'], $returnUrlParameters);
324 if (strpos($parsedReturnUrl[
'path'],
'mod.php') !== FALSE && isset($returnUrlParameters[
'M'])) {
325 $module = $returnUrlParameters[
'M'];
328 $url = $parsedUrl[
'path'] .
'?' . http_build_query(
$parameters);
332 if (strpos($parsedUrl[
'path'],
'mod.php') !== FALSE && isset(
$parameters[
'M'])) {
347 foreach ($this->shortcuts as $shortcut) {
348 if ($shortcut[
'group'] == $groupId) {
362 $returnShortcut = FALSE;
363 foreach ($this->shortcuts as $shortcut) {
364 if ($shortcut[
'raw'][
'uid'] == (
int)$shortcutId) {
365 $returnShortcut = $shortcut;
369 return $returnShortcut;
379 $bookmarkGroups =
$GLOBALS[
'BE_USER']->getTSConfigProp(
'options.bookmarkGroups');
380 if (is_array($bookmarkGroups) && count($bookmarkGroups)) {
381 foreach ($bookmarkGroups as $groupId => $label) {
382 if (!empty($label)) {
383 $this->shortcutGroups[$groupId] = (string)$label;
384 } elseif (
$GLOBALS[
'BE_USER']->isAdmin()) {
385 unset($this->shortcutGroups[$groupId]);
390 if (count($this->shortcutGroups)) {
392 foreach ($groups as $groupId => $groupLabel) {
393 $this->shortcutGroups[$groupId * -1] = $groupLabel;
397 $this->shortcutGroups[self::SUPERGLOBAL_GROUP] = 1;
399 foreach ($this->shortcutGroups as $groupId => $groupLabel) {
400 $groupId = (int)$groupId;
401 $label = $groupLabel;
402 if ($groupLabel ==
'1') {
403 $label =
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_misc.xlf:bookmark_group_' . abs($groupId), TRUE);
406 $label =
$GLOBALS[
'LANG']->getLL(
'bookmark_group', 1) .
' ' . abs($groupId);
411 $label =
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_misc.xlf:bookmark_global', TRUE) .
': ' . (!empty($label) ? $label : abs($groupId));
412 if ($groupId === self::SUPERGLOBAL_GROUP) {
413 $label =
$GLOBALS[
'LANG']->getLL(
'bookmark_global', 1) .
': ' .
$GLOBALS[
'LANG']->getLL(
'bookmark_all', 1);
416 $this->shortcutGroups[$groupId] = $label;
430 if (!
$GLOBALS[
'BE_USER']->isAdmin()) {
432 if ((
int)$groupId < 0) {
451 $ajaxReturn =
'failed';
452 if ($fullShortcut[
'raw'][
'userid'] ==
$GLOBALS[
'BE_USER']->user[
'uid']) {
453 $GLOBALS[
'TYPO3_DB']->exec_DELETEquery(
'sys_be_shortcuts',
'uid = ' . $shortcutId);
454 if (
$GLOBALS[
'TYPO3_DB']->sql_affected_rows() == 1) {
455 $ajaxReturn =
'deleted';
458 $ajaxObj->addContent(
'delete', $ajaxReturn);
469 $shortcutCreated =
'failed';
471 $shortcutName =
'Shortcut';
472 $shortcutNamePrepend =
'';
477 $queryParts = parse_url($url);
480 if (empty($queryParts[
'scheme'])) {
481 if (is_array($queryParameters[
'edit'])) {
482 $shortcut[
'table'] = key($queryParameters[
'edit']);
483 $shortcut[
'recordid'] = key($queryParameters[
'edit'][$shortcut[
'table']]);
484 if ($queryParameters[
'edit'][$shortcut[
'table']][$shortcut[
'recordid']] ==
'edit') {
485 $shortcut[
'type'] =
'edit';
486 $shortcutNamePrepend =
$GLOBALS[
'LANG']->getLL(
'shortcut_edit', 1);
487 } elseif ($queryParameters[
'edit'][$shortcut[
'table']][$shortcut[
'recordid']] ==
'new') {
488 $shortcut[
'type'] =
'new';
489 $shortcutNamePrepend =
$GLOBALS[
'LANG']->getLL(
'shortcut_create', 1);
492 $shortcut[
'type'] =
'other';
495 $pageId = $shortcut[
'recordid'] ? $shortcut[
'recordid'] : $this->
getLinkedPageId($url);
497 $page = BackendUtility::getRecord(
'pages', $pageId);
500 if ($shortcut[
'type'] ==
'other') {
501 $shortcutName = $page[
'title'];
503 $shortcutName = $shortcutNamePrepend .
' ' .
$GLOBALS[
'LANG']->sL(
$GLOBALS[
'TCA'][$shortcut[
'table']][
'ctrl'][
'title']) .
' (' . $page[
'title'] .
')';
507 $dirName = urldecode($pageId);
508 if (preg_match(
'/\\/$/', $dirName)) {
512 $shortcutName .=
' ' . basename($dirName);
517 $fieldValues = array(
518 'userid' =>
$GLOBALS[
'BE_USER']->user[
'uid'],
519 'module_name' =>
$module .
'|' . $motherModule,
521 'description' => $shortcutName,
524 $GLOBALS[
'TYPO3_DB']->exec_INSERTquery(
'sys_be_shortcuts', $fieldValues);
525 if (
$GLOBALS[
'TYPO3_DB']->sql_affected_rows() == 1) {
526 $shortcutCreated =
'success';
529 $ajaxObj->addContent(
'create', $shortcutCreated);
546 $addUserWhere = !
$GLOBALS[
'BE_USER']->isAdmin() ?
' AND userid=' . (int)
$GLOBALS[
'BE_USER']->user[
'uid'] :
'';
547 $fieldValues = array(
548 'description' => $shortcutName,
549 'sc_group' => $shortcutGroupId
551 if ($fieldValues[
'sc_group'] < 0 && !
$GLOBALS[
'BE_USER']->isAdmin()) {
552 $fieldValues[
'sc_group'] = 0;
554 $GLOBALS[
'TYPO3_DB']->exec_UPDATEquery(
'sys_be_shortcuts',
'uid=' . $shortcutId . $addUserWhere, $fieldValues);
555 $affectedRows =
$GLOBALS[
'TYPO3_DB']->sql_affected_rows();
556 if ($affectedRows == 1) {
557 $ajaxObj->addContent(
'shortcut', $shortcutName);
559 $ajaxObj->addContent(
'shortcut',
'failed');
561 $ajaxObj->setContentFormat(
'plain');
571 return isset($this->shortcutGroups[$groupId]) ? $this->shortcutGroups[$groupId] :
'';
580 $globalGroups = array();
581 foreach ($this->shortcutGroups as $groupId => $groupLabel) {
583 $globalGroups[$groupId] = $groupLabel;
586 return $globalGroups;
596 foreach ($this->shortcuts as $shortcut) {
597 $groups[$shortcut[
'group']] = $this->shortcutGroups[$shortcut[
'group']];
599 return array_unique($groups);
610 switch ($row[
'module_name']) {
611 case 'xMOD_alt_doc.php':
612 $table = $shortcut[
'table'];
613 $recordid = $shortcut[
'recordid'];
615 if ($shortcut[
'type'] ==
'edit') {
618 $selectFields[] =
'uid';
619 $selectFields[] =
'pid';
620 if ($table ==
'pages') {
621 $selectFields[] =
'module';
622 $selectFields[] =
'extendToSubpages';
623 $selectFields[] =
'doktype';
625 if (is_array(
$GLOBALS[
'TCA'][$table][
'ctrl'][
'enablecolumns'])) {
626 $selectFields = array_merge($selectFields,
$GLOBALS[
'TCA'][$table][
'ctrl'][
'enablecolumns']);
628 if (
$GLOBALS[
'TCA'][$table][
'ctrl'][
'type']) {
629 $selectFields[] =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'type'];
631 if (
$GLOBALS[
'TCA'][$table][
'ctrl'][
'typeicon_column']) {
632 $selectFields[] =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'typeicon_column'];
634 if (
$GLOBALS[
'TCA'][$table][
'ctrl'][
'versioningWS']) {
635 $selectFields[] =
't3ver_state';
638 $selectFields = array_unique($selectFields);
639 $permissionClause = $table ===
'pages' && $this->perms_clause ?
' AND ' . $this->perms_clause :
'';
640 $sqlQueryParts = array(
641 'SELECT' => implode(
',', $selectFields),
645 $result =
$GLOBALS[
'TYPO3_DB']->exec_SELECT_queryArray($sqlQueryParts);
648 } elseif ($shortcut[
'type'] ==
'new') {
653 case 'xMOD_file_edit.php':
654 $icon =
'gfx/edit_file.gif';
657 $icon =
'gfx/edit_rtewiz.gif';
660 if (
$GLOBALS[
'LANG']->moduleLabels[
'tabs_images'][$row[
'module_name'] .
'_tab']) {
661 $icon =
$GLOBALS[
'LANG']->moduleLabels[
'tabs_images'][$row[
'module_name'] .
'_tab'];
663 $icon = str_replace(
'mod/file/list/list.gif',
'mod/file/file.gif', $icon);
668 $icon =
'gfx/dummy_module.gif';
671 return '<img src="' . $icon .
'" alt="' .
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:toolbarItems.shortcut', TRUE) .
'" title="' .
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:toolbarItems.shortcut', TRUE) .
'" />';
688 $title =
$GLOBALS[
'LANG']->moduleLabels[
'tabs'][$splitModuleName[0] .
'_tab'];
689 if (count($splitModuleName) > 1) {
693 if ($parentModuleName) {
694 $title .=
' (' . $parentModuleName .
')';
696 $title .=
': ' . $shortcutLabel;
707 return preg_replace(
'/.*[\\?&]id=([^&]+).*/',
'$1', $url);
static skinImg($backPath, $src, $wHattribs='', $outputMode=0)
static explodeUrl2Array($string, $multidim=FALSE)
static quoteJSvalue($value)
static canBeInterpretedAsInteger($var)
static makeInstance($className)
static getModuleUrl($moduleName, $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
static getIcon($table, $row=array(), $shaded=FALSE)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
static versioningPlaceholderClause($table)
static getSpriteIcon($iconName, array $options=array(), array $overlays=array())
static fixed_lgd_cs($string, $chars, $appendString='...')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static stripPathSitePrefix($path)
if($ajaxRegistryEntry !==NULL) $ajaxObj
static deleteClause($table, $tableAlias='')