Commit 8116ce4b2b93a70d5459cbd6729e9846aac9912f

Authored by totoro
1 parent c35a0960

continuation of the refactoring, and gather database call back in hk_table_controller

implement, insert or update, and update to CSV import
make clickable the text on Apps view
Fix bug on list view with filter which was not applied at first draw
add reference to foreign table in foreign_text of HK_Form_Entry
controller/hk_rows_import.anubis
@@ -111,20 +111,55 @@ define (Int, List(List(String))) @@ -111,20 +111,55 @@ define (Int, List(List(String)))
111 else 111 else
112 if cvs_line_reader(unique) is 112 if cvs_line_reader(unique) is
113 { 113 {
114 - end_of_input then (offset, so_far) 114 + end_of_input then println("END OF INPUT "+offset);(offset, so_far)
115 error(e) then 115 error(e) then
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)+"\"");
  120 +
119 //if line_data is (line, all_values) then 121 //if line_data is (line, all_values) then
120 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])
121 } 123 }
122 . 124 .
123 125
  126 +
  127 +define Result(String, One)
  128 + update_data_to_table
  129 + (
  130 + SQLite3Stmt update_data_stmt,
  131 + List(String) columns,
  132 + List(String) values
  133 + )=
  134 + if sqlite3_reset(update_data_stmt) is
  135 + {
  136 + error(err) then println(db_error(err, "Error reseting update data statement")); error("DB Error"),
  137 + ok then
  138 + //println("update reset ok");
  139 + if sqlite3_bind(update_data_stmt, map2_select(bind_column_value, columns, values)) is
  140 + {
  141 + error(err) then println(db_error(err, "Error binding update data statement"));error("DB Error"),
  142 + ok then
  143 + //println("update bind ok");
  144 + if sqlite3_step(update_data_stmt) is
  145 + {
  146 + error(err) then
  147 + println(db_error(err, "Error executing update data statement"));
  148 + error("DB Error"),
  149 + no_more_row then
  150 + ok(unique),
  151 + row(_) then
  152 + ok(unique)
  153 + }
  154 + }
  155 + }.
  156 +
