Commit 80c9c10d01f61d55c712a80296af34f9f3c2b870

Authored by totoro
1 parent a40e905e

Use the DB_id instead of Int for foreign key

Add attribute for used editor for text_field
calexium_lib @ 455f1bc5407
1 -Subproject commit 5b85c04ccb6f2723207bb2b0640de7ec64850665 1 +Subproject commit 455f1bc540754c023475efc76ab6394c9f8968cd
hayamiki_lib @ 99a54291b71
1 -Subproject commit 9ab9ecc773adfda2d84d6cd559b1fe7ef305880e 1 +Subproject commit 99a54291b71c079ff268a039c9c43cc17e093f36
src/generation/columns.anubis
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 read system/string.anubis 9 read system/string.anubis
10 read tools/list.anubis 10 read tools/list.anubis
11 read hayamiki_lib/types/model/columns.anubis 11 read hayamiki_lib/types/model/columns.anubis
  12 +read hayamiki_lib/types/model/fields.anubis
12 13
13 read fields.anubis 14 read fields.anubis
14 15
@@ -146,7 +147,7 @@ public define Maybe(String) @@ -146,7 +147,7 @@ public define Maybe(String)
146 integer_field(_) then success(name), 147 integer_field(_) then success(name),
147 char_field(_,_) then success(name), 148 char_field(_,_) then success(name),
148 password_field(_) then success(name), 149 password_field(_) then success(name),
149 - text_field then success(name) 150 + text_field(_) then success(name)
150 }. 151 }.
151 152
152 public define List(String) 153 public define List(String)
@@ -259,7 +260,7 @@ public define Maybe(String) @@ -259,7 +260,7 @@ public define Maybe(String)
259 success("text(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")") 260 success("text(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")")
260 } 261 }
261 password_field(min_size) then success("password(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")") 262 password_field(min_size) then success("password(\""+to_upper(name)+"\", \""+name+"\", "+to_Anubis_source(help)+")")
262 - text_field then success("text_area(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(help)+")") 263 + text_field(txt_attr) then success("text_area(\""+to_upper(name)+"\", \""+name+"\", "+type_name+"."+name+", "+to_Anubis_source(txt_attr)+", "+to_Anubis_source(help)+")")
263 }. 264 }.
264 265
265 public define String 266 public define String
@@ -330,5 +331,5 @@ public define String @@ -330,5 +331,5 @@ public define String
330 integer_field(_) then "to_String("+current_type_name+"."+name+")", 331 integer_field(_) then "to_String("+current_type_name+"."+name+")",
331 char_field(_,_) then current_type_name+"."+name, 332 char_field(_,_) then current_type_name+"."+name,
332 password_field(_) then current_type_name+"."+name, 333 password_field(_) then current_type_name+"."+name,
333 - text_field then current_type_name+"."+name 334 + text_field(_) then current_type_name+"."+name
334 }. 335 }.
src/generation/cxm_lib_menu.anubis
@@ -81,6 +81,7 @@ public define Maybe(One) @@ -81,6 +81,7 @@ public define Maybe(One)
81 * Time: "+_Int_to_ISO_8601_time(now)+" 81 * Time: "+_Int_to_ISO_8601_time(now)+"
82 */ 82 */
83 83
  84 +transmit calexium_lib/web/CXM_making_a_web_site.anubis
