diff --git a/view/load_vtm.anubis b/view/load_vtm.anubis new file mode 100644 index 0000000..95f9d40 --- /dev/null +++ b/view/load_vtm.anubis @@ -0,0 +1,104 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ aka (David RENÉ) + * Date: 29/03/2018 + * Time: 22:35 + * © Calexium + */ + + +transmit view_table_manager_types.anubis + +define String modules_directory = find_and_replace(my_anubis_directory, "\\", "/") + "/modules/". + +public define Maybe(VTM) + load_plugin + ( + String file_name + ) + = + if (LoadAdm(VTM))load_adm(file_name) is + { + file_not_found then print("File '"+file_name+"' not found.\n\n");failure, + read_error then print("Error reading file '"+file_name+"'.\n\n");failure, + timeout then print("Timeout when loading '"+file_name+"'.\n\n");failure, + file_damaged then print("File '"+file_name+"' is damaged.\n\n");failure, + bad_version(expected,found) then print("Secondary module '"+file_name+"' doesn't have the same\n"+ + " version ("+found+") as primary module ("+expected+").\n\n");failure, + wrong_type(expected,found) then print("Secondary module '"+file_name+"' has type:\n"+ + found+" while primary module expected:\n"+ + expected+"\n\n");failure, + ok(vtm_plugin) then println("vtm plugin "+vtm_plugin.db_version+" loaded "); success(vtm_plugin) + }. + +define Maybe(VTM) + load_vtm + ( + List(String) left, + DB_Version vtm_version + )= + if left is + { + [] then failure, + [file_name . t] then + if load_plugin(modules_directory+file_name) is + { + failure then load_vtm(t, vtm_version), + success(_vtm) then + if compare_db_version(_vtm.db_version, vtm_version) is + { + less then load_vtm(t, vtm_version), + more then failure, + equal then success(_vtm), + equal_but_sign then success(_vtm) + } + } + } +. + +define Maybe(VTM) + load_latest_vtm + ( + List(String) left, + VTM _current_vtm + )= + if left is + { + [] then + since _current_vtm is vtm(_version, _, _, _), + if _version.version.numeric = 0 & _version.db_hash = "" then + failure + else + success(_current_vtm), + [file_name . t] then + if load_plugin(modules_directory+file_name) is + { + failure then load_latest_vtm(t, _current_vtm), + success(_vtm) then + if compare_db_version( _vtm.db_version, _current_vtm.db_version) is + { + less then load_latest_vtm(t, _current_vtm), + more then load_latest_vtm(t, _vtm), + equal then load_latest_vtm(t, _current_vtm), + equal_but_sign then load_latest_vtm(t, _current_vtm) + } + } + } +. + +public define Maybe(VTM) + load_vtm + ( + DB_Version vtm_version + ) + = + with files = directory_list(modules_directory, "vtm_v*.adm"), + load_vtm(files, vtm_version) +. + +public define Maybe(VTM) + load_latest_vtm + = + with files = directory_list(modules_directory, "vtm_v*.adm"), + load_latest_vtm(files, blank_vtm) +. diff --git a/view/view_table_manager_types.anubis b/view/view_table_manager_types.anubis index 5ad85bd..48e2b55 100644 --- a/view/view_table_manager_types.anubis +++ b/view/view_table_manager_types.anubis @@ -10,6 +10,7 @@ transmit hayamiki_lib/view/types/hk_form.anubis transmit hayamiki_lib/view/types/hk_view.anubis transmit hayamiki_lib/view/types/hk_filter.anubis transmit calexium_lib/web/CXM_common.anubis +transmit calexium_lib/database/db_version.anubis transmit hayamiki_lib/controller/hk_controller.anubis //read hayamiki_lib/types/hayamiki.anubis @@ -35,6 +36,10 @@ public type VTM_view_list: vtm_view_list(List(VTM_view) list). public type VTM: - vtm(VTM_view_list view_list, + vtm(DB_Version db_version, + VTM_view_list view_list, VTM_edit_list edit_list, List(HK_Table_controller) hk_controllers). + + +public define VTM blank_vtm = vtm(db_v_0, vtm_view_list([]), vtm_edit_list([]), []). diff --git a/view/view_table_renderer.anubis b/view/view_table_renderer.anubis index 932a9d9..4113292 100644 --- a/view/view_table_renderer.anubis +++ b/view/view_table_renderer.anubis @@ -550,7 +550,7 @@ public define HTML_Partial_Content 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)))), partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(uid+action_name+"_dlg_ajax")))], "", [])), //table_view_selector(_T, vtm_v, view_name), - partial(jqGrid_table(db, uid, current_view, filter_name, _T, lang, fk_clause, table_referer)), + partial(jqGrid_table(db, uid, current_view, filter_name, _T, lang, /*fk_clause*/ f_clause, table_referer)), //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)) ]). -- libgit2 0.21.4