Publish Conditions

On This Page

    publishConditions module allows you to block content publishing until conditions specified in this module are satisfied. All existing connect conditions are supported by this module.

    Example

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 { "modules": { "publishConditions": [ { "errorMessage": { "value": "My error message" }, "context": "addon", "dialog": { "height": "100px", "url": "/your_api", "conditions": [ { "condition": "has_attachment", "invert": false } ], "header": { "value": "My custom header" }, "width": "500px" }, "conditions": [ { "or": [ { "condition": "user_is_admin", "invert": false }, { "condition": "has_attachment", "invert": false } ] }, { "condition": "user_is_logged_in", "invert": false } ], "name": { "value": "My Publish Condition" }, "key": "my-publish-condition" } ] } }

    Properties

    errorMessage
    Type
    i18n Property
    Required
    Yes
    Description

    An error message will help you to understand the issue and take necessary action to satisfy the publish condition.

    Note: If dialog property is missing, it will be displayed as a notification in Confluence.

    Represents a string that can be resolved via a localization properties file. You can use the same i18n Property key and value in multiple places if you like, but identical keys must have identical values.

    Example

    1
    2
    3
    4
    {
      "value": "My text"
    }
    

    Properties

    value
    Type
    string
    Max length
    1500
    Required
    Yes
    Description

    The human-readable default value. This will be used if no translation exists. Only the following HTML tags are supported: b, i, strong, em, and code.

    i18n
    Type
    string
    Max length
    300
    Description

    The localization key for the human-readable value. Translations for the keys are defined at the top level of the add-on descriptor.


    key
    Type
    string
    Max length
    100
    Required
    Yes
    Pattern
    ^[a-zA-Z0-9-]+$
    Description

    A key to identify this module.

    This key must be unique relative to the add on, with the exception of Confluence macros: Their keys need to be globally unique.

    Keys must only contain alphanumeric characters and dashes.

    The key is used to generate the url to your add-on's module. The url is generated as a combination of your add-on key and module key. For example, an add-on which looks like:

    { "key": "my-addon", "modules": { "configurePage": { "key": "configure-me", } } }

    Will have a configuration page module with a URL of /plugins/servlet/ac/my-addon/configure-me.


    name
    Type
    i18n Property
    Required
    Yes
    Description

    A human readable name.

    Represents a string that can be resolved via a localization properties file. You can use the same i18n Property key and value in multiple places if you like, but identical keys must have identical values.

    Example

    1
    2
    3
    4
    {
      "value": "My text"
    }
    

    Properties

    value
    Type
    string
    Max length
    1500
    Required
    Yes
    Description

    The human-readable default value. This will be used if no translation exists. Only the following HTML tags are supported: b, i, strong, em, and code.

    i18n
    Type
    string
    Max length
    300
    Description

    The localization key for the human-readable value. Translations for the keys are defined at the top level of the add-on descriptor.


    conditions
    Type
    [Composite Condition, Single Condition, ...]
    Description

    Conditions can be added to display only when all the given conditions are true.


    context
    Type
    string
    Defaults to
    addon
    Allowed values
    • page
    • PAGE
    • addon
    • ADDON
    • product
    • PRODUCT
    Description

    The context for the URL parameter. As of now only supported value is addon.

    • addon - a URL relative to the add-on's base URL


    dialog
    Type
    object
    Description

    Triggers the dialog on click of Publish button.

    The dialog allows you to display their custom content within iFrame in the dialog during publish button click.

    Trigger dialog close using postMessage

    You can close dialog by sending postMessage with action = closeConditionalPublishDialog
    1
    2
    3
    4
    5
    6
    7
    8
    9
    
      $(function(){
       setTimeout(() => {
         window.top.postMessage({
           action: "closeConditionalPublishDialog"
         }, AP._data.origin)
       }, 10000);
     })
     

    Properties

    url
    Type
    string
    Format
    uri-template
    Required
    Yes
    Description

    Specifies the destination of the dialog content. The interpretation of this field depends on the value of the context field.

    The URL attribute used for Publish Conditions does not support context parameters. However, the Connect JavaScript API can be used to gain the following context: content.id, content.type, and space.key.

    conditions
    Type
    [Composite Condition, Single Condition, ...]
    Description

    Conditions can be added to display only when all the given conditions are true.

    header
    Type
    i18n Property
    Description

    The header text for the dialog

    Represents a string that can be resolved via a localization properties file. You can use the same i18n Property key and value in multiple places if you like, but identical keys must have identical values.

    Example

    1
    2
    3
    4
    {
      "value": "My text"
    }
    
    height
    Type
    string
    Max length
    10
    Description

    Sets how high the dialog is in pixels

    width
    Type
    string
    Max length
    10
    Description

    Sets how wide the dialog is in pixels.


    params
    Type
    Object
    Description

    This object represents a map of key/value pairs, where each property name and value corresponds to the parameter name and value respectively.

    Example

    1
    2
    3
    4
    5
    6
    7
    {
      "params": {
        "someOtherProperty": "someValue",
        "myCustomProperty": "myValue"
      }
    }
    

    Rate this page: