From 8b859764c3fc634c78b5c970950c660267309ef6 Mon Sep 17 00:00:00 2001 From: totoro Date: Sat, 18 Feb 2017 18:12:50 +0100 Subject: [PATCH] fix some function definition do be compatible with old action name (String) and let old project to compiles --- web/CXM_form.anubis | 48 +++++++++++++++++++++++++++++++++++++++--------- web/CXM_making_a_web_site.anubis | 46 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 84 insertions(+), 10 deletions(-) diff --git a/web/CXM_form.anubis b/web/CXM_form.anubis index dd1f9fe..e5ca9cf 100644 --- a/web/CXM_form.anubis +++ b/web/CXM_form.anubis @@ -317,6 +317,11 @@ public define CXM_Form_Field submit(WEB_Action_Name action_name, Maybe(String) label, String button_text, List((String,String)) extra_operands) = submit([], htmlClass(""), action_name, label, button_text, extra_operands). +public define CXM_Form_Field //Helper for older project wich use only String as Action name + submit(String _action_name, Maybe(String) label, String button_text, List((String,String)) extra_operands) + = submit([], htmlClass(""), action_name(_action_name), label, button_text, extra_operands). + + public define CXM_Form_Field upload(HTML_Label label, HTML_Id id, WebArgName name, Width width) = upload([], label, id, name, width, non_mandatory). @@ -634,6 +639,29 @@ public define HTML_Off_Form extra_ops, format_CXM_Form_Field(fields, lwa) ). + +public define HTML_Off_Form +/* older manner to call CXM_form with action as String. + * this function only exists for compatibility with older projects. Please consider + * to use the above function with WEB_Action_Name instead of String +*/ + cxm_form + ( + HTML_Id form_Id, + List(CoreAttrs) options, + String action, //older manner to call action with String + List((String,String)) extra_ops, + List(Web_arg) lwa, + List(CXM_Form_Field) fields + ) = + + form( + form_Id, + [class("cxm_form") . options], + action_name(action), + extra_ops, + format_CXM_Form_Field(fields, lwa) + ). public define HTML_Off_Form cxm_form @@ -646,17 +674,19 @@ public define HTML_Off_Form List(CXM_Form_Field) form_fields )= cxm_form(html_Id(form_name), options, action, extra_ops, lwa, form_fields). - - public define HTML_In_Form - cxm_fieldset + +public define HTML_Off_Form + cxm_form ( - HTML_Id fieldSetId, + String form_name, + List(CoreAttrs) options, + String action, + List((String,String)) extra_ops, List(Web_arg) lwa, - List(CXM_Form_Field) fields - ) = - cxm_fieldset([id(fieldSetId.id), class("aligned")], "", lwa, fields). - - + List(CXM_Form_Field) form_fields + )= + cxm_form(html_Id(form_name), options, action_name(action), extra_ops, lwa, form_fields). + public define HTML_Off_Form cxm_form diff --git a/web/CXM_making_a_web_site.anubis b/web/CXM_making_a_web_site.anubis index f304692..5b9f19a 100644 --- a/web/CXM_making_a_web_site.anubis +++ b/web/CXM_making_a_web_site.anubis @@ -1416,6 +1416,22 @@ public define HTML_In_Form )= actioner(conn,targ,asp,action,extra_ops,[]) . + +public define HTML_In_Form +/* Older call with String as action instead of WEB_Action_Name. + * This function exists only for compatibility with older project. + * Please condiser to use above function instead + */ + actioner + ( + Actioner_Connection conn, + Actioner_Target targ, + Actioner_Aspect asp, + String action, + List((String,String)) extra_ops + )= + actioner(conn,targ,asp,action_name(action),extra_ops,[]) +. public define HTML_In_Form actioner @@ -1653,6 +1669,22 @@ public define HTML_Off_Form List((String,String)) extra_ops ) = actioner(conn,targ,asp,action,extra_ops,[]). + +public define HTML_Off_Form +/* Older call with String as action instead of WEB_Action_Name. + * This function exists only for compatibility with older project. + * Please condiser to use above function instead + */ + actioner + ( + Actioner_Connection conn, + Actioner_Target targ, + Actioner_Aspect asp, + String action, + List((String,String)) extra_ops + )= + actioner(conn,targ,asp,action_name(action),extra_ops,[]) +. public define HTML_Off_Form table @@ -1896,7 +1928,19 @@ public type HTML_Meta: literal (String). Meta tags are put in the 'head' of the HTML page. - + +public define HTML_Meta + refresh + ( + Actioner_Connection connection, + Actioner_Target target, + String action, + Int delay + )= + refresh(connection, target, action_name(action), delay) +. + + public type Body_Option: core_attrs(List(CoreAttrs)), -- libgit2 0.21.4