diff --git a/calexium_lib b/calexium_lib index 204b008..6cf67b0 160000 --- a/calexium_lib +++ b/calexium_lib @@ -1 +1 @@ -Subproject commit 204b008703703918117e3e32e9f5b20785c99b12 +Subproject commit 6cf67b09e781c09f8475c678ba69991772066a76 diff --git a/hayamiki.aproj b/hayamiki.aproj new file mode 100644 index 0000000..771a389 --- /dev/null +++ b/hayamiki.aproj @@ -0,0 +1,699 @@ + + + {89372B21-80FA-4EB8-B17C-072EB55713D6} + Debug + AnyCPU + Exe + model_manager + hayamiki + src\main.anubis + ./%3b./src + False + False + False + + + bin\Debug\ + True + Full + False + -sc + + + bin\Release\ + False + None + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hayamiki.ide b/hayamiki.ide new file mode 100644 index 0000000..ab1b6eb --- /dev/null +++ b/hayamiki.ide @@ -0,0 +1,18 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +# SharpDevelop 1.0.12.108 +Project("{B6712916-30DE-4a3e-A54C-2A79AC984AEE}") = "hayamiki", "hayamiki.aproj", "{89372B21-80FA-4EB8-B17C-072EB55713D6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {89372B21-80FA-4EB8-B17C-072EB55713D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {89372B21-80FA-4EB8-B17C-072EB55713D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {89372B21-80FA-4EB8-B17C-072EB55713D6}.Release|Any CPU.Build.0 = Release|Any CPU + {89372B21-80FA-4EB8-B17C-072EB55713D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/generation/files.anubis b/src/generation/files.anubis index ec74902..2622107 100644 --- a/src/generation/files.anubis +++ b/src/generation/files.anubis @@ -23,6 +23,8 @@ define Maybe(One) = since org_table is db_table(name, old_model, display), since old_model is db_model(columns, show_string), + since display is db_display(list_view, list_edit), + with model = db_model([db_column("id", p_key, []). columns], show_string ), with table = db_table(name, model, display), println("Generating file for table ["+name+"]"); @@ -42,7 +44,7 @@ define Maybe(One) if generate_update(strm, table) is { failure then failure, success(_) then if generate_show_string(strm, table) is { failure then failure, success(_) then if generate_selector(strm, table) is { failure then failure, success(_) then - if generate_VT_view(strm, table) is { failure then failure, success(_) then + if generate_VT_all_view(strm, table) is { failure then failure, success(_) then if generate_VT_edit(strm, table) is { failure then failure, success(_) then success(unique)}}}}}}}}}}}} }. diff --git a/src/generation/header.anubis b/src/generation/header.anubis index fef6f0b..29091ca 100644 --- a/src/generation/header.anubis +++ b/src/generation/header.anubis @@ -44,7 +44,7 @@ public define Maybe(One) )= if write_string(stream, "/* - * Created by model_manager. + * Created by 早見木 (Hayamiki). * User: Automat * Date: "+_Int_to_ISO_8601_date(now)+" * Time: "+_Int_to_ISO_8601_time(now)+" @@ -56,6 +56,7 @@ read calexium_lib/web/CXM_making_a_web_site.anubis read calexium_lib/web/CXM_common.anubis read calexium_lib/web/CXM_web_dump.anubis read calexium_lib/web/CXM_web_arg_utils.anubis +read calexium_lib/web/widgets/icons_set.anubis read data_base/sqlite.anubis read data_base/db_tools.anubis read calexium_lib/database/db_utils.anubis diff --git a/src/generation/types.anubis b/src/generation/types.anubis index 9bcc711..e1834ea 100644 --- a/src/generation/types.anubis +++ b/src/generation/types.anubis @@ -193,7 +193,7 @@ public define Maybe(One) " (\n"+ " SQLite3DataBase db,\n"+ " )=\n"+ - " if sql_query_timeout(db, \"SELECT "+join(", ", enclose("\\\"",components(columns, [])) )+" FROM "+name+";\", [], \"get_all_"+name+"\") is\n"+ + " if sql_query_timeout(db, \"SELECT "+join(", ", enclose("\\\"",to_List_String(columns, true)))+" FROM "+name+";\", [], \"get_all_"+name+"\") is\n"+ " {\n"+ " error(_) then [],\n"+ " ok(_, cursor, _) then _get_all_"+name+"(cursor, [])\n"+ @@ -225,7 +225,7 @@ public define Maybe(One) " SQLite3DataBase db,\n"+ " String idx\n"+ " )=\n"+ - " if sql_query_timeout(db, \"SELECT "+join(", ", enclose("\\\"",components(columns, [])))+" FROM "+name+" WHERE id=\"+idx+\";\", [], \"get_"+name+"\") is\n"+ + " if sql_query_timeout(db, \"SELECT "+join(", ", enclose("\\\"",to_List_String(columns, true)))+" FROM "+name+" WHERE id=\"+idx+\";\", [], \"get_"+name+"\") is\n"+ " {\n"+ " error(_) then failure,\n"+ " ok(_, cursor, _) then extract_"+name+"(cursor)\n"+ @@ -375,23 +375,36 @@ public define Maybe(One) }. public define Maybe(One) +/* Generate + +*/ generate_VT_view ( - Stream stream, - DB_Table table + Stream stream, //stream file where to write + DB_Table table, // + HK_List_View list_view //list view to generate )= - since table is db_table(name, model, display), + since table is db_table(table_name, model, display), since model is db_model( columns, _), - since display is db_display(list_view, list_edit), - - with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. + //since display is db_display(list_view, list_edit), + with type_name = to_upper(table_name, 1), //make the first character to upper case and be an Anubis Type. + with view_name = if list_view is + { + list_view_all then "default", + list_view(view_name, _) then view_name + }, + with current_list_view = if list_view is + { + list_view_all then to_List_String(columns, false), + list_view(_, cols)then cols + }, //generate the type of the table that contain all components if write_string(stream, "\n\n"+ //SQL query "define VT_view\n"+ - " _get_viewable_"+name+"\n"+ + " _get_viewable_"+table_name+"_"+view_name+"\n"+ " (\n"+ " SQLite3DataBase db,\n"+ " List("+type_name+") list,\n"+ @@ -402,27 +415,139 @@ public define Maybe(One) " [] then\n"+ " with header = vt_view_row([\n"+ // view row header - make_list_view_header(list_view, " ")+"\n"+ + make_list_view_header(current_list_view, " ")+"\n"+ " ]),\n"+ - " vt_view(\""+name+"\", header, reverse(so_far)),\n"+ + " vt_view(\""+table_name+"\", \""+view_name+"\", header, reverse(so_far)),\n"+ " [ h . t ] then\n"+ " with entry = vt_view_row([\n"+ // view row - make_list_view_row(table, "h", " ")+"\n"+ + make_list_view_row(table, "h", " ", list_view)+"\n"+ " ]),\n"+ - " _get_viewable_"+name+"(db, t, [entry . so_far])\n"+ + " _get_viewable_"+table_name+"_"+view_name+"(db, t, [entry . so_far])\n"+ " }.\n\n"+ "public define VT_view\n"+ - " get_viewable_"+name+"\n"+ + " get_viewable_"+table_name+"_"+view_name+"\n"+ " (\n"+ " SQLite3DataBase db\n"+ " )=\n"+ - " _get_viewable_"+name+"(db, get_all_"+name+"(db), []).\n\n" + " _get_viewable_"+table_name+"_"+view_name+"(db, get_all_"+table_name+"(db), []).\n\n" ) is //end of the function { failure then println("can't write generate_VT_view "+type_name); failure, success(_) then success(unique) }. + +public define Maybe(One) +/* Generate + +*/ + _generate_VT_view + ( + Stream stream, //stream file where to write + DB_Table table, // + List(HK_List_View) list_view, //list view to generate + Bool has_default //set to true if a default view was encountered. + )= + if list_view is + { + [] then + //if default view was not generated, we force to generate it + if has_default = false then + generate_VT_view(stream, table, list_view_all) + else + success(unique), + [view . t] then + if generate_VT_view(stream, table, view) is + { + failure then failure, + success(_) then + with new_has_default = if has_default = true then //already true, no need to go further + true + else + if view is + { + list_view_all then true, //list_view_all is default view + list_view(view_name, _) then + //if not we search for view named 'default' + if view_name = "default" then true else false + }, + _generate_VT_view(stream, table, t, new_has_default) + } + }. + +public define String +/* Generate + +*/ + _generate_get_viewable_if_else + ( + String table_name, // + List(HK_List_View) list_view, //list view to generate + String so_far + )= + if list_view is + { + [] then + so_far + + "\n"+ + " _get_viewable_"+table_name+"_default(db, get_all_"+table_name+"(db), [])\n", + [view . t] then + with view_name = if view is + { + list_view_all then "default", + list_view(view_name, _) then view_name + }, + _generate_get_viewable_if_else( table_name, t, + so_far + + " if view = \""+view_name+"\" then\n"+ + " _get_viewable_"+table_name+"_"+view_name+"(db, get_all_"+table_name+"(db), [])\n"+ + " else" + ) + }. + +public define Maybe(One) +/* Generate + +*/ + generate_get_viewable + ( + Stream stream, //stream file where to write + DB_Table table, // + List(HK_List_View) list_view //list view to generate + )= + since table is db_table(table_name, model, display), + if write_string(stream, + "public define VT_view\n"+ + " get_viewable_"+table_name+"\n"+ + " (\n"+ + " SQLite3DataBase db,\n"+ + " String view\n"+ + " )=\n"+ + _generate_get_viewable_if_else(table_name, list_view, "")+ + ".\n" + ) is //end of the function + { + failure then println("can't write generate_get_viewable "+table_name); failure, + success(_) then success(unique) + }. + +public define Maybe(One) + generate_VT_all_view + ( + Stream stream, + DB_Table table + )= + since table is db_table(name, model, display), + since model is db_model( columns, _), + since display is db_display(list_view, list_edit), + + with type_name = to_upper(name, 1), //make the first character to upper case to able to be a Anubis Type. + if _generate_VT_view(stream, table, list_view, false) is //list view to generate + { + failure then failure, + success(_) then generate_get_viewable(stream, table, list_view) + }. + public define Maybe(One) generate_VT_edit diff --git a/src/model.3.0.0.anubis b/src/model.3.0.0.anubis index 8831e52..4bba1b2 100644 --- a/src/model.3.0.0.anubis +++ b/src/model.3.0.0.anubis @@ -40,15 +40,18 @@ public define DB_Table mf_serial_table = "obj.serial" ), db_display( - views( + [ //list_view - list_view([ "serial", "mf_version", "mac", "app_id", "is_demo", "is_test", "last_updated", "last_ping", "mf_version", ]), - ]), - //list edit - list_edit(["serial", "mac", "app_id", "enabled", "free_domain", "max_domains", "is_demo", "is_test", "date_created", "last_updated", "last_ping", "current_ip", "mf_version", - "os_version", "ipkg_list", "ifconfig", "dmesg", "memory", "vm_memory", "status", "disks", "isp_smtp", "description", "comments", "alert_received", "alert_date", - "alert_msg", "alert_mf_version"]) + list_view("default", ["serial", "mf_version", "mac", "app_id", "is_demo", "is_test", "last_updated", "last_ping", "mf_version"]), + ], + //list of edit + ( + //edit_view_all + ["serial", "mac", "app_id", "enabled", "free_domain", "max_domains", "is_demo", "is_test", "date_created", "last_updated", "last_ping", "current_ip", "mf_version", + "os_version", "ipkg_list", "ifconfig", "dmesg", "memory", "vm_memory", "status", "disks", "isp_smtp", "description", "comments", "alert_received", "alert_date", + "alert_msg", "alert_mf_version"] + ) ) ). @@ -64,7 +67,7 @@ public define DB_Table settings_table = ), db_display( //list_view - [ "var_name", "var_value"], + [ list_view_all], //list edit ["var_name", "var_value"] ) @@ -89,7 +92,7 @@ public define DB_Table django_admin_log_table = ), db_display( //list_view - [ "action_time", "user_id", "content_type_id", "object_id", "object_repr", "action_flag", "change_message" ], + [ list_view_all], //list edit ["action_time", "user_id", "content_type_id", "object_id", "object_repr", "action_flag", "change_message"] ) @@ -108,7 +111,7 @@ public define DB_Table production_macaddress_table = ), db_display( //list_view - [ "mac", "index", "mailfountain_id"], + [ list_view_all], //list edit ["mac", "index", "mailfountain_id"] ) @@ -125,7 +128,7 @@ public define DB_Table production_mass_storage_type_table = ), db_display( //list_view - [ "type"], + [ list_view_all], //list edit ["type"] ) @@ -150,7 +153,9 @@ public define DB_Table production_mass_storage_table = ), db_display( //list_view - ["model_id", "serial", "status", "date_created"], + [ + list_view("current",["model_id", "serial", "status", "date_created"]) + ], //list_edit ["purchase_id", "model_id", "serial", "status", "comments"] ) @@ -187,7 +192,9 @@ public define DB_Table production_mass_storage_model_table = ), db_display( //list_view - [ "manufacturer", "type_id", "capacity", "tr_min", "last_modified", "date_created"], + [ + list_view("default", ["manufacturer", "type_id", "capacity", "tr_min", "last_modified", "date_created"]) + ], //list_edit [] ) @@ -210,7 +217,9 @@ public define DB_Table production_memory_table = ), db_display( //list_view - [ "serial", "status", "last_modified", "date_created"], + [ + list_view("default", ["serial", "status", "last_modified", "date_created"]) + ], //list_edit ["purchase_id", "model_id", "serial", "status", "last_modified", "date_created", "comments"] ) @@ -229,7 +238,7 @@ public define DB_Table production_memory_model_table = ), db_display( //list_view - [ "type_id", "manufacturer", "capacity"], + [ list_view_all], //list_edit ["type_id", "manufacturer", "capacity"] ) @@ -246,7 +255,7 @@ public define DB_Table production_memory_type_table = ), db_display( //list_view - [ "type"], + [ list_view_all], //list edit ["type"] ) @@ -270,7 +279,9 @@ public define DB_Table production_motherboard_table = ), db_display( //list_view - [ "serial", "week_fab", "status", "last_modified", "date_created"], + [ + list_view("default", ["serial", "week_fab", "status", "last_modified", "date_created"]) + ], //list_edit ["purchase_id", "model_id", "serial", "week_fab", "status", "last_modified", "date_created", "comments"] ) @@ -294,7 +305,9 @@ public define DB_Table production_motherboard_model_table = ), db_display( //list_view - ["name", "manufacturer", "cpu_model", "cpu_freq"], + [ + list_view("default", ["name", "manufacturer", "cpu_model", "cpu_freq"]) + ], //list_edit ["name", "manufacturer", "has_nand", "nand_capacity", "memory", "cpu_freq", "cpu_model", "endian"] ) @@ -317,7 +330,9 @@ public define DB_Table production_power_supply_table = ), db_display( //list_view - [ "serial", "status", "date_created", "last_modified"], + [ + list_view("default", ["serial", "status", "date_created", "last_modified"]) + ], //list_edit ["purchase_id", "model_id", "serial", "status", "date_created", "last_modified", "comments"] ) @@ -336,7 +351,9 @@ public define DB_Table production_power_supply_model_table = ), db_display( //list_view - [ "name", "manufacturer"], + [ + list_view("default", ["name", "manufacturer"]) + ], //list_edit ["name", "manufacturer", "power"] ) @@ -364,7 +381,9 @@ public define DB_Table production_product_reference_table = ), db_display( //list_view - [ "type_ref_id", "product_ref", "product_name", "description"], + [ + list_view("default", ["type_ref_id", "product_ref", "product_name", "description"]) + ], //list_edit [ "type_ref_id", "product_ref", "product_name", "description", "need_memory", "need_power_supply", "need_additional_storage", "min_additional_storage", "max_additional_storage", "date_created", "last_modified", "comments"] @@ -399,7 +418,9 @@ public define DB_Table production_products_table = ), db_display( //list_view - [ "production_id", "date", "serial", "motherboard_id", "app_id", "status"], + [ + list_view("default", ["production_id", "date", "serial", "motherboard_id", "app_id", "status"]) + ], //list_edit [ "production_id", "produced", "date", "serial", "security_code", "motherboard_id", "storage_id", "memory_id", "power_supply_id", "wifi", "mac", "app_id", "os_version", "published", "publish_date", "status", "date_created", "last_modified", "comments"] @@ -431,7 +452,9 @@ public define DB_Table production_production_table = ), db_display( //list_view - [ "date", "type_ref_id", "sticker_tpl_id", "product_ref_id", "site_id", "product_count", "produced_count"], + [ + list_view("default", ["date", "type_ref_id", "sticker_tpl_id", "product_ref_id", "site_id", "product_count", "produced_count"]) + ], //list_edit [ "date", "assembler_id", "type_ref_id", "product_ref_id", "site_id", "serial_prefix_id", "sticker_tpl_id", "starting_index", "product_count", "produced_count", "completed", "active", "date_created", "last_modified", "comments"] @@ -455,7 +478,9 @@ public define DB_Table production_production_site_table = ), db_display( //list_view - [ "ref", "name", "city", "country"], + [ + list_view("default", ["ref", "name", "city", "country"]) + ], //list_edit [ "ref", "name", "city", "country", "next_serial", "date_created", "last_modified", "comments"] ) @@ -478,7 +503,9 @@ public define DB_Table production_purchase_table = ), db_display( //list_view - ["date", "supplier_id", "description"], + [ + list_view("default", ["date", "supplier_id", "description"]) + ], //list_edit ["date", "buyer_id", "supplier_id", "order_ref", "description", "comments"] ) @@ -496,7 +523,7 @@ public define DB_Table production_serial_prefix_table = ), db_display( //list_view - ["prefix", "next_start"], + [list_view_all], //list_edit ["prefix", "next_start"] ) @@ -517,7 +544,9 @@ public define DB_Table production_type_number_table = ), db_display( //list_view - [ "type_ref", "description"], + [ + list_view("default", ["type_ref", "description"]) + ], //list_edit ["type_ref", "description", "comments"] ) @@ -550,7 +579,9 @@ public define DB_Table production_supplier_table = ), db_display( //list_view - [ "company", "phone", "mobile", "email"], + [ + list_view("default", ["company", "phone", "mobile", "email"]) + ], //list_edit ["company", "supplier_id", "address1", "address2", "zipcode", "city", "country", "email", "url", "phone", "fax", "mobile", "siret", "tva_number", "date_created", "last_modified", "comments"] @@ -573,7 +604,9 @@ public define DB_Table staff_department_table = ), db_display( //list_view - [ "name"], + [ + list_view("default", ["name"]) + ], //list_edit ["name", "description", "comments"] ) @@ -594,7 +627,9 @@ public define DB_Table staff_role_table = ), db_display( //list_view - [ "role_name"], + [ + list_view("default", ["role_name"]) + ], //list_edit ["role_name", "description", "comments"] ) @@ -620,7 +655,11 @@ public define DB_Table staff_staff_table = ), db_display( //list_view - [ "contact_id", "department_id", "role_id", "email"], + [ + list_view("default", ["contact_id", "department_id", "role_id", "email"]), + list_view("details", ["contact_id", "department_id", "role_id", "email", "incoming_date", "still_present"]) + + ], //list_edit ["contact_id", "department_id", "role_id", "email", "incoming_date", "outgoing_date", "still_present", "date_created", "date_modified", "comments"] ) @@ -653,7 +692,11 @@ public define DB_Table address_book_contact_table = ), db_display( //list_view - [ "first_name", "last_name", "company", "phone", "mobile", "email"], + [ + 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 ["first_name", "last_name", "company", "role", "address1", "address2", "zipcode", "city", "country", "email", "url", "phone", "fax", "mobile", "comments"] ) -- libgit2 0.21.4