AnsweredAssumed Answered

understanding sites.get.js and modifying

Question asked by jaspervlb on May 22, 2013
Latest reply on May 23, 2013 by ddraper
Hi

I'm am trying to customize the alfresco header (4.2). First I want to try and modify the dropdown to list all sites the logged in user is a member of. Later on I can then modify the header to be a menu bar with different icons for each site.

Now I understand I have to edit sites.get.js in the header module. I also found this topic on the forum: http://forums.alfresco.com/forum/end-user-discussions/alfresco-share/modify-favorite-sites-dropdown-show-all-sites-04132011
but it is outdated. The code has changed already.

Can someone help me understand what happens?
<javascript>   // can optionally pass JSON list of fav sites if they are already known to the caller
   if (args.favsites)
   {
      favourites = eval('(' + args.favsites + ')');
   }</javascript>
When is this if-loop executed. When will this argument be passed? Is it a GET argument and will I see it in the address bar?

<javascript>
      prefs = eval('(' + preferences.value + ')');

      // Populate the favourites object literal for easy look-up later
      favourites = eval('try{(prefs.' + PREF_FAVOURITE_SITES + ')}catch(e){}');
</javascript>
What does this piece of code do? I can not find explanations in the javascript API's. Am I looking in the wrong place? Where can I find documentation on this prefs object. So I can see how to modify <javascript>const PREF_FAVOURITE_SITES = "org.alfresco.share.sites.favourites";</javascript> to list all sites.

<javascript>
   var connector = remote.connect("alfresco");
   result = connector.post("/api/sites/query", jsonUtils.toJSONString(query), "application/json");
</javascript>

Also I could not find documentation on this sites/query possibility. How can I find what queries are possible and how I need to format them.

Thanks!

Outcomes