<cfcomponent
output="false"
hint="I provide remote proxy functionality for AJAX calls that need to access the application.">
<cffunction
name="NewResponse"
access="public"
returntype="struct"
output="false"
hint="I create a new instance of the unified response object used in the AJAX requests.">
<cfset var LOCAL = {} />
<cfset LOCAL.Response = {
Success = true,
Errors = [],
Data = ""
} />
<cfreturn LOCAL.Response />
</cffunction>
<cffunction
name="AddResponseError"
access="public"
returntype="struct"
output="false"
hint="I add the given error to the given response object.">
<cfargument
name="Response"
type="struct"
required="true"
hint="I am the response object to which an error is being added."
/>
<cfargument
name="Property"
type="string"
required="true"
hint="I am the property in error."
/>
<cfargument
name="Error"
type="string"
required="true"
hint="I am the error message."
/>
<cfset var LOCAL = {} />
<cfset LOCAL.Error = {
Property = ARGUMENTS.Property,
Error = ARGUMENTS.Error
} />
<cfset ArrayAppend(
ARGUMENTS.Response.Errors,
LOCAL.Error
) />
<cfset ARGUMENTS.Response.Success = false />
<cfreturn ARGUMENTS.Response />
</cffunction>
</cfcomponent>