2
votes

Is there a way to get the logo clickable when using the application layout? Most web sites go back to the home page when clicking the logo at the top, and my users are asking for this. Couldn't figure out how to it... I'm pretty sure it has to do with the submittedValue, but how do you set it for the logo? Or it may be something totally different, not sure.

I found this: onClick Event Banner in Application Layout but I am not sure I want to add some client side JavaScript to all pages. There must be a better way.

1

1 Answers

6
votes

Add a class productLogoClass="applicationLogo" to your logo like shown here.

Add a client side onclick event for this class which executes a partial refresh on an empty panel. This panel has a rendered property which always returns true but executes additional code if partial refresh was executed by client side onclick event.

<xe:applicationLayout
    ...
    <xe:this.configuration>
        <xe:oneuiApplication
            productLogo="/logo.png"
            productLogoClass="applicationLogo">
            ...
        </xe:oneuiApplication>
    </xe:this.configuration>
</xe:applicationLayout>
<xp:eventHandler
    event="onClientLoad"
    submit="false">
    <xp:this.script><![CDATA[var applicationLogo = dojo.query('.applicationLogo')[0];
        applicationLogo.onclick = function() {
        XSP.partialRefreshGet("#{id:onClickApplicationLogo}", 
            {params: {'onClickApplicationLogo': true}})
        }
    ]]></xp:this.script>
</xp:eventHandler>
<xp:panel id="onClickApplicationLogo">
    <xp:this.rendered><![CDATA[#{javascript:
        if (param.onClickApplicationLogo) {
            print("onClick application icon");
            context.redirectToPage("Home.xsp");
        }
        return true;}]]>
    </xp:this.rendered>
</xp:panel>

In this example it writes "onClick application icon" to server console and redirects to "Home.xsp".