API Docs for: 0.8.0
Show:

DeleteController Class

Deletes objects from the database

Constructor

DeleteController

()

Methods

canDelete

(
  • cb
)

Parameters:

  • cb Function

checkForFormRefill

(
  • result
  • cb
)

Parameters:

  • result String
  • cb Function

displayErrorOrSuccessCallback

(
  • flag
  • cb
)

Parameters:

  • flag String
  • cb Function

formError

(
  • message
  • redirectLocation
  • cb
)

Parameters:

  • message String

    The error message to be displayed

  • redirectLocation String
  • cb Function

getAutoSanitize

() Boolean

Returns:

Boolean:

getDataOnSuccess

(
  • results
)
Object

Parameters:

  • results Array

Returns:

Object:

getDefaultErrorMessage

() String

Returns:

String:

getDeleteCollection

() String

Returns:

String:

getDeleteQuery

() Object

Returns:

Object:

getFormErrorRedirect

(
  • err
  • message
)

Parameters:

  • err Error
  • message String

Returns:

getJSONPostParams

(
  • cb
)
deprecated

Inherited from BaseController: controllers/base_controller.js:460

Deprecated: Since 0.8.0. Will be removed in v1.0

Parses the incoming payload of a request as JSON formatted data.

Parameters:

  • cb Function

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:

String:

The page title

getPostData

(
  • cb
)

Parameters:

  • cb Function

getPostParams

(
  • cb
)

Parameters:

  • cb Function

getRequiredFields

(
  • cb
)

Parameters:

  • cb Function

getSanitizationRules

() Object

Returns:

Object:

getServiceContext

() Object

Retrieves a context object that contains the necessary information for service prototypes

Returns:

Object:

getSuccessRedirect

() String

Returns:

String:

getTemplateServiceInstance

(
  • props
)
TemplateService

Creates a TemplateService instance

Parameters:

  • props Object

Returns:

hasRequiredParams

(
  • queryObject
  • requiredParameters
)

Parameters:

  • queryObject Object
  • requiredParameters Array

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:

  • props Object

    The properties needed to initialize the controller

    • request_handler RequestHandler
    • request Request

      The incoming request

    • response Response

      The outgoing response

    • session Object

      The session object

    • localization_service Localization

      The localization service instance for the request

    • path_vars Object

      The path variables associated with the URL for the request

    • query Object

      The query string variables associated with the URL for the request

  • cb Function

    A 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:

  • context Object

    See "init" for more details on properties

onAfterDelete

(
  • cb
)

Parameters:

  • cb Function

onBeforeDelete

(
  • cb
)

Parameters:

  • cb Function

onLocalizedAlternateFlagFound

(
  • routeLocalized
  • cb
)

Parameters:

  • routeLocalized Boolean
  • cb Function

onPostParamsError

(
  • err
  • cb
)

Parameters:

  • err Error
  • cb Function

(
  • [err]
  • message
  • cb
)

Parameters:

  • [err] Error optional
  • message String
  • cb Function

onPostParamsRetrieved

(
  • cb
)

Inherited from FormController but overwritten in controllers/delete_controller.js:33

Parameters:

  • cb Function

redirect

(
  • location
  • cb
)

Redirects a request to a different location

Parameters:

  • location String
  • cb Function

render

(
  • cb
)
Responsible for gathering the payload data from the request and parsing it. The result is passed down to the controller's onPostParamsRetrieved function. In addition and the autoSanitize property is TRUE, the posted parameters will be sanitized.

Parameters:

  • cb Function

requiresClientLocalization

() Boolean

Returns:

Boolean:

requiresClientLocalizationCallback

(
  • flag
  • cb
)

Parameters:

  • flag String
  • cb Function

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:

  • obj Object

setAutoSanitize

(
  • val
)

Parameters:

  • val Boolean

setFormFieldValues

(
  • post
)

Parameters:

  • post Object

setPageName

(
  • pageName
)

Sets the page title

Parameters:

  • pageName String

    The desired page title

Properties

activeTheme

String

autoSanitize

Boolean
Instructs the controller to automatically sanitize any incoming post data when set to TRUE.

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

localizationService

Localization deprecated

Inherited from BaseController: controllers/base_controller.js:151

Deprecated: Use this.ls

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

reqHandler

RequestHandler

The instance of the request handler that processed the request

res

Response

The current response object

session

Object

The session object that represents the calling entity