Commit 889ced71b2265e84b0b4b2661d76c84a3998cbd4

Authored by totoro
1 parent 23eeeae8

still working on view/form refactoring

view/jqgrid.anubis
... ... @@ -9,6 +9,7 @@
9 9 read calexium_lib/web/CXM_making_a_web_site.anubis
10 10 read hayamiki_lib/types/hayamiki.anubis
11 11 read hayamiki_lib/view/types/hk_form.anubis
  12 +read hayamiki_lib/view/types/hk_view.anubis
12 13  
13 14 define String
14 15 to_jqGrid_selector
... ...
view/types/hk_view.anubis
... ... @@ -9,6 +9,7 @@ read calexium_lib/web/CXM_making_a_web_site.anubis
9 9 transmit calexium_lib/web/CXM_common.anubis
10 10 read hayamiki_lib/types/hayamiki.anubis
11 11 read hayamiki_lib/view/types/hk_form_table.anubis
  12 +read hayamiki_lib/view/types/hk_form_tab.anubis
12 13  
13 14 //public type VT_edit_selector:
14 15 // vt_edit_selector((SQLite3DataBase db, HK_Referer referer, String filter) -> List((List(CoreAttrs), WebArgValue, String)) get).
... ... @@ -43,14 +44,14 @@ read hayamiki_lib/view/types/hk_form_table.anubis
43 44 //public define VT_edit_entry information(String s_name, String c_name, String v_name, HK_Help_Text help) = information(s_name, c_name, v_name, 0, help).
44 45  
45 46  
46   -public type HK_Form_Tab: //HK_V_Edit_Tab:
47   - hk_ve_form_tab(String fk_table_name, String fk_col_name, String list_view_name)
48   -.
  47 +//public type HK_Form_Tab: //HK_V_Edit_Tab:
  48 +// hk_ve_form_tab(String fk_table_name, String fk_col_name, String list_view_name)
  49 +//.
49 50  
50   -public type HK_Form: //VT_edit:
51   - hk_form_in_list (String table_name, String view_name, List(HK_Form_Entry) list, List(HK_Form_Tab) tabs),
52   - hk_form_in_table(String table_name, String view_name, HK_Form_Table ve_table)
53   -.
  51 +//public type HK_Form: //VT_edit:
  52 +// hk_form_in_list (String table_name, String view_name, List(HK_Form_Entry) list, List(HK_Form_Tab) tabs),
  53 +// hk_form_in_table(String table_name, String view_name, HK_Form_Table ve_table)
  54 +//.
54 55  
55 56  
56 57 public type VT_view_model_entry:
... ...
view/view_table_manager_types.anubis
... ... @@ -7,6 +7,7 @@
7 7 */
8 8  
9 9 read hayamiki_lib/view/types/hk_form.anubis
  10 +read hayamiki_lib/view/types/hk_view.anubis
10 11 read calexium_lib/web/CXM_common.anubis
11 12  
12 13 public type VTM_edit:
... ...
view/view_table_renderer.anubis
... ... @@ -8,6 +8,7 @@
8 8  
9 9 read hayamiki_lib/view/types/hk_form_entry.anubis
10 10 read hayamiki_lib/view/types/hk_form.anubis
  11 +read hayamiki_lib/view/types/hk_view.anubis
11 12 read hayamiki_lib/view/jqgrid.anubis
12 13 read hayamiki_lib/view/view_table_manager_types.anubis
13 14 read hayamiki_lib/view/view_table_manager.anubis
... ... @@ -477,14 +478,18 @@ public define HTML_Partial_Content
477 478 (String) -> String _T,
478 479 String lang,
479 480 String web_site_directory,
  481 + String table_name,
  482 + String view_name,
  483 + List(HK_Form_Entry) list_entries,
  484 + List(HK_Form_Tab) list_tabs,
480 485 List(Web_arg) lwa,
481   - HK_Form edit_form,
  486 + //HK_Form edit_form,
482 487 VTM vtm,
483 488 String clause,
484 489 String fk_clause,
485 490 HK_Referer table_referer //from which table and row id that editor is called
486 491 ) =
487   - with table_name = vt_elist.table_name,
  492 + //with table_name = vt_elist.table_name,
488 493 //true if need to create row or false for updating
489 494 with create = if get_String(lwa, "id","none") = "none" then true else false,
490 495 with id = get_String(lwa, "id","none"),
... ... @@ -495,10 +500,10 @@ public define HTML_Partial_Content
495 500 [ js(js_file("js/jscolor.min.js"))
496 501 ]+
497 502 jq_datetimepicker_init(lang) +
498   - get_editor_header(vt_elist.list), //add editor header if need. Like init ck_editor
  503 + get_editor_header(list_entries), //add editor header if need. Like init ck_editor
499 504 sequence([
500 505 cxm_form( table_name, lwa,
501   - edit_form_lines(db, "", table_referer, _T, vt_elist.list, create, [])+
  506 + edit_form_lines(db, "", table_referer, _T, list_entries, create, [])+
502 507 [ one_line_fields([
503 508 submit(if create then hkc_save_row else hkc_update_row, failure, button_name, [("table_name", table_name)]),
504 509 submit(if create then hkc_save_row_and_new else hkc_update_row_and_new, failure, button_name_and_new, [("table_name", table_name)]),
... ... @@ -511,7 +516,7 @@ public define HTML_Partial_Content
511 516 else
512 517 map( (HK_Form_Tab tab)
513 518 |->
514   - since tab is hk_v_edit_tab(fk_table_name, fk_col_name, list_view_name),
  519 + since tab is hk_form_tab(fk_table_name, fk_col_name, list_view_name),
515 520 with referer = hk_referer(table_name, id, fk_table_name, fk_col_name),
516 521 if table_in_list_view_only(db, _T, lang, web_site_directory, fk_table_name, list_view_name, "edit", "", referer, fk_clause, vtm) is
517 522 {
... ... @@ -519,7 +524,7 @@ public define HTML_Partial_Content
519 524 success(p_content) then partial(p_content)
520 525 }
521 526 //text("Foreign Key from table ["+fk_table_name+"] columns ["+fk_col_name+"] view to use ["+list_view_name+"]")
522   - ,vt_elist.tabs)
  527 + ,list_tabs)
523 528 )).
524 529  
525 530 public define Maybe(HTML_Partial_Content)
... ... @@ -543,7 +548,13 @@ public define Maybe(HTML_Partial_Content)
543 548 failure then failure,
544 549 success(vtm_e) then
545 550 since vtm_e is vtm_edit(_, get_edit),
546   - success(edit_table_form(db, _T, lang, web_site_directory, lwa, get_edit(db, action, view_name), vtm, clause, fk_clause, referer))
  551 + if get_edit(db, action, view_name) is
  552 + {
  553 + hk_form_in_list(tb_name, view_name, list_form_entres, list_tabs) then
  554 + success(render_edit_form(db, _T, lang, web_site_directory, lwa, vtm, tb_name, view_name, list_form_entries, list_tabs, clause, fk_clause, referer)),
  555 + hk_form_in_table(tb_name, view_name, form_in_table then ,
  556 +
  557 + }
547 558 }.
548 559  
549 560  
... ...