specialized_elements.anubis
4.28 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/*
* Created by PyramIDE.
* User: フランスのトトロ aka (David RENÉ)
* Date: 01/06/2017
* Time: 12:03
* © David RENÉ
*/
read xlib/web/making_a_web_site.anubis
public type Phone_Type:
generic, //Nothing special, normal phone number like home, mobile, etc..
landline, //wired phone line number
cellphone, //mobile or cell phone line number
fax //fax line number
.
public define String
to_Icon
(
Phone_Type phone_type
)=
if phone_type is
{
generic then "desktop_phone.png",
landline then "desktop_phone.png",
cellphone then "cellphone.png",
fax then "fax.png"
}
.
public define HTML
phone_icon
(
List(CoreAttrs) attrs,
String phone_number,
Phone_Type phone_type,
Bool show_text,
Bool click_to_dial //click_call boolean allows to not manage the click_to_dial
)=
if phone_number = "" then empty
else
with _attrs = if click_to_dial then //click to dial allowed
//if phone is fax don't manage the click to dial the fax ! ;-)
if phone_type = fax then
[]
else
[data("phone-number", phone_number), event(onclick, "hk_phone_call(this)"), class("clickable") . attrs]
else //click to dial not allowed, hence return the given attributes
attrs,
sequence([
//add sms icon if mobile phone number
if phone_type = cellphone then
if click_to_dial then //click to dial allowed and mobile phone number. Hence add the sms icon to let send a message
img(attrs+[event(onmouseover, "/icons/16x16/send_sms.png"), data("phone-number", phone_number), event(onclick, "hk_send_sms(this)"), class("clickable icon_in_text")], "/icons/16x16/sms.png","")
else
empty
else
empty,
//here select the right icon for the phone number. Landline or mobile phone
img(_attrs+[class("icon_in_text")], "/icons/16x16/"+to_Icon(phone_type)),
if show_text then
text(_attrs, phone_number)
else
empty
])
.
public define HTML
phone_icon
(
List(CoreAttrs) attrs,
String phone_number,
Bool click_to_dial
)= phone_icon(attrs, phone_number, generic, true, click_to_dial).
public define HTML
phone_icon
(
String phone_number,
Bool click_to_dial
)=
phone_icon([], phone_number, generic, true, click_to_dial)
.
public define HTML
phone_icon
(
String phone_number,
Phone_Type phone_type,
Bool show_number,
Bool click_to_dial
)=
phone_icon([], phone_number, phone_type, show_number, click_to_dial)
.
public define HTML
phone_icon
(
String phone_number,
Phone_Type phone_type,
Bool click_to_dial
)=
phone_icon([], phone_number, phone_type, true, click_to_dial)
.
public define HTML
email_icon
(
List(CoreAttrs) attrs,
String email_str,
Bool show_text
)=
if email_str = "" then empty
else
with _attrs = [data("email", email_str), event(onclick, "hk_send_email(this)"), class("clickable") . attrs],
sequence([
img(_attrs+[class("icon_in_text")], "/icons/16x16/email.png"),
if show_text then
text(_attrs, email_str)
else
empty
])
.
public define HTML
email_icon
(
String email_address,
Bool show_text
)=
email_icon([], email_address, show_text)
.
public define HTML
email_icon
(
String email_address
)=
email_icon([], email_address, true)
.
public define HTML
url_icon
(
List(CoreAttrs) attrs,
String url_string,
Bool show_text
)=
if url_string = "" then empty
else
with _attrs = [data("url", url_string), event(onclick, "hk_go_url(this)"), class("clickable") . attrs],
sequence([
img(_attrs+[class("icon_in_text")], "/icons/16x16/url.png"),
if show_text then
text(_attrs, url_string)
else
empty
])
.
public define HTML
url_icon
(
String url_string, //url to open
Bool show_text //if true show the url link near the icon
)=
url_icon([], url_string, show_text)
.
public define HTML
url_icon
(
String url_string
)=
url_icon(url_string, true)
.