124 define Result(String, One) 157 define Result(String, One)
125 - insert_data_to_table 158 + insert_or_update_data_to_table
126 ( 159 (
127 SQLite3Stmt insert_data_stmt, 160 SQLite3Stmt insert_data_stmt,
  161 + SQLite3Stmt update_data_stmt,
  162 + Bool update, //if true make update on constraint violation
128 List(String) columns, 163 List(String) columns,
129 List(String) values 164 List(String) values
130 )= 165 )=
@@ -138,9 +173,20 @@ define Result(String, One) @@ -138,9 +173,20 @@ define Result(String, One)
138 ok then 173 ok then
139 if sqlite3_step(insert_data_stmt) is 174 if sqlite3_step(insert_data_stmt) is
140 { 175 {
141 - error(err) then println(db_error(err, "Error executing insert data statement")); error("DB Error"),  
142 - no_more_row then ok(unique), 176 + error(err) then
  177 + //println(db_error(err, "Error executing insert data statement"));
  178 + forget(sqlite3_reset(insert_data_stmt));
  179 +
  180 + if err.code = 19 & update then
  181 + update_data_to_table(update_data_stmt, columns, values)
  182 + else
  183 + error("DB Error"),
  184 + no_more_row then ok(unique)
  185 + //println("insert no more row");
  186 + //update_data_to_table(update_data_stmt, columns, values),
143 row(_) then ok(unique) 187 row(_) then ok(unique)
  188 + //println("insert row");
  189 + //update_data_to_table(update_data_stmt, columns, values)
144 } 190 }
145 } 191 }
146 }. 192 }.
@@ -148,28 +194,33 @@ define Result(String, One) @@ -148,28 +194,33 @@ define Result(String, One)
148 define Maybe(One) 194 define Maybe(One)
149 store_data 195 store_data
150 ( 196 (
151 - SQLite3Stmt insert_data_stmt,  
152 - SQLite3Stmt update_data_stmt, 197 +// SQLite3Stmt insert_data_stmt,
  198 +// SQLite3Stmt update_data_stmt,
  199 +// Bool update,
  200 + List(String) -> Result(String, One) import_line_values,
153 // SQLite3Stmt select_contact_id_opt_out_stmt, 201 // SQLite3Stmt select_contact_id_opt_out_stmt,
154 // SQLite3Stmt select_stmt, 202 // SQLite3Stmt select_stmt,
155 // SQLite3Stmt insert_list_contact_stmt, 203 // SQLite3Stmt insert_list_contact_stmt,
156 // SQLite3Stmt count_stmt, 204 // SQLite3Stmt count_stmt,
157 - List(String) columns, //list of column's name 205 +
  206 +// List(String) columns, //list of column's name
158 List(List(String)) rows //list of list of real data to store 207 List(List(String)) rows //list of list of real data to store
159 ) = 208 ) =
160 if rows is 209 if rows is
161 { 210 {
162 - [] then success(unique), 211 + [] then
  212 + println("store data row empty");
  213 + success(unique),
163 [row . t] then 214 [row . t] then
164 - if insert_data_to_table(insert_data_stmt, columns, row) is 215 + if import_line_values(row) is //insert_or_update_data_to_table(insert_data_stmt, update_data_stmt, update, columns, row) is
165 { 216 {
166 error(msg) then 217 error(msg) then
167 println("data can't be added "+msg); 218 println("data can't be added "+msg);
168 //TODO as Julien's idea, copy error line in new csv file 219 //TODO as Julien's idea, copy error line in new csv file
169 - store_data(insert_data_stmt, update_data_stmt, columns, t), 220 + store_data(import_line_values, t),
170 221
171 ok(_) then 222 ok(_) then
172 - store_data(insert_data_stmt, update_data_stmt, columns, t) 223 + store_data(import_line_values, t)
173 } 224 }
174 } 225 }
175 . 226 .
@@ -179,9 +230,9 @@ define CSV_Import_Status @@ -179,9 +230,9 @@ define CSV_Import_Status
179 ( 230 (
180 SQLite3DataBase db, 231 SQLite3DataBase db,
181 // Int import_id, */ 232 // Int import_id, */
182 - SQLite3Stmt insert_data_stmt,  
183 - SQLite3Stmt update_data_stmt,  
184 - 233 +// SQLite3Stmt insert_data_stmt,
  234 +// SQLite3Stmt update_data_stmt,
  235 + List(String) -> Result(String, One) import_line_values,
185 One -> ReadCsvResult csv_line_reader, 236 One -> ReadCsvResult csv_line_reader,
186 //One -> Int progression, 237 //One -> Int progression,
187 UTime start_time, 238 UTime start_time,
@@ -201,22 +252,25 @@ define CSV_Import_Status @@ -201,22 +252,25 @@ define CSV_Import_Status
201 //get 500 lines from cvs 252 //get 500 lines from cvs
202 since extract_lines(csv_line_reader, 500, columns, _offset, []) is (offset, so_far), 253 since extract_lines(csv_line_reader, 500, columns, _offset, []) is (offset, so_far),
203 with extract_length = length(so_far), 254 with extract_length = length(so_far),
204 - println("Extracted lines : "+extract_length); 255 + //println("extraction: offset "+offset+" #lines "+extract_length);
205 256
206 if extract_length = 0 then 257 if extract_length = 0 then
207 csv_finished 258 csv_finished
208 else 259 else
209 if db_do_transaction( 260 if db_do_transaction(
210 db, 261 db,
211 - (One _) |-> store_data(insert_data_stmt, update_data_stmt, columns, so_far), 262 + (One _) |-> store_data(import_line_values, so_far),
212 success((SQLite3Error err) |-> println(db_error(err,"import_csv_to_db"))), 263 success((SQLite3Error err) |-> println(db_error(err,"import_csv_to_db"))),
213 //success((SQLite3Error err) |-> logError("DB", db_error(err,"import_csv_to_db"))), 264 //success((SQLite3Error err) |-> logError("DB", db_error(err,"import_csv_to_db"))),
214 60000, // max 60s 265 60000, // max 60s
215 100 // retry every 100 ms 266 100 // retry every 100 ms
216 ) is 267 ) is
217 { 268 {
218 - error(_) then csv_db_error,  
219 - ok(_) then main_loop(db, insert_data_stmt, update_data_stmt, csv_line_reader, new_time, columns, line_num + extract_length, offset, offset_base) 269 + error(_) then
  270 + println("main loop db_do_transaction csv_db_error");
  271 + csv_db_error,
  272 + ok(_) then
  273 + main_loop(db, import_line_values, csv_line_reader, new_time, columns, line_num + extract_length, offset, offset_base)
220 } 274 }
221 . 275 .
222 276
@@ -228,17 +282,17 @@ define CSV_Import_Status @@ -228,17 +282,17 @@ define CSV_Import_Status
228 // Import_Task import_task, 282 // Import_Task import_task,
229 One -> ReadCsvResult csv_line_reader, 283 One -> ReadCsvResult csv_line_reader,
230 //(One) -> Int progression, 284 //(One) -> Int progression,
  285 + String import_type,
231 List(String) columns, //columns selected for importation in same order from CSV file 286 List(String) columns, //columns selected for importation in same order from CSV file
  287 + String column_key,
232 UTime start_time, 288 UTime start_time,
233 Int offset_base 289 Int offset_base
234 )= 290 )=
235 //since import_task is import_task(import_task_id, list_id, filename, file_size, csv_db_columns, separator, charset, amount_time, offset, current_line, lines_count, status, status_details, update_contact, opt_out_import), 291 //since import_task is import_task(import_task_id, list_id, filename, file_size, csv_db_columns, separator, charset, amount_time, offset, current_line, lines_count, status, status_details, update_contact, opt_out_import),
236 with current_line = (Int)0, 292 with current_line = (Int)0,
237 with offset = (Int)0, 293 with offset = (Int)0,
238 -// if get_domain_id_from_mailing(db, list_id) is  
239 -// {  
240 -// failure then logError(debug_log, "domain_id not found in import_csv_to_mailing_list"); csv_error,  
241 -// success(domain_id) then 294 + with key = if column_key = "" then "id" else column_key,
  295 +
