Building Content-centric Add-ons for Confluence

Preview:

Citation preview

NIRAJ BHAWNANI • CONFLUENCE DEVELOPER • ATLASS IAN • @NIRAJBHAWNANI

Building Content-centric Add-ons for Confluence

What is a “content-centric add-on?”

Types of content-centric add-ons

Macros Blueprints SpaceBlueprints

Ok, but why do I care?

• Confluence guru

• introduced Confluence to BigCorp

• talented plugin developer

Bob, Senior Developer

• not very tech savvy

• “How can I create an event page?”

• Bob writes him an “Event” macro

Jason, Events Coordinator

Creating an event page from scratch

Creating an event page from scratch

• Confluence power user

• discovers a new use-case for Bob’s new macro

Alice, Project Manager

• Event macro has 2 use-cases:

• company event

• team demo meeting

Bob writes some blueprints

Creating an event page using blueprints

Creating an event page using blueprints

And everyone’s happy!

Thanks, Bob!

... but Bob’s not done yet!• Writes 2 space

blueprints:

• team space

• project space

Creating a team space

Now everyone’s really happy!

Great work, Bob!

DEVELOPMENT

FEATURES

OVERVIEW

Blueprints

OVERVIEW

• Blueprints allow you to surface your macros for a specific use case.

• Confluence 5.1+

• Examples - Decisions, meeting notes, file lists

When should you use blueprints?

The “blank page” problem

DEVELOPMENT

OVERVIEW

FEATURES

Blueprints

“How to” guide

1

2

Edit

meeting

label

Label Report

Wizard View/Index

@@@@@@

Page Properties

Custom

Blueprint features

Guidance

Create

Flow

ABC

Content

FEATURES

OVERVIEW

DEVELOPMENT

Blueprints

DEVELOPMENT

With the Atlassian SDK$ atlas-update

$ atlas-create-confluence-plugin-module

atlassian-plugin.xml

DEVELOPMENT

Code structure

<web-item>

<blueprint>

<content-template>

...

content-template.xml

ContextProvider.java

atlassian-plugin.xml

DEVELOPMENT

Code structure

<web-item>

<blueprint>

<content-template>

...

content-template.xml

ContextProvider.java

DEVELOPMENT

Create dialog web-item<web-item key="file-list-item" i18n-name-key="file.list.blueprint.name" section="system.create.dialog/content">

<description key="file.list.blueprint.description"/>

<resource name="icon" type="download" location="images/icon-filelist.png"/>

<param name="blueprintKey" value="file-list-blueprint"/>

</web-item>

atlassian-plugin.xml

DEVELOPMENT

Code structure

<web-item>

<blueprint>

<content-template>

...

content-template.xml

ContextProvider.java

DEVELOPMENT

Blueprint descriptor<blueprint key="file-list-blueprint" name="File List Blueprint" i18n-name-key="file.list.title" create-result="view" index-key="file-list" index-template-key="file-list-index-page" i18n-index-title-key= "file.list.index.page.title">

<content-template ref="file-list-page"/>

<dialog-wizard key="file-list-blueprint-wizard"> <dialog-page id="file-list-page1" template-key="Confluence.Templates.FileList.dialogForm" title-key="file.list.wizard.title" description-header-link-key="file.list.wizard.about.link" description-header-key="file.list.wizard.about.heading" description-content-key="file.list.wizard.about.description"/> </dialog-wizard>

</blueprint>

atlassian-plugin.xml

DEVELOPMENT

Code structure

<web-item>

<blueprint>

<content-template>

...

content-template.xml

ContextProvider.java

DEVELOPMENT

Content-template descriptor<content-template key="file-list-page" i18n-name-key="file.list.content.template.name">

<description key="file.list.content.template.description"/>

<resource name="template" type="download" location="xml/content-template.xml"/>

<context-provider class="com.atlassian.examples.FileListContextProvider"/>

</content-template>

atlassian-plugin.xml

DEVELOPMENT

Code structure

<web-item>

<blueprint>

<content-template>

content-template.xml

ContextProvider.java

...

DEVELOPMENT

Blueprint context providerpublic class FileListContextProvider implements ContextProvider{ public FileListContextProvider(...) { }

@Override public void init(Map<String, String> params) throws PluginParseException { }

@Override public Map<String, Object> getContextMap(Map<String, Object> context) { context.put("simpleVariable", "Hello world!"); context.put("rawXhtmlVariable", "<ac:structured-macro ac:name="cheese" />"); return context; }

}

atlassian-plugin.xml

DEVELOPMENT

Code structure

<web-item>

<blueprint>

<content-template>

...

content-template.xml

ContextProvider.java

DEVELOPMENT

