{namespace v=FluidTYPO3\Vhs\ViewHelpers}
{namespace ot=Opentalent\OtTemplating\ViewHelpers}

<f:comment><!-- Panneau d'authentification ou espace utilisateur --></f:comment>

<ul>
    <f:security.ifAuthenticated>
        <f:then>
            <v:variable.set name="feuser" value="{ot:request.getFeUser()}"/>

            <li>
                <span><f:translate key="LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:welcome"/> <b>{feuser.username}</b>!</span>
            </li>
            <li>
                <a href="{ot:request.getOtEnvVar(argument: 'DASHBOARD_URL')}">
                    <f:translate key="LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:member-area-of-my-structure"/>
                </a>
            </li>
            <li>
                <f:link.page additionalParams="{logintype:'logout'}">
                    <f:translate key="LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:log-out"/>
                </f:link.page>
            </li>
        </f:then>
        <f:else>
            <li>
                <f:if condition="{ot:request.isCustomDomain()}">
                    <f:then>
                        <f:comment><!-- Because crossdomain auth could not be achieved properly until now,
                                    the login popup is shown for websites with custom domains --></f:comment>
                        <a href="#"
                           class="{f:if(condition: '{ot:loginFailed()}', then: 'trigger-on-load')}"
                           data-toggle="modal"
                           data-target="#loginModal">
                            <f:translate id="LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:login"/>
                        </a>
                    </f:then>
                    <f:else>
                        <a href="{ot:request.getOtEnvVar(argument: 'LOGIN_PAGE_URL')}"
                           target="_blank"
                           class="{f:if(condition: '{ot:loginFailed()}', then: 'trigger-on-load')}"
                        >
                            <f:translate id="LLL:EXT:ot_templating/Resources/Private/Language/locallang.xlf:login"/>
                        </a>
                    </f:else>
                </f:if>
            </li>
        </f:else>
    </f:security.ifAuthenticated>
</ul>