242 with filter_columns = map_select((String s) |-> if s = "" then failure else success(s), columns), 296 with filter_columns = map_select((String s) |-> if s = "" then failure else success(s), columns),
243 sql_columns = join(", ", filter_columns), 297 sql_columns = join(", ", filter_columns),
244 sql_values = join(", ", map((String s) |-> ":"+s, filter_columns)), 298 sql_values = join(", ", map((String s) |-> ":"+s, filter_columns)),
@@ -246,25 +300,36 @@ define CSV_Import_Status @@ -246,25 +300,36 @@ define CSV_Import_Status
246 300
247 if sqlite3_prepare(db, "INSERT INTO "+table_name+" ("+sql_columns+") VALUES ("+sql_values+");") is 301 if sqlite3_prepare(db, "INSERT INTO "+table_name+" ("+sql_columns+") VALUES ("+sql_values+");") is
248 { 302 {
249 - error(err) then //logError(debug_log, db_error(err, "preparing insert contact statement for import_csv_to_mailing_list")); 303 + error(err) then //logError(debug_log, db_error(err, "preparing insert contact statement for import _csv_to_mailing_list"));
250 println(db_error(err, "preparing insert data statement for import_csv_to_mailing_list")); 304 println(db_error(err, "preparing insert data statement for import_csv_to_mailing_list"));
251 csv_db_error, 305 csv_db_error,
252 ok(insert_data_stmt) then 306 ok(insert_data_stmt) then
253 -  
254 - if sqlite3_prepare(db, "UPDATE "+table_name+" SET " + sql_update_values + " WHERE id=:id;") is 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 "+key+"=:"+key+";",
  309 + println(" update query : "+update_query);
  310 + if sqlite3_prepare(db, update_query) is
255 { 311 {
256 error(err) then //logError(debug_log, db_error(err, "preparing update contact statement for import_csv_to_mailing_list")); 312 error(err) then //logError(debug_log, db_error(err, "preparing update contact statement for import_csv_to_mailing_list"));
257 println(db_error(err, "preparing update data statement for import_csv_to_db_transaction")); 313 println(db_error(err, "preparing update data statement for import_csv_to_db_transaction"));
258 csv_db_error, 314 csv_db_error,
259 ok(update_data_stmt) then 315 ok(update_data_stmt) then
260 /* run the main loop */ 316 /* run the main loop */
261 - main_loop(db, /*import_task_id, */ insert_data_stmt, update_data_stmt, csv_line_reader, start_time, columns, current_line, offset, offset_base) 317 + with import_line_values =
  318 + if import_type = "insert_or_update" then
  319 + (List(String) row) |-> insert_or_update_data_to_table(insert_data_stmt, update_data_stmt, true, columns, row)
  320 + else if import_type = "insert" then
  321 + (List(String) row) |-> insert_or_update_data_to_table(insert_data_stmt, update_data_stmt, false, columns, row)
  322 + else if import_type = "update" then
  323 + (List(String) row) |-> update_data_to_table(update_data_stmt, columns, row)
  324 + else
  325 + (List(String) row) |-> insert_or_update_data_to_table(insert_data_stmt, update_data_stmt, true, columns, row),
  326 +
  327 + main_loop(db, import_line_values, csv_line_reader, start_time, columns, current_line, offset, offset_base)
262 } 328 }
263 } 329 }
264 // } 330 // }
265 . 331 .
266 332
267 -  
268 public define Result(String, String) 333 public define Result(String, String)
269 hkc_import_execute 334 hkc_import_execute
270 ( 335 (
@@ -282,7 +347,9 @@ public define Result(String, String) @@ -282,7 +347,9 @@ public define Result(String, String)
282 with separator = get_String(lwa, "csv_sep", ";"), 347 with separator = get_String(lwa, "csv_sep", ";"),
283 with csv_db_columns = get_columns_list(lwa), 348 with csv_db_columns = get_columns_list(lwa),
284 with columns = get_db_columns(csv_db_columns, []), 349 with columns = get_db_columns(csv_db_columns, []),
  350 + column_key = get_String(lwa, "column_key", ""),
285 table_name = get_String(lwa, "table_name", ""), 351 table_name = get_String(lwa, "table_name", ""),
  352 + import_type = get_String(lwa, "import_type", "insert_or_update"),
286 with start_time = unow, 353 with start_time = unow,
287 offset_base = (Int)0, 354 offset_base = (Int)0,
288 skip_first_line = get_Bool(lwa, "hk_remove_csv_header", true), 355 skip_first_line = get_Bool(lwa, "hk_remove_csv_header", true),
@@ -306,9 +373,8 @@ public define Result(String, String) @@ -306,9 +373,8 @@ public define Result(String, String)
306 forget(csv_line_reader(unique)) 373 forget(csv_line_reader(unique))
307 else 374 else
308 unique); 375 unique);
309 - with status = import_csv_to_db_transaction(db, table_name, csv_line_reader, columns, start_time, offset_base), 376 + with status = import_csv_to_db_transaction(db, table_name, csv_line_reader, import_type, columns, column_key, start_time, offset_base),
310 ok("imported") 377 ok("imported")
311 -  
312 } 378 }
313 } 379 }
314 . 380 .
view/types/hk_form_entry.anubis
@@ -24,7 +24,7 @@ public type HK_Form_Entry: //legacy VT_Edit @@ -24,7 +24,7 @@ public type HK_Form_Entry: //legacy VT_Edit
24 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 24 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
25 text (String s_name, String c_name, String value, HK_Help_Text help), //s_name = show_name for translation, c_name = table column name 25 text (String s_name, String c_name, String value, HK_Help_Text help), //s_name = show_name for translation, c_name = table column name
26 password (String s_name, String c_name, HK_Help_Text help), //s_name = show_name for translation, c_name = table column name 26 password (String s_name, String c_name, HK_Help_Text help), //s_name = show_name for translation, c_name = table column name
27 - foreign_text(String s_name, String c_name, DB_id selected, HK_Form_Selector selector, HK_Help_Text help), 27 + foreign_text(String s_name, String c_name, DB_id selected, String f_table_name, HK_Form_Selector selector, HK_Help_Text help),
28 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_search(String s_name, String c_name, DB_id selected, String f_table_name, List(String) search_fields, HK_Help_Text help),
29 choices_text(String s_name, String c_name, String selected, HK_Form_Selector selector, HK_Help_Text help), 29 choices_text(String s_name, String c_name, String selected, HK_Form_Selector selector, HK_Help_Text help),
30 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 30 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
@@ -41,7 +41,7 @@ public type HK_Form_Entry: //legacy VT_Edit @@ -41,7 +41,7 @@ public type HK_Form_Entry: //legacy VT_Edit
41 . 41 .
42 42
43 public define HK_Form_Entry text (String s_name, String c_name, String value) = text (s_name, c_name, value, no_help_text). 43 public define HK_Form_Entry text (String s_name, String c_name, String value) = text (s_name, c_name, value, no_help_text).
44 -public define HK_Form_Entry foreign_text(String s_name, String c_name, DB_id selected, HK_Form_Selector selector) = foreign_text(s_name, c_name, selected, selector, no_help_text). 44 +public define HK_Form_Entry foreign_text(String s_name, String c_name, DB_id selected, String foreign_table_name, HK_Form_Selector selector) = foreign_text(s_name, c_name, selected, foreign_table_name, selector, no_help_text).
45 public define HK_Form_Entry text_area (String s_name, String c_name, String value) = text_area (s_name, c_name, value, none, no_help_text). 45 public define HK_Form_Entry text_area (String s_name, String c_name, String value) = text_area (s_name, c_name, value, none, no_help_text).
46 public define HK_Form_Entry boolean (String s_name, String c_name, Bool value) = boolean (s_name, c_name, value, no_help_text). 46 public define HK_Form_Entry boolean (String s_name, String c_name, Bool value) = boolean (s_name, c_name, value, no_help_text).
47 public define HK_Form_Entry integer (String s_name, String c_name, Int value) = integer (s_name, c_name, value, no_help_text). 47 public define HK_Form_Entry integer (String s_name, String c_name, Int value) = integer (s_name, c_name, value, no_help_text).
view/types/hk_view.anubis
@@ -91,16 +91,17 @@ public type VT_view_row_header: @@ -91,16 +91,17 @@ public type VT_view_row_header:
91 public type VT_view_row: 91 public type VT_view_row:
92 vt_view_row(Int db_id, List(VT_view_entry) list). 92 vt_view_row(Int db_id, List(VT_view_entry) list).
93 93
  94 +/*
94 public type VT_View_DB_Calls: 95 public type VT_View_DB_Calls:
95 vt_view_db_calls( 96 vt_view_db_calls(
96 - (SQLite3DataBase db, String clause) -> Int get_count,  
97 - (SQLite3DataBase db, HK_Referer referer, String clause, String order_by) -> JsonMember get_rows_json 97 + (SQLite3DataBase db, String clause) -> Int get_count,
  98 + (SQLite3DataBase db, HK_Referer referer, String clause, String order_by) -> JsonValue get_rows_json
98 // (SQLite3DataBase db, String clause) -> List(VT_view_row) get_rows 99 // (SQLite3DataBase db, String clause) -> List(VT_view_row) get_rows
99 ) 100 )
100 -. 101 +. */
101 102
102 public type VT_view: 103 public type VT_view:
103 - vt_view(String table_name, String view_name, VT_view_model view_model, VT_view_row_header header, VT_View_DB_Calls db_calls). 104 + vt_view(String table_name, String view_name, VT_view_model view_model, VT_view_row_header header).
104 105
105 106
106 public type HK_Form_action: 107 public type HK_Form_action:
view/view_apps_renderer.anubis
@@ -35,19 +35,19 @@ define List(HTML_Row(HTML_Off_Form)) @@ -35,19 +35,19 @@ define List(HTML_Row(HTML_Off_Form))
35 cell( 35 cell(
36 sequence([ 36 sequence([
37 partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id("edit_table_dlg_ajax"), "'table_name="+table_name+"'"))], "", [])), 37 partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id("edit_table_dlg_ajax"), "'table_name="+table_name+"'"))], "", [])),
38 - text(_T("ADD")), 38 + actioner(link([core_attrs([event(onclick, jq_dialog_open(dialog_id("edit_table_dlg_ajax"), "'table_name="+table_name+"'"))])],_T("ADD")), no_action, [])
39 ]) 39 ])
40 ), 40 ),
41 cell( 41 cell(
42 sequence([ 42 sequence([
43 partial(img_button(icn16_view_list, hkc_list_view, [("table_name",table_name)])), 43 partial(img_button(icn16_view_list, hkc_list_view, [("table_name",table_name)])),
44 - text(_T("LIST")) 44 + actioner(link(_T("LIST")), hkc_list_view, [("table_name",table_name)])
45 ]) 45 ])
46 ), 46 ),
47 cell( 47 cell(
48 sequence([ 48 sequence([
49 partial(img_button("icons/16x16/table_import.png", hkc_import_dropzone, [("table_name",table_name)])), 49 partial(img_button("icons/16x16/table_import.png", hkc_import_dropzone, [("table_name",table_name)])),
50 - text(_T("CSV_IMPORT")) 50 + actioner(link(_T("CSV_IMPORT")), hkc_import_dropzone, [("table_name",table_name)])
51 ]) 51 ])
52 ), 52 ),
53 cell(text(_T("RECORDS_COUNT")+" ")), 53 cell(text(_T("RECORDS_COUNT")+" ")),
view/view_rows_import.anubis
@@ -10,10 +10,12 @@ read locale/L3.anubis @@ -10,10 +10,12 @@ read locale/L3.anubis
10 read locale/L3LanguageInfo.anubis //date and time formating 10 read locale/L3LanguageInfo.anubis //date and time formating
11 read system/data_io.anubis 11 read system/data_io.anubis
12 read tools/line_reader.anubis 12 read tools/line_reader.anubis
  13 +read tools/basis.anubis
