Commit 546d5e5da0dfc001067c59389980ed6915a60c59

Authored by totoro
1 parent 7a8ff83c

continue refactoring

view/jqgrid.anubis
... ... @@ -8,7 +8,7 @@
8 8  
9 9 read calexium_lib/web/CXM_making_a_web_site.anubis
10 10 read hayamiki_lib/types/hayamiki.anubis
11   -read view_table_types.anubis
  11 +read hayamiki_lib/view/types/hk_form.anubis
12 12  
13 13 define String
14 14 to_jqGrid_selector
... ...
view/types/hk_form_table_cell.anubis
1   -/*
  1 +/*
2 2 * Created by 伝作 (Densaku).
3 3 * Types & Messages generator written by フランスのトトロ aka (David RENÉ)
4 4 * Date: 2017-04-04
... ... @@ -33,9 +33,9 @@ public define Message
33 33 {
34 34 //Alternative hk_form_table_cell
35 35 hk_form_table_cell(_form_entry) then
36   - forget(add_string(_hk_form_table_cell_message, "__TYPE_ALT__", "hk_form_table_cell"));
  36 + forget(add_string(_hk_form_table_cell_message, "__TYPE_ALT__", "hk_form_table_cell"))
37 37 // [type = HK_Form_Entry] hk_form_table_cell.form_entry
38   - forget(add_message(_hk_form_table_cell_message, "form_entry", to_Message(_form_entry))),
  38 + //forget(add_message(_hk_form_table_cell_message, "form_entry", to_Message(_form_entry))),
39 39  
40 40 };
41 41 _hk_form_table_cell_message
... ... @@ -52,8 +52,8 @@ public define Maybe(HK_Form_Table_Cell)
52 52 //Alternative hk_form_table_cell
53 53 if __type_alt__ = "hk_form_table_cell" then //Alternative hk_form_table_cell
54 54 // [type = HK_Form_Entry] hk_form_table_cell.form_entry
55   - if find_message(_hk_form_table_cell_message, "form_entry") is {failure then failure, success(form_entry_msg) then
56   - if (Maybe(HK_Form_Entry))from_Message(form_entry_msg) is {failure then failure, success(form_entry) then
  55 + //if find_message(_hk_form_table_cell_message, "form_entry") is {failure then failure, success(form_entry_msg) then
  56 + // if (Maybe(HK_Form_Entry))from_Message(form_entry_msg) is {failure then failure, success(form_entry) then
57 57  
58 58 success(hk_form_table_cell(form_entry))
59 59 }}
... ...
view/view_editor_renderer.anubis
... ... @@ -12,7 +12,7 @@ read hayamiki_lib/view/view_table_manager_types.anubis
12 12 read hayamiki_lib/view/view_table_manager.anubis
13 13 read hayamiki_lib/types/hayamiki.anubis
14 14  
15   -public define Maybe(HTML_Partial_Content)
  15 + public define Maybe(HTML_Partial_Content)
16 16 view_editor_content
17 17 (
18 18 SQLite3DataBase db,
... ... @@ -22,7 +22,7 @@ public define Maybe(HTML_Partial_Content)
22 22 List(Web_arg) lwa,
23 23 String table, //table name
24 24 String view_name, //view name to use
25   - VT_action action, //new_entry or edit an existing record
  25 + HK_Form_action action, //new_entry or edit an existing record
26 26 VTM vtm,
27 27 String clause,
28 28 String fk_clause,
... ...
view/view_table_manager.anubis
... ... @@ -6,7 +6,7 @@
6 6 */
7 7  
8 8 read tools/basis.anubis
9   -transmit hayamiki_lib/view/view_table_types.anubis
  9 +transmit hayamiki_lib/view/types/hk_form.anubis
10 10 transmit hayamiki_lib/view/view_table_manager_types.anubis
11 11  
12 12 public define Maybe(VTM_view)
... ...
view/view_table_manager_types.anubis
... ... @@ -6,11 +6,11 @@
6 6 *
7 7 */
8 8  
9   -read hayamiki_lib/view/view_table_types.anubis
  9 +read hayamiki_lib/view/types/hk_form.anubis
10 10 read calexium_lib/web/CXM_common.anubis
11 11  
12 12 public type VTM_edit:
13   - vtm_edit(String table_name, (SQLite3DataBase db, VT_action action, String edit_view_name) -> VT_edit get_edit).
  13 + vtm_edit(String table_name, (SQLite3DataBase db, HK_Form_action action, String edit_view_name) -> HK_Form get_edit).
