Commit cd48d68ef74535b1bc6761e9bb33b3517364aff6
1 parent
049aee2e
still working on refactoring
Showing
14 changed files
with
98 additions
and
62 deletions
Show diff stats
calexium_lib @ 891e24cfc2e
densaku_lib @ aaa50241ac1
hayamiki_generator.aproj
| @@ -155,15 +155,7 @@ | @@ -155,15 +155,7 @@ | ||
| 155 | <Compile Include="hayamiki_lib\model\types\hk_text_choices.anubis" /> | 155 | <Compile Include="hayamiki_lib\model\types\hk_text_choices.anubis" /> |
| 156 | <Compile Include="hayamiki_lib\model\types\hk_text_field_attr.anubis" /> | 156 | <Compile Include="hayamiki_lib\model\types\hk_text_field_attr.anubis" /> |
| 157 | <Compile Include="hayamiki_lib\types\hayamiki.anubis" /> | 157 | <Compile Include="hayamiki_lib\types\hayamiki.anubis" /> |
| 158 | - <Compile Include="hayamiki_lib\types\model\app.anubis" /> | ||
| 159 | - <Compile Include="hayamiki_lib\types\model\columns.anubis" /> | ||
| 160 | - <Compile Include="hayamiki_lib\types\model\database.anubis" /> | ||
| 161 | - <Compile Include="hayamiki_lib\types\model\display.anubis" /> | ||
| 162 | - <Compile Include="hayamiki_lib\types\model\fields.anubis" /> | ||
| 163 | - <Compile Include="hayamiki_lib\types\model\help.anubis" /> | ||
| 164 | - <Compile Include="hayamiki_lib\types\model\icons.anubis" /> | ||
| 165 | - <Compile Include="hayamiki_lib\types\model\model.anubis" /> | ||
| 166 | - <Compile Include="hayamiki_lib\types\model\tables.anubis" /> | 158 | + <Compile Include="hayamiki_lib\view\jqgrid.anubis" /> |
| 167 | <Compile Include="hayamiki_lib\view\view_apps_renderer.anubis" /> | 159 | <Compile Include="hayamiki_lib\view\view_apps_renderer.anubis" /> |
| 168 | <Compile Include="hayamiki_lib\view\view_table_manager.anubis" /> | 160 | <Compile Include="hayamiki_lib\view\view_table_manager.anubis" /> |
| 169 | <Compile Include="hayamiki_lib\view\view_table_manager_types.anubis" /> | 161 | <Compile Include="hayamiki_lib\view\view_table_manager_types.anubis" /> |
| @@ -725,9 +717,8 @@ | @@ -725,9 +717,8 @@ | ||
| 725 | <Folder Include="hayamiki_lib\model" /> | 717 | <Folder Include="hayamiki_lib\model" /> |
| 726 | <Folder Include="hayamiki_lib\model\types" /> | 718 | <Folder Include="hayamiki_lib\model\types" /> |
| 727 | <Folder Include="hayamiki_lib\types" /> | 719 | <Folder Include="hayamiki_lib\types" /> |
| 728 | - <Folder Include="hayamiki_lib\types\model" /> | ||
| 729 | - <Folder Include="hayamiki_lib\types\view" /> | ||
| 730 | <Folder Include="hayamiki_lib\view" /> | 720 | <Folder Include="hayamiki_lib\view" /> |
| 721 | + <Folder Include="hayamiki_lib\view\types" /> | ||
| 731 | <Folder Include="library" /> | 722 | <Folder Include="library" /> |
| 732 | <Folder Include="library\a2a" /> | 723 | <Folder Include="library\a2a" /> |
| 733 | <Folder Include="library\a2a\C" /> | 724 | <Folder Include="library\a2a\C" /> |
hayamiki_lib @ 23eeeae8417
src/check.anubis
| @@ -10,7 +10,7 @@ read hayamiki_lib/types/hayamiki.anubis | @@ -10,7 +10,7 @@ read hayamiki_lib/types/hayamiki.anubis | ||
| 10 | read system/string.anubis | 10 | read system/string.anubis |
| 11 | read tools/list.anubis | 11 | read tools/list.anubis |
| 12 | read tools/basis.anubis | 12 | read tools/basis.anubis |
| 13 | -transmit hayamiki_lib/model/types/hk_edit_view.anubis | 13 | +transmit hayamiki_lib/view/types/hk_edit_view.anubis |
| 14 | 14 | ||
| 15 | public define Maybe(List(String)) | 15 | public define Maybe(List(String)) |
| 16 | get_all_apps_name | 16 | get_all_apps_name |
| @@ -120,13 +120,14 @@ define Maybe(HK_Edit_View) | @@ -120,13 +120,14 @@ define Maybe(HK_Edit_View) | ||
| 120 | if _edit_view is | 120 | if _edit_view is |
| 121 | { | 121 | { |
| 122 | edit_view_all then success(edit_view_all), | 122 | edit_view_all then success(edit_view_all), |
| 123 | - edit_view(v, c, fk_views) then | 123 | + edit_view_list_form(v, c, fk_views) then |
| 124 | with mb_fk_views = map_escape((HK_FK_View _fk_view) |-> resolve_HK_FK_View_foreign(apps_name, app_name, _fk_view), fk_views), | 124 | with mb_fk_views = map_escape((HK_FK_View _fk_view) |-> resolve_HK_FK_View_foreign(apps_name, app_name, _fk_view), fk_views), |
| 125 | if mb_fk_views is | 125 | if mb_fk_views is |
| 126 | { | 126 | { |
| 127 | failure then failure, | 127 | failure then failure, |
| 128 | - success(n_fk_views) then success(edit_view(v, c, n_fk_views)) | 128 | + success(n_fk_views) then success(edit_view_list_form(v, c, n_fk_views)) |
| 129 | } | 129 | } |
| 130 | + edit_view_table_form(v, t) then success(edit_view_table_form(v, t)) | ||
| 130 | } | 131 | } |
| 131 | . | 132 | . |
| 132 | 133 |
src/generation/SQL_get_all.anubis
| @@ -114,9 +114,12 @@ public define Maybe(One) | @@ -114,9 +114,12 @@ public define Maybe(One) | ||
| 114 | " get_all_"+name+"_by_clause_to_json\n"+ | 114 | " get_all_"+name+"_by_clause_to_json\n"+ |
| 115 | " (\n"+ | 115 | " (\n"+ |
| 116 | " SQLite3DataBase db,\n"+ | 116 | " SQLite3DataBase db,\n"+ |
| 117 | -" String clause\n"+ | 117 | +" HK_Referer referer,\n"+ |
| 118 | +" String filter\n"+ | ||
| 118 | " )=\n"+ | 119 | " )=\n"+ |
| 119 | -" if get_all_"+name+"_by_clause(db, clause) is\n"+ | 120 | +" with clause = referer_to_sql_clause(referer, \""+name+"\", "+name+"_columns),\n\n"+ |
| 121 | +" //with _and_ = if length(clause) > 0 & length(filter) > 0 then \" AND \" else \"\",\n"+ | ||
| 122 | +" if get_all_"+name+"_by_clause(db, clause+filter) is\n"+ | ||
| 120 | " {\n"+ | 123 | " {\n"+ |
| 121 | " failure then json_member(\"rows\", json_array([])),\n"+ | 124 | " failure then json_member(\"rows\", json_array([])),\n"+ |
| 122 | " success(cursor) then json_member(\"rows\", json_array(_get_all_"+name+"_to_json(db, cursor, [])))\n"+ | 125 | " success(cursor) then json_member(\"rows\", json_array(_get_all_"+name+"_to_json(db, cursor, [])))\n"+ |
src/generation/columns.anubis
| @@ -45,11 +45,12 @@ public define Maybe(List(HK_Model_Column)) | @@ -45,11 +45,12 @@ public define Maybe(List(HK_Model_Column)) | ||
| 45 | 45 | ||
| 46 | define List(String) | 46 | define List(String) |
| 47 | /* return the list of all columns name | 47 | /* return the list of all columns name |
| 48 | + * | ||
| 48 | */ | 49 | */ |
| 49 | _to_List_String | 50 | _to_List_String |
| 50 | ( | 51 | ( |
| 51 | List(HK_Model_Column) columns, | 52 | List(HK_Model_Column) columns, |
| 52 | - Bool with_pk, | 53 | + Bool with_pk, //if set, add the primary key named "id" |
| 53 | List(String) so_far | 54 | List(String) so_far |
| 54 | )= | 55 | )= |
| 55 | if columns is | 56 | if columns is |
| @@ -207,7 +208,7 @@ public define String | @@ -207,7 +208,7 @@ public define String | ||
| 207 | public define Maybe(String) | 208 | public define Maybe(String) |
| 208 | /** Here we generate the VT_Edit entry according to the model | 209 | /** Here we generate the VT_Edit entry according to the model |
| 209 | */ | 210 | */ |
| 210 | - get_VT_edit_entry | 211 | + get_HK_Form_Entry |
| 211 | ( | 212 | ( |
| 212 | HK_Model_Column col, | 213 | HK_Model_Column col, |
| 213 | String type_name | 214 | String type_name |
| @@ -237,7 +238,7 @@ public define Maybe(String) | @@ -237,7 +238,7 @@ public define Maybe(String) | ||
| 237 | auto_now then success("information(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+".datetime, 18, "+to_Anubis_source(help)+")"), | 238 | auto_now then success("information(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+".datetime, 18, "+to_Anubis_source(help)+")"), |
| 238 | auto_now_add 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)+")") |
| 239 | }, | 240 | }, |
| 240 | - foreign_key(app,foreign_table) then success("foreign_text(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", vt_edit_selector(get_selector_"+foreign_table+"), "+to_Anubis_source(help)+")"), | 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 | 242 | ||
| 242 | 243 | ||
| 243 | integer_field(choices) then | 244 | integer_field(choices) then |
| @@ -248,7 +249,7 @@ public define Maybe(String) | @@ -248,7 +249,7 @@ public define Maybe(String) | ||
| 248 | int_choices(choices_list) then | 249 | int_choices(choices_list) then |
| 249 | //if choice list is NOT empty we construct the possible choices selector | 250 | //if choice list is NOT empty we construct the possible choices selector |
| 250 | if length(choices_list) > 0 then | 251 | if length(choices_list) > 0 then |
| 251 | - success("choices_int(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", vt_edit_selector(get_choices_selector_"+to_lower(type_name)+"_"+name+"), "+to_Anubis_source(help)+")") | 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 | else | 253 | else |
| 253 | success("integer(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), | 254 | success("integer(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), |
| 254 | } | 255 | } |
| @@ -262,7 +263,7 @@ public define Maybe(String) | @@ -262,7 +263,7 @@ public define Maybe(String) | ||
| 262 | text_choices(choices_list) then | 263 | text_choices(choices_list) then |
| 263 | //if choice list is NOT empty we construct the possible choices selector | 264 | //if choice list is NOT empty we construct the possible choices selector |
| 264 | if length(choices_list) > 0 then | 265 | if length(choices_list) > 0 then |
| 265 | - success("choices_text(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", vt_edit_selector(get_choices_selector_"+to_lower(type_name)+"_"+name+"), "+to_Anubis_source(help)+")") | 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 | else | 267 | else |
| 267 | success("text(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")") | 268 | success("text(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")") |
| 268 | } | 269 | } |
| @@ -283,7 +284,7 @@ public define String | @@ -283,7 +284,7 @@ public define String | ||
| 283 | { | 284 | { |
| 284 | [] then indent+" "+join(",\n"+indent+" ", reverse(so_far)), | 285 | [] then indent+" "+join(",\n"+indent+" ", reverse(so_far)), |
| 285 | [h . t] then | 286 | [h . t] then |
| 286 | - if get_VT_edit_entry(h, type_name) is | 287 | + if get_HK_Form_Entry(h, type_name) is |
| 287 | { | 288 | { |
| 288 | failure then edit_entries(t, type_name, indent, so_far) | 289 | failure then edit_entries(t, type_name, indent, so_far) |
| 289 | success(result) then edit_entries(t, type_name, indent, [result . so_far]) | 290 | success(result) then edit_entries(t, type_name, indent, [result . so_far]) |
src/generation/fields.anubis
| @@ -105,7 +105,7 @@ public define String | @@ -105,7 +105,7 @@ public define String | ||
| 105 | char_field(choices,size) then "\"\"", | 105 | char_field(choices,size) then "\"\"", |
| 106 | password_field(min_size) then "\"\"", | 106 | password_field(min_size) then "\"\"", |
| 107 | text_field(_) then "\"\"", | 107 | text_field(_) then "\"\"", |
| 108 | - color_field then "#DDD", | 108 | + color_field then "\"#DDD\"", |
| 109 | }. | 109 | }. |
| 110 | 110 | ||
| 111 | 111 |
src/generation/files.anubis
| @@ -61,6 +61,7 @@ define Maybe(One) | @@ -61,6 +61,7 @@ define Maybe(One) | ||
| 61 | if generate_densaku_type(table, dest_dir, use_densaku) is { failure then failure, success(_) then | 61 | if generate_densaku_type(table, dest_dir, use_densaku) is { failure then failure, success(_) then |
| 62 | if generate_type(strm, table, use_densaku) is { failure then failure, success(_) then | 62 | if generate_type(strm, table, use_densaku) is { failure then failure, success(_) then |
| 63 | if generate_get_default(strm, table) is { failure then failure, success(_) then | 63 | if generate_get_default(strm, table) is { failure then failure, success(_) then |
| 64 | + if generate_columns_list(strm, table) is { failure then failure, success(_) then | ||
| 64 | if generate_extract_web_arg_to_type(strm, table) is { failure then failure, success(_) then | 65 | if generate_extract_web_arg_to_type(strm, table) is { failure then failure, success(_) then |
| 65 | if generate_extract_web_arg_to_update_field(strm, table) is { failure then failure, success(_) then | 66 | if generate_extract_web_arg_to_update_field(strm, table) is { failure then failure, success(_) then |
| 66 | if generate_extract_db_cursor_to_mb_type(strm, table) is { failure then failure, success(_) then | 67 | if generate_extract_db_cursor_to_mb_type(strm, table) is { failure then failure, success(_) then |
| @@ -77,7 +78,7 @@ define Maybe(One) | @@ -77,7 +78,7 @@ define Maybe(One) | ||
| 77 | if generate_choices_selector(strm, table) is { failure then failure, success(_) then | 78 | if generate_choices_selector(strm, table) is { failure then failure, success(_) then |
| 78 | if generate_VT_all_view(strm, table) is { failure then failure, success(_) then | 79 | if generate_VT_all_view(strm, table) is { failure then failure, success(_) then |
| 79 | if generate_VT_all_edit(strm, table) is { failure then failure, success(_) then | 80 | if generate_VT_all_edit(strm, table) is { failure then failure, success(_) then |
| 80 | - success(unique)}}}}}}}}}}}}}}}}}}}} | 81 | + success(unique)}}}}}}}}}}}}}}}}}}}}} |
| 81 | }. | 82 | }. |
| 82 | 83 | ||
| 83 | define One | 84 | define One |
src/generation/header.anubis
| @@ -62,9 +62,10 @@ read data_base/sqlite.anubis | @@ -62,9 +62,10 @@ read data_base/sqlite.anubis | ||
| 62 | read data_base/db_tools.anubis | 62 | read data_base/db_tools.anubis |
| 63 | read calexium_lib/database/db_utils.anubis | 63 | read calexium_lib/database/db_utils.anubis |
| 64 | read calexium_lib/database/db_types.anubis | 64 | read calexium_lib/database/db_types.anubis |
| 65 | -read hayamiki_lib/view/view_table_types.anubis | 65 | +read hayamiki_lib/view/types/hk_form.anubis |
| 66 | +read hayamiki_lib/view/types/hk_view.anubis | ||
| 66 | read hayamiki_lib/types/hayamiki.anubis | 67 | read hayamiki_lib/types/hayamiki.anubis |
| 67 | - | 68 | +read hayamiki_lib/controller/hk_sql_utils.anubis |
| 68 | read system/logger.anubis | 69 | read system/logger.anubis |
| 69 | read system/datetime.anubis | 70 | read system/datetime.anubis |
| 70 | read system/convert.anubis | 71 | read system/convert.anubis |
| @@ -72,7 +73,6 @@ read system/string.anubis | @@ -72,7 +73,6 @@ read system/string.anubis | ||
| 72 | 73 | ||
| 73 | read calexium_lib/net_services_protocols/logger_service.anubis | 74 | read calexium_lib/net_services_protocols/logger_service.anubis |
| 74 | read app/app_loggers.anubis | 75 | read app/app_loggers.anubis |
| 75 | - | ||
| 76 | ") is failure then failure else | 76 | ") is failure then failure else |
| 77 | foreign_table_header(stream, columns) | 77 | foreign_table_header(stream, columns) |
| 78 | . | 78 | . |
src/generation/types.anubis
| @@ -75,6 +75,7 @@ define List(String) | @@ -75,6 +75,7 @@ define List(String) | ||
| 75 | since h is hk_column(name, col_type, _, _), | 75 | since h is hk_column(name, col_type, _, _), |
| 76 | _generate_get_default(t, [ to_Anubis_default(col_type) . so_far]) | 76 | _generate_get_default(t, [ to_Anubis_default(col_type) . so_far]) |
| 77 | }. | 77 | }. |
| 78 | + | ||
| 78 | public define Maybe(One) | 79 | public define Maybe(One) |
| 79 | generate_get_default | 80 | generate_get_default |
| 80 | ( | 81 | ( |
| @@ -89,13 +90,32 @@ public define Maybe(One) | @@ -89,13 +90,32 @@ public define Maybe(One) | ||
| 89 | if write_string(stream, | 90 | if write_string(stream, |
| 90 | "\n\ndefine "+type_name+"\n get_default_"+name+" =\n "+name+"("+ //head of the definition | 91 | "\n\ndefine "+type_name+"\n get_default_"+name+" =\n "+name+"("+ //head of the definition |
| 91 | join(", ",_generate_get_default(columns, []))+ //all components of the type | 92 | join(", ",_generate_get_default(columns, []))+ //all components of the type |
| 92 | - ").\n") is //end of the function | 93 | + ").\n\n") is //end of the function |
| 93 | { | 94 | { |
| 94 | failure then println("can't write get_default "+type_name); failure, | 95 | failure then println("can't write get_default "+type_name); failure, |
| 95 | success(_) then success(unique) | 96 | success(_) then success(unique) |
| 96 | }. | 97 | }. |
| 97 | 98 | ||
| 98 | 99 | ||
| 100 | +public define Maybe(One) | ||
| 101 | + generate_columns_list | ||
| 102 | + ( | ||
| 103 | + Stream stream, | ||
| 104 | + HK_Table table | ||
| 105 | + )= | ||
| 106 | + since table is hk_table(name, short_name, model, _), | ||
| 107 | + since model is hk_model(columns, show_string), | ||
| 108 | + with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | ||
| 109 | + | ||
| 110 | + //generate the type of the table that contain all components | ||
| 111 | + if write_string(stream, | ||
| 112 | + "\n\ndefine List(String)\n "+name+"_columns =\n ["+ //head of the definition | ||
| 113 | + join(",\n ",enclose("\"", to_List_String(columns, false)))+ //all columns name wihtout id | ||
| 114 | + " ].\n\n") is //end of the list | ||
| 115 | + { | ||
| 116 | + failure then println("can't write generate_columns_list "+type_name); failure, | ||
| 117 | + success(_) then success(unique) | ||
| 118 | + }. | ||
| 99 | 119 | ||
| 100 | 120 | ||
| 101 | 121 | ||
| @@ -351,9 +371,12 @@ public define Maybe(One) | @@ -351,9 +371,12 @@ public define Maybe(One) | ||
| 351 | " get_selector_"+name+"\n"+ | 371 | " get_selector_"+name+"\n"+ |
| 352 | " (\n"+ | 372 | " (\n"+ |
| 353 | " SQLite3DataBase db,\n"+ | 373 | " SQLite3DataBase db,\n"+ |
| 354 | - " String clause\n"+ | 374 | + " HK_Referer referer,\n"+ |
| 375 | + " String filter\n"+ | ||
| 355 | " )=\n"+ | 376 | " )=\n"+ |
| 356 | - " _get_selector_"+name+"(db, get_all_"+name+"_by_clause_to_list_type(db, clause), [])." | 377 | + " with clause = referer_to_sql_clause(referer, \""+name+"\", "+name+"_columns),\n\n"+ |
| 378 | + " with _and_ = if length(clause) > 0 & length(filter) > 0 then \" AND \" else \"\",\n"+ | ||
| 379 | + " _get_selector_"+name+"(db, get_all_"+name+"_by_clause_to_list_type(db, clause+_and_+filter), [])." | ||
| 357 | ) is //end of the function | 380 | ) is //end of the function |
| 358 | { | 381 | { |
| 359 | failure then println("can't write generate_show_string "+type_name); failure, | 382 | failure then println("can't write generate_show_string "+type_name); failure, |
src/generation/vt_edit.anubis
| @@ -15,7 +15,7 @@ read columns.anubis | @@ -15,7 +15,7 @@ read columns.anubis | ||
| 15 | read html.anubis | 15 | read html.anubis |
| 16 | 16 | ||
| 17 | define String | 17 | define String |
| 18 | - edit_tab_entries | 18 | + hk_form_tab_entries |
| 19 | ( | 19 | ( |
| 20 | List(HK_FK_View) fk_views, | 20 | List(HK_FK_View) fk_views, |
| 21 | String indent | 21 | String indent |
| @@ -24,7 +24,7 @@ define String | @@ -24,7 +24,7 @@ define String | ||
| 24 | map((HK_FK_View fk_view) | 24 | map((HK_FK_View fk_view) |
| 25 | |-> | 25 | |-> |
| 26 | since fk_view is fk_view(app_name, fk_table_name, fk_col), | 26 | since fk_view is fk_view(app_name, fk_table_name, fk_col), |
| 27 | - indent+" hk_v_edit_tab(\""+fk_table_name+"\", \""+fk_col+"\", \"default\")" | 27 | + indent+" hk_form_tab(\""+fk_table_name+"\", \""+fk_col+"\", \"default\")" |
| 28 | , | 28 | , |
| 29 | fk_views) | 29 | fk_views) |
| 30 | ) | 30 | ) |
| @@ -47,45 +47,48 @@ public define Maybe(One) | @@ -47,45 +47,48 @@ public define Maybe(One) | ||
| 47 | with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type. | 47 | 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 | 48 | with view_name = if edit_view is |
| 49 | { | 49 | { |
| 50 | - edit_view_all then "default", | ||
| 51 | - edit_view(v_name, _, _) then v_name | 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 | ||
| 52 | }, | 53 | }, |
| 53 | with current_edit_view = if edit_view is | 54 | with current_edit_view = if edit_view is |
| 54 | { | 55 | { |
| 55 | edit_view_all then columns, | 56 | edit_view_all then columns, |
| 56 | - edit_view(v_name, cols, _) then | 57 | + edit_view_list_form(v_name, cols, _) then |
| 57 | if get_HK_Model_Column_list_from_name_list(columns, cols) is | 58 | if get_HK_Model_Column_list_from_name_list(columns, cols) is |
| 58 | { | 59 | { |
| 59 | failure then println("generate_VT_edit: can't get all specified columns for table \""+table_name+"\" view name \""+v_name+"\" cols["+join(", ",cols)+"]");[], | 60 | failure then println("generate_VT_edit: can't get all specified columns for table \""+table_name+"\" view name \""+v_name+"\" cols["+join(", ",cols)+"]");[], |
| 60 | success(got_columns) then got_columns, | 61 | success(got_columns) then got_columns, |
| 61 | } | 62 | } |
| 63 | + edit_view_table_form(_,_) then todo "handle case 'edit_view_table_form'" | ||
| 62 | }, | 64 | }, |
| 63 | with current_fk_views = if edit_view is | 65 | with current_fk_views = if edit_view is |
| 64 | { | 66 | { |
| 65 | - edit_view_all then [], | ||
| 66 | - edit_view(_, _, lfk) then lfk | 67 | + edit_view_all then [], |
| 68 | + edit_view_list_form(_, _, lfk) then lfk, | ||
| 69 | + edit_view_table_form(_,_) then [] | ||
| 67 | }, | 70 | }, |
| 68 | 71 | ||
| 69 | //generate the type of the table that contain all components | 72 | //generate the type of the table that contain all components |
| 70 | if write_string(stream, | 73 | if write_string(stream, |
| 71 | "\n\n"+ | 74 | "\n\n"+ |
| 72 | //SQL query | 75 | //SQL query |
| 73 | - "define VT_edit\n"+ | 76 | + "define HK_Form\n"+ |
| 74 | " _get_editable_"+table_name+"_"+view_name+"\n"+ | 77 | " _get_editable_"+table_name+"_"+view_name+"\n"+ |
| 75 | " (\n"+ | 78 | " (\n"+ |
| 76 | " "+type_name+" "+table_name+",\n"+ | 79 | " "+type_name+" "+table_name+",\n"+ |
| 77 | " SQLite3DataBase db\n"+ | 80 | " SQLite3DataBase db\n"+ |
| 78 | " )=\n"+ | 81 | " )=\n"+ |
| 79 | - " with edit_entries = (List(VT_edit_entry))\n"+ | 82 | + " with edit_entries = (List(HK_Form_Entry))\n"+ |
| 80 | " [\n"+ | 83 | " [\n"+ |
| 81 | " hidden(\"id\", to_String("+table_name+".id)),\n"+ | 84 | " hidden(\"id\", to_String("+table_name+".id)),\n"+ |
| 82 | edit_entries(current_edit_view, table_name, " ", [])+"\n"+ | 85 | edit_entries(current_edit_view, table_name, " ", [])+"\n"+ |
| 83 | " ],\n"+ | 86 | " ],\n"+ |
| 84 | - " with fk_view_entries = (List(HK_V_Edit_Tab))\n"+ | 87 | + " with fk_view_entries = (List(HK_Form_Tab))\n"+ |
| 85 | " [\n"+ | 88 | " [\n"+ |
| 86 | - edit_tab_entries(current_fk_views, " ")+"\n"+ | 89 | + hk_form_tab_entries(current_fk_views, " ")+"\n"+ |
| 87 | " ],\n"+ | 90 | " ],\n"+ |
| 88 | - " vt_edit(\""+table_name+"\", \""+view_name+"\", edit_entries, fk_view_entries).\n\n" | 91 | + " hk_form_in_list(\""+table_name+"\", \""+view_name+"\", edit_entries, fk_view_entries).\n\n" |
| 89 | ) is //end of the function | 92 | ) is //end of the function |
| 90 | { | 93 | { |
| 91 | failure then println("can't write generate_VT_view "+type_name); failure, | 94 | failure then println("can't write generate_VT_view "+type_name); failure, |
| @@ -122,7 +125,10 @@ public define Maybe(One) | @@ -122,7 +125,10 @@ public define Maybe(One) | ||
| 122 | if view is | 125 | if view is |
| 123 | { | 126 | { |
| 124 | edit_view_all then true, //list_view_all is default view | 127 | edit_view_all then true, //list_view_all is default view |
| 125 | - edit_view(view_name, _, _) then | 128 | + edit_view_list_form(view_name, _, _) then |
| 129 | + //if not we search for view named 'default' | ||
| 130 | + if view_name = "default" then true else false | ||
| 131 | + edit_view_table_form(view_name, _) then | ||
| 126 | //if not we search for view named 'default' | 132 | //if not we search for view named 'default' |
| 127 | if view_name = "default" then true else false | 133 | if view_name = "default" then true else false |
| 128 | }, | 134 | }, |
| @@ -149,8 +155,9 @@ public define String | @@ -149,8 +155,9 @@ public define String | ||
| 149 | [view . t] then | 155 | [view . t] then |
| 150 | with view_name = if view is | 156 | with view_name = if view is |
| 151 | { | 157 | { |
| 152 | - edit_view_all then "default", | ||
| 153 | - edit_view(view_name, _, _) then view_name | 158 | + edit_view_all then "default", |
| 159 | + edit_view_list_form(view_name, _, _) then view_name | ||
| 160 | + edit_view_table_form(view_name, _) then view_name | ||
| 154 | }, | 161 | }, |
| 155 | _generate_get_editable_if_else( table_name, t, | 162 | _generate_get_editable_if_else( table_name, t, |
| 156 | so_far + | 163 | so_far + |
| @@ -172,11 +179,11 @@ public define Maybe(One) | @@ -172,11 +179,11 @@ public define Maybe(One) | ||
| 172 | )= | 179 | )= |
| 173 | since table is hk_table(table_name, short_name, model, display), | 180 | since table is hk_table(table_name, short_name, model, display), |
| 174 | if write_string(stream, | 181 | if write_string(stream, |
| 175 | - "public define VT_edit\n"+ | 182 | + "public define HK_Form\n"+ |
| 176 | " get_editable_"+table_name+"\n"+ | 183 | " get_editable_"+table_name+"\n"+ |
| 177 | " (\n"+ | 184 | " (\n"+ |
| 178 | " SQLite3DataBase db,\n"+ | 185 | " SQLite3DataBase db,\n"+ |
| 179 | - " VT_action action,\n"+ | 186 | + " HK_Form_action action,\n"+ |
| 180 | " String editor_view\n"+ | 187 | " String editor_view\n"+ |
| 181 | " )=\n"+ | 188 | " )=\n"+ |
| 182 | " with "+table_name+" = if action is\n"+ | 189 | " with "+table_name+" = if action is\n"+ |
src/generation/vt_view.anubis
| @@ -48,7 +48,7 @@ define String | @@ -48,7 +48,7 @@ define String | ||
| 48 | date_field(attrs) then "date(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", | 48 | date_field(attrs) then "date(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", |
| 49 | time_field(attrs) then "time(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", | 49 | time_field(attrs) then "time(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", |
| 50 | datetime_field(attrs) then "datetime(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", | 50 | datetime_field(attrs) then "datetime(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", |
| 51 | - foreign_key(app,foreign_table) then "foreign_text(\""+to_upper(name)+"\", \""+name+"\", vt_edit_selector(get_selector_"+foreign_table+"), "+to_Anubis_source(help)+")", | 51 | + foreign_key(app,foreign_table) then "foreign_text(\""+to_upper(name)+"\", \""+name+"\", hk_form_selector(get_selector_"+foreign_table+"), "+to_Anubis_source(help)+")", |
| 52 | integer_field(choices) then | 52 | integer_field(choices) then |
| 53 | if choices is | 53 | if choices is |
| 54 | { | 54 | { |
| @@ -56,7 +56,7 @@ define String | @@ -56,7 +56,7 @@ define String | ||
| 56 | int_choices(choices_list) then | 56 | int_choices(choices_list) then |
| 57 | //if choice list is NOT empty we construct the possible choices selector | 57 | //if choice list is NOT empty we construct the possible choices selector |
| 58 | if length(choices_list) > 0 then | 58 | if length(choices_list) > 0 then |
| 59 | - "choices_int(\""+to_upper(name)+"\", \""+name+"\", vt_edit_selector(get_choices_selector_"+to_lower(type_name)+"_"+name+"), "+to_Anubis_source(help)+")" | 59 | + "choices_int(\""+to_upper(name)+"\", \""+name+"\", hk_form_selector(get_choices_selector_"+to_lower(type_name)+"_"+name+"), "+to_Anubis_source(help)+")" |
| 60 | else | 60 | else |
| 61 | "integer(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", | 61 | "integer(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", |
| 62 | } | 62 | } |
| @@ -70,7 +70,7 @@ define String | @@ -70,7 +70,7 @@ define String | ||
| 70 | text_choices(choices_list) then | 70 | text_choices(choices_list) then |
| 71 | //if choice list is NOT empty we construct the possible choices selector | 71 | //if choice list is NOT empty we construct the possible choices selector |
| 72 | if length(choices_list) > 0 then | 72 | if length(choices_list) > 0 then |
| 73 | - "choices_text(\""+to_upper(name)+"\", \""+name+"\", vt_edit_selector(get_choices_selector_"+to_lower(type_name)+"_"+name+"), "+to_Anubis_source(help)+")" | 73 | + "choices_text(\""+to_upper(name)+"\", \""+name+"\", hk_form_selector(get_choices_selector_"+to_lower(type_name)+"_"+name+"), "+to_Anubis_source(help)+")" |
| 74 | else | 74 | else |
| 75 | "text(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")" | 75 | "text(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")" |
| 76 | } | 76 | } |
src/model.3.0.0.anubis
| @@ -103,7 +103,7 @@ public define HK_Table production_mass_storage_table = | @@ -103,7 +103,7 @@ public define HK_Table production_mass_storage_table = | ||
| 103 | list_view("current",["model_id", "serial", "status", "date_created"]) | 103 | list_view("current",["model_id", "serial", "status", "date_created"]) |
| 104 | ], | 104 | ], |
| 105 | //list_edit | 105 | //list_edit |
| 106 | - [ edit_view("default", ["purchase_id", "model_id", "serial", "status", "comments"])] | 106 | + [ edit_view_list_form("default", ["purchase_id", "model_id", "serial", "status", "comments"])] |
| 107 | ) | 107 | ) |
| 108 | ). | 108 | ). |
| 109 | 109 | ||
| @@ -367,7 +367,7 @@ public define HK_Table production_products_table = | @@ -367,7 +367,7 @@ public define HK_Table production_products_table = | ||
| 367 | list_view("default", ["production_id", "date", "serial", "motherboard_id", "app_id", "status"]) | 367 | list_view("default", ["production_id", "date", "serial", "motherboard_id", "app_id", "status"]) |
| 368 | ], | 368 | ], |
| 369 | //list_edit | 369 | //list_edit |
| 370 | - [ edit_view("default", [ "production_id", "produced", "date", "serial", "security_code", "motherboard_id", "storage_id", "memory_id", "power_supply_id", "wifi", "mac", | 370 | + [ edit_view_list_form("default", [ "production_id", "produced", "date", "serial", "security_code", "motherboard_id", "storage_id", "memory_id", "power_supply_id", "wifi", "mac", |
| 371 | "app_id", "os_version", "published", "publish_date", "status", "date_created", "last_modified", "comments"])] | 371 | "app_id", "os_version", "published", "publish_date", "status", "date_created", "last_modified", "comments"])] |
| 372 | ) | 372 | ) |
| 373 | ). | 373 | ). |
| @@ -401,7 +401,7 @@ public define HK_Table production_production_table = | @@ -401,7 +401,7 @@ public define HK_Table production_production_table = | ||
| 401 | list_view("default", ["date", "type_ref_id", "sticker_tpl_id", "product_ref_id", "site_id", "product_count", "produced_count"]) | 401 | list_view("default", ["date", "type_ref_id", "sticker_tpl_id", "product_ref_id", "site_id", "product_count", "produced_count"]) |
| 402 | ], | 402 | ], |
| 403 | //list_edit | 403 | //list_edit |
| 404 | - [ edit_view("default", [ "date", "assembler_id", "type_ref_id", "product_ref_id", "site_id", "serial_prefix_id", "sticker_tpl_id", "starting_index", "product_count", "produced_count", "completed", | 404 | + [ edit_view_list_form("default", [ "date", "assembler_id", "type_ref_id", "product_ref_id", "site_id", "serial_prefix_id", "sticker_tpl_id", "starting_index", "product_count", "produced_count", "completed", |
| 405 | "active", "date_created", "last_modified", "comments"])] | 405 | "active", "date_created", "last_modified", "comments"])] |
| 406 | ) | 406 | ) |
| 407 | ). | 407 | ). |
| @@ -493,7 +493,7 @@ public define HK_Table production_type_number_table = | @@ -493,7 +493,7 @@ public define HK_Table production_type_number_table = | ||
| 493 | list_view("default", ["type_ref", "description"]) | 493 | list_view("default", ["type_ref", "description"]) |
| 494 | ], | 494 | ], |
| 495 | //list_edit | 495 | //list_edit |
| 496 | - [ edit_view("default", ["type_ref", "description", "comments"])] | 496 | + [ edit_view_list_form("default", ["type_ref", "description", "comments"])] |
| 497 | ) | 497 | ) |
| 498 | ). | 498 | ). |
| 499 | 499 | ||
| @@ -528,7 +528,7 @@ public define HK_Table production_supplier_table = | @@ -528,7 +528,7 @@ public define HK_Table production_supplier_table = | ||
| 528 | list_view("default", ["company", "phone", "mobile", "email"]) | 528 | list_view("default", ["company", "phone", "mobile", "email"]) |
| 529 | ], | 529 | ], |
| 530 | //list_edit | 530 | //list_edit |
| 531 | - [ edit_view("default", ["company", "contact_id", "address1", "address2", "zipcode", "city", "country", "email", "url", "phone", "fax", "mobile", | 531 | + [ edit_view_list_form("default", ["company", "contact_id", "address1", "address2", "zipcode", "city", "country", "email", "url", "phone", "fax", "mobile", |
| 532 | "siret", "tva_number", "date_created", "last_modified", "comments"])] | 532 | "siret", "tva_number", "date_created", "last_modified", "comments"])] |
| 533 | ) | 533 | ) |
| 534 | ). | 534 | ). |
| @@ -553,7 +553,7 @@ public define HK_Table department_table = | @@ -553,7 +553,7 @@ public define HK_Table department_table = | ||
| 553 | list_view("default", ["name"]) | 553 | list_view("default", ["name"]) |
| 554 | ], | 554 | ], |
| 555 | //list_edit | 555 | //list_edit |
| 556 | - [ edit_view("default", ["name", "description", "comments"])] | 556 | + [ edit_view_list_form("default", ["name", "description", "comments"])] |
| 557 | ) | 557 | ) |
| 558 | ). | 558 | ). |
| 559 | 559 | ||
| @@ -576,7 +576,16 @@ public define HK_Table role_table = | @@ -576,7 +576,16 @@ public define HK_Table role_table = | ||
| 576 | list_view("default", ["role_name"]) | 576 | list_view("default", ["role_name"]) |
| 577 | ], | 577 | ], |
| 578 | //list_edit | 578 | //list_edit |
| 579 | - [ edit_view("default", ["role_name", "description", "comments"])] | 579 | + [ edit_view_list_form("default", ["role_name", "description", "comments"]), |
| 580 | + edit_view_table_form("table", | ||
| 581 | + table([ | ||
| 582 | + line([label("role_name"), column("role_name")]), | ||
| 583 | + line([empty, column("description")]), | ||
| 584 | + line([label("comments"), column("comments")]), | ||
| 585 | + line([label("date_created"),column("date_created"),label("last_modified"),column("last_modified")]) | ||
| 586 | + ]) | ||
| 587 | + ) | ||
| 588 | + ] | ||
| 580 | ) | 589 | ) |
| 581 | ). | 590 | ). |
| 582 | 591 | ||
| @@ -606,7 +615,7 @@ public define HK_Table staff_table = | @@ -606,7 +615,7 @@ public define HK_Table staff_table = | ||
| 606 | 615 | ||
| 607 | ], | 616 | ], |
| 608 | //list_edit | 617 | //list_edit |
| 609 | - [ edit_view("default", ["contact_id", "department_id", "role_id", "email", "incoming_date", "outgoing_date", "still_present", "date_created", "last_modified", "comments"])] | 618 | + [ edit_view_list_form("default", ["contact_id", "department_id", "role_id", "email", "incoming_date", "outgoing_date", "still_present", "date_created", "last_modified", "comments"])] |
| 610 | ) | 619 | ) |
| 611 | ). | 620 | ). |
| 612 | 621 | ||
| @@ -643,7 +652,7 @@ public define HK_Table address_book_contact_table = | @@ -643,7 +652,7 @@ public define HK_Table address_book_contact_table = | ||
| 643 | list_view("details", ["first_name", "last_name", "company", "url", "role", "phone", "mobile", "email", "address1", "address2", "zipcode", "city", "country"]) | 652 | list_view("details", ["first_name", "last_name", "company", "url", "role", "phone", "mobile", "email", "address1", "address2", "zipcode", "city", "country"]) |
| 644 | ], | 653 | ], |
| 645 | //list_edit | 654 | //list_edit |
| 646 | - [ edit_view("default", ["first_name", "last_name", "company", "role", "address1", "address2", "zipcode", "city", "country", "email", "url", "phone", "fax", "mobile", "comments"])] | 655 | + [ edit_view_list_form("default", ["first_name", "last_name", "company", "role", "address1", "address2", "zipcode", "city", "country", "email", "url", "phone", "fax", "mobile", "comments"])] |
| 647 | ) | 656 | ) |
| 648 | ). | 657 | ). |
| 649 | 658 |