How to remove the "Get Started" from the dashboard in code

cancel
Showing results for 
Search instead for 
Did you mean: 
raghunandangowd
Active Member II

How to remove the "Get Started" from the dashboard in code

Hello,

I want to hide the "Get Started" menu which will be redirecting to quick tour. It should not visible to any users. So where I'm supposed to comment this in code. I'm new to alfresco, Please find the attached snapshot my dashboard. I want to remove the highlighted area which is marked in red color. please help me out.

Thanks in advance,

Raghu

7 Replies
douglascrp
Advanced II

Re: How to remove the "Get Started" from the dashboard in code

You should be learning how to extend a webscript.

In your specific case, you have to extend the dynamic-welcome webscript.

The souce code is available at share/dynamic-welcome.get.html.ftl at 2d4d902c1de5010e5467dbd75669638214dd686c · Alfresco/share · Gi... 

The easier way to change it is to use the web-extension to load your custom webscript controller replacing the following:

share/dynamic-welcome.get.js at 2d4d902c1de5010e5467dbd75669638214dd686c · Alfresco/share · GitHub 

Enforce the variable to be always false, like:

model.showDashlet = false;

raghunandangowd
Active Member II

Re: How to remove the "Get Started" from the dashboard in code

Hi Douglas,

I changed according to your suggestion and the code link which you shared. But still I'm not getting the result which i needed. Please help me out

douglascrp
Advanced II

Re: How to remove the "Get Started" from the dashboard in code

The idea was not to simply "replace" the value, but use the right mechanism to create a proper extension, which would set the value for you.

You can find information on how to do so by reading the docs at Customizing (Web Script Controller) the WebView dashlet on the Dashboard page | Alfresco Documentati... 

In the link above you can see how to correctly extend one of the existing dashlets, and you can try to apply it to the dashlet you want to change.

If you want us to take a look on what is wrong with your code, then you should share it here. Without that, it will be impossible, unless someone is willing to do it for you.

So, please, share what and how you did it.

raghunandangowd
Active Member II

Re: How to remove the "Get Started" from the dashboard in code

<@markup id="css" >
   <#-- CSS Dependencies -->
   <@link rel="stylesheet" type="text/css" href="${url.context}/res/components/dashlets/dynamic-welcome.css" group="dashlets" />
</@>

<@markup id="js">
   <#-- JavaScript Dependencies -->
   <@script type="text/javascript" src="${url.context}/res/components/dashlets/dynamic-welcome.js" group="dashlets"/>
</@>

<@markup id="widgets">
   <@createWidgets group="dashlets"/>
</@>