Content template XML<at:var at:name="simpleVariable"></at:var>

<at:var at:name="rawXhtmlVariable" at:rawxhtml="true"></at:var>

Hello World!

<at:var at:name="rawXhtmlVariable" at:rawxhtml="true"></at:var>

Hello World!

<ac:structured-macro ac:name="cheese" />

• Blueprints package an entire use-case into a single create experience.

• Blueprints more than templates

• Easily created with the Atlassian SDK

Blueprints summary

DEVELOPMENT

FEATURES

OVERVIEW

Space Blueprints

OVERVIEW

• When you want to create a type of space with:

• prepackaged content

• certain blueprints promoted

• a custom homepage tying everything together

• Confluence 5.3+

• Examples - team space, knowledge base space

When should you use space blueprints?

OVERVIEW

How does it work?

DEVELOPMENT

OVERVIEW

FEATURES

Space Blueprints

“How to” guide

1

2

Wizard

Space blueprint features

Guidance

Custom

SpaceSettings

ABC

Content

Page hierarchy

HomepagePromoted Blueprints

team

project

SpaceCategories

FEATURES

OVERVIEW

DEVELOPMENT

Space Blueprints

atlassian-plugin.xml

DEVELOPMENT

Code structure

<web-item>

<space-blueprint>

<content-template>

...

content-template.xml

ContextProvider.java

atlassian-plugin.xml

DEVELOPMENT

Code structure

<web-item>

<space-blueprint>

<content-template>

...

content-template.xml

ContextProvider.java

<web-item key='team-space-blueprint-item' i18n-name-key='confluence.team.space.name' section='system.create.space.dialog/content'>

<resource name='icon' type='download' location='/images/icon-space-team-48.png'/>

<description key='confluence.team.space.description'/>

<param name='blueprintKey' value='team-space-blueprint'/>

</web-item>

DEVELOPMENT

Create space dialog web-item

atlassian-plugin.xml

DEVELOPMENT

Code structure

<web-item>

<space-blueprint>

<content-template>

...

content-template.xml

ContextProvider.java

DEVELOPMENT

Space blueprint descriptor<space-blueprint key="team-space-blueprint" i18n-name-key="confluence.team.space.name" category="teams">

<content-template ref="team-space-homepage-template"/>

<promoted-blueprints> ... <blueprint ref="com.atlassian.confluence.plugins.confluence-create-content-plugin:create-blank-page"/> <blueprint ref="com.atlassian.confluence.plugins.confluence-create-content-plugin:create-blog-post"/> </promoted-blueprints>

<dialog-wizard key="team-space-blueprint-wizard"> <dialog-page id="teamSpaceId" template-key="Confluence.SpaceBlueprints.Team.dialogForm" title-key="confluence.team.space.create.title" description-header-key="confluence.team.space.create.heading" description-content-key="confluence.team.space.create.description" last="true"/> </dialog-wizard>

</space-blueprint>

atlassian-plugin.xml

DEVELOPMENT

Code structure

<web-item>

<space-blueprint>

<content-template>

...

content-template.xml

ContextProvider.java

DEVELOPMENT

Content template descriptor<content-template key="team-space-homepage-template" i18n-name-key="confluence.team.space.homepage.name"> <description key="confluence.team.space.homepage.desc"/> <resource name="template" type="download" location="xml/team-space-home.xml"/>

<content-template key="team-space-child-page" i18n-name-key="confluence.team.space.homepage.name"> <description key="confluence.team.space.childpage.desc"/> <resource name="template" type="download" location="xml/team-space-child.xml"/> </content-template>

</content-template>

DEVELOPMENT

Developer resourceshttp://go.atlassian.com/dev-space-

blueprints

• Like blueprints, they package a use-case but at the space level.

• Space blueprints let you create a type of space with:

• a custom homepage

• prepackaged content

• promoted blueprints

Space blueprints summary

Where to go from here?

• Grab the Atlassian SDK

• Check out our developer documentation:

• Write your own! Submit them to the Marketplace.

Where to go from here?

http://go.atlassian.com/sdk

http://go.atlassian.com/dev-macros

http://go.atlassian.com/dev-blueprints

http://go.atlassian.com/dev-space-blueprints

• Think of use-cases in your organization

• Write Blueprints to solve them!

Be like Bob!

Thank you!

NIRAJ BHAWNANI • CONFLUENCE DEVELOPER • ATLASS IAN • @NIRAJBHAWNANI

Text code below to 22333or visit http://bit.ly/19dVZcc

Building Content-Centric Add-ons for Confluence

To join this session, send text 136888 to

AWESOME = 16

PRETTY GOOD = 15

NOT BAD = 14

MEH = 13

Rate this Talk

Recommended