CXM_jquery_dialog.anubis
2.82 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
* Created by PyramIDE.
* User: フランスのトトロ & julien
* Date: 09/11/2014
* Time: 15:51
* © Calexium
*/
read system/convert.anubis
read calexium_lib/web/CXM_making_a_web_site.anubis
read calexium_lib/web/CXM_jquery.anubis
public type JQuery_dialog_id:
dialog_id(String id).
public type JQuery_dialog:
p_content(HTML_Partial_Content content),
off_form(HTML_Off_Form o_form),
ajax(String url).
public define HTML_Partial_Content
jq_dialog_create
(
JQuery_dialog_id dial_id,
JQuery_dialog content,
Bool autoOpen,
String extra_param
)=
with dlg_id = id(dial_id),
js = js_inline(jquery_ready("
$( \"#"+dlg_id+"\" ).dialog({
autoOpen: "+to_String(autoOpen)+",
modal: true,
height: 'auto',
width: 'auto',
"+extra_param+"
Cancel: function() {
$( this ).dialog( 'close' );
}
});
")),
if content is
{
p_content(pc) then
if pc is partial_content(tags, html) then
partial_content( [js . tags ], html), //html code of the dialog
off_form(html) then
partial_content( [js], html), //html code of the dialog
ajax(url) then
partial_content( [js], div_empty([id(dlg_id), attr("ajax_url",url)]))
}.
public define HTML_Partial_Content
jq_dialog_create
(
JQuery_dialog_id dial_id,
JQuery_dialog content,
String extra_param
)=
jq_dialog_create(dial_id, content, false, extra_param).
public define HTML_Partial_Content
jq_dialog_create
(
JQuery_dialog_id dial_id,
JQuery_dialog content
)=
jq_dialog_create(dial_id, content, false, "").
public define HTML_Partial_Content
jq_dialog_create
(
JQuery_dialog_id dial_id,
JQuery_dialog content,
Bool autoOpen
)=
jq_dialog_create(dial_id, content, autoOpen, "").
define String
_jq_dialog_open
(
Maybe(String) mb_html,
JQuery_dialog_id dialog_id,
String params
)=
with js_function = "CalexiumToolBox.jquery_dialog_click('"+id(dialog_id)+"', "+(if length(params)=0 then "''" else params) +");",
if mb_html is
{
failure then js_function,
success(html) then "<a onclick=\""+js_function+"\">"+html+"</a>"
}.
public define String
jq_dialog_open
(
String html,
JQuery_dialog_id dialog_id,
String params
)=
_jq_dialog_open(success(html), dialog_id, params).
public define String
jq_dialog_open
(
JQuery_dialog_id dialog_id
)=
_jq_dialog_open(failure, dialog_id, "").
public define List(HTML_Head_Tag)
jq_dialog_init
=
[
js_inline(jquery_ready("
"))
].