Project

General

Profile

Bug #20385 » 11019_v10.diff

Administrator Admin, 2009-06-02 16:31

View differences:

typo3/sysext/setup/ext_tables.php (working copy)
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'
);
?>
typo3/sysext/setup/mod/index.php (working copy)
var $OLD_BE_USER;
var $languageUpdate;
protected $isAdmin;
protected $dividers2tabs;
protected $tsFieldConf;
......
// 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
......
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));
......
// 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;
}
......
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');
......
}
}
// 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
......
// Build the <body> 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 .= '</div>';
$this->content.= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
// end of wrapper div
$this->content .= '</div>';
}
/**
......
/******************************
*
* 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 ('<td valign="top" colspan="3">','</td>'));
}
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 = '<input id="field_' . $fieldName . '"
type="' . $type . '"
name="data' . $dataAdd . '[' . $fieldName . ']"
value="' . htmlspecialchars($value) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(20) . $more . ' />';
break;
case 'check':
if (!$class) {
$more .= ' class="check"';
}
$html = '<input id="field_' . $fieldName . '"
type="checkbox"
name="data[' . $fieldName . ']"' .
($GLOBALS['BE_USER']->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 = '<select id="field_' . $fieldName . '" name="data[' . $fieldName . ']"' . $more . '>' . chr(10);
foreach ($config['items'] as $key => $value) {
$html .= '<option value="' . $key . '"' .
($GLOBALS['BE_USER']->uc[$fieldName] == $key ? ' selected="selected"' : '') .
'>' . $this->getLabel($value,'',false) . '</option>' . chr(10);
}
$html .= '</select>';
}
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
......
*
* @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) . '<option value="">' . $LANG->getLL('lang_default', 1) . '</option>'
'000000000' => chr(10) . '<option value="">' . $GLOBALS['LANG']->getLL('lang_default', 1) . '</option>'
);
// traverse the number of languages
$theLanguages = t3lib_div::trimExplode('|', TYPO3_languages);
......
$unavailable = (is_dir(PATH_typo3conf . 'l10n/' . $language) ? false : true);
if (!$unavailable) {
$languageOptions[$languageValue . '--' . $language] = '
<option value="'.$language.'"'.($BE_USER->uc['lang'] == $language ? ' selected="selected"' : '') . ($unavailable ? ' class="c-na"' : '').'>'.$LANG->getLL('lang_' . $language, 1) . $localLabel . '</option>';
<option value="'.$language.'"'.($GLOBALS['BE_USER']->uc['lang'] == $language ? ' selected="selected"' : '') . ($unavailable ? ' class="c-na"' : '').'>'.$GLOBALS['LANG']->getLL('lang_' . $language, 1) . $localLabel . '</option>';
}
}
}
ksort($languageOptions);
$languageCode = '
<select id="field_language" name="data[lang]">' .
<select id="field_lang" name="data[lang]" class="select">' .
implode('', $languageOptions) . '
</select>';
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 .= '<table border="0" cellpadding="0" cellspacing="0" class="warningbox"><tr><td>'.
$this->doc->icons(3) .
'The selected language is not available before the language pack is installed.<br />'.
($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.') .
'</td></tr></table>';
}
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' => '<input id="field_beUser_realName" type="text" name="ext_beuser[realName]" value="'.htmlspecialchars($BE_USER->user['realName']).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />',
),
'beUser_email' => array(
'type' => 'text',
'form' => '<input id="field_beUser_email" type="text" name="ext_beuser[email]" value="'.htmlspecialchars($BE_USER->user['email']).'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' />',
),
'emailMeAtLogin' => array(
'type' => 'check',
'form' => '<input id="field_emailMeAtLogin" type="checkbox" name="data[emailMeAtLogin]"'.($BE_USER->uc['emailMeAtLogin']?' checked="checked"':'').' />',
),
'newPassword' => array(
'type' => 'password',
'form' => '<input id="field_newPassword" type="password" name="ext_beuser[password1]" value="" '.$GLOBALS['TBE_TEMPLATE']->formWidth(20).' onchange="this.value=this.value?MD5(this.value):\'\';" />',
),
'newPasswordAgain' => array(
'type' => 'password',
'form' => '<input id="field_newPasswordAgain" type="password" name="ext_beuser[password2]" value="" '.$GLOBALS['TBE_TEMPLATE']->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 .= '<option value=""></option>';
foreach ($this->loadModules->modules as $mainMod => $modData) {
if (isset($modData['sub']) && is_array($modData['sub'])) {
$startModuleSelect .= '<option disabled="disabled">'.$LANG->moduleLabels['tabs'][$mainMod.'_tab'].'</option>';
$startModuleSelect .= '<option disabled="disabled">'.$GLOBALS['LANG']->moduleLabels['tabs'][$mainMod.'_tab'].'</option>';
foreach ($modData['sub'] as $subKey => $subData) {
$modName = $subData['name'];
$startModuleSelect .= '<option value="'.$modName.'"'.($BE_USER->uc['startModule']==$modName?' selected="selected"':'').'>';
$startModuleSelect .= ' - '.$LANG->moduleLabels['tabs'][$modName.'_tab'].'</option>';
$startModuleSelect .= '<option value="' . $modName . '"' . ($GLOBALS['BE_USER']->uc['startModule'] == $modName ? ' selected="selected"' : '') . '>';
$startModuleSelect .= ' - ' . $GLOBALS['LANG']->moduleLabels['tabs'][$modName.'_tab'] . '</option>';
}
}
}
$startModuleSelect = '<select id="field_startModule" name="data[startModule]">' . $startModuleSelect . '</select>';
$data['startup'] = array(
'ctrl' => array(
'label' => $LANG->getLL('opening'),
),
'columns' => array(
'condensedMode' => array(
'type' => 'checkbox',
'form' => '<input id="field_condensedMode" type="checkbox" name="data[condensedMode]"'.($BE_USER->uc['condensedMode']?' checked="checked"':'').' />',
'label' => 'condensedMode'
),
'noMenuMode' => array(
'type' => 'select',
'form' => '<select id="field_noMenuMode" name="data[noMenuMode]">
<option value=""'.(!$BE_USER->uc['noMenuMode']?' selected="selected"':'').'>'.$LANG->getLL('noMenuMode_def').'</option>
<option value="1"'.($BE_USER->uc['noMenuMode'] && (string)$BE_USER->uc['noMenuMode']!="icons"?' selected="selected"':'').'>'.$LANG->getLL('noMenuMode_sel').'</option>
<option value="icons"'.((string)$BE_USER->uc['noMenuMode']=='icons'?' selected="selected"':'').'>'.$LANG->getLL('noMenuMode_icons').'</option>
</select>',
'labelkey' => 'noMenuMode'
),
'startModule' => array(
'type' => 'select',
'form' => $startModuleSelect,
'labelkey' => 'startModule'
),
'showThumbs' => array(
'type' => 'check',
'form' => '<input id="field_showThumbs" type="checkbox" name="data[thumbnailsByDefault]"'.($BE_USER->uc['thumbnailsByDefault']?' checked="checked"':'').' />',
'labelkey' => 'thumbnailsByDefault',
),
'helpText' => array(
'type' => 'check',
'form' => '<input id="field_helpText" type="checkbox" name="data[helpText]"'.($BE_USER->uc['helpText']?' checked="checked"':'').' />',
),
'edit_showFieldHelp' => array(
'type' => 'select',
'form' => '<select id="field_edit_showFieldHelp" name="data[edit_showFieldHelp]">
<option value="">'.$LANG->getLL('edit_showFieldHelp_none').'</option>
<option value="icon"'.($BE_USER->uc['edit_showFieldHelp']=='icon'?' selected="selected"':'').'>'.$LANG->getLL('edit_showFieldHelp_icon').'</option>
<option value="text"'.($BE_USER->uc['edit_showFieldHelp']=='text'?' selected="selected"':'').'>'.$LANG->getLL('edit_showFieldHelp_message').'</option>
</select>',
),
'maxTitleLen' => array(
'type' => 'text',
'form' => '<input id="field_maxTitleLen" type="text" name="data[titleLen]" value="'.$BE_USER->uc['titleLen'].'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(5).' maxlength="5" />',
'labelkey' => 'titleLen',
),
)
);
if ($GLOBALS['BE_USER']->uc['interfaceSetup'] != 'backend_old') {
unset($data['startup']['columns']['noMenuMode']);
return '<select id="field_startModule" name="data[startModule]" class="select">' . $startModuleSelect . '</select>';
}
// 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' => '<input id="field_edit_RTE" type="checkbox" name="data[edit_RTE]"'.($BE_USER->uc['edit_RTE']?' checked="checked"':'').' />',
),
'edit_docModuleUpload' => array(
'type' => 'check',
'form' => '<input id="field_edit_docModuleUpload" type="checkbox" name="data[edit_docModuleUpload]"'.($BE_USER->uc['edit_docModuleUpload']?' checked="checked"':'').' />'
),
'enableFlashUploader' => array(
'type' => 'check',
'form' => '<input id="field_enableFlashUploader" type="checkbox" name="data[enableFlashUploader]"' . ($BE_USER->uc['enableFlashUploader'] ? ' checked="checked"' : '') . ' />'
),
'disableCMlayers' => array(
'type' => 'check',
'form' => '<input id="field_disableCMlayers" type="checkbox" name="data[disableCMlayers]"'.($BE_USER->uc['disableCMlayers']?' checked="checked"':'').' />'
),
'copyLevels' => array(
'type' => 'text',
'form' => '<input id="field_copyLevels" type="text" name="data[copyLevels]" value="'.$BE_USER->uc['copyLevels'].'"'.$GLOBALS['TBE_TEMPLATE']->formWidth(5).' maxlength="5" />&nbsp;'.$LANG->getLL('levels')
),
'recursiveDelete' => array(
'type' => 'check',
'form' => '<input id="field_recursiveDelete" type="checkbox" name="data[recursiveDelete]"'.($BE_USER->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 ('<td valign="top" colspan="3">','</td>'));
}
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)
*
......
}
/**
* 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
......
* @param string Alternative id for use in "for" attribute of <label> tag. By default the $str key is used prepended with "field_".
* @return string HTML output.
*/
function setLabel($str, $key='', $addLabelTag=true, $altLabelTagId='') {
$out = $GLOBALS['LANG']->getLL($str) . ': ';
protected function getLabel($str, $key='', $addLabelTag=true, $altLabelTagId='') {
if (substr($str, 0, 4) == 'LLL:') {
$out = $GLOBALS['LANG']->sL($str);
} else {
$out = htmlspecialchars($str);
}
if (isset($this->overrideConf[($key?$key:$str)])) {
$out = '<span style="color:#999999">'.$out.'</span>';
}
if($addLabelTag) {
$out = '<label for="'.($altLabelTagId?$altLabelTagId:'field_'.$str).'">'.$out.'</label>';
$out = '<label for="' . ($altLabelTagId ? $altLabelTagId : 'field_' . $key) . '">' . $out . '</label>';
}
return $out;
}
......
* @param string Locallang key
* @return string HTML output.
*/
function getCSH($str) {
if (!t3lib_div::inList('language', $str)) {
protected function getCSH($str) {
if (!t3lib_div::inList('language,simuser', $str)) {
$str = 'option_' . $str;
}
return t3lib_BEfunc::cshItem('_MOD_user_setup', $str, $GLOBALS['BACK_PATH'], '|', false, 'margin-bottom:0px;');
typo3/sysext/setup/mod/locallang.xml (working copy)
<label index="edit_RTE">Enable Rich Text Editor (if available)</label>
<label index="edit_docModuleUpload">File upload directly in Doc-module</label>
<label index="enableFlashUploader">Enable Flash Uploader (requires Flash 9+)</label>
<label index="editFunctionsTab">Edit &amp; Advanced functions</label>
<label index="edit_functions">Edit</label>
<label index="disableCMlayers">Disable Popup Context Menus</label>
<label index="setToStandard">Reset all Values to default</label>
(2-2/2)