14 14  
15 15 public type VTM_edit_list:
16 16 vtm_edit_list(List(VTM_edit) list).
... ...
view/view_table_renderer.anubis
... ... @@ -7,6 +7,7 @@
7 7 */
8 8  
9 9 read hayamiki_lib/view/types/hk_form_entry.anubis
  10 +read hayamiki_lib/view/types/hk_form.anubis
10 11 read hayamiki_lib/view/jqgrid.anubis
11 12 read hayamiki_lib/view/view_table_manager_types.anubis
12 13 read hayamiki_lib/view/view_table_manager.anubis
... ... @@ -390,7 +391,9 @@ public define List(CXM_Form_Field)
390 391 {
391 392 hidden(name, value) then
392 393 //print("hidden "+name+" = "+value);
393   - [hidden(html_Id(""), wan(name), wav(value))],
  394 + [hidden(html_Id(""), wan(name), wav(value))],
  395 + label(name) then
  396 + [div([],text(name))],
394 397 primary_key(idx) then
395 398 [hidden(html_Id(""), wan("id"), wav(idx))],
396 399 information(s_name, c_name, value, width, help) then
... ... @@ -444,10 +447,10 @@ public define List(CXM_Form_Field)
444 447 define HTML_Head_Tag
445 448 get_rich_editor_inline
446 449 (
447   - List(VT_edit_entry) list
  450 + List(HK_Form_Entry) list
448 451 )=
449 452 js_inline(jquery_ready(
450   - join("",map_select((VT_edit_entry entry) |->
  453 + join("",map_select((HK_Form_Entry entry) |->
451 454 if entry is text_area(s_name, c_name, value, txt_editor, help) then
452 455 if txt_editor is { none then failure,
453 456 rich_editor then success(" CKEDITOR.replace( '"+c_name+"_editor' );")
... ... @@ -468,14 +471,14 @@ define List(HTML_Head_Tag)
468 471 .
469 472  
470 473 public define HTML_Partial_Content
471   - edit_table_form
  474 + renderer_edit_form
472 475 (
473 476 SQLite3DataBase db,
474 477 (String) -> String _T,
475 478 String lang,
476 479 String web_site_directory,
477 480 List(Web_arg) lwa,
478   - VT_edit vt_elist,
  481 + HK_Form edit_form,
479 482 VTM vtm,
480 483 String clause,
481 484 String fk_clause,
... ... @@ -487,26 +490,26 @@ public define HTML_Partial_Content
487 490 with id = get_String(lwa, "id","none"),
488 491 with button_name = if create then _T("CREATE") else _T("UPDATE"),
489 492 with button_name_and_new = if create then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"),
490   -
  493 +
491 494 partial_content(
492 495 [ js(js_file("js/jscolor.min.js"))
493 496 ]+
494 497 jq_datetimepicker_init(lang) +
495 498 get_editor_header(vt_elist.list), //add editor header if need. Like init ck_editor
496 499 sequence([
497   - cxm_form( table_name, lwa,
498   - edit_form_lines(db, "", table_referer, _T, vt_elist.list, create, [])+
499   - [ one_line_fields([
500   - submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name)]),
501   - submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name)]),
502   - submit(hkc_cancel, failure, _T("CANCEL"))
503   - ])
504   - ]
505   - )]+
  500 + cxm_form( table_name, lwa,
  501 + edit_form_lines(db, "", table_referer, _T, vt_elist.list, create, [])+
  502 + [ one_line_fields([
  503 + submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name)]),
  504 + submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name)]),
  505 + submit(hkc_cancel, failure, _T("CANCEL"))
  506 + ])
  507 + ]
  508 + )]+
506 509 if id = "none" then
507 510 []
508 511 else
509   - map( (HK_V_Edit_Tab tab)
  512 + map( (HK_Form_Tab tab)
510 513 |->
511 514 since tab is hk_v_edit_tab(fk_table_name, fk_col_name, list_view_name),
512 515 with referer = hk_referer(table_name, id, fk_table_name, fk_col_name),
... ... @@ -529,7 +532,7 @@ public define Maybe(HTML_Partial_Content)
529 532 List(Web_arg) lwa,
530 533 String table, //table name
531 534 String view_name, //view name to use
532   - VT_action action, //new_entry or edit an existing record
  535 + HK_Form_action action, //new_entry or edit an existing record
533 536 VTM vtm,
534 537 String clause,
535 538 String fk_clause,
... ...