diff --git a/hayamiki_generator.aproj b/hayamiki_generator.aproj index 77af4f0..372b9f2 100644 --- a/hayamiki_generator.aproj +++ b/hayamiki_generator.aproj @@ -489,6 +489,7 @@ + diff --git a/src/generation/cxm_lib_menu.anubis b/src/generation/cxm_lib_menu.anubis new file mode 100644 index 0000000..f7b6658 --- /dev/null +++ b/src/generation/cxm_lib_menu.anubis @@ -0,0 +1,97 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ + * Date: 06/02/2016 + * Time: 15:40 + * © Calexium + */ + +read hayamiki_lib/types/hayamiki.anubis +read tools/basis.anubis +read tools/int.anubis +read system/string.anubis +read system/files.anubis +read tools/streams.anubis +read tools/ISO-8601.anubis + +read utils/utils.anubis + +define String + generate_application_menu + ( + List(HK_App) apps, +// List(HK_Table) tables, //list of the table model description + String indent + )= + // hk_menu_list("111", help_text("222"), + // [ + // hk_menu_item("production_mass_storage", "view_table", "CURRENT", [("table_name", "production_mass_storage", ),("view_name", "current")]), + + //calculate then longest table name and add 4 for enclosed quote + coma + final space + //hence we can make a beautiful formatting + with max_space = longest_table_name_size(apps, 0) + 4, + + join(",\n", + map((HK_App app) |-> since app is hk_app(app_name, icon, help, tables), + /*indent+"menu_item("+ + with app_menu_name = if help is { no_help_text then if app_name ="" then "base" else app_name, + help_text_TAG(tag) then tag, + help_text(txt) then txt + }, + to_String(icon)+", "+ + //determine if there is help text for app. If not we use the App name as menu entry + + app_menu_name+",\n"+indent+"[\n"+*/ + join(",\n", + map_append((HK_Table table) |-> + since table is hk_table(table_name, short_name, model, display), + since display is hk_display(list_views, _), + map((HK_List_View view ) |-> + with view_name = if view is list_view(v_name, _, _) then v_name else "default", + indent+" "+"menu_item("+ + fill("\""+short_name+(if view_name="default" then "" else " "+view_name)+"\",",max_space)+ + //fill("\""+table_name+"\",",max_space)+ + " controller_action(\"hk_c\", \"view_table\"), "+ + "[(\"table_name\", "+fill("\""+table_name+"\",",max_space)+"),(\"view_name\", \""+view_name+"\")])", list_views), tables))/*+"\n"+indent+"])"*/, apps)). + + +public define Maybe(One) + generate_cxm_lib_menus + ( + List(HK_App) apps, //list of the table model description + String dest_dir + )= + + with file_name = dest_dir+"web_pages/generated/cxm_lib_apps_menu.anubis", + + //create all necessary directories if doesn't exist. + make_directories(file_name); + + //create script file name as new file. Previous file with same name will be erased + if file(file_name, new) is + { + failure then println("Can't create menu "+file_name);failure, + success(fd) then + with stream = make_stream(fd), + + write_string(stream, +"/* + * Created by 早見木 (Hayamiki). + * Date: "+_Int_to_ISO_8601_date(now)+" + * Time: "+_Int_to_ISO_8601_time(now)+" + */ + +transmit calexium_lib/web/widgets/menu.anubis + +public define List(Menu_Item) + applications_cxm_lib_menu + =" + +/* hk_menu_list(\"managers\", help_text_TAG(\"APPLICATIONS\"), */ +" [\n"+ + generate_application_menu(apps, " ")+ +"\n + ].\n" + ) + } + +. diff --git a/src/generation/files.anubis b/src/generation/files.anubis index 06f0468..768f418 100644 --- a/src/generation/files.anubis +++ b/src/generation/files.anubis @@ -21,6 +21,7 @@ read generation/types.anubis read generation/densaku.anubis read generation/create_table.anubis read generation/hk_menu.anubis +read generation/cxm_lib_menu.anubis read generation/fn_delete.anubis read generation/choices_selector.anubis read generation/vt_edit.anubis @@ -238,6 +239,7 @@ define Maybe(One) if generate_create_table(apps, destination_dir) is failure then println("failure");failure else println("Generating menu for Database "+name); if generate_hk_menus(apps, destination_dir) is failure then println("failure");failure else + if generate_cxm_lib_menus(apps, destination_dir) is failure then println("failure");failure else writeString(ini, "DB_MODEL", "SHA1", current_db_SHA1); writeIniInfo(ini); success(unique) -- libgit2 0.21.4