{function name=show_warnings}
    {if count($values) > 0}
        {$warnings = $i.auth_oauth_login_no}
        {foreach item="warning" from=$values}
            {if (is_string($warning))}
                {$warnings = "{$warnings} {$warning}"}
            {else if is_array($warning)}
                {foreach item="warn" from=$warning}
                    {if $warn instanceof stdClass && isset($warn->text)}
                        {$warnings = "{$warnings} {$warn->text}"}
                    {/if}
                {/foreach}
            {/if}
        {/foreach}
        <span class="dialog_make_btn14 urgent1 ui-corner-all" title="{$warnings}"></span>
    {/if}  
{/function}
{function name=show_login_info login_infos=[]}
    <ul class="blockelement-menu" style="padding-left: 0; clear: both;">
        {foreach item="login_info" from=$login_infos}
            {$oauth_account = $login_info->id}
            <li class="dialog_make_text_btn ui-corner-all" 
                  {if $login_info->token===null || !$login_info->valid}style="color: #FF0000;"{/if}
                  title="{if $login_info->token===null || !$login_info->valid}{$i.auth_oauth_login}{else}{$i.auth_oauth_relogin}{/if}"
                  onclick="webApp.oauth.login({$oauth_account}, 'webApp.oauth.oauth_login_{$oauth_login_unique_id}_update');">
                    {us_substr($login_info->name, 0, 100)}
                    {if $login_info->is_old_login}
                        <span style="width: 100%; display: block; position: absolute; margin-top: -1.4em; font-size: 80%; text-align: center; color: #DD0000;" title="{$i.auth_oauth_old2}">
                            {$i.auth_oauth_old1}
                        </span>
                    {/if}
                <span 
                    style="float:right"
                    onclick="webApp.oauth.logout({$oauth_account}, 'webApp.oauth.oauth_logout_{$oauth_login_unique_id}_update');event.stopPropagation()" title="Bei OAuth 2.0 Server abmelden" class="dialog_make_btn16 logout smallbtns ui-corner-all"
                ></span>                    
                <span style="float:right">
                    {if $login_info->token===null || !$login_info->valid}
                        {if is_array($login_info->token_warnings) && !isset($login_info->token_warnings.No_token_info_error)}
                            {$butler_autorefresh="butler_autorefresh bar_{$oauth_account}"}
                        {else}
                            {$butler_autorefresh=''}
                        {/if}
                        <span style="width: 30px; display: inline-flex;" class="{$butler_autorefresh}">
                            {show_warnings values=$login_info->token_warnings}
                        </span>
                    {else}
                        <span class="only_fullscreen">
                            <span style="padding-right: 20px; width: 90px; display: inline-flex;" 
                                  {if isset($login_info->reclsec) && !is_bool($login_info->reclsec)}title="{$login_info->reclsec}"{/if}>
                                {if isset($login_info->reclsec)}
                                    {if $login_info->reclsec===false}
                                        {$login_info->internal_client_secret_date->us_date()}
                                    {elseif $login_info->reclsec===true}
                                        New
                                    {else}
                                        Error ({$login_info->internal_client_secret_date->us_date()})
                                    {/if}
                                {/if}
                            </span>
                            <span style="padding-right: 20px; width: 110px; display: inline-flex;">
                                {$login_info->login_date->us_date_time()}
                            </span>
                            <span style="padding-right: 20px; width: 110px; display: inline-flex;">
                                {$login_info->last_update->us_date_time()}
                            </span>
                            <span style="padding-right: 20px; width: 110px; display: inline-flex;">
                                {$login_info->expires_date->us_date_time()}
                            </span>
                        </span>
                        <span style="width: 30px; display: inline-flex;">
                            <span class="dialog_make_btn14 is_yes_2d ui-corner-all" title="{$i.auth_oauth_login_ok}"></span>
                        </span>
                    {/if}
                </span>
            </li>
        {/foreach}
    </ul>
{/function}

<div style="float:left">
    {$i.auth_oauth_login_do}:
</div>
<div style="float:right">
    <span class="only_fullscreen">
        <span style="padding-right: 20px; width: 90px; display: inline-flex;">
            Inter. Secret
        </span>
        <span style="padding-right: 20px; width: 110px; display: inline-flex;">
            {$i.auth_oauth_login_d}
        </span>
        <span style="padding-right: 20px; width: 110px; display: inline-flex;">
            {$i.auth_oauth_last_update}
        </span>
        <span style="padding-right: 20px; width: 110px; display: inline-flex;">
            {$i.auth_oauth_expires}
        </span>
    </span>
    <span title="{$i.auth_oauth_logged_in_l}" style="width: 35px; display: inline-flex;">
        {$i.auth_oauth_logged_in}
    </span>
</div>
{show_login_info login_infos=$email_login_infos}
{show_login_info login_infos=$o365_calendar_login_infos}
{show_login_info login_infos=$o365_login_infos}
{show_login_info login_infos=$dropbox_login_infos}
