devcon share site customizations live 2012 pptx.ppt

38
Share Site Customizations Live David Draper @_DaveDraper Erik Winlöf @erikwinlof (UI Team)

Upload: jbg2010

Post on 27-Oct-2015

104 views

Category:

Documents


5 download

DESCRIPTION

share custom

TRANSCRIPT

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

• Publishes R&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

1. Define R&D projects

2. Make it available

Don’t worry, be happy!

Define R&D projects

• Used in create site dialog

• Customize using “preset-id” in evaluators

•Config template

/alfresco/site-data/presets/

acme-rd-presets.xml<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>

Also:

•Custom properties

•Rename pages w <pageMetadata>

•*-presets.xml (v 4.1)

http://blogs.alfresco.com/wp/ddraper/2011/11/01/spring-surf-presets/

/alfresco/site-data/pages/

acme-rd-introduction.xml<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>

Tip! (v4.0b)

•2-columns•2-columns-resizable•2-columns-narrow-left•2-columns-narrow-left•3-columnshttphttp://blogs.alfresco.com/wp/ewinlof/2011/10/12/create-pages-in-alfresco-share-using-new-out-of-the-box-templates/

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

<evaluator>

<components>

<configurations>

<customizations>

Add/remove/replacecomponents in a<@region>

Merge share-config

Enhance templates’& webscripts’:markup / resources / model

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

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/modules

create-site.get.js

model.sitePresets.push(

{

id: "acme-rd-preset",

name: msg.get("preset.acme-rd.title")

});

/alfresco/site-webscripts/acme/rd/customizations/modules

create-site.get.js

var sitePresets = [{

id: "site-dashboard",

name: msg.get("title.collaborationSite")

}];

model.sitePresets = sitePresets;

Demo 1: “Create R&D project”

How quick is Dave?

…he’s smart…

https://github.com/share-extras/site-extension

%>ant create-project -Dcompany=Acme -Dusecase=RD …

ShareNamespaced project structure:

•build targets

•Spring context file

•i18n

•Site preset

•Sample page & webscript

•Extension modules

•Doclib customizations

RepositoryNamespaced project structure:

•build targets

•Spring context file

•Content model

•Sample repo action

Note!

Not required…

Repository

https://devcon.alfresco.com/berlin/sessions/developing-doclib-actions-alfresco-4

http://wiki.alfresco.com/wiki/Data_Dictionary_Guide

Alternative solution:

Folder rule kicks off a simple workflowhttp://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Ftasks%2Flibrary-folder-rules-define.html

Step 2

1. Publishing articles

2. Show article info in the document library

3. “Slim down” Share for Editors

Publishing articles

• Doclib action

• 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

<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>

Also:

(v4.2b)•isSiteConsumer •isSiteContributor•isSiteCollaborator

•“pagelink” / “link” https://devcon.alfresco.com/berlin/sessions/developing-doclib-actions-alfresco-4

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

<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>

Tip!

<override>some-indicator-id</override>

“action” attribute

http://blogs.alfresco.com/wp/mikeh/2011/09/26/share-document-library-extensions-in-v4-0/

/alfresco/site-data/extensions/

acme-rd-extension.xml

<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_status acme.rd.metadata.status}

</line>

</template>

</metadata-templates>

</config>

Renders objects with: (v4.2b)•userName•displayName•iso8601•title•name

…or register a custom renderer (v.4.0)

http://blogs.alfresco.com/wp/mikeh/2011/09/26/share-document-library-extensions-in-v4-0/

Hide “Documents” for Editors

http://localhost:8081/share/page/surfBugStatus

http://blogs.alfresco.com/wp/ddraper/2011/08/31/surfbug/

/alfresco/site-data/extensions/

acme-rd-extension.xml

<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>

Also: Add & Replacehttp://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.evaluatorhttp://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Ftasks%2FCreate-a-Model.html

Demo 2: “R&D site customizations”

Step 3

1. Partner “portal”

2. List R&D Projects

3. Only “Published” articles

4. “inline previewer”

Partner “portal”

/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 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

<@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>

<#-- 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/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>

/alfresco/web-extensions/

acme-rd-share-context.xml

<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 sessionhttps://devcon.alfresco.com/berlin/sessions/share-document-library-views-dam-interface

http://rgauss.com/2012/08/08/adding-document-library-views-to-alfresco-share/

Demo 3: “Partner ‘portal’”

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