<@markup id="html">
   <@uniqueIdDiv>
      <#if showDashlet>
         <#assign el=args.htmlid?html>
         <div id="${el}-get-started-panel-container" class="dashlet dynamic-welcome<#if args.dashboardType = "user"> alf-user-welcome</#if>">
            <div class="alf-welcome-hide-button">
                <span id="${el}-hide-button" class="yui-button yui-push-button">
                    <span class="first-child">
                        <button>${msg(args.dashboardType + ".welcome.close")}</button>
                    </span>
                </span>
            </div>
            <div class="welcome-body">

               <#-- OVERVIEW CONTAINER -->
               <@markup id="overviewContainer">
                  <div class="welcome-info">
                     <h1>${msg(title, user.fullName, site)?html}</h1>
                     <#if description??>
                        <p class="welcome-info-text">${msg(description)}</p>
                     </#if>
                     <#if args.dashboardType = "site">
                        <h2>${msg("get.started.message")}</h2>
                     </#if>
                  </div>
               </@markup>

               <#if args.dashboardType = "site">
                   <#-- DESCRIPTIONS CONTAINER -->
                   <@markup id="actionsContainer">
                      <div>
                         <div class="welcome-right-container">
                            <div class="welcome-middle-right-container welcome-border-container">
                               <div class="welcome-middle-left-container welcome-border-container">
                                  <div class="welcome-left-container welcome-border-container">
                                     <#list columns as column>
                                        <#if column??>
                                           <div class="welcome-details-column welcome-details-column-${column_index}">
                                              <div class="welcome-details-column-image">
                                                 <img src="${url.context}${column.imageUrl}"/>
                                              </div>
                                              <div class="welcome-details-column-info">
                                                 <h3>${msg(column.title)}</h3>
                                                 <#-- The following section allows us to insert arguments into the
                                                   description using the "descriptionArgs" property of the column
                                                   data. We construct a FreeMarker expression as a string iterating
                                                   over any supplied arguments and then evaluate it. -->
                                                 <#assign descArgs = "msg(column.description" />
                                                 <#if column.descriptionArgs??>
                                                    <#list column.descriptionArgs as x>
                                                       <#assign descArgs = descArgs + ",\"" + x?rtf?html + "\"">
                                                    </#list>
                                                 </#if>
                                                 <#assign descArgs = descArgs + ")">
                                                 <#assign displayText = descArgs?replace("{", "'{'")?replace("}", "'}'")?eval>
                                                 <p class="welcome-details-column-info-text">${displayText?replace("%7B", "{")}</p>
                                              </div>
                                              <div class="welcome-height-adjuster" style="height:0;"> </div>
                                           </div>
                                        </#if>
                                     </#list>
                                  </div>
                               </div>
                            </div>
                         </div>
                         <div class="welcome-height-adjuster" style="height:0;"> </div>
                      </div>
                   </@markup>
    
                   <#-- ACTIONS -->
                   <@markup id="actionsContainer">
                      <div class="welcome-details">
                         <div class="welcome-right-container">
                            <div class="welcome-middle-right-container">
                               <div class="welcome-middle-left-container">
                                  <div class="welcome-left-container">
                                     <#list columns as column>
                                        <#if column??>
                                           <div class="welcome-details-column welcome-details-column-${column_index}">
                                              <div class="welcome-details-column-info">
                                                 <#if column.actionMsg??>
                                                    <div class="welcome-details-column-info-vertical-spacer"></div>
                                                    <a <#if column.actionId??>id="${el}${column.actionId}" </#if>
                                                       <#if column.actionHref??>href="${column.actionHref}" </#if>
                                                       <#if column.actionTarget??>target="${column.actionTarget}" </#if>>
                                                          <span>${msg(column.actionMsg)}</span>
                                                    </a>
                                                 <#else>
                                                    <div class="welcome-details-column-info-vertical-spacer"></div>
                                                 </#if>
                                              </div>
                                           </div>
                                        </#if>
                                     </#list>
                                  </div>
                               </div>
                            </div>
                         </div>
                         <div class="welcome-height-adjuster"> </div>
                      </div>
                   </@markup>
               </#if>
            </div>
          </div>
      </#if>
   </@>
</@>

This is my dynamic-welcome.get.html.ftl fle. I think, i need to remove or comment the highlighted text. So confirm this Douglas C. R. Paes‌.

And the below code is dynamic-welcome.get.js file. Please have a look at it bro..

