CXM_widgets.anubis
2.09 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
/*
* Created by PyramIDE.
* User: フランスのトトロ
* Date: 07/12/2014
* Time: 18:10
* © Calexium
*/
read system/string.anubis
read tools/basis.anubis
read calexium_lib/web/CXM_making_a_web_site.anubis
public define HTML_In_Form
ip_input
(
HTML_Id the_id,
WebArgName wan_prefix,
String ip
)=
with ip_fields = split(ip, '.'),
if the_id is html_Id(id_str) then
if wan_prefix is wan(field_prefix) then
div([id(id_str)],
sequence(
[
text_input([class("ip_input")], no_label, html_Id(""), wan(field_prefix+"_0"), init(force_nth(0,ip_fields,"")), 3),
text("."),
text_input([class("ip_input")], no_label, html_Id(""), wan(field_prefix+"_1"), init(force_nth(1,ip_fields,"")), 3),
text("."),
text_input([class("ip_input")], no_label, html_Id(""), wan(field_prefix+"_2"), init(force_nth(2,ip_fields,"")), 3),
text("."),
text_input([class("ip_input")], no_label, html_Id(""), wan(field_prefix+"_3"), init(force_nth(3,ip_fields,"")), 3),
]))
.
// ---------------------------------------------------------------------------
public define HTML_In_Form
partial_ip_input
(
HTML_Id the_id,
WebArgName wan_prefix,
List(String) ip_fixed_part,
String ip
)=
with ip_fields = split(ip, '.'),
if the_id is html_Id(id_str) then
if wan_prefix is wan(field_prefix) then
with make_field = (Int index)
|-> if index < length(ip_fixed_part) then
text([], force_nth(index, ip_fixed_part, ""))
else
text_input([class("ip_input")],
no_label,
html_Id(""),
wan(field_prefix + "_" + index),
init(force_nth(index, ip_fields, "")),
3),
div([id(id_str)],
sequence(
[
make_field(0),
text("."),
make_field(1),
text("."),
make_field(2),
text("."),
make_field(3),
]))
.