<div id="inforight">
    <p>
        {include file='r_icons/external_warn.tpl'}
    </p>
    <p style="padding-top: 2em;">
        <a href="#" 
            class="dialog_make_text_btn ui-corner-all"
            onclick="masterdatamanagement.oauth.add_default_o365_account('ms_mail'); return false;">
            <span class="dialog_make_btn16 add"></span>{$i.masterdatamanagement_oauth_link_us_mail}</a>
    </p>
    <p>
        <a href="#" 
            class="dialog_make_text_btn ui-corner-all"
            onclick="masterdatamanagement.oauth.add_default_o365_account('ms_azure_365_cal'); return false;">
            <span class="dialog_make_btn16 add"></span>{$i.masterdatamanagement_oauth_link_us_calendar}</a>
    </p>  
    <p>
        <a href="#" 
            class="dialog_make_text_btn ui-corner-all"
            onclick="masterdatamanagement.oauth.add_default_o365_account('ms_azure_365'); return false;">
            <span class="dialog_make_btn16 add"></span>{$i.masterdatamanagement_oauth_link_us_corr}</a>
    <p>
    <br/>
        <h2>{$i.masterdatamanagement_azure_app}</h2>
        {if stripos(site_url(), 'https://') === 0 || stripos(site_url(), 'http://localhost') === 0}
            {if $azure_app_data instanceof stdClass}
                <table class="col2btn">
                    <tr>
                        <td>{$i.masterdatamanagement_client_id}</td>
                        <td>{$azure_app_data->app_id}</td>
                    </tr>
                    <tr>
                        <td>{$i.masterdatamanagement_client_secret_validity}</td>
                        <td>
                            {$azure_app_data->secret_end->us_date_time()}
                            {if datetime_diff_days($today, $azure_app_data->secret_end) <= 30}
                                <br />
                                <span class="warningsmall ui-corner-all" style="color: red">
                                    {$i.masterdatamanagement_client_secret_expires}
                                </span>
                            {/if}
                        </td>
                    </tr>
                </table>
            {/if}
            <a href="#" 
                class="dialog_make_text_btn ui-corner-all"
                onclick="webApp.oauth.create_azure_app(); return false;">
                <span class="dialog_make_btn16 add"></span>
                {if $azure_app_data instanceof stdClass}
                    {$i.masterdatamanagement_azure_app_update}
                    {else}
                    {$i.masterdatamanagement_azure_app_create}
                {/if}
                </a>    
        {else}
            <div class="warning ui-corner-all">
                {$i.masterdatamanagement_azure_app_no_https|markdown}
            </div>
        {/if}
    </p>    
    <p style="padding-top: 2em;">
        {include file='r/input.tpl' name="oauth_url" readonly="true" class="t-midlong"
            title='masterdatamanagement_oauth_url' default=site_url('/oauth')}
    </p>
    <p style="padding-top: 0.5em;">
        <a href="https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps" 
            class="dialog_make_text_btn ui-corner-all"
            onclick="window.open(this.href); return false;">
            <span class="dialog_make_btn16 internet"></span>{$i.masterdatamanagement_oauth_help_azure}</a>

        <a href="https://www.dropbox.com/developers" 
            class="dialog_make_text_btn ui-corner-all"
            onclick="window.open(this.href); return false;">
            <span class="dialog_make_btn16 internet"></span>{$i.masterdatamanagement_oauth_help_dropbox}</a>
    </p>
    <p style="padding-top: 2em;">
        {is_https_active_assign}
        {if !$https_active}
            <div class="warning ui-corner-all">
                {$i.pages_oauth_no_https|markdown}
            </div>
        {else}
            <div class="warningsmall ui-corner-all">
                {$i.pages_oauth_https|markdown}
            </div>
        {/if}
    </p>
    
    <p style="padding-top: 2em;">
        <a class="dialog_make_text_btn ui-corner-all"
            href="javascript:fullPopup.view('reporting', 'index', 'staff_oauth_tokens');">
            {$i.masterdatamanagement_staff_oauth_tokens}
        </a>
    </p>
</div>
