Sie sind auf Seite 1von 24

Configuring and Extending Alfresco Share

Will Abson Solutions Engineer

Share is a Platform
Base content


Dashboards, client



templatable alternative

Lightweight portal Pull data from

Alfresco and other applications

Share Technologies

General Development Considerations

Consider development across all three tiers

Client-side, web-tier, repository-tier Decide mix between client-side vs. web-tier JavaScript code

Most extensions will use a combination of both But do not duplicate code

Consider software versions

Alfresco versions Browser versions

Have a test plan

Configuration vs. Extension

Configuration via Spring and Surf configuration

Forms configuration Data lists

Extension involves lightweight development

Custom Dashlets Custom Document Actions Custom Themes Additional Language Packs Custom Pages (More advanced)

Custom Dashlets
Just a web script!

can also utilise client-side assets

Most Alfresco dashlets use client-side JS

Render HTML areas on dashboards


alternative scripting and template

Rapid development

Support overriding existing dashlets

Dashlet Capabilities
Call repository services, e.g.

Fetch content metadata Invoke actions on content

e.g. Check out

Set user preferences

Call external services

JSON, Atom, HTML, etc. Authentication through custom endpoints

Manage dashlet configuration Internationalisation (I18N) Client-side capabilities via YUI

Resizing Dialogues

Types of Dashlet
User Dashlets (user-dashlet family) Available on any user dashboard Usually independent of site content, or crosssite view

e.g. Alfresco Network, My Sites, My Tasks

Site Dashlets (site-dashlet family) Available on any site dashboard Typically concerned with content within a site

e.g. Site Wiki

Combined Dashlets (dashlet family) Available on both user and site dashboards

Anatomy of a Dashlet
Client-side (optional)


JavaScript module Dashlet CSS


web script, including

Web script XML descriptor (name, description, family, etc) HTML Freemarker template Messages bundle(s) for I18N Dashlet controller script (optional) Dashlet XML configuration (optional)

Repository-tier (optional) (or third party)


data web scripts

Dashlet Source Layout (1)

Suggested source layout

Class path resources in config

Web-tier scripts in config/alfresco/web-


Repository-tier scripts in

config/alfresco/extension/templat es/webscripts

Client-side resources in source/web Same as Alfresco standard layout

Easy deployment and packaging using Ant Not suitable if you are using Maven

Dashlet Source Layout (2)

Web scripts layout

sub-packages below sitewebscripts and webscripts folders

e.g. com/mycompany/components/dashlets Do not use org/alfresco namespace

Client-side assets layout


sub-folders below web folder

e.g. components/dashlets

Developing Dashlets
Develop locally

Copy files into a local Alfresco instance to test

Do not develop inside an Alfresco instance!

Development tips

Development tools

Your favourite text editor / IDE Firefox plus Firebug OR Google Chrome Ant or Maven to deploy changes to your test system and package for distribution Source code control, e.g. SVN, Git YUI Compressor

Testing Dashlets
Copy web-tier scripts to
<TOMCAT_HOME>/shared/classes/alfresco/webextension/site-webscripts <TOMCAT_HOME>/shared/classes/alfresco/extensio n/templates/webscripts <TOMCAT_HOME>/webapps/ROOT/share-extension

Copy repository-tier scripts to Copy client-side resources to

Dont forget to refresh web scripts



be automated using Ant

Packaging & Deploying Dashlets

Use YUI Compressor to generate -min.js files Use JAR files to package where possible Web-tier script resources in root Client-side resources in META-INF

Reference via /share/res URIs May need to rewrite your links

Can use Ant or Maven for easy packaging Deploy into webapps/share/WEB-INF/lib or


AMP files may be used when more complex

Extensions in Action

Hello World Dashlet 1

Web-tier web script
hello-world.get.desc.xml hello-world.get.html.ftl

Hello World Dashlet 2

Web-tier web script
hello-world.get.desc.xml hello-world.get.html.ftl hello-world.get.js

Hello World Dashlet 3

Web-tier web script
hello-world.get.desc.xml hello-world.get.html.ftl hello-world.get.js hello-world.get.config.xml

Anatomy of a Document Action

Client-side Client-side JavaScript action Action CSS Web-tier Web-tier configuration

Document List component Document Details component

Repository-tier (optional) Repository-tier data web script

Custom Backup Action

Anatomy of a Theme
Theme Theme

CSS image assets configuration


Red Theme

More information