--- /var/www/trunk/typo3/classes/class.shortcutmenu.php 2008-01-21 16:33:29.000000000 +0100 +++ /var/www/temp/classes_1/class.shortcutmenu.php 2008-01-21 16:26:41.000000000 +0100 @@ -252,6 +252,20 @@ $row['module_name'] ); $queryParts = parse_url($row['url']); + $queryPartsArr = t3lib_div::explodeUrl2Array($queryParts['query'],1); + if($row['module_name']=='xMOD_alt_doc.php') { + if(is_array($queryPartsArr['edit'])) { + $shortcut['table'] = key($queryPartsArr['edit']); + $shortcut['recordid'] = key($queryPartsArr['edit'][$shortcut['table']]); + if($queryPartsArr['edit'][$shortcut['table']][$shortcut['recordid']]=='edit') { + $shortcut['type'] = 'edit'; + } elseif($queryPartsArr['edit'][$shortcut['table']][$shortcut['recordid']]=='new') { + $shortcut['type'] = 'new'; + } + } + } else { + $shortcut['type'] = 'other'; + } // check for module access if(!$GLOBALS['BE_USER']->isAdmin()) { @@ -288,7 +302,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].'\');'; @@ -595,11 +609,55 @@ * @param string backend module name * @return string shortcut icon as img tag */ - private function getShortcutIcon($moduleName) { - - switch($moduleName) { + private function getShortcutIcon($row, $shortcut) { + global $TCA; + 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! +// Is the below line necessary? +// $selectFields = array_intersect($selectFields,$this->makeFieldList($table,1)); // Making sure that the fields in the field-list ARE in the field-list from TCA! + $selFieldList = implode(',',$selectFields); // implode it into a list of fields for the SQL-statement. + $pC = ($table=='pages' && $this->perms_clause)?' AND '.$this->perms_clause:''; + $SqlQueryParts = array( + 'SELECT' => $selFieldList, + 'FROM' => $table, + 'WHERE' => 'uid='.$recordid. + ' '.$pC. + 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); + }elseif($shortcut['type']=='new') { + $icon = t3lib_iconWorks::getIcon($table,'',$this->backPath); + } break; case 'xMOD_file_edit.php': $icon = 'gfx/edit_file.gif'; @@ -608,8 +666,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);