Run Plugin

Description | Compatibility | Documentation | Export | Usage | Release History | Open Issues | Screenshots
Name Run Plugin
Vendor Bob Swift and other contributors
Authors Bob Swift
Homepage http://confluence.atlassian.com/display/CONFEXT/Run+Plugin
Issue Management http://developer.atlassian.com/jira/browse/RUN
Categories Content Macros
Version 1.0.0
Availability Confluence v2.5.2 to v2.10-m1
State Stable
Support Unsupported Plugins
License Freeware / Open Source (BSD)
Price Free
Release Docs http://confluence.atlassian.com/display/CONFEXT/Run+Plugin
Java API Docs n/a
Download Source http://svn.atlassian.com/svn/public/contrib/confluence/run-plugin/trunk
Download JAR run-plugin-1.0.0.jar

Additional Information

JVM requirements Java 1.4 and above
Installation requirements Confluence Repository Client
or upload from Confluence's administration console.
Cannot be installed in /WEB-INF/lib

Description

Dynamic content based on substitution of parameters provided by page user. Macro displays a dialog for substitution parameters and then renders the body contents after substitution.

Downloads

Date 2008-Mar 2008-Apr 2008-May 2008-Jun 2008-Jul 2008-Aug 2008-Sep
Hits 49 103 82 89 84 65 13

Compatibility

Plugin 2.2 2.3 2.4 2.5 2.6 2.7 2.8 Tested release
1.0.0 2.5.2, 2.7.1, 2.8
0.7.0 2.2.9, 2.5.2, 2.7.1

Documentation

  • Also see the Notation guide on your installation.

Allows user control over the rendering of the body of the macro. Parameters can be provided and they will be used to replace parameters in the body prior to rendering. Parameters can be provided as request parameters on the URL, enabling automatic running of content based on the incoming parameters. Any text in the macro body that begins with $ immediately followed by a key value found in the replace parameter list of comma separated key:value:description triples will be replaced by the value. Until the documentation can be improved, look at the url after pressing the run button or after an autorun.
Some pre-defined variables are available for use:

  • $current_user_id will be replaced with the current logged in user's id or blank if not logged in
  • $current_user_name will be replaced with the current user's full name or blank if not logged in
  • $current_user_email will be replaced with the current user's email address or blank if not logged in
  • $page_title will be replaced with the page title of the page containing the macro
  • $space_name will be replaced with the space name of the page containing the macro
  • $space_key will be replaced with the space key of the page containing the macro
  • $current_time will be replaced with the current date and time in the format specified by the dateFormat parameter

The html, representing the rendered body of the macro, can be exported to a page attachment or to the file system. This enables the dynamic content to be captured at a point in time for later viewing. An attachment or file created by this type of export, can be used on a page by including it in the body of an {html} macro. For example: {html:script=^bobs.html} {html}

Advanced capabilities: If exportVersion=keep is used, the referenced attachment is already there, and the HTML macro is authorized for use on the page, then the macro body will not be rendered and the attachment will be included instead. This enables caching and automation capabilities.

Recursive use: Three identical macros run, run1, and run2 are provided to enable recursive use of the macro.

