lucee.Componentcbmessagebox.MessageBox
Copyright Since 2005 Ortus Solutions, Corp www.ortussolutions.com --- This module provides a way to track alert message boxes. The user has several types of message types 1. Warn 2. Error 3. Info 4. Success The messages and optional metadata will be stored in the application's Flash RAM storage. --- The look and feel of the messages can be altered by styles and cfml template settings.
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
any
|
flash
DI ***********************************************************.
|
true
|
false
|
|
string
|
flashDataKey
The flash data key to use in the flash RAM data struct.
|
true
|
false
|
|
string
|
flashKey
The flash message key to use in the flash RAM data struct.
|
true
|
false
|
|
string
|
moduleRoot
The module root location.
|
true
|
false
|
|
boolean
|
styleOverride
Flag to override styles when rendering.
|
false
|
true
|
false
|
string
|
template
The default rendering template to use.
|
true
|
false
|
Constructor Summary | |
---|---|
init(struct config)
Constructor. |
Method Summary | |
---|---|
MessageBox
|
addData(any key, any value)
Add metadata that can be used for saving arbitrary stuff alongside our flash messages. |
MessageBox
|
append(any message, [any defaultType='info'])
Appends a message to the messagebox data. |
MessageBox
|
appendArray(array messageArray, [any defaultType='info'])
Append an array of messages to the MessageBox. |
MessageBox
|
clearMessage()
Clears the message structure by deleting it from the session scope. |
MessageBox
|
error([any message=''], [array messageArray])
Facade to setmessage with error type. |
private string
|
flattenMessageArray(array messageArray, [string separator=' ']) Flatten a message array into a string with separators. |
array
|
getData([boolean clearData='true'])
Get the message data. |
string
|
getDataJSON([boolean clearData='true'])
Get the message data as js. |
string
|
getFlash()
|
string
|
getFlashDataKey()
|
string
|
getFlashKey()
|
struct
|
getMessage()
Returns a structure of the messages if it exists, else a blank structure. |
string
|
getModuleRoot()
|
string
|
getStyleOverride()
|
string
|
getTemplate()
|
boolean
|
hasMessageType(string type)
Returns true if the message box contains a message of specified type. |
MessageBox
|
info([any message=''], [array messageArray])
Facade to setmessage with info type. |
boolean
|
isEmptyMessage()
Checks wether the MessageBox is empty or not. |
private boolean
|
isValidMessageType(string type)
Validate a type. |
MessageBox
|
prependArray(array messageArray, [any defaultType='info'])
Prepend an array of messages to the MessageBox. |
MessageBox
|
putData(array theData)
WARNING: Override the entire flash metadata key with your own array of data. |
any
|
renderIt([boolean clearMessage='true'], [any template=''])
Renders the message box and clears the message structure by default. |
string
|
renderMessage(any type, [any message=''], [any messageArray], [any template=''])
Renders a messagebox immediately for you with the passed in arguments. |
any
|
setFlash(any flash)
|
any
|
setFlashDataKey(string flashDataKey)
|
any
|
setFlashKey(string flashKey)
|
MessageBox
|
setMessage(any type, [any message=''], [array messageArray])
Create a new MessageBox with a specific message and type. |
any
|
setModuleRoot(string moduleRoot)
|
any
|
setStyleOverride(boolean styleOverride)
|
any
|
setTemplate(string template)
|
MessageBox
|
success([any message=''], [array messageArray])
Facade to setmessage with success type. |
MessageBox
|
warn([any message=''], [array messageArray])
Facade to setmessage with warn type. |
MessageBox
|
warning([any message=''], [array messageArray])
Facade to setmessage with warn type. |
Methods inherited from class lucee.Component |
---|
None |
Constructor Detail |
---|
Constructor
config
- The messagebox module configuration structureProperty Detail |
---|
DI ***********************************************************
access
- publicrequired
- falsereturntype
- anyinject
- coldbox:flashserializable
- trueThe flash data key to use in the flash RAM data struct
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe flash message key to use in the flash RAM data struct
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe module root location
access
- publicrequired
- falsereturntype
- anyserializable
- trueFlag to override styles when rendering
access
- publicrequired
- falsereturntype
- anyserializable
- trueThe default rendering template to use
access
- publicrequired
- falsereturntype
- anyserializable
- trueMethod Detail |
---|
Add metadata that can be used for saving arbitrary stuff alongside our flash messages
key
- The key to storevalue
- The value to storeAppends a message to the messagebox data. If there is no message, then it sets the default type to info.
message
- The message to appenddefaultType
- The default type to use if not passed. Defaults to 'info'Append an array of messages to the MessageBox. If there is no message, then it sets the default type to info.
messageArray
- An array of messages to appenddefaultType
- The default type to use if not passed. Defaults to 'info'Clears the message structure by deleting it from the session scope.
Facade to setmessage with error type
message
- The message to flash, mutually exclusive to the 'messageArray' argument.messageArray
- An array of messages to flash, mutually exclusive to the 'message' argument.Flatten a message array into a string with
separators
messageArray
- The message array to flatten.separator
Get the message data
clearData
- clear the data from flash or not.Get the message data as js
clearData
- clear the data from flash or not.Returns a structure of the messages if it exists, else a blank structure.
Returns true if the message box contains a message of specified type
type
- The message type, available types are: success, info, error, warnFacade to setmessage with info type
message
- The message to flash, mutually exclusive to the 'messageArray' argument.messageArray
- An array of messages to flash, mutually exclusive to the 'message' argument.Checks wether the MessageBox is empty or not.
Validate a type
type
- The message typePrepend an array of messages to the MessageBox. If there is no message, then it sets the default type to info.
messageArray
- An array of messages to prependdefaultType
- The default type to use if not passed. Defaults to 'info'WARNING: Override the entire flash metadata key with your own array of data.
theData
- The array of data to flashRenders the message box and clears the message structure by default
clearMessage
- Flag to clear the message structure or not after rendering. Default is true.template
- An optional CFML template to use for rendering instead of core or settingRenders a messagebox immediately for you with the passed in arguments
type
- The message type, available types are: success, info, error, warnmessage
- The message to flash, mutually exclusive to the 'messageArray' argument.messageArray
- An array of messages to flash, mutually exclusive to the 'message' argument.template
- The CFML template to use to render the messagebox, if not passed then the one set as default will be used.flash
flashDataKey
flashKey
Create a new MessageBox with a specific message and type
type
- The message type, available types are: success, info, error, warnmessage
- The message to flash, mutually exclusive to the 'messageArray' argument.messageArray
- An array of messages to flash, mutually exclusive to the 'message' argument.moduleRoot
styleOverride
template
Facade to setmessage with success type
message
- The message to flash, mutually exclusive to the 'messageArray' argument.messageArray
- An array of messages to flash, mutually exclusive to the 'message' argument.Facade to setmessage with warn type
message
- The message to flash, mutually exclusive to the 'messageArray' argument.messageArray
- An array of messages to flash, mutually exclusive to the 'message' argument.Facade to setmessage with warn type
message
- The message to flash, mutually exclusive to the 'messageArray' argument.messageArray
- An array of messages to flash, mutually exclusive to the 'message' argument.