Commit 5ab6864e3415774c8abba04528dfbb833f1bfbf6

Authored by David RENÉ
1 parent 87db844b

Add parameter in phone_icon to allow or not the click to dial

Showing 1 changed file with 29 additions and 13 deletions   Show diff stats
web/widgets/specialized_elements.anubis
... ... @@ -35,17 +35,29 @@ public define HTML_Off_Form
35 35 List(CoreAttrs) attrs,
36 36 String phone_number,
37 37 Phone_Type phone_type,
38   - Bool show_text
  38 + Bool show_text,
  39 + Bool click_to_dial //click_call boolean allows to not manage the click_to_dial
39 40 )=
40 41 if phone_number = "" then empty
41   - else
42   - with _attrs = if phone_type = fax then [] else [data("phone-number", phone_number), event(onclick, "hk_phone_call(this)"), class("clickable") . attrs],
  42 + else
  43 + with _attrs = if click_to_dial then //click to dial allowed
  44 + //if phone is fax don't manage the click to dial the fax ! ;-)
  45 + if phone_type = fax then
  46 + []
  47 + else
  48 + [data("phone-number", phone_number), event(onclick, "hk_phone_call(this)"), class("clickable") . attrs]
  49 + else //click to dial not allowed, hence return the given attributes
  50 + attrs,
43 51 sequence([
44   - //add sms
  52 + //add sms icon if mobile phone number
45 53 if phone_type = cellphone then
46   - 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","")
  54 + if click_to_dial then //click to dial allowed and mobile phone number. Hence add the sms icon to let send a message
  55 + 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","")
  56 + else
  57 + empty
47 58 else
48 59 empty,
  60 + //here select the right icon for the phone number. Landline or mobile phone
49 61 img(_attrs+[class("icon_in_text")], "/icons/16x16/"+to_Icon(phone_type)),
50 62 if show_text then
51 63 text(_attrs, phone_number)
... ... @@ -58,15 +70,17 @@ public define HTML_Off_Form
58 70 phone_icon
59 71 (
60 72 List(CoreAttrs) attrs,
61   - String phone_number
62   - )= phone_icon(attrs, phone_number, generic, true).
  73 + String phone_number,
  74 + Bool click_to_dial
  75 + )= phone_icon(attrs, phone_number, generic, true, click_to_dial).
63 76  
64 77 public define HTML_Off_Form
65 78 phone_icon
66 79 (
67   - String phone_number
  80 + String phone_number,
  81 + Bool click_to_dial
68 82 )=
69   - phone_icon([], phone_number, generic, true)
  83 + phone_icon([], phone_number, generic, true, click_to_dial)
70 84 .
71 85  
72 86 public define HTML_Off_Form
... ... @@ -74,18 +88,20 @@ public define HTML_Off_Form
74 88 (
75 89 String phone_number,
76 90 Phone_Type phone_type,
77   - Bool show_number
  91 + Bool show_number,
  92 + Bool click_to_dial
78 93 )=
79   - phone_icon([], phone_number, phone_type, show_number)
  94 + phone_icon([], phone_number, phone_type, show_number, click_to_dial)
80 95 .
81 96  
82 97 public define HTML_Off_Form
83 98 phone_icon
84 99 (
85 100 String phone_number,
86   - Phone_Type phone_type
  101 + Phone_Type phone_type,
  102 + Bool click_to_dial
87 103 )=
88   - phone_icon([], phone_number, phone_type, true)
  104 + phone_icon([], phone_number, phone_type, true, click_to_dial)
89 105 .
90 106  
91 107  
... ...