specialized_elements.anubis 3.23 KB
/*
 * Created by PyramIDE.
 * User: フランスのトトロ aka (David RENÉ) 
 * Date: 01/06/2017
 * Time: 12:03
 * © Calexium 
 */

read calexium_lib/web/CXM_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
  )=
  if phone_number = "" then empty
  else
      with _attrs = if phone_type = fax then [] else [data("phone-number", phone_number), event(onclick, "hk_phone_call(this)"), class("clickable") . attrs],
  sequence([
    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
  )= phone_icon(attrs, phone_number, generic, true).
  
public define HTML_Off_Form
  phone_icon
  (
    String          phone_number
  )=
  phone_icon([], phone_number, generic, true)
.

public define HTML_Off_Form
  phone_icon
  (
    String      phone_number,
    Phone_Type  phone_type,
    Bool        show_number
  )=
  phone_icon([], phone_number, phone_type, show_number)
.

public define HTML_Off_Form
  phone_icon
  (
    String      phone_number,
    Phone_Type  phone_type
  )=
  phone_icon([], phone_number, phone_type, true)
.


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)
.