Commit 93a3526ea45236af912bf543ed37ea1c136993ab

Authored by totoro
1 parent 463b9c3d

add phone and email field generation

calexium_lib @ 3a2758b69cc
1   -Subproject commit 45e29b302fac0def4330ce9654cfa2cecd9e69f2
  1 +Subproject commit 3a2758b69ccb9499f35eec40cc72b2cae14998fc
... ...
hayamiki_lib @ 5ef0dd2a124
1   -Subproject commit 95c6d5064c6062446d1d22c6b4cc3ad5a93f4df5
  1 +Subproject commit 5ef0dd2a124781ed0bec0c17b95f4a4d78ec7822
... ...
src/generation/columns.anubis
... ... @@ -153,6 +153,8 @@ public define Maybe(String)
153 153 password_field(_) then success(name),
154 154 text_field(_) then success(name),
155 155 color_field then success(name),
  156 + phone_field then success(name),
  157 + email_field then success(name)
156 158 }.
157 159  
158 160 public define List(String)
... ... @@ -270,6 +272,8 @@ public define Maybe(String)
270 272 password_field(min_size) then success("password(\""+to_upper(col_name)+"\", \""+col_name+"\", "+to_Anubis_source(help)+")")
271 273 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 274 color_field then success("color(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"),
  275 + phone_field then success("phone(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"),
  276 + email_field then success("email(\""+to_upper(col_name)+"\", \""+col_name+"\", "+type_name+"."+col_name+", "+to_Anubis_source(help)+")"),
273 277 }.
274 278  
275 279 public define String
... ... @@ -319,7 +323,9 @@ public define String
319 323 char_field(_,_) then current_type_name+"."+name,
320 324 password_field(_) then current_type_name+"."+name,
321 325 text_field(_) then current_type_name+"."+name
322   - color_field then current_type_name+"."+name
  326 + color_field then current_type_name+"."+name
  327 + phone_field then current_type_name+"."+name
  328 + email_field then current_type_name+"."+name
323 329 }.
324 330  
325 331  
... ...
src/generation/extractor.anubis
... ... @@ -31,7 +31,9 @@ public define String
31 31 char_field(_,_) then "text"+cursor_index,
32 32 password_field(_) then "text"+cursor_index,
33 33 text_field(_) then "text"+cursor_index,
34   - color_field then "text"+cursor_index
  34 + color_field then "text"+cursor_index,
  35 + phone_field then "text"+cursor_index,
  36 + email_field then "text"+cursor_index
35 37 }.
36 38  
37 39 define List(String)
... ...
src/generation/fields.anubis
... ... @@ -37,6 +37,8 @@ public define String
37 37 password_field(_) then "String",
38 38 text_field(_) then "String",
39 39 color_field then "String",
  40 + phone_field then "String",
  41 + email_field then "String"
40 42 }.
41 43  
42 44 public define String
... ... @@ -59,7 +61,9 @@ public define String
59 61 char_field(_,_) then "string",
60 62 password_field(_) then "string",
61 63 text_field(_) then "string",
62   - color_field then "string"
  64 + color_field then "string",
  65 + phone_field then "string"
  66 + email_field then "string"
63 67 }.
64 68  
65 69 public define String
... ... @@ -83,7 +87,9 @@ public define String
83 87 password_field(size) then fill("VARCHAR("+size+")", 15) + format_attributes(attributes),
84 88 text_field(_) then fill("TEXT", 15) + format_attributes(attributes),
85 89 color_field then fill("VARCHAR(8)",15)+ format_attributes(attributes),
86   - }.
  90 + phone_field then fill("VARCHAR(20)", 15) + format_attributes(attributes),
  91 + email_field then fill("VARCHAR(254)", 15) + format_attributes(attributes),
  92 +}.
87 93  
88 94 public define String
89 95 to_Anubis_default
... ... @@ -106,6 +112,8 @@ public define String
106 112 password_field(min_size) then "\"\"",
107 113 text_field(_) then "\"\"",
108 114 color_field then "\"#DDD\"",
  115 + phone_field then "\"\"",
  116 + email_field then "\"\""
109 117 }.
110 118  
111 119  
... ... @@ -144,5 +152,7 @@ public define String
144 152 char_field(_,_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",
145 153 password_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",
146 154 text_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",
147   - color_field then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",
  155 + color_field then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",
  156 + phone_field then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",
  157 + email_field then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",
148 158 }.
... ...
src/generation/html.anubis
... ... @@ -102,7 +102,9 @@ public define String
102 102 "text(\"********\")",
103 103 //to_HTML_cell_text(column, data_name, general_type_name),
104 104 text_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name),
105   - color_field then to_HTML_cell_text(column, data_name, general_type_name),
  105 + color_field then to_HTML_cell_text(column, data_name, general_type_name),
  106 + phone_field then to_HTML_cell_text(column, data_name, general_type_name),
  107 + email_field then to_HTML_cell_text(column, data_name, general_type_name)
106 108 }
107 109 }.
108 110  
... ...
src/generation/icons.anubis
... ... @@ -34,6 +34,8 @@ public define String
34 34 char_field(choice, size) then icn16_question,
35 35 password_field(min_size) then icn16_question,
36 36 text_field(_) then icn16_question,
37   - color_field then icn16_question
  37 + color_field then icn16_question,
  38 + phone_field then icn16_phone,
  39 + email_field then icn16_email
