Commit 0e255eaa0482c4f749081056eb5049ec6c309a7c
1 parent
55c024e5
update to be compatible with calexium_lib and checkbox without wav (web arg value)
Showing
3 changed files
with
12 additions
and
11 deletions
Show diff stats
controller/hk_rows_import.anubis
| @@ -116,7 +116,7 @@ define (Int, List(List(String))) | @@ -116,7 +116,7 @@ define (Int, List(List(String))) | ||
| 116 | //TODO report that error in importation report | 116 | //TODO report that error in importation report |
| 117 | println("error ["+e+"]\n"); (offset, so_far), | 117 | println("error ["+e+"]\n"); (offset, so_far), |
| 118 | ok(_offset, all_values) then | 118 | ok(_offset, all_values) then |
| 119 | - println("extracted line : \""+join("\", ", all_values)+"\""); | 119 | + println("extracted line : \""+join("\", \"", all_values)+"\""); |
| 120 | 120 | ||
| 121 | //if line_data is (line, all_values) then | 121 | //if line_data is (line, all_values) then |
| 122 | extract_lines(cvs_line_reader, max_count - 1, columns, _offset, [all_values . so_far]) | 122 | extract_lines(cvs_line_reader, max_count - 1, columns, _offset, [all_values . so_far]) |
| @@ -174,7 +174,7 @@ define Result(String, One) | @@ -174,7 +174,7 @@ define Result(String, One) | ||
| 174 | if sqlite3_step(insert_data_stmt) is | 174 | if sqlite3_step(insert_data_stmt) is |
| 175 | { | 175 | { |
| 176 | error(err) then | 176 | error(err) then |
| 177 | - //println(db_error(err, "Error executing insert data statement")); | 177 | + println(db_error(err, "Error executing insert data statement")); |
| 178 | forget(sqlite3_reset(insert_data_stmt)); | 178 | forget(sqlite3_reset(insert_data_stmt)); |
| 179 | 179 | ||
| 180 | if err.code = 19 & update then | 180 | if err.code = 19 & update then |
| @@ -293,10 +293,11 @@ define CSV_Import_Status | @@ -293,10 +293,11 @@ define CSV_Import_Status | ||
| 293 | with offset = (Int)0, | 293 | with offset = (Int)0, |
| 294 | with key = if column_key = "" then "id" else column_key, | 294 | with key = if column_key = "" then "id" else column_key, |
| 295 | 295 | ||
| 296 | - with filter_columns = map_select((String s) |-> if s = "" then failure else success(s), columns), | ||
| 297 | - sql_columns = join(", ", filter_columns), | 296 | + with filter_columns_esc = map_select((String s) |-> if s = "" then failure else success("\""+s+"\""), columns), |
| 297 | + with filter_columns = map_select((String s) |-> if s = "" then failure else success(s), columns), | ||
| 298 | + sql_columns = join(", ", filter_columns_esc), | ||
| 298 | sql_values = join(", ", map((String s) |-> ":"+s, filter_columns)), | 299 | sql_values = join(", ", map((String s) |-> ":"+s, filter_columns)), |
| 299 | - with sql_update_values = join(", ", map((String s) |-> s+"=:"+s, filter_columns)), | 300 | + with sql_update_values = join(", ", map((String s) |-> "\""+s+"\" = :"+s, filter_columns)), |
| 300 | 301 | ||
| 301 | if sqlite3_prepare(db, "INSERT INTO "+table_name+" ("+sql_columns+") VALUES ("+sql_values+");") is | 302 | if sqlite3_prepare(db, "INSERT INTO "+table_name+" ("+sql_columns+") VALUES ("+sql_values+");") is |
| 302 | { | 303 | { |
| @@ -305,7 +306,7 @@ define CSV_Import_Status | @@ -305,7 +306,7 @@ define CSV_Import_Status | ||
| 305 | csv_db_error, | 306 | csv_db_error, |
| 306 | ok(insert_data_stmt) then | 307 | ok(insert_data_stmt) then |
| 307 | // with update_query = "UPDATE "+table_name+" SET " + sql_update_values + " WHERE changes()=0 AND "+key+"=:"+key+";", | 308 | // with update_query = "UPDATE "+table_name+" SET " + sql_update_values + " WHERE changes()=0 AND "+key+"=:"+key+";", |
| 308 | - with update_query = "UPDATE "+table_name+" SET " + sql_update_values + " WHERE "+key+"=:"+key+";", | 309 | + with update_query = "UPDATE "+table_name+" SET " + sql_update_values + " WHERE \""+key+"\" = :"+key+";", |
| 309 | println(" update query : "+update_query); | 310 | println(" update query : "+update_query); |
| 310 | if sqlite3_prepare(db, update_query) is | 311 | if sqlite3_prepare(db, update_query) is |
| 311 | { | 312 | { |
view/view_rows_import.anubis
| @@ -202,7 +202,7 @@ public define HTML_Partial_Content | @@ -202,7 +202,7 @@ public define HTML_Partial_Content | ||
| 202 | row([], [cell(image(icn16_mime_unknown)), cell(text(_T("SOURCE_FILE_TO_IMPORT"))), cell(text(uploaded_file))]), | 202 | row([], [cell(image(icn16_mime_unknown)), cell(text(_T("SOURCE_FILE_TO_IMPORT"))), cell(text(uploaded_file))]), |
| 203 | row([], [cell(empty), cell(text(_T("DELIMITER"))), cell(selector_c([], no_label, html_Id("import_delimiter"), wan("csv_sep"), 1, csv_delimiter_combo(_T), init(separator)),)]), | 203 | row([], [cell(empty), cell(text(_T("DELIMITER"))), cell(selector_c([], no_label, html_Id("import_delimiter"), wan("csv_sep"), 1, csv_delimiter_combo(_T), init(separator)),)]), |
| 204 | row([], [cell(empty), cell(text(_T("FILE_ENCODING"))), cell(text("choose encoding"))]), | 204 | row([], [cell(empty), cell(text(_T("FILE_ENCODING"))), cell(text("choose encoding"))]), |
| 205 | - row([], [cell(empty), cell(text(_T("REMOVE_CSV_HEADER"))), cell(check_box([], no_label, html_Id(""), wan("hk_remove_csv_header"), wav("1"), true))]), | 205 | + row([], [cell(empty), cell(text(_T("REMOVE_CSV_HEADER"))), cell(check_box([], no_label, html_Id(""), wan("hk_remove_csv_header"), true))]), |
| 206 | row([], [cell(empty), cell(text(_T("IMPORT_TYPE"))), cell(selector_c([], no_label, html_Id("import_type"), wan("import_type"), 1, csv_import_type_combo(_T), init(separator)),)]), | 206 | row([], [cell(empty), cell(text(_T("IMPORT_TYPE"))), cell(selector_c([], no_label, html_Id("import_type"), wan("import_type"), 1, csv_import_type_combo(_T), init(separator)),)]), |
| 207 | 207 | ||
| 208 | // row([], [cell(empty), cell(text(_T("OPT_OUT"))), cell(check_box([], no_label, html_Id(""), wan("import_opt_out"), wav("1"), false))])] //end of row | 208 | // row([], [cell(empty), cell(text(_T("OPT_OUT"))), cell(check_box([], no_label, html_Id(""), wan("import_opt_out"), wav("1"), false))])] //end of row |
view/view_table_renderer.anubis
| @@ -643,7 +643,7 @@ public define List(CXM_Form_Field) | @@ -643,7 +643,7 @@ public define List(CXM_Form_Field) | ||
| 643 | ], | 643 | ], |
| 644 | 644 | ||
| 645 | if new_entry = false then | 645 | if new_entry = false then |
| 646 | - [ checkbox_hide_show([], label(_T("CLICK_TO_CHANGE_PASSWORD")), wan(c_name+"_pwd_change"), wav("on"), false, //not checked at first | 646 | + [ checkbox_hide_show([], label(_T("CLICK_TO_CHANGE_PASSWORD")), wan(c_name+"_pwd_change"), false, //not checked at first |
| 647 | password_entries), | 647 | password_entries), |
| 648 | hidden(html_Id(""), wan(c_name+"_pwd_change_option"), wav("true")) | 648 | hidden(html_Id(""), wan(c_name+"_pwd_change_option"), wav("true")) |
| 649 | ] | 649 | ] |
| @@ -704,7 +704,7 @@ public define List(CXM_Form_Field) | @@ -704,7 +704,7 @@ public define List(CXM_Form_Field) | ||
| 704 | ], | 704 | ], |
| 705 | 705 | ||
| 706 | boolean(s_name, c_name, value, help) then | 706 | boolean(s_name, c_name, value, help) then |
| 707 | - [checkboxr([],label(_T(s_name), no_help), html_Id(""), wan(c_name), wav("true"),value, mandatory), help_line(help, _T)], | 707 | + [checkboxr([],label(_T(s_name), no_help), html_Id(""), wan(c_name), value, mandatory), help_line(help, _T)], |
| 708 | integer(s_name, c_name, value, help) then | 708 | integer(s_name, c_name, value, help) then |
| 709 | [input(label(_T(s_name), no_help), wan(c_name), init(abs_to_decimal(value)), small, mandatory), help_line(help, _T)], | 709 | [input(label(_T(s_name), no_help), wan(c_name), init(abs_to_decimal(value)), small, mandatory), help_line(help, _T)], |
| 710 | float(s_name, c_name, value, help) then | 710 | float(s_name, c_name, value, help) then |
| @@ -854,7 +854,7 @@ public define List(CXM_Form_Field) | @@ -854,7 +854,7 @@ public define List(CXM_Form_Field) | ||
| 854 | ], | 854 | ], |
| 855 | 855 | ||
| 856 | if new_entry = false then | 856 | if new_entry = false then |
| 857 | - [ checkbox_hide_show([], label(_T("CLICK_TO_CHANGE_PASSWORD")), wan(c_name+"_pwd_change"), wav("on"), false, //not checked at first | 857 | + [ checkbox_hide_show([], label(_T("CLICK_TO_CHANGE_PASSWORD")), wan(c_name+"_pwd_change"), false, //not checked at first |
| 858 | password_entries), | 858 | password_entries), |
| 859 | hidden(html_Id(""), wan(c_name+"_pwd_change_option"), wav("true")) | 859 | hidden(html_Id(""), wan(c_name+"_pwd_change_option"), wav("true")) |
| 860 | ] | 860 | ] |
| @@ -914,7 +914,7 @@ public define List(CXM_Form_Field) | @@ -914,7 +914,7 @@ public define List(CXM_Form_Field) | ||
| 914 | text_area([],no_label, html_Id(id), wan(c_name), init(not_null_String(value)), narrow, (Int)5, mandatory), help_line(help, _T)], | 914 | text_area([],no_label, html_Id(id), wan(c_name), init(not_null_String(value)), narrow, (Int)5, mandatory), help_line(help, _T)], |
| 915 | 915 | ||
| 916 | boolean(s_name, c_name, value, help) then | 916 | boolean(s_name, c_name, value, help) then |
| 917 | - [checkboxr([],no_label, html_Id(""), wan(c_name), wav("true"),value, mandatory), help_line(help, _T)], | 917 | + [checkboxr([],no_label, html_Id(""), wan(c_name), value, mandatory), help_line(help, _T)], |
| 918 | integer(s_name, c_name, value, help) then | 918 | integer(s_name, c_name, value, help) then |
| 919 | [input(no_label, wan(c_name), init(abs_to_decimal(value)), small, mandatory), help_line(help, _T)], | 919 | [input(no_label, wan(c_name), init(abs_to_decimal(value)), small, mandatory), help_line(help, _T)], |
| 920 | float(s_name, c_name, value, help) then | 920 | float(s_name, c_name, value, help) then |