/* * Created by PyramIDE. * User: フランスのトトロ aka (David RENÉ) * Date: 11/03/2017 * Time: 19:12 * © Calexium */ read hayamiki_lib/types/hayamiki.anubis read hayamiki_lib/view/web_action.anubis read hayamiki_lib/controller/hk_sql_utils.anubis read calexium_lib/web/CXM_making_a_web_site.anubis read calexium_lib/web/jQuery/CXM_jquery_dialog.anubis read calexium_lib/web/jQuery/CXM_jquery_button.anubis read calexium_lib/web/jQuery/ui-addon/datetimepicker.anubis read calexium_lib/web/widgets/button.anubis define List(HTML_Row(HTML_Off_Form)) generate_apps ( SQLite3DataBase db, List(HK_App) apps, String dialog_uid, (String) -> String _T, )= map_append((HK_App app) |-> since app is hk_app(app_name, icon, help, tables), [ (HTML_Row(HTML_Off_Form))row([core_attrs([class("hk_app_title")])],cell([columns(6)],text(app_name)))]+ //APP name line //here map for each table map((HK_Table table) |-> since table is hk_table(_table_name, short_name, model, display), //construct the real name of the table (app + table_name) with table_name = if length(app_name) > 0 then app_name +"_"+_table_name else _table_name, (HTML_Row(HTML_Off_Form))row([core_attrs([class("hk_table_line")])], [ cell(text(_table_name)), cell( sequence([ partial(img_button(icn16_add, [event(onclick, jq_dialog_open(dialog_id(dialog_uid), "'table_name="+table_name+"'"))], "", [])), actioner(link([core_attrs([event(onclick, jq_dialog_open(dialog_id(dialog_uid), "'table_name="+table_name+"'"))])],_T("ADD")), no_action, []) ]) ), cell( sequence([ partial(img_button(icn16_view_list, hkc_list_view, [("table_name",table_name)])), actioner(link(_T("LIST")), hkc_list_view, [("table_name",table_name)]) ]) ), cell( sequence([ partial(img_button("icons/16x16/table_import.png", hkc_import_dropzone, [("table_name",table_name)])), actioner(link(_T("CSV_IMPORT")), hkc_import_dropzone, [("table_name",table_name)]) ]) ), cell(text(_T("RECORDS_COUNT")+" ")), cell([right], text(get_count(db, table_name))) ]) ,tables) ,apps ) . public define Maybe(HTML_Partial_Content) show_apps_content ( SQLite3DataBase db, HK_Database hk_db, (String) -> String _T, String lang, String web_site_directory ) = with dialog_uid = "_"+generate_random_string(15)+"_cxm_dlg", success(partial_content([css(css_file("hayamiki/hayamiki.css")),]+ jq_dialog_init + jq_datetimepicker_init(lang), sequence([ partial(jq_dialog_create(dialog_id(dialog_uid), ajax(controller_action("hk_c", "ajax_edit_table&dialog_id="+dialog_uid)))), /*&table_name="+rows.table_name*/ table([class("hk_table_apps")], generate_apps(db, hk_db.apps, dialog_uid, _T)) ]) )) .