[TASK] Show infobox for records which are set to readOnly 84/57284/4
authorMathias Brodala <mbrodala@pagemachine.de>
Thu, 21 Jun 2018 10:31:30 +0000 (12:31 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Fri, 22 Jun 2018 19:54:58 +0000 (21:54 +0200)
Records can be set to readOnly by setting 'readOnly` in the TCA ctrl section.
Inform editors by rendering an infobox above the record.

Additionally improve the code of the record note rendering.

Resolves: #85244
Releases: master, 8.7
Change-Id: I46c84f18b22332c5691f7fb41836a0b97f8dafa2
Reviewed-on: https://review.typo3.org/57284
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/backend/Classes/Form/Container/OuterWrapContainer.php
typo3/sysext/backend/Resources/Private/Templates/OuterWrapContainer.html
typo3/sysext/lang/Resources/Private/Language/locallang_core.xlf

index d15fc61..f24fb21 100644 (file)
@@ -121,14 +121,13 @@ class OuterWrapContainer extends AbstractContainer
         $descriptionColumn = !empty($this->data['processedTca']['ctrl']['descriptionColumn'])
             ? $this->data['processedTca']['ctrl']['descriptionColumn'] : null;
         if ($descriptionColumn !== null) {
-            $title = $this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.recordInformation');
-            $content = $this->data['databaseRow'][$descriptionColumn];
-            $view->assignMultiple([
-                'infoBoxMessageTitle' => $title,
-                'infoBoxMessage' => $content
-            ]);
+            $view->assign('recordDescription', $this->data['databaseRow'][$descriptionColumn]);
+        }
+        $readOnlyRecord = !empty($this->data['processedTca']['ctrl']['readOnly'])
+            ? (bool)$this->data['processedTca']['ctrl']['readOnly'] : null;
+        if ($readOnlyRecord === true) {
+            $view->assign('recordReadonly', true);
         }
-
         $fieldInformationResult = $this->renderFieldInformation();
         $fieldInformationHtml = $fieldInformationResult['html'];
         $result = $this->mergeChildReturnIntoExistingResult($result, $fieldInformationResult, false);
index ef78104..4203119 100644 (file)
@@ -1,8 +1,13 @@
 <h1><f:format.raw>{pageTitle}</f:format.raw></h1>
 
-<f:if condition="{infoBoxMessage}">
-       <f:be.infobox title="{infoBoxMessageTitle}">
-               {infoBoxMessage -> f:format.nl2br()}
+<f:if condition="{recordDescription}">
+       <f:be.infobox title="{f:translate(key:'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.recordInformation')}">
+               {recordDescription -> f:format.nl2br()}
+       </f:be.infobox>
+</f:if>
+<f:if condition="{recordReadonly}">
+       <f:be.infobox title="{f:translate(key:'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.recordInformation')}">
+               {f:translate(key:'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.recordReadonly')}
        </f:be.infobox>
 </f:if>
 
index c8e43e8..4fb9d23 100644 (file)
@@ -412,6 +412,9 @@ Do you want to continue WITHOUT saving?</source>
                        <trans-unit id="labels.label.search_levels">
                                <source>Search levels</source>
                        </trans-unit>
+                       <trans-unit id="labels.recordReadonly">
+                               <source>The table is defined as readonly and can't be edited.</source>
+                       </trans-unit>
                        <trans-unit id="alttext.suggestSearching">
                                <source>Searching...</source>
                        </trans-unit>