SlideShare a Scribd company logo
1
No coding necessary
Building user macros and dynamic reports inside Confluence



       Charles Hall
       Wiki Project Manager
       Astrium




                                                            2
Who we are




             Europe’s leading satellite manufacturer, number 3
                                worldwide.


                           www.astrium.eads.net




                                                                 3
Agenda

• What is a user macro?

• Worked example – colored tables

• Worked example – watermark for wiki pages

• Showcase




                                              4
User macros

• What is a user macro?
   • Added functionality
   • Removes complexity for authors
   • Facilitates re-use


• Restrictions
   • Used by users but…
   • …installed by system admins




                                      5
User macros

• Where can they be used?
  • Pages
  • Templates
  • In other user macros

   But not…
  • Custom HTML (administration screen)


• What do they consist of?
  •   HTML
  •   Javascript
  •   Velocity Template Language (VTL)
  •   References to Confluence objects

                                          6
Complexity vs Functionality
 High                                             Effort
                                                                  Capability




Functionality




                                     Complexity
                                                                               High
 Low
           Standard Wiki   {html}    User              Custom plugins
              markup                macros



                                                                                      7
An example

A performance testing tool – {response-time}




See your cheat sheet for details of this macro



                                                 8
Introducing jQuery

“I thought you said no coding?”

• A Javascript library for simplifying HTML document traversal, event handling, and adding
  AJAX support easily
• Already used by Confluence
• Minimizes Javascript coding




                                                                                             9
Worked example 1 – colored tables

No more boring tables!




                                    10
Worked example 1 – colored tables
      Listing 2

      ##   Macro name: color-table
      ##   Macro has a body: N
      ##   Body format: n/a
      ##   Output: HTML
      ##                                          Comment header
      ##   Developed by: Charles Hall
      ##   Developed for: All users
      ##   Date created: 23/02/2010
      ##   Installed by: Charles Hall

      ## Apply coloring to alternate rows of tables.

      <script type="text/javascript" defer="defer">
        jQuery(document).ready(function()
        {
          jQuery("tr:even").css("background-color", "#318db6");
          jQuery("tr:odd").css("background-color", "#f86a46");
        });
      </script>




                                                                   11
Worked example 1 – side effects

Test, test then test some more!




                                  12
Firebug to the rescue



                           Pinpoint the table(s) we
                             want to modify




           Point & Click




                                                      13
Worked example 1 – revised version
      Listing 2

      ##   Macro name: color-table
      ##   Macro has a body: N
      ##   Body format: n/a
      ##   Output: HTML
      ##
      ##   Developed by: Charles Hall
      ##   Developed for: All users
      ##   Date created: 23/02/2010
      ##   Installed by: Charles Hall

      ## Apply coloring to alternate rows of any tables with the class of
        confluenceTable.

      <script type="text/javascript" defer="defer">
        jQuery(document).ready(function()                            element.class
        {
           jQuery("table.confluenceTable tr:nth-child (odd)").css("background-color",
        "#f86a46");
           jQuery("table.confluenceTable tr:nth-child (even)").css("background-color",
        "#318db6");
        });
      </script>



                                                                                         14
Worked example 1 – Accepting parameters


                   {color-table:A2C1D5|BFEBEF}




                                                 15
Worked example 1 – Accepting parameters

       Listing 2

       ## Apply coloring to alternate rows of any tables with the
         class of confluenceTable.

       #set($oddcolor= $param0)
       #set($evencolor= $param1)

       ## Check for valid odd color, otherwise use default
       #if (!$oddcolor)
         #set ($oddcolor="ffffff")
       #end

       ## Check for valid even color, otherwise use default
       #if (!$evencolor)
         #set ($evencolor="ededed")
       #end




                                                                    16
Worked Example 2 - Using Confluence objects




                                             17
