Commit 73fc07e3 authored by damjan's avatar damjan

[FEATURE] Adds checkbox 'Can change editing mode'

Adds checkbox to backend user settings which allows to non-admin users to switch between editing modes.
parent 6dfef84f
......@@ -50,15 +50,21 @@ abstract class AbstractBackendController extends AbstractController {
if (TYPO3_MODE === 'BE') {
$this->backendUser = $GLOBALS['BE_USER'];
}
$editingMode = $this->session->getDataByKey('editingMode');
if ($this->backendUser->isAdmin()) {
$editingMode = $this->session->getDataByKey('editingMode');
if (empty($editingMode)) {
$this->session->setDataByKey('editingMode', 'extension');
}
$canChangeEditingModes = TRUE;
} else {
$this->session->setDataByKey('editingMode', 'override');
$canChangeEditingModes = $this->backendUser->user['lfeditor_change_editing_modes'] !== 0;
  • Is there a better way to do this? (because $this->backendUser->user is @internal)

  • This is ok... just ignore the internal information property. Only don't use deprecated stuff.

Please register or sign in to reply
if (!$canChangeEditingModes || empty($editingMode)) {
$this->session->setDataByKey('editingMode', 'override');
}
}
$this->session->setDataByKey('defaultLanguagePermission', $this->backendUser->checkLanguageAccess(0));
$this->session->setDataByKey('canChangeEditingModes', $canChangeEditingModes);
}
/**
......@@ -180,6 +186,7 @@ abstract class AbstractBackendController extends AbstractController {
$this->view->assign('editingModeOptions', $editingModeOptions);
$this->view->assign('adminUser', $this->backendUser->isAdmin());
$this->view->assign('defaultLanguagePermission', $this->session->getDataByKey('defaultLanguagePermission'));
$this->view->assign('canChangeEditingModes', $this->session->getDataByKey('canChangeEditingModes'));
}
}
......
<?php
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (http://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
$fieldDefinition = array(
'lfeditor_change_editing_modes' => array(
'exclude' => 1,
Please register or sign in to reply
'label' => 'LLL:EXT:lfeditor/Resources/Private/Language/locallang_mod.xlf:mlang_tabs_tab',
Please register or sign in to reply
'config' => array(
'type' => 'check',
'items' => array(
'1' => array(
'0' => 'LLL:EXT:lfeditor/Resources/Private/Language/locallang_mod.xlf:settings_canChangeEditingMode'
)
)
)
)
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'be_users', 'lfeditor_change_editing_modes', '', 'after:allowed_languages'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'be_users',
$fieldDefinition,
1
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette(
'be_users',
'lfeditor',
'lfeditor_change_editing_modes',
'after:allowed_languages'
);
\ No newline at end of file
......@@ -21,6 +21,10 @@
<source>LFEditor</source>
<target>LFEditor</target>
</trans-unit>
<trans-unit id="settings_canChangeEditingMode" approved="yes" xml:space="preserve">
<source>Can change editing mode</source>
Please register or sign in to reply
<target>Kann Bearbeitungmodus umsteigen</target>
Please register or sign in to reply
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -18,6 +18,9 @@
<trans-unit id="mlang_tabs_tab" xml:space="preserve">
<source>LFEditor</source>
</trans-unit>
<trans-unit id="settings_canChangeEditingMode" xml:space="preserve">
<source>Can change editing mode</source>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -76,7 +76,7 @@
</f:if>
</f:be.menus.actionMenu>
</f:if>
<f:if condition="{adminUser}">
<f:if condition="{canChangeEditingModes}">
<f:be.menus.actionMenu>
<f:for each="{editingModeOptions}" key="editingModeOption" as="editingModeLabel">
<f:if condition="{editingMode} == {editingModeOption}">
......
CREATE TABLE be_users (
lfeditor_change_editing_modes tinyint(4) unsigned DEFAULT '0' NOT NULL
);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment