Commit e8311d8a297797824a7d1dd074f05c81aea7af55
1 parent
917dd665
Generate choices selector
Showing
5 changed files
with
41 additions
and
4 deletions
Show diff stats
calexium_lib @ 89e465d6f9d
hayamiki.aproj
| @@ -482,6 +482,7 @@ | @@ -482,6 +482,7 @@ | ||
| 482 | <Compile Include="library\xml\basic_xml_parser.anubis" /> | 482 | <Compile Include="library\xml\basic_xml_parser.anubis" /> |
| 483 | <Compile Include="library\xml\xml_parser.apg.anubis" /> | 483 | <Compile Include="library\xml\xml_parser.apg.anubis" /> |
| 484 | <Compile Include="src\check.anubis" /> | 484 | <Compile Include="src\check.anubis" /> |
| 485 | + <Compile Include="src\generation\choices_selector.anubis" /> | ||
| 485 | <Compile Include="src\generation\columns.anubis" /> | 486 | <Compile Include="src\generation\columns.anubis" /> |
| 486 | <Compile Include="src\generation\create_table.anubis" /> | 487 | <Compile Include="src\generation\create_table.anubis" /> |
| 487 | <Compile Include="src\generation\fields.anubis" /> | 488 | <Compile Include="src\generation\fields.anubis" /> |
src/generation/columns.anubis
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | read system/string.anubis | 9 | read system/string.anubis |
| 10 | +read tools/list.anubis | ||
| 10 | read hayamiki_lib/types/model/columns.anubis | 11 | read hayamiki_lib/types/model/columns.anubis |
| 11 | 12 | ||
| 12 | read fields.anubis | 13 | read fields.anubis |
| @@ -226,7 +227,17 @@ public define Maybe(String) | @@ -226,7 +227,17 @@ public define Maybe(String) | ||
| 226 | 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)+")"), | 227 | 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)+")"), |
| 227 | integer_field then success("integer(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), | 228 | integer_field then success("integer(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), |
| 228 | //TODO make choices selection if need | 229 | //TODO make choices selection if need |
| 229 | - char_field(choices,_) then success("text(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), | 230 | + char_field(choices,_) then |
| 231 | + if choices is | ||
| 232 | + { | ||
| 233 | + no_choice then success("text(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")"), | ||
| 234 | + text_choices(choices_list) then | ||
| 235 | + //if choice list is NOT empty we construct the possible choices selector | ||
| 236 | + if length(choices_list) > 0 then | ||
| 237 | + 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)+")") | ||
| 238 | + else | ||
| 239 | + success("text(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")") | ||
| 240 | + } | ||
| 230 | text_field then success("text_area(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")") | 241 | text_field then success("text_area(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")") |
| 231 | }. | 242 | }. |
| 232 | 243 |
src/generation/create_table.anubis
| @@ -3,7 +3,30 @@ | @@ -3,7 +3,30 @@ | ||
| 3 | * User: フランスのトトロ aka (David RENÉ) | 3 | * User: フランスのトトロ aka (David RENÉ) |
| 4 | * Date: 24/01/2016 | 4 | * Date: 24/01/2016 |
| 5 | * Time: 18:13 | 5 | * Time: 18:13 |
| 6 | - * © Calexium | 6 | + |
| 7 | +Hayamiki is Copyright © 2016 by Calexium | ||
| 8 | +All rights reserved. | ||
| 9 | + | ||
| 10 | +Redistribution and use in source and binary forms, with or without modification, | ||
| 11 | +are permitted provided that the following conditions are met: | ||
| 12 | + | ||
| 13 | +1. Redistributions of source code must retain the above copyright notice, | ||
| 14 | + this list of conditions and the following disclaimer. | ||
| 15 | + | ||
| 16 | +2. Redistributions in binary form must reproduce the above copyright notice, | ||
| 17 | + this list of conditions and the following disclaimer in the documentation | ||
| 18 | + and/or other materials provided with the distribution. | ||
| 19 | + | ||
| 20 | +THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, | ||
| 21 | +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | ||
| 22 | +AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
| 23 | +AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, | ||
| 24 | +OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 25 | +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 26 | +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 27 | +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 28 | +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 29 | +POSSIBILITY OF SUCH DAMAGE. | ||
| 7 | */ | 30 | */ |
| 8 | 31 | ||
| 9 | 32 |
src/generation/files.anubis
| @@ -20,6 +20,7 @@ read generation/types.anubis | @@ -20,6 +20,7 @@ read generation/types.anubis | ||
| 20 | read generation/create_table.anubis | 20 | read generation/create_table.anubis |
| 21 | read generation/menu.anubis | 21 | read generation/menu.anubis |
| 22 | read generation/fn_delete.anubis | 22 | read generation/fn_delete.anubis |
| 23 | +read generation/choices_selector.anubis | ||
| 23 | read check.anubis | 24 | read check.anubis |
| 24 | 25 | ||
| 25 | define Maybe(One) | 26 | define Maybe(One) |
| @@ -57,9 +58,10 @@ define Maybe(One) | @@ -57,9 +58,10 @@ define Maybe(One) | ||
| 57 | if generate_delete(strm, table) is { failure then failure, success(_) then | 58 | if generate_delete(strm, table) is { failure then failure, success(_) then |
| 58 | if generate_show_string(strm, table) is { failure then failure, success(_) then | 59 | if generate_show_string(strm, table) is { failure then failure, success(_) then |
| 59 | if generate_selector(strm, table) is { failure then failure, success(_) then | 60 | if generate_selector(strm, table) is { failure then failure, success(_) then |
| 61 | + if generate_choices_selector(strm, table) is { failure then failure, success(_) then | ||
| 60 | if generate_VT_all_view(strm, table) is { failure then failure, success(_) then | 62 | if generate_VT_all_view(strm, table) is { failure then failure, success(_) then |
| 61 | if generate_VT_edit(strm, table) is { failure then failure, success(_) then | 63 | if generate_VT_edit(strm, table) is { failure then failure, success(_) then |
| 62 | - success(unique)}}}}}}}}}}}}} | 64 | + success(unique)}}}}}}}}}}}}}} |
| 63 | }. | 65 | }. |
| 64 | 66 | ||
| 65 | define One | 67 | define One |