Commit 6ad846b4dc7ff3ab41cd33262dfe68e3de9c6952
1 parent
95ca2d08
manage password entry in view_table_renderer
Showing
1 changed file
with
19 additions
and
6 deletions
Show diff stats
view/view_table_renderer.anubis
| ... | ... | @@ -57,6 +57,7 @@ public define List(CXM_Form_Field) |
| 57 | 57 | SQLite3DataBase db, |
| 58 | 58 | (String) -> String _T, |
| 59 | 59 | List(VT_edit_entry) list, |
| 60 | + Bool new_entry, | |
| 60 | 61 | List(CXM_Form_Field) so_far |
| 61 | 62 | )= |
| 62 | 63 | if list is |
| ... | ... | @@ -76,9 +77,21 @@ public define List(CXM_Form_Field) |
| 76 | 77 | text(s_name, c_name, value, help) then |
| 77 | 78 | [input(label(_T(s_name), no_help), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], |
| 78 | 79 | password(s_name, c_name, help) then |
| 79 | - [password_input(label(_T(s_name), no_help), wan(c_name+"_1"), init(""), narrow, non_mandatory), | |
| 80 | - password_input(label(_T(s_name), no_help), wan(c_name+"_2"), init(""), narrow, non_mandatory), | |
| 81 | - help_line(help, _T)], | |
| 80 | + with password_entries = | |
| 81 | + [ password_input(label(_T(s_name), no_help), wan(c_name+"_1"), init(""), narrow, non_mandatory), | |
| 82 | + password_input(label(_T(s_name), no_help), wan(c_name+"_2"), init(""), narrow, non_mandatory), | |
| 83 | + help_line(help, _T) | |
| 84 | + ], | |
| 85 | + | |
| 86 | + if new_entry = false then | |
| 87 | + [ checkbox_hide_show([], label(_T("CLICK_TO_CHANGE_PASSWORD")), wan(c_name+"_pwd_change"), wav("on"), false, //not checked at first | |
| 88 | + password_entries), | |
| 89 | + hidden(html_Id(""), wan(c_name+"_pwd_change_option"), wav("true")) | |
| 90 | + ] | |
| 91 | + else | |
| 92 | + [ hidden(html_Id(""), wan(c_name+"_pwd_change_option"), wav("false")) . | |
| 93 | + password_entries | |
| 94 | + ], | |
| 82 | 95 | |
| 83 | 96 | foreign_text(s_name, c_name, value, select, help) then |
| 84 | 97 | [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) |
| 102 | 115 | datetime(s_name, c_name, value, help) then |
| 103 | 116 | [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)], |
| 104 | 117 | }, |
| 105 | - edit_form_lines(db, _T, t, reverse(line)+so_far) | |
| 118 | + edit_form_lines(db, _T, t, new_entry, reverse(line)+so_far) | |
| 106 | 119 | }. |
| 107 | 120 | |
| 108 | 121 | define HTML_Head_Tag |
| ... | ... | @@ -143,13 +156,13 @@ public define HTML_Partial_Content |
| 143 | 156 | with table_name = vt_elist.table_name, |
| 144 | 157 | with button_name = if get_String(lwa, "id","none") = "none" then _T("CREATE") else _T("UPDATE"), |
| 145 | 158 | with button_name_and_new = if get_String(lwa, "id","none") = "none" then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"), |
| 146 | - | |
| 159 | + with new_entry = if get_String(lwa, "id", "none") = "none" then true else false, | |
| 147 | 160 | |
| 148 | 161 | partial_content( |
| 149 | 162 | jq_datetimepicker_init(lang) + |
| 150 | 163 | get_editor_header(vt_elist.list), //add editor header if need. Like init ck_editor |
| 151 | 164 | cxm_form( table_name, lwa, |
| 152 | - edit_form_lines(db, _T, vt_elist.list, [])+ | |
| 165 | + edit_form_lines(db, _T, vt_elist.list, new_entry, [])+ | |
| 153 | 166 | [ one_line_fields([ |
| 154 | 167 | submit(save_row, failure, button_name, [("table_name", table_name)]), |
| 155 | 168 | submit(save_row_and_new, failure, button_name_and_new, [("table_name", table_name)]), | ... | ... |