SlideShare a Scribd company logo
Customizing the Document Library1Mike HatfieldSenior Software Engineer, Alfrescotwitter: @mikehatfield
Customizing the Document Library2What We’ll Cover Architecture
 Challenges to customization and extensionPlans for improvement Case Study: the DoD 5015.2 Extensions
 Extension Example Status Indicators Custom Actions Custom Metadata Filters
Architecture3
Architecture4Heavy Use of YUI for “Web 2.0” ExperienceMany JavaScript frameworks evaluatedOnly YUI had a full-time staff, full API documentation, supported UI widgetsMany YUI widgets and modules usedDataTableTreeviewButtons, Menus, ContainersHistory Manager for “AJAX back button” supportXHR wrappers, JSON parserMost HTML rendering performed client-side
yuilibrary.com is your friend!Architecture5Initial Page LoadCreate all YUI controls
Register event handlers
Extract URL arguments
Bubbling Event  “changeFilter”
onChangeFilter: updateDocList()
Webscript URL (via proxy)  YUI DataSource
Repository webscripts execute for given filter & params
Bubbling Event  “filterChanged”
Render JSON response using DataTable cell renderersArchitecture6Subsequent Navigations (e.g Folder)Bubbling Event  “changeFilter” [new filter params]
onChangeFilter: Build data webscript URL
History Manager  multiNavigate()
onHistoryManagerFilterChanged: updateDocList()
Webscript URL (via proxy)  YUI DataSource
Repository webscripts execute for given filter & params
Bubbling Event  “filterChanged”
Render JSON response using DataTable cell renderersArchitecture7YUI DataTable RenderersOne renderer per data columnSelected file / folderStatus indicatorThumbnail / iconMetadata descriptionActionsRender XSS-safe HTML from parsed JSONelCell.innerHTML = “<div>…</div>”YUI wraps output in <table><tr><td> tagsArchitecture8ActionsCurrently defined in webscript config xml filesSeparate configs for browse page, details pagesAction Sets based on repository business logicevaluator.lib.js“document”, “folder”, “locked”, “workingCopyOwner”, etc.Two action types“simple-link” URL via getActionUrls(){downloadUrl}, {viewUrl}, {folderDetailsUrl}“action-link” JavaScript function  “id” attributeID attribute defines action icon and JavaScript functionArchitecture9ActionsPermissionsComma-separated listUser AND asset must have ALL permissions for action to appear“Virtual” permissions as well as role-basedcreate, edit, delete, permissions, cancel-checkoutinline-edit, simple-approve, googledocs-editNegative permission via tilde (~)~filter-path, ~portlet, ~googledocs-editLabel attribute for I18N messageCurrent Extension Points10Custom UINew FiltersNew ActionsCustom UINew FiltersNew ActionsCustom UINew ActionsNew ActionsNew Filters
Plans for Improvements11 Consolidate scattered action configurationshare-config-custom.xml instead of webscriptconfigStill possible to restrict & specialise actions on details pages New actions via configuration where practicablejar file for client-side UI assets, I18NCSS and JS dependencies via config (see Forms & Header) Leverage Repository Actions & scripts
 Custom ViewsWeb-tier renderingOpen CMIS
