Commit a538fc25 authored by Stefan Busemann's avatar Stefan Busemann
Browse files

Merge branch '27-edit-a-personal-profile' into 'develop'

Resolve "Edit a personal profile"

Closes #27

See merge request !16
parents edb978c4 c0864f91
Pipeline #3386 failed with stages
in 5 minutes and 8 seconds
......@@ -7,7 +7,6 @@ html/typo3
html/fileadmin/
html/typo3conf/ext/*
!html/typo3conf/ext/t3omy/
!html/typo3conf/ext/userprofile/
html/typo3conf/AdditionalConfiguration.php
html/typo3conf/deprecation_*
html/typo3conf/ENABLE_INSTALL_TOOL
......
<?php
declare(strict_types=1);
namespace T3o\T3omy\Controller;
use T3o\T3omy\Domain\Repository\MyProfileRepository;
use T3o\T3omy\Domain\Model\MyProfile;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
use TYPO3\CMS\Core\Messaging\AbstractMessage;
/**
* Class UserController
*/
class MyProfileController extends ActionController
{
/**
* @var MyProfileRepository
*/
public $myProfileRepository;
/**
* @var persistenceManager
*/
public $persistenceManager;
/**
* @param MyProfileRepository $myProfileRepository
*/
public function injectUserProfileRepository(MyProfileRepository $myProfileRepository)
{
$this->myProfileRepository = $myProfileRepository;
}
/**
* @param PersistenceManager $persistenceManager
*/
public function injectPersistenceManager(PersistenceManager $persistenceManager)
{
$this->persistenceManager = $persistenceManager;
}
/**
* @param MyProfile|null $user
*/
public function showAction (MyProfile $user = null) {
if ($user === null) {
$user = $this->myProfileRepository->findByUid(
$GLOBALS['TSFE']->fe_user->user['uid']
);
if ($user === null) {
$this->addFlashMessage(
'Something went wrong. We were not able to find your profile found!',
'Profile can not be shown',
AbstractMessage::ERROR
);
}
}
$this->view->assign('user',$user);
}
/**
* @param MyProfile $user
*/
public function editAction(MyProfile $user){
$this->view->assign('user', $user);
}
/**
* @param MyProfile $user
*/
public function updateAction (MyProfile $user) {
$this->myProfileRepository->update($user);
$this->persistenceManager->persistAll();
$this->redirect('show');
}
}
<?php
declare(strict_types=1);
namespace T3o\T3omy\Domain\Model;
use TYPO3\CMS\Extbase\Domain\Model\FrontendUser;
/**
* Class UserProfileRepository
*/
class MyProfile extends FrontendUser
{
/**
* @var string
*/
public $github = '';
/**
* @var string
*/
public $twitter = '';
/**
* @var string
*/
public $facebook = '';
/**
* @return string
*/
public function getGithub(): string
{
return $this->github;
}
/**
* @param string $github
*/
public function setGithub(string $github)
{
$this->github = $github;
}
/**
* @return string
*/
public function getTwitter(): string
{
return $this->twitter;
}
/**
* @param string $twitter
*/
public function setTwitter(string $twitter)
{
$this->twitter = $twitter;
}
/**
* @return string
*/
public function getFacebook(): string
{
return $this->facebook;
}
/**
* @param string $facebook
*/
public function setFacebook(string $facebook)
{
$this->facebook = $facebook;
}
}
<?php
declare(strict_types=1);
namespace T3o\T3omy\Domain\Repository;
use TYPO3\CMS\Extbase\Persistence\Repository;
/**
* Class UserProfileRepository
*/
class MyProfileRepository extends Repository
{
}
......@@ -4,34 +4,34 @@
* Table configuration fe_users
*/
$feUsersColumns = [
'privacy_settings' => [
'github' => [
'exclude' => 0,
'label' => 'Privacy settings',
'label' => 'Github profile',
'config' => [
'type' => 'text',
'type' => 'input',
]
],
'about_me' => [
'twitter' => [
'exclude' => 0,
'label' => 'about me',
'label' => 'twitter profile',
'config' => [
'type' => 'text',
'type' => 'input',
]
],
'public_profile' => [
'facebook' => [
'exclude' => 0,
'label' => 'show user profile',
'label' => 'Facebook profile',
'config' => [
'type' => 'check',
'type' => 'input',
]
],
];
$fields = 'privacy_settings,about_me,';
$fields = 'github, twitter, facebook,';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes(
'fe_users',
'privacy_settings,about_me,public_profile',
'github, twitter, facebook',
'',
'after:name'
);
......
plugin.tx_t3omy {
view {
templateRootPath = {$plugin.tx_userprofile.view.templateRootPath}
partialRootPath = {$plugin.tx_userprofile.view.partialRootPath}
layoutRootPath = {$plugin.tx_userprofile.view.layoutRootPath}
}
persistence {
storagePid = {$plugin.tx_userprofile.persistence.storagePid}
}
features {
# uncomment the following line to enable the new Property Mapper.
# rewrittenPropertyMapper = 1
}
slackbot {
webhook {
securityToken =
......
plugin.tx_userprofile {
view {
templateRootPath = {$plugin.tx_userprofile.view.templateRootPath}
partialRootPath = {$plugin.tx_userprofile.view.partialRootPath}
layoutRootPath = {$plugin.tx_userprofile.view.layoutRootPath}
}
persistence {
storagePid = {$plugin.tx_userprofile.persistence.storagePid}
}
features {
# uncomment the following line to enable the new Property Mapper.
# rewrittenPropertyMapper = 1
templateRootPaths {
20 = EXT:t3omy/Resources/Private/Templates/UserProfile/
}
}
settings {
privacy {
_default {
......@@ -22,17 +12,21 @@ plugin.tx_userprofile {
groups = 0
}
#column_name = 1 activates the setting for the user
#column_name {
# public = 0 => sets the default value for element
# authenticated = 0
# groups = 0
# }
about_me = 1
firstName = 1
lastName = 1
address = 1
telephone = 1
email = 1
name = 1
zip = 1
city = 1
country = 1
www = 1
company = 1
image = 1
slack_id = 1
githubProfile = 1
twitter = 1
facebook = 1
}
}
}
Userprofile
===========
The userprofile is maintained via different extensions. Main purpose is, to prevent duplicate and individual code.
List of extensions which provide data:
* femanager: main personal data (name, mail, adress...)
* userprofile; privacy settings, aboutme
* t3omy: adds typo3.org spedific additional profile fields (github, facebook, twitter, teams)
E-Mail Templates
================
## To do
#### Create Assets
(Use the image sizes like in the example references for retina displays and responsive purposes.)
- Logo
- Icons
- Social Icons
---
#### Links
Set link refence to buttons and links
---
## Hints
```
full html is needed (head & body)
<head> is the same in all templates
```
Templates in Resources/Private/Templates/Femanager/Email
CreateUserConfirmation.html
CreateUserNotify.html
CreateUserSecondConfirmation.html
## Litmus tests
[CreateUserConfirmation](https://litmus.com/checklist/emails/public/3a1c0d4)
[CreateUserNotify](https://litmus.com/checklist/emails/public/ec4f2e4)
[CreateUserSecondConfirmation](https://litmus.com/checklist/emails/public/b267f74)
## Created by
Contact for questions:
Miro Olma
Slack: @miroolma
Mail: <olma@medienagenten.de>
# E-Mail Templates
User Registration Process
=========================
* register via femanager plugin
* approvement process (auto approvement rules)
* backend approvement
* slack hook
* t3o_ldap operation via hook
## To do
Configuration
-------------
#### Create Assets
(Use the image sizes like in the example references for retina displays and responsive purposes.)
- Logo
- Icons
- Social Icons
---
#### Links
Set link refence to buttons and links
---
## Hints
```
full html is needed (head & body)
<head> is the same in all templates
```
Templates in Resources/Private/Templates/Femanager/Email
CreateUserConfirmation.html
CreateUserNotify.html
CreateUserSecondConfirmation.html
## Litmus tests
[CreateUserConfirmation](https://litmus.com/checklist/emails/public/3a1c0d4)
[CreateUserNotify](https://litmus.com/checklist/emails/public/ec4f2e4)
[CreateUserSecondConfirmation](https://litmus.com/checklist/emails/public/b267f74)
## Created by
Contact for questions:
Miro Olma
Slack: @miroolma
Mail: <olma@medienagenten.de>
Guide for e-mail templates
my.typo3.org documentation
==========================
.. toctree::
:maxdepth: 3
UserProfile
UserRegistration
https://my.typo3.org/
---------------------
This site is main entry for all user profile related actions:
* User registration (via femanager)
* Update User Profile (via femanager, userprofile, t3omy)
* Register for Slack (via t3o_slack)
* create / update LDAP data (t3o_ldap)
====================== ============== ==============================
Contac Funktion email
====================== ============== ==============================
Stefan Busemann Product Owner stefan.busemann@typo3.org
Thomas Löffler Team Leader thomas.loeffler@typo3.org
===================== ============== ==============================
<section class="container">
<h1>Edit {user.name}</h1>
<f:flashMessages/>
<f:form action="update" objectName="user" object="{user}">
<label for="user.github">Github:</label><br />
<f:form.textfield id="user.github" property="github" value="{user.github}" class="xxlarge form-control"/>
<label for="user.twitter">Github:</label><br />
<f:form.textfield id="user.twitter" property="twitter" value="{user.twitter}" class="xxlarge form-control"/>
<label for="user.facebook">facebook:</label><br />
<f:form.textfield id="user.facebook" property="facebook" value="{user.facebook}" class="xxlarge form-control"/>
<f:link.action action="show" arguments="{user:user}" class="btn btn-secondary">back</f:link.action> <input type="submit" value="update" class="btn btn-success"/>
</f:form>
</section>
<section class="container">
<f:flashMessages/>
<f:if condition="{user}">
<h1>Show {user.name}</h1>
<ul>
<li>Github User: {user.github}</li>
<li>Facebook: {user.facebook}</li>
<li>twitter: {user.twitter}</li>
</ul>
<f:link.action action="edit" arguments="{user:user}" class="btn btn-primary" >Edit your profile</f:link.action>
</f:if>
</section>
<section class="container">
<h1>t3o Edit my profile {user.name}</h1>
<ul>
<li>Name: {user.firstName} {user.lastName}</li>
<li>Email: {user.email}</li>
<li>About me: {user.aboutMe}</li>
</ul>
</section>
<section class="container">
<h1>Our community</h1>
<f:debug>{frontendUsers}</f:debug>
<table>
<f:for each="{frontendUsers}" as="frontendUser">
<f:if condition="{frontendUser.publicProfile}">
<tr>
<td><f:link.action controller="UserProfile" action="show" arguments="{user:frontendUser}">{frontendUser.username}</f:link.action></td>
</tr>
</f:if>
</f:for>
</table>
</section>
{namespace userprofile=In2code\Userprofile\ViewHelpers}
{namespace slack=T3o\T3oSlack\ViewHelpers}
<section class="container">
<h1>{user.name}</h1>
<ul>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'name', user:user)}">
<li>Name: {user.name}</li>
</f:if>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'firstname', user:user)}">
<li>Firstname: {user.firstname}</li>
</f:if>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'lastname', user:user)}">
<li>Lastname: {user.lastname}</li>
</f:if>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'address', user:user)}">
<li>Street: {user.address}</li>
</f:if>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'zip', user:user)}">
<li>Zip: {user.zip}</li>
</f:if>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'city', user:user)}">
<li>City: {user.city}</li>
</f:if>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'telephone', user:user)}">
<li>Phone: {user.telephone}</li>
</f:if>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'email', user:user)}">
<li>Email: {user.email}</li>
</f:if>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'country', user:user)}">
<li>Country: {user.country}</li>
</f:if>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'www', user:user)}">
<li>www: {user.www}</li>
</f:if>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'image', user:user)}">
<f:for each="{user.image}" as="image">
<f:image image="{image}" maxWidth="800" />
</f:for>
</f:if>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'about_me', user:user)}">
<li>About me: {user.aboutMe}</li>
</f:if>
<f:if condition="{userprofile:isPropertyVisible(propertyName:'slack_id', user:user)}">
<li><slack:showSlackLink frontendUserUID="{user.uid}" /></li>
</f:if>
<f:if condition="{isOwnProfile}">
<f:render partial="ShowEdit" arguments="{_all}" />
</f:if>
</ul>
</section>
<svg xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" stroke-miterlimit="1.414" viewBox="0 0 64 64" width="64" height="64">
<path fill="#ff8700" fill-rule="nonzero" d="M46.37 42.73c-.84.247-1.51.34-2.39.34-7.205 0-17.784-25.177-17.784-33.556 0-3.085.73-4.114 1.76-4.997-8.817 1.03-19.397 4.265-22.78 8.378C4.446 13.925 4 15.54 4 17.6c0 13.08 13.962 42.76 23.81 42.76 4.558 0 12.24-7.49 18.56-17.633m-4.6-39.09c9.113 0 18.23 1.47 18.23 6.613 0 10.434-6.617 23.08-9.995 23.08-6.027 0-13.522-16.76-13.522-25.14 0-3.82 1.47-4.552 5.288-4.552"/>