Index: typo3/classes/class.shortcutmenu.php =================================================================== --- typo3/classes/class.shortcutmenu.php (revision 2965) +++ typo3/classes/class.shortcutmenu.php (working copy) @@ -252,6 +252,24 @@ $row['module_name'] ); $queryParts = parse_url($row['url']); + $queryParameters = t3lib_div::explodeUrl2Array($queryParts['query'], 1); + + if($row['module_name'] == 'xMOD_alt_doc.php' && is_array($queryParameters['edit'])) { + $shortcut['table'] = key($queryParameters['edit']); + $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]); + + if(substr($shortcut['recordid'], -1) == ',') { + $shortcut['recordid'] = substr($shortcut['recordid'], 0, -1); + } + + if($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') { + $shortcut['type'] = 'edit'; + } elseif($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') { + $shortcut['type'] = 'new'; + } + } else { + $shortcut['type'] = 'other'; + } // check for module access if(!$GLOBALS['BE_USER']->isAdmin()) { @@ -288,7 +306,7 @@ } $shortcut['group'] = $shortcutGroup; - $shortcut['icon'] = $this->getShortcutIcon($row['module_name']); + $shortcut['icon'] = $this->getShortcutIcon($row, $shortcut); $shortcut['iconTitle'] = $this->getShortcutIconTitle($shortcutLabel, $row['module_name'], $row['M_module_name']); $shortcut['action'] = 'jump(unescape(\''.rawurlencode($row['url']).'\'),\''.implode('_',$moduleParts).'\',\''.$moduleParts[0].'\');'; @@ -450,8 +468,11 @@ * @return void */ public function createAjaxShortcut($params = array(), TYPO3AJAX &$ajaxObj = null) { + global $TCA, $LANG; + $shortcutCreated = 'failed'; $shortcutName = 'Shortcut'; // default name + $shortcutNamePrepend = ''; $url = urldecode(t3lib_div::_POST('url')); $module = t3lib_div::_POST('module'); @@ -457,6 +478,25 @@ $module = t3lib_div::_POST('module'); $motherModule = t3lib_div::_POST('motherModName'); + // determine shortcut type + $queryParts = parse_url($url); + $queryParameters = t3lib_div::explodeUrl2Array($queryParts['query'], 1); + + if(is_array($queryParameters['edit'])) { + $shortcut['table'] = key($queryParameters['edit']); + $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]); + + if($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') { + $shortcut['type'] = 'edit'; + $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_edit', 1); + } elseif($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') { + $shortcut['type'] = 'new'; + $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_create', 1); + } + } else { + $shortcut['type'] = 'other'; + } + // Lookup the title of this page and use it as default description $pageId = $this->getLinkedPageId($url); @@ -464,7 +504,11 @@ $page = t3lib_BEfunc::getRecord('pages', $pageId); if(count($page)) { // set the name to the title of the page - $shortcutName = $page['title']; + if($shortcut['type'] == 'other') { + $shortcutName = $page['title']; + } else { + $shortcutName = $shortcutNamePrepend.' '.$LANG->sL($TCA[$shortcut['table']]['ctrl']['title']).'('.$page['title'].')'; + } } } else { if (preg_match('/\/$/', $pageId)) { @@ -471,7 +515,7 @@ // if $pageId is a string and ends with a slash, // assume it is a fileadmin reference and set // the description to the basename of that path - $shortcutName = basename($pageId); + $shortcutName .= basename($pageId); } } @@ -595,11 +639,64 @@ * @param string backend module name * @return string shortcut icon as img tag */ - private function getShortcutIcon($moduleName) { + private function getShortcutIcon($row, $shortcut) { + global $TCA; - switch($moduleName) { + switch($row['module_name']) { case 'xMOD_alt_doc.php': - $icon = 'gfx/edit2.gif'; + $table = $shortcut['table']; + $recordid = $shortcut['recordid']; + + if($shortcut['type'] == 'edit') { + // Creating the list of fields to include in the SQL query: + $selectFields = $this->fieldArray; + $selectFields[] = 'uid'; + $selectFields[] = 'pid'; + + if($table=='pages') { + if(t3lib_extMgm::isLoaded('cms')) { + $selectFields[] = 'module'; + $selectFields[] = 'extendToSubpages'; + } + $selectFields[] = 'doktype'; + } + + if(is_array($TCA[$table]['ctrl']['enablecolumns'])) { + $selectFields = array_merge($selectFields,$TCA[$table]['ctrl']['enablecolumns']); + } + + if($TCA[$table]['ctrl']['type']) { + $selectFields[] = $TCA[$table]['ctrl']['type']; + } + + if($TCA[$table]['ctrl']['typeicon_column']) { + $selectFields[] = $TCA[$table]['ctrl']['typeicon_column']; + } + + if($TCA[$table]['ctrl']['versioningWS']) { + $selectFields[] = 't3ver_state'; + } + + $selectFields = array_unique($selectFields); // Unique list! + $permissionClause = ($table=='pages' && $this->perms_clause) ? + ' AND '.$this->perms_clause : + ''; + + $sqlQueryParts = array( + 'SELECT' => implode(',', $selectFields), + 'FROM' => $table, + 'WHERE' => 'uid = '.$recordid.' '.$permissionClause. + t3lib_BEfunc::deleteClause($table). + t3lib_BEfunc::versioningPlaceholderClause($table) + ); + $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($sqlQueryParts); + $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); + + $icon = t3lib_iconWorks::getIcon($table, $row, $this->backPath); +debug($icon); + } elseif($shortcut['type'] == 'new') { + $icon = t3lib_iconWorks::getIcon($table, '', $this->backPath); + } break; case 'xMOD_file_edit.php': $icon = 'gfx/edit_file.gif'; @@ -608,8 +705,8 @@ $icon = 'gfx/edit_rtewiz.gif'; break; default: - if($GLOBALS['LANG']->moduleLabels['tabs_images'][$moduleName.'_tab']) { - $icon = $GLOBALS['LANG']->moduleLabels['tabs_images'][$moduleName.'_tab']; + if($GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'].'_tab']) { + $icon = $GLOBALS['LANG']->moduleLabels['tabs_images'][$row['module_name'].'_tab']; // change icon of fileadmin references - otherwise it doesn't differ with Web->List $icon = str_replace('mod/file/list/list.gif', 'mod/file/file.gif', $icon); @@ -622,9 +719,7 @@ } } - $icon = 'shortcut icon'; - - return $icon; + return 'shortcut icon'; } /** Index: typo3/sysext/lang/locallang_misc.xml =================================================================== --- typo3/sysext/lang/locallang_misc.xml (revision 2956) +++ typo3/sysext/lang/locallang_misc.xml (working copy) @@ -7,6 +7,7 @@ +