Parameters

  • id - Optional way to identify this instance of the run macro. By default, a numeric id is automatically assigned based on the order of the macro on the page. The id is visible in the url after a button press.
  • replace - A comma separated list of key:value:description triples. Any string containing a comma (,) or colon (:) must be enclosed in single quotes (').
    • key is the parameter name. This must be non blank.
    • value is the initial replacement value. If not provided, blank will be used.
    • description is text used to provide prompt text for the parameter. If not provided, the key will be used.
  • inputSize - Size of the value entry fields. Default is 20.
  • autoRun - Default is false. Set to true to render the macro body with the default parameter values.
  • heading - Heading that appears before the buttons. Default is blank.
  • prompt - Prompt text that appears above the parameters. Default is blank.
  • titleRun - Title for the run button. Default is Run
  • titleExport - Title for the export button. Default is Export. Exportfile parameter is required before the export button will show.
  • titleExportFile - Title for the export file input field. Default is blank. This will only be shown if exportfile parameter value starts with a question mark (?).
  • titleAttachmentComment - Title for the attachment comment input field. Default is blank. This will only be shown if attachmentComment parameter value starts with a question mark (?).
  • hideParameters - Hide the parameters. Default is false.
  • hideRun - Hide the Run button. Default is false.
  • hideExport - Hide the Export button. Default is true unless exportFile is non-blank.
  • exportFile - Location of the export partial html file representing the rendered macro body. For export to an attachment, the user must be authorized to add attachments to the page specified.
    • ^attachment - The rendered html is exported as an attachment to the current page.
    • page^attachment - The rendered html is exported as an attachment to the page name provided.
    • space:page^attachment - The rendered html exported as an attachment to the page name provided in the space indicated.
    • filename - The rendered html is exported as a file located in confluence home directory/script/filename. Subdirectories can be specified. Replacement keys are allowed in this field and will be replaced with values.
  • exportVersion - Defines the the versioning mechanism for exported html.
    • new - (default) Creates new version of the attachment. For file based exports 'new' has the same effect as 'keep'.
    • replace - Replaces (overwrites) existing rendered html and, for attachments, removes all previous versions! To replace an existing attachment, the user must be authorized to remove attachments for the page specified.
    • keep - Only creates an new export if an existing export of the same name does not exist. An existing attachment will not be changed and an existing file will not be updated.
  • attachmentComment - Comment used for an exported attachment. If it begins with a question mark (?) then an entry field with this value will appear next to the export button. Replacement keys are allowed in this field and will be replaced with values.
  • autoExport - Default is false. Set to true to have the rendered macro body automatically exported.
  • showKey - Show the key. The key is shown after the value entry field. Default is false.
  • dateFormat - Date format to use for replacement of $current_time. Default is server date format. The notation guides has informaiton on the format of this parameter.
  • keepRequestParameters - Default is false. Set to true to keep existing request parameters on the url after button is pressed. All requests parameters will be retained if keepRequestIds is not specified. Otherwise, non-run macro request parameters and those references by the keepRequestIds parameter will be retained.
  • keepRequestIds - List of run macro ids whose request parameters should be retained on the url after a button is pressed. button is pressed. This will be required for recursive use of this macro. Use of this parameter or keepRequestParameters parameter is required for recursive use of this macro.

Export

The html representing the rendered body of the macro can be exported to a page attachment or to the file system. This enables the dynamic content to be captured at a point in time for later viewing. An attachment or file created by this type of export, can be used on a page by including it in the body of an HTML Plugin. For example:

{html:script=^bobs.html} {html}

If exportVersion=keep is used, the referenced attachment is already there, and the HTML macro is authorized for use on the page, then the macro body will not be rendered and the attachment will be included instead. This enables caching and automation capabilities.

Usage

Run example

Run a script

{run:replace=greeting:Hello,who:Bob}
{beanshell}
System.out.println("$greeting $who");
{beanshell}
{run}

Run a SQL query

{run:replace=first:Bob:First name|exportFile=^bobs.html|titleExport=Archive result}
{sql:datasource=NameDS}
select * from NAMES where first='$first'
{sql}
{run} 

Release History

Version Date State License Price
Show description 1.0.0 (#4) 16 Apr 2008 Stable Freeware / Open Source (BSD) Free

Release Notes

Atlassian Developer Network JIRA (4 issues)
Key Pr Summary Updated Reporter Status
RUN-14 Major Recursive use of run macro Apr 16, 2008 Bob Swift Closed
RUN-13 Major Add ability to keep existing request parameters on button push Apr 16, 2008 Bob Swift Closed
RUN-9 Major run macro to have some pre-defined (automatic) substitution values Apr 16, 2008 Ed Wittmann Closed
RUN-8 Major Ability to use the run macro by submitting form Apr 16, 2008 Scott Farquhar (Devsuite) Closed

Contributors

  • Bob Swift — Developer

Show description 0.7 (#3) 26 Jan 2007 Stable Freeware / Open Source (BSD) Free

Release Notes

Atlassian Developer Network JIRA (0 issues)
Key Pr Summary Updated Reporter Status

Contributors

  • Bob Swift — Developer

Show description 0.6 (#2) 05 Oct 2006 Beta Freeware / Open Source (BSD) Free

Contributors

  • Bob Swift — Developer

Show description 0.5 (#1) 16 Sep 2006 Beta Freeware / Open Source (BSD) Free

Contributors

  • Bob Swift — Developer

Older history

Version Date Author Notes
0.8-b4 03-Apr-2008 Bob Swift Beta jar Supports 2.5.2 to 2.8-m9-r3
0.8-b4 03-Apr-2008 Bob Swift Beta jar Supports 2.5.2 to 2.8-m9-r3
0.8-b3 09-Mar-2008 Bob Swift Beta jar Supports 2.5.2 to 2.7.1
0.8-b2 24-Feb-2008 Bob Swift Beta jar Supports 2.5.2 to 2.7.1
0.8-b1 10-Feb-2008 Bob Swift Beta jar Supports 2.5.2 to 2.7.1
0.7 26-Jan-2007 Bob Swift Usability and automation support
0.6 05-Oct-2006 Bob Swift RUN-1, beta release
0.5 16-Sep-2006 Bob Swift SCRP-70, beta release
0.4   Bob Swift Internal
0.3 12-Jul-2006 Bob Swift Description on parameters, limited running in preview mode
0.2 04-Jun-2006 Bob Swift Added export capability, parameter and button hiding
0.1 12-Apr-2006 Bob Swift Initial version - not formally released

Open Issues

Atlassian Developer Network JIRA (6 issues)
T Key Summary Reporter Assignee Pr Status
New Feature RUN-1 More input choices? Drop down choice, checkboxes, radio button. Patrice Saint-Louis Bob Swift Major Open
New Feature RUN-5 Harmonize with the replace-and-render macro James Mortimer Bob Swift Major Open
New Feature RUN-11 result of run plugin to be exported to a PAGE as WIKI (a.k.a. an attachment as html) James Mortimer Bob Swift Major Open
New Feature RUN-15 Control over URL parameter prefix David Dembo Bob Swift Major Open
Bug RUN-16 Pluging does not work if page title contains umlauts Christian Vollrath Bob Swift Major Open
New Feature RUN-17 new variable: $page_id (more useful than $page_title for SQL queries) Vincent Kopa Bob Swift Major Open

Screenshots

Labels

plugin plugin Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Oct 09, 2006

    patrice saint-louis says:

    Is it possible to have a dropdown of choices for the prompt? Similar to the in ...

    Is it possible to have a dropdown of choices for the prompt?

    Similar to the

    Unknown macro: {search-select}
    in the advanced search bar.

    http://confluence.atlassian.com/display/CONFEXT/Advanced+Search+Plugin?focusedCommentId=191663#comment-191663 

     That would be really nice!

    1. Oct 09, 2006

      Bob Swift says:

      Not sure how difficult, please write up an issue in the issue tracker indicated ...

      Not sure how difficult, please write up an issue in the issue tracker indicated at the start of this page, that way your request will not be lost.

      1. Jan 24, 2007

        James Mortimer says:

        if you start doing dropdowns and select lists, etc, then the RUN macro should be...

        if you start doing drop-downs and select lists, etc, then the RUN macro should be harmonized with the scaffolding plugin

  2. Oct 31, 2006

    Jeff Hatfield says:

    I've installed the 0.6 Run Plugin jar file and I'm getting this error in the adm...

    I've installed the 0.6 Run Plugin jar file and I'm getting this error in the admin console:

    Error: There was a problem loading the descriptor for module 'macro' in plugin 'Run Plugin'. Error retrieving dependency of class: org.swift.confluence.run.RunMacro. Missing class: org/swift/confluence/scriptutil/ScriptMacro

    Any idea what I need to do to fix it?

    1. Oct 31, 2006

      Bob Swift says:

      I suspect you put the jar in the WEBINF/lib. The new stuff bundles dependencies,...

      I suspect you put the jar in the WEB-INF/lib. The new stuff bundles dependencies, so it must be loaded using the repository or uploaded. I have updated this page to indicated that - sorry, I must have forgotten this one.

      1. Nov 01, 2006

        Jeff Hatfield says:

        Yep, that seems to have been the problem.  Thanks for the quick response an...

        Yep, that seems to have been the problem.  Thanks for the quick response and all your work on this plugin.  I think this is going to save us a ton of time.  We do a lot of SQL queries in Collaborate and now we should be able to make them more general and more functional. 

  3. Nov 14, 2006

    Juan Leon says:

    This macro is very helpful.  When placed in an authoring template, however,...

    This macro is very helpful.  When placed in an authoring template, however, it seems to block or disable the "Insert Variables" action.  No error is thrown, but the Insert action is never completed and the authoring process does not ever go on to create a new page and display it in edit mode.  Is there a fix or workaround for this problem?

    Thank you.

    1. Nov 14, 2006

      Bob Swift says:

      Sorry, don't know. Write up an issue to track it and I can see what needs to be ...

      Sorry, don't know. Write up an issue to track it and I can see what needs to be done. Please provide other feedback via issues or discussion as I am planning some significant work on this macro soon.

  4. Jan 09, 2007

    Bill Winett says:

    This macro looks compelling for use with SQL, but it seems to me that SQL inject...

    This macro looks compelling for use with SQL, but it seems to me that SQL injection would be trivial.  And I don't know how you could mitigate this problem reliably.  Maybe this can only be used with SQL if you KNOW that people using it can be trusted.  Thoughts?

    1. Jan 09, 2007

      Bob Swift says:

      SQL plugin can be controlled to only be used by certain groups, whether or not i...

      SQL Plugin can be controlled to only be used by certain groups, whether or not it is surrounded by a run macro. So, its not clear to me that this macro introduces any exposure other than if the user allows it. If there is such a case, it is easy to add the same controls to the run macro. Just submit an issue to the issue tracker.

      1. Jan 09, 2007

        Bill Winett says:

        I want to make sure we're on the same page here.  Let's say I, as the creat...

        I want to make sure we're on the same page here.  Let's say I, as the creator of a page, put this code on my page:
         

        {run:replace=first:Bob:First name|exportFile=^bobs.html|titleExport=Archive result}
        {sql:datasource=NameDS}
        select * from NAMES where first='$first'
        {sql}
        {run}

         
        And let's say that anyone in my company can read the page.
         
        Now, someone comes to the page.  The form is displayed, prompt