13 14
14 read calexium_lib/database/csv_tools.anubis 15 read calexium_lib/database/csv_tools.anubis
15 read calexium_lib/web/CXM_making_a_web_site.anubis 16 read calexium_lib/web/CXM_making_a_web_site.anubis
16 read calexium_lib/web/CXM_jquery.anubis 17 read calexium_lib/web/CXM_jquery.anubis
  18 +read calexium_lib/web/CXM_form.anubis
17 read calexium_lib/web/jQuery/CXM_jquery_button.anubis 19 read calexium_lib/web/jQuery/CXM_jquery_button.anubis
18 read calexium_lib/web/widgets/css_helper.anubis 20 read calexium_lib/web/widgets/css_helper.anubis
19 read calexium_lib/web/widgets/icons_set.anubis 21 read calexium_lib/web/widgets/icons_set.anubis
@@ -36,6 +38,18 @@ public define List((List(CoreAttrs), WebArgValue, String)) @@ -36,6 +38,18 @@ public define List((List(CoreAttrs), WebArgValue, String))
36 38
37 39
38 40
  41 +public define List((List(CoreAttrs), WebArgValue, String))
  42 + csv_import_type_combo
  43 + (
  44 + (String) -> String _T
  45 + )
  46 + =
  47 + (List((List(CoreAttrs), WebArgValue, String)))[
  48 + ([],wav("insert_or_update"), _T("INSERT_OR_UPDATE")),
  49 + ([],wav("insert"), _T("INSERT")),
  50 + ([],wav("update"), _T("UPDATE")),
  51 + ].
  52 +
