Naar inhoud springen

Module:Layout/Production/Interface

Uit Wikibooks
 Deze module is nog in ontwikkeling (versie 0.0) en wordt getest.

De Module:Layout is bedoeld om snel, consistent en uitgebreid een pagina op te maken.
Er is een op de module afgestemde handleiding over deze onderwijswiki beschikbaar.

De module wordt geïnitialiseerd met de configuratie in Module:Layout/Production/Configuration.

Controleer op scriptfouten of opmaak notificaties.




-- De submodule Interface forms an interface between the calling template and the submodules.
local interface = {};

-- The main function converts the invokement of the template into a valid wikitext.
-- The input comes from the user as the frame-object and from the configuration as set by the developers of the module.
-- The input is gradually transformed to a call variable that is safe to pass to the system.
-- The settings in the configuration and the input are used to build up this call variable.
-- The reponse of the function is a wikitext that can be used by the calling template.
function interface.main( frame, CFG, environment )  -- : string
	-- The model has for the incoming data the call variable
    local call = CFG.INCLUDE( environment, "call" );
    call.init( CFG, environment );

	-- The interface needs the following submodules based on the analogy of boarding, flying and landing a plane.
	local luggage, security, flight = call.include( "luggage", "security", "flight" );

    -- The call object will take over from the frame object that is dropped afterwards.
    -- The object is refilled based on the settings in the configuration file and the environment.
    call = luggage.drop( call, frame, CFG, environment );
    
    -- The caller's identity determines if it may pass to the system.
    call = security.authentication( call );
    
    -- The call-object is inspected to see if there is a problem to declare
    call = security.declaration( call );

    -- If there is nothing to declare we can take the carry-on luggage to the security screening 
    if call.pass then call = luggage.carry_on( call ); end
    
    -- The call is scanned on the validity of the parameters supplied
    if call.pass then call = security.scan( call ); end
    
    -- The values of the parameters of the call are then frisked. 
    if call.pass then call = security.frisk( call ); end
    
    -- FROM THIS MOMENT ON ALL DATA MUST BE CORRECT OTHERWISE THERE IS A SCRIPT ERROR --
    
    -- The call is then corrected, converted and prefilled by extracting from other sources stirred by the input and the configuration.
    if call.pass then call = luggage.loading( call ); end

    -- The calling template needs a response in the format of a text
    local response = call.include( "response" );
    response.init();
    
    -- The call is passed to the system that can take off if allowed.
 	if call.pass then response.add( flight.takeoff( call ) ); end
	
	-- We want to know if the system landed safely if it took off.
	if call.pass then response.add( flight.landed( call ) ); end

	-- The call object is recollected
	call = luggage.claim( call );
	
	-- The response of the flight can be extended with feedback supplied by the supporting functionality
	response.add( flight.feedback( call ) );
	
	-- The calling template needs a string a result of the interface
    return tostring( response.get() );
end

return interface;
Informatie afkomstig van https://nl.wikibooks.org Wikibooks NL.
Wikibooks NL is onderdeel van de wikimediafoundation.