/* * 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_Off_Form 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_Off_Form 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_Off_Form phone_icon ( String phone_number, Bool click_to_dial )= phone_icon([], phone_number, generic, true, click_to_dial) . public define HTML_Off_Form 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_Off_Form 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_Off_Form 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_Off_Form email_icon ( String email_address, Bool show_text )= email_icon([], email_address, show_text) . public define HTML_Off_Form email_icon ( String email_address )= email_icon([], email_address, true) . public define HTML_Off_Form 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_Off_Form 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_Off_Form url_icon ( String url_string )= url_icon(url_string, true) .