diff --git a/web/CXM_form.anubis b/web/CXM_form.anubis index 4420aef..6836109 100644 --- a/web/CXM_form.anubis +++ b/web/CXM_form.anubis @@ -16,6 +16,7 @@ read calexium_lib/web/CXM_web_arg_utils.anubis read calexium_lib/web/CXM_making_a_web_site.anubis read calexium_lib/web/CXM_html_tooltip.anubis read calexium_lib/web/CXM_widgets.anubis +read calexium_lib/web/widgets/specialized_elements.anubis public type Mandatory: // used to mark fields as mandatory. mandatory, @@ -95,10 +96,11 @@ public type CXM_Form_Field: HTML_Id id, WebArgName web_arg_name, InitialValue init_value, + Phone_Type phone_type, Width width, Mandatory mandatory), - //--- phone field ------------------------------------------------------------ + //--- email field ------------------------------------------------------------ email_input( List(CoreAttrs) icon_options, List(CoreAttrs) options, @@ -108,6 +110,17 @@ public type CXM_Form_Field: InitialValue init_value, Width width, Mandatory mandatory), + + //--- url field ------------------------------------------------------------ + url_input( + List(CoreAttrs) icon_options, + List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + InitialValue init_value, + Width width, + Mandatory mandatory), //--- hidden field ------------------------------------------------------------ hidden( @@ -526,9 +539,9 @@ public define HTML_In_Form password_input(options, _label, id, name, init, w, mand) then password_input([class("in") . options], star(_label, mand), id, name, init, pixels(w)), - phone_input(icon_options, options, _label, id, wan, default, w, mand) then + phone_input(icon_options, options, _label, id, wan, default, phone_type, w, mand) then sequence([ - image(icon_options, "/icons/16x16/phone.png", ""), + image(icon_options, "/icons/16x16/"+to_Icon(phone_type), ""), text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), ]), @@ -536,7 +549,13 @@ public define HTML_In_Form sequence([ image(icon_options, "/icons/16x16/email_edit.png", ""), text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), - ]) + ]), + + url_input(icon_options, options, _label, id, wan, default, w, mand) then + sequence([ + image(icon_options, "/icons/16x16/url.png", ""), + text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), + ]), hidden(id, name, init) then hidden(id, name, init), diff --git a/web/widgets/specialized_elements.anubis b/web/widgets/specialized_elements.anubis index c37daa7..f73bc97 100644 --- a/web/widgets/specialized_elements.anubis +++ b/web/widgets/specialized_elements.anubis @@ -8,57 +8,150 @@ 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 + phone_icon ( List(CoreAttrs) attrs, String phone_number, - Bool image_only + Phone_Type phone_type, + Bool show_text )= if phone_number = "" then empty else - with _attrs = [data("phone-number", phone_number), event(onclick, "hk_phone_call(this)"), class("phone_click") . attrs], - div([ - img(_attrs, "/icons/16x16/phone.png"), - if image_only 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 + phone_icon ( List(CoreAttrs) attrs, String phone_number - )= phone(attrs, phone_number, false). + )= phone_icon(attrs, phone_number, generic, true). public define HTML_Off_Form - phone + phone_icon ( String phone_number )= - phone([], 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 - email + 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 + 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("email_click") . attrs], - div([ - img(_attrs, "/icons/16x16/email.png"), - text(_attrs, email_str) + 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 + email_icon ( - String phone_number + 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 )= - email([], phone_number) + url_icon(url_string, true) . -- libgit2 0.21.4