Webman-framework

Lightweight, Component-based, and Database-oriented Web Application Framework

About | Overview | Documentation

 

Documentation > Modules and APIs > webman_link_path_generator

webman_link_path_generator

 

Description:

Component-type module that provides facilities to extract and generate application's link path structure based on current active link-node ID. The current active node is actually the end node of the generated link path structure.

 

Dependencies:

Webman-framework's Component-type Modules:

  • CGI_Component::webman_CGI_component (Inheritance)

 

1. View Template

The view template simply contains single word pattern $LINK_PATH_DYNAMIC_ enclosed inside the VIEW template-element. This word pattern is used as a place-holder for link path text content generated by the module.

<html>
<body>
<!-- start_view_ //-->
$LINK_PATH_DYNAMIC_
<!-- end_view_ //-->
</body>
</html>



 
2. Instantiation and Basic Parameter Setting

Most basic parameter settings are to set the current link path data structure, link-properties for each link-nodes, and to control the view presentation of the generated link path structure. Detailed explanations for each of these basic parameter settings are given as a comments before each function calls.

The parameter settings (lines 33-34) are quite special since they are used specifically to compensate some missing feature of the module as component-type module. The module is intended to be used entirely as a black-box component inside other client modules and it's too rare to have the module directly called inside the main-controller or component selector sub-controller with particular link-node ID or component-selector ID referenced to it. This situation prohibit the module from able to carry out dynamic component parameter settings at application runtime through queries from database table as specified by its base module (webman_CGI_component) generic implementations. The function calls (lines 33-34) can addrress this issue by using template-element name passed to the module and the module name itself as a keys for dynamic component parameter settings via database queries. However, within the framework implementation sructure it's limited to global component parameter settings without specific back-reference to link-node ID or component-selector ID which contsruct the overall application main link structure.

  1 my $component = new webman_link_path_generator;                                       
  2                                                                                       
  3 $component->set_CGI($cgi);                                                            
  4 $component->set_DBI_Conn($db_conn);                                                   
  5                                                                                       
  6 ### Get current link path info. from the client component which make a call           
  7 ### to the current component. The client component commonly get the link path         
  8 ### info. from framework's main controller.                                           
  9 $component->set_Link_Path($this->get_Link_Path);                                      
 10                                                                                       
 11 ### Options to add GET-data's parameter-value on each link-nodes. The string          
 12 ### argument for set_Carried_GET_Data function call is all possible existing          
 13 ### CGI parameters (separated by spaces) which are already exists at the              
 14 ### application runtime with the exceptions of special farmework's CGI                
 15 ### parameters ("app_name", "session_id", "link_name", and "link_id")                 
 16 #$component->set_Carried_GET_Data("param_name_1 ... param_name_2");                   
 17 #$component->set_Additional_GET_Data("param_name_1=value_1&...&param_name_n=value_n");
 18                                                                                       
 19 ### Options to cut some of the beginning and ending nodes of the link path.           
 20 ### For n number of nodes that construct the link path structure, both                
 21 ### $level_start and $level_deep arguments will have their possible values            
 22 ### in the range of 0 to n-1 and must always in the condition of                      
 23 ### $level_start < $level_deep.                                                       
 24 #$component->set_Level_Start($level_start);                                           
 25 #$component->set_Level_Deep($level_deep);                                             
 26                                                                                       
 27 ### Default HTML object used as link  path nodes separator is "&gt;".                 
 28 $component->set_Separator_Tag($html_object);                                          
 29                                                                                       
 30                                                                                       
 31 ### The next two function calls must be made exactly in the                           
 32 ### order as given below.                                                             
 33 $component->set_Current_Dynamic_Content_Name($te_type_name);                          
 34 $component->set_Module_DB_Param;                                                      
 35                                                                                       
 36 $component->set_Template_Default($template_file);                                     
 37                                                                                       


 
3. Component-type Generic Function Calls

 30 $component->run_Task;                 
 31 $component->process_Content;          
 32                                       
 33 my $content = $component->get_Content;