Commit 36359069ec2114e868bb2ead82d170fcf7a759ad
1 parent
609807d9
add foreign_key active filter as argument. Not yet managed
Showing
2 changed files
with
32 additions
and
30 deletions
Show diff stats
view/types/hk_form_entry.anubis
| ... | ... | @@ -25,8 +25,8 @@ public type HK_Form_Entry: //legacy VT_Edit |
| 25 | 25 | information (String s_name, String c_name, String v_name, Int width, HK_Help_Text help), //s_name = show_name for translation, v_name = string to show |
| 26 | 26 | text (String s_name, String c_name, String value, HK_Help_Text help), //s_name = show_name for translation, c_name = table column name |
| 27 | 27 | password (String s_name, String c_name, HK_Help_Text help), //s_name = show_name for translation, c_name = table column name |
| 28 | - foreign_text(String s_name, String c_name, DB_id selected, String f_table_name, HK_Form_Selector selector, HK_Help_Text help), | |
| 29 | - foreign_text_search(String s_name, String c_name, DB_id selected, String f_table_name, List(String) search_fields, HK_Help_Text help), | |
| 28 | + foreign_text(String s_name, String c_name, DB_id selected, String f_table_name, HK_Form_Selector selector, List(HK_Foreign_Key_Active_Filter) active_filters, HK_Help_Text help), | |
| 29 | + foreign_text_search(String s_name, String c_name, DB_id selected, String f_table_name, List(String) search_fields, List(HK_Foreign_Key_Active_Filter) active_filters, HK_Help_Text help), | |
| 30 | 30 | choices_text(String s_name, String c_name, String selected, HK_Form_Selector selector, HK_Help_Text help), |
| 31 | 31 | text_area (String s_name, String c_name, String value, HK_Text_Field_Attr area_att, HK_Help_Text help), //s_name = show_name for translate, c_name = table column name |
| 32 | 32 | boolean (String s_name, String c_name, Bool value, HK_Help_Text help), | ... | ... |
view/view_table_renderer.anubis
| ... | ... | @@ -678,7 +678,7 @@ public define List(CXM_Form_Field) |
| 678 | 678 | password_entries |
| 679 | 679 | ], |
| 680 | 680 | |
| 681 | - foreign_text(s_name, c_name, _value, foreign_table_name, select, help) then | |
| 681 | + foreign_text(s_name, c_name, _value, foreign_table_name, active_filter, select, help) then | |
| 682 | 682 | with uid = "_"+generate_random_string(20)+"_", |
| 683 | 683 | with refresh_func = uid+foreign_table_name+"_"+c_name+"_selector_refresh", |
| 684 | 684 | //Get the priority of the web argument content for the value, this means the value already set by the user or called with programmaticaly with it |
| ... | ... | @@ -698,7 +698,7 @@ public define List(CXM_Form_Field) |
| 698 | 698 | ], |
| 699 | 699 | |
| 700 | 700 | |
| 701 | - foreign_text_search(s_name, c_name, _select, foreign_table_name, s_fields, help) then | |
| 701 | + foreign_text_search(s_name, c_name, _select, foreign_table_name, s_fields, active_filter, help) then | |
| 702 | 702 | with uid = "_"+generate_random_string(20)+"_", |
| 703 | 703 | //Get the priority of the web argument content for the select, this means the value already set by the user or called with programmaticaly with it |
| 704 | 704 | with select = get_DB_id(lwa, c_name, _select), |
| ... | ... | @@ -869,7 +869,7 @@ public define List(CXM_Form_Field) |
| 869 | 869 | edit_form_cell |
| 870 | 870 | ( |
| 871 | 871 | SQLite3DataBase db, |
| 872 | - String fk_clause, | |
| 872 | + //String fk_clause, | |
| 873 | 873 | HK_Referer table_referer, |
| 874 | 874 | List(Web_arg) lwa, //web arguments of the request |
| 875 | 875 | (String) -> String _T, |
| ... | ... | @@ -884,11 +884,11 @@ public define List(CXM_Form_Field) |
| 884 | 884 | empty then [empty], |
| 885 | 885 | hidden(name, value) then |
| 886 | 886 | //print("hidden "+name+" = "+value); |
| 887 | - [hidden(html_Id(""), wan(name), wav(value))], | |
| 887 | + [hidden(html_Id(name), wan(name), wav(value))], | |
| 888 | 888 | label(name) then |
| 889 | 889 | [div([],text(_T(name)))], |
| 890 | 890 | primary_key(idx) then |
| 891 | - [hidden(html_Id(""), wan("id"), wav(idx))], | |
| 891 | + [hidden(html_Id("id"), wan("id"), wav(idx))], | |
| 892 | 892 | information(s_name, c_name, value, width, help) then |
| 893 | 893 | [input_readonly(no_label, wan(c_name), init(not_null_String(value)), if width > 0 then custom(width) else narrow), help_line(help, _T)], |
| 894 | 894 | text(s_name, c_name, value, help) then |
| ... | ... | @@ -910,8 +910,9 @@ public define List(CXM_Form_Field) |
| 910 | 910 | password_entries |
| 911 | 911 | ], |
| 912 | 912 | |
| 913 | - foreign_text(s_name, c_name, _value, foreign_table_name, select, help) then | |
| 913 | + foreign_text(s_name, c_name, _value, foreign_table_name, active_filter, select, help) then | |
| 914 | 914 | //[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)], |
| 915 | + with fk_clause = "", | |
| 915 | 916 | with uid = "_"+generate_random_string(20)+"_", |
| 916 | 917 | with refresh_func = uid+foreign_table_name+"_"+c_name+"_selector_refresh", |
| 917 | 918 | with value = get_DB_id(lwa, c_name, _value), |
| ... | ... | @@ -929,7 +930,7 @@ public define List(CXM_Form_Field) |
| 929 | 930 | ]) |
| 930 | 931 | ], |
| 931 | 932 | |
| 932 | - foreign_text_search(s_name, c_name, _select, foreign_table_name, s_fields, help) then | |
| 933 | + foreign_text_search(s_name, c_name, _select, foreign_table_name, s_fields, active_filer, help) then | |
| 933 | 934 | //[raw_in_form(literal("<input class=\"in\" id=\"acb_"+c_name+"\" data-init_record=\""+select+"\" size=\"50\" type=\"text\">"))] |
| 934 | 935 | with uid = "_"+generate_random_string(20)+"_", |
| 935 | 936 | with select = get_DB_id(lwa, c_name, _select), |
| ... | ... | @@ -951,31 +952,32 @@ public define List(CXM_Form_Field) |
| 951 | 952 | ] |
| 952 | 953 | |
| 953 | 954 | choices_text(s_name, c_name, value, select, help) then |
| 954 | - [selector_c([],no_label, html_Id(""), wan(c_name), 1, select.get(db, no_referer, ""), success(init(value)), mandatory), help_line(help, _T)], | |
| 955 | + [selector_c([],no_label, html_Id(c_name), wan(c_name), 1, select.get(db, no_referer, ""), success(init(value)), mandatory), help_line(help, _T)], | |
| 955 | 956 | |
| 956 | 957 | text_area(s_name, c_name, value, txt_editor, help) then |
| 957 | - with uid = "_"+generate_random_string(20), | |
| 958 | - with id = if txt_editor is { none then "", rich_editor then uid+"_editor"}, | |
| 958 | + //with uid = "_"+generate_random_string(20), | |
| 959 | + //with id = if txt_editor is { none then "", rich_editor then uid+"_editor"}, | |
| 959 | 960 | [ |
| 960 | 961 | if txt_editor is { |
| 961 | 962 | none then empty, |
| 962 | 963 | rich_editor then partial(partial_content( |
| 963 | 964 | [js(js_file("ckeditor/ckeditor.js")), |
| 964 | 965 | js_inline(jquery_ready( |
| 965 | - " var cke_instance = CKEDITOR.replace( '"+id+"' ); | |
| 966 | - cke_instance.on('blur', function() { cke_instance.updateElement(); }); | |
| 966 | + " var cke_instance = CKEDITOR.replace( '"+c_name+"' );"+ | |
| 967 | + //" var cke_instance = CKEDITOR.replace( '"+id+"' ); | |
| 968 | + " cke_instance.on('blur', function() { cke_instance.updateElement(); }); | |
| 967 | 969 | "))],empty)) |
| 968 | 970 | }, |
| 969 | - text_area([],no_label, html_Id(id), wan(c_name), init(not_null_String(value)), narrow, (Int)5, mandatory), help_line(help, _T)], | |
| 971 | + text_area([],no_label, html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, (Int)5, mandatory), help_line(help, _T)], | |
| 970 | 972 | |
| 971 | 973 | boolean(s_name, c_name, value, help) then |
| 972 | - [checkboxr([],label(_T(s_name), no_help)/*no_label*/, html_Id(""), wan(c_name), value, mandatory), help_line(help, _T)], | |
| 974 | + [checkboxr([],label(_T(s_name), no_help), html_Id(c_name), wan(c_name), value, mandatory), help_line(help, _T)], | |
| 973 | 975 | integer(s_name, c_name, value, help) then |
| 974 | - [input(no_label, wan(c_name), init(abs_to_decimal(value)), small, mandatory), help_line(help, _T)], | |
| 976 | + [input(no_label, html_Id(c_name), wan(c_name), init(abs_to_decimal(value)), small, mandatory), help_line(help, _T)], | |
| 975 | 977 | float(s_name, c_name, value, help) then |
| 976 | - [input(no_label, wan(c_name), init(float_to_string(value, 5)), small, mandatory), help_line(help, _T)], | |
| 978 | + [input(no_label, html_Id(c_name), wan(c_name), init(float_to_string(value, 5)), small, mandatory), help_line(help, _T)], | |
| 977 | 979 | choices_int(s_name, c_name, value, select, help) then |
| 978 | - [selector_c([],no_label, html_Id(""), wan(c_name), 1, select.get(db, no_referer, ""), success(init(to_String(value))), mandatory), help_line(help, _T)], | |
| 980 | + [selector_c([],no_label, html_Id(c_name), wan(c_name), 1, select.get(db, no_referer, ""), success(init(to_String(value))), mandatory), help_line(help, _T)], | |
| 979 | 981 | date(s_name, c_name, value, help) then |
| 980 | 982 | [input([class("datepicker")], no_label, html_Id(c_name), wan(c_name), init(not_null_String(value)), small, non_mandatory), help_line(help, _T)], |
| 981 | 983 | time(s_name, c_name, value, help) then |
| ... | ... | @@ -983,7 +985,7 @@ public define List(CXM_Form_Field) |
| 983 | 985 | datetime(s_name, c_name, value, help) then |
| 984 | 986 | [input([class("datetimepicker")], no_label, html_Id(c_name), wan(c_name), init(not_null_String(value)), custom(18), mandatory), help_line(help, _T)], |
| 985 | 987 | color( s_name, c_name, value, help) then |
| 986 | - [input([class("jscolor"), style("background-color: #"+value+";")], no_label, wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], | |
| 988 | + [input([class("jscolor"), style("background-color: #"+value+";")], no_label, html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], | |
| 987 | 989 | phone( s_name, c_name, value, phone_type, help) then |
| 988 | 990 | with sms_options = (Maybe(List(CoreAttrs)))if phone_type = cellphone then success([event(onclick, "hk_send_sms(this)"), class("clickable")]) else failure, |
| 989 | 991 | with event = (List(CoreAttrs))if phone_type = fax then [] else [event(onclick, "hk_phone_call(this)"), class("clickable")], |
| ... | ... | @@ -1017,9 +1019,9 @@ define CXM_Form_Field |
| 1017 | 1019 | HK_Referer table_referer, |
| 1018 | 1020 | (String) -> String _T, |
| 1019 | 1021 | List(Web_arg) lwa, |
| 1020 | - List(HK_Form_Table_Line) form_lines, | |
| 1021 | - Bool create, //this is new entry, db_id = none | |
| 1022 | - Bool no_add //not allow to add new entry in dropdown | |
| 1022 | + List(HK_Form_Table_Line) form_lines, | |
| 1023 | + Bool create, //this is new entry, db_id = none | |
| 1024 | + Bool no_add //not allow to add new entry in dropdown | |
| 1023 | 1025 | )= |
| 1024 | 1026 | div([], |
| 1025 | 1027 | table([class("striped")], |
| ... | ... | @@ -1032,7 +1034,7 @@ define CXM_Form_Field |
| 1032 | 1034 | { |
| 1033 | 1035 | //construct one cell |
| 1034 | 1036 | hk_form_table_cell(cell_attributes, entry) then |
| 1035 | - cell(make_cell_option(cell_attributes), to_HTML_In_Form(edit_form_cell(db, "", table_referer, lwa, _T, entry, create, no_add, []), lwa, "form_field table", false)), | |
| 1037 | + cell(make_cell_option(cell_attributes), to_HTML_In_Form(edit_form_cell(db, table_referer, lwa, _T, entry, create, no_add, []), lwa, "form_field table", false)), | |
| 1036 | 1038 | //construct table in one cell |
| 1037 | 1039 | hk_form_table_cell_table(cell_attributes, lines) then |
| 1038 | 1040 | cell(make_cell_option(cell_attributes), to_HTML_In_Form([construct_edit_form_table(db, table_referer, _T, lwa, lines, create, no_add)], lwa, "form_field table", false)) |
| ... | ... | @@ -1153,14 +1155,14 @@ public define Maybe(HTML_Partial_Content) |
| 1153 | 1155 | (String) -> String _T, |
| 1154 | 1156 | String lang, |
| 1155 | 1157 | List(Web_arg) lwa, |
| 1156 | - String table, //table name | |
| 1158 | + String table_name, //table name | |
| 1157 | 1159 | String view_name, //view name to use |
| 1158 | 1160 | HK_Form_action action, //new_entry or edit an existing record |
| 1159 | 1161 | VTM vtm, |
| 1160 | 1162 | String fk_clause, |
| 1161 | 1163 | HK_Referer referer |
| 1162 | 1164 | ) = |
| 1163 | - if vtm_get_edit(table, vtm.edit_list) is | |
| 1165 | + if vtm_get_edit(table_name, vtm.edit_list) is | |
| 1164 | 1166 | { |
| 1165 | 1167 | failure then failure, |
| 1166 | 1168 | success(vtm_e) then |
| ... | ... | @@ -1168,10 +1170,10 @@ public define Maybe(HTML_Partial_Content) |
| 1168 | 1170 | //get editor by his view name |
| 1169 | 1171 | if get_edit(db, action, view_name) is |
| 1170 | 1172 | { |
| 1171 | - hk_form_in_list(tb_name, v_name, list_form_entries, list_tabs) then | |
| 1172 | - 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)), | |
| 1173 | - hk_form_in_table(tb_name, v_name, form_in_table) then | |
| 1174 | - success(renderer_edit_table_form(db, _T, lang, /*web_site_directory,*/ tb_name, /*v_name,*/ form_in_table, lwa, /*vtm,*/ /*clause,*/ fk_clause, referer)) | |
| 1173 | + hk_form_in_list(_, v_name, list_form_entries, list_tabs) then | |
| 1174 | + success(renderer_edit_list_form(db, _T, lang, table_name, /*v_name,*/ list_form_entries, list_tabs, lwa, vtm, /*clause,*/ fk_clause, referer)), | |
| 1175 | + hk_form_in_table(_, v_name, form_in_table) then | |
| 1176 | + success(renderer_edit_table_form(db, _T, lang, table_name, /*v_name,*/ form_in_table, lwa, /*vtm,*/ /*clause,*/ fk_clause, referer)) | |
| 1175 | 1177 | } |
| 1176 | 1178 | }. |
| 1177 | 1179 | ... | ... |