39 public define HTML_Partial_Content 53 public define HTML_Partial_Content
40 import_zone 54 import_zone
41 ( 55 (
@@ -140,7 +154,7 @@ define List(HTML_Row(HTML_In_Form)) @@ -140,7 +154,7 @@ define List(HTML_Row(HTML_In_Form))
140 text(_T("IGNORED_COLUMN")), 154 text(_T("IGNORED_COLUMN")),
141 hidden(html_Id("hk_"+hidden_name+"_input"), wan(""), wav(hidden_name)) 155 hidden(html_Id("hk_"+hidden_name+"_input"), wan(""), wav(hidden_name))
142 ])), 156 ])),
143 - cell([class("icon ")],image([class("dnd-dst-btn")],"/icons/16x16/delete_cross.png","")) 157 + cell(image([class("dnd-dst-btn")],"/icons/16x16/delete_cross.png",""))
144 ]) 158 ])
145 . so_far], index+1, _T) 159 . so_far], index+1, _T)
146 }. 160 }.
@@ -173,6 +187,7 @@ public define HTML_Partial_Content @@ -173,6 +187,7 @@ public define HTML_Partial_Content
173 (String) -> String _T, 187 (String) -> String _T,
174 )= 188 )=
175 partial_content([css(css_file("css/cxm/cxm_dnd.css")), 189 partial_content([css(css_file("css/cxm/cxm_dnd.css")),
  190 + css(css_file("css/changelists.css")),
176 js(js_file("js/cxm/cxm_dnd.js")), 191 js(js_file("js/cxm/cxm_dnd.js")),
177 js(js_file("js/data_import.js")) 192 js(js_file("js/data_import.js"))
178 ], 193 ],
@@ -188,6 +203,8 @@ public define HTML_Partial_Content @@ -188,6 +203,8 @@ public define HTML_Partial_Content
188 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)),)]),
189 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"))]),
190 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"), wav("1"), 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)),)]),
  207 +
191 // 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
192 ]), 209 ]),
193 br, 210 br,
@@ -202,10 +219,7 @@ public define HTML_Partial_Content @@ -202,10 +219,7 @@ public define HTML_Partial_Content
202 219
203 div_empty([class("clear")]) 220 div_empty([class("clear")])
204 ])), 221 ])),
205 - //partial(jquery_button(jquery_img_button(icn16_cross, _T("CANCEL"), "", jQuery_actioner(same, jqlink, "go_edit_mailing_list&list_id="+list_id.id), left))),  
206 - //partial(jquery_button(jquery_img_button(icn16_check, _T("IMPORT"), "", jQuery_actioner(same, jqform, "import_csv_form"), left)))  
207 -  
208 - ])), //end of sequence in form 222 + ])), //end of sequence in form
209 // )]) 223 // )])
210 partial(jquery_button(jquery_img_button(icn16_cross, _T("CANCEL"), "", jQuery_actioner(same, jqlink(cancel_action)), left))), 224 partial(jquery_button(jquery_img_button(icn16_cross, _T("CANCEL"), "", jQuery_actioner(same, jqlink(cancel_action)), left))),
211 partial(img_submit_button(_T("IMPORT"), "import_csv_form")) 225 partial(img_submit_button(_T("IMPORT"), "import_csv_form"))
view/view_table_manager_types.anubis
@@ -12,6 +12,10 @@ transmit hayamiki_lib/view/types/hk_filter.anubis @@ -12,6 +12,10 @@ transmit hayamiki_lib/view/types/hk_filter.anubis
12 transmit calexium_lib/web/CXM_common.anubis 12 transmit calexium_lib/web/CXM_common.anubis
13 read hayamiki_lib/types/hayamiki.anubis 13 read hayamiki_lib/types/hayamiki.anubis
14 14
  15 +
  16 +read calexium_lib/web/CXM_common.anubis
  17 +read calexium_lib/database/db_types.anubis
  18 +
15 public type VTM_edit: 19 public type VTM_edit:
16 vtm_edit(String table_name, (SQLite3DataBase db, HK_Form_action action, String edit_view_name) -> HK_Form get_edit). 20 vtm_edit(String table_name, (SQLite3DataBase db, HK_Form_action action, String edit_view_name) -> HK_Form get_edit).
17 21
@@ -40,8 +44,8 @@ public type HK_Table_controller: @@ -40,8 +44,8 @@ public type HK_Table_controller:
40 (SQLite3DataBase db, List(Web_arg) lwa) -> Maybe(One) write_from_fields, 44 (SQLite3DataBase db, List(Web_arg) lwa) -> Maybe(One) write_from_fields,
41 //Read 45 //Read
42 (SQLite3DataBase db, String clause) -> Int get_count, 46 (SQLite3DataBase db, String clause) -> Int get_count,
43 - (SQLite3DataBase db, HK_Referer referer, String clause, String order_by) -> JsonMember get_rows_json,  
44 - 47 + (SQLite3DataBase db, List(String) columns, DB_id) -> JsonValue get_one_json,
  48 + (SQLite3DataBase db, List(String) columns, HK_Referer referer, String clause, String order_by) -> JsonValue get_rows_json,
45 //Update 49 //Update
46 //Delete 50 //Delete
47 (SQLite3DataBase db, List(Int) l_int) -> Maybe(One) delete 51 (SQLite3DataBase db, List(Int) l_int) -> Maybe(One) delete
view/view_table_renderer.anubis
@@ -18,6 +18,7 @@ read system/string.anubis @@ -18,6 +18,7 @@ read system/string.anubis
18 read locale/L3.anubis 18 read locale/L3.anubis
19 read tools/basis.anubis 19 read tools/basis.anubis
20 read tools/list.anubis 20 read tools/list.anubis
  21 +read tools/printable_tree.anubis
21 read data_base/sqlite.anubis 22 read data_base/sqlite.anubis
22 read system_colors/rgb.anubis 23 read system_colors/rgb.anubis
23 read system/convert.anubis 24 read system/convert.anubis
@@ -97,12 +98,17 @@ public define HK_Filter @@ -97,12 +98,17 @@ public define HK_Filter
97 get_filter_from_name 98 get_filter_from_name
98 ( 99 (
99 VTM_view vtm_v, //virtual table manager view 100 VTM_view vtm_v, //virtual table manager view
100 - String view_name, //  
101 - String filter_name 101 + String view_name, //view name where belonging the filters
  102 + String filter_name //the filter name to get
102 )= 103 )=
103 with all_view_name = vtm_v.get_all_view_name(unique), 104 with all_view_name = vtm_v.get_all_view_name(unique),
104 with filters = get_view_filters(view_name, all_view_name), 105 with filters = get_view_filters(view_name, all_view_name),
105 - 106 +
  107 + //we don't have any filter name to search for, hence we get the first entry
  108 + if filter_name = "" then
  109 + force_nth(0, filters, hk_filter("", ""))
  110 + else
  111 + //else try to get the filter according to his name
