Tech Talk Live on Share Extensibility
-
Upload
alfresco-software -
Category
Technology
-
view
3.636 -
download
0
description
Transcript of Tech Talk Live on Share Extensibility
![Page 1: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/1.jpg)
New Client Config & Extension Points in Share
Dave Draper @_DaveDraper
!
![Page 2: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/2.jpg)
Background
• Alfresco Share was not originally intended as a platform
• Spring Surf did not provide any extension mechanism
• Difficult to identify use cases
![Page 3: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/3.jpg)
Goals (for 4.0)
• Ensure that Spring Surf continues to be compatible with previous Alfresco releases (i.e. Avoid branching)
• Minimize Share code changes • Provide the ability to easily extend Share
without copying and pasting code • Provide extensions through simple JAR
deployment
![Page 4: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/4.jpg)
Goals (for next major release)
• Make customizing client-side JavaScript widgets simpler
• Convert Share WebScripts to common “boiler-plate” template
• Move dependency requests into WebScript “.html.ftl” files
• Remove Share WebScript “.head.ftl” files
![Page 5: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/5.jpg)
Solution Overview
• Two distinct approaches to extension o Customization by targeting existing files o Customization through Component configuration
• Creation of in-memory output model o Provides opportunity to amend default output o Each FreeMarker template gets an output model o Models can are nested
• Introduction of Sub-Components o Solves 1-1 Region to Component mapping problem
![Page 6: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/6.jpg)
File Customization
• Works with Templates or WebScripts • Can extend i18n properties, JavaScript
controllers & FreeMarker templates • FreeMarker extensions depend upon
custom directives – <@region> & <@markup> – Entirely abstract framework – scope for adding
new directives
![Page 7: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/7.jpg)
What Can You Do With This?
• Modify Surf templates to add, remove, modify Component bindings
• Change display labels • Modify the content displayed by updating
the model
![Page 8: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/8.jpg)
Sub-Components
• A Sub-Component maps to a WebScript • Only AdvancedComponents support Sub-
Components o Only Share 4.0 uses AdvancedComponents by default o Configurable through Surf configuration
• Legacy configuration conversion o Components become Sub-Components
• Support for dynamic evaluation of parameters against request
![Page 9: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/9.jpg)
Sub-Component Evaluations
• A Sub-Component can have zero or more Evaluations
• Each Evaluation can use zero or more Evaluators
• If all Evaluators are successful then Evaluation overrides Sub-Component defaults
• WebScript URL, properties and index can be overridden
![Page 10: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/10.jpg)
What Can You Do With This?
• Add, remove and modify the content within a Component
• Have a Component display different content dynamically based on request information (e.g. The Site being accessed, the current User)
![Page 11: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/11.jpg)
Extensions & Modules • An “Extension” can contain zero or more “Modules” • An Extension can be configured within the application
(e.g. Portlet extension) or externally in a JAR (e.g. RM extension)
• Three deployment modes “auto”, “enable-auto-deploy” and “manual” (manual is default)
• Default module configuration can be overridden when deployed
• Modules can be dynamically deployed and removed without server restart.
![Page 12: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/12.jpg)
Benefits
• Easy to add new coarse grained content to existing Share pages
• Easy to override i18n properties for WebScripts
• Scope for future enhancements using in-memory output model (i.e. new FreeMarker directives)
![Page 13: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/13.jpg)
Restrictions (in 4.0)
• Still difficult to extend JavaScript widgets for fine grained changes
• Limited use of <@markup> directive in Share
• Sub-Component extensions only work with WebScripts
• Limited control over module overrides at deployment
![Page 14: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/14.jpg)
Additional Tooling
• “SurfBug”: identifies the Spring Surf elements on each page: o Sub-Components & Component bindings, properties &
evaluation results o Contributing file paths o WebScript information o Customization data (i.e. use of extensibility directives)
![Page 15: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/15.jpg)
Additional Dependency Handling
• Use <dependencies> element as a child of <customization> element in Module configuration:
<dependencies> <css>/res/demo/dependencies/styles.css</css> <js>/res/demo/dependencies/script.js</js> </dependencies>
![Page 16: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/16.jpg)
Share Configuration Support
• Available from 4.0.2 • Use of <configurations> element as a
child of <module> element • Allows dynamically evaluated Share
configuration changes (i.e. that would typically be found in “share-config.xml”)
• MUST include all configuration – it is not an augment capability
![Page 17: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/17.jpg)
Demos
![Page 18: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/18.jpg)
Adding New Content (Method 1)
![Page 19: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/19.jpg)
Create some content...
WebScript Template
WebScript Descriptor
![Page 20: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/20.jpg)
Target Area Of Share...
![Page 21: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/21.jpg)
Define new Sub-Component...
![Page 22: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/22.jpg)
Deploy Module...
![Page 23: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/23.jpg)
Result...
![Page 24: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/24.jpg)
Hiding Existing Content (Method 1)
![Page 25: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/25.jpg)
Target Sub-Component to hide...
![Page 26: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/26.jpg)
Result...
![Page 27: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/27.jpg)
Conditional Hide
![Page 28: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/28.jpg)
Create an Evaluator...
![Page 29: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/29.jpg)
Make the Evaluator a Spring Bean...
org.springframework.extensions.surf.spring-surf-extensibility-context.xml
![Page 30: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/30.jpg)
Specify the Evaluator...
![Page 31: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/31.jpg)
Result...
![Page 32: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/32.jpg)
Adding New Content (Method 2)
![Page 33: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/33.jpg)
Target a TemplateInstance...
![Page 34: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/34.jpg)
Define a customization...
![Page 35: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/35.jpg)
Create the customization file...
(in specified package)
![Page 36: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/36.jpg)
Define a Component to bind to new Region...
(re-using the WebScript from the earlier example to provide content)
![Page 37: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/37.jpg)
Result...
![Page 38: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/38.jpg)
Hiding Existing Content (Method 2)
![Page 39: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/39.jpg)
Remove the Region... (Same target, different action)
Other actions are available... § “after” § “modify”
![Page 40: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/40.jpg)
Override i18n Properties
![Page 41: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/41.jpg)
Find the property...
![Page 42: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/42.jpg)
Define a customization...
![Page 43: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/43.jpg)
Create the customization file...
Note that the location of a WebScript customization is at a different path root than for TemplateInstance customizations!
![Page 44: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/44.jpg)
Result...
![Page 45: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/45.jpg)
Override JavaScript Controller
![Page 46: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/46.jpg)
Identify JavaScript model properties...
![Page 47: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/47.jpg)
Define a customization...
![Page 48: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/48.jpg)
Create The Customization File...
![Page 49: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/49.jpg)
Result...
![Page 50: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/50.jpg)
Other Demos (if time allows)
• Site conditional Flash upload • User conditional help • Additional dependencies • Document Library extension
![Page 51: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/51.jpg)
Other Customizations…
• Re-order entire pages (add + remove regions)
• Auto readme (see Blog post) • PeerBind Chat Service (see David
Webster’s blog) • Resource Management module • Portlet module • ...
![Page 52: Tech Talk Live on Share Extensibility](https://reader034.fdocuments.in/reader034/viewer/2022052522/554c119ab4c905e7568b4889/html5/thumbnails/52.jpg)
Additional Reading
• Lots more in-depth information and tutorials available at: http://blogs.alfresco.com/wp/ddraper
• Alfresco Surf Development Forum • More blogs to come!