BaseAdminController Class
This class serves as a base class for all the controllers used in the admin control panel
Constructor
BaseAdminController
()
Item Index
Methods
- checkForFormRefill
- displayErrorOrSuccessCallback
- extendedInit
- formError
- getAdminPills
- getJSONPostParams deprecated
- getPageName
- getPostData
- getPostParams
- getSanitizationRules
- getServiceContext
- getTemplateServiceInstance
- hasRequiredParams
- init
- initSync
- onLocalizedAlternateFlagFound
- redirect
- requiresClientLocalization
- requiresClientLocalizationCallback
- sanitizeObject
- setFormFieldValues
- setPageName
Properties
- activeTheme
- body
- context
- localizationService deprecated
- ls
- pageName
- pathVars
- query
- referer deprecated
- req
- reqHandler
- res
- session
- ts
Methods
checkForFormRefill
(
-
result -
cb
Parameters:
-
resultString -
cbFunction
displayErrorOrSuccessCallback
(
-
flag -
cb
Parameters:
-
flagString -
cbFunction
extendedInit
(
-
cb
Initializes the admin controller with instance variables
Parameters:
-
cbFunction
formError
(
-
message -
redirectLocation -
cb
Parameters:
-
messageStringThe error message to be displayed -
redirectLocationString -
cbFunction
getAdminPills
(
Object
-
navKey -
localizationService -
activePill -
[data]
Centralized place to obtain the pills to be displayed on top of the admin controller
Parameters:
-
navKeyString -
localizationServiceLocalization -
activePill -
[data]Object optional
Returns:
Object:
pill objects for admin console with site pill at the beginning
getJSONPostParams
(
deprecated
-
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:
String:
The page title
getPostData
(
-
cb
Parameters:
-
cbFunction
getPostParams
(
-
cb
Parameters:
-
cbFunction
getSanitizationRules
()
Object
Returns:
Object:
getServiceContext
()
Object
Retrieves a context object that contains the necessary information for
service prototypes
Returns:
Object:
getTemplateServiceInstance
(
TemplateService
-
props
Creates a TemplateService instance
Parameters:
-
propsObject
Returns:
hasRequiredParams
(
-
queryObject -
requiredParameters
Parameters:
-
queryObjectObject -
requiredParametersArray
init
(
-
props -
cb
Initializes the admin controller with site-related info
Parameters:
-
propsObject -
cbFunction
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
onLocalizedAlternateFlagFound
(
-
routeLocalized -
cb
Parameters:
-
routeLocalizedBoolean -
cbFunction
redirect
(
-
location -
cb
Redirects a request to a different location
Parameters:
-
locationString -
cbFunction
requiresClientLocalization
()
Boolean
Returns:
Boolean:
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
setFormFieldValues
(
-
post
Parameters:
-
postObject
setPageName
(
-
pageName
Sets the page title
Parameters:
-
pageNameStringThe desired page title
Properties
activeTheme
String
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
