Thursday, September 17, 2009

Changing the landing tab for a Lotus Connections 2.5 feature


We had a customer, that wanted that the Homepage feature's default tab should be the "My Page" tab not the Update tab as it is per default. The InfoCenter mentions, that you could add additional links to the navigation bar by editing the header.html. Another entry mentions, if you want to edit the application links themselves, you have to set the href attributes in the LotusConnections-config.xml. However, the latter SHOULD NOT be used, to modify the landing page because the href attribute refers to the application ROOT entry. For instance, if you change this for the homepage feature, the static widget resources which are searched relative to this root are not found. So use this setting only for pointing to a different server or a different context root.


So the first link was of more use, to edit the header.html directly. But, it only mentions to add additional links not to modify existing one. However, by using a simple JavaScript snippet, it is possible to alter the generated links after display. Simpy insert the following snippet into the header.html right after {{application links: li }}.


<script type="text/javascript">
function changeHomepageLink() {

var homePageLink = null;
var homePageLink = document.getElementById('lotusBannerHomepage');


if(homePageLink != null) {
var link = homePageLink.firstChild;
var hrefAttr = link .getAttribute('href');
var newHrefAttr = hrefAttr + '/web/widgets';
link .setAttribute('href', newHrefAttr);
}
}
changeHomepageLink();
</script>

Actually, we don't know if that is the official or correct way to do so, but it works. The "welcome" page is defined in the web.xml of the web application. Another way to change this would be to change the web.xml of the war file and redeploy it, though, this seemed a little too risky to us.


Post a Comment