106 get_filter_from_name(filters, filter_name) 112 get_filter_from_name(filters, filter_name)
107 . 113 .
108 114
@@ -287,9 +293,8 @@ define String @@ -287,9 +293,8 @@ define String
287 autoResizing: { compact: true, resetWidthOrg: true }, 293 autoResizing: { compact: true, resetWidthOrg: true },
288 autoresizeOnLoad: true, 294 autoresizeOnLoad: true,
289 autowidth:true, 295 autowidth:true,
290 - /*idPrefix: '_g_"+uid+"_',*/  
291 - pager: '#"+uid+"_pager',  
292 - pager: true, 296 + viewrecords: true,
  297 + /*pager: true,*/
293 toppager: true, 298 toppager: true,
294 299
295 /*shrinkToFit:false,*/ 300 /*shrinkToFit:false,*/
@@ -400,7 +405,7 @@ url:'?aws_controller=hk_c&aws_action=grid_view&table_name="+rows.table_name+"&vi @@ -400,7 +405,7 @@ url:'?aws_controller=hk_c&aws_action=grid_view&table_name="+rows.table_name+"&vi
400 return $(cellObject.html()).css(\"backgroundColor\").substring(1); 405 return $(cellObject.html()).css(\"backgroundColor\").substring(1);
401 } 406 }
402 function formatPhone(cellValue, options, rowObject) { 407 function formatPhone(cellValue, options, rowObject) {
403 - var phoneInput = '<span class=\"hk_phone_call\"><img src=\\"/icons/16x16/phone.png\\" onclick=\"hk_phone_call(this);\">' + cellValue + '</span>'; 408 + var phoneInput = '<span class=\"hk_phone_call\"><img data-phone-number=\"'+cellValue+'\" src=\\"/icons/16x16/phone.png\\" onclick=\"hk_phone_call(this);\">' + cellValue + '</span>';
404 return phoneInput; 409 return phoneInput;
405 } 410 }
406 function unformatPhone(cellValue, options, cellObject) { 411 function unformatPhone(cellValue, options, cellObject) {
@@ -409,7 +414,7 @@ url:&#39;?aws_controller=hk_c&amp;aws_action=grid_view&amp;table_name=&quot;+rows.table_name+&quot;&amp;vi @@ -409,7 +414,7 @@ url:&#39;?aws_controller=hk_c&amp;aws_action=grid_view&amp;table_name=&quot;+rows.table_name+&quot;&amp;vi
409 return ret; 414 return ret;
410 } 415 }
411 function formatEmail(cellValue, options, rowObject) { 416 function formatEmail(cellValue, options, rowObject) {
412 - var phoneInput = '<span class=\"hk_send_email\"><img src=\\"/icons/16x16/email_edit.png\\" onclick=\"hk_send_email(this);\">' + cellValue + '</span>'; 417 + var phoneInput = '<span class=\"hk_send_email\"><img data-email=\"'+cellValue+'\" src=\\"/icons/16x16/email_edit.png\\" onclick=\"hk_send_email(this);\">' + cellValue + '</span>';
413 return phoneInput; 418 return phoneInput;
414 } 419 }
415 function unformatEmail(cellValue, options, cellObject) { 420 function unformatEmail(cellValue, options, cellObject) {
@@ -422,7 +427,7 @@ url:&#39;?aws_controller=hk_c&amp;aws_action=grid_view&amp;table_name=&quot;+rows.table_name+&quot;&amp;vi @@ -422,7 +427,7 @@ url:&#39;?aws_controller=hk_c&amp;aws_action=grid_view&amp;table_name=&quot;+rows.table_name+&quot;&amp;vi
422 div([], 427 div([],
423 sequence([ 428 sequence([
424 table([core_attrs([id(uid+"_grid")])],[]), 429 table([core_attrs([id(uid+"_grid")])],[]),
425 - div_empty([id(uid+"_pager")]) 430 + //DR 20170528 div_empty([id(uid+"_pager")])
426 ]) 431 ])
427 ) 432 )
428 ) 433 )
@@ -623,10 +628,26 @@ public define List(CXM_Form_Field) @@ -623,10 +628,26 @@ public define List(CXM_Form_Field)
623 password_entries 628 password_entries
624 ], 629 ],
625 630
626 - foreign_text(s_name, c_name, value, select, help) then  
627 - [selector_c([],label(_T(s_name), no_help), html_Id(""), wan(c_name), 1, select.get(db, table_referer, fk_clause), success(init(to_String(value))), mandatory), help_line(help, _T)],  
628 - foreign_text_search(s_name, c_name, select, table_name, fields, help) then  
629 - [raw_in_form(literal("<input id=\"acb_"+c_name+"\" type=\"text\">"))] 631 + foreign_text(s_name, c_name, value, foreign_table_name, select, help) then
  632 + with uid = generate_random_string(20)+"_",
  633 +
  634 + [selector_c([],label(_T(s_name), no_help), html_Id(""), wan(c_name), 1, select.get(db, table_referer, fk_clause), success(init(to_String(value))), mandatory), help_line(help, _T),
  635 +
  636 + partial(jq_dialog_create(dialog_id(uid+foreign_table_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&sub_dialog=true&table_name="+foreign_table_name)))),
  637 + partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+foreign_table_name+"_dlg_ajax")))], "", [])),
  638 + ],
  639 + foreign_text_search(s_name, c_name, select, foreign_table_name, fields, help) then
  640 + with uid = generate_random_string(20)+"_",
  641 + [
  642 + raw_in_form(sequence([
  643 + literal(to_String(format_label(label(_T(s_name), no_help), html_Id("")))+
  644 + "<input class=\"in\" id=\"acb_"+c_name+"\" data-init_record=\""+select+"\" size=\"50\" type=\"text\">"),
  645 + partial(jq_dialog_create(dialog_id(uid+foreign_table_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&sub_dialog=true&table_name="+foreign_table_name)))),
  646 + partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+foreign_table_name+"_dlg_ajax")))], "", [])),
  647 + ])
  648 + ),
  649 + help_line(help, _T)]
  650 +
