DeleteController Class
Deletes objects from the database
Constructor
DeleteController
()
Item Index
Methods
- canDelete
- checkForFormRefill
- displayErrorOrSuccessCallback
- formError
- getAutoSanitize
- getDataOnSuccess
- getDefaultErrorMessage
- getDeleteCollection
- getDeleteQuery
- getFormErrorRedirect
- getJSONPostParams deprecated
- getPageName
- getPostData
- getPostParams
- getRequiredFields
- getSanitizationRules
- getServiceContext
- getSuccessRedirect
- getTemplateServiceInstance
- hasRequiredParams
- init
- initSync
- onAfterDelete
- onBeforeDelete
- onLocalizedAlternateFlagFound
- onPostParamsError
- onPostParamsRetrieved
- redirect
- render
- requiresClientLocalization
- requiresClientLocalizationCallback
- sanitizeObject
- setAutoSanitize
- setFormFieldValues
- setPageName
Properties
- activeTheme
- autoSanitize
- body
- context
- localizationService deprecated
- ls
- pageName
- pathVars
- query
- referer deprecated
- req
- reqHandler
- res
- session
- ts
Methods
canDelete
-
cb
Parameters:
-
cbFunction
checkForFormRefill
-
result -
cb
Parameters:
-
resultString -
cbFunction
displayErrorOrSuccessCallback
-
flag -
cb
Parameters:
-
flagString -
cbFunction
formError
-
message -
redirectLocation -
cb
Parameters:
-
messageStringThe error message to be displayed
-
redirectLocationString -
cbFunction
getAutoSanitize
()
Boolean
Returns:
getDataOnSuccess
-
results
Parameters:
-
resultsArray
Returns:
getDefaultErrorMessage
()
String
Returns:
getDeleteCollection
()
String
Returns:
getDeleteQuery
()
Object
Returns:
getFormErrorRedirect
-
err -
message
Parameters:
-
errError -
messageString
Returns:
getJSONPostParams
-
cb
Parses the incoming payload of a request as JSON formatted data.
Parameters:
-
cbFunction
getPageName
()
String
Provides a page title. This is picked up by the template engine when the ^page_name^ key is found in a template.
Returns:
The page title
getPostData
-
cb
Parameters:
-
cbFunction
getPostParams
-
cb
Parameters:
-
cbFunction
getRequiredFields
-
cb
Parameters:
-
cbFunction
getSanitizationRules
()
Object
Returns:
getServiceContext
()
Object
Retrieves a context object that contains the necessary information for service prototypes
Returns:
getSuccessRedirect
()
String
Returns:
getTemplateServiceInstance
-
props
Creates a TemplateService instance
Parameters:
-
propsObject
Returns:
hasRequiredParams
-
queryObject -
requiredParameters
Parameters:
-
queryObjectObject -
requiredParametersArray
init
-
props -
cb
Responsible for initializing a controller. Properties from the RequestHandler are passed down so that the controller has complete access to a variety of request specified properties. By default the function transfers the options over to instance variables that can be access during rendering. In addition, the function sets up the template service along with a set of local flags:
- locale - The selected locale for the request (NOTE: this may not match the requested language if not supported)
- error_success - An alert box if one was registered by the controller
- page_name - The title of the page
- localization_script - Includes the localization script so that it can be used client side
- analytics - Inserts the necessary javascript for analytics providers
Parameters:
-
propsObjectThe properties needed to initialize the controller
-
request_handlerRequestHandler -
requestRequestThe incoming request
-
responseResponseThe outgoing response
-
sessionObjectThe session object
-
localization_serviceLocalizationThe localization service instance for the request
-
path_varsObjectThe path variables associated with the URL for the request
-
queryObjectThe query string variables associated with the URL for the request
-
-
cbFunctionA callback that takes a single optional argument: cb(Error)
initSync
-
context
Provides a synchronous function means to initialize a controller. It is meant to be called from the "init" function called by the request handler.
Parameters:
-
contextObjectSee "init" for more details on properties
onAfterDelete
-
cb
Parameters:
-
cbFunction
onBeforeDelete
-
cb
Parameters:
-
cbFunction
onLocalizedAlternateFlagFound
-
routeLocalized -
cb
Parameters:
-
routeLocalizedBoolean -
cbFunction
onPostParamsError
-
err -
cb
Parameters:
-
errError -
cbFunction
-
[err] -
message -
cb
Parameters:
-
[err]Error optional -
messageString -
cbFunction
onPostParamsRetrieved
-
cb
Parameters:
-
cbFunction
redirect
-
location -
cb
Redirects a request to a different location
Parameters:
-
locationString -
cbFunction
render
-
cb
Parameters:
-
cbFunction
requiresClientLocalization
()
Boolean
Returns:
requiresClientLocalizationCallback
-
flag -
cb
Parameters:
-
flagString -
cbFunction
sanitizeObject
-
obj
Sanitizes an object. This function is handy for incoming post objects. It iterates over each field. If the field is a string value it will be sanitized based on the default sanitization rules (BaseController.getDefaultSanitizationRules) or those provided by the call to BaseController.getSanitizationRules.
Parameters:
-
objObject
setAutoSanitize
-
val
Parameters:
-
valBoolean
setFormFieldValues
-
post
Parameters:
-
postObject
setPageName
-
pageName
Sets the page title
Parameters:
-
pageNameStringThe desired page title
Properties
activeTheme
String
autoSanitize
Boolean
body
Object | Null
The deserialized body of the request. This field is only ever populted if the executing route specifies the "request_body" attribute and provides valid MIME types that map to a registered body parser
context
Req: Request, session: object, ls: Localization, ts: TemplateService, site: string, hostname: string, activeTheme: string, onlyThisSite: boolean, siteObj: object
pageName
String
The title of the view to be rendered, if there is a view
pathVars
Object
The hash of key/value pairs that represent the variables passed in the route path
query
Object
The hash of key/value pairs that represent the variables passed as query string parameters
referer
String
deprecated
The referring URL
req
Request
The current request object
res
Response
The current response object
session
Object
The session object that represents the calling entity