84 transmit calexium_lib/web/widgets/menu.anubis 85 transmit calexium_lib/web/widgets/menu.anubis
85 86
86 public define List(Menu_Item) 87 public define List(Menu_Item)
src/generation/fields.anubis
@@ -30,11 +30,11 @@ public define String @@ -30,11 +30,11 @@ public define String
30 date_field(_) then "DB_date", 30 date_field(_) then "DB_date",
31 time_field(_) then "DB_time", 31 time_field(_) then "DB_time",
32 datetime_field(_) then "DB_datetime", 32 datetime_field(_) then "DB_datetime",
33 - foreign_key(_,_) then "Int", 33 + foreign_key(_,_) then "DB_id",
34 integer_field(_) then "Int", 34 integer_field(_) then "Int",
35 char_field(_,_) then "String", 35 char_field(_,_) then "String",
36 password_field(_) then "String", 36 password_field(_) then "String",
37 - text_field then "String" 37 + text_field(_) then "String"
38 }. 38 }.
39 39
40 public define String 40 public define String
@@ -53,11 +53,11 @@ public define String @@ -53,11 +53,11 @@ public define String
53 date_field(_) then "extern_type(\"DB_date\", \"calexium_lib/database/db_types.anubis\")", 53 date_field(_) then "extern_type(\"DB_date\", \"calexium_lib/database/db_types.anubis\")",
54 time_field(_) then "extern_type(\"DB_time\", \"calexium_lib/database/db_types.anubis\")", 54 time_field(_) then "extern_type(\"DB_time\", \"calexium_lib/database/db_types.anubis\")",
55 datetime_field(_) then "extern_type(\"DB_datetime\", \"calexium_lib/database/db_types.anubis\")", 55 datetime_field(_) then "extern_type(\"DB_datetime\", \"calexium_lib/database/db_types.anubis\")",
56 - foreign_key(_,_) then "int", 56 + foreign_key(_,_) then "extern_type(\"DB_id\", \"calexium_lib/database/db_types.anubis\")",
57 integer_field(_) then "int", 57 integer_field(_) then "int",
58 char_field(_,_) then "string", 58 char_field(_,_) then "string",
59 password_field(_) then "string", 59 password_field(_) then "string",
60 - text_field then "string" 60 + text_field(_) then "string"
61 }. 61 }.
62 62
63 public define String 63 public define String
@@ -78,7 +78,7 @@ public define String @@ -78,7 +78,7 @@ public define String
78 integer_field(_) then fill("INTEGER", 15) +format_attributes(attributes), 78 integer_field(_) then fill("INTEGER", 15) +format_attributes(attributes),
79 char_field(_,size) then fill("VARCHAR("+size+")", 15) +format_attributes(attributes), 79 char_field(_,size) then fill("VARCHAR("+size+")", 15) +format_attributes(attributes),
80 password_field(_) then fill("TEXT", 15) +format_attributes(attributes), 80 password_field(_) then fill("TEXT", 15) +format_attributes(attributes),
81 - text_field then fill("TEXT", 15) +format_attributes(attributes), 81 + text_field(_) then fill("TEXT", 15) +format_attributes(attributes),
82 }. 82 }.
83 83
84 public define String 84 public define String
@@ -95,11 +95,11 @@ public define String @@ -95,11 +95,11 @@ public define String
95 date_field(_) then "db_date(\"\")", 95 date_field(_) then "db_date(\"\")",
96 time_field(_) then "db_time(\"\")", 96 time_field(_) then "db_time(\"\")",
97 datetime_field(_) then "db_datetime(\"\")", 97 datetime_field(_) then "db_datetime(\"\")",
98 - foreign_key(_,_) then "(Int)0", 98 + foreign_key(_,_) then "(DB_id)none",
99 integer_field(_) then "(Int)0", 99 integer_field(_) then "(Int)0",
100 char_field(choices,size) then "\"\"", 100 char_field(choices,size) then "\"\"",
101 password_field(min_size) then "\"\"", 101 password_field(min_size) then "\"\"",
102 - text_field then "\"\"" 102 + text_field(_) then "\"\""
103 }. 103 }.
104 104
105 public define String 105 public define String
@@ -117,11 +117,11 @@ public define String @@ -117,11 +117,11 @@ public define String
117 date_field(attrs) then if attrs = none then "get_DB_date(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_date,", 117 date_field(attrs) then if attrs = none then "get_DB_date(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_date,",
118 time_field(attrs) then if attrs = none then "get_DB_time(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_time,", 118 time_field(attrs) then if attrs = none then "get_DB_time(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_time,",
119 datetime_field(attrs) then if attrs = none then "get_DB_datetime(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_datetime,", 119 datetime_field(attrs) then if attrs = none then "get_DB_datetime(lwa, __prefix__+\""+name+"\")" else "with "+name+" = get_dummy_DB_datetime,",
120 - foreign_key(_,_) then "get_Int(lwa, __prefix__+\""+name+"\")", 120 + foreign_key(_,_) then "with "+name+" = get_DB_id(lwa, __prefix__+\""+name+"\"),",
121 integer_field(_) then "get_Int(lwa, __prefix__+\""+name+"\")", 121 integer_field(_) then "get_Int(lwa, __prefix__+\""+name+"\")",
122 char_field(_,_) then "get_String(lwa, __prefix__+\""+name+"\")", 122 char_field(_,_) then "get_String(lwa, __prefix__+\""+name+"\")",
123 password_field(min_size) then "get_String(lwa, __prefix__+\""+name+"_1\")", 123 password_field(min_size) then "get_String(lwa, __prefix__+\""+name+"_1\")",
124 - text_field then "get_String(lwa, __prefix__+\""+name+"\")" 124 + text_field(_) then "get_String(lwa, __prefix__+\""+name+"\")"
125 }. 125 }.
126 126
127 public define String 127 public define String
@@ -139,11 +139,11 @@ public define String @@ -139,11 +139,11 @@ public define String
139 date_field(_) then "db_date(text"+cursor_index+")", 139 date_field(_) then "db_date(text"+cursor_index+")",
140 time_field(_) then "db_time(text"+cursor_index+")", 140 time_field(_) then "db_time(text"+cursor_index+")",
141 datetime_field(_) then "db_datetime(text"+cursor_index+")", 141 datetime_field(_) then "db_datetime(text"+cursor_index+")",
142 - foreign_key(_,_) then "(Int)db_integer"+cursor_index, 142 + foreign_key(_,_) then "db_id((Int)db_integer"+cursor_index+")",
143 integer_field(_) then "(Int)db_integer"+cursor_index, 143 integer_field(_) then "(Int)db_integer"+cursor_index,
144 char_field(_,_) then "text"+cursor_index, 144 char_field(_,_) then "text"+cursor_index,
145 password_field(_) then "text"+cursor_index, 145 password_field(_) then "text"+cursor_index,
146 - text_field then "text"+cursor_index 146 + text_field(_) then "text"+cursor_index
147 }. 147 }.
148 148
149 public define String 149 public define String
@@ -172,9 +172,9 @@ public define String @@ -172,9 +172,9 @@ public define String
172 else 172 else
173 "" 173 ""
174 }, 174 },
175 - foreign_key(_,_) then "bind_Int(\":v_"+name+"\", "+type_name+"."+name+")", 175 + foreign_key(_,_) then "bind_DB_id_or_NULL(\":v_"+name+"\", "+type_name+"."+name+")",
176 integer_field(_) then "bind_Int(\":v_"+name+"\", "+type_name+"."+name+")", 176 integer_field(_) then "bind_Int(\":v_"+name+"\", "+type_name+"."+name+")",
177 char_field(_,_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")", 177 char_field(_,_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",
178 password_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")", 178 password_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")",
179 - text_field then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")" 179 + text_field(_) then "bind_String(\":v_"+name+"\", "+type_name+"."+name+")"
180 }. 180 }.
src/generation/html.anubis
@@ -96,7 +96,7 @@ public define String @@ -96,7 +96,7 @@ public define String
96 integer_field(choices) then to_HTML_cell_text(column, data_name, general_type_name), 96 integer_field(choices) then to_HTML_cell_text(column, data_name, general_type_name),
97 char_field(choices, size) then to_HTML_cell_text(column, data_name, general_type_name), 97 char_field(choices, size) then to_HTML_cell_text(column, data_name, general_type_name),
98 password_field(min_size) then to_HTML_cell_text(column, data_name, general_type_name), 98 password_field(min_size) then to_HTML_cell_text(column, data_name, general_type_name),
99 - text_field then to_HTML_cell_text(column, data_name, general_type_name), 99 + text_field(attrs) then to_HTML_cell_text(column, data_name, general_type_name),
100 } 100 }
101 }. 101 }.
102 102
src/generation/icons.anubis
@@ -32,6 +32,6 @@ public define String @@ -32,6 +32,6 @@ public define String
32 integer_field(choice) then icn16_question, 32 integer_field(choice) then icn16_question,
33 char_field(choice, size) then icn16_question, 33 char_field(choice, size) then icn16_question,
34 password_field(min_size) then icn16_question, 34 password_field(min_size) then icn16_question,
35 - text_field then icn16_question 35 + text_field(_) then icn16_question
36 }. 36 }.
37 37
src/generation/types.anubis
@@ -399,12 +399,17 @@ public define Maybe(One) @@ -399,12 +399,17 @@ public define Maybe(One)
399 " get_"+name+"_show_string\n"+ 399 " get_"+name+"_show_string\n"+
400 " (\n"+ 400 " (\n"+
401 " SQLite3DataBase db,\n"+ 401 " SQLite3DataBase db,\n"+
402 - " Int idx\n"+ 402 + " DB_id _idx\n"+
403 " )=\n"+ 403 " )=\n"+
404 - " if get_"+name+"(db, idx) is\n"+ 404 + " if _idx is \n"+
405 " {\n"+ 405 " {\n"+
406 - " failure then default_select,\n"+  
407 - " success(obj) then "+show_string+"\n"+ 406 + " none then default_select,\n"+
  407 + " db_id(idx) then \n"+
  408 + " if get_"+name+"(db, idx) is\n"+
  409 + " {\n"+
  410 + " failure then default_select,\n"+
  411 + " success(obj) then "+show_string+"\n"+
  412 + " }\n"+
