Commit a40e905eebfc5dbd13bcc8bc86d2e00a17d73ec1
1 parent
0fab7df4
add generation of calexium_lib menu
Showing
3 changed files
with
100 additions
and
0 deletions
Show diff stats
hayamiki_generator.aproj
| @@ -489,6 +489,7 @@ | @@ -489,6 +489,7 @@ | ||
| 489 | <Compile Include="src\generation\choices_selector.anubis" /> | 489 | <Compile Include="src\generation\choices_selector.anubis" /> |
| 490 | <Compile Include="src\generation\columns.anubis" /> | 490 | <Compile Include="src\generation\columns.anubis" /> |
| 491 | <Compile Include="src\generation\create_table.anubis" /> | 491 | <Compile Include="src\generation\create_table.anubis" /> |
| 492 | + <Compile Include="src\generation\cxm_lib_menu.anubis" /> | ||
| 492 | <Compile Include="src\generation\densaku.anubis" /> | 493 | <Compile Include="src\generation\densaku.anubis" /> |
| 493 | <Compile Include="src\generation\fields.anubis" /> | 494 | <Compile Include="src\generation\fields.anubis" /> |
| 494 | <Compile Include="src\generation\files.anubis" /> | 495 | <Compile Include="src\generation\files.anubis" /> |
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: フランスのトトロ | ||
| 4 | + * Date: 06/02/2016 | ||
| 5 | + * Time: 15:40 | ||
| 6 | + * © Calexium | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +read hayamiki_lib/types/hayamiki.anubis | ||
| 10 | +read tools/basis.anubis | ||
| 11 | +read tools/int.anubis | ||
| 12 | +read system/string.anubis | ||
| 13 | +read system/files.anubis | ||
| 14 | +read tools/streams.anubis | ||
| 15 | +read tools/ISO-8601.anubis | ||
| 16 | + | ||
| 17 | +read utils/utils.anubis | ||
| 18 | + | ||
| 19 | +define String | ||
| 20 | + generate_application_menu | ||
| 21 | + ( | ||
| 22 | + List(HK_App) apps, | ||
| 23 | +// List(HK_Table) tables, //list of the table model description | ||
| 24 | + String indent | ||
| 25 | + )= | ||
| 26 | + // hk_menu_list("111", help_text("222"), | ||
| 27 | + // [ | ||
| 28 | + // hk_menu_item("production_mass_storage", "view_table", "CURRENT", [("table_name", "production_mass_storage", ),("view_name", "current")]), | ||
| 29 | + | ||
| 30 | + //calculate then longest table name and add 4 for enclosed quote + coma + final space | ||
| 31 | + //hence we can make a beautiful formatting | ||
| 32 | + with max_space = longest_table_name_size(apps, 0) + 4, | ||
| 33 | + | ||
| 34 | + join(",\n", | ||
| 35 | + map((HK_App app) |-> since app is hk_app(app_name, icon, help, tables), | ||
| 36 | + /*indent+"menu_item("+ | ||
| 37 | + with app_menu_name = if help is { no_help_text then if app_name ="" then "base" else app_name, | ||
| 38 | + help_text_TAG(tag) then tag, | ||
| 39 | + help_text(txt) then txt | ||
| 40 | + }, | ||
| 41 | + to_String(icon)+", "+ | ||
| 42 | + //determine if there is help text for app. If not we use the App name as menu entry | ||
| 43 | + | ||
| 44 | + app_menu_name+",\n"+indent+"[\n"+*/ | ||
| 45 | + join(",\n", | ||
| 46 | + map_append((HK_Table table) |-> | ||
| 47 | + since table is hk_table(table_name, short_name, model, display), | ||
| 48 | + since display is hk_display(list_views, _), | ||
| 49 | + map((HK_List_View view ) |-> | ||
| 50 | + with view_name = if view is list_view(v_name, _, _) then v_name else "default", | ||
| 51 | + indent+" "+"menu_item("+ | ||
| 52 | + fill("\""+short_name+(if view_name="default" then "" else " "+view_name)+"\",",max_space)+ | ||
| 53 | + //fill("\""+table_name+"\",",max_space)+ | ||
| 54 | + " controller_action(\"hk_c\", \"view_table\"), "+ | ||
| 55 | + "[(\"table_name\", "+fill("\""+table_name+"\",",max_space)+"),(\"view_name\", \""+view_name+"\")])", list_views), tables))/*+"\n"+indent+"])"*/, apps)). | ||
| 56 | + | ||
| 57 | + | ||
| 58 | +public define Maybe(One) | ||
| 59 | + generate_cxm_lib_menus | ||
| 60 | + ( | ||
| 61 | + List(HK_App) apps, //list of the table model description | ||
| 62 | + String dest_dir | ||
| 63 | + )= | ||
| 64 | + | ||
| 65 | + with file_name = dest_dir+"web_pages/generated/cxm_lib_apps_menu.anubis", | ||
| 66 | + | ||
| 67 | + //create all necessary directories if doesn't exist. | ||
| 68 | + make_directories(file_name); | ||
| 69 | + | ||
| 70 | + //create script file name as new file. Previous file with same name will be erased | ||
| 71 | + if file(file_name, new) is | ||
| 72 | + { | ||
| 73 | + failure then println("Can't create menu "+file_name);failure, | ||
| 74 | + success(fd) then | ||
| 75 | + with stream = make_stream(fd), | ||
| 76 | + | ||
| 77 | + write_string(stream, | ||
| 78 | +"/* | ||
| 79 | + * Created by 早見木 (Hayamiki). | ||
| 80 | + * Date: "+_Int_to_ISO_8601_date(now)+" | ||
| 81 | + * Time: "+_Int_to_ISO_8601_time(now)+" | ||
| 82 | + */ | ||
| 83 | + | ||
| 84 | +transmit calexium_lib/web/widgets/menu.anubis | ||
| 85 | + | ||
| 86 | +public define List(Menu_Item) | ||
| 87 | + applications_cxm_lib_menu | ||
| 88 | + =" + | ||
| 89 | +/* hk_menu_list(\"managers\", help_text_TAG(\"APPLICATIONS\"), */ | ||
| 90 | +" [\n"+ | ||
| 91 | + generate_application_menu(apps, " ")+ | ||
| 92 | +"\n | ||
| 93 | + ].\n" | ||
| 94 | + ) | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | +. |
src/generation/files.anubis
| @@ -21,6 +21,7 @@ read generation/types.anubis | @@ -21,6 +21,7 @@ read generation/types.anubis | ||
| 21 | read generation/densaku.anubis | 21 | read generation/densaku.anubis |
| 22 | read generation/create_table.anubis | 22 | read generation/create_table.anubis |
| 23 | read generation/hk_menu.anubis | 23 | read generation/hk_menu.anubis |
| 24 | +read generation/cxm_lib_menu.anubis | ||
| 24 | read generation/fn_delete.anubis | 25 | read generation/fn_delete.anubis |
| 25 | read generation/choices_selector.anubis | 26 | read generation/choices_selector.anubis |
| 26 | read generation/vt_edit.anubis | 27 | read generation/vt_edit.anubis |
| @@ -238,6 +239,7 @@ define Maybe(One) | @@ -238,6 +239,7 @@ define Maybe(One) | ||
| 238 | if generate_create_table(apps, destination_dir) is failure then println("failure");failure else | 239 | if generate_create_table(apps, destination_dir) is failure then println("failure");failure else |
| 239 | println("Generating menu for Database "+name); | 240 | println("Generating menu for Database "+name); |
| 240 | if generate_hk_menus(apps, destination_dir) is failure then println("failure");failure else | 241 | if generate_hk_menus(apps, destination_dir) is failure then println("failure");failure else |
| 242 | + if generate_cxm_lib_menus(apps, destination_dir) is failure then println("failure");failure else | ||
| 241 | writeString(ini, "DB_MODEL", "SHA1", current_db_SHA1); | 243 | writeString(ini, "DB_MODEL", "SHA1", current_db_SHA1); |
| 242 | writeIniInfo(ini); | 244 | writeIniInfo(ini); |
| 243 | success(unique) | 245 | success(unique) |