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...!!!
Good to start.
ReplyDeletesimple and very helpful! think you
ReplyDeleteafter adding this 2 files to the specified path and restarting alfresco i still couldn't find the dashlet
ReplyDeleteHope you adding your dashlet from customize dashboard button.
DeletePlease try again and make sure the given path is perfect. It should work.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteI am new to Alfresco, Where I can get the all the property values like ${user.name}. means If I need the user location to display, then where can I get to know that there is a property value for location.?
ReplyDeleteSiddharth,
DeleteWhat mean you want user location ? you can get reference from : http://wiki.alfresco.com/wiki/3.0_JavaScript_API
There are few public API available for JS.