AnsweredAssumed Answered

Help customizing Sites in Share's header...

Question asked by gregbpopstar on Nov 12, 2010
Latest reply on Mar 7, 2012 by dallimor
I'm customizing Share's "app-items" in it's header. 

First I read this great wiki article about the Share Header.

I found it was very easy to add a static "link" menu item to to sites Document Library on a site by site basis by adding the <header> section to the global config in share-config-custom.xml like this:


    <!– Global config section –>
    <config replace="true">

      <header>
         <app-items>

            <item type="link" id="test-site" label="Test Site" icon="sites.png">/site/test/documentlibrary</item>

         </app-items>

      </header>
    </config>
That worked, but the following is what I really want to do, but haven't had success with yet.

I want to modify the "Sites" javascript menu so the favorites links on the menu all deliver the user directly to the Document Library bypassing the each sites dashboard. 

I tried this by changing the following:
1. Copied the UriTemplate config section from share-config.xml into share-config-custom.xml and modified it adding a new uri-template.  Here's what I added with a coment by my new uri-template element:

   <config evaluator="string-compare" condition="UriTemplate" replace="true">
      <uri-templates>
         <uri-template id="sitedashboardpage">/site/{site}/dashboard</uri-template>
        
      <!– Adding the uri template below in at attempt to change the urls on the site menu making them go directly to the document library. –>
      <uri-template id="sitedocumentlibrarypage">/site/{site}/documentlibrary</uri-template>

         <uri-template id="sitepage">/site/{site}/{pageid}</uri-template>
         <uri-template id="userdashboardpage">/user/{userid}/dashboard</uri-template>
         <uri-template id="userpage">/user/{userid}/{pageid}</uri-template>
         <uri-template id="userprofilepage">/user/{userid}/profile</uri-template>
         <uri-template id="userdefaultpage">/user/{pageid}</uri-template>
         <uri-template id="consoletoolpage">/console/{pageid}/{toolid}</uri-template>
         <uri-template id="consolepage">/console/{pageid}</uri-template>
      </uri-templates>
   </config>
2. Next, I changed the _renderFavouriteSites function in /modules/header/sites.js file like this:


      _renderFavouriteSites: function Sites__renderFavouriteSites()
      {

         for (i = 0, ii = sites.length; i < ii; i++)
         {
            sitesMenu.addItem(
            {
               text: $html(this.options.favouriteSites[sites[i]]),
              
/* Using my new sitedocumentlibrarypage uri template instead of sitedashboardpage */
               url: Alfresco.util.uriTemplate("sitedocumentlibrarypage",
               {
                  site: sites[i]
               })
            }, 0);
         }

      },

I know I should have done #2 above in a new javascript file and then added it to the dependencies, but this is a test at this point.

To my disappointment, these 2 changes didn't make the Sites menu items link correctly and even caused the Document Library page on every site to be inaccessible.

Does anyone have suggestions on how I may be able to make this kind of idea work?

Thanks

Outcomes