Commit 3fbfbd95eca09d18798d424226697292dfb54d7c
1 parent
3cb2dc13
move vtm as loadable secondary module
Showing
3 changed files
with
111 additions
and
2 deletions
Show diff stats
| 1 | +/* | |
| 2 | + * Created by PyramIDE. | |
| 3 | + * User: フランスのトトロ aka (David RENÉ) | |
| 4 | + * Date: 29/03/2018 | |
| 5 | + * Time: 22:35 | |
| 6 | + * © Calexium | |
| 7 | + */ | |
| 8 | + | |
| 9 | + | |
| 10 | +transmit view_table_manager_types.anubis | |
| 11 | + | |
| 12 | +define String modules_directory = find_and_replace(my_anubis_directory, "\\", "/") + "/modules/". | |
| 13 | + | |
| 14 | +public define Maybe(VTM) | |
| 15 | + load_plugin | |
| 16 | + ( | |
| 17 | + String file_name | |
| 18 | + ) | |
| 19 | + = | |
| 20 | + if (LoadAdm(VTM))load_adm(file_name) is | |
| 21 | + { | |
| 22 | + file_not_found then print("File '"+file_name+"' not found.\n\n");failure, | |
| 23 | + read_error then print("Error reading file '"+file_name+"'.\n\n");failure, | |
| 24 | + timeout then print("Timeout when loading '"+file_name+"'.\n\n");failure, | |
| 25 | + file_damaged then print("File '"+file_name+"' is damaged.\n\n");failure, | |
| 26 | + bad_version(expected,found) then print("Secondary module '"+file_name+"' doesn't have the same\n"+ | |
| 27 | + " version ("+found+") as primary module ("+expected+").\n\n");failure, | |
| 28 | + wrong_type(expected,found) then print("Secondary module '"+file_name+"' has type:\n"+ | |
| 29 | + found+" while primary module expected:\n"+ | |
| 30 | + expected+"\n\n");failure, | |
| 31 | + ok(vtm_plugin) then println("vtm plugin "+vtm_plugin.db_version+" loaded "); success(vtm_plugin) | |
| 32 | + }. | |
| 33 | + | |
| 34 | +define Maybe(VTM) | |
| 35 | + load_vtm | |
| 36 | + ( | |
| 37 | + List(String) left, | |
| 38 | + DB_Version vtm_version | |
| 39 | + )= | |
| 40 | + if left is | |
| 41 | + { | |
| 42 | + [] then failure, | |
| 43 | + [file_name . t] then | |
| 44 | + if load_plugin(modules_directory+file_name) is | |
| 45 | + { | |
| 46 | + failure then load_vtm(t, vtm_version), | |
| 47 | + success(_vtm) then | |
| 48 | + if compare_db_version(_vtm.db_version, vtm_version) is | |
| 49 | + { | |
| 50 | + less then load_vtm(t, vtm_version), | |
| 51 | + more then failure, | |
| 52 | + equal then success(_vtm), | |
| 53 | + equal_but_sign then success(_vtm) | |
| 54 | + } | |
| 55 | + } | |
| 56 | + } | |
| 57 | +. | |
| 58 | + | |
| 59 | +define Maybe(VTM) | |
| 60 | + load_latest_vtm | |
| 61 | + ( | |
| 62 | + List(String) left, | |
| 63 | + VTM _current_vtm | |
| 64 | + )= | |
| 65 | + if left is | |
| 66 | + { | |
| 67 | + [] then | |
| 68 | + since _current_vtm is vtm(_version, _, _, _), | |
| 69 | + if _version.version.numeric = 0 & _version.db_hash = "" then | |
| 70 | + failure | |
| 71 | + else | |
| 72 | + success(_current_vtm), | |
| 73 | + [file_name . t] then | |
| 74 | + if load_plugin(modules_directory+file_name) is | |
| 75 | + { | |
| 76 | + failure then load_latest_vtm(t, _current_vtm), | |
| 77 | + success(_vtm) then | |
| 78 | + if compare_db_version( _vtm.db_version, _current_vtm.db_version) is | |
| 79 | + { | |
| 80 | + less then load_latest_vtm(t, _current_vtm), | |
| 81 | + more then load_latest_vtm(t, _vtm), | |
| 82 | + equal then load_latest_vtm(t, _current_vtm), | |
| 83 | + equal_but_sign then load_latest_vtm(t, _current_vtm) | |
| 84 | + } | |
| 85 | + } | |
| 86 | + } | |
| 87 | +. | |
| 88 | + | |
| 89 | +public define Maybe(VTM) | |
| 90 | + load_vtm | |
| 91 | + ( | |
| 92 | + DB_Version vtm_version | |
| 93 | + ) | |
| 94 | + = | |
| 95 | + with files = directory_list(modules_directory, "vtm_v*.adm"), | |
| 96 | + load_vtm(files, vtm_version) | |
| 97 | +. | |
| 98 | + | |
| 99 | +public define Maybe(VTM) | |
| 100 | + load_latest_vtm | |
| 101 | + = | |
| 102 | + with files = directory_list(modules_directory, "vtm_v*.adm"), | |
| 103 | + load_latest_vtm(files, blank_vtm) | |
| 104 | +. | ... | ... |
view/view_table_manager_types.anubis
| ... | ... | @@ -10,6 +10,7 @@ transmit hayamiki_lib/view/types/hk_form.anubis |
| 10 | 10 | transmit hayamiki_lib/view/types/hk_view.anubis |
| 11 | 11 | transmit hayamiki_lib/view/types/hk_filter.anubis |
| 12 | 12 | transmit calexium_lib/web/CXM_common.anubis |
| 13 | +transmit calexium_lib/database/db_version.anubis | |
| 13 | 14 | transmit hayamiki_lib/controller/hk_controller.anubis |
| 14 | 15 | |
| 15 | 16 | //read hayamiki_lib/types/hayamiki.anubis |
| ... | ... | @@ -35,6 +36,10 @@ public type VTM_view_list: |
| 35 | 36 | vtm_view_list(List(VTM_view) list). |
| 36 | 37 | |
| 37 | 38 | public type VTM: |
| 38 | - vtm(VTM_view_list view_list, | |
| 39 | + vtm(DB_Version db_version, | |
| 40 | + VTM_view_list view_list, | |
| 39 | 41 | VTM_edit_list edit_list, |
| 40 | 42 | List(HK_Table_controller) hk_controllers). |
| 43 | + | |
| 44 | + | |
| 45 | +public define VTM blank_vtm = vtm(db_v_0, vtm_view_list([]), vtm_edit_list([]), []). | ... | ... |
view/view_table_renderer.anubis
| ... | ... | @@ -550,7 +550,7 @@ public define HTML_Partial_Content |
| 550 | 550 | partial(jq_dialog_create(dialog_id(uid+action_name+"_dlg_ajax"), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+uid+action_name+"_dlg_ajax&table_name="+current_view.table_name+filter_clause+referer_arg)))), |
| 551 | 551 | partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), |
| 552 | 552 | //table_view_selector(_T, vtm_v, view_name), |
| 553 | - partial(jqGrid_table(db, uid, current_view, filter_name, _T, lang, fk_clause, table_referer)), | |
| 553 | + partial(jqGrid_table(db, uid, current_view, filter_name, _T, lang, /*fk_clause*/ f_clause, table_referer)), | |
| 554 | 554 | //partial(jquery_datatable(uid+"table_view", view_table_form(_T, uid, action_name, rows), true, false, jq_dt_pt_full_numbers, false, scrollY(200), true, true, true, lang, no_extra, web_site_directory)) |
| 555 | 555 | ]). |
| 556 | 556 | ... | ... |