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

About | Overview | Documentation


Documentation > Tutorial > 8.1 Admin page: Automatic code generation

8.1 Admin page: Automatic code generation


Go back to the command prompt window and run the code generator script by entering the command: perl app_code_generator.pl mygb mygb_entry 0. This is the option to directly pass the basic inputs (application name, table name, and test option) at the command line without need to wait they are interactively asked by the script later.


For the next first 4 (four) inputs asked by the script, enter them as shown and labeled below.


Generally the above inputs tell the script to not use the previously existing saved automatic code generation inputs ([1]) and for the database table operations to be applied, the most complete list item management support is opted ([2], [3], and [4]). Besides the item/list view operation, other three basic database operations (insert, update, and delete) are also included and further advanced with the support of multi-rows item operations and text-based data input.

Enter other next 4 (four) inputs as shown and labeled below.


For insert, update, and delete operations via text-based input support with enormous number of input rows being extracted from the text file, it's crucial to know and confirm whether the items involved already exist or not. The current table involved (mygb_entry) doesn't has any single fix primary/unique key except the id_entry_62base that is auto-generated and not visible as default view entity. Due to this situation, the possible option to uniquely identifies item entries is via the combination of fields that act as a key on each item rows. The inputs number [5] and [6] above have applied this option and set the combination of nickname, wmf_date_created, and wmf_time_created fields as the key-fields for text-based input service to unqiuely identifies item entries from inside the table. The next 2 (two) inputs ([7] and [8]) just simply add the facility so admin can limit the items to be viewed in the list through item filtration based on the combination of nickname, email, and wmf_date_created key-fields.

When the script runtime has reached the phase of automatic module file generation, there will be an alert whether to overwrite or not the exsiting mygb_entry_list.pm module file. Do remember that this particular module file has been automatically generated and then customized as explained and done in sub-sections 6.1 and 6.2. The existing module has its own specific purpose to publicly list the entries thus for the admin it's a good practice to create new module with a different new name (mygb_entry_list_admin.pm) such as shown below.


Since it's for database item management purposes, other than the primary key (id_entry_62base) there will be no more fields to be excluded from being treated as a view element inside all kind of database page operations provided by the admin page service.


At this stage all related resources for mygb_entry table item administration have been created and updated. Inside the application main link structure, apply the parameter seetings for these new resources into "Admin" link node that has the link ID of "9".


Save all previous input settings just in case if there is a need to regenerate the resources with the exact same specifications later.


At the end of the automatic code generation, below are the module and view template files that should be already generated and available to support the implementation of admin page for guestbook data entry.

Modules files generated:








View template files generated:













Do check the new content of mygb application main controller module (E:\wmbase\webman\pm\apps\mygb\mygb.pm). All new generated modules above should be automatically included inside the main controller module such as shown in lines 14-17 and 19-21 below.

  1 Current modules included inside the main controller module (mygb.pm):   


  3 package mygb;                                                           


  5 use webman_main;                                                        


  7 @ISA=("webman_main");                                                   


  9 ### Include new customized application modules next to this line.       


 11 #__cust_mod__                                                           


 13 use mygb_entry_list;                                                    

 14 use mygb_entry_list_admin;                                              

 15 use mygb_entry_multirows_delete;                                        

 16 use mygb_entry_multirows_insert;                                        

 17 use mygb_entry_multirows_update;                                        

 18 use mygb_entry_std_insert;                                              

 19 use mygb_entry_text2db_delete;                                          

 20 use mygb_entry_text2db_insert;                                          

 21 use mygb_entry_text2db_update;                                          


 23 #__cust_mod__                                                           

 24 ### Don't remove the above "#__cust_mod__" comments since they are used 

 25 ### by the framework code generator to automatically add/remove modules.

Read the documentation on each base modules inherited by the new generated modules above to really understand how they could be set and customized later. These base module documentations (Component-type Modules) are available from Modules and APIs page section.