630 choices_text(s_name, c_name, value, select, help) then 651 choices_text(s_name, c_name, value, select, help) then
631 [selector_c([],label(_T(s_name), no_help), html_Id(""), wan(c_name), 1, select.get(db, no_referer, ""), success(init(value)), mandatory), help_line(help, _T)], 652 [selector_c([],label(_T(s_name), no_help), html_Id(""), wan(c_name), 1, select.get(db, no_referer, ""), success(init(value)), mandatory), help_line(help, _T)],
632 text_area(s_name, c_name, value, txt_editor, help) then 653 text_area(s_name, c_name, value, txt_editor, help) then
@@ -649,9 +670,9 @@ public define List(CXM_Form_Field) @@ -649,9 +670,9 @@ public define List(CXM_Form_Field)
649 color( s_name, c_name, value, help) then 670 color( s_name, c_name, value, help) then
650 [input([class("jscolor")], label(_T(s_name), no_help), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], 671 [input([class("jscolor")], label(_T(s_name), no_help), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)],
651 phone( s_name, c_name, value, help) then 672 phone( s_name, c_name, value, help) then
652 - [input([class("hk_input_phone")], label(_T(s_name), no_help), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], 673 + [phone_input([event(onclick, "hk_phone_call(this)")], [class("hk_input_phone")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)],
653 email( s_name, c_name, value, help) then 674 email( s_name, c_name, value, help) then
654 - [input([class("hk_input_email")], label(_T(s_name), no_help), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], 675 + [email_input([event(onclick, "hk_send_email(this)")], [class("hk_input_email")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)],
655 }, 676 },
656 edit_form_lines(db, fk_clause, table_referer, _T, t, new_entry, reverse(line)+so_far) 677 edit_form_lines(db, fk_clause, table_referer, _T, t, new_entry, reverse(line)+so_far)
657 }. 678 }.
@@ -710,6 +731,26 @@ define List(String) @@ -710,6 +731,26 @@ define List(String)
710 _lines) 731 _lines)
711 . 732 .
712 733
  734 +define String
  735 + ajax_combo_init_parameter
  736 + (
  737 + String f_table, //db table name
  738 + String c_name, //column name in the table
  739 + List(String) s_fields //search fields
  740 + )=
  741 +"$('#acb_"+c_name+"').ajaxComboBox( '?aws_controller=hk_c&aws_action=combo_search',
  742 + {
  743 + lang: 'fr',
  744 + per_page: 15,
  745 + db_table: '"+f_table+"',
  746 + button_img: 'ajax-combobox/btn.png',
  747 + field: '"+force_nth(0, s_fields, "name")+"',
  748 + search_field: '"+join(", ", s_fields)+"',
  749 + hidden_name: '"+c_name+"',
  750 + show_string: '"+join(", ", s_fields)+"',
  751 + and_or: 'OR'
  752 + });"
  753 +.
713 754
714 define List(String) 755 define List(String)
715 _get_combo_header 756 _get_combo_header
@@ -724,15 +765,8 @@ define List(String) @@ -724,15 +765,8 @@ define List(String)
724 if cell is 765 if cell is
725 { 766 {
726 hk_form_table_cell(_, form_entry) then 767 hk_form_table_cell(_, form_entry) then
727 - if form_entry is foreign_text(s_name, c_name, value, select, help) then  
728 - with result =  
729 -"$('#acb_"+c_name+"').ajaxComboBox( '?aws_controller=hkc&aws_action=combo_action',  
730 - {  
731 - lang: 'fr',  
732 - db_table: '"+table_name+"',  
733 - button_img: 'ajax-combobox/btn.png'  
734 - });",  
735 - [result] 768 + if form_entry is foreign_text_search(s_name, c_name, select, f_table, s_fields, help) then
  769 + [ajax_combo_init_parameter(f_table, c_name, s_fields)]
736 else 770 else
737 [], 771 [],
738 hk_form_table_cell_table(_, t_lines) then 772 hk_form_table_cell_table(_, t_lines) then
@@ -755,6 +789,7 @@ define List(HTML_Head_Tag) @@ -755,6 +789,7 @@ define List(HTML_Head_Tag)
755 else 789 else
756 [] 790 []
757 . 791 .
  792 +
758 define List(HTML_Head_Tag) 793 define List(HTML_Head_Tag)
759 get_combo_header 794 get_combo_header
760 ( 795 (
@@ -770,6 +805,38 @@ define List(HTML_Head_Tag) @@ -770,6 +805,38 @@ define List(HTML_Head_Tag)
770 else 805 else
771 [] 806 []
772 . 807 .
  808 +
  809 +define List(String)
  810 + _get_combo_header
  811 + (
  812 + String table_name,
  813 + List(HK_Form_Entry) _entries
  814 + )=
  815 + map_append((HK_Form_Entry entry)
  816 + |->
  817 + if entry is foreign_text_search(s_name, c_name, select, f_table, s_fields, help) then
  818 + [ajax_combo_init_parameter(f_table, c_name, s_fields)]
  819 + else
  820 + []
  821 + ,
  822 + _entries)
  823 +.
  824 +
  825 +define List(HTML_Head_Tag)
  826 + get_combo_header
  827 + (
  828 + String table_name,
  829 + List(HK_Form_Entry) _lines
  830 + )=
  831 + with result = _get_combo_header(table_name, _lines),
  832 + if length(result) > 0 then
  833 + [js(js_file("ajax-combobox/js/jquery.ajax-combobox.js")),
  834 + css(css_file("ajax-combobox/css/jquery.ajax-combobox.css")),
  835 + js_inline(jquery_ready(join("",result)))
  836 + ]
  837 + else
  838 + []
  839 + .
773 840
774 public define HTML_Partial_Content 841 public define HTML_Partial_Content
775 renderer_edit_list_form 842 renderer_edit_list_form
@@ -793,6 +860,8 @@ public define HTML_Partial_Content @@ -793,6 +860,8 @@ public define HTML_Partial_Content
793 //true if need to create row or false for updating 860 //true if need to create row or false for updating
794 with create = if get_String(lwa, "id","none") = "none" then true else false, 861 with create = if get_String(lwa, "id","none") = "none" then true else false,
795 with id = get_String(lwa, "id","none"), 862 with id = get_String(lwa, "id","none"),
  863 + with sub_dialog = get_String(lwa, "sub_dialog", "false"),
  864 +
796 with button_name = if create then _T("CREATE") else _T("UPDATE"), 865 with button_name = if create then _T("CREATE") else _T("UPDATE"),
797 with button_name_and_new = if create then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"), 866 with button_name_and_new = if create then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"),
798 867
@@ -807,13 +876,14 @@ public define HTML_Partial_Content @@ -807,13 +876,14 @@ public define HTML_Partial_Content
807 $('#my-awesome-dropzone').dropzone(); ")), 876 $('#my-awesome-dropzone').dropzone(); ")),
808 ]+ 877 ]+
809 jq_datetimepicker_init(lang) + 878 jq_datetimepicker_init(lang) +
810 - get_editor_header(list_entries), //add editor header if need. Like init ck_editor 879 + get_editor_header(list_entries)+ //add editor header if need. Like init ck_editor
  880 + get_combo_header(table_name, list_entries),
