From 43f4a3b453f179548d10cee12671f5d74a51b2fc Mon Sep 17 00:00:00 2001 From: totoro Date: Thu, 8 Mar 2018 16:38:42 +0100 Subject: [PATCH] add lwa argument in edit_form_cell add helper for column, column_label, label and table --- view/types/hk_editor_table.anubis | 35 ++++++++++++++++++++++++++++++++++- view/view_table_renderer.anubis | 13 ++++++++----- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/view/types/hk_editor_table.anubis b/view/types/hk_editor_table.anubis index a5ac927..e2ce14b 100644 --- a/view/types/hk_editor_table.anubis +++ b/view/types/hk_editor_table.anubis @@ -1,4 +1,4 @@ -/* +/* * Created by 伝作 (Densaku). * Types & Messages generator written by フランスのトトロ aka (David RENÉ) * Date: 2017-05-19 @@ -60,6 +60,39 @@ public type HK_Editor_Table_Cell: . +public define HK_Editor_Table_Cell + column + ( + String column_name + )= + column([], column_name) +. + +public define HK_Editor_Table_Cell + column_label + ( + String column_name + )= + column_label([], column_name) +. + +public define HK_Editor_Table_Cell + label + ( + String _label + )= + label([], _label) +. + +public define HK_Editor_Table_Cell + table + ( + List(HK_Editor_Table_Line) lines + )= + table([], lines) +. + + public type HK_Editor_Table_Line: line( List(HK_Editor_Table_Cell) cells diff --git a/view/view_table_renderer.anubis b/view/view_table_renderer.anubis index 1e0540c..2b1068c 100644 --- a/view/view_table_renderer.anubis +++ b/view/view_table_renderer.anubis @@ -858,6 +858,7 @@ public define List(CXM_Form_Field) SQLite3DataBase db, String fk_clause, HK_Referer table_referer, + List(Web_arg) lwa, //web arguments of the request (String) -> String _T, HK_Form_Entry cell, Bool new_entry, @@ -895,10 +896,11 @@ public define List(CXM_Form_Field) password_entries ], - foreign_text(s_name, c_name, value, foreign_table_name, select, help) then + foreign_text(s_name, c_name, _value, foreign_table_name, select, help) then //[selector_c([],no_label, html_Id(""), wan(c_name), 1, select.get(db, table_referer, fk_clause), success(init(to_String(value))), mandatory), help_line(help, _T)], with uid = "_"+generate_random_string(20)+"_", with refresh_func = uid+foreign_table_name+"_"+c_name+"_selector_refresh", + with value = get_DB_id(lwa, c_name, _value), //with load_script = "CalexiumToolBox.ajax_load_content('"+uid+foreign_table_name+"_"+c_name+"_selector', '?aws_controller=hk_c&aws_action=selector&table_name="+foreign_table_name+"&fk_filter="+fk_clause+"&selected="+value+"');", with load_script = script("text/javascript","function "+refresh_func+"() { CalexiumToolBox.ajax_load_content('"+uid+foreign_table_name+"_"+c_name+"_selector', '?aws_controller=hk_c&aws_action=selector&table_name="+foreign_table_name+"&fk_filter="+fk_clause+"&selected="+value+"');} "+refresh_func+"(); "), [ @@ -910,9 +912,10 @@ public define List(CXM_Form_Field) ]) ], - foreign_text_search(s_name, c_name, select, foreign_table_name, s_fields, help) then + foreign_text_search(s_name, c_name, _select, foreign_table_name, s_fields, help) then //[raw_in_form(literal(""))] with uid = "_"+generate_random_string(20)+"_", + with select = get_DB_id(lwa, c_name, _select), with combo_init = ajax_combo_init_parameter(uid, foreign_table_name, c_name, s_fields), [ partial(partial_content([ @@ -1008,7 +1011,7 @@ define CXM_Form_Field { //construct one cell hk_form_table_cell(cell_attributes, entry) then - cell(make_cell_option(cell_attributes), to_HTML_In_Form(edit_form_cell(db, "", table_referer, _T, entry, create, []), lwa, "form_field table", false)), + cell(make_cell_option(cell_attributes), to_HTML_In_Form(edit_form_cell(db, "", table_referer, lwa, _T, entry, create, []), lwa, "form_field table", false)), //construct table in one cell hk_form_table_cell_table(cell_attributes, lines) then cell(make_cell_option(cell_attributes), to_HTML_In_Form([construct_edit_form_table(db, table_referer, _T, lwa, lines, create)], lwa, "form_field table", false)) @@ -1040,7 +1043,7 @@ public define HTML_Partial_Content //String view_name, HK_Form_Table table_form, List(Web_arg) lwa, - VTM vtm, + //VTM vtm, //String clause, String fk_clause, HK_Referer table_referer //from which table and row id that editor is called @@ -1125,7 +1128,7 @@ public define Maybe(HTML_Partial_Content) hk_form_in_list(tb_name, v_name, list_form_entries, list_tabs) then success(renderer_edit_list_form(db, _T, lang, /*web_site_directory,*/ tb_name, /*v_name,*/ list_form_entries, list_tabs, lwa, vtm, /*clause,*/ fk_clause, referer)), hk_form_in_table(tb_name, v_name, form_in_table) then - success(renderer_edit_table_form(db, _T, lang, /*web_site_directory,*/ tb_name, /*v_name,*/ form_in_table, lwa, vtm, /*clause,*/ fk_clause, referer)) + success(renderer_edit_table_form(db, _T, lang, /*web_site_directory,*/ tb_name, /*v_name,*/ form_in_table, lwa, /*vtm,*/ /*clause,*/ fk_clause, referer)) } }. -- libgit2 0.21.4