380 likes | 535 Views
Share Site Customizations Live. David Draper @_ DaveDraper Erik Winlöf @ erikwinlof (UI Team). What we’re going to do…. Possibilities Unique Organizing Extension points 3 demos = 3 extension modules
E N D
Share Site Customizations Live • David Draper @_DaveDraper • Erik Winlöf@erikwinlof • (UI Team)
What we’re going to do… • Possibilities • Unique • Organizing • Extension points • 3 demos = 3 extension modules • …customizations applied LIVE! • Create your own < 1 hour!
Acme • Research & Development department • PublishesR&D articles • Partner “portal” • Casting: • Author: Alan • Editor: Erik • Partner: Patrick
Pre Demo: “Nothing up our sleeves” • Alfresco Community 4.2.b (vanilla)
Step 1 • Define R&D projects • Make it available
Define R&D projects • Site Presets • Config template • Used in create site dialog • Customize using “preset-id” in evaluators
/alfresco/site-data/presets/acme-rd-presets.xml • Also: • Custom properties • Rename pages w <pageMetadata> • *-presets.xml (v 4.1) • <preset id="acme-rd-preset”> • <page id="site/${siteid}/dashboard"> • <title-id>page.acme-rd-dashboard.title</title-id> • <properties> • <sitePages>[ • { "pageId":"acme-rd-introduction" }, • { "pageId":"documentlibrary" } • ]</sitePages> • </properties> • </page> • <components/> • </preset> http://blogs.alfresco.com/wp/ddraper/2011/11/01/spring-surf-presets/
/alfresco/site-data/pages/acme-rd-introduction.xml • Tip! (v4.0b) • 2-columns • 2-columns-resizable • 2-columns-narrow-left • 2-columns-narrow-left • 3-columns • http://blogs.alfresco.com/wp/ewinlof/2011/10/12/create-pages-in-alfresco-share-using-new-out-of-the-box-templates/ • <page> • <template-instance>1-column</template-instance> • <components> • … • <component> • <region-id>column</region-id> • <sub-components> • <sub-component id="wiki"> • <url>/components/wiki/page</url> • </sub-component> • </sub-components> • </component> • </components> http://wiki.alfresco.com/wiki/Share_Custom_Pages
Make preset available • Global module: <customizations>
What is an extension module? (v4.0)/alfresco/site-data/extensions/*-extension.xml • Module evaluators: • site.module.evaluator(v4.0) • portal.module.evaluator(v4.0) • group.module.evaluator(v4.2b) • http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Ftasks%2FCreate-a-Model.html • Add/remove/replace • components in a • <@region> <evaluator> <components> • Merge share-config <configurations> <customizations> • Enhance templates’ • & webscripts’: • markup / resources / • model http://blogs.alfresco.com/wp/ddraper/2011/08/26/extensibility-module-deployment/
/alfresco/site-data/extensions/acme-rd-extension.xml • <extension> • <modules> • <module> • <id>Acme Rd (1) Global changes</id> • <auto-deploy>true</auto-deploy> • <!-- No evaluator, always applied! --> • <customizations> • <customization> • <targetPackageRoot>org.alfresco</targetPackageRoot> • <sourcePackageRoot>acme.rd.customizations</sourcePackageRoot> • </customization> • </customizations> • </module>
/alfresco/site-webscripts/org/alfresco/modulescreate-site.get.js/alfresco/site-webscripts/org/alfresco/modulescreate-site.get.js • Note! • Separate runtime • Common model • http://blogs.alfresco.com/wp/ddraper/2012/05/22/customizing-share-javascript-widget-instantiation-part-1/ • varsitePresets = [{ • id: "site-dashboard", • name: msg.get("title.collaborationSite") • }]; • model.sitePresets = sitePresets; • model.sitePresets.push( • { • id: "acme-rd-preset", • name: msg.get("preset.acme-rd.title") • }); /alfresco/site-webscripts/acme/rd/customizations/modulescreate-site.get.js
How quick is Dave? …he’s smart… https://github.com/share-extras/site-extension %>ant create-project -Dcompany=Acme-Dusecase=RD …
Share • Namespaced project structure: • build targets • Spring context file • i18n • Site preset • Sample page & webscript • Extension modules • Doclib customizations
Repository Note! Not required… • Namespaced project structure: • build targets • Spring context file • Content model • Sample repo action
Repository Alternative solution: Folder rule kicks off a simple workflow http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Ftasks%2Flibrary-folder-rules-define.html • rd:article aspect • rd:statusproperty [ “Draft” | ”Published” ] • Repo action marks as “Published” http://wiki.alfresco.com/wiki/Data_Dictionary_Guide https://devcon.alfresco.com/berlin/sessions/developing-doclib-actions-alfresco-4
Step 2 • Publishing articles • Show article info in the document library • “Slim down” Share for Editors
Publishing articles • Doclibaction • SiteManager(editor) • R&D Project only • Site Preset module: <configurations>
/alfresco/site-data/extensions/acme-rd-extension.xml • <module> • <id>Acme Rd (2) Site changes</id> • <evaluator type="site.module.evaluator"> • <params> • <sites>.*</sites> • <sitePresets>acme-rd-preset</sitePresets> • <applyForNonSites>false</applyForNonSites> • <groups>.*</groups> • </params> • </evaluator> • <configurations> Actions, indicators etc
/alfresco/site-data/extensions/acme-rd-extension.xml • Also: • (v4.2b) • isSiteConsumer • isSiteContributor • isSiteCollaborator • “pagelink” / “link” • https://devcon.alfresco.com/berlin/sessions/developing-doclib-actions-alfresco-4 • <config evaluator="string-compare" condition="DocLibActions"> • <actions> • <action id="acme-rd-document-setStatusPublished" type="javascript"> • <evaluator>acme.rd.evaluator.doclib.hasArticleAspect</evaluator> • <evaluator negate="true">acme.rd.evaluator.doclib.isStatusPublished</evaluator> • <evaluator>evaluator.doclib.action.isSiteManager</evaluator> • <permissions> • <permission allow="true">Write</permission> • </permissions> • <param name="function">onActionSimpleRepoAction</param> • <param name="action">acme.rd.setPublishedStatus</param> • </action> http://blogs.alfresco.com/wp/mikeh/2011/09/26/share-document-library-extensions-in-v4-0/
Show Custom data only in R&D doclibs • Indicators • Metadata templates
/alfresco/site-data/extensions/acme-rd-extension.xml Tip! <override>some-indicator-id</override> “action” attribute • <config evaluator="string-compare" condition="DocumentLibrary"> • <indicators> • <indicator id="acme-rd-status" index="10" • icon=”…/rd/components/documentlibrary/indicators/status-16.png” • label="acme.rd.indicator.status"> • <evaluator>acme.rd.evaluator.doclib.hasArticleAspect</evaluator> • <labelParam index="0">{jsNode.properties.rd_status}</labelParam> • </indicator> • </indicators> • </config> http://blogs.alfresco.com/wp/mikeh/2011/09/26/share-document-library-extensions-in-v4-0/
/alfresco/site-data/extensions/acme-rd-extension.xml • Renders objects with: (v4.2b) • userName • displayName • iso8601 • title • name • …or register a custom renderer (v.4.0) • <config evaluator="string-compare" condition="DocumentLibrary"> • <metadata-templates> • <template id="acme-rd-status"> • <evaluator>acme.rd.evaluator.doclib.hasArticleAspect</evaluator> • <line index="10" id="date">{date}{size}</line> • <line index="20" id="rd:status"> • {rd_statusacme.rd.metadata.status} • </line> • </template> • </metadata-templates> • </config> http://blogs.alfresco.com/wp/mikeh/2011/09/26/share-document-library-extensions-in-v4-0/
Hide “Documents” for Editors • Site Presetmodule: <components> • http://localhost:8081/share/page/surfBugStatus http://blogs.alfresco.com/wp/ddraper/2011/08/31/surfbug/
/alfresco/site-data/extensions/acme-rd-extension.xml • Also: Add & Replace • http://blogs.alfresco.com/wp/ewinlof/2011/11/09/add-remove-or-replace-components-on-shares-document-details-page/ • Component evaluators: (v4.0) • config.component.evaluator • equals.component.evaluator • portlet.component.evaluator • site.component.evaluator • preset.component.evaluator • http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Ftasks%2FCreate-a-Model.html • <component> • <scope>template</scope> • <region-id>filter</region-id> • <source-id>documentlibrary</source-id> • <sub-components> • <sub-component id="default"> • <evaluations> • <evaluation id="hideSiteManagersFilter"> • <render>false</render> • <evaluators> • <evaluator type="group.component.evaluator"> • <params><groups>SiteManager</groups></params> • </evaluator>
Step 3 • Partner “portal” • List R&D Projects • Only “Published” articles • “inline previewer”
Partner “portal” • Dashboard page • Partner Title • List of R&D projects (api/sites?spf=acme-rd-preset) • Document Library page • Partner Title • Document List (customized)
/alfresco/site-data/extensions/acme-rd-extension.xml • <module> • <id>Acme Rd (3) Partner changes</id> • <evaluator type="group.module.evaluator"> • <params> • <groups>GROUP_Partner</groups> • <groupRelation>AND</groups> • </params> • </evaluator> • <customizations> • <customization> • <targetPackageRoot>org.alfresco</targetPackageRoot> • <sourcePackageRoot>acme.rd.customizations-partner</sourcePackageRoot> • </customization>
/alfresco/templates/org/alfresco/dashboard.ftl • <@markup id="alf-hd”><div id="alf-hd"> • <@region id="header" scope="global" /> • <@region id="title" scope="page" /> • <@region id="navigation" scope="page" /> • </div></@markup> • <@markup target="alf-hd" action="after" id="acme-after-alf-hd"> • <@region id="partner-title” scope="global" /> • <@region id="partner-sites" scope="global" /> • </@markup> /alfresco/templates/acme/rd/customizations-partner /dashboard.ftl • <#-- Remove markup sections we don't want --> • <@markup target="alf-hd"action="remove" id="acme-remove-alf-hd" /> http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Ftasks%2Ftu-share-FM-temp-customize.html
Only “Published” docs • Custom repository webscript • /slingshot/doclib2/acme-rd • rd:status == “Published” • Share “surf-doclist” webscript • <data-url-resolver> • “resolver.doclib.doclistDataUrl”
/alfresco/web-extensions/acme-rd-share-context.xml /alfresco/site-data/extensions/acme-rd-extension.xml • <bean id="acme.rd.doclib.resolver.doclistDataUrl” • class="org.alfresco.web.resolver.doclib. • DefaultDoclistDataUrlResolver"> • <property name="basePath" value="/slingshot/doclib2/acme-rd"/> • </bean> • <config evaluator="string-compare” condition="DocumentLibrary" • replace="true"> • <doclist><data-url-resolver> • acme.rd.doclib.resolver.doclistDataUrl • </data-url-resolver></doclist> • </config>
“inline previewer” • Document List “viewRenderer” • Notes from Ray’s session • https://devcon.alfresco.com/berlin/sessions/share-document-library-views-dam-interface http://rgauss.com/2012/08/08/adding-document-library-views-to-alfresco-share/
What we have done • Site extension project • Site Preset • Global module • Site preset module • Group module
Start worrying! • Engineering sessions • Slides & code • https://devcon.alfresco.com/berlin/sessions/share-customizations-live • Blogs • http://blogs.alfresco.com/wp/ewinlof/ • http://blogs.alfresco.com/wp/ddraper/ • Site Extension project • https://github.com/share-extras/site-extension