atlascamp 2011: confluence 4 and beyond
TRANSCRIPT
Sherif MansourConfluence Product Manager, Atlassian
Charles MillerConfluence Architect, Atlassian
Confluence 4 and Beyond
2
• Confluence 4 for
• Users
• Plugin Developers
• Beyond the 4.0 editing experience
• Releases
• Other 4.0 developer improvements
Agenda
3
Confluence 4.0
4
Confluence 4.0
4
5
5
experiences Fir! class
5
experiences Fir! class
6
First class for content
6
• Value increases with content
First class for content
6
• Value increases with content
• Start of collaboration cycle
First class for content
7
7
You
7
You
7
You
8
9
9
Brilliantly Simple
10
10
Packed with Power
visual macros advanced tables
11
11
Intelligent and Fast
autoformat wiki markup autocomplete + shortcut luv
paste images
h1. Hi -> Hi
*bold* -> bold
:) ->
12
12
Familiarly Social
13
First Class Content Creation Experience
13
First Class Content Creation Experience
Brilliantly Simple Packed with Power
Intelligent and Fast Familiarly Social
14
14
15
Confluence 2.x15
Confluence 2.x Confluence 3.x15
Confluence 2.x Confluence 4.xConfluence 3.x15
16
Confluence 4.x
16
Confluence 4.x
17
Confluence 4.x
17
Confluence 4.x
17
Confluence 4.x
17
Confluence 4.x
17
You control this experience
Confluence 4.x
17
Confluence 4.x
17
Confluence 4.x
17
Confluence 4.x
18
Confluence 4.x
• No macro parameter knowledge required
• No need for the user to know about the macro
• Create a more WYSIWYG experience
• You control the experience, seamless integration
19
1. Insert menu
2. Formatting menu
3. Custom property panel buttons
4. Rendered images as macro placeholders
5. Footer actions
6. Default parameter in placeholder
Confluence 4.x
19
1. Insert menu
2. Formatting menu
3. Custom property panel buttons
4. Rendered images as macro placeholders
5. Footer actions
6. Default parameter in placeholder
Confluence 4.x
2:15 pmThursday
Ryan Thomas
20
20
Fir! class
• 4.1 - Page Layouts
• 4.2 - Template Improvements
Beyond 4.0
21
Sherif MansourConfluence Product Manager, Atlassian
Confluence 4 and Beyond
22
Charles MillerConfluence Architect, Atlassian
Sherif MansourConfluence Product Manager, Atlassian
Confluence 4 and Beyond
22
Charles MillerConfluence Architect, Atlassian
…that aren’t the rich text editor
Two cool things for 4.0
23
Charles MillerConfluence Architect, Atlassian
Closure Templates
24
• Language-neutral
• Compiled to Javascript for the client
• Component-based
Closure Templates
25http://code.google.com/closure/templates/index.html
Defining a template
26
{namespace Confluence.Templates.Example}/** * Renders a Hello message. * @param name the name of the user */{template .helloWorld} <div>Hello {$name}!</div>{/template}
https://developer.atlassian.com/display/CONFDEV/Templating+in+JavaScript+with+Soy
example.soy
Looping and Branching
27
{foreach $child in $children} {call .pageInfo data="$child"} {param oddRow: index($child) % 2 /} {/call}{ifEmpty} {getText(‘page.has.no.children’)} {/foreach}
Invoking a template
28
var data = {name: “John Smith”}
Confluence.Templates.Example.helloWorld(data);
https://developer.atlassian.com/display/CONFDEV/Templating+in+JavaScript+with+Soy
example.js
Compiling a template
29
<web-resource key="example-resources"> <transformation extension="soy"> <transformer key="soyTransformer"/> </transformation>
<resource type="download" name="example-soy.js" location="/soy/example.soy"/></web-resource>
atlassian-plugin.xml
https://developer.atlassian.com/display/PLUGINFRAMEWORK/Web+Resource+Transformer+Plugin+Module
• Bundled plugin in Confluence 4.0
• Server-side templates supported in 4.1
Closure (Soy) Templates
30
JSON-RPC
31
• SOAP
• Complicated XML protocol
• Made easy with tool support
• XML-RPC
• Simpler XML protocol
• Widely available libraries
RPC
32https://developer.atlassian.com/display/CONFDEV/Confluence+XML-RPC+and+SOAP+APIs
• Data transport agnostic (usually XML/JSON)
• Pure HTTP, no need for library support
• Limited Confluence API
REST
33
• Simple JSON protocol
• RPC, not REST
• Easy to use from the browser
JSON-RPC
34
• Too much protocol overhead
• Still requires a client-side library
Standard JSON-RPC
35http://groups.google.com/group/json-rpc
• Exposes all XML-RPC/SOAP services as JSON-RPC
• Authentication via web login session
• Supports both standard JSON-RPC and a web-friendly “light” protocol
JSON-RPC plugin
36https://plugins.atlassian.com/plugin/details/40277
JSON-RPC Light Request
37
[ "DOC" ]POST /rpc/json-rpc/confluenceservice-v2/getSpace
JSON-RPC Light Response
38
{ key : "DOC", name : "Documentation Space", url : "http://wiki.example.com/display/DOC", homePage : "Home", description : "Product Documentation" }
POST /rpc/json-rpc/confluenceservice-v2/getSpace
Calling from jQuery
39
jQuery.ajax({ url: Confluence.getContextPath() + “/rpc/json-rpc/confluenceservice-v2/getSpace”, type: “POST”, dataType: “json”, contentType: "application/json", data: JSON.stringify([ AJS.Meta.get(“space-id”) ]), success: function(data) { show_space(data) }, error: function(data) { show_error(data) }});
• Available from plugins.atlassian.com
• Compatible with Confluence 3.5 or later
• Will be bundled with Confluence 4.1
Confluence JSON-RPC Plugin
40
Putting them together…
41
42
43
Retrieve with JSON-RPC
44
jQuery.ajax({ url: Confluence.getContextPath() + "/rpc/json-rpc/confluenceservice-v2/getPageHistory", type: "POST", dataType: "json", contentType: "application/json", data: JSON.stringify([ AJS.Meta.get("page-id") ]), success: function(data) { show_history_popup(data) }, error: function(data) { show_error_popup(data) } });
Display with Closure
45
function show_history_popup(historyData) { popup = AJS.ConfluenceDialog({ width : 865, height: 530, id: "page-history-dialog", onCancel: cancel }); ... popup.addPanel( Confluence.Templates.Plugins.Pagehistory.popup( { histories: historyData }) popup.show();}
Display with Closure
46
/** * Displays the page history popup * * @param histories array of the history objects to list */{template .popup} <form name="diff" method="GET" action="{contextPath}/pages/diffpagesbyversion.action">
<input type="submit" value="{getText('compare.selected')}"> <input type="hidden" name="pageId" value="{$histories[0].id}"> <table id="page-history-container" width="100%" cellspacing="0" class="tableview"> <tr> <th> </th> <th>{getText('heading.version.number')}</th> <th>{getText('heading.version.date')}</th> <th>{getText('heading.comment')}</th> </tr>
{foreach $history in $histories} {call .historyRow data="$history"} {param current: isFirst($history)/} {/call} {/foreach} </table> </form>{/template}
pagehistory-template.soy
Cheat it into the menu…
47
$("#action-view-history-link").click(function(e) { show_history(); e.preventDefault();});
48
Download the code
49
https://bitbucket.org/cmiller_atlassian/atlascamp-pagehistory-demo
Thank you
50
• Learn more about Confluence 4:
1.http://atlss.in/confluence4
2.Hands-on Developer Sessions
3.“Pimp my Confluence Plugin” - Thursday, 2:15pm
Thank you!