view_apps_renderer.anubis
3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* Created by PyramIDE.
* User: フランスのトトロ aka (David RENÉ)
* Date: 11/03/2017
* Time: 19:12
* © David RENÉ
*/
read hayamiki_lib/types/hayamiki.anubis
read hayamiki_lib/view/web_action.anubis
read hayamiki_lib/controller/hk_sql_utils.anubis
read xlib/web/CXM_making_a_web_site.anubis
read xlib/web/jQuery/CXM_jquery_dialog.anubis
read xlib/web/jQuery/CXM_jquery_button.anubis
read xlib/web/jQuery/ui-addon/datetimepicker.anubis
read xlib/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))
])
))
.