salted
07/13/2022, 9:23 AMview()
to render another view(b) within an existing one(a), however this requires any data in (b) to be in the controller for (a). Does a way exist to have (b) be self contained? Basically ColdBox’s conception of a ‘viewlet’websolete
07/13/2022, 12:41 PMwebsolete
07/13/2022, 12:41 PMsalted
07/13/2022, 12:42 PMsalted
07/13/2022, 12:42 PMwebsolete
07/13/2022, 12:43 PMsalted
07/13/2022, 12:43 PMsalted
07/13/2022, 12:44 PMsalted
07/13/2022, 12:45 PMwebsolete
07/13/2022, 12:45 PMwebsolete
07/13/2022, 12:47 PMwebsolete
07/13/2022, 12:48 PMsalted
07/13/2022, 12:49 PMsalted
07/13/2022, 12:49 PMwebsolete
07/13/2022, 12:49 PMsalted
07/13/2022, 12:49 PMwebsolete
07/13/2022, 12:50 PMwebsolete
07/13/2022, 12:50 PMwebsolete
07/13/2022, 12:51 PMsalted
07/13/2022, 12:52 PMsalted
07/13/2022, 12:52 PMwebsolete
07/13/2022, 12:54 PMsalted
07/13/2022, 12:55 PMwebsolete
07/13/2022, 12:55 PMwebsolete
07/13/2022, 12:55 PMsalted
07/13/2022, 12:56 PMsalted
07/13/2022, 12:57 PMif ( structKeyExists( request._fw1, 'controllerExecutionStarted' ) ) {
throw( type='FW1.controllerExecutionStarted', message="Controller '#action#' may not be added at this point.",
detail='The controller execution phase has already started. Controllers may not be added by other controller methods.' );
}
salted
07/13/2022, 12:57 PMwebsolete
07/13/2022, 1:01 PMwebsolete
07/13/2022, 1:03 PMwebsolete
07/13/2022, 1:03 PMsalted
07/13/2022, 1:04 PMsalted
07/13/2022, 1:04 PMcfsimplicity
07/13/2022, 1:08 PMrc
is vulnerable to manipulation only struck me failry recently (after a security audit!). I considered hand-rolling a prc
scope, but decided just to switch to the request
scope for all data which hasn't come in via form/url. Makes the untrustworthy data that needs validation left in rc
stand out.websolete
07/13/2022, 1:09 PM#view("viewlets/viewletname",rc)#
and viewlet just pulls it from rc and outputs it. the viewlets would only need enough code to examine rc and find the named key of what is being asked forsalted
07/13/2022, 1:09 PMwebsolete
07/13/2022, 1:11 PMwebsolete
07/13/2022, 1:12 PMcfsimplicity
07/13/2022, 1:14 PMparam rc.whatever="default"
If you scrupulously avoid that you're probably safe as you say, but I like the clarity of a completely separate, untouchable scope.websolete
07/13/2022, 1:15 PMwebsolete
07/13/2022, 1:16 PMwebsolete
07/13/2022, 1:16 PMwebsolete
07/13/2022, 1:19 PM/**
* Allows view rendering capabilities from this component
*
* @path string the path to the view, relative to the /views/ directory; ex: reportgenerator/content/viewName
* @rc struct ?: struct to pass as the rc scope
* @prc struct ?: struct to pass as the prc scope
*
* @return string
*/
public string function renderView(
required string path,
struct rc = {},
struct prc = {}
) {
var result = fw.view( arguments.path,{ "rc" : arguments.rc, "prc" : arguments.prc } );
return result;
}
/**
* Allows layout rendering capabilities from this component
*
* @path string the path to the layout, relative to the /layouts/ directory; ex: reportgenerator/layoutName
* @body string ?: the body content to pass into the layout, typically the result of a view() call
*
* @return string the rendered layout content
*/
public string function renderLayout(
required string path,
string body = ""
) {
var result = fw.layout( arguments.path, arguments.body );
return result;
}
websolete
07/13/2022, 1:19 PMwebsolete
07/13/2022, 1:20 PMMatt Jones
07/13/2022, 2:00 PMMatt Jones
07/13/2022, 2:05 PMpublic function runEvent( event="", eventArguments={}) {
var subsystem = getSubsystem( arguments.event );
var section = getSection( arguments.event );
var item = getItem( arguments.event );
var cfc = getController( section = section, subsystem = subsystem );
var _rc = request.context;
_rc.append( arguments.eventArguments );
if ( structKeyExists( cfc, item ) ) {
invoke( cfc, item, { rc : _rc, headers : request._fw1.headers } );
}
return view( listChangeDelims(arguments.event,"/",".") );
}
Matt Jones
07/13/2022, 2:07 PMwebsolete
07/13/2022, 2:08 PMsalted
07/13/2022, 2:08 PMMatt Jones
07/13/2022, 2:08 PMsalted
07/13/2022, 2:08 PMMatt Jones
07/13/2022, 2:09 PMMatt Jones
07/13/2022, 2:10 PMwebsolete
07/13/2022, 2:12 PMwebsolete
07/13/2022, 2:13 PMsalted
07/13/2022, 2:14 PMwebsolete
07/13/2022, 2:14 PM