Case Study: DoD 5015.2 Extensions12
Case Study: DoD 5015.2 Extensions13Custom ActionsNumerous new and overridden actions to support the DoD requirements specification.
Case Study: DoD 5015.2 Extensions14Custom ToolbarSensitive to current folder type. New and overridden actions.Custom FiltersRemoved unsuitable filters (user filters, tags). One static, one dynamic (populated from list of saved searches on the Repository).
Case Study: DoD 5015.2 Extensions15“documentLibrary” container type determines components
Case Study: DoD 5015.2 Extensions16
Template: documentlibrary17documentlibrary.jsconnector.get("/slingshot/doclib/container/" + siteId + "/" + containerId);"dod:filePlan"model.doclibType = fromRepoType("dod:filePlan");“dod5015”documentlibrary.ftl<@region id=doclibType+ "documentlist" scope="template" protected=true />Surf Component Bindingtemplate.dod5015-documentlist.documentlibrary.xml<url>/components/documentlibrary/dod5015/documentlist</url>
Creating the Container18DoD 5015.2 Methodpresets.xml<preset id="rm-site-dashboard">  <page id="site/${siteid}/dashboard">    <properties>      <pageMetadata>{"documentlibrary":{…, "type":"dod5015"}}</pageMetadata>  documentlibrary.jspage = sitedata.getPage("site/" + siteId + "/dashboard");pageMeta = eval('(' + p.properties.pageMetadata + ')');contentType = doclibMeta.type;connector.get("/slingshot/doclib/container/" + siteId + "/" + containerId+ “?type=“ + toRepoType(contentType));”dod:filePlan”
Creating the Container19Web QuickStart Methoddashletconnector.get("/api/loadwebsitedata?site=" + siteId);LoadWebSiteDataGet.javaNodeRefdocLib = siteService.getContainer(siteId, COMPONENT_DOCUMENT_LIBRARY);siteService.createContainer(siteId, COMPONENT_DOCUMENT_LIBRARY, WebSiteModel.TYPE_WEBSITE_CONTAINER, null);ornodeService.setType(docLib, WebSiteModel.TYPE_WEBSITE_CONTAINER);
Case Study: DoD 5015.2 Extensions20YUI HelpsYUI developers added a number of helper functions to allow OO-style JavaScript modules. Notice:constructorsuperclassextendaugmentetc…
Component Replacement Approach21Full override / replacement control on all tiers.Your code can be almost completely independent of Alfresco’s.ProsMandatory component mapping	, even for “native” components.Still have to copy/paste where <include> cannot be used, e.g. I18N.Repository folder type to component prefix issue.Not a 100% “clean” override mechanism.Cons
Mandatory Component Mapping22Big Development Overheadtemplate.dod5015-actions-common.documentlibrary.xmltemplate.dod5015-documentlist.documentlibrary.xmltemplate.dod5015-file-upload.documentlibrary.xmltemplate.dod5015-fileplan.documentlibrary.xmltemplate.dod5015-flash-upload.documentlibrary.xmltemplate.dod5015-html-upload.documentlibrary.xmltemplate.dod5015-navigation.documentlibrary.xmltemplate.dod5015-savedsearch.documentlibrary.xmltemplate.dod5015-title.documentlibrary.xmltemplate.dod5015-toolbar.documentlibrary.xmltemplate.dod5015-tree.documentlibrary.xml…And that’s just the browse page!
Extension Example23 Overview
 Customisations Status IndicatorsCustom MetadataNew FiltersCustom Action Based on Alfresco Community 3.4.b
 Need to use AMP on the Repository until refactoring work is complete
 Share extensions via .jar and web-extension folderExtension Example: Photography24Overview
