Commit 210cb395a1ecef6aaf5c27f7ab054f0d6f444676
1 parent
e8311d8a
forgotten file
Showing
1 changed file
with
70 additions
and
0 deletions
Show diff stats
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: フランスのトトロ aka (David RENÉ) | |
| 4 | + * Date: 06/04/2016 | |
| 5 | + * Time: 22:54 | |
| 6 | + * © Calexium | |
| 7 | + */ | |
| 8 | + | |
| 9 | +read hayamiki_lib/types/hayamiki.anubis | |
| 10 | +read tools/basis.anubis | |
| 11 | +read tools/streams.anubis | |
| 12 | +read system/string.anubis | |
| 13 | +read fields.anubis | |
| 14 | +read columns.anubis | |
| 15 | +read html.anubis | |
| 16 | + | |
| 17 | +define Maybe(One) | |
| 18 | + _generate_choices_selector | |
| 19 | + ( | |
| 20 | + Stream stream, | |
| 21 | + String table_name, | |
| 22 | + String column_name, | |
| 23 | + List(HK_Text_Choice) choices | |
| 24 | + )= | |
| 25 | + //generate the type of the table that contain all components | |
| 26 | + if write_string(stream, | |
| 27 | + "\n\n"+ | |
| 28 | + "public define List((List(CoreAttrs), WebArgValue, String))\n"+ | |
| 29 | + " get_choices_selector_"+table_name+"_"+column_name+"\n"+ | |
| 30 | + " (\n"+ | |
| 31 | + " SQLite3DataBase db,\n"+ | |
| 32 | + " )=\n"+ | |
| 33 | + " [\n"+ | |
| 34 | + concat(map((HK_Text_Choice hk_txt_choice) |-> | |
| 35 | + since hk_txt_choice is hk_text_choice(value, visible), | |
| 36 | + " ([], wav(\""+value+"\"), \""+visible+"\"),\n", choices))+ | |
| 37 | + " ]." | |
| 38 | + ) is //end of the function | |
| 39 | + { | |
| 40 | + failure then println("can't write generate_choices_selector_"+table_name+"_"+column_name); failure, | |
| 41 | + success(_) then success(unique) | |
| 42 | + }. | |
| 43 | + . | |
| 44 | + | |
| 45 | +public define Maybe(One) | |
| 46 | + generate_choices_selector | |
| 47 | + ( | |
| 48 | + Stream stream, | |
| 49 | + HK_Table table | |
| 50 | + )= | |
| 51 | + since table is hk_table(table_name, short_name, model, _), | |
| 52 | + since model is hk_model( columns, show_string), | |
| 53 | + | |
| 54 | + map_forget((HK_Model_Column column) |-> | |
| 55 | + since column is hk_column(column_name, field_type, _, _), | |
| 56 | + if field_type is char_field(choices, _) then | |
| 57 | + if choices is | |
| 58 | + { | |
| 59 | + no_choice then success(unique), | |
| 60 | + text_choices(choices_list) then | |
| 61 | + _generate_choices_selector(stream, table_name, column_name, choices_list) | |
| 62 | + } | |
| 63 | + else | |
| 64 | + success(unique), columns); | |
| 65 | + success(unique). | |
| 66 | + | |
| 67 | + | |
| 68 | + with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. | |
| 69 | + | |
| 70 | + | ... | ... |