Module: alfresco/dialogs/AlfDialog

alfresco/dialogs/AlfDialog

An Alfresco styled dialog. Extends the default Dojo dialog by adding support for a row of buttons defined by the widgetButtons attribute. The main body of the dialog can either be defined as simple text assigned to the content attribute or as a JSON model assigned to the widgetsContent attribute (widgets take precedence over text - it is not possible to mix both).
Author:
  • Dave Draper
License:
Source:

Members

_buttons :object[]

This field is used to keep track of the buttons that are created.
Type:
  • object[]
Default Value:
  • null
Source:

cancelPublishScope :string

A scope against which to publish the cancellation topic
Type:
  • string
Default Value:
  • null
Source:

cancelPublishTopic :string

An optional topic to be published when the dialog is cancelled (escape keypress or cross-button click)
Type:
  • string
Default Value:
  • null
Source:

content :String

Basic text content to be added to the dialog.
Type:
  • String
Source:

cssRequirements :object[]

An array of the CSS files to use with this widget.
Type:
  • object[]
Default Value:
  • [{cssFile:"./css/AlfDialog.css"}]
Source:

duration :number

This controls the duration of the fade in/out effect when the dialog is shown and hidden.
Type:
  • number
Since:
  • 1.0.33
Default Value:
  • 0
Source:

fixedWidth :boolean

If this is set to true then the dialog will retain it's opening width regardless of what happens to it's contents. This is especially useful when the dialog contains widgets that resize themselves that could result in the dialog shrinking (this can occur when using HorizontalWidgets.
Type:
  • boolean
Default Value:
  • false
Source:

fullScreenMode :boolean

Indicates whether or not to override all dimension settings and to make the dialog consume all the available space on the screen (minus any padding).
Type:
  • boolean
Since:
  • 1.0.35
Default Value:
  • false
Source:

fullScreenPadding :boolean

When full screen mode is used this is the value in pixels that will be left as a padding between the edge of the dialog and the edge the screen.
Type:
  • boolean
Since:
  • 1.0.35
Default Value:
  • 10
Source:

handleOverflow :boolean

In some cases the content placed within the dialog will handle overflow itself, in that case this should be set to false. However, in most cases the dialog will want to manage overflow itself. Effectively this means that scroll bars will be added as necessary to ensure that the user can see all of the dialog content.
Type:
  • boolean
Default Value:
  • true
Source:

i18nRequirements :object[]

An array of the i18n files to use with this widget.
Type:
  • object[]
Default Value:
  • [{i18nFile: "./i18n/AlfDialog.properties"}]
Source:

noMinWidth :boolean

Indicates the the default minimum width rules for the dialog (controlled through LESS variables) can be ignored.
Type:
  • boolean
Since:
  • 1.0.84
Default Value:
  • false
Source:

<readonly> resizeListener :object

A placeholder for the resize-listener that's enabled while the dialog is visible. This value is set automatically.
Type:
  • object
Since:
  • 1.0.43
Source:

suppressCloseClasses :array

An optional array of CSS classes to check buttons for that will suppress dialog closure when the button is clicked. This has been added to allow button actions to be carried out to a successful conclusion before the dialog is closed. This means that button action failures will leave the dialog visible. In particular this addresses the use case of form dialogs not being closed if the form submission fails.
Type:
  • array
Default Value:
  • null
Source:

widgetsButtons :Object[]

Widgets to be processed into the button bar
Type:
  • Object[]
Default Value:
  • null
Source:

widgetsContent :Object[]

Widgets to be processed into the main node
Type:
  • Object[]
Default Value:
  • null
Source:

Methods

_onFocus()

This is called once the dialog gets focus and at that point it is necessary to resize it's contents as this is the final function that is called after the dialog is displayed and therefore we know it will have dimensions to size against.
Source:

allWidgetsProcessed(widgets)

Iterates over any buttons that are created and calls the attachButtonHandler function with each of them to ensure that clicking a button always results in the dialog being hidden. It is up to the buttons defined to publish a request to perform the appropriate action.
Parameters:
Name Type Description
widgets Object[]
Source:

attachButtonHandler(widget)

Hitches each button click to the "hide" method so that whenever a button is clicked the dialog will be hidden. It's assumed that the buttons will take care of their own business.
Parameters:
Name Type Description
widget Object The widget update
Source:

calculateHeights() → {object}

Calculates various heights that are used to set dimensions of the dialog when it is created as well as on resize events (such as resizing the window).
Since:
  • 1.0.36
Source:
Returns:
  • heights The calculated heights
    Type
    object
  • heights.clientHeight The height of the viewport
    Type
    number
  • heights.documentHeight The height of the document
    Type
    number
  • heights.maxBodyHeight The maximum height allowed for the body of the dialog
    Type
    number
  • heights.paddingAdjustment The pixels to allow for padding in the dialog body
    Type
    number
  • heights.simplePanelHeight The height of the SimplePanel containing the dialog content
    Type
    number

constructor(args)

Extends the default constructor to adjust for changes between 1.9.x and 1.10.x versions of the dijit/Dialog. This has been done to keep AlfDialog configuration backwards compatible.
Parameters:
Name Type Description
args object The constructor arguments
Source:

getButtons() → {promise}

Returns a promise to provide an array of all the buttons in the dialog.
Since:
  • 1.0.58
Source:
Returns:
An array of the buttons widgets for the dialog
Type
promise

onCancel()

Override the onCancel method of the Dojo Dialog class
Source:

onHide()

Called when the dialog is hidden. Enable the outer page scrolling - disabled in onShow().
Source:

onResizeRequest(payload)

Calls the resize() function
Parameters:
Name Type Description
payload object
Source:

onShow()

Called when the dialog is shown. Disable the outer page scrolling ability by the user when a dialog is showing.
Source:

onWindowResize()

This is called whenever the window is resized. It ensures that the dialog body is the correct height when taking into account the new size of the view port.
Since:
  • 1.0.36
Source:

postCreate()

Extends the superclass implementation to process the widgets defined by widgetButtons into the buttons bar and either the widgets defined by widgetsContent or the text string set as content into the main body of the dialog.
Source:

postMixInProperties()

Extends the superclass implementation to set the dialog as not closeable (by clicking an "X" in the corner).
Source:

resize()

Extends the default resize function to to provide the full screen mode capability.
Since:
  • 1.0.35
Source:

setTitle(newTitle)

Set the title of the dialog. The Dojo way of doing it uses innerHTML, so this is the recommended, XSS-safe way of doing it.
Parameters:
Name Type Description
newTitle string The new title
Since:
  • 1.0.52
Source:

show() → {Promise}

Override the default dialog method to ensure that the dialog starts its position at the top of the page to avoid the page scrolling to focus on its content (see call to child.focus() below).
Since:
  • 1.0.63
Source:
Returns:
Returns the superclass' promise
Type
Promise