38 40 }.
39 41  
... ...
src/generation/json.anubis
... ... @@ -35,6 +35,8 @@ public define String
35 35 password_field(_) then "to_JSON_String("+current_type_name+"."+name+")",
36 36 text_field(_) then "to_JSON_String("+current_type_name+"."+name+")",
37 37 color_field then "to_JSON_String("+current_type_name+"."+name+")",
  38 + phone_field then "to_JSON_String("+current_type_name+"."+name+")",
  39 + email_field then "to_JSON_String("+current_type_name+"."+name+")",
38 40 }
39 41 .
40 42  
... ... @@ -64,7 +66,9 @@ public define String
64 66 char_field(_,_) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))",
65 67 password_field(_) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))",
66 68 text_field(_) then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))",
67   - color_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))"
  69 + color_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))",
  70 + phone_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))",
  71 + email_field then "json_member(\""+name+"\", json_string("+current_type_name+"."+name+"))",
68 72 }
69 73 .
70 74  
... ... @@ -89,7 +93,9 @@ public define String
89 93 float_field then "json_member(\""+name+"\", json_float(db_float"+cursor_index+",5))",
90 94 char_field(_,_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))",
91 95 password_field(_) then "json_member(\""+name+"\", json_string(\"******\"))",
92   - text_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))"
93   - color_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))"
  96 + text_field(_) then "json_member(\""+name+"\", json_string(text"+cursor_index+"))",
  97 + color_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))",
  98 + phone_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))",
  99 + email_field then "json_member(\""+name+"\", json_string(text"+cursor_index+"))"
94 100 }
95 101 .
... ...
src/generation/vt_view.anubis
... ... @@ -76,7 +76,10 @@ define String
76 76 }
77 77 password_field(min_size) then "password(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")",
78 78 text_field(txt_attr) then "text_area(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")",
79   - color_field then "color(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")"
  79 + color_field then "color(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")",
  80 + phone_field then "phone(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")",
  81 + email_field then "email(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")"
  82 +
80 83 }.
81 84  
82 85  
... ...
src/generation/web_args.anubis
... ... @@ -32,6 +32,8 @@ public define String
32 32 password_field(min_size) then "get_Password(lwa, __prefix__+\""+name+"_1\", __prefix__+\""+name+"_2\")",
33 33 text_field(_) then "get_String(lwa, __prefix__+\""+name+"\")",
34 34 color_field then "get_String(lwa, __prefix__+\""+name+"\")",
  35 + phone_field then "get_String(lwa, __prefix__+\""+name+"\")",
  36 + email_field then "get_String(lwa, __prefix__+\""+name+"\")"
35 37 }.
36 38  
37 39 define (List(String), Int)
... ... @@ -143,7 +145,10 @@ public define String
143 145 "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }",
144 146 color_field then
145 147 "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }"
146   - //"get_String(lwa, __prefix__+\""+name+"\")"
  148 + phone_field then
  149 + "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }"
  150 + email_field then
  151 + "if get_String(lwa, __prefix__+\""+name+"\") is {failure then [], success("+name+") then [field(\""+name+"\", bind_String(\":v_"+name+"\", "+name+"))] }"
147 152 }.
148 153  
149 154 define String
... ...
src/model.3.0.0.anubis
... ... @@ -509,11 +509,11 @@ public define HK_Table production_supplier_table =
509 509 hk_column("zipcode", char_field(10), []),
510 510 hk_column("city", char_field(50), []),
511 511 hk_column("country", char_field(50), []),
512   - hk_column("email", char_field(75), []),
  512 + hk_column("email", email_field, []),
513 513 hk_column("url", char_field(200), []),
514   - hk_column("phone", char_field(20), []),
  514 + hk_column("phone", phone_field, []),
515 515 hk_column("fax", char_field(20), []),
516   - hk_column("mobile", char_field(20), []),
  516 + hk_column("mobile", phone_field, []),
517 517 hk_column("siret", char_field(50), []),
518 518 hk_column("tva_number", char_field(50), []),
519 519 hk_column("date_created", datetime_field(auto_now_add), []),
... ... @@ -597,7 +597,7 @@ public define HK_Table staff_table =
597 597 hk_column("contact_id", foreign_key(none, "address_book_contact"), []),
598 598 hk_column("department_id", foreign_key("department"), []),
599 599 hk_column("role_id", foreign_key("role"), []),
600   - hk_column("email", char_field(75), []),
  600 + hk_column("email", email_field, []),
601 601 hk_column("incoming_date", date_field(none), []), //
602 602 hk_column("outgoing_date", date_field(none), [], help_text("if not still present in company. The date of official outgoing")), //
603 603 hk_column("still_present", boolean_field, [], help_text("Still working for the company")),
... ... @@ -633,11 +633,11 @@ public define HK_Table address_book_contact_table =
633 633 hk_column("zipcode", char_field(10), []),
634 634 hk_column("city", char_field(50), []),
635 635 hk_column("country", char_field(50), []),
636   - hk_column("email", char_field(75), []),
  636 + hk_column("email", email_field, []),
637 637 hk_column("url", char_field(200), []),
638   - hk_column("phone", char_field(20), []),
639   - hk_column("fax", char_field(20), []),
640   - hk_column("mobile", char_field(20), []),
  638 + hk_column("phone", phone_field, []),
  639 + hk_column("fax", char_field(20), []),
  640 + hk_column("mobile", phone_field, []),
641 641 hk_column("date_created", datetime_field(auto_now_add), []),
642 642 hk_column("last_modified", datetime_field(auto_now), []),
643 643 hk_column("comments", text_field, []) // whatever the user wants to keep
... ...