Search in sources :

Example 1 with OAuthDisplayName

use of org.olat.login.oauth.OAuthDisplayName in project OpenOLAT by OpenOLAT.

the class OAuthAuthenticationController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    for (OAuthSPI spi : oauthModule.getEnableSPIs()) {
        String spiName;
        int presentation;
        if (spi instanceof OAuthDisplayName) {
            spiName = ((OAuthDisplayName) spi).getDisplayName();
            presentation = Link.BUTTON | Link.NONTRANSLATED;
        } else {
            spiName = "login.".concat(spi.getName());
            presentation = Link.BUTTON;
        }
        FormLink button = uifactory.addFormLink(spiName, "login", spiName, null, formLayout, presentation);
        button.setIconLeftCSS(spi.getIconCSS());
        button.setElementCssClass("o_sel_auth_" + spi.getName());
        button.setUserObject(spi);
    }
}
Also used : OAuthDisplayName(org.olat.login.oauth.OAuthDisplayName) OAuthSPI(org.olat.login.oauth.OAuthSPI) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 2 with OAuthDisplayName

use of org.olat.login.oauth.OAuthDisplayName in project openolat by klemens.

the class OAuthAuthenticationController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    for (OAuthSPI spi : oauthModule.getEnableSPIs()) {
        String spiName;
        int presentation;
        if (spi instanceof OAuthDisplayName) {
            spiName = ((OAuthDisplayName) spi).getDisplayName();
            presentation = Link.BUTTON | Link.NONTRANSLATED;
        } else {
            spiName = "login.".concat(spi.getName());
            presentation = Link.BUTTON;
        }
        FormLink button = uifactory.addFormLink(spiName, "login", spiName, null, formLayout, presentation);
        button.setIconLeftCSS(spi.getIconCSS());
        button.setElementCssClass("o_sel_auth_" + spi.getName());
        button.setUserObject(spi);
    }
}
Also used : OAuthDisplayName(org.olat.login.oauth.OAuthDisplayName) OAuthSPI(org.olat.login.oauth.OAuthSPI) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Aggregations

FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)2 OAuthDisplayName (org.olat.login.oauth.OAuthDisplayName)2 OAuthSPI (org.olat.login.oauth.OAuthSPI)2