cancel
Showing results for 
Search instead for 
Did you mean: 

Dashlets Examples

gaurav
Champ in-the-making
Champ in-the-making
I was wondering if I could find some example of a(web script) custom web client using a dashlet.

To my understanding dashlet functionality is my best bet to achieve ECM style functionality in WCM. I don't really know if my understanding is correct. Any suggestions are welcome

Thnanks,
Gaurav
3 REPLIES 3

typsy
Champ in-the-making
Champ in-the-making
Hi,

I found an useful link http://livinginjava.blogspot.com/2008/11/how-to-create-custom-dashlet-in.html
So thank to Santoso from the link we have an example of how to create a simple dashlet.

Just in case that this link won't be available in time I'll write here the main steps of creating a Hello World dashlet for Alfresco. (I am using Alfresco 3.0 and it worked for me):

Step by step on creating dashlet in Alfresco :

1. Create a freemarker template for the dashlet and name it filename.html.ftl (e.g. hello.html.ftl). For freemarker syntax please see http://freemarker.org/. Sample content :

<#assign name = person.properties.userName>
Hello ${name}

2. Save the file in tomcat\webapps\alfresco\WEB-INF\classes\alfresco\templates\, you could also a directory inside and put your file in your directory.

3. Create a jsp file that will include the template file created on step 1. The content of the jsp file would be :
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<r:template templatePath="/alfresco/templates/hello.html.ftl">
</r:template>

4. Save the jsp file in tomcat\webapps\alfresco\jsp\dashboards\dashlets.

5. Open web-client-config.xml, you can find it in tomcat\webapps\alfresco\WEB-INF\classes\alfresco.

6. Register the new dashlet, find "dashlets" (without quotes) in web-client-config.xml, add the following configuration :

<dashlet id="hello" label="Hello Dashlet"
     description="My Hello Dashlet"
     jsp="/jsp/dashboards/dashlets/hello.jsp">
</dashlet>

7. To see the new dashlet in action, just restart alfresco, login, configure the dashboard and pick the new dashlet.

Cheers!

typsy
Champ in-the-making
Champ in-the-making
Sorry, above at 3. I mean instead of
<r:template templatePath="/alfresco/templates/hello.html.ftl">
The correct form is:
<r:template template="/alfresco/templates/hello.html.ftl">

Thanks.

rshoemake
Champ in-the-making
Champ in-the-making
I didnt find this info very helpful at all.  The dashlet listed above doesn't appear as an available dashlet.