408 " }." 413 " }."
409 ) is //end of the function 414 ) is //end of the function
410 { 415 {
@@ -434,12 +439,12 @@ public define Maybe(One) @@ -434,12 +439,12 @@ public define Maybe(One)
434 " )=\n"+ 439 " )=\n"+
435 " if list is\n"+ 440 " if list is\n"+
436 " {\n"+ 441 " {\n"+
437 - " [] then reverse(so_far),\n"+ 442 + " [] then [selector_default_entry . reverse(so_far)],\n"+
438 " [ h . t ] then \n"+ 443 " [ h . t ] then \n"+
439 " if h.id is \n"+ 444 " if h.id is \n"+
440 " {\n"+ 445 " {\n"+
441 - " none then [],\n"+  
442 - " db_id(id) then _get_selector_"+name+"(db, t, [([], wav(to_String(id)), get_"+name+"_show_string(db, id)) . so_far])\n"+ 446 + " none then [selector_default_entry],\n"+
  447 + " db_id(_id) then _get_selector_"+name+"(db, t, [([], wav(to_String(_id)), get_"+name+"_show_string(db, h.id)) . so_far])\n"+
443 " }\n"+ 448 " }\n"+
444 " }.\n\n"+ 449 " }.\n\n"+
445 "public define List((List(CoreAttrs), WebArgValue, String))\n"+ 450 "public define List((List(CoreAttrs), WebArgValue, String))\n"+
src/model.3.0.0.anubis
@@ -270,7 +270,7 @@ public define HK_Table production_power_supply_table = @@ -270,7 +270,7 @@ public define HK_Table production_power_supply_table =
270 hk_column("status", char_field(10), []), // 270 hk_column("status", char_field(10), []), //
271 hk_column("date_created", datetime_field(auto_now_add), []), 271 hk_column("date_created", datetime_field(auto_now_add), []),
272 hk_column("last_modified", datetime_field(auto_now), []), 272 hk_column("last_modified", datetime_field(auto_now), []),
273 - hk_column("comments", text_field, []) // whatever the user wants to keep 273 + hk_column("comments", text_field(rich_editor), []) // whatever the user wants to keep
274 ], 274 ],
275 "obj.serial" 275 "obj.serial"
276 ), 276 ),