Commit 6edb52dd2c5f90f71fe5cc126f9366600d9a96a9
1 parent
cd48d68e
start to rename VT_edit into HK_Form
add generation of HK_Form_Table, which allow to describe editor as table
Showing
6 changed files
with
257 additions
and
93 deletions
Show diff stats
hayamiki_generator.aproj
| ... | ... | @@ -517,6 +517,8 @@ |
| 517 | 517 | <Compile Include="src\generation\create_table.anubis" /> |
| 518 | 518 | <Compile Include="src\generation\cxm_lib_menu.anubis" /> |
| 519 | 519 | <Compile Include="src\generation\densaku.anubis" /> |
| 520 | + <Compile Include="src\generation\edit_view_list_form.anubis" /> | |
| 521 | + <Compile Include="src\generation\edit_view_table_form.anubis" /> | |
| 520 | 522 | <Compile Include="src\generation\extractor.anubis" /> |
| 521 | 523 | <Compile Include="src\generation\fields.anubis" /> |
| 522 | 524 | <Compile Include="src\generation\files.anubis" /> | ... | ... |
hayamiki_lib @ fed6db131cf
src/generation/columns.anubis
| ... | ... | @@ -211,65 +211,65 @@ public define Maybe(String) |
| 211 | 211 | get_HK_Form_Entry |
| 212 | 212 | ( |
| 213 | 213 | HK_Model_Column col, |
| 214 | - String type_name | |
| 214 | + String type_name //name of the instanciated type | |
| 215 | 215 | ) = |
| 216 | - since col is hk_column(name, col_type, _, help), | |
| 216 | + since col is hk_column(col_name, col_type, _, help), | |
| 217 | 217 | if col_type is |
| 218 | 218 | { |
| 219 | 219 | //anubis(_T) then "constant_byte_array(0,0)", |
| 220 | - p_key then success("primary_key(to_String("+type_name+"."+name+"))"), | |
| 220 | + p_key then success("primary_key(to_String("+type_name+"."+col_name+"))"), | |
| 221 | 221 | //binary then "constant_byte_array(0,0)", |
| 222 | - boolean_field then success("boolean(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), | |
| 222 | + boolean_field then success("boolean(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), | |
| 223 | 223 | date_field(attrs) then if attrs is |
| 224 | 224 | { |
| 225 | - none then success("date(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+".date, "+to_Anubis_source(help)+")"), | |
| 226 | - auto_now then success("information(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+".date, 10, "+to_Anubis_source(help)+")"), | |
| 227 | - auto_now_add then success("information(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+".date, 10, "+to_Anubis_source(help)+")") | |
| 225 | + none then success("date(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+".date, "+to_Anubis_source(help)+")"), | |
| 226 | + auto_now then success("information(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+".date, 10, "+to_Anubis_source(help)+")"), | |
| 227 | + auto_now_add then success("information(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+".date, 10, "+to_Anubis_source(help)+")") | |
| 228 | 228 | }, |
| 229 | 229 | time_field(attrs) then if attrs is |
| 230 | 230 | { |
| 231 | - none then success("time(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+".time, "+to_Anubis_source(help)+")"), | |
| 232 | - auto_now then success("information(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+".time, 10, "+to_Anubis_source(help)+")"), | |
| 233 | - auto_now_add then success("information(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+".time, 10, "+to_Anubis_source(help)+")") | |
| 231 | + none then success("time(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+".time, "+to_Anubis_source(help)+")"), | |
| 232 | + auto_now then success("information(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+".time, 10, "+to_Anubis_source(help)+")"), | |
| 233 | + auto_now_add then success("information(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+".time, 10, "+to_Anubis_source(help)+")") | |
| 234 | 234 | }, |
| 235 | 235 | datetime_field(attrs) then if attrs is |
| 236 | 236 | { |
| 237 | - none then success("datetime(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+".datetime, "+to_Anubis_source(help)+")"), | |
| 238 | - auto_now then success("information(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+".datetime, 18, "+to_Anubis_source(help)+")"), | |
| 239 | - auto_now_add then success("information(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+".datetime, 18, "+to_Anubis_source(help)+")") | |
| 237 | + none then success("datetime(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+".datetime, "+to_Anubis_source(help)+")"), | |
| 238 | + auto_now then success("information(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+".datetime, 18, "+to_Anubis_source(help)+")"), | |
| 239 | + auto_now_add then success("information(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+".datetime, 18, "+to_Anubis_source(help)+")") | |
| 240 | 240 | }, |
| 241 | - foreign_key(app,foreign_table) then success("foreign_text(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", hk_form_selector(get_selector_"+foreign_table+"), "+to_Anubis_source(help)+")"), | |
| 241 | + foreign_key(app,foreign_table) then success("foreign_text(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", hk_form_selector(get_selector_"+foreign_table+"), "+to_Anubis_source(help)+")"), | |
| 242 | 242 | |
| 243 | 243 | |
| 244 | 244 | integer_field(choices) then |
| 245 | 245 | //success("integer(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), |
| 246 | 246 | if choices is |
| 247 | 247 | { |
| 248 | - no_choice then success("integer(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), | |
| 248 | + no_choice then success("integer(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), | |
| 249 | 249 | int_choices(choices_list) then |
| 250 | 250 | //if choice list is NOT empty we construct the possible choices selector |
| 251 | 251 | if length(choices_list) > 0 then |
| 252 | - success("choices_int(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", hk_form_selector(get_choices_selector_"+to_lower(type_name)+"_"+name+"), "+to_Anubis_source(help)+")") | |
| 252 | + success("choices_int(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", hk_form_selector(get_choices_selector_"+to_lower(type_name)+"_"+col_name+"), "+to_Anubis_source(help)+")") | |
| 253 | 253 | else |
| 254 | - success("integer(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), | |
| 254 | + success("integer(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), | |
| 255 | 255 | } |
| 256 | - float_field then success("float(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), | |
| 256 | + float_field then success("float(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), | |
| 257 | 257 | |
| 258 | 258 | //TODO make choices selection if need |
| 259 | 259 | char_field(choices,_) then |
| 260 | 260 | if choices is |
| 261 | 261 | { |
| 262 | - no_choice then success("text(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), | |
| 262 | + no_choice then success("text(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), | |
| 263 | 263 | text_choices(choices_list) then |
| 264 | 264 | //if choice list is NOT empty we construct the possible choices selector |
| 265 | 265 | if length(choices_list) > 0 then |
| 266 | - success("choices_text(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", hk_form_selector(get_choices_selector_"+to_lower(type_name)+"_"+name+"), "+to_Anubis_source(help)+")") | |
| 266 | + success("choices_text(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", hk_form_selector(get_choices_selector_"+to_lower(type_name)+"_"+col_name+"), "+to_Anubis_source(help)+")") | |
| 267 | 267 | else |
| 268 | - success("text(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")") | |
| 268 | + success("text(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")") | |
| 269 | 269 | } |
| 270 | - password_field(min_size) then success("password(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")") | |
| 271 | - text_field(txt_attr) then success("text_area(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(txt_attr)+", "+to_Anubis_source(help)+")"), | |
| 272 | - color_field then success("color(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), | |
| 270 | + password_field(min_size) then success("password(\""+to_upper(col_name)+"\", \""+col_name+"\", "+to_Anubis_source(help)+")") | |
| 271 | + text_field(txt_attr) then success("text_area(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(txt_attr)+", "+to_Anubis_source(help)+")"), | |
| 272 | + color_field then success("color(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), | |
| 273 | 273 | }. |
| 274 | 274 | |
| 275 | 275 | public define String | ... | ... |
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: フランスのトトロ aka (David RENÉ) | |
| 4 | + * Date: 09/04/2017 | |
| 5 | + * Time: 16:40 | |
| 6 | + * © Calexium | |
| 7 | + */ | |
| 8 | + | |
| 9 | +read hayamiki_lib/types/hayamiki.anubis | |
| 10 | +read tools/basis.anubis | |
| 11 | +read tools/list.anubis | |
| 12 | +read tools/streams.anubis | |
| 13 | +read system/string.anubis | |
| 14 | +read columns.anubis | |
| 15 | +read html.anubis | |
| 16 | + | |
| 17 | +define String | |
| 18 | + hk_form_tab_entries | |
| 19 | + ( | |
| 20 | + List(HK_FK_View) fk_views, | |
| 21 | + String indent | |
| 22 | + )= | |
| 23 | + join(",\n", | |
| 24 | + map((HK_FK_View fk_view) | |
| 25 | + |-> | |
| 26 | + since fk_view is fk_view(app_name, fk_table_name, fk_col), | |
| 27 | + indent+" hk_form_tab(\""+fk_table_name+"\", \""+fk_col+"\", \"default\")" | |
| 28 | + , | |
| 29 | + fk_views) | |
| 30 | + ) | |
| 31 | +. | |
| 32 | + | |
| 33 | +public define Maybe(One) | |
| 34 | +/* Generate | |
| 35 | + | |
| 36 | +*/ | |
| 37 | + generate_edit_view_list_form | |
| 38 | + ( | |
| 39 | + Stream stream, //stream file where to write | |
| 40 | + HK_Table table, //db table name | |
| 41 | + String view_name, //name of the form | |
| 42 | + List(HK_Model_Column) l_cols, //Columns selected to be editable in this list form | |
| 43 | + List(HK_FK_View) l_fk_view //List of foreign key view to display | |
| 44 | + )= | |
| 45 | + since table is hk_table(table_name, short_name, model, display), | |
| 46 | + since model is hk_model( columns, _), | |
| 47 | + with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type. | |
| 48 | + | |
| 49 | + if write_string(stream, | |
| 50 | + "\n\n"+ | |
| 51 | + //SQL query | |
| 52 | + "define HK_Form\n"+ | |
| 53 | + " _get_editable_"+table_name+"_"+view_name+"\n"+ | |
| 54 | + " (\n"+ | |
| 55 | + " "+type_name+" "+table_name+",\n"+ | |
| 56 | + " SQLite3DataBase db\n"+ | |
| 57 | + " )=\n"+ | |
| 58 | + " with edit_entries = (List(HK_Form_Entry))\n"+ | |
| 59 | + " [\n"+ | |
| 60 | + " hidden(\"id\", to_String("+table_name+".id)),\n"+ | |
| 61 | + edit_entries(l_cols, table_name, " ", [])+"\n"+ | |
| 62 | + " ],\n"+ | |
| 63 | + (if is_empty(l_fk_view) then | |
| 64 | + " hk_form_in_list(\""+table_name+"\", \""+view_name+"\", edit_entries, []).\n\n" | |
| 65 | + else | |
| 66 | + " with fk_view_entries = (List(HK_Form_Tab))\n"+ | |
| 67 | + " [\n"+ | |
| 68 | + hk_form_tab_entries(l_fk_view, " ")+"\n"+ | |
| 69 | + " ],\n\n"+ | |
| 70 | + " hk_form_in_list(\""+table_name+"\", \""+view_name+"\", edit_entries, fk_view_entries).\n\n" | |
| 71 | + ) | |
| 72 | + ) is //end of the function | |
| 73 | + { | |
| 74 | + failure then println("can't write generate_VT_view "+type_name); failure, | |
| 75 | + success(_) then success(unique) | |
| 76 | + }. | ... | ... |
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: フランスのトトロ aka (David RENÉ) | |
| 4 | + * Date: 09/04/2017 | |
| 5 | + * Time: 02:37 | |
| 6 | + * © Calexium | |
| 7 | + */ | |
| 8 | + | |
| 9 | +read hayamiki_lib/types/hayamiki.anubis | |
| 10 | +read tools/streams.anubis | |
| 11 | +read columns.anubis | |
| 12 | + | |
| 13 | +public define String | |
| 14 | + make_cell | |
| 15 | + ( | |
| 16 | + HK_Edit_View_Table_Cell cell_description, // | |
| 17 | + List(HK_Model_Column) columns, | |
| 18 | + String type_name | |
| 19 | + )= | |
| 20 | + if cell_description is | |
| 21 | + { | |
| 22 | + empty then "" | |
| 23 | + column(col_name) then | |
| 24 | + if get_column_type_from_name(columns, col_name) is | |
| 25 | + { | |
| 26 | + failure then "label(\"column ["+col_name+"] not found\")", | |
| 27 | + success(col_type) then | |
| 28 | + if get_HK_Form_Entry(col_type, type_name) is | |
| 29 | + { | |
| 30 | + failure then "label(\" form for column ["+col_name+"] not found\")", | |
| 31 | + success(form_string) then form_string | |
| 32 | + } | |
| 33 | + } | |
| 34 | + label(label_str) then "label(\""+label_str+"\")" | |
| 35 | + | |
| 36 | + } | |
| 37 | +. | |
| 38 | + | |
| 39 | + | |
| 40 | + get_column_type_from_name(columns, column_name) | |
| 41 | + | |
| 42 | +public define String | |
| 43 | + make_cells | |
| 44 | + ( | |
| 45 | + List(HK_Edit_View_Table_Cell) cells, | |
| 46 | + List(HK_Model_Column) columns, | |
| 47 | + String table_name, | |
| 48 | + String indent | |
| 49 | + ) = | |
| 50 | + if is_empty(cells) then | |
| 51 | + "" | |
| 52 | + else | |
| 53 | + "\n"+indent+ join(",\n"+indent, map((HK_Edit_View_Table_Cell cell) |-> "hk_form_table_cell("+ make_cell(cell, columns, table_name) +")", cells)) | |
| 54 | +. | |
| 55 | + | |
| 56 | + | |
| 57 | + if columns is | |
| 58 | + { | |
| 59 | + [] then indent+" "+join(",\n"+indent+" ", reverse(so_far)), | |
| 60 | + [h . t] then | |
| 61 | + if get_HK_Form_Entry(h, type_name) is | |
| 62 | + { | |
| 63 | + failure then edit_entries(t, type_name, indent, so_far) | |
| 64 | + success(result) then edit_entries(t, type_name, indent, [result . so_far]) | |
| 65 | + } | |
| 66 | + }. | |
| 67 | + | |
| 68 | +define String | |
| 69 | + make_lines | |
| 70 | + ( | |
| 71 | + List(HK_Edit_View_Table_Line) lines, | |
| 72 | + List(HK_Model_Column) columns, | |
| 73 | + String table_name, | |
| 74 | + String indent | |
| 75 | + )= | |
| 76 | + if is_empty(lines) then | |
| 77 | + "" | |
| 78 | + else | |
| 79 | + "\n"+indent+ join(",\n"+indent, map((HK_Edit_View_Table_Line line) |-> "hk_form_table_line(["+ make_cells(line.cells, columns, table_name, indent+" ") +"\n"+indent+"])", lines)) | |
| 80 | +. | |
| 81 | + | |
| 82 | + | |
| 83 | +public define Maybe(One) | |
| 84 | +/* Generate | |
| 85 | + | |
| 86 | +*/ | |
| 87 | + generate_edit_view_table_form | |
| 88 | + ( | |
| 89 | + Stream stream, //stream file where to write | |
| 90 | + HK_Table table, // | |
| 91 | + String view_name, | |
| 92 | + HK_Edit_View_Table form_in_table //edit view to generate | |
| 93 | + )= | |
| 94 | + since table is hk_table(table_name, short_name, model, display), | |
| 95 | + since model is hk_model( columns, _), | |
| 96 | + with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type. | |
| 97 | + | |
| 98 | + //generate the type of the table that contain all components | |
| 99 | + if write_string(stream, | |
| 100 | + "\n\n"+ | |
| 101 | + //SQL query | |
| 102 | + "define HK_Form\n"+ | |
| 103 | + " _get_editable_"+table_name+"_"+view_name+"\n"+ | |
| 104 | + " (\n"+ | |
| 105 | + " "+type_name+" "+table_name+",\n"+ | |
| 106 | + " SQLite3DataBase db\n"+ | |
| 107 | + " )=\n"+ | |
| 108 | + " with form_table = hk_form_table( [\n"+ | |
| 109 | + " //Attributes of the table\n"+ | |
| 110 | + " hidden(\"id\", to_String("+table_name+".id)),\n"+ | |
| 111 | + " ],\n"+ | |
| 112 | + " //All lines and cells of the table \n"+ | |
| 113 | + " ["+ | |
| 114 | + | |
| 115 | + make_lines(form_in_table.lines, columns, table_name, " ")+"\n"+ | |
| 116 | + " ]),\n\n"+ | |
| 117 | + " hk_form_in_table(\""+table_name+"\", \""+view_name+"\", form_table).\n\n" | |
| 118 | + ) is //end of the function | |
| 119 | + { | |
| 120 | + failure then println("can't write generate_VT_view "+type_name); failure, | |
| 121 | + success(_) then success(unique) | |
| 122 | + }. | ... | ... |
src/generation/vt_edit.anubis
| ... | ... | @@ -13,28 +13,16 @@ read system/string.anubis |
| 13 | 13 | read fields.anubis |
| 14 | 14 | read columns.anubis |
| 15 | 15 | read html.anubis |
| 16 | +read edit_view_list_form.anubis | |
| 17 | +read edit_view_table_form.anubis | |
| 18 | + | |
| 16 | 19 | |
| 17 | -define String | |
| 18 | - hk_form_tab_entries | |
| 19 | - ( | |
| 20 | - List(HK_FK_View) fk_views, | |
| 21 | - String indent | |
| 22 | - )= | |
| 23 | - join(",\n", | |
| 24 | - map((HK_FK_View fk_view) | |
| 25 | - |-> | |
| 26 | - since fk_view is fk_view(app_name, fk_table_name, fk_col), | |
| 27 | - indent+" hk_form_tab(\""+fk_table_name+"\", \""+fk_col+"\", \"default\")" | |
| 28 | - , | |
| 29 | - fk_views) | |
| 30 | - ) | |
| 31 | -. | |
| 32 | 20 | |
| 33 | 21 | public define Maybe(One) |
| 34 | 22 | /* Generate |
| 35 | 23 | |
| 36 | 24 | */ |
| 37 | - generate_VT_edit | |
| 25 | + generate_HK_Form | |
| 38 | 26 | ( |
| 39 | 27 | Stream stream, //stream file where to write |
| 40 | 28 | HK_Table table, // |
| ... | ... | @@ -45,61 +33,37 @@ public define Maybe(One) |
| 45 | 33 | //since display is db_display(list_view, list_edit), |
| 46 | 34 | |
| 47 | 35 | with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type. |
| 48 | - with view_name = if edit_view is | |
| 49 | - { | |
| 50 | - edit_view_all then "default", | |
| 51 | - edit_view_list_form(v_name, _, _) then v_name, | |
| 52 | - edit_view_table_form(v_name, _) then v_name | |
| 53 | - }, | |
| 54 | - with current_edit_view = if edit_view is | |
| 55 | - { | |
| 56 | - edit_view_all then columns, | |
| 57 | - edit_view_list_form(v_name, cols, _) then | |
| 58 | - if get_HK_Model_Column_list_from_name_list(columns, cols) is | |
| 59 | - { | |
| 60 | - failure then println("generate_VT_edit: can't get all specified columns for table \""+table_name+"\" view name \""+v_name+"\" cols["+join(", ",cols)+"]");[], | |
| 61 | - success(got_columns) then got_columns, | |
| 62 | - } | |
| 63 | - edit_view_table_form(_,_) then todo "handle case 'edit_view_table_form'" | |
| 64 | - }, | |
| 65 | - with current_fk_views = if edit_view is | |
| 66 | - { | |
| 67 | - edit_view_all then [], | |
| 68 | - edit_view_list_form(_, _, lfk) then lfk, | |
| 69 | - edit_view_table_form(_,_) then [] | |
| 70 | - }, | |
| 36 | + if edit_view is | |
| 37 | + { | |
| 38 | + //generate the form with all entries in list form | |
| 39 | + edit_view_all then | |
| 40 | + generate_edit_view_list_form(stream, table, "default", columns, []), | |
| 41 | + | |
| 42 | + //generate the list form with given columns | |
| 43 | + edit_view_list_form(v_name, cols, lfk) then | |
| 44 | + if get_HK_Model_Column_list_from_name_list(columns, cols) is | |
| 45 | + { | |
| 46 | + failure then | |
| 47 | + println("generate_HK_Form: can't get all specified columns for table \""+table_name+"\" view name \""+v_name+"\" cols["+join(", ",cols)+"]"); | |
| 48 | + failure, | |
| 49 | + success(got_columns) then | |
| 50 | + generate_edit_view_list_form(stream, table, v_name, got_columns, lfk) | |
| 51 | + } | |
| 52 | + edit_view_table_form(v_name, table_description) then | |
| 53 | + generate_edit_view_table_form(stream, table, v_name, table_description) | |
| 54 | + //generate the table form | |
| 55 | + | |
| 56 | + } | |
| 57 | +. | |
| 71 | 58 | |
| 72 | 59 | //generate the type of the table that contain all components |
| 73 | - if write_string(stream, | |
| 74 | - "\n\n"+ | |
| 75 | - //SQL query | |
| 76 | - "define HK_Form\n"+ | |
| 77 | - " _get_editable_"+table_name+"_"+view_name+"\n"+ | |
| 78 | - " (\n"+ | |
| 79 | - " "+type_name+" "+table_name+",\n"+ | |
| 80 | - " SQLite3DataBase db\n"+ | |
| 81 | - " )=\n"+ | |
| 82 | - " with edit_entries = (List(HK_Form_Entry))\n"+ | |
| 83 | - " [\n"+ | |
| 84 | - " hidden(\"id\", to_String("+table_name+".id)),\n"+ | |
| 85 | - edit_entries(current_edit_view, table_name, " ", [])+"\n"+ | |
| 86 | - " ],\n"+ | |
| 87 | - " with fk_view_entries = (List(HK_Form_Tab))\n"+ | |
| 88 | - " [\n"+ | |
| 89 | - hk_form_tab_entries(current_fk_views, " ")+"\n"+ | |
| 90 | - " ],\n"+ | |
| 91 | - " hk_form_in_list(\""+table_name+"\", \""+view_name+"\", edit_entries, fk_view_entries).\n\n" | |
| 92 | - ) is //end of the function | |
| 93 | - { | |
| 94 | - failure then println("can't write generate_VT_view "+type_name); failure, | |
| 95 | - success(_) then success(unique) | |
| 96 | - }. | |
| 60 | + | |
| 97 | 61 | |
| 98 | 62 | public define Maybe(One) |
| 99 | 63 | /* Generate |
| 100 | 64 | |
| 101 | 65 | */ |
| 102 | - _generate_VT_edit | |
| 66 | + _generate_HK_Form | |
| 103 | 67 | ( |
| 104 | 68 | Stream stream, //stream file where to write |
| 105 | 69 | HK_Table table, // |
| ... | ... | @@ -111,11 +75,11 @@ public define Maybe(One) |
| 111 | 75 | [] then |
| 112 | 76 | //if default view was not generated, we force to generate it |
| 113 | 77 | if has_default = false then |
| 114 | - generate_VT_edit(stream, table, edit_view_all) | |
| 78 | + generate_HK_Form(stream, table, edit_view_all) | |
| 115 | 79 | else |
| 116 | 80 | success(unique), |
| 117 | 81 | [view . t] then |
| 118 | - if generate_VT_edit(stream, table, view) is | |
| 82 | + if generate_HK_Form(stream, table, view) is | |
| 119 | 83 | { |
| 120 | 84 | failure then failure, |
| 121 | 85 | success(_) then |
| ... | ... | @@ -132,7 +96,7 @@ public define Maybe(One) |
| 132 | 96 | //if not we search for view named 'default' |
| 133 | 97 | if view_name = "default" then true else false |
| 134 | 98 | }, |
| 135 | - _generate_VT_edit(stream, table, t, new_has_default) | |
| 99 | + _generate_HK_Form(stream, table, t, new_has_default) | |
| 136 | 100 | } |
| 137 | 101 | }. |
| 138 | 102 | |
| ... | ... | @@ -215,7 +179,7 @@ public define Maybe(One) |
| 215 | 179 | since display is hk_display(_, list_edit), |
| 216 | 180 | |
| 217 | 181 | with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. |
| 218 | - if _generate_VT_edit(stream, table, list_edit, false) is //edit view to generate | |
| 182 | + if _generate_HK_Form(stream, table, list_edit, false) is //edit view to generate | |
| 219 | 183 | { |
| 220 | 184 | failure then failure, |
| 221 | 185 | success(_) then generate_get_viewable(stream, table, list_edit) | ... | ... |