From 6ad846b4dc7ff3ab41cd33262dfe68e3de9c6952 Mon Sep 17 00:00:00 2001 From: totoro Date: Fri, 17 Mar 2017 18:09:38 +0100 Subject: [PATCH] manage password entry in view_table_renderer --- view/view_table_renderer.anubis | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/view/view_table_renderer.anubis b/view/view_table_renderer.anubis index 11e1875..2632b50 100644 --- a/view/view_table_renderer.anubis +++ b/view/view_table_renderer.anubis @@ -57,6 +57,7 @@ public define List(CXM_Form_Field) SQLite3DataBase db, (String) -> String _T, List(VT_edit_entry) list, + Bool new_entry, List(CXM_Form_Field) so_far )= if list is @@ -76,9 +77,21 @@ public define List(CXM_Form_Field) text(s_name, c_name, value, help) then [input(label(_T(s_name), no_help), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], password(s_name, c_name, help) then - [password_input(label(_T(s_name), no_help), wan(c_name+"_1"), init(""), narrow, non_mandatory), - password_input(label(_T(s_name), no_help), wan(c_name+"_2"), init(""), narrow, non_mandatory), - help_line(help, _T)], + with password_entries = + [ password_input(label(_T(s_name), no_help), wan(c_name+"_1"), init(""), narrow, non_mandatory), + password_input(label(_T(s_name), no_help), wan(c_name+"_2"), init(""), narrow, non_mandatory), + help_line(help, _T) + ], + + if new_entry = false then + [ checkbox_hide_show([], label(_T("CLICK_TO_CHANGE_PASSWORD")), wan(c_name+"_pwd_change"), wav("on"), false, //not checked at first + password_entries), + hidden(html_Id(""), wan(c_name+"_pwd_change_option"), wav("true")) + ] + else + [ hidden(html_Id(""), wan(c_name+"_pwd_change_option"), wav("false")) . + password_entries + ], foreign_text(s_name, c_name, value, select, help) then [selector_c([],label(_T(s_name), no_help), html_Id(""), wan(c_name), 1, select.get(db), success(init(to_String(value))), mandatory), help_line(help, _T)], @@ -102,7 +115,7 @@ public define List(CXM_Form_Field) datetime(s_name, c_name, value, help) then [input([class("datetimepicker")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(value), custom(18), mandatory), help_line(help, _T)], }, - edit_form_lines(db, _T, t, reverse(line)+so_far) + edit_form_lines(db, _T, t, new_entry, reverse(line)+so_far) }. define HTML_Head_Tag @@ -143,13 +156,13 @@ public define HTML_Partial_Content with table_name = vt_elist.table_name, with button_name = if get_String(lwa, "id","none") = "none" then _T("CREATE") else _T("UPDATE"), with button_name_and_new = if get_String(lwa, "id","none") = "none" then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"), - + with new_entry = if get_String(lwa, "id", "none") = "none" then true else false, partial_content( jq_datetimepicker_init(lang) + get_editor_header(vt_elist.list), //add editor header if need. Like init ck_editor cxm_form( table_name, lwa, - edit_form_lines(db, _T, vt_elist.list, [])+ + edit_form_lines(db, _T, vt_elist.list, new_entry, [])+ [ one_line_fields([ submit(save_row, failure, button_name, [("table_name", table_name)]), submit(save_row_and_new, failure, button_name_and_new, [("table_name", table_name)]), -- libgit2 0.21.4