cancel
Showing results for 
Search instead for 
Did you mean: 

Hide Create Site link in dashboard/dashlet

irene08
Champ in-the-making
Champ in-the-making
Hi! Good Day!


Does anyone knows how to hide 'Create site' in 'My site' dashboard/dashlet? What file–> js/xml should I customize?


Thank you,
Irene
5 REPLIES 5

romschn
Star Collaborator
Star Collaborator
You can modify/override below files to hide create site link.

My Sites dashlet - site-webscripts/org/alfresco/components/dashlet/my-sites.get.html.ftl
Top header - site-webscripts/org/alfresco/modules/sites.get.html.ftl

Thanks,

michaelc
Champ on-the-rise
Champ on-the-rise
A little more detail - in the js module
function main()
{
   createSite = false

       var result = remote.call("/api/people/" + stringUtils.urlEncode(user.name) + "?groups=true");
       if (result.status == 200)
          {
           var i;         
          
          // Create javascript objects from the server response
          // This is the User and it also contains all groups.
           var userValue = eval('(' + result + ')');
        
         
           if (userValue.groups.length != 0)
              {

                 for (i = 0; i < userValue.groups.length; i++)
                 {
                      if (userValue.groups[i].itemName == "GROUP_ALFRESCO_ADMINISTRATORS") createSite = true;
                      if (userValue.groups[i].itemName == "GROUP_CreateSiteAdministrator") createSite = true;
                 }
              }           

          }
   
   // Check for IMAP server status
   var result = remote.call("/imap/servstatus"),
      imapServerEnabled = (result.status == 200 && result == "enabled");

   // Prepare the model for the template
   model.imapServerEnabled = imapServerEnabled;
   model.createSite = createSite;
}

main();

then in the HTML file
            <span class="first-child">
               <#if createSite>
               <a href="#" id="${id}-createSite-button" class="theme-color-1">
                  <img src="${url.context}/res/components/images/site-16.png" style="vertical-align: text-bottom" />
                  ${msg("link.createSite")}</a>
               </#if>     
            </span>

irene08
Champ in-the-making
Champ in-the-making
You can modify/override below files to hide create site link.

My Sites dashlet - site-webscripts/org/alfresco/components/dashlet/my-sites.get.html.ftl
Top header - site-webscripts/org/alfresco/modules/sites.get.html.ftl

Thanks,


Thank you. I appreciate Smiley Happy

Irene

irene08
Champ in-the-making
Champ in-the-making
A little more detail - in the js module
function main()
{
   createSite = false

       var result = remote.call("/api/people/" + stringUtils.urlEncode(user.name) + "?groups=true");
       if (result.status == 200)
          {
           var i;         
          
          // Create javascript objects from the server response
          // This is the User and it also contains all groups.
           var userValue = eval('(' + result + ')');
        
         
           if (userValue.groups.length != 0)
              {

                 for (i = 0; i < userValue.groups.length; i++)
                 {
                      if (userValue.groups[i].itemName == "GROUP_ALFRESCO_ADMINISTRATORS") createSite = true;
                      if (userValue.groups[i].itemName == "GROUP_CreateSiteAdministrator") createSite = true;
                 }
              }           

          }
   
   // Check for IMAP server status
   var result = remote.call("/imap/servstatus"),
      imapServerEnabled = (result.status == 200 && result == "enabled");

   // Prepare the model for the template
   model.imapServerEnabled = imapServerEnabled;
   model.createSite = createSite;
}

main();

then in the HTML file
            <span class="first-child">
               <#if createSite>
               <a href="#" id="${id}-createSite-button" class="theme-color-1">
                  <img src="${url.context}/res/components/images/site-16.png" style="vertical-align: text-bottom" />
                  ${msg("link.createSite")}</a>
               </#if>     
            </span>


Thank you for your help. I appreciate. Smiley Happy Can I ask something about executing script? If you could help me also. Thanks.

Irene Smiley Happy

deeps
Champ in-the-making
Champ in-the-making
Hi,

i did above to hide create site link, and its working fine,

but if i deploy any amp, then all changes are reverted back to original.

so can any one tell me what can i do this to solve above problem????


Thanks in advance

Regards: Deepak