DemoOut-of-the-box Share25
Extension: Status Indicators 26Provide the user a quick indication of the current status of a folder or document, e.g. aspects applied.Calculated in evaluator.lib.jsRepository
evaluator.lib.js
Share
I18N messages
Indicator imagesRepository: Override evaluator.lib.js27/* Exif metadata */if (node.hasAspect("exif:exif")){status["exif"] = true;}/* Geographic */if (node.hasAspect("cm:geographic")){status["geographic"] = true;}
Share: Indicator images28status[”exif"] = true;status["geographic"] = true;share.jar!/META-INF/components/documentlibrary/imagesexif-indicator-16.pnggeographic-indicator-16.png

More Related Content

PPTX
Alfresco tuning part1
PDF
Storage and Alfresco
PPTX
Alfresco勉強会#36 alfresco 5でカスタムREST APIを作ってみよう
PPTX
(Re)Indexing Large Repositories in Alfresco
PPTX
Introduction to Apache Camel
PPTX
Using and extending Alfresco Content Application
PDF
The automation challenge: Kubernetes Operators vs Helm Charts
PDF
Alfresco Content Modelling and Policy Behaviours
 
Alfresco tuning part1
Storage and Alfresco
Alfresco勉強会#36 alfresco 5でカスタムREST APIを作ってみよう
(Re)Indexing Large Repositories in Alfresco
Introduction to Apache Camel
Using and extending Alfresco Content Application
The automation challenge: Kubernetes Operators vs Helm Charts
Alfresco Content Modelling and Policy Behaviours
 

What's hot (20)

PDF
Terraform: An Overview & Introduction
PPTX
Best practices and lessons learnt from Running Apache NiFi at Renault
PDF
Running Kafka On Kubernetes With Strimzi For Real-Time Streaming Applications
PPTX
Alfresco tuning part2
PDF
Intro to Reactive Programming
PPTX
Alfresco Certificates
PPTX
Alfresco tuning part1
PDF
JCR, Sling or AEM? Which API should I use and when?
PPT
Alfresco node lifecyle, services and zones
PDF
Argocd up and running
PDF
Kafka Connect & Streams - the ecosystem around Kafka
PDF
Helm - Application deployment management for Kubernetes
PPTX
Terraform Modules and Continuous Deployment
PPTX
Kafka Tutorial - introduction to the Kafka streaming platform
PPSX
Big Data Redis Mongodb Dynamodb Sharding
PDF
Introduction to docker
PDF
[GitOps] Argo CD on GKE (v0.9.2).pdf
PDF
Vert.X: Microservices Were Never So Easy (Clement Escoffier)
PDF
CAF intro Hosters modern
PPTX
Splunk Overview
Terraform: An Overview & Introduction
Best practices and lessons learnt from Running Apache NiFi at Renault
Running Kafka On Kubernetes With Strimzi For Real-Time Streaming Applications
Alfresco tuning part2
Intro to Reactive Programming
Alfresco Certificates
Alfresco tuning part1
JCR, Sling or AEM? Which API should I use and when?
Alfresco node lifecyle, services and zones
Argocd up and running
Kafka Connect & Streams - the ecosystem around Kafka
Helm - Application deployment management for Kubernetes
Terraform Modules and Continuous Deployment
Kafka Tutorial - introduction to the Kafka streaming platform
Big Data Redis Mongodb Dynamodb Sharding
Introduction to docker
[GitOps] Argo CD on GKE (v0.9.2).pdf
Vert.X: Microservices Were Never So Easy (Clement Escoffier)
CAF intro Hosters modern
Splunk Overview
Ad

Viewers also liked (20)

PDF
PLAT-13 Metadata Extraction and Transformation
PDF
Upload & share power point presentations and documents
PDF
Elements_Architecture_and_Technology.pdf
PDF
Model metadata sheet - WAMSI
PDF
How the health well facilitates access to information Adam McCune
PDF
This Year's Model: Metadata Models and Representations - Tech Forum 2014 - Gr...
PDF
Ariyalur
PDF
How to Create a Metadata Schema that Doesn't suck in 5 Easy Steps
PPTX
Can ISO 19157 support current NASA data quality metadata?
PPTX
Alfresco architecture-overview
PPT
Enterprise Content Management Migration Best Practices Feat Migrations From...
PDF
What the future holds: Metadata and Document Repositories Stanislav Nazarenk...
PDF
Alfresco Day Amsterdam 2015 - Alfresco One Product Suite Update + Demo
PPT
Document repositories-and-metadata
PPTX
Alfresco Day BeNelux: The success of Alfresco
PPT
The World Needs an Alternative to SharePoint
PDF
Alfresco Security Best Practices 2014
PPTX
Alfresco Day Benelux Hogeschool Inholland Records Management application
PPTX
Alfresco Day BeNelux: Customer Success Showcase - Saxion Hogescholen
PPTX
Sizing your alfresco platform
PLAT-13 Metadata Extraction and Transformation
Upload & share power point presentations and documents
Elements_Architecture_and_Technology.pdf
Model metadata sheet - WAMSI
How the health well facilitates access to information Adam McCune
This Year's Model: Metadata Models and Representations - Tech Forum 2014 - Gr...
Ariyalur
How to Create a Metadata Schema that Doesn't suck in 5 Easy Steps
Can ISO 19157 support current NASA data quality metadata?
Alfresco architecture-overview
Enterprise Content Management Migration Best Practices Feat Migrations From...
What the future holds: Metadata and Document Repositories Stanislav Nazarenk...
Alfresco Day Amsterdam 2015 - Alfresco One Product Suite Update + Demo
Document repositories-and-metadata
Alfresco Day BeNelux: The success of Alfresco
The World Needs an Alternative to SharePoint
Alfresco Security Best Practices 2014
Alfresco Day Benelux Hogeschool Inholland Records Management application
Alfresco Day BeNelux: Customer Success Showcase - Saxion Hogescholen
Sizing your alfresco platform
Ad

Similar to Customizing the Document Library (20)

PDF
CUST-1 Share Document Library Extension Points
PDF
Optaros Surf Code Camp Walkthrough 2
PDF
CUST-3 Document Management with Share
PDF
Tech talk live share extras extension modules feb 13
PDF
Optaros Surf Code Camp Lab 4
PPT
Enterprise Google Gadgets Integrated with Alfresco - Open Source ECM
PDF
fme Alfresco Day 06-2013 - alfresco.js and share
PDF
Alfresco Day Stockholm 2015 - Rapid UI Development
ODP
REST dojo Comet
PPTX
Good GateIn Stuff
PDF
BP-7 Share Customization Best Practices
PDF
Create a mobile web app with Sencha Touch
ODP
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
PDF
BP-9 Share Customization Best Practices
PPTX
Metadata Extraction and Content Transformation
PPTX
Spring Surf 101
PPT
Mappetizer Web mapping software
PDF
JavaScript Library Overview
PPT
Mashups & APIs
PPT
Intro To Alfresco Part 2
CUST-1 Share Document Library Extension Points
Optaros Surf Code Camp Walkthrough 2
CUST-3 Document Management with Share
Tech talk live share extras extension modules feb 13
Optaros Surf Code Camp Lab 4
Enterprise Google Gadgets Integrated with Alfresco - Open Source ECM
fme Alfresco Day 06-2013 - alfresco.js and share
Alfresco Day Stockholm 2015 - Rapid UI Development
REST dojo Comet
Good GateIn Stuff
BP-7 Share Customization Best Practices
Create a mobile web app with Sencha Touch
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
BP-9 Share Customization Best Practices
Metadata Extraction and Content Transformation
Spring Surf 101
Mappetizer Web mapping software
JavaScript Library Overview
Mashups & APIs
Intro To Alfresco Part 2

More from Alfresco Software (20)

PPTX
Alfresco Day Benelux Inholland studentendossier
PPTX
Alfresco Day BeNelux: Customer Success Showcase - Gemeente Amsterdam
PDF
Alfresco Day BeNelux: Customer Success Showcase - Credendo Group
PDF
Alfresco Day BeNelux: Digital Transformation - It's All About Flow
PDF
Alfresco Day Vienna 2016: Activiti – ein Katalysator für die DMS-Strategie be...
PDF
Alfresco Day Vienna 2016: Elektronische Geschäftsprozesse auf Basis von Alfre...
PDF
Alfresco Day Vienna 2016: Alfrescos neue Rest API
PDF
Alfresco Day Vienna 2016: Support Tools für die Admin-Konsole
PDF
Alfresco Day Vienna 2016: Entwickeln mit Alfresco
PDF
Alfresco Day Vienna 2016: Activiti goes enterprise: Die Evolution der BPM Sui...
PDF
Alfresco Day Vienna 2016: Partner Lightning Talk: Westernacher
PDF
Alfresco Day Vienna 2016: Bringing Content & Process together with the App De...
PDF
Alfresco Day Vienna 2016: Partner Lightning Talk - it-novum
PDF
Alfresco Day Vienna 2016: How to Achieve Digital Flow in the Enterprise - Joh...
PDF
Alfresco Day Warsaw 2016 - Czy możliwe jest spełnienie wszystkich regulacji p...
PDF
Alfresco Day Warsaw 2016: Identyfikacja i podpiselektroniczny - Safran
PDF
Alfresco Day Warsaw 2016: Advancing the Flow of Digital Business
PDF
Alfresco Day Warsaw 2016: Podpis elektroniczny - BMS
PDF
Alfresco Day Warsaw 2016: Next-Generation Business Process Management with Al...
PDF
Alfresco Day Milano 2016 - Demo Data
Alfresco Day Benelux Inholland studentendossier
Alfresco Day BeNelux: Customer Success Showcase - Gemeente Amsterdam
Alfresco Day BeNelux: Customer Success Showcase - Credendo Group
Alfresco Day BeNelux: Digital Transformation - It's All About Flow
Alfresco Day Vienna 2016: Activiti – ein Katalysator für die DMS-Strategie be...
Alfresco Day Vienna 2016: Elektronische Geschäftsprozesse auf Basis von Alfre...
Alfresco Day Vienna 2016: Alfrescos neue Rest API
Alfresco Day Vienna 2016: Support Tools für die Admin-Konsole
Alfresco Day Vienna 2016: Entwickeln mit Alfresco
Alfresco Day Vienna 2016: Activiti goes enterprise: Die Evolution der BPM Sui...
Alfresco Day Vienna 2016: Partner Lightning Talk: Westernacher
Alfresco Day Vienna 2016: Bringing Content & Process together with the App De...
Alfresco Day Vienna 2016: Partner Lightning Talk - it-novum
Alfresco Day Vienna 2016: How to Achieve Digital Flow in the Enterprise - Joh...
Alfresco Day Warsaw 2016 - Czy możliwe jest spełnienie wszystkich regulacji p...
Alfresco Day Warsaw 2016: Identyfikacja i podpiselektroniczny - Safran
Alfresco Day Warsaw 2016: Advancing the Flow of Digital Business
Alfresco Day Warsaw 2016: Podpis elektroniczny - BMS
Alfresco Day Warsaw 2016: Next-Generation Business Process Management with Al...
Alfresco Day Milano 2016 - Demo Data

Recently uploaded (20)

PPTX
Cloud computing and distributed systems.
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPT
Teaching material agriculture food technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Empathic Computing: Creating Shared Understanding
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
Cloud computing and distributed systems.
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Teaching material agriculture food technology
Chapter 3 Spatial Domain Image Processing.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Unlocking AI with Model Context Protocol (MCP)
Empathic Computing: Creating Shared Understanding
20250228 LYD VKU AI Blended-Learning.pptx
NewMind AI Monthly Chronicles - July 2025
Building Integrated photovoltaic BIPV_UPV.pdf
Network Security Unit 5.pdf for BCA BBA.
Spectral efficient network and resource selection model in 5G networks
NewMind AI Weekly Chronicles - August'25 Week I
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Review of recent advances in non-invasive hemoglobin estimation
MYSQL Presentation for SQL database connectivity
Per capita expenditure prediction using model stacking based on satellite ima...

Customizing the Document Library

  • 1. Customizing the Document Library1Mike HatfieldSenior Software Engineer, Alfrescotwitter: @mikehatfield
  • 2. Customizing the Document Library2What We’ll Cover Architecture
  • 3. Challenges to customization and extensionPlans for improvement Case Study: the DoD 5015.2 Extensions
  • 4. Extension Example Status Indicators Custom Actions Custom Metadata Filters
  • 6. Architecture4Heavy Use of YUI for “Web 2.0” ExperienceMany JavaScript frameworks evaluatedOnly YUI had a full-time staff, full API documentation, supported UI widgetsMany YUI widgets and modules usedDataTableTreeviewButtons, Menus, ContainersHistory Manager for “AJAX back button” supportXHR wrappers, JSON parserMost HTML rendering performed client-side
  • 7. yuilibrary.com is your friend!Architecture5Initial Page LoadCreate all YUI controls
  • 10. Bubbling Event  “changeFilter”
  • 12. Webscript URL (via proxy)  YUI DataSource
  • 13. Repository webscripts execute for given filter & params
  • 14. Bubbling Event  “filterChanged”
  • 15. Render JSON response using DataTable cell renderersArchitecture6Subsequent Navigations (e.g Folder)Bubbling Event  “changeFilter” [new filter params]
  • 17. History Manager  multiNavigate()
  • 19. Webscript URL (via proxy)  YUI DataSource
  • 20. Repository webscripts execute for given filter & params
  • 21. Bubbling Event  “filterChanged”
  • 22. Render JSON response using DataTable cell renderersArchitecture7YUI DataTable RenderersOne renderer per data columnSelected file / folderStatus indicatorThumbnail / iconMetadata descriptionActionsRender XSS-safe HTML from parsed JSONelCell.innerHTML = “<div>…</div>”YUI wraps output in <table><tr><td> tagsArchitecture8ActionsCurrently defined in webscript config xml filesSeparate configs for browse page, details pagesAction Sets based on repository business logicevaluator.lib.js“document”, “folder”, “locked”, “workingCopyOwner”, etc.Two action types“simple-link” URL via getActionUrls(){downloadUrl}, {viewUrl}, {folderDetailsUrl}“action-link” JavaScript function  “id” attributeID attribute defines action icon and JavaScript functionArchitecture9ActionsPermissionsComma-separated listUser AND asset must have ALL permissions for action to appear“Virtual” permissions as well as role-basedcreate, edit, delete, permissions, cancel-checkoutinline-edit, simple-approve, googledocs-editNegative permission via tilde (~)~filter-path, ~portlet, ~googledocs-editLabel attribute for I18N messageCurrent Extension Points10Custom UINew FiltersNew ActionsCustom UINew FiltersNew ActionsCustom UINew ActionsNew ActionsNew Filters
  • 23. Plans for Improvements11 Consolidate scattered action configurationshare-config-custom.xml instead of webscriptconfigStill possible to restrict & specialise actions on details pages New actions via configuration where practicablejar file for client-side UI assets, I18NCSS and JS dependencies via config (see Forms & Header) Leverage Repository Actions & scripts
  • 24. Custom ViewsWeb-tier renderingOpen CMIS
  • 25. Case Study: DoD 5015.2 Extensions12
  • 26. Case Study: DoD 5015.2 Extensions13Custom ActionsNumerous new and overridden actions to support the DoD requirements specification.
  • 27. Case Study: DoD 5015.2 Extensions14Custom ToolbarSensitive to current folder type. New and overridden actions.Custom FiltersRemoved unsuitable filters (user filters, tags). One static, one dynamic (populated from list of saved searches on the Repository).
  • 28. Case Study: DoD 5015.2 Extensions15“documentLibrary” container type determines components
  • 29. Case Study: DoD 5015.2 Extensions16
  • 30. Template: documentlibrary17documentlibrary.jsconnector.get("/slingshot/doclib/container/" + siteId + "/" + containerId);"dod:filePlan"model.doclibType = fromRepoType("dod:filePlan");“dod5015”documentlibrary.ftl<@region id=doclibType+ "documentlist" scope="template" protected=true />Surf Component Bindingtemplate.dod5015-documentlist.documentlibrary.xml<url>/components/documentlibrary/dod5015/documentlist</url>
  • 31. Creating the Container18DoD 5015.2 Methodpresets.xml<preset id="rm-site-dashboard"> <page id="site/${siteid}/dashboard"> <properties> <pageMetadata>{"documentlibrary":{…, "type":"dod5015"}}</pageMetadata> documentlibrary.jspage = sitedata.getPage("site/" + siteId + "/dashboard");pageMeta = eval('(' + p.properties.pageMetadata + ')');contentType = doclibMeta.type;connector.get("/slingshot/doclib/container/" + siteId + "/" + containerId+ “?type=“ + toRepoType(contentType));”dod:filePlan”
  • 32. Creating the Container19Web QuickStart Methoddashletconnector.get("/api/loadwebsitedata?site=" + siteId);LoadWebSiteDataGet.javaNodeRefdocLib = siteService.getContainer(siteId, COMPONENT_DOCUMENT_LIBRARY);siteService.createContainer(siteId, COMPONENT_DOCUMENT_LIBRARY, WebSiteModel.TYPE_WEBSITE_CONTAINER, null);ornodeService.setType(docLib, WebSiteModel.TYPE_WEBSITE_CONTAINER);
  • 33. Case Study: DoD 5015.2 Extensions20YUI HelpsYUI developers added a number of helper functions to allow OO-style JavaScript modules. Notice:constructorsuperclassextendaugmentetc…
  • 34. Component Replacement Approach21Full override / replacement control on all tiers.Your code can be almost completely independent of Alfresco’s.ProsMandatory component mapping , even for “native” components.Still have to copy/paste where <include> cannot be used, e.g. I18N.Repository folder type to component prefix issue.Not a 100% “clean” override mechanism.Cons
  • 35. Mandatory Component Mapping22Big Development Overheadtemplate.dod5015-actions-common.documentlibrary.xmltemplate.dod5015-documentlist.documentlibrary.xmltemplate.dod5015-file-upload.documentlibrary.xmltemplate.dod5015-fileplan.documentlibrary.xmltemplate.dod5015-flash-upload.documentlibrary.xmltemplate.dod5015-html-upload.documentlibrary.xmltemplate.dod5015-navigation.documentlibrary.xmltemplate.dod5015-savedsearch.documentlibrary.xmltemplate.dod5015-title.documentlibrary.xmltemplate.dod5015-toolbar.documentlibrary.xmltemplate.dod5015-tree.documentlibrary.xml…And that’s just the browse page!
  • 37. Customisations Status IndicatorsCustom MetadataNew FiltersCustom Action Based on Alfresco Community 3.4.b
  • 38. Need to use AMP on the Repository until refactoring work is complete
  • 39. Share extensions via .jar and web-extension folderExtension Example: Photography24Overview
  • 41. Extension: Status Indicators 26Provide the user a quick indication of the current status of a folder or document, e.g. aspects applied.Calculated in evaluator.lib.jsRepository
  • 43. Share
  • 45. Indicator imagesRepository: Override evaluator.lib.js27/* Exif metadata */if (node.hasAspect("exif:exif")){status["exif"] = true;}/* Geographic */if (node.hasAspect("cm:geographic")){status["geographic"] = true;}
  • 46. Share: Indicator images28status[”exif"] = true;status["geographic"] = true;share.jar!/META-INF/components/documentlibrary/imagesexif-indicator-16.pnggeographic-indicator-16.png
  • 47. Share: Add I18N messages29share.jar!/org/springframework/extensions/surf/custom-slingshot-geographic-context.xml<bean id="geographic.custom.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent"> <property name="resourceBundles"> <list> <value>alfresco.messages.geographic</value> </list> </property></bean>share.jar!/alfresco/messages/geographic.propertiestip.geographic=Geo Locationtip.exif=EXIF Metadata
  • 48. Extension: Custom Metadata30Rendered entirely by the web browser from JSON data.Repository
  • 51. Share
  • 53. Override cell rendererRepository: Override item.lib.ftl31alfresco.amp!/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/item.lib.ftl<#if node.hasAspect("cm:geographic")>“geolocation”:{ "latitude": ${(node.properties["cm:latitude"]!0)?c}, "longitude": ${(node.properties["cm:longitude"]!0)?c}},</#if><#if node.hasAspect(”exif:exif")>“exif”:{ …},</#if>
  • 54. Share: Reference extension JavaScript32shared/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/documentlibrary/actions-common.get.head.ftl<@script type="text/javascript" src="${page.url.context}/res/components/geographic/geographic-extension.js"></@script>
  • 55. Share: Override cell renderer33Override fnRenderCellDescriptionshare.jar!/META-INF/components/geographic/geographic-extension.jsYAHOO.util.Event.onContentReady("alf-hd", function(){ if (Alfresco.DocumentList) {Alfresco.DocumentList.prototype.fnRenderCellDescription = function DL_fnRenderCellDescription() { … if (record.exif) {desc += scope.msg(“detail.exposure”) + record.exif.exposureTime; } … } }}
  • 56. Extension: New Filter34Allow easy filtering by any Repository logic, most commonly a Lucene or Alfresco FTS search query.Repository
  • 58. Share
  • 60. Filter webscriptconfigShare: Filter webscriptconfig35shared/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/documentlibrary/filter.get.config.xml<filters> … <filter id="geo" label="link.geo-located" /> <filter id="exif" label="link.exif" /> …</filters>
  • 61. Repository: Filter webscript override36alfresco.amp!/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/filters.lib.jscase "geo":filterQuery = "+PATH:\"" +parsedArgs.rootNode.qnamePath + "//*\"";filterQuery += "+ASPECT:\"cm:geographic\"";filterParams.query = filterQuery break;case "exif":filterQuery = "+PATH:\"" +parsedArgs.rootNode.qnamePath + "//*\"";filterQuery += "+ASPECT:\"exif:exif\"";filterParams.query = filterQuery break;
  • 62. Extension: Custom Action37Can be configured to only appear if a folder or document is in a particular state and/or the user has the correct permission(s) and/or the page is within a Site context and/or the action is on the browse or details page.Repository
  • 65. Share
  • 68. Client-side logic & imagesRepository: Override evaluator.lib.js38/* Geographic */if (node.hasAspect("cm:geographic")){status["geographic"] = true;permissions["geographic"] = true;}
  • 70. Share: CSS and JS dependencies40shared/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/documentlibrary/actions-common.get.head.ftl<@link rel="stylesheet" type="text/css" href="${page.url.context}/res/components/geographic/geographic-extension.css" />share.jar!/META-INF/components/geographic/geographic-extension.css.doclist .onActionGeographica{ background-image: url(pin.png) !important;}
  • 71. Share: Proxy JavaScript function41var override = Alfresco.DocumentList || Alfresco.DocumentActions;// Store reference to getActionUrls() function to allow extension.vargetActionUrls_geo = override.prototype.getActionUrls;override.prototype.getActionUrls = function(recordData){varactionUrls = getActionUrls_geo.apply(this, arguments);actionUrls["geographicUrl"] = Alfresco.util.siteURL( "geographic-map?nodeRef=" + recordData.nodeRef); return actionUrls;};
  • 74. Roadmap44 Consolidate scattered action configuration
  • 75. New actions via configuration where practicable
  • 76. Remove references to non-core Share code
  • 77. Leverage Repository Actions & scripts
  • 78. Custom ViewsQ & A45FeedbackLearn More46wiki.alfresco.com/wiki/Shareblogs.alfresco.com/wp/mikeh/

Editor's Notes

  • #46: If you have any specific questions or need me to show you how to do something just come and find me