ACF acf www-controller.lua reference: Difference between revisions

From Alpine Linux
(Category:Lua)
(minor updates)
Line 101: Line 101:


[[Category:ACF]] [[Category:Lua]]
[[Category:ACF]] [[Category:Lua]]
== private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm ==
Offers private label cosmetics with custom design. We produce lip balms, serum, creams and more. Easy to buy with eshop. Private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm
[[http://ultra-high-end.com/custom-made.html private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]]
[[http://ultra-high-end.com/custom-made.html private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]]
== private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm ==
Offers private label cosmetics with custom design. We produce lip balms, serum, creams and more. Easy to buy with eshop. Private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm
[[http://ultra-high-end.com/custom-made.html private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]]
[[http://ultra-high-end.com/custom-made.html private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]]
== private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm ==
Offers private label cosmetics with custom design. We produce lip balms, serum, creams and more. Easy to buy with eshop. Private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm
[[http://ultra-high-end.com/custom-made.html private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]]
[[http://ultra-high-end.com/custom-made.html private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]]
== private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm ==
Offers private label cosmetics with custom design. We produce lip balms, serum, creams and more. Easy to buy with eshop. Private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm
[[http://ultra-high-end.com/custom-made.html private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]]
[[http://ultra-high-end.com/custom-made.html private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]]
== private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm ==
Offers private label cosmetics with custom design. We produce lip balms, serum, creams and more. Easy to buy with eshop. Private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm
[[http://ultra-high-end.com/custom-made.html private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]]
[[http://ultra-high-end.com/custom-made.html private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]]

Revision as of 03:10, 7 March 2016

acf_www-controller.lua reference

The acf_www-controller.lua provides the basic dispatcher, exception handler, and application-wide functions for the acf web application.

build_menus ( self )

(internal function) Builds the permissions and menu tables and stores them in self.sessiondata for use on each page throughout the user session.

  1. Searches for roles files to determine which controllers and actions the current user has permission to view
  2. Searches for menu files to create the entire menu structure
  3. Removes from the menu any actions for which the user does not have permission

check_permission ( self, controller, action )

(internal function) Returns a boolean to tell whether or not this user is permitted to access this controller/action combo. The decision is based upon the permissions table in self.sessiondata.

find_template ( appdir, prefix, controller, action, viewtype )

(internal function) Looks for a .lsp (Lua Server Page) template. Looks for the first matching:

  1. appdir/prefix/template-controller-action-viewtype.lsp
  2. appdir/prefix/template-controller-viewtype.lsp
  3. appdir/prefix/template-action-viewtype.lsp
  4. appdir/prefix/template-viewtype.lsp

It repeats through each upper level of prefix until prefix is "nil". Returns the first found lsp, or false.

find_view ( appdir, prefix, controller, action, viewtype )

(internal function) Looks for a .lsp (Lua Server Page) view. Looks for the first matching:

  1. appdir/prefix/controller-action-viewtype.lsp
  2. appdir/prefix/controller-viewtype.lsp

has_view ( self )

(internal function) Returns true if there is a .lsp (Lua Server Page) view specifically for this action.

dispatch_component ( str, clientdata, suppress_view )

(internal function) This function is made available to each view file to allow loading of components (sub-actions). It will launch a new controller/action, passing any clientdata, and return the result of the action. If suppress_view is not true, it will display the component action's view.

create_helper_library ( self )

(internal function) Creates a helper library to be passed to each view. Currently, the only function passed is dispatch_component, but in the future functions that need access to self may be added.

view_resolver ( self )

(internal function) Returns a function that will run the template and view. The template is found with find_template, and the view with find_view. Also generates and returns the view parameters besides viewtable.

mvc.on_load ( self, parent )

Sets up self.conf and self.sessiondata. If the client reports a session id, this function will attempt to load the existing session. If not, a new session is created and build_menus is called to fill in the permissions and menu tables.

mvc.on_unload ( self )

Saves the session data before returning. This function will be called after the action is complete and before the view is displayed.

exception_handler ( self, message )

If message is a table and message.type="redir", then issues a 302 Moved to the client, with the target of the redirect being message.prefix/message.controller/message.action message.extra If found while displaying a component, an error message is output instead.

If the message.type is "redir_to_referrer", then issues a 302 Moved to the client, with the target of the redirect being the referring page.

If the message.type is "dispatch", then calls the parent (mvc.lua) exception handler.

Otherwise, calls the parent (mvc.lua) exception handler.

dispatch ( self, prefix, controller, action )

Overload of the MVC dispatch function to check permissions (and redirect if not allowed), handle components, pass more data to the view, and allow display of views without actions. Controller actions are executed in a protected xpcall.

  1. Checks if user has permission to access this controller/action by calling check_permission
    1. If no permission to action, redirects to default action
    2. If no permission to controller, redirects to default controller/action
  2. If the controller/action exists
    1. Creates a self:new ( prefix .. controller) mvc object
    2. Runs any existing worker.mvc.pre_exec function
    3. Runs the worker.action
    4. Runs any existing worker.mvc.post_exec function
    5. Calls destroy to destroy the mvc object
  3. Gets the view function and parameters from view_resolver
  4. Executes the view with the result of the worker.action
  5. Returns the result of the worker.action

If an error occurs, an exception_handler function is run. If possible, the exception handler of the new mvc object is run, otherwise self::exception_handler function handles the error. If an exception occurs after creating the new mvc object, mvc.on_unload is guaranteed to run, but mvc.post_exec is not.

redirect ( self, str )

Cause a redirect to the specified path. If a prefix or controller is not found in the string, use the current prefix and/or controller. If an action is not found in the string, use the default action. The actual redirection is defined in exception_handler. This function can be called by an action to redirect to another action rather than display it's own view. Note: The controller post_exec function will not be called after redirect is called.

redirect_to_referrer ( self )

If we've acted on a command, put the result in the session and cause a redirect to the referring page (assuming it's different). If not, check to see if there is a result in the session from a previous redirection. The actual redirection is defined in exception_handler. This function should be called by an action to redirect to the referring page rather than display it's own view. This allows actions that are used as components to display the container view after completing the requested command, and then display the result when reloaded as a component. Note: The controller post_exec function will not be called if redirect_to_referrer causes a redirection.

logevent ( message )

Writes a message to the acf log file.

private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm

Offers private label cosmetics with custom design. We produce lip balms, serum, creams and more. Easy to buy with eshop. Private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm

[private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]

[private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]

private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm

Offers private label cosmetics with custom design. We produce lip balms, serum, creams and more. Easy to buy with eshop. Private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm

[private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]

[private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]

private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm

Offers private label cosmetics with custom design. We produce lip balms, serum, creams and more. Easy to buy with eshop. Private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm

[private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]

[private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]

private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm

Offers private label cosmetics with custom design. We produce lip balms, serum, creams and more. Easy to buy with eshop. Private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm

[private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]

[private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]

private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm

Offers private label cosmetics with custom design. We produce lip balms, serum, creams and more. Easy to buy with eshop. Private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm

[private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]

[private label cosmetics, custom made cosmetic, custom made cream, custom lip stick lip balm]