cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving site title from site shortname

fast3r
Champ on-the-rise
Champ on-the-rise
This is a very dumb question, but the Alfresco mechanism is not very clear to me.

How do I get the site title from the site shortname in a web script?
I simply need to show the site title instead of shortname in the 'my project activities' RSS feed descriptions.

I can't access the repository with the alfresco connector to get the site data when the user is connected only to alfresco-feed (for ex., when reading a feed with an external rss feed reader).
Can I call the getSite(shortname) method in a javascript? And how?

Thank you very much.
1 REPLY 1

fast3r
Champ on-the-rise
Champ on-the-rise
I answer myself as usual  Smiley Very Happy
This was enough for my needs, I can now call the repo with the alfresco-feed connector and retrieve site titles.

function getSiteTitle(siteid)
{
     // Call the correct repo script depending on the mode
     var connector, result =
     {
        status: 0
     };
 
     if (format.name == "html")
     {
        connector = remote.connect("alfresco");
     }
     else
     {
        // Use alfresco-feed connector as a basic HTTP auth challenge will be issued
        connector = remote.connect("alfresco-feed");
     }
     
         // Call the repo for sites the user is a member of
         var ressite = connector.get("/api/sites/" + stringUtils.urlEncode(siteid));
         if (ressite.status == 200)
         {
            // Create javascript objects from the server response
            var mySite = eval('(' + ressite + ')');
            siteTitle = mySite.title;
         }
         else
         {
            siteTitle = ""; 
         }
      
      return siteTitle;
}