diff --git a/ds_files/graphviz.gv b/ds_files/graphviz.gv index 8e83808..fea44f9 100644 --- a/ds_files/graphviz.gv +++ b/ds_files/graphviz.gv @@ -1,8 +1,8 @@ /* * Created by 伝作 (Densaku). * Types & Messages generator written by フランスのトトロ aka (David RENÉ) - * Date: 2019-07-14 - * Time: 16:15:41 + * Date: 2022-05-28 + * Time: 21:06:38 * */ diff --git a/hayamiki_ds_types.anubis b/hayamiki_ds_types.anubis index 242d1ce..9bb82ce 100644 --- a/hayamiki_ds_types.anubis +++ b/hayamiki_ds_types.anubis @@ -24,4 +24,4 @@ global define One success(ds_gen) then forget(ds_gen.generate_type_files(hayamiki_lib_types_description, [], "ds_files/")) }. -execute anbexec hayamiki_1_19_lib_ds // generate the file +execute anbexec.1.19 hayamiki_1_19_lib_ds // generate the file diff --git a/hayamiki_ds_types.aproj b/hayamiki_ds_types.aproj index ca2b389..6d05cfa 100644 --- a/hayamiki_ds_types.aproj +++ b/hayamiki_ds_types.aproj @@ -11,7 +11,7 @@ False False False - c:\anubis.1.19\ + c:\anubis\1.19\ bin\Debug\ diff --git a/hayamiki_lib b/hayamiki_lib index 121721e..d57036b 160000 --- a/hayamiki_lib +++ b/hayamiki_lib @@ -1 +1 @@ -Subproject commit 121721e07c35734855b53c726dad24f43dfcae67 +Subproject commit d57036b4baa16371f6eedbf8ff6e4361f4e89081 diff --git a/src/generation/extractor.anubis b/src/generation/extractor.anubis index 75bd634..162d43a 100644 --- a/src/generation/extractor.anubis +++ b/src/generation/extractor.anubis @@ -20,12 +20,12 @@ public define String with cursor_index = "("+cursor+")("+index+")", if t is { - p_key then "db_id((Int)db_integer"+cursor_index+")", + p_key then "db_id_or_null"+cursor_index, boolean_field then "db_bool"+cursor_index, date_field(_) then "db_date(text"+cursor_index+")", time_field(_) then "db_time(text"+cursor_index+")", datetime_field(_) then "db_datetime(text"+cursor_index+")", - foreign_key(_,_,_,_,_) then "db_id((Int)db_integer"+cursor_index+")", + foreign_key(_,_,_,_,_) then "db_id_or_null"+cursor_index, integer_field(_) then "(Int)db_integer"+cursor_index, float_field then "db_float"+cursor_index, char_field(_,_) then "text"+cursor_index, diff --git a/src/web_controller/controller.anubis b/src/web_controller/controller.anubis index 91f4863..9d9c2eb 100644 --- a/src/web_controller/controller.anubis +++ b/src/web_controller/controller.anubis @@ -13,7 +13,7 @@ read hayamiki_lib/view/view_table_manager_types.anubis public define WEB_Controller - get_hk_controller + get_hk_web_controller ( SQLite3DataBase db, HK_Database hk_db, @@ -32,5 +32,5 @@ public define List(WEB_Controller) VTM _vtm, (LogLevel, String) -> One logger ) = - [get_hk_controller(db, hk_db, _vtm, logger)] + [get_hk_web_controller(db, hk_db, _vtm, logger)] . diff --git a/src/web_controller/hayamiki.anubis b/src/web_controller/hayamiki.anubis index 9a768e1..76e2e7e 100644 --- a/src/web_controller/hayamiki.anubis +++ b/src/web_controller/hayamiki.anubis @@ -658,6 +658,43 @@ define (WEB_Session) -> WEB_Controller_Result } . +define List(JsonValue) + to_select2_results + ( + List((List(CoreAttrs), WebArgValue, String)) l, + String selected + ) = + if l is + { + [ ] then + if selected = "" then + [json_object([json_member("id", json_string("-1")), + json_member("text", json_string(""))])] + else + [ ], + [h . t] then + if h is (attrs, val, item) + then [json_object([json_member("id", json_string(val.value)), + json_member("text", json_string(item))]+ + if selected = val.value then + [json_member("selected", json_bool(true))] + else + []) . to_select2_results(t, selected)] + } +. + +define JsonValue + to_select2_results + ( + List((List(CoreAttrs), WebArgValue, String)) l, + String selected + ) = + println("to_select2_results: selected ["+selected+"]"); + json_object([ + json_member("results", json_array(to_select2_results(l, selected))) + ]) +. + define (WEB_Session) -> WEB_Controller_Result get_selector ( @@ -674,14 +711,19 @@ define (WEB_Session) -> WEB_Controller_Result with sub_dialog = get_Bool(lwa, "sub_dialog"), with fk_filter = get_String(lwa, "fk_filter", ""), with selected = get_String(lwa, "selected", ""), + with select2 = get_Bool(lwa, "select2"), with referer = get_HK_Referer_from_web_arg(lwa, ""), + println("get_selector"); + if get_hk_controller(_vtm.hk_controllers, table_name) is { failure then println("can't get writer for "+table_name);redirect_to_previous, success(controller) then - - ajax(json(http_ok, to_html_ajax_content(format_choices(controller.get_selector(db, referer, fk_filter), init(selected)), ""))) + if select2 then + ajax(json(http_ok, to_select2_results(controller.get_selector(db, referer, fk_filter), selected))) + else + ajax(json(http_ok, to_html_ajax_content(format_choices(controller.get_selector(db, referer, fk_filter), init(selected)), ""))) } . -- libgit2 0.21.4