cancel
Showing results for 
Search instead for 
Did you mean: 

Need to customize the 'My Alfresco' page

theorbix
Confirmed Champ
Confirmed Champ
Hello, I need to customize the behaviour of the My Alfresco page in a way that the Navigator pane will always display the list of spaces under "Company Home".

I have looked around the .jsp pages, but I haven't found a way to implement this enhancement.

Does this change require some changes in a Java class? Can someone provide a hint at what I should modify?

Thanks in advance…
11 REPLIES 11

wabson
Star Contributor
Star Contributor
Hi,

Changing the behaviour of the navigator would be non-trivial and you would need at least a basic understanding of JSF. However, there is a setting in your user preferences to specify your initial start location when you log in. You can change the default value in web-client-custom.xml - take a look at web-client-config.xml in the webapp if you cannot find the right setting - you may need to copy it over.

Cheers,
Will.

theorbix
Confirmed Champ
Confirmed Champ
Thanks Will, but I have already customized the web-client-custom.xml file, and this is not enough for my needs.

I have modified the following tag

         <initial-location>myalfresco</initial-location>

And now My Alfresco is the default home page when users (or guests) access the Web Client.

Beside this, I have also created and defined two custom dashlets (one that shows the 10 most recently added or modified documents in the repository, and another that shows the content of a certain folder that contains frequently used documents).

This works well, and both my authenticated users and guest accounts now have a "home page" that uses this custom dashboard.

The problem is that, when in My Alfresco mode, the Navigator pane is basically empty (this happens because the "My Alfresco" node of the navigator clearly has no subspaces to show, so the three blue tabs with Company Home, My Alfresco and My Home are shown collapsed), and this is very confusing for my users.

So I really need to find a way to:
1) ensure that when users - or guests - access the Web Client for the first time, they see the My Alfresco page with my customizations (and this is already done thanks to the changes in web-client-custom.xml…)
2) when they are on the My Alfresco page, they should also be able to  seen and navigate in the tree of corporate spaces.
3) in the Navigator pane, I also need to hide the My Home tab, since it's also useless for my needs.

From your words, I guess that to achieve #2 and #3, it will not be easy and will require some knowledge of JSF, but it should be feasible.

I know that the basic answer could be "RTFM" ( 🙂 ), but can you give me some directions on what I should modify?

rosemaryl
Champ in-the-making
Champ in-the-making
Hi TheOrbix,

I also would like to accomplish what you want to do in #3.  Have you received any responses on this subject yet?  I'm going to take a look and will let you know if I find anything.

rosemaryl
Champ in-the-making
Champ in-the-making
I tried looking at ways to affect the Java beans that render the shelf navigation component, but there didn't seem to be anything I could use.  Instead of doing things server-side, I employed these little changes on the client-side:

In jsp/parts/titlebar.jsp, remove
<a:listItem value="userhome" label="#{msg.my_home}"/>
.  This will remove "My Home" from the toolbar at the top.

In jsp/sidebar/navigator.jsp, I added:


<script type="text/javascript">
   window.onload = hideMyHome;

function hideMyHome(){
   var links = document.getElementById("navigator").getElementsByTagName('div');
   
   for(var i=0; i<links.length; i++){
      if(links[i].innerHTML.indexOf("My Home") > 0){
         links[i].style.visible = 'false';
         links[i].style.display = 'none';
      }
   }
}
</script>

Which is a start, but since it waits until the document is loaded "My Home" still gets rendered but then gets removed, meaning it will flicker before disappearing. 

This is really hacky to me, and I'm not quite satisfied with it.  It would be really nice if there was a way to configure the navigator to hide certain elements. Smiley Happy

List of my resources:

theorbix
Confirmed Champ
Confirmed Champ
In jsp/parts/titlebar.jsp, remove
<a:listItem value="userhome" label="#{msg.my_home}"/>
.  This will remove "My Home" from the toolbar at the top.

There is a slightly better approach for this:

<a:listItem value="userhome" label="#{msg.my_home}"  rendered="#{!NavigationBean.isGuest}" />

In this way, the My Home link will be hidden, but only for the Guest users. I also used the same trick to hide the "User Options" icon for the Guest user:


an.isGuest}"
image="/images/icons/user_console.gif"
showLink="false"
action="dialog:userConsole"
actionListener="#{UsersBean.setupUserAction}"
id="alf_user_console">
<f:param name="id" value="#{NavigationBean.currentUser.person.id}" />
</a:actionLink>

Regarding your "hack" to modify the behaviour of the Navigator tree: I like it and is definitely better than nothing ( 🙂 ) but I hope that someone else in the Forum will give us some directions for a slightly more elegant implementation….

rosemaryl
Champ in-the-making
Champ in-the-making
Thanks TheOrbix,
I misread your requirements and just posted what I used for our project (we wanted to hide My Home from all users), but if someone did want to just hide it from guest users your solution is definitely more elegant. Smiley Happy

cbosdonnat
Champ in-the-making
Champ in-the-making
Hi rosemaryl,

Which is a start, but since it waits until the document is loaded "My Home" still gets rendered but then gets removed, meaning it will flicker before disappearing.

I agree with you. I had to remove the My Alfresco part of the navigator and I hacked the JSF tag of the navigator to do avoid this. You can find the details for the hack on my blog:

http://cedric.bosdonnat.free.fr/wordpress/?p=94&lang_view=en

Of course this is only one case, but it can help you to do what you want with the navigator. This hack has one more advantage: it's not depending on one locale.

HTH

theorbix
Confirmed Champ
Confirmed Champ
Thanks cbosdonnat, nice trick.

I was thinking that with some enhancements, this could become a setting configurable in web-client-config-custom.xml.

For instance:

   <config>
      <client>
         <show-myalfresco>true</show-myalfresco>
         <show-userhome>true</show-userhome>
      </client>
   </config>

cbosdonnat
Champ in-the-making
Champ in-the-making
Thanks cbosdonnat, nice trick.

You're welcome

I was thinking that with some enhancements, this could become a setting configurable in web-client-config-custom.xml

Of course this would be great. I'll try to see if I get to make it configurable… I'll post here again when I'll have a solution for this.

Regards