Worked example 2 – Referencing the image
{watermark:draft.gif|no-repeat|1000}
             Listing 3

             #set($image= $param0)
             #set($repeat = $param1)
             #set($minheight= $param2)

             <script type="text/javascript" defer="defer">
             jQuery(document).ready(function()
             {
             jQuery('#mainViewPane').css('background-image',
               'url($config.getBaseUrl()
               $content.getAttachmentNamed("$image").getDownloadPath())');
             …

                                                 2 strings joined together



                                                                             18
Worked example 2 – Setting the repeat behaviour


         Listing 3

         #set($repeat = $param1)
         …

         ## Add the specified repeat behaviour
         #if ($repeat)
           jQuery('#mainViewPane').css('background-repeat', '$repeat');
         #end

         …




                                                                          19
Worked example 2 – Specifying a minimum height



          Listing 3

          #set($minheight = $param2)
          …

          ## Check for a specified minimum height
          #if ($minheight)
            jQuery('#mainViewPane').css('height', '$minheight');
          #end

          …




                                                                   20
Worked example 2 – reusing

How about defining some standard watermarks to help users?
  • Draft
  • Company logo


Could we make the syntax easier too?

  • {draft-watermark}
  • {company-watermark}




                                                            21
Worked example 2 – reusing
      Listing 3

      …


      ## Check for full image path or attachment name
      #if($image.startsWith("http",0))
      #set($url=$image)
      #else
      #set($url=$config.getBaseUrl()+
       $content.getAttachmentNamed("$image").getDownloadPath())
      #end
      …




                                                                  22
Worked example 2 – reusing
      Listing 4

      ##   Macro name: draft-watermark
      ##   Macro has a body: N
      ##   Body format: n/a
      ##   Output: HTML
      ##
      ##   Developed by: Charles Hall
      ##   Developed for: Astrium wiki                             Calling the existing user macro
      ##   Date created: 19/04/2010
      ##   Installed by: Charles Hall


      ## N.B. Calls the watermark user macro
      ## draft.gif must reside in "company" space


      #set($url="http://globalcorp.com/confluence/download/attachments/74416134/draft.gif")


      $action.getHelper().renderConfluenceMacro("{watermark:$url|no-repeat|1000}")




                                                                                                     23
Showcase




           24
Gradient background




                      25
Page theme




             26
Client-side RSS feed reader




                              27
Tweaking another plug-in




                           28
Tweaking a standard feature
In summary

• Add real functionality
• Users can control behaviour
• Access to some Confluence objects
• Can perform useful UI tweaks
• Can be re-used in other macros

Useful resources
• See your cheat sheet




                                     30
Building Awesome
   Dashboards
     with Confluence



  Jim Severino, Atlassian
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
Confluence
        Free Plugins
+         Your Data
    =     Awesome
JDBC
Plugins For Reporting:
     1. SQL
     2. Chart
     3. Run
     4. Scripting
Plugin: SQL

{sql}             Wiki

        JDBC


        DB
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
Plugin: SQL

{sql}                 Table

            JDBC


           DB
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
Plugin: Chart
                    {chart}

{sql}           Table



        DB
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
Plugin: Chart
                    {chart}

{sql}           Table



        DB
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
https://confluence.foo.com
    /FOO/Sales+Report?
run_1_category=motorcycles
        &run_1=run
https://confluence.foo.com/FOO/Sales+Report




?run_1_category=motorcycles

        Other Parameters!
     &run_1_foo=...&run_1_bar=...
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
Plugin: Run
{run}                         {chart}

        {sql}             Table



                DB
Scripting
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
Text
       Image (c) United
        Feature Comics
Rule #1:
Macro Security
Recommendation:
       Use the
Macro Security Plugin.
Rule #2:
Datasource Security
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
Rule #3:
Summary Databases
Recommendation:
Run Reports off a
Summary Database
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
Plugins For Reporting:
     1. SQL
     2. Chart
     3. Run
     4. Scripting
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010
http://bit.ly/
howto-report

More Related Content

DOC
No Coding Necessary: Building Confluence User Macros Cheat Sheet - Atlassian ...
PPTX
IndexedDB - Querying and Performance
PDF
Introducing Rendr: Run your Backbone.js apps on the client and server
PPTX
Planbox Backbone MVC
PDF
Workshop 27: Isomorphic web apps with ReactJS
PDF
Sane Async Patterns
KEY
Overlays, Accordions & Tabs, Oh My
PDF
Workshop 8: Templating: Handlebars, DustJS
No Coding Necessary: Building Confluence User Macros Cheat Sheet - Atlassian ...
IndexedDB - Querying and Performance
Introducing Rendr: Run your Backbone.js apps on the client and server
Planbox Backbone MVC
Workshop 27: Isomorphic web apps with ReactJS
Sane Async Patterns
Overlays, Accordions & Tabs, Oh My
Workshop 8: Templating: Handlebars, DustJS

What's hot (20)

KEY
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
PPT
Drupal Javascript for developers
PPTX
Jsp presentation
PPTX
Implicit object.pptx
PDF
Viking academy backbone.js
PPT
Creating the interfaces of the future with the APIs of today
PDF
Workshop 6: Designer tools
PDF
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
PDF
JavaScript for Flex Devs
PDF
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
PDF
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
PDF
Refactoring Large Web Applications with Backbone.js
PDF
An Introduction To Testing In AngularJS Applications
PDF
Java Web Programming [5/9] : EL, JSTL and Custom Tags
PPTX
Backbone.js and friends
PDF
Java Web Programming [8/9] : JSF and AJAX
PDF
Raybiztech Guide To Backbone Javascript Library
PDF
Spring MVC Annotations
ODP
Java Spring MVC Framework with AngularJS by Google and HTML5
PDF
Introduction to backbone presentation
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Drupal Javascript for developers
Jsp presentation
Implicit object.pptx
Viking academy backbone.js
Creating the interfaces of the future with the APIs of today
Workshop 6: Designer tools
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
JavaScript for Flex Devs
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
In The Trenches With Tomster, Upgrading Ember.js & Ember Data
Refactoring Large Web Applications with Backbone.js
An Introduction To Testing In AngularJS Applications
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Backbone.js and friends
Java Web Programming [8/9] : JSF and AJAX
Raybiztech Guide To Backbone Javascript Library
Spring MVC Annotations
Java Spring MVC Framework with AngularJS by Google and HTML5
Introduction to backbone presentation
Ad

Viewers also liked (6)

PPTX
User Macros: Making Your Own Improvements to Confluence - Atlassian Summit 2012
PDF
AtlasCamp 2010: Making Confluence Macros Easy (for the user) - Dave Taylor
PDF
AtlasCamp 2014: Writing Connect Add-ons for Confluence
PDF
Build Amazing Add-ons for Atlassian JIRA and Confluence
PDF
Collaborating Across an Enterprise: Quarterly Planning at Twitter with JIRA a...
PDF
#OOW16 - Introducing Oracle Financial Reporting Compliance Cloud Service
User Macros: Making Your Own Improvements to Confluence - Atlassian Summit 2012
AtlasCamp 2010: Making Confluence Macros Easy (for the user) - Dave Taylor
AtlasCamp 2014: Writing Connect Add-ons for Confluence
Build Amazing Add-ons for Atlassian JIRA and Confluence
Collaborating Across an Enterprise: Quarterly Planning at Twitter with JIRA a...
#OOW16 - Introducing Oracle Financial Reporting Compliance Cloud Service
Ad

Similar to No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010 (20)

PDF
jQuery Migration
PPTX
TERMINALFOUR t44u 2009 - University of St Andrews Case Study
PPTX
Prairie Dev Con West - 2012-03-14 - Webmatrix, see what the matrix can do fo...
PDF
Recovering a Business Object Model from Web Applications
KEY
HTML CSS & Javascript
KEY
Better Front-end Development in Atlassian Plugins
PDF
Idiots guide to jquery
PDF
SilverStripe CMS JavaScript Refactoring
PDF
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
PDF
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
PDF
Calloway introduction
PDF
WebMatrix, see what the matrix can do for you!!
PDF
From where OpenVBX came from to how we open sourced it
PDF
Silverlight Document Search Engine
KEY
Get ready for web3.0! Open up your app!
PPT
Hyperlink.85 to 86
PDF
Wordcamp 2012 riaan knoetze - how to hijack a themeshop
PDF
Mike Taulty TechDays 2010 Silverlight 4 - What's New?
KEY
Architectures for Inclusive Design
PDF
DSVC Working Lunch Feb 2010: Exploring Interactive Interactions
jQuery Migration
TERMINALFOUR t44u 2009 - University of St Andrews Case Study
Prairie Dev Con West - 2012-03-14 - Webmatrix, see what the matrix can do fo...
Recovering a Business Object Model from Web Applications
HTML CSS & Javascript
Better Front-end Development in Atlassian Plugins
Idiots guide to jquery
SilverStripe CMS JavaScript Refactoring
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
DevTeach Ottawa - Webmatrix, see what the matrix can do for you!!
Calloway introduction
WebMatrix, see what the matrix can do for you!!
From where OpenVBX came from to how we open sourced it
Silverlight Document Search Engine
Get ready for web3.0! Open up your app!
Hyperlink.85 to 86
Wordcamp 2012 riaan knoetze - how to hijack a themeshop
Mike Taulty TechDays 2010 Silverlight 4 - What's New?
Architectures for Inclusive Design
DSVC Working Lunch Feb 2010: Exploring Interactive Interactions

More from Atlassian (20)

PPTX
International Women's Day 2020
PDF
10 emerging trends that will unbreak your workplace in 2020
PDF
Forge App Showcase
PDF
Let's Build an Editor Macro with Forge UI
PDF
Meet the Forge Runtime
PDF
Forge UI: A New Way to Customize the Atlassian User Experience
PDF
Take Action with Forge Triggers
PDF
Observability and Troubleshooting in Forge
PDF
Trusted by Default: The Forge Security & Privacy Model
PDF
Designing Forge UI: A Story of Designing an App UI System
PDF
Forge: Under the Hood
PDF
Access to User Activities - Activity Platform APIs
PDF
Design Your Next App with the Atlassian Vendor Sketch Plugin
PDF
Tear Up Your Roadmap and Get Out of the Building
PDF
Nailing Measurement: a Framework for Measuring Metrics that Matter
PDF
Building Apps With Color Blind Users in Mind
PDF
Creating Inclusive Experiences: Balancing Personality and Accessibility in UX...
PDF
Beyond Diversity: A Guide to Building Balanced Teams
PDF
The Road(map) to Las Vegas - The Story of an Emerging Self-Managed Team
PDF
Building Apps With Enterprise in Mind
International Women's Day 2020
10 emerging trends that will unbreak your workplace in 2020
Forge App Showcase
Let's Build an Editor Macro with Forge UI
Meet the Forge Runtime
Forge UI: A New Way to Customize the Atlassian User Experience
Take Action with Forge Triggers
Observability and Troubleshooting in Forge
Trusted by Default: The Forge Security & Privacy Model
Designing Forge UI: A Story of Designing an App UI System
Forge: Under the Hood
Access to User Activities - Activity Platform APIs
Design Your Next App with the Atlassian Vendor Sketch Plugin
Tear Up Your Roadmap and Get Out of the Building
Nailing Measurement: a Framework for Measuring Metrics that Matter
Building Apps With Color Blind Users in Mind
Creating Inclusive Experiences: Balancing Personality and Accessibility in UX...
Beyond Diversity: A Guide to Building Balanced Teams
The Road(map) to Las Vegas - The Story of an Emerging Self-Managed Team
Building Apps With Enterprise in Mind

Recently uploaded (20)

PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
KodekX | Application Modernization Development
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Cloud computing and distributed systems.
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPT
Teaching material agriculture food technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Chapter 3 Spatial Domain Image Processing.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
A Presentation on Artificial Intelligence
20250228 LYD VKU AI Blended-Learning.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Building Integrated photovoltaic BIPV_UPV.pdf
Big Data Technologies - Introduction.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
NewMind AI Monthly Chronicles - July 2025
Encapsulation_ Review paper, used for researhc scholars
KodekX | Application Modernization Development
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Cloud computing and distributed systems.
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Teaching material agriculture food technology
Understanding_Digital_Forensics_Presentation.pptx

No Coding Necessary: Building User Macros and Dynamic Reports Inside Confluence - Atlassian Summit 2010

  • 1. 1
  • 2. No coding necessary Building user macros and dynamic reports inside Confluence Charles Hall Wiki Project Manager Astrium 2
  • 3. Who we are Europe’s leading satellite manufacturer, number 3 worldwide. www.astrium.eads.net 3
  • 4. Agenda • What is a user macro? • Worked example – colored tables • Worked example – watermark for wiki pages • Showcase 4
  • 5. User macros • What is a user macro? • Added functionality • Removes complexity for authors • Facilitates re-use • Restrictions • Used by users but… • …installed by system admins 5
  • 6. User macros • Where can they be used? • Pages • Templates • In other user macros But not… • Custom HTML (administration screen) • What do they consist of? • HTML • Javascript • Velocity Template Language (VTL) • References to Confluence objects 6
  • 7. Complexity vs Functionality High Effort Capability Functionality Complexity High Low Standard Wiki {html} User Custom plugins markup macros 7
  • 8. An example A performance testing tool – {response-time} See your cheat sheet for details of this macro 8
  • 9. Introducing jQuery “I thought you said no coding?” • A Javascript library for simplifying HTML document traversal, event handling, and adding AJAX support easily • Already used by Confluence • Minimizes Javascript coding 9
  • 10. Worked example 1 – colored tables No more boring tables! 10
  • 11. Worked example 1 – colored tables Listing 2 ## Macro name: color-table ## Macro has a body: N ## Body format: n/a ## Output: HTML ## Comment header ## Developed by: Charles Hall ## Developed for: All users ## Date created: 23/02/2010 ## Installed by: Charles Hall ## Apply coloring to alternate rows of tables. <script type="text/javascript" defer="defer"> jQuery(document).ready(function() { jQuery("tr:even").css("background-color", "#318db6"); jQuery("tr:odd").css("background-color", "#f86a46"); }); </script> 11
  • 12. Worked example 1 – side effects Test, test then test some more! 12
  • 13. Firebug to the rescue Pinpoint the table(s) we want to modify Point & Click 13
  • 14. Worked example 1 – revised version Listing 2 ## Macro name: color-table ## Macro has a body: N ## Body format: n/a ## Output: HTML ## ## Developed by: Charles Hall ## Developed for: All users ## Date created: 23/02/2010 ## Installed by: Charles Hall ## Apply coloring to alternate rows of any tables with the class of confluenceTable. <script type="text/javascript" defer="defer"> jQuery(document).ready(function() element.class { jQuery("table.confluenceTable tr:nth-child (odd)").css("background-color", "#f86a46"); jQuery("table.confluenceTable tr:nth-child (even)").css("background-color", "#318db6"); }); </script> 14
  • 15. Worked example 1 – Accepting parameters {color-table:A2C1D5|BFEBEF} 15
  • 16. Worked example 1 – Accepting parameters Listing 2 ## Apply coloring to alternate rows of any tables with the class of confluenceTable. #set($oddcolor= $param0) #set($evencolor= $param1) ## Check for valid odd color, otherwise use default #if (!$oddcolor) #set ($oddcolor="ffffff") #end ## Check for valid even color, otherwise use default #if (!$evencolor) #set ($evencolor="ededed") #end 16
  • 17. Worked Example 2 - Using Confluence objects 17
  • 18. Worked example 2 – Referencing the image {watermark:draft.gif|no-repeat|1000} Listing 3 #set($image= $param0) #set($repeat = $param1) #set($minheight= $param2) <script type="text/javascript" defer="defer"> jQuery(document).ready(function() { jQuery('#mainViewPane').css('background-image', 'url($config.getBaseUrl() $content.getAttachmentNamed("$image").getDownloadPath())'); … 2 strings joined together 18
  • 19. Worked example 2 – Setting the repeat behaviour Listing 3 #set($repeat = $param1) … ## Add the specified repeat behaviour #if ($repeat) jQuery('#mainViewPane').css('background-repeat', '$repeat'); #end … 19
  • 20. Worked example 2 – Specifying a minimum height Listing 3 #set($minheight = $param2) … ## Check for a specified minimum height #if ($minheight) jQuery('#mainViewPane').css('height', '$minheight'); #end … 20
  • 21. Worked example 2 – reusing How about defining some standard watermarks to help users? • Draft • Company logo Could we make the syntax easier too? • {draft-watermark} • {company-watermark} 21
  • 22. Worked example 2 – reusing Listing 3 … ## Check for full image path or attachment name #if($image.startsWith("http",0)) #set($url=$image) #else #set($url=$config.getBaseUrl()+ $content.getAttachmentNamed("$image").getDownloadPath()) #end … 22
  • 23. Worked example 2 – reusing Listing 4 ## Macro name: draft-watermark ## Macro has a body: N ## Body format: n/a ## Output: HTML ## ## Developed by: Charles Hall ## Developed for: Astrium wiki Calling the existing user macro ## Date created: 19/04/2010 ## Installed by: Charles Hall ## N.B. Calls the watermark user macro ## draft.gif must reside in "company" space #set($url="http://globalcorp.com/confluence/download/attachments/74416134/draft.gif") $action.getHelper().renderConfluenceMacro("{watermark:$url|no-repeat|1000}") 23
  • 24. Showcase 24
  • 27. Client-side RSS feed reader 27
  • 30. In summary • Add real functionality • Users can control behaviour • Access to some Confluence objects • Can perform useful UI tweaks • Can be re-used in other macros Useful resources • See your cheat sheet 30
  • 31. Building Awesome Dashboards with Confluence Jim Severino, Atlassian
  • 42. Confluence Free Plugins + Your Data = Awesome
  • 43. JDBC
  • 44. Plugins For Reporting: 1. SQL 2. Chart 3. Run 4. Scripting
  • 45. Plugin: SQL {sql} Wiki JDBC DB
  • 47. Plugin: SQL {sql} Table JDBC DB
  • 50. Plugin: Chart {chart} {sql} Table DB
  • 53. Plugin: Chart {chart} {sql} Table DB
  • 61. https://confluence.foo.com /FOO/Sales+Report? run_1_category=motorcycles &run_1=run
  • 67. Plugin: Run {run} {chart} {sql} Table DB
  • 70. Text Image (c) United Feature Comics
  • 72. Recommendation: Use the Macro Security Plugin.
  • 76. Recommendation: Run Reports off a Summary Database
  • 78. Plugins For Reporting: 1. SQL 2. Chart 3. Run 4. Scripting