Introductiontoalfrescodashlets 111015062135-phpapp02

333 views
288 views

Published on

Published in: Technology, Design
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
333
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introductiontoalfrescodashlets 111015062135-phpapp02

  1. 1. Introduction to Alfresco Dashlets for beginnersJordi Vilaplana - Computer Engineer @vjordi gatasuna@gmail.com http://jordiv.com
  2. 2. What is a dashlet?"A dashlet is an application that appears in the Alfresco dashboard that presents informationto the user." My Sites dashlet
  3. 3. How it works?
  4. 4. Files involved - Naming conventionsTo create a dashlet we need to decide three things ● Dashlets name ● HTTP method used to call the dashlet ● Presentation format for the responseAll dashlet files start with the name of the dashlet
  5. 5. Files involved - Naming conventions
  6. 6. Files involved - Naming conventions● mydashlet.get.desc.xml: Descriptor file● mydashlet.get.js: Model file, where we put the logic● mydashlet.get.html.ftl: View file for the presentation● mydashlet.properties: Properties file
  7. 7. Files involved - One file at a timemydashlet.get.desc.xml<webscript> <shortname>My Dashlet</shortname> <description>A dashlet that does nothing</description> <family>user-dashlet</family> <url>/jordiv/components/dashlets/mydashlet</url></webscript> ● shortname: A user-friendly name ● description: A short description ● family: One of user-dashlet, site-dashlet or dashlet ● url: URL used to access the dashlet
  8. 8. Files involved - One file at a timemydashlet.get.jsfunction main() { model.name = "Jordi";}main();All what we put inside the model variable will be availablein the view.
  9. 9. Files involved - One file at a timemydashlet.get.html.ftl<script type="text/javascript">//<![CDATA[ new Alfresco.widget.DashletResizer("${args.htmlid}", "${instance.object.id}");//]]</script><div class="dashlet"> <div class="title">${msg("label.title")}</div> <div class="body scrollable"> <p>${msg("label.hello")} ${name!}!</p> </div></div>We can access the strings defined in the properties filesusing the msg variable, and use variables from the model
  10. 10. Files involved - One file at a timemydashlet.propertieslabel.title=My Dashletlabel.hello=HelloWe should put all the strings of our dashlet in theproperties file, so it can be easily translatedSupport for more languages can be added creating moreproperties files: ● mydashlet_ca.properties ● mydashlet_es.properties
  11. 11. Deploy to Alfresco ShareCopy all four files inside:<ALF_HOME>/tomcat/shared/classes/alfresco/web-extension/site-webscripts/com/jordiv/Replace com/jordiv by your domainRestart Alfresco Share or click the "Refresh Web Scripts" button (http://<server>:8080/share/page/index) and it will be available in userscustomize dashboardThis is not the best way to deploy a dashlet into Alfresco Share, just thesimplest one
  12. 12. Whats next - Where to look nowDashlets can be much more complex...stats-dashlet:http://code.google.com/p/stats-dashlet/share-extras:http://code.google.com/p/share-extras/Alfresco Forums:https://forums.alfresco.com/en/Alfresco Wiki:http://wiki.alfresco.com/

×