Commit 43f4a3b453f179548d10cee12671f5d74a51b2fc

Authored by totoro
1 parent 661f6c0e

add lwa argument in edit_form_cell

add helper for column, column_label, label and table
view/types/hk_editor_table.anubis
1   -/*
  1 +/*
2 2 * Created by 伝作 (Densaku).
3 3 * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
4 4 * Date: 2017-05-19
... ... @@ -60,6 +60,39 @@ public type HK_Editor_Table_Cell:
60 60 .
61 61  
62 62  
  63 +public define HK_Editor_Table_Cell
  64 + column
  65 + (
  66 + String column_name
  67 + )=
  68 + column([], column_name)
  69 +.
  70 +
  71 +public define HK_Editor_Table_Cell
  72 + column_label
  73 + (
  74 + String column_name
  75 + )=
  76 + column_label([], column_name)
  77 +.
  78 +
  79 +public define HK_Editor_Table_Cell
  80 + label
  81 + (
  82 + String _label
  83 + )=
  84 + label([], _label)
  85 +.
  86 +
  87 +public define HK_Editor_Table_Cell
  88 + table
  89 + (
  90 + List(HK_Editor_Table_Line) lines
  91 + )=
  92 + table([], lines)
  93 +.
  94 +
  95 +
63 96 public type HK_Editor_Table_Line:
64 97 line(
65 98 List(HK_Editor_Table_Cell) cells
... ...
view/view_table_renderer.anubis
... ... @@ -858,6 +858,7 @@ public define List(CXM_Form_Field)
858 858 SQLite3DataBase db,
859 859 String fk_clause,
860 860 HK_Referer table_referer,
  861 + List(Web_arg) lwa, //web arguments of the request
861 862 (String) -> String _T,
862 863 HK_Form_Entry cell,
863 864 Bool new_entry,
... ... @@ -895,10 +896,11 @@ public define List(CXM_Form_Field)
895 896 password_entries
896 897 ],
897 898  
898   - foreign_text(s_name, c_name, value, foreign_table_name, select, help) then
  899 + foreign_text(s_name, c_name, _value, foreign_table_name, select, help) then
899 900 //[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)],
900 901 with uid = "_"+generate_random_string(20)+"_",
901 902 with refresh_func = uid+foreign_table_name+"_"+c_name+"_selector_refresh",
  903 + with value = get_DB_id(lwa, c_name, _value),
902 904 //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+"');",
903 905 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+"(); "),
904 906 [
... ... @@ -910,9 +912,10 @@ public define List(CXM_Form_Field)
910 912 ])
911 913 ],
912 914  
913   - foreign_text_search(s_name, c_name, select, foreign_table_name, s_fields, help) then
  915 + foreign_text_search(s_name, c_name, _select, foreign_table_name, s_fields, help) then
914 916 //[raw_in_form(literal("<input class=\"in\" id=\"acb_"+c_name+"\" data-init_record=\""+select+"\" size=\"50\" type=\"text\">"))]
915 917 with uid = "_"+generate_random_string(20)+"_",
  918 + with select = get_DB_id(lwa, c_name, _select),
916 919 with combo_init = ajax_combo_init_parameter(uid, foreign_table_name, c_name, s_fields),
917 920 [
918 921 partial(partial_content([
... ... @@ -1008,7 +1011,7 @@ define CXM_Form_Field
1008 1011 {
1009 1012 //construct one cell
1010 1013 hk_form_table_cell(cell_attributes, entry) then
1011   - cell(make_cell_option(cell_attributes), to_HTML_In_Form(edit_form_cell(db, "", table_referer, _T, entry, create, []), lwa, "form_field table", false)),
  1014 + 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)),
1012 1015 //construct table in one cell
1013 1016 hk_form_table_cell_table(cell_attributes, lines) then
1014 1017 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
1040 1043 //String view_name,
1041 1044 HK_Form_Table table_form,
1042 1045 List(Web_arg) lwa,
1043   - VTM vtm,
  1046 + //VTM vtm,
1044 1047 //String clause,
1045 1048 String fk_clause,
1046 1049 HK_Referer table_referer //from which table and row id that editor is called
... ... @@ -1125,7 +1128,7 @@ public define Maybe(HTML_Partial_Content)
1125 1128 hk_form_in_list(tb_name, v_name, list_form_entries, list_tabs) then
1126 1129 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)),
1127 1130 hk_form_in_table(tb_name, v_name, form_in_table) then
1128   - success(renderer_edit_table_form(db, _T, lang, /*web_site_directory,*/ tb_name, /*v_name,*/ form_in_table, lwa, vtm, /*clause,*/ fk_clause, referer))
  1131 + success(renderer_edit_table_form(db, _T, lang, /*web_site_directory,*/ tb_name, /*v_name,*/ form_in_table, lwa, /*vtm,*/ /*clause,*/ fk_clause, referer))
1129 1132 }
1130 1133 }.
1131 1134  
... ...