Project

General

Profile

Feature #18044 » bug_7267_2.diff

Administrator Admin, 2008-01-26 09:50

View differences:

/var/www/temp/classes_2/class.shortcutmenu.php 2008-01-21 16:35:13.000000000 +0100
$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()) {
......
}
$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].'\');';
......
* @return void
*/
public function createAjaxShortcut($params = array(), TYPO3AJAX &$ajaxObj = null) {
global $TCA, $LANG;
$shortcutCreated = 'failed';
$shortcutName = 'Shortcut'; // default name
......
$module = t3lib_div::_POST('module');
$motherModule = t3lib_div::_POST('motherModName');
// Determine shortcut type
$queryParts = parse_url($url);
$queryPartsArr = t3lib_div::explodeUrl2Array($queryParts['query'],1);
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';
$shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_edit', 1);
} elseif($queryPartsArr['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);
......
$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)) {
// 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);
}
}
......
* @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';
......
$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);
(2-2/7)