811 sequence([ 881 sequence([
812 cxm_form( table_name, lwa, 882 cxm_form( table_name, lwa,
813 [ one_line_fields([ 883 [ one_line_fields([
814 - submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name)]),  
815 - submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name)]),  
816 - submit(hkc_cancel, failure, _T("CANCEL")) 884 + submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name), ("sub_dialog", sub_dialog)]),
  885 + submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name), ("sub_dialog", sub_dialog)]),
  886 + submit(hkc_cancel, failure, _T("CANCEL"), [("sub_dialog", sub_dialog)])
817 ]), 887 ]),
818 hr 888 hr
819 ]+edit_form_lines(db, "", table_referer, _T, list_entries, create, []) 889 ]+edit_form_lines(db, "", table_referer, _T, list_entries, create, [])
@@ -834,9 +904,9 @@ public define HTML_Partial_Content @@ -834,9 +904,9 @@ public define HTML_Partial_Content
834 ,list_tabs))+ 904 ,list_tabs))+
835 [ hr, 905 [ hr,
836 one_line_fields([ 906 one_line_fields([
837 - submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name)]),  
838 - submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name)]),  
839 - submit(hkc_cancel, failure, _T("CANCEL")) 907 + submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name), ("sub_dialog", sub_dialog)]),
  908 + submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name), ("sub_dialog", sub_dialog)]),
  909 + submit(hkc_cancel, failure, _T("CANCEL"), [("sub_dialog", sub_dialog)])
840 ]) 910 ])
841 ] 911 ]
842 ), 912 ),
@@ -887,11 +957,12 @@ public define List(CXM_Form_Field) @@ -887,11 +957,12 @@ public define List(CXM_Form_Field)
887 password_entries 957 password_entries
888 ], 958 ],
889 959
890 - foreign_text(s_name, c_name, value, select, help) then 960 + foreign_text(s_name, c_name, value, foreign_table_name, select, help) then
891 [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)], 961 [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)],
892 - //[selector_c([],label(_T(s_name), no_help), html_Id(""), wan(c_name), 1, select.get(db, table_referer, fk_clause), success(init(to_String(value))), mandatory), help_line(help, _T)],  
893 - foreign_text_search(s_name, c_name, select, f_table, s_fields, help) then  
894 - [raw_in_form(literal("<input id=\"acb_"+c_name+"\" type=\"text\">"))], 962 +
  963 + foreign_text_search(s_name, c_name, select, foreign_table_name, s_fields, help) then
  964 + [raw_in_form(literal("<input class=\"in\" id=\"acb_"+c_name+"\" data-init_record=\""+select+"\" size=\"50\" type=\"text\">"))]
  965 +// [raw_in_form(literal("<input class=\"in\" id=\"acb_"+c_name+"\" type=\"text\">"))],
895 966
896 choices_text(s_name, c_name, value, select, help) then 967 choices_text(s_name, c_name, value, select, help) then
897 [selector_c([],no_label, html_Id(""), wan(c_name), 1, select.get(db, no_referer, ""), success(init(value)), mandatory), help_line(help, _T)], 968 [selector_c([],no_label, html_Id(""), wan(c_name), 1, select.get(db, no_referer, ""), success(init(value)), mandatory), help_line(help, _T)],
@@ -915,9 +986,9 @@ public define List(CXM_Form_Field) @@ -915,9 +986,9 @@ public define List(CXM_Form_Field)
915 color( s_name, c_name, value, help) then 986 color( s_name, c_name, value, help) then
916 [input([class("jscolor")], no_label, wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], 987 [input([class("jscolor")], no_label, wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)],
917 phone( s_name, c_name, value, help) then 988 phone( s_name, c_name, value, help) then
918 - [input([class("hk_input_phone")], no_label, wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], 989 + [phone_input([event(onclick, "hk_phone_call(this)"), class("phone_click")], [class("hk_input_phone")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)],
919 email( s_name, c_name, value, help) then 990 email( s_name, c_name, value, help) then
920 - [input([class("hk_input_email")], no_label, wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)], 991 + [email_input([event(onclick, "hk_send_email(this)"), class("email_click")], [class("hk_input_email")], label(_T(s_name), no_help), html_Id(c_name), wan(c_name), init(not_null_String(value)), narrow, mandatory), help_line(help, _T)],
921 992
922 }. 993 }.
923 994