Commit 546d5e5da0dfc001067c59389980ed6915a60c59
1 parent
7a8ff83c
continue refactoring
Showing
6 changed files
with
31 additions
and
28 deletions
Show diff stats
view/jqgrid.anubis
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | read calexium_lib/web/CXM_making_a_web_site.anubis | 9 | read calexium_lib/web/CXM_making_a_web_site.anubis |
| 10 | read hayamiki_lib/types/hayamiki.anubis | 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 | define String | 13 | define String |
| 14 | to_jqGrid_selector | 14 | to_jqGrid_selector |
view/types/hk_form_table_cell.anubis
| 1 | -/* | 1 | +/* |
| 2 | * Created by 伝作 (Densaku). | 2 | * Created by 伝作 (Densaku). |
| 3 | * Types & Messages generator written by フランスのトトロ aka (David RENÉ) | 3 | * Types & Messages generator written by フランスのトトロ aka (David RENÉ) |
| 4 | * Date: 2017-04-04 | 4 | * Date: 2017-04-04 |
| @@ -33,9 +33,9 @@ public define Message | @@ -33,9 +33,9 @@ public define Message | ||
| 33 | { | 33 | { |
| 34 | //Alternative hk_form_table_cell | 34 | //Alternative hk_form_table_cell |
| 35 | hk_form_table_cell(_form_entry) then | 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 | // [type = HK_Form_Entry] hk_form_table_cell.form_entry | 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 | _hk_form_table_cell_message | 41 | _hk_form_table_cell_message |
| @@ -52,8 +52,8 @@ public define Maybe(HK_Form_Table_Cell) | @@ -52,8 +52,8 @@ public define Maybe(HK_Form_Table_Cell) | ||
| 52 | //Alternative hk_form_table_cell | 52 | //Alternative hk_form_table_cell |
| 53 | if __type_alt__ = "hk_form_table_cell" then //Alternative hk_form_table_cell | 53 | if __type_alt__ = "hk_form_table_cell" then //Alternative hk_form_table_cell |
| 54 | // [type = HK_Form_Entry] hk_form_table_cell.form_entry | 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 | success(hk_form_table_cell(form_entry)) | 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,7 +12,7 @@ read hayamiki_lib/view/view_table_manager_types.anubis | ||
| 12 | read hayamiki_lib/view/view_table_manager.anubis | 12 | read hayamiki_lib/view/view_table_manager.anubis |
| 13 | read hayamiki_lib/types/hayamiki.anubis | 13 | read hayamiki_lib/types/hayamiki.anubis |
| 14 | 14 | ||
| 15 | -public define Maybe(HTML_Partial_Content) | 15 | + public define Maybe(HTML_Partial_Content) |
| 16 | view_editor_content | 16 | view_editor_content |
| 17 | ( | 17 | ( |
| 18 | SQLite3DataBase db, | 18 | SQLite3DataBase db, |
| @@ -22,7 +22,7 @@ public define Maybe(HTML_Partial_Content) | @@ -22,7 +22,7 @@ public define Maybe(HTML_Partial_Content) | ||
| 22 | List(Web_arg) lwa, | 22 | List(Web_arg) lwa, |
| 23 | String table, //table name | 23 | String table, //table name |
| 24 | String view_name, //view name to use | 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 | VTM vtm, | 26 | VTM vtm, |
| 27 | String clause, | 27 | String clause, |
| 28 | String fk_clause, | 28 | String fk_clause, |
view/view_table_manager.anubis
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | read tools/basis.anubis | 8 | read tools/basis.anubis |
| 9 | -transmit hayamiki_lib/view/view_table_types.anubis | 9 | +transmit hayamiki_lib/view/types/hk_form.anubis |
| 10 | transmit hayamiki_lib/view/view_table_manager_types.anubis | 10 | transmit hayamiki_lib/view/view_table_manager_types.anubis |
| 11 | 11 | ||
| 12 | public define Maybe(VTM_view) | 12 | public define Maybe(VTM_view) |
view/view_table_manager_types.anubis
| @@ -6,11 +6,11 @@ | @@ -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 | read calexium_lib/web/CXM_common.anubis | 10 | read calexium_lib/web/CXM_common.anubis |
| 11 | 11 | ||
| 12 | public type VTM_edit: | 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 | public type VTM_edit_list: | 15 | public type VTM_edit_list: |
| 16 | vtm_edit_list(List(VTM_edit) list). | 16 | vtm_edit_list(List(VTM_edit) list). |
view/view_table_renderer.anubis
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | read hayamiki_lib/view/types/hk_form_entry.anubis | 9 | read hayamiki_lib/view/types/hk_form_entry.anubis |
| 10 | +read hayamiki_lib/view/types/hk_form.anubis | ||
| 10 | read hayamiki_lib/view/jqgrid.anubis | 11 | read hayamiki_lib/view/jqgrid.anubis |
| 11 | read hayamiki_lib/view/view_table_manager_types.anubis | 12 | read hayamiki_lib/view/view_table_manager_types.anubis |
| 12 | read hayamiki_lib/view/view_table_manager.anubis | 13 | read hayamiki_lib/view/view_table_manager.anubis |
| @@ -390,7 +391,9 @@ public define List(CXM_Form_Field) | @@ -390,7 +391,9 @@ public define List(CXM_Form_Field) | ||
| 390 | { | 391 | { |
| 391 | hidden(name, value) then | 392 | hidden(name, value) then |
| 392 | //print("hidden "+name+" = "+value); | 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 | primary_key(idx) then | 397 | primary_key(idx) then |
| 395 | [hidden(html_Id(""), wan("id"), wav(idx))], | 398 | [hidden(html_Id(""), wan("id"), wav(idx))], |
| 396 | information(s_name, c_name, value, width, help) then | 399 | information(s_name, c_name, value, width, help) then |
| @@ -444,10 +447,10 @@ public define List(CXM_Form_Field) | @@ -444,10 +447,10 @@ public define List(CXM_Form_Field) | ||
| 444 | define HTML_Head_Tag | 447 | define HTML_Head_Tag |
| 445 | get_rich_editor_inline | 448 | get_rich_editor_inline |
| 446 | ( | 449 | ( |
| 447 | - List(VT_edit_entry) list | 450 | + List(HK_Form_Entry) list |
| 448 | )= | 451 | )= |
| 449 | js_inline(jquery_ready( | 452 | js_inline(jquery_ready( |
| 450 | - join("",map_select((VT_edit_entry entry) |-> | 453 | + join("",map_select((HK_Form_Entry entry) |-> |
| 451 | if entry is text_area(s_name, c_name, value, txt_editor, help) then | 454 | if entry is text_area(s_name, c_name, value, txt_editor, help) then |
| 452 | if txt_editor is { none then failure, | 455 | if txt_editor is { none then failure, |
| 453 | rich_editor then success(" CKEDITOR.replace( '"+c_name+"_editor' );") | 456 | rich_editor then success(" CKEDITOR.replace( '"+c_name+"_editor' );") |
| @@ -468,14 +471,14 @@ define List(HTML_Head_Tag) | @@ -468,14 +471,14 @@ define List(HTML_Head_Tag) | ||
| 468 | . | 471 | . |
| 469 | 472 | ||
| 470 | public define HTML_Partial_Content | 473 | public define HTML_Partial_Content |
| 471 | - edit_table_form | 474 | + renderer_edit_form |
| 472 | ( | 475 | ( |
| 473 | SQLite3DataBase db, | 476 | SQLite3DataBase db, |
| 474 | (String) -> String _T, | 477 | (String) -> String _T, |
| 475 | String lang, | 478 | String lang, |
| 476 | String web_site_directory, | 479 | String web_site_directory, |
| 477 | List(Web_arg) lwa, | 480 | List(Web_arg) lwa, |
| 478 | - VT_edit vt_elist, | 481 | + HK_Form edit_form, |
| 479 | VTM vtm, | 482 | VTM vtm, |
| 480 | String clause, | 483 | String clause, |
| 481 | String fk_clause, | 484 | String fk_clause, |
| @@ -487,26 +490,26 @@ public define HTML_Partial_Content | @@ -487,26 +490,26 @@ public define HTML_Partial_Content | ||
| 487 | with id = get_String(lwa, "id","none"), | 490 | with id = get_String(lwa, "id","none"), |
| 488 | with button_name = if create then _T("CREATE") else _T("UPDATE"), | 491 | with button_name = if create then _T("CREATE") else _T("UPDATE"), |
| 489 | with button_name_and_new = if create then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"), | 492 | with button_name_and_new = if create then _T("CREATE_AND_EDIT_NEW") else _T("UPDATE_AND_EDIT_NEW"), |
| 490 | - | 493 | + |
| 491 | partial_content( | 494 | partial_content( |
| 492 | [ js(js_file("js/jscolor.min.js")) | 495 | [ js(js_file("js/jscolor.min.js")) |
| 493 | ]+ | 496 | ]+ |
| 494 | jq_datetimepicker_init(lang) + | 497 | jq_datetimepicker_init(lang) + |
| 495 | get_editor_header(vt_elist.list), //add editor header if need. Like init ck_editor | 498 | get_editor_header(vt_elist.list), //add editor header if need. Like init ck_editor |
| 496 | sequence([ | 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 | if id = "none" then | 509 | if id = "none" then |
| 507 | [] | 510 | [] |
| 508 | else | 511 | else |
| 509 | - map( (HK_V_Edit_Tab tab) | 512 | + map( (HK_Form_Tab tab) |
| 510 | |-> | 513 | |-> |
| 511 | since tab is hk_v_edit_tab(fk_table_name, fk_col_name, list_view_name), | 514 | since tab is hk_v_edit_tab(fk_table_name, fk_col_name, list_view_name), |
| 512 | with referer = hk_referer(table_name, id, fk_table_name, fk_col_name), | 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,7 +532,7 @@ public define Maybe(HTML_Partial_Content) | ||
| 529 | List(Web_arg) lwa, | 532 | List(Web_arg) lwa, |
| 530 | String table, //table name | 533 | String table, //table name |
| 531 | String view_name, //view name to use | 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 | VTM vtm, | 536 | VTM vtm, |
| 534 | String clause, | 537 | String clause, |
| 535 | String fk_clause, | 538 | String fk_clause, |