diff --git a/web/CXM_making_a_web_site.anubis b/web/CXM_making_a_web_site.anubis index 639e787..275c0f2 100644 --- a/web/CXM_making_a_web_site.anubis +++ b/web/CXM_making_a_web_site.anubis @@ -2173,12 +2173,16 @@ public define HTML_Off_Form input(CoreAttrs attr) // public define HTML_Off_Form img(List(CoreAttrs) attrs, String src, String alt) = html_void_tag("img", attrs + [attr("src",src), attr("alt",alt)] ). +public define HTML_Off_Form img(CoreAttrs _attr, String src, String alt) = html_void_tag("img", [_attr, attr("src",src), attr("alt",alt)] ). public define HTML_Off_Form img(String src) = img([], src, ""). public define HTML_Off_Form img(String src, String alt) = img([], src, alt). public define HTML_Off_Form img(List(CoreAttrs) attrs, String src) = img(attrs, src, ""). +public define HTML_Off_Form img(CoreAttrs attr, String src) = img([attr], src, ""). public define HTML_Off_Form img(String src, Int width, Int height) = img([attr("witdh",to_String(width)), attr("height",to_String(height))], src, src). public define HTML_Off_Form img(List(CoreAttrs) attrs, String src, String alt, Int width, Int height) = html_void_tag("img", attrs + [attr("src",src), attr("alt",alt), attr("witdh",to_String(width)), attr("height",to_String(height))]). +public define HTML_Off_Form img(CoreAttrs _attr, String src, String alt, Int width, Int height) = + html_void_tag("img", [_attr, attr("src",src), attr("alt",alt), attr("witdh",to_String(width)), attr("height",to_String(height))]). //
  • public define HTML_Off_Form li(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("li", attrs, content). @@ -2391,11 +2395,12 @@ public define HTML_Off_Form . public define HTML_Off_Form - table - ( - List(HTML_Row(HTML_Off_Form)) rows - ) = - table([],empty,rows,empty). + table + ( + List(HTML_Row(HTML_Off_Form)) rows + )= + table([], empty, rows,empty) +. public define HTML_Off_Form table @@ -2403,7 +2408,8 @@ public define HTML_Off_Form List(Table_Option) options, List(HTML_Row(HTML_Off_Form)) rows ) = - table(options,empty,rows,empty). + table(options,empty,rows,empty) +. public define HTML_Off_Form table @@ -2411,7 +2417,8 @@ public define HTML_Off_Form Table_Option option, HTML_Row(HTML_Off_Form) row ) = - table([option], empty, [row], empty). + table([option], empty, [row], empty) +. public define HTML_Off_Form table @@ -2419,7 +2426,8 @@ public define HTML_Off_Form HTML_Header_Row(HTML_Off_Form) h_row, List(HTML_Row(HTML_Off_Form)) rows ) = - table([],h_row,rows,empty). + table([],h_row,rows,empty) +. public define HTML_Off_Form table @@ -2428,7 +2436,18 @@ public define HTML_Off_Form HTML_Header_Row(HTML_Off_Form) h_row, List(HTML_Row(HTML_Off_Form)) rows ) = - table(options,h_row,rows,empty). + table(options,h_row,rows,empty) +. + +public define HTML_Off_Form + table + ( + Table_Option option, + HTML_Header_Row(HTML_Off_Form) h_row, + List(HTML_Row(HTML_Off_Form)) rows + ) = + table([option], h_row, rows,empty) +. We add two convenience functions for 'row'. The reason why we add two functions, one for 'HTML_In_Form' and one for 'HTML_Off_Form', is that adding a schema with an @@ -2615,7 +2634,11 @@ public define HTML_Partial_Content )= list_to_pcontent(l_p_content, [], []). - +public define HTML_Partial_Content + partial_empty + = + partial_content(empty) +. define String format @@ -2735,7 +2758,51 @@ public define HTTP_Answer HTML_Body body ) = html_page(http_ok, title, metas, styles, [], [], [], body). - + +public define HTTP_Answer + web_controller_error_page + ( + String name + ) + = + html_page + ( + name+" Controller error", // title of web site + [], // list of 'META' tags (empty for this site) + body // body of page + ( + // list of body options + [ + background_color(rgb(255,200,200)) + // add more body options here + ], + + // content of page + center(text(name+" Controller error")) + ) + ) +. + +define (WEB_Session)-> WEB_Controller_Result + web_controller_error + ( + String name + )= + ( + WEB_Session session + ) |-> + http_answer(session, web_controller_error_page(name)). + +public define WEB_Controller + web_controller + ( + String name, //controller name + Var(List(WEB_Action)) controller_actions //list of all actions of that controller + //(WEB_Session)-> WEB_Controller_Result error //Error renderer + )= + web_controller(name, controller_actions, web_controller_error(name)) +. + 'HTTP_Answer' represents the final product of the construction of a web page. -- libgit2 0.21.4