function main()
{
   // Define a set of functions to return common column settings...
   function getTutorialColumn()
   {
      var docsEdition = context.properties["docsEdition"].getValue();
      var tutorial = msg.get("share-tutorial.docs-url", [docsEdition]);
      return (
      {
         title: "welcome.user.tutorial.title",
         description: "welcome.user.tutorial.description",
         imageUrl: "/res/components/images/help-tutorial-bw-64.png",
         actionMsg: "welcome.user.tutorial.link",
         actionHref: tutorial,
         actionId: null,
         actionTarget: "_blank"
      });
   }

   function getSiteColumn()
   {
      return (
      {
         title: "welcome.user.sites.title",
         description: "welcome.user.sites.description",
         imageUrl: "/res/components/images/help-site-bw-64.png",
         actionMsg: "welcome.user.sites.link",
         actionHref: "#",
         actionId: "-createSite-button",
         actionTarget: null
      });
   }

   function getProfileColumn()
   {
      return (
      {
         title: "welcome.user.profile.title",
         description: "welcome.user.profile.description",
         imageUrl: "/res/components/images/help-avatar-bw-64.png",
         actionMsg: "welcome.user.profile.link",
         actionHref: page.url.context + "/page/user/profile#edit",
         actionId: null,
         actionTarget: null
      });
   }

   function getSiteInfoColumn(siteTitle, actionMsg, actionHref)
   {
      return (
      {
         title: "welcome.site.dashboard.title",
         description: "welcome.site.dashboard.description",
         descriptionArgs: [siteTitle],
         imageUrl: "/res/components/images/help-dashboard-bw-64.png",
         actionMsg: actionMsg,
         actionHref: actionHref,
         actionId: null,
         actionTarget: null
      });
   }

   function getUploadInfoColumn()
   {
      return (
      {
         title: "welcome.site.upload.title",
         description: "welcome.site.upload.description",
         imageUrl: "/res/components/images/help-share-bw-64.png",
         actionMsg: "welcome.site.upload.link",
         actionHref: "documentlibrary#upload",
         actionId: "-upload-button",
         actionTarget: null
      });
   }

   function getInviteColumn()
   {
      return (
      {
         title: "welcome.site.invite.title",
         description: "welcome.site.invite.description",
         imageUrl: "/res/components/images/help-people-bw-64.png",
         actionMsg: "welcome.site.invite.link",
         actionHref: "invite",
         actionId: "-invite-button",
         actionTarget: null
      });
   }

   function getModeratedSiteColumn()
   {
      return (
      {
         title: "welcome.site.moderated.title",
         description: "welcome.site.moderated.description",
         imageUrl: "/res/components/images/help-site-bw-64.png",
         actionMsg: "welcome.site.moderated.link",
         actionHref: "#",
         actionId: "-requestJoin-button",
         actionTarget: null
      });
   }

   function getSiteMembersColumn()
   {
      return (
      {
         title: "welcome.site.members.title",
         description: "welcome.site.members.description",
         imageUrl: "/res/components/images/help-people-bw-64.png",
         actionMsg: "welcome.site.members.link",
      actionHref: "site-members",
         actionId: null,
         actionTarget: null
      });
   }

   function getBrowseSiteColumn()
   {
      return (
      {
         title: "welcome.site.browse.title",
         description: "welcome.site.browse.description",
         imageUrl: "/res/components/images/help-site-bw-64.png",
         actionMsg: "welcome.site.browse.link",
         actionHref: "documentlibrary",
         actionId: null,
         actionTarget: null
      });
   }

   function getCloudSignUpColumn()
   {
      return (
      {
         title: "welcome.cloud.sign-up.title",
         description: "welcome.cloud.sign-up.description",
         imageUrl: "/res/components/images/help-cloud-bw-64.png",
         actionMsg: "welcome.cloud.sign-up.link",
         actionHref: "http://www.alfresco.com/cloud?utm_source=AlfEnt4&utm_medium=anchor&utm_campaign=claimnetwork",
         actionId: null,
         actionTarget: "_blank"
      });
   }

   model.showDashlet = true;
   model.userIsMember = false;
   model.userIsSiteManager = false;
   model.userIsSiteConsumer = false;

   // This WebScript will render welcome dashlets for both user and site dashboards, however
   // since each is handled differently we need to determine which type is being rendered.
   // This should be defined in a component property called "dashboardType" which should be
   // either "user" or "site"...
   var dashboardId, dashboardUrl, columns = [];
   if (args.dashboardType == "user")
   {
      dashboardId = "user/" + user.name + "/dashboard";
      dashboardUrl = "user/" + encodeURIComponent(user.name) + "/dashboard";

      model.siteURL = ""; // Not needed for user

      model.title="welcome.user";
      model.description="welcome.user.description";

      columns[0] = getTutorialColumn();
      columns[1] = getSiteColumn();
      columns[2] = getProfileColumn();
   }
   else if (args.dashboardType == "site")
   {
      // Each user has their dashboard configuration in the sitedata, and there
      // is only one configuration for each site dashboard. Whether or not it is
      // displayed is determined by user preferences. Before going any further we
      // need to establish whether the welcome dashlet should even be displayed.
      var hideDashlet = false,
          profile;

      try
      {
         // Call the repository for the site profile
         var json = remote.call("/api/sites/" + page.url.templateArgs.site);
         profile =
         {
            title: "",
            shortName: "",
            visibility: "PUBLIC"
         };

         if (json.status == 200)
         {
            // Create javascript objects from the repo response
            var obj = JSON.parse(json);
            if (obj)
            {
               profile = obj;
               model.siteNodeRef = obj.node;
            }
         }

         // Request the current user's preferences to determine whether or not
         // the dashlet should be displayed...
         var prefs = jsonUtils.toObject(preferences.value);
         // Populate the preferences object literal for easy look-up later
         var dashletprefs = eval('try{(prefs.org.alfresco.share.siteWelcome)}catch(e){}');
         if (typeof dashletprefs != "object")
         {
            dashletprefs = {};
         }
         else
         {
            // replace the forward slash "/" and dot "." characters with dash "-"
            hideDashlet = dashletprefs[profile.node.substring(1).replace(/\/|\./g, "-")] != null;
         }
      }
      catch (e)
      {
      }
   
      if (hideDashlet)
      {
         // If the user has opted not to see the welcome dashlet for this site dashboard then
         // hide the component...
         model.showDashlet = false;
      }
      else
      {
         // If there are no site welcome dashlet preferences configured for the current user
         // or the user prefers to see the welcome dashlet then continue with the rendering...
         dashboardId = "site/" + page.url.templateArgs.site + "/dashboard";
         dashboardUrl = dashboardId;
         model.siteURL = page.url.templateArgs.site;
   
         var siteTitle = (profile.title != "") ? profile.title : profile.shortName;
   
         model.site = siteTitle;
         model.title="welcome.site";
         model.description="welcome.site.description";
   
         // Call the repository to see if the user is site manager or not
         var userIsSiteManager = false,
            userIsMember = false,
            userIsSiteConsumer = true,
            obj = null;
   
         json = remote.call("/api/sites/" + page.url.templateArgs.site + "/memberships/" + encodeURIComponent(user.name));
         if (json.status == 200)
         {
            obj = JSON.parse(json);
         }
         if (obj)
         {
            userIsMember = true;
            userIsSiteManager = obj.role == "SiteManager";
            userIsSiteConsumer = obj.role == "SiteConsumer";
            model.userIsMember = userIsMember;
            model.userIsSiteManager = userIsSiteManager;
            model.userIsSiteConsumer = userIsSiteConsumer;
         }
   
         // Configure the columns in the dashlet based on the users ownership and access rights...
         if (userIsSiteManager)
         {
            // Configure the dashlet for a site manager...
            columns[0] = getSiteInfoColumn(siteTitle, "welcome.site.dashboard.link", "customise-site-dashboard");
            columns[1] = getInviteColumn();
            columns[2] = getUploadInfoColumn();
         }
         else if (userIsMember)
         {
            columns[0] = getBrowseSiteColumn();
            columns[1] = getSiteMembersColumn();
               
            if (userIsSiteConsumer)
            {
               // Configure the 3rd column for a user with read access...
               columns[2] = getProfileColumn();
            }
            else
            {
               // Configure the 3rd column for a user with write access...
               columns[2] = getUploadInfoColumn();
            }
         }  
         else if (profile.visibility == "MODERATED")
         {
            // Configure the dashlet for a moderated site
            columns[0] = getModeratedSiteColumn();
            columns[1] = getSiteMembersColumn();
            columns[2] = null;
         }
         else
         {
            model.showDashlet = false;
         }
      }
   }

   columns.push(getCloudSignUpColumn());

   model.columns = columns;
   model.dashboardUrl = dashboardUrl;
   model.dashboardId = dashboardId;
   model.dashboardType = args.dashboardType;
   var docsEdition = context.properties["docsEdition"];

   // Widget instantiation metadata...
   var dynamicWelcome = {
      id : "DynamicWelcome",
      name : "Alfresco.dashlet.DynamicWelcome",
      initArgs : ["\"" + args.htmlid + "\"",
                  "\"" + model.dashboardUrl + "\"",
                  "\"" + model.dashboardType + "\"",
                  "\"" + (model.siteNodeRef == null ? "" : model.siteNodeRef) + "\"",
                  "\"" + (model.site == null ? "" : encodeURIComponent(jsonUtils.encodeJSONString(model.site))) + "\"",
                  "\"" + docsEdition.getValue() + "\""]
   };
   model.widgets = [dynamicWelcome];
}

main();

douglascrp
Advanced II

Re: How to remove the "Get Started" from the dashboard in code

Hello.

In fact, in order to achieve that, you need a way simpler solution.

Instead of trying to explain everything to you, I decided to create a sample project which does exactly what you need.

It is hosted at GitHub - douglascrp/alfresco-share-remove-dynamic-welcome: A simple project intended to show how to ... 

What the project does, basically, is:

Please, grab it and try to understand how it works.

If you need help with it, come back and ask specific questions

douglascrp
Advanced II

Re: How to remove the "Get Started" from the dashboard in code

I forgot to mention you can enable/disable the extension without restarting Alfresco.

Just browse to http://serverSmiley Tongueort/share/page/modules/deploy and move the module remove-dynamic-welcome into Available or Disabled Modules columns.

Click Apply Changes and refresh the browser.

raghunandangowd
Active Member II

Re: How to remove the "Get Started" from the dashboard in code

I did it Douglas C. R. Paes‌,

I just commented the body of function getTutorialColumn() in dynamic-welcome.get.js.

Now it is not redirecting me to external link.

Thanks,

Raghu