[TASK] Add avatar to more places 12/41912/2
authorGeorg Ringer <georg.ringer@gmail.com>
Fri, 24 Jul 2015 04:37:08 +0000 (06:37 +0200)
committerBenjamin Mack <benni@typo3.org>
Fri, 24 Jul 2015 14:01:36 +0000 (16:01 +0200)
Show the avatar at:
- Record history
- Permission module

Change-Id: I73998dd1b4e393dbd7c86053ec12f73d3959b4ba
Resolves: #68496
Releases: master
Reviewed-on: http://review.typo3.org/41912
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
typo3/sysext/backend/Classes/History/RecordHistory.php
typo3/sysext/backend/Classes/ViewHelpers/AvatarViewHelper.php
typo3/sysext/beuser/Resources/Private/Partials/Permission/Ownername.html

index c18740e..9e48712 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Backend\History;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Backend\Backend\Avatar\Avatar;
 
 /**
  * Class for the record history display module show_rechis
@@ -374,6 +375,10 @@ class RecordHistory {
                        return 0;
                }
                $i = 0;
+
+               /** @var Avatar $avatar */
+               $avatar = GeneralUtility::makeInstance(Avatar::class);
+
                foreach ($this->changeLog as $sysLogUid => $entry) {
                        // stop after maxSteps
                        if ($i > $this->maxSteps && $this->maxSteps) {
@@ -396,7 +401,8 @@ class RecordHistory {
                        // add time
                        $singleLine[] = htmlspecialchars(BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $entry['tstamp'], $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')));
                        // add age
-                       $singleLine[] = htmlspecialchars($userName);
+                       $userEntry = is_array($be_user_array[$entry['user']]) ? $be_user_array[$entry['user']] : NULL;
+                       $singleLine[] = $avatar->render($userEntry) . ' ' . htmlspecialchars($userName);
                        // add user name
                        $singleLine[] = $this->linkPage($this->generateTitle($entry['tablename'], $entry['recuid']), array('element' => $entry['tablename'] . ':' . $entry['recuid']), '', $GLOBALS['LANG']->getLL('linkRecordHistory', 1));
                        // add record UID
index 6b19ca4..35968d8 100644 (file)
@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Backend\ViewHelpers;
 
 use TYPO3\CMS\Backend\Backend\Avatar\Avatar;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;
 use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;
 use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
index 576002b..b4d0796 100644 (file)
@@ -1,3 +1,4 @@
+{namespace be = TYPO3\CMS\Backend\ViewHelpers}
 <span id="o_{pageId}">
        <a
                class="ug_selector changeowner"
@@ -21,6 +22,7 @@
                                                        A user name can be resolved
                                                </f:comment>
                                                {username -> f:format.crop(maxCharacters:20)}
+                                               <be:avatar backendUser="{userId}" />
                                        </f:then>
                                        <f:else>
                                                <f:comment>