[BUGIFX] Field labels not shown in workspaces history 13/30713/2
authorOliver Hader <oliver@typo3.org>
Fri, 13 Jun 2014 11:23:01 +0000 (13:23 +0200)
committerOliver Hader <oliver.hader@typo3.org>
Mon, 16 Jun 2014 09:48:18 +0000 (11:48 +0200)
Field labels are not shown if opening the history of an
element in the workspace module.

Resolves: #59546
Releases: 6.2
Change-Id: I3f522957dad8e36046b508dde658496f1cec6008
Reviewed-on: https://review.typo3.org/30713
Reviewed-by: Wouter Wolters
Reviewed-by: Alexander Opitz
Tested-by: Alexander Opitz
Reviewed-by: Tymoteusz Motylewski
Tested-by: Tymoteusz Motylewski
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
typo3/sysext/workspaces/Classes/Service/HistoryService.php
typo3/sysext/workspaces/Resources/Public/JavaScript/helpers.js

index 6e7cfa8..f7ae7c9 100644 (file)
@@ -89,7 +89,7 @@ class HistoryService implements \TYPO3\CMS\Core\SingletonInterface {
                if (!empty($entry['action'])) {
                        $differences = $entry['action'];
                } else {
-                       $differences = implode('<br/>', $this->getDifferences($entry));
+                       $differences = $this->getDifferences($entry);
                }
                return array(
                        'datetime' => htmlspecialchars(BackendUtility::datetime($entry['tstamp'])),
@@ -117,7 +117,12 @@ class HistoryService implements \TYPO3\CMS\Core\SingletonInterface {
                                                BackendUtility::getProcessedValue($tableName, $field, $entry['oldRecord'][$field], 0, TRUE),
                                                BackendUtility::getProcessedValue($tableName, $field, $entry['newRecord'][$field], 0, TRUE)
                                        );
-                                       $differences[] = nl2br($fieldDifferences);
+                                       if (!empty($fieldDifferences)) {
+                                               $differences[] = array(
+                                                       'label' => $this->getLanguageService()->sl((string)BackendUtility::getItemLabel($tableName, $field)),
+                                                       'html' => nl2br(trim($fieldDifferences)),
+                                               );
+                                       }
                                }
                        }
                }
@@ -168,4 +173,11 @@ class HistoryService implements \TYPO3\CMS\Core\SingletonInterface {
                return $this->differencesObject;
        }
 
+       /**
+        * @return \TYPO3\CMS\Lang\LanguageService
+        */
+       protected function getLanguageService() {
+               return $GLOBALS['LANG'];
+       }
+
 }
index 1733640..e6a6f00 100644 (file)
@@ -172,7 +172,23 @@ TYPO3.Workspaces.Helpers = {
                                                columns: [
                                                        { width: 30, id: 'datetime', header: 'Date' },
                                                        { width: 20, id: 'user', header: 'User', dataIndex: 'user' },
-                                                       { id: 'differences', header: 'Differences', dataIndex: 'differences' }
+                                                       {
+                                                               id: 'differences',
+                                                               header: 'Differences',
+                                                               dataIndex: 'differences',
+                                                               renderer: function(value, metaData, record, rowIndex, colIndex, store) {
+                                                                       if (typeof value === 'string') {
+                                                                               return value;
+                                                                       } else {
+                                                                               var template = new Ext.XTemplate(
+                                                                                       '<tpl for=".">',
+                                                                                               '<div style="display: block; padding: 3px 0;"><strong>{label}</strong> {html}</div>',
+                                                                                       '</tpl>'
+                                                                               );
+                                                                               return template.apply(value);
+                                                                       }
+                                                               }
+                                                       }
                                                ]
                                        })
                                }