How do you change the Repository link on Alfresco Share?

Go To


In Alfresco Share, when you click the "Repository" icon in the toolbar, you're taken to:


I would like to change this link to take the user to their home folder, example:


I figured this would be a simple change, however, I'm pulling my hair out trying to figure out how to change the link. Does anyone know what I edit to change that link?

Update: So I can update the link via the share-config-custom.xml file, changing this line:

<item type="link" id="repository">/repository</item>

But I'm not sure how to get the folder path information in there. Does anyone have any ideas?

2012-04-04 16:42
by patorjk


This was surprisingly difficult, so I figured I'd post what I did in case anyone else has the same problem.

If you're not using hashed home folders, you can provide this functionality by simply updating your share-config.xml or share-config-custom.xml like so:

<item type="link" id="repository">/repository#filter=path|/User%2520Homes/{userid}</item>

However, if you're using hashed home folders, things become a little tricky. Instead of modifying any XML files, you'll instead create a web script to get the user's home folder path and then modify the share template file to replace the links to the repository. Below is a sample web script and the modifications to the template file that are needed in order to do this.


    <shortname>Home Folder Path</shortname>
    <description>Description here.</description>
    <format default="json">argument</format>


This script traverses up the node tree and puts together the folder's path.

var myPerson = person;//used people.getPerson("patrick.j.gillespie") for testing
var currentNode =;
var myDir =["{}name"];
var count = 0;

while (count < 100) { // prevent an infinite loop
    currentNode = currentNode.parent;
    if (currentNode === undefined || currentNode === null) {break;}
    if ( === undefined) {break;}
    myDir =["{}name"] + "/" + myDir;
if (count === 100) { //something went wrong
    myDir = "";

model.homeFolder = myDir;


   "homeFolder": "${homeFolder}"

Finally, you'll need to modify the "alfresco-template.ftl" file, located in "share/WEB-INF/classes/alfresco/templates/org/alfresco/include". Near the bottom of the file, add the code below. It will call the above web script to fetch the home folder path, and then update the Repository links with the home folder link.

<script type="text/javascript">
    var callback = {
        success: function(res) {
            var data = YAHOO.lang.JSON.parse(res.responseText);
            var homeFolder = "";
            var hfIndex = data.homeFolder.indexOf("/User Homes/");
            if (hfIndex !== -1) {
                homeFolder = data.homeFolder.substr(hfIndex+12);

            var repoLinks = $("a[title='Repository']");
            for (var ii = 0; ii < repoLinks.length; ii++) {
                repoLinks.get(ii).href = "/share/page/repository#filter=path|/User%2520Homes/" + homeFolder;
    var sUrl = Alfresco.constants.PROXY_URI + "demo/get-home-folder-path";
    var postData = "";
    var getData = "";
    var request = YAHOO.util.Connect.asyncRequest('GET', sUrl+getData, callback, postData);

There may possibly be a better way, but I was unable to find it. I'll probably refine it later, and this should mostly just be used as a starting point, but I figured I'd post it in case anyone had a similar problem.

2012-04-05 20:58
by patorjk


Although not super elegant, I guess you can append parameters or anchors using a Javascript onclick handler on the link. Not quite sure which webscript renders the toolbar, but that one may be a good place to put the customization.

2012-04-05 05:21
by Andreas Steffan
I think this will ultimately be what I end up doing (dynamically updating the link on the client side). It looks like the "replaceUriTokens" in header-min.js is where the link is set. However, modifying that could open a can of worms when I update Alfresco down the road. Plus I still have to find a way to get the home folder path (possibly with a custom web script via an AJAX call). I'll have to think about this for a bit - patorjk 2012-04-05 14:02