Creating
Custom Dashlet
creating
custom dashlet is easy in alfresco share. Most common required
file(s) are as below:
- descriptor file (.desc.xml)
- main html template file (.html.ftl)
- js file (having logic for calling local or remote script) [optional]
- properties file [optional]
- head file [optional]Let we will create sample dashlet which will display current user name who logged in.
For
the starting point lets create these files in Out-of-box path :
alfresco\tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\dashlets
- loggeduser.get.desc.xml
This
file is descriptor file and define a webscript url through which it
will be called and display appropriate template.
<webscript> <shortname>Username Display Dashlet</shortname> <description>Demo dashlet for username display</description> <family>site-dashlet</family> <url>/components/dashlets/loggeduser</url> </webscript>
- loggeduser.get.html.ftl
This
file is html template or display area of the script. Content would be
displayed here.
<div class="dashlet"> <div class="title">Demo</div> <h3> Logged user : ${user.name}</h3> </div>
Now
check with your site dashboard area and click “customize dashboard”
button and select dashlet Username Display Dashlet.
Click
“OK”
done...!!!