js.Dialog Documentation Index:

Simple Dialogs: Dialog.alert
Dialog.confirm
Dialog.prompt
Base Classes: Dialog.core
Dialog.simple
Information: Callbacks
Settings: Dialog.settings Utilities: Functions

js.Dialog

Because it’s the 21st century, baby

Dialog.core (class)

Provides the basic functionality for all dialogs. The preferred way to use this class is to create a subclass (like Dialog.simple) where you can then implement your own functionality.

Content:

Constructors

initialize
Default constructor method. Will be called automatically when the Class is instantiated with the new operator.
Parameters: object: options (optional)
The parameter options can contain the following named parameters:
Possible properties for constructor options
Property Type Description Default
title String The title bar text "Dialog"
zIndex Integer the CSS layer in which the dialog shall appear. This is always relative to the body element. 32750
modal Boolean If true, the overlay layer will be displayed false
onLoad function Callback function that will be triggered once the dialog is displayed.
Parameters: dlg: Dialog.core
For more information, see Callbacks.
null
Usage:
Here is an example constructor for a simple dialog:
var dlg = new Dialog.core({
		    title: 'Simple Dialog',
		    modal: true
		});
Please note that in order to actually show the dialog, you would also need to call the show method on the dialog object.

Public Properties

uniqueId
Upon instantination, this property will be initialized to a random number. While there is currently no checking if this number already exists, it is very, very unlikely that you ever get two dialogs with the same id.
Type: Integer
dlgObject
As long as the dialog is displayed, this property contains a reference to the DOM-Element which represents the top-most dialog element (usually the 'DlgContainer' object).
Type: Element (Prototype, DOM)

Public Methods

isModal
Returns true if the dialog is modal (i.e. has an overlay) and false if not.
Parameters: none
Returns: Boolean
show
Shows the actual dialog. This is a simple implementation of the show() method which is primarily here for debugging purposes only. Subclasses should override this method.
Parameters: object: options (optional)
Returns: void
options may contain any of the following named parameters:
Possible properties for the options parameter object
Property Type Description Default
msg String A message that should be displayed in the dialog "{unset}"
onButtonClick function Callback function that will be triggered once the dialog is displayed.
Parameters: dlg: Dialog.core, num: Integer
For more information, see Callbacks.
null
In addition, the options object can contain any parameter that is available for the constructor methods.
cancel
Cancels the dialog. This does the same as hide, but it may be overridden to add more functionality.
Parameters: none
Returns: void
hide
Hides the dialog and removes it from the global registry. This method should be considered final. Please do not override it!
Parameters: none
Returns: void

Protected Methods

_showFrame
Shows the dialog frame as specified by the settings. This method should be considered final. Please do not override it!
Parameters: Node: node (required)
Returns: void
_showModalFrame
Modifies the settings to show a modal dialog, and then calls showFrame. This is a convenience method which should be considered final.
Parameters: Node: node (required)
Returns: void
_clickButton
Should be called whenever a button is clicked in the dialog body. The parameter should give a number which button has been pressed.
This method implements only very rudimentary behaviour (num=0 →cancel(), num=1 →hide()), that's why you should override it in the subclass.
Parameters: Integer: num (required)
Returns: void

Protected Properties

_options
All dialog options (set via the constructor or show parameters) are stored here.
Type: Object

Private Methods

_getOverlayNode
Returns a Node object that represents the overlay for modal dialogs. Will be called by showFrame in case the dialog to be displayed is modal.
Parameters: none
Returns: Node
_getFrameNode
Returns a Node object that represents the the dialog frame, i.e. the actual dialog without the body content.
The passed node parameter will be inserted as body into the node hierarchy.
Parameters: Node: node (required)
Returns: Node

References

Subclasses
The following classes are subclasses of Dialog.core:
– Dialog.simple