Commit 30bc3c986f18aa29a4061c4bcb51088a043e4d71
1 parent
f8f2a481
sync with calexium_lib
add the management of short_name in hk_table add the generation of the menu of application
Showing
7 changed files
with
149 additions
and
73 deletions
Show diff stats
calexium_lib @ 03b49657664
src/check.anubis
| @@ -21,7 +21,7 @@ public define Maybe(List(String)) | @@ -21,7 +21,7 @@ public define Maybe(List(String)) | ||
| 21 | { | 21 | { |
| 22 | [] then success(so_far), | 22 | [] then success(so_far), |
| 23 | [h . t] then | 23 | [h . t] then |
| 24 | - since h is hk_app(name, _), | 24 | + since h is hk_app(name, _, _, _), |
| 25 | if name:so_far then | 25 | if name:so_far then |
| 26 | println("The app name "+name+" already exists"); failure | 26 | println("The app name "+name+" already exists"); failure |
| 27 | //'this' is not allowed as app name because the | 27 | //'this' is not allowed as app name because the |
| @@ -94,13 +94,13 @@ define Maybe(List(HK_Table)) | @@ -94,13 +94,13 @@ define Maybe(List(HK_Table)) | ||
| 94 | { | 94 | { |
| 95 | [] then success(reverse(so_far)), | 95 | [] then success(reverse(so_far)), |
| 96 | [h . t] then | 96 | [h . t] then |
| 97 | - since h is hk_table(name, model, display), | 97 | + since h is hk_table(name, short_name, model, display), |
| 98 | since model is hk_model(columns, display_string), | 98 | since model is hk_model(columns, display_string), |
| 99 | with table_name = if length(app_name) > 0 then app_name +"_"+name else name, | 99 | with table_name = if length(app_name) > 0 then app_name +"_"+name else name, |
| 100 | if resolve_foreign(apps_name, app_name, table_name, columns, []) is | 100 | if resolve_foreign(apps_name, app_name, table_name, columns, []) is |
| 101 | { | 101 | { |
| 102 | failure then failure, | 102 | failure then failure, |
| 103 | - success(checked_model) then resolve_foreign(apps_name, app_name, t, [hk_table(table_name, hk_model(checked_model, display_string), display) . so_far]) | 103 | + success(checked_model) then resolve_foreign(apps_name, app_name, t, [hk_table(table_name, name, hk_model(checked_model, display_string), display) . so_far]) |
| 104 | } | 104 | } |
| 105 | }. | 105 | }. |
| 106 | 106 | ||
| @@ -110,7 +110,7 @@ define Maybe(HK_App) | @@ -110,7 +110,7 @@ define Maybe(HK_App) | ||
| 110 | List(String) apps_name, | 110 | List(String) apps_name, |
| 111 | HK_App app | 111 | HK_App app |
| 112 | )= | 112 | )= |
| 113 | - since app is hk_app(name, tables), | 113 | + since app is hk_app(name, _, _, tables), |
| 114 | if resolve_foreign(apps_name, name, tables, []) is | 114 | if resolve_foreign(apps_name, name, tables, []) is |
| 115 | { | 115 | { |
| 116 | failure then failure, | 116 | failure then failure, |
src/generation/create_table.anubis
| @@ -41,7 +41,7 @@ define String | @@ -41,7 +41,7 @@ define String | ||
| 41 | ( | 41 | ( |
| 42 | HK_Table table | 42 | HK_Table table |
| 43 | )= | 43 | )= |
| 44 | - since table is hk_table(name, model, display), | 44 | + since table is hk_table(name, short_name, model, display), |
| 45 | since model is hk_model( columns, _), | 45 | since model is hk_model( columns, _), |
| 46 | 46 | ||
| 47 | "\n"+ | 47 | "\n"+ |
| @@ -68,7 +68,7 @@ define String | @@ -68,7 +68,7 @@ define String | ||
| 68 | [] then //no more apps to generate | 68 | [] then //no more apps to generate |
| 69 | so_far, //return the all create table generated so far | 69 | so_far, //return the all create table generated so far |
| 70 | [app. t_apps] then //another app available | 70 | [app. t_apps] then //another app available |
| 71 | - since app is hk_app(name, app_tables), | 71 | + since app is hk_app(name, _, _, app_tables), |
| 72 | create_table_generate_all_tables(t_apps, app_tables, so_far + "\n /************ TABLES for Application '"+name+"' ***************/") | 72 | create_table_generate_all_tables(t_apps, app_tables, so_far + "\n /************ TABLES for Application '"+name+"' ***************/") |
| 73 | }, | 73 | }, |
| 74 | 74 | ||
| @@ -77,20 +77,7 @@ define String | @@ -77,20 +77,7 @@ define String | ||
| 77 | create_table_generate_all_tables(apps, t, so_far + create_table_generate_one_table(table)) | 77 | create_table_generate_all_tables(apps, t, so_far + create_table_generate_one_table(table)) |
| 78 | }. | 78 | }. |
| 79 | 79 | ||
| 80 | -define Int | ||
| 81 | - longest_table_name_size | ||
| 82 | - ( | ||
| 83 | - List(HK_App) apps, | ||
| 84 | - Int current_size | ||
| 85 | - )= | ||
| 86 | - if apps is | ||
| 87 | - { | ||
| 88 | - [] then current_size, | ||
| 89 | - [app . t_apps] then | ||
| 90 | - since app is hk_app(_, tables), | ||
| 91 | - with max_size = max(map((HK_Table table) |-> length(table.name), tables), current_size), | ||
| 92 | - longest_table_name_size(t_apps, max_size) | ||
| 93 | - }. | 80 | + |
| 94 | 81 | ||
| 95 | define String | 82 | define String |
| 96 | generate_all_tables_list | 83 | generate_all_tables_list |
| @@ -103,7 +90,7 @@ define String | @@ -103,7 +90,7 @@ define String | ||
| 103 | //hence we can make a beautiful formatting | 90 | //hence we can make a beautiful formatting |
| 104 | with max_space = longest_table_name_size(apps, 0) + 4, | 91 | with max_space = longest_table_name_size(apps, 0) + 4, |
| 105 | join(",\n", | 92 | join(",\n", |
| 106 | - map_append((HK_App app) |-> since app is hk_app(_, tables), | 93 | + map_append((HK_App app) |-> since app is hk_app(_, _, _, tables), |
| 107 | map((HK_Table table) |-> indent+"table("+fill("\""+table.name+"\",", max_space)+"create_table_"+table.name+")", tables), apps)). | 94 | map((HK_Table table) |-> indent+"table("+fill("\""+table.name+"\",", max_space)+"create_table_"+table.name+")", tables), apps)). |
| 108 | 95 | ||
| 109 | public define Maybe(One) | 96 | public define Maybe(One) |
| @@ -131,10 +118,8 @@ public define Maybe(One) | @@ -131,10 +118,8 @@ public define Maybe(One) | ||
| 131 | if write_string(script_stream, | 118 | if write_string(script_stream, |
| 132 | "/* | 119 | "/* |
| 133 | * Created by 早見木 (Hayamiki). | 120 | * Created by 早見木 (Hayamiki). |
| 134 | - * User: Automaton | ||
| 135 | * Date: "+_Int_to_ISO_8601_date(now)+" | 121 | * Date: "+_Int_to_ISO_8601_date(now)+" |
| 136 | * Time: "+_Int_to_ISO_8601_time(now)+" | 122 | * Time: "+_Int_to_ISO_8601_time(now)+" |
| 137 | - * | ||
| 138 | */ | 123 | */ |
| 139 | read data_base/sqlite_foreign_key.anubis | 124 | read data_base/sqlite_foreign_key.anubis |
| 140 | read data_base/db_types.anubis\n"+ | 125 | read data_base/db_types.anubis\n"+ |
| @@ -158,10 +143,8 @@ read data_base/db_types.anubis\n"+ | @@ -158,10 +143,8 @@ read data_base/db_types.anubis\n"+ | ||
| 158 | write_string(stream, | 143 | write_string(stream, |
| 159 | "/* | 144 | "/* |
| 160 | * Created by 早見木 (Hayamiki). | 145 | * Created by 早見木 (Hayamiki). |
| 161 | - * User: Automaton | ||
| 162 | * Date: "+_Int_to_ISO_8601_date(now)+" | 146 | * Date: "+_Int_to_ISO_8601_date(now)+" |
| 163 | * Time: "+_Int_to_ISO_8601_time(now)+" | 147 | * Time: "+_Int_to_ISO_8601_time(now)+" |
| 164 | - * | ||
| 165 | */ | 148 | */ |
| 166 | * | 149 | * |
| 167 | read tools/basis.anubis | 150 | read tools/basis.anubis |
src/generation/files.anubis
| @@ -16,6 +16,7 @@ read tools/ISO-8601.anubis | @@ -16,6 +16,7 @@ read tools/ISO-8601.anubis | ||
| 16 | read generation/header.anubis | 16 | read generation/header.anubis |
| 17 | read generation/types.anubis | 17 | read generation/types.anubis |
| 18 | read generation/create_table.anubis | 18 | read generation/create_table.anubis |
| 19 | +read generation/menu.anubis | ||
| 19 | read check.anubis | 20 | read check.anubis |
| 20 | 21 | ||
| 21 | define Maybe(One) | 22 | define Maybe(One) |
| @@ -24,12 +25,12 @@ define Maybe(One) | @@ -24,12 +25,12 @@ define Maybe(One) | ||
| 24 | HK_Table org_table | 25 | HK_Table org_table |
| 25 | ) | 26 | ) |
| 26 | = | 27 | = |
| 27 | - since org_table is hk_table(name, old_model, display), | 28 | + since org_table is hk_table(name, short_name, old_model, display), |
| 28 | since old_model is hk_model(columns, show_string), | 29 | since old_model is hk_model(columns, show_string), |
| 29 | - since display is db_display(list_view, list_edit), | 30 | + since display is hk_display(list_view, list_edit), |
| 30 | 31 | ||
| 31 | with model = hk_model([hk_column("id", p_key, []). columns], show_string ), | 32 | with model = hk_model([hk_column("id", p_key, []). columns], show_string ), |
| 32 | - with table = hk_table(name, model, display), | 33 | + with table = hk_table(name, short_name, model, display), |
| 33 | println("Generating file for table ["+name+"]"); | 34 | println("Generating file for table ["+name+"]"); |
| 34 | with file_name = "database/generated/"+name+".anubis", | 35 | with file_name = "database/generated/"+name+".anubis", |
| 35 | 36 | ||
| @@ -78,7 +79,7 @@ define One | @@ -78,7 +79,7 @@ define One | ||
| 78 | ( | 79 | ( |
| 79 | List(HK_App) apps | 80 | List(HK_App) apps |
| 80 | )= | 81 | )= |
| 81 | - map_forget((HK_App app) |-> since app is hk_app(app_name, tables), | 82 | + map_forget((HK_App app) |-> since app is hk_app(app_name, _, _, tables), |
| 82 | println("generating tables for App ["+app_name+"]"); | 83 | println("generating tables for App ["+app_name+"]"); |
| 83 | make_all_tables(tables), apps). | 84 | make_all_tables(tables), apps). |
| 84 | 85 | ||
| @@ -149,7 +150,7 @@ define One | @@ -149,7 +150,7 @@ define One | ||
| 149 | }, | 150 | }, |
| 150 | 151 | ||
| 151 | [table . t] then | 152 | [table . t] then |
| 152 | - since table is hk_table(name, _, _), | 153 | + since table is hk_table(name, _, _, _), |
| 153 | with transmit = "transmit "+name+".anubis", | 154 | with transmit = "transmit "+name+".anubis", |
| 154 | with view = "vtm_view(\""+name+"\", get_viewable_"+name+")", | 155 | with view = "vtm_view(\""+name+"\", get_viewable_"+name+")", |
| 155 | with edit = "vtm_edit(\""+name+"\", get_editable_"+name+")", | 156 | with edit = "vtm_edit(\""+name+"\", get_editable_"+name+")", |
| @@ -184,6 +185,8 @@ public define One | @@ -184,6 +185,8 @@ public define One | ||
| 184 | make_vtm(apps); | 185 | make_vtm(apps); |
| 185 | println("Generating create for Database "+name); | 186 | println("Generating create for Database "+name); |
| 186 | if generate_create_table(apps) is failure then println("failure") else | 187 | if generate_create_table(apps) is failure then println("failure") else |
| 188 | + println("Generating menu for Database "+name); | ||
| 189 | + if generate_menus(apps) is failure then println("failure") else | ||
| 187 | unique | 190 | unique |
| 188 | }. | 191 | }. |
| 189 | 192 |
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: フランスのトトロ | ||
| 4 | + * Date: 06/02/2016 | ||
| 5 | + * Time: 15:40 | ||
| 6 | + * © Calexium | ||
| 7 | + */ | ||
| 8 | +read calexium_lib/database/model/db_model.anubis | ||
| 9 | +read tools/basis.anubis | ||
| 10 | +read tools/int.anubis | ||
| 11 | +read system/string.anubis | ||
| 12 | +read system/files.anubis | ||
| 13 | +read tools/streams.anubis | ||
| 14 | +read tools/ISO-8601.anubis | ||
| 15 | + | ||
| 16 | + | ||
| 17 | +define String | ||
| 18 | + generate_application_menu | ||
| 19 | + ( | ||
| 20 | + List(HK_App) apps, | ||
| 21 | +// List(HK_Table) tables, //list of the table model description | ||
| 22 | + String indent | ||
| 23 | + )= | ||
| 24 | + // hk_menu_list("111", help_text("222"), | ||
| 25 | + // [ | ||
| 26 | + // hk_menu_item("production_mass_storage", "view_table", "CURRENT", [("table_name", "production_mass_storage", ),("view_name", "current")]), | ||
| 27 | + | ||
| 28 | + //calculate then longest table name and add 4 for enclosed quote + coma + final space | ||
| 29 | + //hence we can make a beautiful formatting | ||
| 30 | + with max_space = longest_table_name_size(apps, 0) + 4, | ||
| 31 | + | ||
| 32 | + join(",\n", | ||
| 33 | + map((HK_App app) |-> since app is hk_app(app_name, icon, help, tables), | ||
| 34 | + indent+"hk_menu_list("+to_String(icon)+", "+ | ||
| 35 | + //determine if there is help text for app. If not we use the App name as menu entry | ||
| 36 | + with app_menu_name = if help is no_help_text then help_text(to_upper(if app_name ="" then "base" else app_name)) else help, | ||
| 37 | + to_Anubis_source(app_menu_name)+",\n"+indent+"[\n"+ | ||
| 38 | + join(",\n", | ||
| 39 | + map_append((HK_Table table) |-> | ||
| 40 | + since table is hk_table(table_name, short_name, model, display), | ||
| 41 | + since display is hk_display(list_views, _), | ||
| 42 | + map((HK_List_View view ) |-> | ||
| 43 | + with view_name = if view is list_view(v_name, _) then v_name else "default", | ||
| 44 | + indent+" "+"hk_menu_item("+fill_or_cut("\""+table_name+"\",",max_space, ' ')+ "\"view_table\", "+ | ||
| 45 | + fill_or_cut("\""+short_name+(if view_name="default" then "" else " "+view_name)+"\",",max_space, ' ')+ | ||
| 46 | + "[(\"table_name\", "+fill_or_cut("\""+table_name+"\",",max_space, ' ')+"),(\"view_name\", \""+view_name+"\")])", list_views), tables))+"\n"+indent+"])", apps)). | ||
| 47 | + | ||
| 48 | + | ||
| 49 | +public define Maybe(One) | ||
| 50 | + generate_menus | ||
| 51 | + ( | ||
| 52 | + List(HK_App) apps //list of the table model description | ||
| 53 | + )= | ||
| 54 | + | ||
| 55 | + with file_name = "web_pages/generated/apps_menu.anubis", | ||
| 56 | + | ||
| 57 | + //create all necessary directories if doesn't exist. | ||
| 58 | + make_directories(file_name); | ||
| 59 | + | ||
| 60 | + //create script file name as new file. Previous file with same name will be erased | ||
| 61 | + if file(file_name, new) is | ||
| 62 | + { | ||
| 63 | + failure then println("Can't create menu "+file_name);failure, | ||
| 64 | + success(fd) then | ||
| 65 | + with stream = make_stream(fd), | ||
| 66 | + | ||
| 67 | + write_string(stream, | ||
| 68 | +"/* | ||
| 69 | + * Created by 早見木 (Hayamiki). | ||
| 70 | + * Date: "+_Int_to_ISO_8601_date(now)+" | ||
| 71 | + * Time: "+_Int_to_ISO_8601_time(now)+" | ||
| 72 | + */ | ||
| 73 | + | ||
| 74 | +transmis calexium_lib/database/model/db_model.anubis | ||
| 75 | +transmit types/hk_menu_types.anubis | ||
| 76 | + | ||
| 77 | +public define HK_Menu | ||
| 78 | + admin_menu | ||
| 79 | + = | ||
| 80 | +hk_menu([ | ||
| 81 | + hk_menu_item(\"\", \"\", \"HOME\", []), | ||
| 82 | + hk_menu_list(\"managers\", help_text_TAG(\"APPLICATIONS\"), | ||
| 83 | + [\n"+ | ||
| 84 | + generate_application_menu(apps, " ")+"\n | ||
| 85 | + ]), | ||
| 86 | + ] | ||
| 87 | +).\n") | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | +. |
src/generation/types.anubis
| @@ -34,7 +34,7 @@ public define Maybe(One) | @@ -34,7 +34,7 @@ public define Maybe(One) | ||
| 34 | Stream stream, | 34 | Stream stream, |
| 35 | HK_Table table | 35 | HK_Table table |
| 36 | )= | 36 | )= |
| 37 | - since table is hk_table(name, model, display), | 37 | + since table is hk_table(name, short_name, model, display), |
| 38 | since model is hk_model(columns, show_string), | 38 | since model is hk_model(columns, show_string), |
| 39 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | 39 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. |
| 40 | 40 | ||
| @@ -69,7 +69,7 @@ public define Maybe(One) | @@ -69,7 +69,7 @@ public define Maybe(One) | ||
| 69 | Stream stream, | 69 | Stream stream, |
| 70 | HK_Table table | 70 | HK_Table table |
| 71 | )= | 71 | )= |
| 72 | - since table is hk_table(name, model, _), | 72 | + since table is hk_table(name, short_name, model, _), |
| 73 | since model is hk_model(columns, show_string), | 73 | since model is hk_model(columns, show_string), |
| 74 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | 74 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. |
| 75 | 75 | ||
| @@ -115,7 +115,7 @@ public define Maybe(One) | @@ -115,7 +115,7 @@ public define Maybe(One) | ||
| 115 | Stream stream, | 115 | Stream stream, |
| 116 | HK_Table table | 116 | HK_Table table |
| 117 | )= | 117 | )= |
| 118 | - since table is hk_table(name, model, _), | 118 | + since table is hk_table(name, short_name, model, _), |
| 119 | since model is hk_model(columns, _), | 119 | since model is hk_model(columns, _), |
| 120 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | 120 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. |
| 121 | since _generate_extract_web_arg(columns, [], 0) is ((List(String))list_of_web_arg, (Int) nb_closure), | 121 | since _generate_extract_web_arg(columns, [], 0) is ((List(String))list_of_web_arg, (Int) nb_closure), |
| @@ -137,7 +137,7 @@ public define Maybe(One) | @@ -137,7 +137,7 @@ public define Maybe(One) | ||
| 137 | Stream stream, | 137 | Stream stream, |
| 138 | HK_Table table | 138 | HK_Table table |
| 139 | )= | 139 | )= |
| 140 | - since table is hk_table(name, model, display), | 140 | + since table is hk_table(name, short_name, model, display), |
| 141 | since model is hk_model(columns, _), | 141 | since model is hk_model(columns, _), |
| 142 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | 142 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. |
| 143 | 143 | ||
| @@ -168,7 +168,7 @@ public define Maybe(One) | @@ -168,7 +168,7 @@ public define Maybe(One) | ||
| 168 | Stream stream, | 168 | Stream stream, |
| 169 | HK_Table table | 169 | HK_Table table |
| 170 | )= | 170 | )= |
| 171 | - since table is hk_table(name, model, _), | 171 | + since table is hk_table(name, short_name, model, _), |
| 172 | since model is hk_model(columns, _), | 172 | since model is hk_model(columns, _), |
| 173 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | 173 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. |
| 174 | 174 | ||
| @@ -211,7 +211,7 @@ public define Maybe(One) | @@ -211,7 +211,7 @@ public define Maybe(One) | ||
| 211 | Stream stream, | 211 | Stream stream, |
| 212 | HK_Table table | 212 | HK_Table table |
| 213 | )= | 213 | )= |
| 214 | - since table is hk_table(name, model, _), | 214 | + since table is hk_table(name, short_name, model, _), |
| 215 | since model is hk_model(columns, show_string), | 215 | since model is hk_model(columns, show_string), |
| 216 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | 216 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. |
| 217 | 217 | ||
| @@ -251,7 +251,7 @@ public define Maybe(One) | @@ -251,7 +251,7 @@ public define Maybe(One) | ||
| 251 | Stream stream, | 251 | Stream stream, |
| 252 | HK_Table table | 252 | HK_Table table |
| 253 | )= | 253 | )= |
| 254 | - since table is hk_table(name, model, _), | 254 | + since table is hk_table(name, short_name, model, _), |
| 255 | since model is hk_model( columns, _), | 255 | since model is hk_model( columns, _), |
| 256 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | 256 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. |
| 257 | 257 | ||
| @@ -307,7 +307,7 @@ public define Maybe(One) | @@ -307,7 +307,7 @@ public define Maybe(One) | ||
| 307 | Stream stream, | 307 | Stream stream, |
| 308 | HK_Table table | 308 | HK_Table table |
| 309 | )= | 309 | )= |
| 310 | - since table is hk_table(name, model, _), | 310 | + since table is hk_table(name, short_name, model, _), |
| 311 | since model is hk_model( columns, show_string), | 311 | since model is hk_model( columns, show_string), |
| 312 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | 312 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. |
| 313 | 313 | ||
| @@ -338,7 +338,7 @@ public define Maybe(One) | @@ -338,7 +338,7 @@ public define Maybe(One) | ||
| 338 | Stream stream, | 338 | Stream stream, |
| 339 | HK_Table table | 339 | HK_Table table |
| 340 | )= | 340 | )= |
| 341 | - since table is hk_table(name, model, _), | 341 | + since table is hk_table(name, short_name, model, _), |
| 342 | since model is hk_model( columns, show_string), | 342 | since model is hk_model( columns, show_string), |
| 343 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | 343 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. |
| 344 | 344 | ||
| @@ -384,7 +384,7 @@ public define Maybe(One) | @@ -384,7 +384,7 @@ public define Maybe(One) | ||
| 384 | HK_Table table, // | 384 | HK_Table table, // |
| 385 | HK_List_View list_view //list view to generate | 385 | HK_List_View list_view //list view to generate |
| 386 | )= | 386 | )= |
| 387 | - since table is hk_table(table_name, model, display), | 387 | + since table is hk_table(table_name, short_name, model, display), |
| 388 | since model is hk_model( columns, _), | 388 | since model is hk_model( columns, _), |
| 389 | //since display is db_display(list_view, list_edit), | 389 | //since display is db_display(list_view, list_edit), |
| 390 | 390 | ||
| @@ -515,7 +515,7 @@ public define Maybe(One) | @@ -515,7 +515,7 @@ public define Maybe(One) | ||
| 515 | HK_Table table, // | 515 | HK_Table table, // |
| 516 | List(HK_List_View) list_view //list view to generate | 516 | List(HK_List_View) list_view //list view to generate |
| 517 | )= | 517 | )= |
| 518 | - since table is hk_table(table_name, model, display), | 518 | + since table is hk_table(table_name, short_name, model, display), |
| 519 | if write_string(stream, | 519 | if write_string(stream, |
| 520 | "public define VT_view\n"+ | 520 | "public define VT_view\n"+ |
| 521 | " get_viewable_"+table_name+"\n"+ | 521 | " get_viewable_"+table_name+"\n"+ |
| @@ -537,9 +537,9 @@ public define Maybe(One) | @@ -537,9 +537,9 @@ public define Maybe(One) | ||
| 537 | Stream stream, | 537 | Stream stream, |
| 538 | HK_Table table | 538 | HK_Table table |
| 539 | )= | 539 | )= |
| 540 | - since table is hk_table(name, model, display), | 540 | + since table is hk_table(name, short_name, model, display), |
| 541 | since model is hk_model( columns, _), | 541 | since model is hk_model( columns, _), |
| 542 | - since display is db_display(list_view, list_edit), | 542 | + since display is hk_display(list_view, list_edit), |
| 543 | 543 | ||
| 544 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | 544 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. |
| 545 | if _generate_VT_view(stream, table, list_view, false) is //list view to generate | 545 | if _generate_VT_view(stream, table, list_view, false) is //list view to generate |
| @@ -555,9 +555,9 @@ public define Maybe(One) | @@ -555,9 +555,9 @@ public define Maybe(One) | ||
| 555 | Stream stream, | 555 | Stream stream, |
| 556 | HK_Table table | 556 | HK_Table table |
| 557 | )= | 557 | )= |
| 558 | - since table is hk_table(name, model, display), | ||
| 559 | - since model is hk_model( columns, _), | ||
| 560 | - since display is db_display(list_view, list_edit), | 558 | + since table is hk_table(name, short_name, model, display), |
| 559 | + since model is hk_model( columns, _), | ||
| 560 | + since display is hk_display(list_view, list_edit), | ||
| 561 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | 561 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. |
| 562 | 562 | ||
| 563 | //generate the type of the table that contain all components | 563 | //generate the type of the table that contain all components |
src/model.3.0.0.anubis
| @@ -39,7 +39,7 @@ public define HK_Table mf_serial_table = | @@ -39,7 +39,7 @@ public define HK_Table mf_serial_table = | ||
| 39 | ], | 39 | ], |
| 40 | "obj.serial" | 40 | "obj.serial" |
| 41 | ), | 41 | ), |
| 42 | - db_display( | 42 | + hk_display( |
| 43 | 43 | ||
| 44 | [ | 44 | [ |
| 45 | //list_view | 45 | //list_view |
| @@ -65,7 +65,7 @@ public define HK_Table settings_table = | @@ -65,7 +65,7 @@ public define HK_Table settings_table = | ||
| 65 | ], | 65 | ], |
| 66 | "obj.var_name+\" = \"+obj.var_value" | 66 | "obj.var_name+\" = \"+obj.var_value" |
| 67 | ), | 67 | ), |
| 68 | - db_display( | 68 | + hk_display( |
| 69 | //list_view | 69 | //list_view |
| 70 | [ list_view_all], | 70 | [ list_view_all], |
| 71 | //list edit | 71 | //list edit |
| @@ -90,7 +90,7 @@ public define HK_Table django_admin_log_table = | @@ -90,7 +90,7 @@ public define HK_Table django_admin_log_table = | ||
| 90 | ], | 90 | ], |
| 91 | "obj.object_repr" | 91 | "obj.object_repr" |
| 92 | ), | 92 | ), |
| 93 | - db_display( | 93 | + hk_display( |
| 94 | //list_view | 94 | //list_view |
| 95 | [ list_view_all], | 95 | [ list_view_all], |
| 96 | //list edit | 96 | //list edit |
| @@ -108,7 +108,7 @@ public define HK_Table production_macaddress_table = | @@ -108,7 +108,7 @@ public define HK_Table production_macaddress_table = | ||
| 108 | ], | 108 | ], |
| 109 | "obj.mac+\" = MailFountain[\"+obj.mailfountain_id+\"]\"" | 109 | "obj.mac+\" = MailFountain[\"+obj.mailfountain_id+\"]\"" |
| 110 | ), | 110 | ), |
| 111 | - db_display( | 111 | + hk_display( |
| 112 | //list_view | 112 | //list_view |
| 113 | [ list_view_all], | 113 | [ list_view_all], |
| 114 | //list edit | 114 | //list edit |
| @@ -125,7 +125,7 @@ public define HK_Table production_mass_storage_type_table = | @@ -125,7 +125,7 @@ public define HK_Table production_mass_storage_type_table = | ||
| 125 | ], | 125 | ], |
| 126 | "to_String(obj.id)+\":\"+obj.type" | 126 | "to_String(obj.id)+\":\"+obj.type" |
| 127 | ), | 127 | ), |
| 128 | - db_display( | 128 | + hk_display( |
| 129 | //list_view | 129 | //list_view |
| 130 | [ list_view_all], | 130 | [ list_view_all], |
| 131 | //list edit | 131 | //list edit |
| @@ -150,7 +150,7 @@ public define HK_Table production_mass_storage_table = | @@ -150,7 +150,7 @@ public define HK_Table production_mass_storage_table = | ||
| 150 | ], | 150 | ], |
| 151 | "obj.serial" | 151 | "obj.serial" |
| 152 | ), | 152 | ), |
| 153 | - db_display( | 153 | + hk_display( |
| 154 | //list_view | 154 | //list_view |
| 155 | [ | 155 | [ |
| 156 | list_view("current",["model_id", "serial", "status", "date_created"]) | 156 | list_view("current",["model_id", "serial", "status", "date_created"]) |
| @@ -189,7 +189,7 @@ public define HK_Table production_mass_storage_model_table = | @@ -189,7 +189,7 @@ public define HK_Table production_mass_storage_model_table = | ||
| 189 | ], | 189 | ], |
| 190 | "obj.manufacturer" | 190 | "obj.manufacturer" |
| 191 | ), | 191 | ), |
| 192 | - db_display( | 192 | + hk_display( |
| 193 | //list_view | 193 | //list_view |
| 194 | [ | 194 | [ |
| 195 | list_view("default", ["manufacturer", "type_id", "capacity", "tr_min", "last_modified", "date_created"]) | 195 | list_view("default", ["manufacturer", "type_id", "capacity", "tr_min", "last_modified", "date_created"]) |
| @@ -214,7 +214,7 @@ public define HK_Table production_memory_table = | @@ -214,7 +214,7 @@ public define HK_Table production_memory_table = | ||
| 214 | ], | 214 | ], |
| 215 | "obj.serial" | 215 | "obj.serial" |
| 216 | ), | 216 | ), |
| 217 | - db_display( | 217 | + hk_display( |
| 218 | //list_view | 218 | //list_view |
| 219 | [ | 219 | [ |
| 220 | list_view("default", ["serial", "status", "last_modified", "date_created"]) | 220 | list_view("default", ["serial", "status", "last_modified", "date_created"]) |
| @@ -235,7 +235,7 @@ public define HK_Table production_memory_model_table = | @@ -235,7 +235,7 @@ public define HK_Table production_memory_model_table = | ||
| 235 | ], | 235 | ], |
| 236 | "obj.manufacturer" | 236 | "obj.manufacturer" |
| 237 | ), | 237 | ), |
| 238 | - db_display( | 238 | + hk_display( |
| 239 | //list_view | 239 | //list_view |
| 240 | [ list_view_all], | 240 | [ list_view_all], |
| 241 | //list_edit | 241 | //list_edit |
| @@ -252,7 +252,7 @@ public define HK_Table production_memory_type_table = | @@ -252,7 +252,7 @@ public define HK_Table production_memory_type_table = | ||
| 252 | ], | 252 | ], |
| 253 | "to_String(obj.id)+\":\"+obj.type" | 253 | "to_String(obj.id)+\":\"+obj.type" |
| 254 | ), | 254 | ), |
| 255 | - db_display( | 255 | + hk_display( |
| 256 | //list_view | 256 | //list_view |
| 257 | [ list_view_all], | 257 | [ list_view_all], |
| 258 | //list edit | 258 | //list edit |
| @@ -276,7 +276,7 @@ public define HK_Table production_motherboard_table = | @@ -276,7 +276,7 @@ public define HK_Table production_motherboard_table = | ||
| 276 | ], | 276 | ], |
| 277 | "obj.serial" | 277 | "obj.serial" |
| 278 | ), | 278 | ), |
| 279 | - db_display( | 279 | + hk_display( |
| 280 | //list_view | 280 | //list_view |
| 281 | [ | 281 | [ |
| 282 | list_view("default", ["serial", "week_fab", "status", "last_modified", "date_created"]) | 282 | list_view("default", ["serial", "week_fab", "status", "last_modified", "date_created"]) |
| @@ -302,7 +302,7 @@ public define HK_Table production_motherboard_model_table = | @@ -302,7 +302,7 @@ public define HK_Table production_motherboard_model_table = | ||
| 302 | ], | 302 | ], |
| 303 | "obj.name" | 303 | "obj.name" |
| 304 | ), | 304 | ), |
| 305 | - db_display( | 305 | + hk_display( |
| 306 | //list_view | 306 | //list_view |
| 307 | [ | 307 | [ |
| 308 | list_view("default", ["name", "manufacturer", "cpu_model", "cpu_freq"]) | 308 | list_view("default", ["name", "manufacturer", "cpu_model", "cpu_freq"]) |
| @@ -327,7 +327,7 @@ public define HK_Table production_power_supply_table = | @@ -327,7 +327,7 @@ public define HK_Table production_power_supply_table = | ||
| 327 | ], | 327 | ], |
| 328 | "obj.serial" | 328 | "obj.serial" |
| 329 | ), | 329 | ), |
| 330 | - db_display( | 330 | + hk_display( |
| 331 | //list_view | 331 | //list_view |
| 332 | [ | 332 | [ |
| 333 | list_view("default", ["serial", "status", "date_created", "last_modified"]) | 333 | list_view("default", ["serial", "status", "date_created", "last_modified"]) |
| @@ -348,7 +348,7 @@ public define HK_Table production_power_supply_model_table = | @@ -348,7 +348,7 @@ public define HK_Table production_power_supply_model_table = | ||
| 348 | ], | 348 | ], |
| 349 | "obj.name" | 349 | "obj.name" |
| 350 | ), | 350 | ), |
| 351 | - db_display( | 351 | + hk_display( |
| 352 | //list_view | 352 | //list_view |
| 353 | [ | 353 | [ |
| 354 | list_view("default", ["name", "manufacturer"]) | 354 | list_view("default", ["name", "manufacturer"]) |
| @@ -378,7 +378,7 @@ public define HK_Table production_product_reference_table = | @@ -378,7 +378,7 @@ public define HK_Table production_product_reference_table = | ||
| 378 | ], | 378 | ], |
| 379 | "obj.product_ref+\":\"+obj.product_name" | 379 | "obj.product_ref+\":\"+obj.product_name" |
| 380 | ), | 380 | ), |
| 381 | - db_display( | 381 | + hk_display( |
| 382 | //list_view | 382 | //list_view |
| 383 | [ | 383 | [ |
| 384 | list_view("default", ["type_ref_id", "product_ref", "product_name", "description"]) | 384 | list_view("default", ["type_ref_id", "product_ref", "product_name", "description"]) |
| @@ -415,7 +415,7 @@ public define HK_Table production_products_table = | @@ -415,7 +415,7 @@ public define HK_Table production_products_table = | ||
| 415 | ], | 415 | ], |
| 416 | "obj.serial" | 416 | "obj.serial" |
| 417 | ), | 417 | ), |
| 418 | - db_display( | 418 | + hk_display( |
| 419 | //list_view | 419 | //list_view |
| 420 | [ | 420 | [ |
| 421 | list_view("default", ["production_id", "date", "serial", "motherboard_id", "app_id", "status"]) | 421 | list_view("default", ["production_id", "date", "serial", "motherboard_id", "app_id", "status"]) |
| @@ -449,7 +449,7 @@ public define HK_Table production_production_table = | @@ -449,7 +449,7 @@ public define HK_Table production_production_table = | ||
| 449 | ], | 449 | ], |
| 450 | "date(obj.date)" | 450 | "date(obj.date)" |
| 451 | ), | 451 | ), |
| 452 | - db_display( | 452 | + hk_display( |
| 453 | //list_view | 453 | //list_view |
| 454 | [ | 454 | [ |
| 455 | list_view("default", ["date", "type_ref_id", "sticker_tpl_id", "product_ref_id", "site_id", "product_count", "produced_count"]) | 455 | list_view("default", ["date", "type_ref_id", "sticker_tpl_id", "product_ref_id", "site_id", "product_count", "produced_count"]) |
| @@ -475,7 +475,7 @@ public define HK_Table production_production_site_table = | @@ -475,7 +475,7 @@ public define HK_Table production_production_site_table = | ||
| 475 | ], | 475 | ], |
| 476 | "obj.ref+\":\"+obj.name" | 476 | "obj.ref+\":\"+obj.name" |
| 477 | ), | 477 | ), |
| 478 | - db_display( | 478 | + hk_display( |
| 479 | //list_view | 479 | //list_view |
| 480 | [ | 480 | [ |
| 481 | list_view("default", ["ref", "name", "city", "country"]) | 481 | list_view("default", ["ref", "name", "city", "country"]) |
| @@ -500,7 +500,7 @@ public define HK_Table production_purchase_table = | @@ -500,7 +500,7 @@ public define HK_Table production_purchase_table = | ||
| 500 | ], | 500 | ], |
| 501 | "date(obj.date)" | 501 | "date(obj.date)" |
| 502 | ), | 502 | ), |
| 503 | - db_display( | 503 | + hk_display( |
| 504 | //list_view | 504 | //list_view |
| 505 | [ | 505 | [ |
| 506 | list_view("default", ["date", "supplier_id", "description"]) | 506 | list_view("default", ["date", "supplier_id", "description"]) |
| @@ -520,7 +520,7 @@ public define HK_Table production_serial_prefix_table = | @@ -520,7 +520,7 @@ public define HK_Table production_serial_prefix_table = | ||
| 520 | ], | 520 | ], |
| 521 | "obj.prefix" | 521 | "obj.prefix" |
| 522 | ), | 522 | ), |
| 523 | - db_display( | 523 | + hk_display( |
| 524 | //list_view | 524 | //list_view |
| 525 | [list_view_all], | 525 | [list_view_all], |
| 526 | //list_edit | 526 | //list_edit |
| @@ -541,7 +541,7 @@ public define HK_Table production_type_number_table = | @@ -541,7 +541,7 @@ public define HK_Table production_type_number_table = | ||
| 541 | ], | 541 | ], |
| 542 | "obj.type_ref+\":\"+obj.description" | 542 | "obj.type_ref+\":\"+obj.description" |
| 543 | ), | 543 | ), |
| 544 | - db_display( | 544 | + hk_display( |
| 545 | //list_view | 545 | //list_view |
| 546 | [ | 546 | [ |
| 547 | list_view("default", ["type_ref", "description"]) | 547 | list_view("default", ["type_ref", "description"]) |
| @@ -576,7 +576,7 @@ public define HK_Table production_supplier_table = | @@ -576,7 +576,7 @@ public define HK_Table production_supplier_table = | ||
| 576 | ], | 576 | ], |
| 577 | "obj.company" | 577 | "obj.company" |
| 578 | ), | 578 | ), |
| 579 | - db_display( | 579 | + hk_display( |
| 580 | //list_view | 580 | //list_view |
| 581 | [ | 581 | [ |
| 582 | list_view("default", ["company", "phone", "mobile", "email"]) | 582 | list_view("default", ["company", "phone", "mobile", "email"]) |
| @@ -601,7 +601,7 @@ public define HK_Table department_table = | @@ -601,7 +601,7 @@ public define HK_Table department_table = | ||
| 601 | ], | 601 | ], |
| 602 | "obj.name" | 602 | "obj.name" |
| 603 | ), | 603 | ), |
| 604 | - db_display( | 604 | + hk_display( |
| 605 | //list_view | 605 | //list_view |
| 606 | [ | 606 | [ |
| 607 | list_view("default", ["name"]) | 607 | list_view("default", ["name"]) |
| @@ -624,7 +624,7 @@ public define HK_Table role_table = | @@ -624,7 +624,7 @@ public define HK_Table role_table = | ||
| 624 | ], | 624 | ], |
| 625 | "obj.role_name" | 625 | "obj.role_name" |
| 626 | ), | 626 | ), |
| 627 | - db_display( | 627 | + hk_display( |
| 628 | //list_view | 628 | //list_view |
| 629 | [ | 629 | [ |
| 630 | list_view("default", ["role_name"]) | 630 | list_view("default", ["role_name"]) |
| @@ -652,7 +652,7 @@ public define HK_Table staff_table = | @@ -652,7 +652,7 @@ public define HK_Table staff_table = | ||
| 652 | ], | 652 | ], |
| 653 | "obj.email" | 653 | "obj.email" |
| 654 | ), | 654 | ), |
| 655 | - db_display( | 655 | + hk_display( |
| 656 | //list_view | 656 | //list_view |
| 657 | [ | 657 | [ |
| 658 | list_view("default", ["contact_id", "department_id", "role_id", "email"]), | 658 | list_view("default", ["contact_id", "department_id", "role_id", "email"]), |
| @@ -689,7 +689,7 @@ public define HK_Table address_book_contact_table = | @@ -689,7 +689,7 @@ public define HK_Table address_book_contact_table = | ||
| 689 | ], | 689 | ], |
| 690 | "obj.first_name +\" \"+obj.last_name " | 690 | "obj.first_name +\" \"+obj.last_name " |
| 691 | ), | 691 | ), |
| 692 | - db_display( | 692 | + hk_display( |
| 693 | //list_view | 693 | //list_view |
| 694 | [ | 694 | [ |
| 695 | list_view("short", ["first_name", "last_name", "company"]), | 695 | list_view("short", ["first_name", "last_name", "company"]), |