diff --git a/.gitignore b/.gitignore index e0dbe82..472f153 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ library/ db_model_manager.sc +ds_files/types/generated/ +labo/modal_interface_files/banner.jpg +labo/ diff --git a/calexium_lib b/calexium_lib index b3254dc..3c4d7fe 160000 --- a/calexium_lib +++ b/calexium_lib @@ -1 +1 @@ -Subproject commit b3254dcbe8651bb63cc91b71934155fd560bf621 +Subproject commit 3c4d7fe5a3ba86018c88dd912f464702088487e8 diff --git a/hayamiki_generator.aproj b/hayamiki_generator.aproj index c2f041b..4d1d9bc 100644 --- a/hayamiki_generator.aproj +++ b/hayamiki_generator.aproj @@ -128,6 +128,9 @@ + + + @@ -141,20 +144,19 @@ + - - - - + + @@ -163,10 +165,12 @@ + + - + diff --git a/hayamiki_lib b/hayamiki_lib index c0af45f..974c856 160000 --- a/hayamiki_lib +++ b/hayamiki_lib @@ -1 +1 @@ -Subproject commit c0af45f7cc7c251cbac2837e95cdb7bea2379d95 +Subproject commit 974c8566fd29876100e5d7ffcfa3031246273447 diff --git a/src/generation/columns.anubis b/src/generation/columns.anubis index 46b185a..8e4b497 100644 --- a/src/generation/columns.anubis +++ b/src/generation/columns.anubis @@ -163,8 +163,7 @@ public define Maybe(String) password_field(_) then success(name), text_field(_) then success(name), color_field then success(name), - phone_field then success(name), - mobile_field then success(name), + phone_field(attr) then success(name), url_field then success(name), email_field then success(name) }. @@ -288,8 +287,8 @@ public define Maybe(String) password_field(min_size) then success("password(\""+to_upper(col_name)+"\", \""+col_name+"\", "+to_Anubis_source(help)+")") 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)+")"), color_field then success("color(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), - phone_field then success("phone(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), - mobile_field then success("mobile_phone(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), + phone_field(ph_attr) then success("phone(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(ph_attr)+", "+to_Anubis_source(help)+")"), +// mobile_field then success("mobile_phone(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), url_field then success("url(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), email_field then success("email(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"), }. @@ -342,8 +341,7 @@ public define String password_field(_) then current_type_name+"."+name, text_field(_) then current_type_name+"."+name, color_field then current_type_name+"."+name, - phone_field then current_type_name+"."+name, - mobile_field then current_type_name+"."+name, + phone_field(_) then current_type_name+"."+name, url_field then current_type_name+"."+name, email_field then current_type_name+"."+name }. diff --git a/src/generation/create_table.anubis b/src/generation/create_table.anubis index c1f7bf5..f93cf79 100644 --- a/src/generation/create_table.anubis +++ b/src/generation/create_table.anubis @@ -87,9 +87,10 @@ define String )= since constraint is unique(_name, columns, _on_conflict), with name = if _name = "" then "" else "CONSTRAINT "+_name+" ", - indent+name+"UNIQUE ("+ + ",\n"+ + indent+name+"UNIQUE (\n"+ indent+indent+join(",\n"+indent+indent, columns)+"\n"+ - indent+")"+ + indent+")\n"+ indent+"ON CONFLICT "+to_String(_on_conflict) . diff --git a/src/generation/extractor.anubis b/src/generation/extractor.anubis index ff275c5..ba267d9 100644 --- a/src/generation/extractor.anubis +++ b/src/generation/extractor.anubis @@ -32,8 +32,8 @@ public define String password_field(_) then "text"+cursor_index, text_field(_) then "text"+cursor_index, color_field then "text"+cursor_index, - phone_field then "text"+cursor_index, - mobile_field then "text"+cursor_index, + phone_field(_) then "text"+cursor_index, +// mobile_field then "text"+cursor_index, url_field then "text"+cursor_index, email_field then "text"+cursor_index }. @@ -160,6 +160,7 @@ public define String String indent )= indent+join("\n"+indent+"else ", to_get_extractor_line_json_member(columns, cursor_name, [], 0))+ + "\n"+indent+"else if component_name =\"__HK_SHOW_STRING__\" then ((Int -> SQLite3Datum) cursor) |-> json_member(\"__HK_SHOW_STRING__\", json_string(get_"+constructor_name+"_show_string(db, db_id((Int)db_integer(cursor)(0)))))"+ "\n"+indent+"else ((Int -> SQLite3Datum) cursor) |-> json_member(component_name, json_null)". diff --git a/src/generation/fields.anubis b/src/generation/fields.anubis index 1c30394..86a009e 100644 --- a/src/generation/fields.anubis +++ b/src/generation/fields.anubis @@ -37,8 +37,7 @@ public define String password_field(_) then "String", text_field(_) then "String", color_field then "String", - phone_field then "String", - mobile_field then "String", + phone_field(_) then "String", url_field then "String", email_field then "String" }. @@ -64,8 +63,7 @@ public define String password_field(_) then "string", text_field(_) then "string", color_field then "string", - phone_field then "string", - mobile_field then "String", + phone_field(_) then "string", url_field then "String", email_field then "string" }. @@ -98,8 +96,8 @@ public define String password_field(size) then fill("VARCHAR("+size+")", 15) + format_attributes(attributes), text_field(_) then fill("TEXT", 15) + format_attributes(attributes), color_field then fill("VARCHAR(8)",15)+ format_attributes(attributes), - phone_field then fill("VARCHAR(20)", 15) + format_attributes(attributes), - mobile_field then fill("VARCHAR(20)", 15) + format_attributes(attributes), + phone_field(_) then fill("VARCHAR(20)", 15) + format_attributes(attributes), +// mobile_field then fill("VARCHAR(20)", 15) + format_attributes(attributes), url_field then fill("VARCHAR(2048)", 15) + format_attributes(attributes), email_field then fill("VARCHAR(254)", 15) + format_attributes(attributes), }. @@ -125,8 +123,8 @@ public define String password_field(min_size) then "\"\"", text_field(_) then "\"\"", color_field then "\"#DDD\"", - phone_field then "\"\"", - mobile_field then "\"\"", + phone_field(_) then "\"\"", +// mobile_field then "\"\"", url_field then "\"\"", email_field then "\"\"" }. @@ -170,8 +168,8 @@ public define String password_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")", text_field(_) then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")", color_field then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")", - phone_field then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")", - mobile_field then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")", + phone_field(_) then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")", +// mobile_field then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")", url_field then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")", email_field then "bind_String"+or_null+"(\":v_"+name+"\", "+type_name+"."+name+")", }. diff --git a/src/generation/html.anubis b/src/generation/html.anubis index 3f248b7..ea91749 100644 --- a/src/generation/html.anubis +++ b/src/generation/html.anubis @@ -107,8 +107,8 @@ public define String //to_HTML_cell_text(column, data_name, general_type_name), text_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name), color_field then to_HTML_cell_text(column, data_name, general_type_name), - phone_field then to_HTML_cell_text(column, data_name, general_type_name), - mobile_field then to_HTML_cell_text(column, data_name, general_type_name), + phone_field(_) then to_HTML_cell_text(column, data_name, general_type_name), +// mobile_field then to_HTML_cell_text(column, data_name, general_type_name), url_field then to_HTML_cell_text(column, data_name, general_type_name), email_field then to_HTML_cell_text(column, data_name, general_type_name) } diff --git a/src/generation/icons.anubis b/src/generation/icons.anubis index 66bc44d..e8fe7ea 100644 --- a/src/generation/icons.anubis +++ b/src/generation/icons.anubis @@ -35,8 +35,7 @@ public define String password_field(min_size) then icn16_question, text_field(_) then icn16_question, color_field then icn16_question, - phone_field then icn16_phone, - mobile_field then icn16_question, + phone_field(_) then icn16_phone, url_field then icn16_question, email_field then icn16_email }. diff --git a/src/generation/json.anubis b/src/generation/json.anubis index 5896bd3..bc22856 100644 --- a/src/generation/json.anubis +++ b/src/generation/json.anubis @@ -35,8 +35,8 @@ public define String password_field(_) then "to_JSON_String("+current_type_name+"."+name+")", text_field(_) then "to_JSON_String("+current_type_name+"."+name+")", color_field then "to_JSON_String("+current_type_name+"."+name+")", - phone_field then "to_JSON_String("+current_type_name+"."+name+")", - mobile_field then "to_JSON_String("+current_type_name+"."+name+")", + phone_field(_) then "to_JSON_String("+current_type_name+"."+name+")", +// mobile_field then "to_JSON_String("+current_type_name+"."+name+")", url_field then "to_JSON_String("+current_type_name+"."+name+")", email_field then "to_JSON_String("+current_type_name+"."+name+")", } @@ -69,8 +69,8 @@ public define String password_field(_) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", text_field(_) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", color_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", - phone_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", - mobile_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", + phone_field(_) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", +// mobile_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", url_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", email_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))", } @@ -103,8 +103,8 @@ public define String password_field(_) then "json_member(\""+name+"\", json_string(\"******\"))", text_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", color_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", - phone_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", - mobile_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", + phone_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", +// mobile_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", url_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))", email_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))" } diff --git a/src/generation/vt_view.anubis b/src/generation/vt_view.anubis index 70e3f8b..ad539ad 100644 --- a/src/generation/vt_view.anubis +++ b/src/generation/vt_view.anubis @@ -78,8 +78,8 @@ define String password_field(min_size) then "password(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", text_field(txt_attr) then "text_area(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", color_field then "color(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", - phone_field then "phone(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", - mobile_field then "mobile_phone(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", + phone_field(_) then "phone(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", +// mobile_field then "mobile_phone(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", url_field then "url(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")", email_field then "email(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")" diff --git a/src/generation/web_args.anubis b/src/generation/web_args.anubis index ec7578a..00c7d37 100644 --- a/src/generation/web_args.anubis +++ b/src/generation/web_args.anubis @@ -33,8 +33,8 @@ public define String password_field(min_size) then "get_Password(lwa, __prefix__+\""+name+"_1\", __prefix__+\""+name+"_2\")", text_field(_) then "get_String(lwa, __prefix__+\""+name+"\")", color_field then "get_String(lwa, __prefix__+\""+name+"\")", - phone_field then "get_String(lwa, __prefix__+\""+name+"\")", - mobile_field then "get_String(lwa, __prefix__+\""+name+"\")", + phone_field(_) then "get_String(lwa, __prefix__+\""+name+"\")", +// mobile_field then "get_String(lwa, __prefix__+\""+name+"\")", url_field then "get_String(lwa, __prefix__+\""+name+"\")", email_field then "get_String(lwa, __prefix__+\""+name+"\")" }. @@ -88,8 +88,8 @@ public define String password_field(min_size) then "if get_Password(lwa, __prefix__+\""+name+"_1\", __prefix__+\""+name+"_2\") is { failure then "+to_Anubis_default(col_type)+", success(pass) then pass},", text_field(_) then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),", color_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),", - phone_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),", - mobile_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),", + phone_field(_) then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),", +// mobile_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),", url_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+"),", email_field then "get_String(lwa, __prefix__+\""+name+"\", "+to_Anubis_default(col_type)+")," }. @@ -217,10 +217,10 @@ public define String "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }", color_field then "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }" - phone_field then - "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }" - mobile_field then + phone_field(_) then "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }" +// mobile_field then +// "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }" url_field then "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }" email_field then diff --git a/src/main.anubis b/src/main.anubis index 5a67015..b40b3ff 100644 --- a/src/main.anubis +++ b/src/main.anubis @@ -3,7 +3,7 @@ * * *Title* Interfacing, generating and controling a database with Anubis * - * *Copyright* Copyright © David René 2015-2016. + * *Copyright* Copyright © David René 2015-2017. * * * diff --git a/src/model.3.0.0.anubis b/src/model.3.0.0.anubis index af2a3f3..5b4bbf7 100644 --- a/src/model.3.0.0.anubis +++ b/src/model.3.0.0.anubis @@ -99,6 +99,9 @@ public define HK_Table production_products_table = hk_column("last_modified", datetime_field(auto_now), []), hk_column("comments", text_field, []) // whatever the user wants to keep ], + [ + unique("", ["serial", "security_code"], ignore) + ], "obj.serial" ), hk_display( @@ -246,19 +249,19 @@ public define HK_Table production_supplier_table = hk_column("contact_id", foreign_key(none, "address_book_contact", []), []), hk_column("address1", char_field(100), []), hk_column("address2", char_field(100), []), - hk_column("zipcode", char_field(10), []), - hk_column("city", char_field(50), []), - hk_column("country", char_field(50), []), + hk_column("zipcode", char_field(10), []), + hk_column("city", char_field(50), []), + hk_column("country", char_field(50), []), hk_column("email", email_field, []), - hk_column("url", char_field(200), []), - hk_column("phone", phone_field, []), - hk_column("fax", char_field(20), []), - hk_column("mobile", phone_field, []), - hk_column("siret", char_field(50), []), - hk_column("tva_number", char_field(50), []), + hk_column("url", url_field, []), + hk_column("phone", phone_field(generic), []), + hk_column("fax", char_field(20), []), + hk_column("mobile", phone_field(cellphone), []), + hk_column("siret", char_field(50), []), + hk_column("tva_number", char_field(50), []), hk_column("date_created", datetime_field(auto_now_add), []), hk_column("last_modified", datetime_field(auto_now), []), - hk_column("comments", text_field, []) // whatever the user wants to keep + hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.company" ), @@ -366,32 +369,32 @@ public define HK_Table address_book_contact_table = hk_model( [ - hk_column("first_name", char_field(50), []), - hk_column("last_name", char_field(50), []), + hk_column("first_name", char_field(50), []), + hk_column("last_name", char_field(50), []), hk_column("company", char_field(100), []), - hk_column("role", char_field(50), []), + hk_column("role", char_field(50), []), hk_column("address1", char_field(100), []), hk_column("address2", char_field(100), []), - hk_column("zipcode", char_field(10), []), - hk_column("city", char_field(50), []), - hk_column("country", char_field(50), []), + hk_column("zipcode", char_field(10), []), + hk_column("city", char_field(50), []), + hk_column("country", char_field(50), []), hk_column("email", email_field, []), - hk_column("url", char_field(200), []), - hk_column("phone", phone_field, []), - hk_column("fax", char_field(20), []), - hk_column("mobile", phone_field, []), - hk_column("date_created", datetime_field(auto_now_add), []), - hk_column("last_modified", datetime_field(auto_now), []), - hk_column("comments", text_field, []) // whatever the user wants to keep + hk_column("url", url_field, []), + hk_column("phone", phone_field(landline), []), + hk_column("fax", char_field(20), []), + hk_column("mobile", phone_field(cellphone), []), + hk_column("date_created", datetime_field(auto_now_add), []), + hk_column("last_modified", datetime_field(auto_now), []), + hk_column("comments", text_field, []) // whatever the user wants to keep ], "obj.first_name +\" \"+obj.last_name " ), hk_display( //list_view [ - list_view("short", ["first_name", "last_name", "company"]), - list_view("default", ["first_name", "last_name", "company", "phone", "mobile", "email"]), - list_view("details", ["first_name", "last_name", "company", "url", "role", "phone", "mobile", "email", "address1", "address2", "zipcode", "city", "country"]) + list_view("short", ["first_name", "last_name", "company"]), + list_view("default", ["first_name", "last_name", "company", "phone", "mobile", "email"]), + list_view("details", ["first_name", "last_name", "company", "url", "role", "phone", "mobile", "email", "address1", "address2", "zipcode", "city", "country"]) ], //list_edit [ edit_view_list_form("default", ["first_name", "last_name", "company", "role", "address1", "address2", "zipcode", "city", "country", "email", "url", "phone", "fax", "mobile", "comments"])] -- libgit2 0.21.4