Index: typo3/sysext/setup/ext_tables.php =================================================================== --- typo3/sysext/setup/ext_tables.php (revision 5526) +++ typo3/sysext/setup/ext_tables.php (working copy) @@ -5,4 +5,145 @@ t3lib_extMgm::addModule('user','setup','after:task',t3lib_extMgm::extPath($_EXTKEY).'mod/'); t3lib_extMgm::addLLrefForTCAdescr('_MOD_user_setup','EXT:setup/locallang_csh_mod.xml'); } + +$GLOBALS['TYPO3_USER_SETTINGS'] = array( + 'ctrl' => array ( + 'dividers2tabs' => 1 + ), + 'columns' => array ( + 'realName' => array( + 'type' => 'text', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:beUser_realName', + 'table' => 'be_users', + 'csh' => 'beUser_realName', + ), + 'email' => array( + 'type' => 'text', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:beUser_email', + 'table' => 'be_users', + 'csh' => 'beUser_email', + ), + 'emailMeAtLogin' => array( + 'type' => 'check', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:emailMeAtLogin', + 'csh' => 'emailMeAtLogin', + ), + 'password' => array( + 'type' => 'password', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:newPassword', + 'table' => 'be_users', + 'csh' => 'newPassword', + 'eval' => 'md5', + ), + 'password2' => array( + 'type' => 'password', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:newPasswordAgain', + 'table' => 'be_users', + 'csh' => 'newPasswordAgain', + 'eval' => 'md5', + ), + 'lang' => array( + 'type' => 'select', + 'itemsProcFunc' => 'SC_mod_user_setup_index->renderLanguageSelect', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:language', + 'csh' => 'language', + ), + + 'condensedMode' => array( + 'type' => 'check', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:condensedMode', + 'csh' => 'condensedMode', + ), + 'noMenuMode' => array( + 'type' => 'select', + 'items' => array( + '0' => 'LLL:EXT:setup/mod/locallang.xml:noMenuMode_def', + '1' => 'LLL:EXT:setup/mod/locallang.xml:noMenuMode_sel', + 'icons' => 'LLL:EXT:setup/mod/locallang.xml:noMenuMode_icons', + ), + 'label' => 'LLL:EXT:setup/mod/locallang.xml:noMenuMode', + 'csh' => 'noMenuMode', + ), + 'startModule' => array( + 'type' => 'select', + 'itemsProcFunc' => 'SC_mod_user_setup_index->renderStartModuleSelect', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:startModule', + 'csh' => 'startModule', + ), + 'thumbnailsByDefault' => array( + 'type' => 'check', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:showThumbs', + 'csh' => 'showThumbs', + ), + 'helpText' => array( + 'type' => 'check', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:helpText', + 'csh' => 'helpText', + ), + 'edit_wideDocument' => array( + 'type' => 'check', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:edit_wideDocument', + 'csh' => 'edit_wideDocument', + ), + 'edit_showFieldHelp' => array( + 'type' => 'select', + 'items' => array ( + '0' => 'LLL:EXT:setup/mod/locallang.xml:edit_showFieldHelp_none', + 'icon' => 'LLL:EXT:setup/mod/locallang.xml:edit_showFieldHelp_icon', + 'text' => 'LLL:EXT:setup/mod/locallang.xml:edit_showFieldHelp_message', + ), + 'label' => 'LLL:EXT:setup/mod/locallang.xml:edit_showFieldHelp', + 'csh' => 'edit_showFieldHelp', + ), + 'titleLen' => array( + 'type' => 'text', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:maxTitleLen', + 'csh' => 'maxTitleLen', + ), + + 'edit_RTE' => array( + 'type' => 'check', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:edit_RTE', + 'csh' => 'edit_RTE', + ), + 'edit_docModuleUpload' => array( + 'type' => 'check', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:edit_docModuleUpload', + 'csh' => 'edit_docModuleUpload', + ), + 'disableCMlayers' => array( + 'type' => 'check', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:disableCMlayers', + 'csh' => 'disableCMlayers', + ), + 'copyLevels' => array( + 'type' => 'text', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:copyLevels', + 'csh' => 'copyLevels', + ), + 'recursiveDelete' => array( + 'type' => 'check', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:recursiveDelete', + 'csh' => 'recursiveDelete', + ), + + 'simulate' => array( + 'type' => 'select', + 'itemsProcFunc' => 'SC_mod_user_setup_index->renderSimulateUserSelect', + 'access' => 'admin', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:simulate', + 'csh' => 'simuser' + ), + 'enableFlashUploader' => array( + 'type' => 'check', + 'label' => 'LLL:EXT:setup/mod/locallang.xml:enableFlashUploader', + 'csh' => 'enableFlashUploader', + ) + ), + 'showitem' => '--div--;LLL:EXT:setup/mod/locallang.xml:personal_data,realName,email,emailMeAtLogin,password,password2,lang, + --div--;LLL:EXT:setup/mod/locallang.xml:opening,condensedMode,noMenuMode,startModule,thumbnailsByDefault,helpText,edit_showFieldHelp,titleLen, + --div--;LLL:EXT:setup/mod/locallang.xml:editFunctionsTab,edit_RTE,edit_wideDocument,edit_docModuleUpload,enableFlashUploader,disableCMlayers,copyLevels,recursiveDelete, + --div--;LLL:EXT:setup/mod/locallang.xml:adminFunctions,simulate' + +); ?> \ No newline at end of file Index: typo3/sysext/setup/mod/index.php =================================================================== --- typo3/sysext/setup/mod/index.php (revision 5526) +++ typo3/sysext/setup/mod/index.php (working copy) @@ -107,7 +107,10 @@ var $OLD_BE_USER; var $languageUpdate; + protected $isAdmin; + protected $dividers2tabs; + protected $tsFieldConf; @@ -129,6 +132,8 @@ // First check if something is submittet in the data-array from POST vars $d = t3lib_div::_POST('data'); + $columns = $GLOBALS['TYPO3_USER_SETTINGS']['columns']; + if (is_array($d)) { // UC hashed before applying changes @@ -140,36 +145,23 @@ if (isset($d['lang']) && ($d['lang'] != $BE_USER->uc['lang'])) { $this->languageUpdate = true; } - // Language - $BE_USER->uc['lang'] = $d['lang']; - // Startup - $BE_USER->uc['condensedMode'] = $d['condensedMode']; - $BE_USER->uc['noMenuMode'] = $d['noMenuMode']; - $BE_USER->uc['startModule'] = $d['startModule']; - $BE_USER->uc['thumbnailsByDefault'] = $d['thumbnailsByDefault']; - $BE_USER->uc['helpText'] = $d['helpText']; - $BE_USER->uc['titleLen'] = intval($d['titleLen']); - - // Advanced functions: - $BE_USER->uc['copyLevels'] = t3lib_div::intInRange($d['copyLevels'],0,100); - $BE_USER->uc['recursiveDelete'] = $d['recursiveDelete']; - - // Edit - $BE_USER->uc['edit_wideDocument'] = $d['edit_wideDocument']; - if ($GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) { $BE_USER->uc['edit_RTE'] = $d['edit_RTE']; } - $BE_USER->uc['edit_docModuleUpload'] = $d['edit_docModuleUpload']; - $BE_USER->uc['enableFlashUploader'] = $d['enableFlashUploader']; - $BE_USER->uc['edit_showFieldHelp'] = $d['edit_showFieldHelp']; - $BE_USER->uc['disableCMlayers'] = $d['disableCMlayers']; - - // Personal: - $BE_USER->uc['emailMeAtLogin'] = $d['emailMeAtLogin']; - - - if ($d['setValuesToDefault']) { // If every value should be default + if ($d['setValuesToDefault']) { + // If every value should be default $BE_USER->resetUC(); + } else { + // save all submitted values if they are no array (arrays are with table=be_users) and exists in $GLOBALS['TYPO3_USER_SETTINGS'][columns] + foreach($columns as $field => $config) { + if ($config['table']) { + continue; } + if ($config['type'] == 'check') { + $BE_USER->uc[$field] = isset($d[$field]) ? 1 : 0; + } else { + $BE_USER->uc[$field] = htmlspecialchars($d[$field]); + } + } + } $BE_USER->overrideUC(); // Inserts the overriding values. $save_after = md5(serialize($BE_USER->uc)); @@ -181,18 +173,18 @@ // Personal data for the users be_user-record (email, name, password...) // If email and name is changed, set it in the users record: - $be_user_data = t3lib_div::_GP('ext_beuser'); - $this->PASSWORD_UPDATED = strlen($be_user_data['password1'].$be_user_data['password2'])>0 ? -1 : 0; + $be_user_data = $d['be_users']; + $this->PASSWORD_UPDATED = strlen($be_user_data['password'].$be_user_data['password2'])>0 ? -1 : 0; if ($be_user_data['email']!=$BE_USER->user['email'] || $be_user_data['realName']!=$BE_USER->user['realName'] - || (strlen($be_user_data['password1'])==32 - && !strcmp($be_user_data['password1'],$be_user_data['password2'])) + || (strlen($be_user_data['password'])==32 + && !strcmp($be_user_data['password'],$be_user_data['password2'])) ) { $storeRec = array(); $BE_USER->user['realName'] = $storeRec['be_users'][$BE_USER->user['uid']]['realName'] = substr($be_user_data['realName'],0,80); $BE_USER->user['email'] = $storeRec['be_users'][$BE_USER->user['uid']]['email'] = substr($be_user_data['email'],0,80); - if (strlen($be_user_data['password1'])==32 && !strcmp($be_user_data['password1'],$be_user_data['password2'])) { - $BE_USER->user['password'] = $storeRec['be_users'][$BE_USER->user['uid']]['password'] = $be_user_data['password1']; + if (strlen($be_user_data['password'])==32 && !strcmp($be_user_data['password'],$be_user_data['password2'])) { + $BE_USER->user['password'] = $storeRec['be_users'][$BE_USER->user['uid']]['password'] = $be_user_data['password2']; $this->PASSWORD_UPDATED = 1; } @@ -233,13 +225,18 @@ function init() { $this->MCONF = $GLOBALS['MCONF']; + // Returns the script user - that is the REAL logged in user! ($GLOBALS[BE_USER] might be another user due to simulation!) $scriptUser = $this->getRealScriptUserObj(); // ... and checking module access for the logged in user. $scriptUser->modAccess($this->MCONF, 1); + $this->isAdmin = $scriptUser->isAdmin(); + // Getting the 'override' values as set might be set in User TSconfig $this->overrideConf = $GLOBALS['BE_USER']->getTSConfigProp('setup.override'); + // Getting the disabled fields might be set in User TSconfig (eg setup.fields.password.disabled=1) + $this->tsFieldConf = $GLOBALS['BE_USER']->getTSConfigProp('setup.fields'); // Create instance of object for output of data $this->doc = t3lib_div::makeInstance('template'); @@ -301,13 +298,10 @@ } } - // compile the menu item data - $data = $this->compileUserSetupData(); - // render the menu items - $menuItems = $this->renderUserSetupTabs($data); + $menuItems = $this->renderUserSetup(); - $this->content .= $this->doc->spacer(20) . $this->doc->getDynTabMenu($menuItems, 'user-setup', false, false, 100); + $this->content .= $this->doc->spacer(20) . $this->doc->getDynTabMenu($menuItems, 'user-setup', false, false, 100, 1, false, 1, $this->dividers2tabs); // Submit and reset buttons @@ -331,11 +325,11 @@ // Build the for the module $this->content = $this->doc->startPage($LANG->getLL('UserSettings')); $this->content.= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); + // end of wrapper div + $this->content .= ''; $this->content.= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); - // end of wrapper div - $this->content .= ''; } /** @@ -371,12 +365,179 @@ + /****************************** + * + * Render module + * + ******************************/ + /** + * renders the data for all tabs in the user setup and returns + * everything that is needed with tabs and dyntab menu + * + * @return ready to use for the dyntabmenu itemarray + */ + protected function renderUserSetup() { + $result = array(); + $firstTabLabel = ''; + $code = array(); + $i = 0; + $fieldList = $GLOBALS['TYPO3_USER_SETTINGS']['showitem']; + // disable fields depended on settings + if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) { + $fieldList = t3lib_div::rmFromList('edit_RTE', $fieldList); + } + if ($GLOBALS['BE_USER']->uc['interfaceSetup'] != 'backend_old') { + $fieldList = t3lib_div::rmFromList('noMenuMode', $fieldList); + } + $fieldArray = t3lib_div::trimExplode(',', $fieldList, true); + $this->dividers2tabs = isset($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) ? intval($GLOBALS['TYPO3_USER_SETTINGS']['ctrl']['dividers2tabs']) : 0; + + + // "display full help" is active? + $displayFullText = ($GLOBALS['BE_USER']->uc['edit_showFieldHelp'] == 'text'); + if ($displayFullText) { + $this->doc->tableLayout['defRowEven'] = array('defCol' => array ('','')); + } + + foreach ($fieldArray as $fieldName) { + $more = ''; + + if (substr($fieldName, 0, 8) == '--div--;') { + if ($firstTabLabel == '') { + // first tab + $tabLabel = $this->getLabel(substr($fieldName, 8), '', false); + $firstTabLabel = $tabLabel; + } else { + if ($this->dividers2tabs) { + $result[] = array( + 'label' => $tabLabel, + 'content' => count($code) ? $this->doc->spacer(20) . $this->doc->table($code) : '' + ); + $tabLabel = $this->getLabel(substr($fieldName, 8), '', false); + $i = 0; + $code = array(); + } + } + continue; + } + + $config = $GLOBALS['TYPO3_USER_SETTINGS']['columns'][$fieldName]; + + // field my be disabled in setup.fields + if (isset($this->tsFieldConf[$fieldName . '.']['disabled']) && $this->tsFieldConf[$fieldName . '.']['disabled'] == 1) { + continue; + } + if (isset($config['access']) && !$this->checkAccess($config['access'])) { + continue; + } + + $label = $this->getLabel($config['label'], $fieldName); + $csh = $this->getCSH($config['csh'] ? $config['csh'] : $fieldName); + $type = $config['type']; + $eval = $config['eval']; + $class = $config['class']; + $style = $config['style']; + + if ($class) { + $more .= ' class="' . $class . '"'; + } + if ($style) { + $more .= ' style="' . $style . '"'; + } + + switch ($type) { + case 'text': + case 'password': + $dataAdd = ''; + if ($config['table'] == 'be_users') { + $dataAdd = '[be_users]'; + $value = $GLOBALS['BE_USER']->user[$fieldName]; + } else { + $value = $GLOBALS['BE_USER']->uc[$fieldName]; + } + if ($eval == 'md5') { + $more .= ' onchange="this.value=this.value?MD5(this.value):\'\';"'; + } + + if ($type == 'password') { + $value = ''; + } + + $html = 'formWidth(20) . $more . ' />'; + break; + case 'check': + if (!$class) { + $more .= ' class="check"'; + } + $html = 'uc[$fieldName] ? ' checked="checked"' : '') . $more . ' />'; + break; + case 'select': + if (!$class) { + $more .= ' class="select"'; + } + + if ($config['itemsProcFunc']) { + $parts = explode('->', $config['itemsProcFunc']); + $html = call_user_func(array($parts[0], $parts[1])); + } else { + $html = ''; + } + + break; + default: + $html = ''; + } + + + // add another table row with the full text help if needed + if ($displayFullText) { + $code[$i++][1] = $csh; + $csh = ''; + } + + $code[$i][1] = $csh . $label; + $code[$i++][2] = $html; + + + + } + + if ($this->dividers2tabs == 0) { + $tabLabel = $firstTabLabel; + } + + $result[] = array( + 'label' => $tabLabel, + 'content' => count($code) ? $this->doc->spacer(20) . $this->doc->table($code) : '' + ); + + + return $result; + } + + + + + + /****************************** * * Helper functions @@ -389,24 +550,21 @@ * * @return object The REAL user is returned - the one logged in. */ - function getRealScriptUserObj() { + protected function getRealScriptUserObj() { return is_object($this->OLD_BE_USER) ? $this->OLD_BE_USER : $GLOBALS['BE_USER']; } + /** - * adds every field and every tab that will be used in a multi-dimensional array to be - * displayed in this module + * Return a select with available languages * - * @return array the full data array that is used for rendering the tabs + * @return string complete select as HTML string or warning box if something went wrong. */ - function compileUserSetupData() { - global $BE_USER, $LANG; - $data = array(); + protected function renderLanguageSelect() { - // Tab: Personal data // compile the languages dropdown $languageOptions = array( - '000000000' => chr(10) . '' + '000000000' => chr(10) . '' ); // traverse the number of languages $theLanguages = t3lib_div::trimExplode('|', TYPO3_languages); @@ -417,235 +575,55 @@ $unavailable = (is_dir(PATH_typo3conf . 'l10n/' . $language) ? false : true); if (!$unavailable) { $languageOptions[$languageValue . '--' . $language] = ' - '; + '; } } } ksort($languageOptions); $languageCode = ' - ' . implode('', $languageOptions) . ' '; - if ($BE_USER->uc['lang'] && !@is_dir(PATH_typo3conf . 'l10n/' . $BE_USER->uc['lang'])) { + if ($GLOBALS['BE_USER']->uc['lang'] && !@is_dir(PATH_typo3conf . 'l10n/' . $GLOBALS['BE_USER']->uc['lang'])) { $languageCode .= '
'. $this->doc->icons(3) . 'The selected language is not available before the language pack is installed.
'. - ($BE_USER->isAdmin() ? 'You can use the Extension Manager to easily download and install new language packs.':'Please ask your system administrator to do this.') . + ($GLOBALS['BE_USER']->isAdmin() ? 'You can use the Extension Manager to easily download and install new language packs.':'Please ask your system administrator to do this.') . '
'; } + return $languageCode; + } - // the data for the user configuration (uc), - $data['personal_data'] = array( - 'ctrl' => array( - 'label' => $LANG->getLL('personal_data'), - ), - 'columns' => array( - 'beUser_realName' => array( - 'type' => 'text', - 'form' => 'formWidth(20).' />', - ), - 'beUser_email' => array( - 'type' => 'text', - 'form' => 'formWidth(20).' />', - ), - 'emailMeAtLogin' => array( - 'type' => 'check', - 'form' => 'uc['emailMeAtLogin']?' checked="checked"':'').' />', - ), - 'newPassword' => array( - 'type' => 'password', - 'form' => 'formWidth(20).' onchange="this.value=this.value?MD5(this.value):\'\';" />', - ), - 'newPasswordAgain' => array( - 'type' => 'password', - 'form' => 'formWidth(20).' onchange="this.value=this.value?MD5(this.value):\'\'" />', - ), - 'language' => array( - 'type' => 'select', - 'form' => $languageCode, - ), - ) - ); - - - // Tab: compiling the 'Startup' section + /** + * Returns a select with all modules for startup + * + * @return string complete select as HTML string + */ + protected function renderStartModuleSelect() { // start module select - if (empty($BE_USER->uc['startModule'])) { - $BE_USER->uc['startModule'] = $BE_USER->uc_default['startModule']; + if (empty($GLOBALS['BE_USER']->uc['startModule'])) { + $GLOBALS['BE_USER']->uc['startModule'] = $GLOBALS['BE_USER']->uc_default['startModule']; } $startModuleSelect .= ''; foreach ($this->loadModules->modules as $mainMod => $modData) { if (isset($modData['sub']) && is_array($modData['sub'])) { - $startModuleSelect .= ''; + $startModuleSelect .= ''; foreach ($modData['sub'] as $subKey => $subData) { $modName = $subData['name']; - $startModuleSelect .= ''; + $startModuleSelect .= ''; } } } - $startModuleSelect = ''; - $data['startup'] = array( - 'ctrl' => array( - 'label' => $LANG->getLL('opening'), - ), - 'columns' => array( - 'condensedMode' => array( - 'type' => 'checkbox', - 'form' => 'uc['condensedMode']?' checked="checked"':'').' />', - 'label' => 'condensedMode' - ), - 'noMenuMode' => array( - 'type' => 'select', - 'form' => '', - 'labelkey' => 'noMenuMode' - ), - 'startModule' => array( - 'type' => 'select', - 'form' => $startModuleSelect, - 'labelkey' => 'startModule' - ), - 'showThumbs' => array( - 'type' => 'check', - 'form' => 'uc['thumbnailsByDefault']?' checked="checked"':'').' />', - 'labelkey' => 'thumbnailsByDefault', - ), - 'helpText' => array( - 'type' => 'check', - 'form' => 'uc['helpText']?' checked="checked"':'').' />', - ), - 'edit_showFieldHelp' => array( - 'type' => 'select', - 'form' => '', - ), - 'maxTitleLen' => array( - 'type' => 'text', - 'form' => 'formWidth(5).' maxlength="5" />', - 'labelkey' => 'titleLen', - ), - ) - ); - if ($GLOBALS['BE_USER']->uc['interfaceSetup'] != 'backend_old') { - unset($data['startup']['columns']['noMenuMode']); + return ''; } - // Tab: Edit section & advanced options - $data['edit'] = array( - 'ctrl' => array( - 'label' => $LANG->getLL('edit_functions') . ' & ' . $LANG->getLL('functions'), - ), - 'columns' => array( - 'edit_RTE' => array( - 'type' => 'check', - 'form' => 'uc['edit_RTE']?' checked="checked"':'').' />', - ), - 'edit_docModuleUpload' => array( - 'type' => 'check', - 'form' => 'uc['edit_docModuleUpload']?' checked="checked"':'').' />' - ), - 'enableFlashUploader' => array( - 'type' => 'check', - 'form' => 'uc['enableFlashUploader'] ? ' checked="checked"' : '') . ' />' - ), - 'disableCMlayers' => array( - 'type' => 'check', - 'form' => 'uc['disableCMlayers']?' checked="checked"':'').' />' - ), - 'copyLevels' => array( - 'type' => 'text', - 'form' => 'formWidth(5).' maxlength="5" /> '.$LANG->getLL('levels') - ), - 'recursiveDelete' => array( - 'type' => 'check', - 'form' => 'uc['recursiveDelete']?' checked="checked"':'').' />', - ), - ) - ); - if (!$GLOBALS['TYPO3_CONF_VARS']['BE']['RTEenabled']) { - unset($data['edit']['columns']['edit_RTE']); - } - - - // Tab: Admin functions - if ($BE_USER->isAdmin()) { - $data['admin'] = array( - 'ctrl' => array( - 'label' => $LANG->getLL('adminFunctions') - ), - 'columns' => array() - ); - // Simulate selector box: - if ($this->simulateSelector) { - $data['admin']['columns']['simulate'] = array( - 'type' => 'select', - 'form' => $this->simulateSelector, - 'csh' => 'simuser' - ); - } - } - - return $data; - } - /** - * renders the data for one tab in the user setup and returns - * everything that is needed to have a complete tab - * for the dyntab menu - * @param $data a multi-dimensional array that will be converted to table contents - * @param $tabLabel the label that is put on top of the tab array - * @return ready to use for the dyntabmenu itemarray - */ - function renderUserSetupTabs($data) { - $result = array(); - foreach ($data as $k => $tabData) { - $code = array(); - $i = 0; - - // "display full help" is active? - $displayFullText = ($GLOBALS['BE_USER']->uc['edit_showFieldHelp'] == 'text'); - if ($displayFullText) { - $this->doc->tableLayout['defRowEven'] = array('defCol' => array ('','')); - } - - foreach ($tabData['columns'] as $fieldname => $data) { - $csh = $this->getCSH($data['csh'] ? $data['csh'] : $fieldname); - // add another table row with the full text help if needed - if ($displayFullText) { - $code[$i++][1] = $csh; - } - - if ($displayFullText) { - $code[$i][1] = $this->setLabel($fieldname, ($data['labelkey'] ? $data['labelkey'] : '')); - } else { - $code[$i][1] = $csh . $this->setLabel($fieldname, ($data['labelkey'] ? $data['labelkey'] : '')); - } - $code[$i++][2] = $data['form']; - } - - if (count($code)) { - $result[] = array( - 'label' => $tabData['ctrl']['label'], - 'content' => $this->doc->spacer(20) . $this->doc->table($code) - ); - } - } - return $result; - } - - /** * Will make the simulate-user selector if the logged in user is administrator. * It will also set the GLOBAL(!) BE_USER to the simulated user selected if any (and set $this->OLD_BE_USER to logged in user) * @@ -690,6 +668,28 @@ } /** + * Returns a select with simulate users + * + * @return string complete select as HTML string + */ + protected function renderSimulateUserSelect() { + return $this->simulateSelector; + } + + /** + * Returns access check (currently only "admin" is supported) + * + * @param $level check against user level (currently only "admin") + * @return boolean true if same access level, else false + */ + protected function checkAccess($level) { + if ($level == 'admin') { + return $this->isAdmin; + } + } + + + /** * Returns the label $str from getLL() and grays out the value if the $str/$key is found in $this->overrideConf array * * @param string Locallang key @@ -698,13 +698,20 @@ * @param string Alternative id for use in "for" attribute of