Commit c7f68b4bcce6a6ff12beae1514ff45ff13c43ec9

Authored by totoro
1 parent 3db9f7fe

add renderer_content in type WEB_Controller_Result. this alternative return the …

…main content to be shown by the current renderer.
It's the result sent by a plugin to renderer. The renderer is set by the application when it's need. Hence we can have any sort of renderer (desktop, mobile, etc..) the show plugin content

remove a lot of alternative of the HTML_Off_Form type (like image, ul, ol, il, etc look the diff of the current commit) and replaced by the html_tag and html_void_tag. This allow to add more quickly new html5 tag instead of big type with a lot of alternative. Most of the html5 tag follow the same schema in their format

move show_page_message from application to the Calexium_lib library

add Plugin_Left_Menu type in left_menu. This allows to have named left menu in stack and choose the correct one when it's need
web/CXM_making_a_web_site.anubis
@@ -118,17 +118,17 @@ transmit calexium_lib/web/types/web_action_name.anubis @@ -118,17 +118,17 @@ transmit calexium_lib/web/types/web_action_name.anubis
118 The next picture shows the structure we have in mind: 118 The next picture shows the structure we have in mind:
119 119
120 120
121 - request +---------+ HTML page (with a hidden state name) 121 + request +---------+ HTML page (with state name in cookie)
122 .-------------------| client |<--------------. 122 .-------------------| client |<--------------.
123 | .-----------------| | | 123 | .-----------------| | |
124 - | | previous state +---------+ |  
125 - | | name (if any) | 124 + | | session +---------+ |
  125 + | | in cookie |
126 | | | client side 126 | | | client side
127 ............................................................................ 127 ............................................................................
128 | | | server side 128 | | | server side
129 | | | 129 | | |
130 | | .-------------------. | 130 | | .-------------------. |
131 - | | | previous state | | 131 + | | | previous session | |
132 V V V | | 132 V V V | |
133 +---------------+ +---------------+ +--------------+ 133 +---------------+ +---------------+ +--------------+
134 | compute state | | server's disk | | compute page | 134 | compute state | | server's disk | | compute page |
@@ -327,65 +327,128 @@ public type WEB_Controller_Result: @@ -327,65 +327,128 @@ public type WEB_Controller_Result:
327 Var(List(WEB_Session_Field)) fields 327 Var(List(WEB_Session_Field)) fields
328 ), 328 ),
329 ajax( 329 ajax(
330 - HTTP_Answer http_answer  
331 - ),  
332 - ajax(  
333 - WEB_Session session, //modified session  
334 - HTTP_Answer http_answer //http answer  
335 - ),  
336 - ajax(  
337 - HTML_Partial_Content content,  
338 - String additional_script 330 + Maybe(WEB_Session) mb_session, //modified session if success else failure
  331 + HTTP_Answer http_answer //http answer
339 ), 332 ),
340 ajax( 333 ajax(
341 - WEB_Session session, //modified session 334 + Maybe(WEB_Session) mb_session, //modified session if success else failure
342 HTML_Partial_Content content, 335 HTML_Partial_Content content,
343 String additional_script 336 String additional_script
344 ), 337 ),
345 ajax( 338 ajax(
346 - Printable_tree content,  
347 - String additional_script  
348 - ),  
349 - ajax(  
350 - WEB_Session session, //modified session 339 + Maybe(WEB_Session) mb_session, //modified session if success else failure
351 Printable_tree content, 340 Printable_tree content,
352 String additional_script 341 String additional_script
353 ), 342 ),
354 send_file( 343 send_file(
355 String full_path //full path with file name of the file to send 344 String full_path //full path with file name of the file to send
  345 + ),
  346 + renderer_content(
  347 + Maybe(WEB_Session) mb_session, //modified session if success else failure
  348 + String title,
  349 + HTML_Partial_Content content,
356 ) 350 )
357 . 351 .
358 352
359 public define WEB_Controller_Result 353 public define WEB_Controller_Result
360 ajax 354 ajax
361 ( 355 (
  356 + HTTP_Answer http_answer
  357 + )=
  358 + ajax(failure, http_answer)
  359 +.
  360 +
  361 +public define WEB_Controller_Result
  362 + ajax
  363 + (
  364 + WEB_Session session, //modified session
  365 + HTTP_Answer http_answer
  366 + )=
  367 + ajax(success(session), http_answer)
  368 +.
  369 +
  370 +public define WEB_Controller_Result
  371 + ajax
  372 + (
362 HTML_Partial_Content content 373 HTML_Partial_Content content
363 )= 374 )=
364 - ajax(content, ""). 375 + ajax(failure, content, "").
365 376
366 public define WEB_Controller_Result 377 public define WEB_Controller_Result
367 ajax 378 ajax
368 ( 379 (
  380 + HTML_Partial_Content content,
  381 + String additional_script
  382 + )=
  383 + ajax(failure, content, additional_script).
  384 +
  385 +public define WEB_Controller_Result
  386 + ajax
  387 + (
369 WEB_Session session, //modified session 388 WEB_Session session, //modified session
370 HTML_Partial_Content content 389 HTML_Partial_Content content
371 )= 390 )=
372 - ajax(session, content, ""). 391 + ajax(success(session), content, "").
  392 +
  393 +public define WEB_Controller_Result
  394 + ajax
  395 + (
  396 + WEB_Session session, //modified session
  397 + HTML_Partial_Content content,
  398 + String additional_script
  399 + )=
  400 + ajax(success(session), content, additional_script).
373 401
374 public define WEB_Controller_Result 402 public define WEB_Controller_Result
375 ajax 403 ajax
376 ( 404 (
377 Printable_tree content 405 Printable_tree content
378 )= 406 )=
379 - ajax(content, ""). 407 + ajax(failure, content, "").
380 408
381 public define WEB_Controller_Result 409 public define WEB_Controller_Result
382 ajax 410 ajax
383 ( 411 (
  412 + Printable_tree content,
  413 + String additional_script
  414 + )=
  415 + ajax(failure, content, additional_script).
  416 +
  417 +public define WEB_Controller_Result
  418 + ajax
  419 + (
384 WEB_Session session, //modified session 420 WEB_Session session, //modified session
385 Printable_tree content 421 Printable_tree content
386 )= 422 )=
387 - ajax(session, content, ""). 423 + ajax(success(session), content, "").
388 424
  425 +public define WEB_Controller_Result
  426 + ajax
  427 + (
  428 + WEB_Session session, //modified session
  429 + Printable_tree content,
  430 + String additional_script
  431 + )=
  432 + ajax(success(session), content, additional_script).
  433 +
  434 +public define WEB_Controller_Result
  435 + renderer_content(
  436 + String title,
  437 + HTML_Partial_Content content,
  438 + )=
  439 + renderer_content(failure, title, content)
  440 +.
  441 +
  442 +public define WEB_Controller_Result
  443 + renderer_content(
  444 + WEB_Session session, //modified session if success else failure
  445 + String title,
  446 + HTML_Partial_Content content,
  447 + )=
  448 + renderer_content(success(session), title, content)
  449 +.
  450 +
  451 +
389 public type WEB_Action_Allowed_Protocol: 452 public type WEB_Action_Allowed_Protocol:
390 http, 453 http,
391 https, 454 https,
@@ -408,6 +471,14 @@ public type WEB_Controller: @@ -408,6 +471,14 @@ public type WEB_Controller:
408 ) 471 )
409 . 472 .
410 473
  474 +public type WEB_Page_Renderer:
  475 + web_page_renderer(
  476 + String name, //renderer name
  477 + (WEB_Session _session, String title, HTML_Partial_Content _content) -> HTTP_Answer page_layout //call back for rendering page
  478 + )
  479 +.
  480 +
  481 +
411 define List(HTTP_header) 482 define List(HTTP_header)
412 make_session_cookie_headers 483 make_session_cookie_headers
413 ( 484 (
@@ -949,17 +1020,7 @@ public define InputAttrs @@ -949,17 +1020,7 @@ public define InputAttrs
949 public type I18n: 1020 public type I18n:
950 lang (String), 1021 lang (String),
951 dir (Reading_Way). 1022 dir (Reading_Way).
952 -  
953 -//public type DIV_Option:  
954 -// id (String),  
955 -// class (String),  
956 -// style (String),  
957 -// tooltip (String),  
958 -// lang (String),  
959 -// dir (Reading_Way),  
960 -// attr (String, String),  
961 -// event (HtmlEvents, String).  
962 -// 1023 +
963 1024
964 A list of 'DIV_Option' must be given with each DIV you want to put in your page. 1025 A list of 'DIV_Option' must be given with each DIV you want to put in your page.
965 1026
@@ -970,24 +1031,24 @@ define String event_name @@ -970,24 +1031,24 @@ define String event_name
970 if e is 1031 if e is
971 { 1032 {
972 // Form element events 1033 // Form element events
973 - onchange then "onchange",  
974 - onsubmit then "onsubmit", 1034 + onchange then "onchange",
  1035 + onsubmit then "onsubmit",
975 onreset then "onreset", 1036 onreset then "onreset",
976 - onselect then "onselect",  
977 - onblur then "onblur", 1037 + onselect then "onselect",
  1038 + onblur then "onblur",
978 onfocus then "onfocus", 1039 onfocus then "onfocus",
979 // Keyboard events 1040 // Keyboard events
980 onkeydown then "onkeydown", 1041 onkeydown then "onkeydown",
981 - onkeypress then "onkeypress", 1042 + onkeypress then "onkeypress",
982 onkeyup then "onkeyup", 1043 onkeyup then "onkeyup",
983 // Mouse events 1044 // Mouse events
984 onclick then "onclick", 1045 onclick then "onclick",
985 - ondblclick then "ondblclick",  
986 - onmousedown then "onmousedown",  
987 - onmousemove then "onmousemove", 1046 + ondblclick then "ondblclick",
  1047 + onmousedown then "onmousedown",
  1048 + onmousemove then "onmousemove",
988 onmouseout then "onmouseout", 1049 onmouseout then "onmouseout",
989 - onmouseover then "onmouseover",  
990 - onmouseup then "onmouseup" 1050 + onmouseover then "onmouseover",
  1051 + onmouseup then "onmouseup"
991 }. 1052 }.
992 1053
993 public type Table_Option: 1054 public type Table_Option:
@@ -1029,13 +1090,13 @@ public type Cell_Option: @@ -1029,13 +1090,13 @@ public type Cell_Option:
1029 base_line, // align the content vertically according to base lines 1090 base_line, // align the content vertically according to base lines
1030 background_color(RGB), 1091 background_color(RGB),
1031 background_image(String url, BackgroundOption), 1092 background_image(String url, BackgroundOption),
1032 - width(Int), // sets a minimal width for the cell 1093 + width(Int), // sets a minimal width for the cell
1033 percentage_width(Int), 1094 percentage_width(Int),
1034 - height(Int), // sets a minimal height for the cell  
1035 - columns(Int), // lets the cell span over several columns  
1036 - rows(Int), // lets the cell span over several rows 1095 + height(Int), // sets a minimal height for the cell
  1096 + columns(Int), // lets the cell span over several columns
  1097 + rows(Int), // lets the cell span over several rows
1037 nowrap, // do not allow text wrapping within the cell 1098 nowrap, // do not allow text wrapping within the cell
1038 - style(String), // in case nothing above is suitable 1099 + style(String), // in case nothing above is suitable
1039 class(String class_name). 1100 class(String class_name).
1040 1101
1041 A list of 'Cell_Option' must be given with each cell and each row in a table. Options 1102 A list of 'Cell_Option' must be given with each cell and each row in a table. Options
@@ -1743,10 +1804,7 @@ public type HTML_Off_Form: @@ -1743,10 +1804,7 @@ public type HTML_Off_Form:
1743 literal (String), 1804 literal (String),
1744 sequence (List(HTML_Off_Form) items), 1805 sequence (List(HTML_Off_Form) items),
1745 text (List(CoreAttrs), String the_text), 1806 text (List(CoreAttrs), String the_text),
1746 - preformated (List(Text_Option), String),  
1747 - paragraph (List(Text_Option), List(HTML_Off_Form) content),  
1748 - image (List(CoreAttrs), String url, String alternate),  
1749 - image (List(CoreAttrs), String url, String alternate, Int width, Int height), 1807 + preformated (List(Text_Option), String),
1750 table (List(Table_Option), HTML_Header_Row(HTML_Off_Form), List(HTML_Row(HTML_Off_Form)), HTML_Footer_Row(HTML_Off_Form)), 1808 table (List(Table_Option), HTML_Header_Row(HTML_Off_Form), List(HTML_Row(HTML_Off_Form)), HTML_Footer_Row(HTML_Off_Form)),
1751 center (HTML_Off_Form), 1809 center (HTML_Off_Form),
1752 mail_to (String email, HTML_Off_Form element), 1810 mail_to (String email, HTML_Off_Form element),
@@ -1772,34 +1830,24 @@ public type HTML_Off_Form: @@ -1772,34 +1830,24 @@ public type HTML_Off_Form:
1772 WEB_Action_Name action, List((String,String)) extra_ops, 1830 WEB_Action_Name action, List((String,String)) extra_ops,
1773 List(HTML_In_Form) content), 1831 List(HTML_In_Form) content),
1774 in_form (HTML_Id form_id, HTML_In_Form content), 1832 in_form (HTML_Id form_id, HTML_In_Form content),
1775 - div (List(CoreAttrs), List(HTML_Off_Form) content),  
1776 div (List(CoreAttrs), List(HTML_Partial_Content) p_content), 1833 div (List(CoreAttrs), List(HTML_Partial_Content) p_content),
1777 - div_empty (List(CoreAttrs)),  
1778 iframe (List(CoreAttrs), 1834 iframe (List(CoreAttrs),
1779 List(CSS_Style) /*styles*/, 1835 List(CSS_Style) /*styles*/,
1780 List(CSS_File) /*css_files*/, 1836 List(CSS_File) /*css_files*/,
1781 List(JS_File) /*js_files*/, 1837 List(JS_File) /*js_files*/,
1782 HTML_Body /*body*/), 1838 HTML_Body /*body*/),
1783 partial (HTML_Partial_Content), 1839 partial (HTML_Partial_Content),
1784 - br,  
1785 progress (List(CoreAttrs), Int value, Int max), 1840 progress (List(CoreAttrs), Int value, Int max),
1786 - ol (List(CoreAttrs), List(HTML_Off_Form) content),  
1787 - ul (List(CoreAttrs), List(HTML_Off_Form) content),  
1788 - li (List(CoreAttrs), List(HTML_Off_Form) content),  
1789 - button (List(CoreAttrs), List(HTML_Off_Form) content),  
1790 i (List(CoreAttrs), String text), 1841 i (List(CoreAttrs), String text),
1791 - span (List(CoreAttrs), String text),  
1792 - strong (List(CoreAttrs), List(HTML_Off_Form) content),  
1793 - hr (List(CoreAttrs)),  
1794 - h1 (List(CoreAttrs), List(HTML_Off_Form) content),  
1795 - h2 (List(CoreAttrs), List(HTML_Off_Form) content),  
1796 - h3 (List(CoreAttrs), List(HTML_Off_Form) content),  
1797 - h4 (List(CoreAttrs), List(HTML_Off_Form) content),  
1798 - h5 (List(CoreAttrs), List(HTML_Off_Form) content),  
1799 - h6 (List(CoreAttrs), List(HTML_Off_Form) content) 1842 + html_tag (String tag_name, List(CoreAttrs), List(HTML_Off_Form) content),
  1843 + html_void_tag (String tag_name, List(CoreAttrs))
1800 . 1844 .
1801 1845
1802 'HTML_Off_Form' defines all the elements you may put outside any form. 1846 'HTML_Off_Form' defines all the elements you may put outside any form.
  1847 +
  1848 +public define HTML_Off_Form text(List(CoreAttrs) lto, Int i) = text(lto, to_decimal(i)).
  1849 +public define HTML_Off_Form text(Int i) = text([], i).
  1850 +public define HTML_Off_Form text(String s) = text([], s).
1803 1851
1804 public define HTML_Off_Form a(A_href _href) = a([], _href, _self, []). 1852 public define HTML_Off_Form a(A_href _href) = a([], _href, _self, []).
1805 public define HTML_Off_Form a(List(CoreAttrs) attrs, A_href _href) = a(attrs, _href, _self, []). 1853 public define HTML_Off_Form a(List(CoreAttrs) attrs, A_href _href) = a(attrs, _href, _self, []).
@@ -1808,38 +1856,149 @@ public define HTML_Off_Form a(List(CoreAttrs) attrs, A_href _href, List(HTML_Off @@ -1808,38 +1856,149 @@ public define HTML_Off_Form a(List(CoreAttrs) attrs, A_href _href, List(HTML_Off
1808 public define HTML_Off_Form a(A_href _href, HTML_Off_Form content) = a([], _href, _self, [content]). 1856 public define HTML_Off_Form a(A_href _href, HTML_Off_Form content) = a([], _href, _self, [content]).
1809 public define HTML_Off_Form a(A_href _href, List(HTML_Off_Form) content) = a([], _href, _self, content). 1857 public define HTML_Off_Form a(A_href _href, List(HTML_Off_Form) content) = a([], _href, _self, content).
1810 1858
1811 -  
1812 -public define HTML_Off_Form strong(HTML_Off_Form content) = strong([], [content]).  
1813 -public define HTML_Off_Form strong(List(HTML_Off_Form) content) = strong([], content).  
1814 -public define HTML_Off_Form strong(List(CoreAttrs) attrs, HTML_Off_Form content) = strong(attrs, [content]).  
1815 -  
1816 -public define HTML_Off_Form h1(HTML_Off_Form content) = h1([], [content]).  
1817 -public define HTML_Off_Form h1(List(HTML_Off_Form) content) = h1([], content).  
1818 -public define HTML_Off_Form h1(List(CoreAttrs) attrs, HTML_Off_Form content) = h1(attrs, [content]).  
1819 -  
1820 -public define HTML_Off_Form h2(HTML_Off_Form content) = h2([], [content]).  
1821 -public define HTML_Off_Form h2(List(HTML_Off_Form) content) = h2([], content).  
1822 -public define HTML_Off_Form h2(List(CoreAttrs) attrs, HTML_Off_Form content) = h2(attrs, [content]).  
1823 -  
1824 -public define HTML_Off_Form h3(HTML_Off_Form content) = h3([], [content]).  
1825 -public define HTML_Off_Form h3(List(HTML_Off_Form) content) = h3([], content).  
1826 -public define HTML_Off_Form h3(List(CoreAttrs) attrs, HTML_Off_Form content) = h3(attrs, [content]).  
1827 -  
1828 -public define HTML_Off_Form h4(HTML_Off_Form content) = h4([], [content]).  
1829 -public define HTML_Off_Form h4(List(HTML_Off_Form) content) = h4([], content).  
1830 -public define HTML_Off_Form h4(List(CoreAttrs) attrs, HTML_Off_Form content) = h4(attrs, [content]).  
1831 -  
1832 -public define HTML_Off_Form h5(HTML_Off_Form content) = h5([], [content]).  
1833 -public define HTML_Off_Form h5(List(HTML_Off_Form) content) = h5([], content).  
1834 -public define HTML_Off_Form h5(List(CoreAttrs) attrs, HTML_Off_Form content) = h5(attrs, [content]). 1859 + // <article>
  1860 +public define HTML_Off_Form article(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("article", attrs, content).
  1861 +public define HTML_Off_Form article(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("article", attrs, [content]).
  1862 +public define HTML_Off_Form article(List(HTML_Off_Form) content) = html_tag("article", [], content).
  1863 +public define HTML_Off_Form article(HTML_Off_Form content) = html_tag("article", [], [content]).
  1864 +
  1865 + // <aside>
  1866 +public define HTML_Off_Form aside(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("aside", attrs, content).
  1867 +public define HTML_Off_Form aside(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("aside", attrs, [content]).
  1868 +public define HTML_Off_Form aside(List(HTML_Off_Form) content) = html_tag("aside", [], content).
  1869 +public define HTML_Off_Form aside(HTML_Off_Form content) = html_tag("aside", [], [content]).
  1870 +
  1871 + // <br>
  1872 +public define HTML_Off_Form br = html_void_tag("br", []).
  1873 +public define HTML_Off_Form br(List(CoreAttrs) attrs) = html_void_tag("br", attrs).
  1874 +
  1875 + // <button>
  1876 +public define HTML_Off_Form button(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("button", attrs, content).
  1877 +public define HTML_Off_Form button(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("button", attrs, [content]).
  1878 +public define HTML_Off_Form button(List(HTML_Off_Form) content) = html_tag("button", [], content).
  1879 +public define HTML_Off_Form button(HTML_Off_Form content) = html_tag("button", [], [content]).
  1880 +
  1881 + // <div>
  1882 +public define HTML_Off_Form div(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("div", attrs, content).
  1883 +public define HTML_Off_Form div(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("div", attrs, [content]).
  1884 +public define HTML_Off_Form div(List(HTML_Off_Form) content) = html_tag("div", [], content).
  1885 +public define HTML_Off_Form div(HTML_Off_Form content) = html_tag("div", [], [content]).
  1886 +public define HTML_Off_Form div(List(CoreAttrs) attrs) = html_tag("div", attrs, [empty]).
  1887 +
  1888 + // <dd>
  1889 +public define HTML_Off_Form dd(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("dd", attrs, content).
  1890 +public define HTML_Off_Form dd(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("dd", attrs, [content]).
  1891 +public define HTML_Off_Form dd(List(HTML_Off_Form) content) = html_tag("dd", [], content).
  1892 +public define HTML_Off_Form dd(HTML_Off_Form content) = html_tag("dd", [], [content]).
  1893 +
  1894 + // <dl>
  1895 +public define HTML_Off_Form dl(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("dl", attrs, content).
  1896 +public define HTML_Off_Form dl(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("dl", attrs, [content]).
  1897 +public define HTML_Off_Form dl(List(HTML_Off_Form) content) = html_tag("dl", [], content).
  1898 +public define HTML_Off_Form dl(HTML_Off_Form content) = html_tag("dl", [], [content]).
  1899 +
  1900 + // <footer>
  1901 +public define HTML_Off_Form footer(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("footer", attrs, content).
  1902 +public define HTML_Off_Form footer(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("footer", attrs, [content]).
  1903 +public define HTML_Off_Form footer(List(HTML_Off_Form) content) = html_tag("footer", [], content).
  1904 +public define HTML_Off_Form footer(HTML_Off_Form content) = html_tag("footer", [], [content]).
  1905 +
  1906 + // <header>
  1907 +public define HTML_Off_Form header(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("header", attrs, content).
  1908 +public define HTML_Off_Form header(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("header", attrs, [content]).
  1909 +public define HTML_Off_Form header(List(HTML_Off_Form) content) = html_tag("header", [], content).
  1910 +public define HTML_Off_Form header(HTML_Off_Form content) = html_tag("header", [], [content]).
  1911 +
  1912 + // <h1>
  1913 +public define HTML_Off_Form h1(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h1", attrs, content).
  1914 +public define HTML_Off_Form h1(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h1", attrs, [content]).
  1915 +public define HTML_Off_Form h1(List(HTML_Off_Form) content) = html_tag("h1", [], content).
  1916 +public define HTML_Off_Form h1(HTML_Off_Form content) = html_tag("h1", [], [content]).
  1917 + // <h2>
  1918 +public define HTML_Off_Form h2(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h2", attrs, content).
  1919 +public define HTML_Off_Form h2(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h2", attrs, [content]).
  1920 +public define HTML_Off_Form h2(List(HTML_Off_Form) content) = html_tag("h2", [], content).
  1921 +public define HTML_Off_Form h2(HTML_Off_Form content) = html_tag("h2", [], [content]).
  1922 + // <h3>
  1923 +public define HTML_Off_Form h3(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h3", attrs, content).
  1924 +public define HTML_Off_Form h3(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h3", attrs, [content]).
  1925 +public define HTML_Off_Form h3(List(HTML_Off_Form) content) = html_tag("h3", [], content).
  1926 +public define HTML_Off_Form h3(HTML_Off_Form content) = html_tag("h3", [], [content]).
  1927 + // <h4>
  1928 +public define HTML_Off_Form h4(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h4", attrs, content).
  1929 +public define HTML_Off_Form h4(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h4", attrs, [content]).
  1930 +public define HTML_Off_Form h4(List(HTML_Off_Form) content) = html_tag("h4", [], content).
  1931 +public define HTML_Off_Form h4(HTML_Off_Form content) = html_tag("h4", [], [content]).
  1932 + // <h5>
  1933 +public define HTML_Off_Form h5(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h5", attrs, content).
  1934 +public define HTML_Off_Form h5(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h5", attrs, [content]).
  1935 +public define HTML_Off_Form h5(List(HTML_Off_Form) content) = html_tag("h5", [], content).
  1936 +public define HTML_Off_Form h5(HTML_Off_Form content) = html_tag("h5", [], [content]).
  1937 +
  1938 + // <h6>
  1939 +public define HTML_Off_Form h6(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("h6", attrs, content).
  1940 +public define HTML_Off_Form h6(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("h6", attrs, [content]).
  1941 +public define HTML_Off_Form h6(List(HTML_Off_Form) content) = html_tag("h6", [], content).
  1942 +public define HTML_Off_Form h6(HTML_Off_Form content) = html_tag("h6", [], [content]).
  1943 +
  1944 + // <img>
  1945 +public define HTML_Off_Form img(List(CoreAttrs) attrs, String src, String alt) = html_void_tag("img", attrs + [attr("src",src), attr("alt",alt)] ).
  1946 +public define HTML_Off_Form img(String src) = img([], src, "").
  1947 +public define HTML_Off_Form img(String src, String alt) = img([], src, alt).
  1948 +public define HTML_Off_Form img(List(CoreAttrs) attrs, String src) = img(attrs, src, "").
  1949 +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).
  1950 +public define HTML_Off_Form img(List(CoreAttrs) attrs, String src, String alt, Int width, Int height) =
  1951 + html_void_tag("img", attrs + [attr("src",src), attr("alt",alt), attr("witdh",to_String(width)), attr("height",to_String(height))]).
  1952 +
  1953 + // <li>
  1954 +public define HTML_Off_Form li(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("li", attrs, content).
  1955 +public define HTML_Off_Form li(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("li", attrs, [content]).
  1956 +public define HTML_Off_Form li(List(HTML_Off_Form) content) = html_tag("li", [], content).
  1957 +public define HTML_Off_Form li(HTML_Off_Form content) = html_tag("li", [], [content]).
  1958 +
  1959 + // <nav>
  1960 +public define HTML_Off_Form nav(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("nav", attrs, content).
  1961 +public define HTML_Off_Form nav(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("nav", attrs, [content]).
  1962 +public define HTML_Off_Form nav(List(HTML_Off_Form) content) = html_tag("nav", [], content).
  1963 +public define HTML_Off_Form nav(HTML_Off_Form content) = html_tag("nav", [], [content]).
  1964 +
  1965 + // <ol>
  1966 +public define HTML_Off_Form ol(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("ol", attrs, content).
  1967 +public define HTML_Off_Form ol(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("ol", attrs, [content]).
  1968 +public define HTML_Off_Form ol(List(HTML_Off_Form) content) = html_tag("ol", [], content).
  1969 +public define HTML_Off_Form ol(HTML_Off_Form content) = html_tag("ol", [], [content]).
  1970 +
  1971 + // <p>
  1972 +public define HTML_Off_Form p(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("p", attrs, content).
  1973 +public define HTML_Off_Form p(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("p", attrs, [content]).
  1974 +public define HTML_Off_Form p(List(HTML_Off_Form) content) = html_tag("p", [], content).
  1975 +public define HTML_Off_Form p(HTML_Off_Form content) = html_tag("p", [], [content]).
  1976 +
  1977 + // <section>
  1978 +public define HTML_Off_Form section(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("section", attrs, content).
  1979 +public define HTML_Off_Form section(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("section", attrs, [content]).
  1980 +public define HTML_Off_Form section(List(HTML_Off_Form) content) = html_tag("section", [], content).
  1981 +public define HTML_Off_Form section(HTML_Off_Form content) = html_tag("section", [], [content]).
  1982 +
  1983 + // <span>
  1984 +public define HTML_Off_Form span(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("span", attrs, content).
  1985 +public define HTML_Off_Form span(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("span", attrs, [content]).
  1986 +public define HTML_Off_Form span(List(HTML_Off_Form) content) = html_tag("span", [], content).
  1987 +public define HTML_Off_Form span(HTML_Off_Form content) = html_tag("span", [], [content]).
  1988 +public define HTML_Off_Form span(Int i) = html_tag("span", [], [text(to_decimal(i))]).
  1989 +
  1990 + // <strong>
  1991 +public define HTML_Off_Form strong(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("strong", attrs, content).
  1992 +public define HTML_Off_Form strong(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("strong", attrs, [content]).
  1993 +public define HTML_Off_Form strong(List(HTML_Off_Form) content) = html_tag("strong", [], content).
  1994 +public define HTML_Off_Form strong(HTML_Off_Form content) = html_tag("strong", [], [content]).
  1995 +
  1996 + // <ul>
  1997 +public define HTML_Off_Form ul(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("ul", attrs, content).
  1998 +public define HTML_Off_Form ul(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("ul", attrs, [content]).
  1999 +public define HTML_Off_Form ul(List(HTML_Off_Form) content) = html_tag("ul", [], content).
  2000 +public define HTML_Off_Form ul(HTML_Off_Form content) = html_tag("ul", [], [content]).
1835 2001
1836 -public define HTML_Off_Form h6(HTML_Off_Form content) = h6([], [content]).  
1837 -public define HTML_Off_Form h6(List(HTML_Off_Form) content) = h6([], content).  
1838 -public define HTML_Off_Form h6(List(CoreAttrs) attrs, HTML_Off_Form content) = h6(attrs, [content]).  
1839 -  
1840 -public define HTML_Off_Form image(String url) = image([], url, url).  
1841 -public define HTML_Off_Form image(List(CoreAttrs) attrs, String url) = image(attrs, url, url).  
1842 -public define HTML_Off_Form image(String url, Int width, Int height) = image([], url, url, width, height).  
1843 2002
1844 public define HTML_Off_Form 2003 public define HTML_Off_Form
1845 form 2004 form
@@ -2072,56 +2231,9 @@ public define HTML_Off_Form @@ -2072,56 +2231,9 @@ public define HTML_Off_Form
2072 List((String,String)) args 2231 List((String,String)) args
2073 ) = 2232 ) =
2074 private_download(abs_path,name,extra_ext,success((action_name,args))). 2233 private_download(abs_path,name,extra_ext,success((action_name,args))).
2075 -  
2076 -public define HTML_Off_Form  
2077 - text  
2078 - (  
2079 - List(CoreAttrs) lto,  
2080 - Int i  
2081 - )=  
2082 - text(lto, to_decimal(i))  
2083 -.  
2084 -  
2085 -public define HTML_Off_Form  
2086 - text  
2087 - (  
2088 - Int i  
2089 - )=  
2090 - text([], i)  
2091 -.  
2092 -  
2093 -public define HTML_Off_Form  
2094 - text  
2095 - (  
2096 - String s  
2097 - )=  
2098 - text([], s)  
2099 -.  
2100 2234
2101 -public define HTML_Off_Form  
2102 - div  
2103 - (  
2104 - HTML_Off_Form element  
2105 - )=  
2106 - div([], [element])  
2107 . 2235 .
2108 2236
2109 -public define HTML_Off_Form  
2110 - div  
2111 - (  
2112 - List(CoreAttrs) attrs,  
2113 - HTML_Off_Form element  
2114 - )=  
2115 - div(attrs, [element])  
2116 -.  
2117 -  
2118 -public define HTML_Off_Form  
2119 - div  
2120 - (  
2121 - List(HTML_Off_Form) elements  
2122 - )=  
2123 - div([], elements)  
2124 -.  
2125 2237
2126 public define HTML_Off_Form 2238 public define HTML_Off_Form
2127 div 2239 div
@@ -2148,128 +2260,6 @@ public define HTML_Off_Form @@ -2148,128 +2260,6 @@ public define HTML_Off_Form
2148 div([], elements) 2260 div([], elements)
2149 . 2261 .
2150 2262
2151 -public define HTML_Off_Form  
2152 - li  
2153 - (  
2154 - List(HTML_Off_Form) elements  
2155 - )=  
2156 - li([], elements)  
2157 -.  
2158 -  
2159 -public define HTML_Off_Form  
2160 - li  
2161 - (  
2162 - List(CoreAttrs) attrs,  
2163 - HTML_Off_Form element  
2164 - )=  
2165 - li(attrs, [element])  
2166 -.  
2167 -  
2168 -public define HTML_Off_Form  
2169 - li  
2170 - (  
2171 - HTML_Off_Form element  
2172 - )=  
2173 - li([], [element])  
2174 -.  
2175 -  
2176 -public define HTML_Off_Form  
2177 - ul  
2178 - (  
2179 - List(HTML_Off_Form) elements  
2180 - )=  
2181 - ul([], elements)  
2182 -.  
2183 -  
2184 -public define HTML_Off_Form  
2185 - ul  
2186 - (  
2187 - List(CoreAttrs) attrs,  
2188 - HTML_Off_Form element  
2189 - )=  
2190 - ul(attrs, [element])  
2191 -.  
2192 -  
2193 -public define HTML_Off_Form  
2194 - ul  
2195 - (  
2196 - HTML_Off_Form element  
2197 - )=  
2198 - ul([], [element])  
2199 -.  
2200 -  
2201 -public define HTML_Off_Form  
2202 - ol  
2203 - (  
2204 - List(HTML_Off_Form) elements  
2205 - )=  
2206 - ol([], elements)  
2207 -.  
2208 -  
2209 -public define HTML_Off_Form  
2210 - ol  
2211 - (  
2212 - List(CoreAttrs) attrs,  
2213 - HTML_Off_Form element  
2214 - )=  
2215 - ol(attrs, [element])  
2216 -.  
2217 -  
2218 -public define HTML_Off_Form  
2219 - ol  
2220 - (  
2221 - HTML_Off_Form element  
2222 - )=  
2223 - ol([], [element])  
2224 -.  
2225 -  
2226 -public define HTML_Off_Form  
2227 - paragraph  
2228 - (  
2229 - List(HTML_Off_Form) elements  
2230 - )=  
2231 - paragraph([], elements)  
2232 -.  
2233 -  
2234 -public define HTML_Off_Form  
2235 - paragraph  
2236 - (  
2237 - List(Text_Option) attrs,  
2238 - HTML_Off_Form element  
2239 - )=  
2240 - paragraph(attrs, [element])  
2241 -.  
2242 -  
2243 -public define HTML_Off_Form  
2244 - paragraph  
2245 - (  
2246 - HTML_Off_Form element  
2247 - )=  
2248 - paragraph([], [element])  
2249 -.  
2250 -  
2251 -public define HTML_Off_Form  
2252 - span  
2253 - (  
2254 - String s  
2255 - )=  
2256 - span([], s)  
2257 -.  
2258 -  
2259 -public define HTML_Off_Form  
2260 - span  
2261 - (  
2262 - Int i  
2263 - )=  
2264 - span([], to_decimal(i))  
2265 -.  
2266 -  
2267 -public define HTML_Off_Form  
2268 - hr  
2269 - =  
2270 - hr([])  
2271 -.  
2272 -  
2273 public define HTML_In_Form 2263 public define HTML_In_Form
2274 hr 2264 hr
2275 = 2265 =
@@ -2300,31 +2290,6 @@ public define HTML_In_Form @@ -2300,31 +2290,6 @@ public define HTML_In_Form
2300 )= 2290 )=
2301 button([], [element]) 2291 button([], [element])
2302 . 2292 .
2303 -  
2304 -public define HTML_Off_Form  
2305 - button  
2306 - (  
2307 - List(HTML_Off_Form) elements  
2308 - )=  
2309 - button([], elements)  
2310 -.  
2311 -  
2312 -public define HTML_Off_Form  
2313 - button  
2314 - (  
2315 - List(CoreAttrs) attrs,  
2316 - HTML_Off_Form element  
2317 - )=  
2318 - button(attrs, [element])  
2319 -.  
2320 -  
2321 -public define HTML_Off_Form  
2322 - button  
2323 - (  
2324 - HTML_Off_Form element  
2325 - )=  
2326 - button([], [element])  
2327 -.  
2328 - Cell a gap between two other cells : 2293 - Cell a gap between two other cells :
2329 2294
2330 public define HTML_Cell(HTML_Off_Form) 2295 public define HTML_Cell(HTML_Off_Form)
@@ -2750,12 +2715,6 @@ public define String @@ -2750,12 +2715,6 @@ public define String
2750 doctype_w3c_header 2715 doctype_w3c_header
2751 = 2716 =
2752 "<!DOCTYPE html>\n". //html 5 2717 "<!DOCTYPE html>\n". //html 5
2753 -  
2754 -// No longer used in HTML 5  
2755 -//public define String  
2756 -// html_header  
2757 -// =  
2758 -// "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n".  
2759 2718
2760 2719
2761 *** [1] States. 2720 *** [1] States.
@@ -3030,12 +2989,6 @@ define Int @@ -3030,12 +2989,6 @@ define Int
3030 2989
3031 2990
3032 2991
3033 - *** [3.1] Prefixing web arguments names.  
3034 -  
3035 - CR 2008-07-08 Prefixing Removed  
3036 -  
3037 -  
3038 -  
3039 *** [3.2] Separating web arguments. 2992 *** [3.2] Separating web arguments.
3040 2993
3041 When a new request arrives, we need to separate the web arguments, that is to say: 2994 When a new request arrives, we need to separate the web arguments, that is to say:
@@ -3305,7 +3258,6 @@ public define Web_Site @@ -3305,7 +3258,6 @@ public define Web_Site
3305 List(MIME) known_mime_types, 3258 List(MIME) known_mime_types,
3306 (String action_name, 3259 (String action_name,
3307 List(Web_arg) args) -> One before_send_file 3260 List(Web_arg) args) -> One before_send_file
3308 - //Bool using_state_cookies  
3309 ) = 3261 ) =
3310 init(unique); 3262 init(unique);
3311 3263
@@ -3452,6 +3404,27 @@ define HTTP_Answer @@ -3452,6 +3404,27 @@ define HTTP_Answer
3452 ) 3404 )
3453 . 3405 .
3454 3406
  3407 +define WEB_Page_Renderer
  3408 + default_page_renderer =
  3409 + web_page_renderer("AWS_DEFAULT_PAGE",
  3410 + ( WEB_Session _session,
  3411 + String _title,
  3412 + HTML_Partial_Content _content
  3413 + ) |->
  3414 + html_page
  3415 + (
  3416 + http_ok,
  3417 + [ title(_title), ]// title of web site
  3418 + ,
  3419 + body // body of page
  3420 + (
  3421 + [], //body options empty
  3422 + (HTML_Off_Form)partial(_content)
  3423 + )
  3424 + )
  3425 + )
  3426 +.
  3427 +
3455 define WEB_Controller_Result 3428 define WEB_Controller_Result
3456 apply_action 3429 apply_action
3457 ( 3430 (
@@ -3535,6 +3508,47 @@ define Maybe(WEB_Controller) @@ -3535,6 +3508,47 @@ define Maybe(WEB_Controller)
3535 } 3508 }
3536 . 3509 .
3537 3510
  3511 +define WEB_Page_Renderer
  3512 + get_page_renderer
  3513 + (
  3514 + String renderer_name,
  3515 + List(WEB_Page_Renderer) renderers,
  3516 + )=
  3517 + if renderers is
  3518 + {
  3519 + [] then
  3520 + println("Can't find page_renderer ["+renderer_name+"], use the default");
  3521 + default_page_renderer,
  3522 + [h . t] then
  3523 + if h.name = renderer_name then
  3524 + //println("Controller ["+controller_name+"] found");
  3525 + h
  3526 + else
  3527 + get_page_renderer(renderer_name, t)
  3528 + }
  3529 +.
  3530 +
  3531 +define WEB_Page_Renderer
  3532 + get_page_renderer
  3533 + (
  3534 + WEB_Session _session,
  3535 + WEB_Page_Renderer _current_page_renderer,
  3536 + List(WEB_Page_Renderer) renderers,
  3537 + )=
  3538 + //get the renderer page name to use from the session "AWS_PAGE_RENDERER"
  3539 + if get_String(_session.fields, "AWS_PAGE_RENDERER") is
  3540 + {
  3541 + failure then println("No renderer defined, use the default"); default_page_renderer,
  3542 + success(renderer_name) then
  3543 + //check if the renderer_page already in cache
  3544 + if renderer_name = _current_page_renderer.name then
  3545 + _current_page_renderer
  3546 + else
  3547 + //if not in cache, use the selector function
  3548 + get_page_renderer(renderer_name, renderers)
  3549 + }
  3550 +.
  3551 +
3538 public define JsonValue to_html_ajax_content(Printable_tree content_HTML, String additional_script). 3552 public define JsonValue to_html_ajax_content(Printable_tree content_HTML, String additional_script).
3539 public define JsonValue to_html_ajax_content(HTML_Partial_Content content_HTML, CommonInfo cinfo, String additional_script). 3553 public define JsonValue to_html_ajax_content(HTML_Partial_Content content_HTML, CommonInfo cinfo, String additional_script).
3540 3554
@@ -3543,6 +3557,8 @@ define (Maybe(WEB_Session), HTTP_Answer) @@ -3543,6 +3557,8 @@ define (Maybe(WEB_Session), HTTP_Answer)
3543 ( 3557 (
3544 WEB_Controller controller, 3558 WEB_Controller controller,
3545 List(WEB_Controller) controllers, 3559 List(WEB_Controller) controllers,
  3560 + WEB_Page_Renderer _current_page_renderer,
  3561 + List(WEB_Page_Renderer) page_renderers,
3546 CommonInfo cinfo, 3562 CommonInfo cinfo,
3547 WEB_Session _session, 3563 WEB_Session _session,
3548 Maybe(String) _mb_action_name, 3564 Maybe(String) _mb_action_name,
@@ -3566,7 +3582,7 @@ define (Maybe(WEB_Session), HTTP_Answer) @@ -3566,7 +3582,7 @@ define (Maybe(WEB_Session), HTTP_Answer)
3566 if get_controller(get_String(*new_session.web_request.lwa, "aws_controller", "root"), controllers) is 3582 if get_controller(get_String(*new_session.web_request.lwa, "aws_controller", "root"), controllers) is
3567 { 3583 {
3568 failure then (failure, error_page(http_not_found, "Initial Session Controller not found", new_session)), 3584 failure then (failure, error_page(http_not_found, "Initial Session Controller not found", new_session)),
3569 - success(new_controller) then apply_controller_action(new_controller, controllers, cinfo, new_session, failure, initial_session), 3585 + success(new_controller) then apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, new_session, failure, initial_session),
3570 }, 3586 },
3571 success(action_name) then 3587 success(action_name) then
3572 println("ACTION_NAME ["+action_name+"]"); 3588 println("ACTION_NAME ["+action_name+"]");
@@ -3578,7 +3594,7 @@ define (Maybe(WEB_Session), HTTP_Answer) @@ -3578,7 +3594,7 @@ define (Maybe(WEB_Session), HTTP_Answer)
3578 if get_controller(get_String(*new_session.web_request.lwa, "aws_controller", "root"), controllers) is 3594 if get_controller(get_String(*new_session.web_request.lwa, "aws_controller", "root"), controllers) is
3579 { 3595 {
3580 failure then (failure, error_page(http_not_found, "Redirect Controller not found", new_session)), 3596 failure then (failure, error_page(http_not_found, "Redirect Controller not found", new_session)),
3581 - success(new_controller) then apply_controller_action(new_controller, controllers, cinfo, new_session, failure, initial_session), 3597 + success(new_controller) then apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, new_session, failure, initial_session),
3582 }, 3598 },
3583 3599
3584 redirect(new_session, r_controller_name, r_action_name) then 3600 redirect(new_session, r_controller_name, r_action_name) then
@@ -3586,7 +3602,7 @@ define (Maybe(WEB_Session), HTTP_Answer) @@ -3586,7 +3602,7 @@ define (Maybe(WEB_Session), HTTP_Answer)
3586 { 3602 {
3587 failure then (failure, error_page(http_not_found, "Redirect Controller "+r_controller_name+" not found", new_session)), 3603 failure then (failure, error_page(http_not_found, "Redirect Controller "+r_controller_name+" not found", new_session)),
3588 success(new_controller) then 3604 success(new_controller) then
3589 - apply_controller_action(new_controller, controllers, cinfo, new_session, success(r_action_name), initial_session), 3605 + apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, new_session, success(r_action_name), initial_session),
3590 }, 3606 },
3591 3607
3592 redirect_to_previous then 3608 redirect_to_previous then
@@ -3595,7 +3611,7 @@ define (Maybe(WEB_Session), HTTP_Answer) @@ -3595,7 +3611,7 @@ define (Maybe(WEB_Session), HTTP_Answer)
3595 failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), 3611 failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)),
3596 success(new_controller) then 3612 success(new_controller) then
3597 since _session is web_session(lang, entries, _, previous), 3613 since _session is web_session(lang, entries, _, previous),
3598 - apply_controller_action(new_controller, controllers, cinfo, web_session(lang, entries, previous, previous), failure, initial_session), 3614 + apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, web_session(lang, entries, previous, previous), failure, initial_session),
3599 }, 3615 },
3600 redirect_to_previous(entries) then 3616 redirect_to_previous(entries) then
3601 if get_controller(get_String(*_session.previous_web_request.lwa, "aws_controller", "root"), controllers) is 3617 if get_controller(get_String(*_session.previous_web_request.lwa, "aws_controller", "root"), controllers) is
@@ -3603,21 +3619,27 @@ define (Maybe(WEB_Session), HTTP_Answer) @@ -3603,21 +3619,27 @@ define (Maybe(WEB_Session), HTTP_Answer)
3603 failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), 3619 failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)),
3604 success(new_controller) then 3620 success(new_controller) then
3605 since _session is web_session(lang, _, _, previous), 3621 since _session is web_session(lang, _, _, previous),
3606 - apply_controller_action(new_controller, controllers, cinfo, web_session(lang, entries, previous, previous), failure, initial_session), 3622 + apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, web_session(lang, entries, previous, previous), failure, initial_session),
3607 }, 3623 },
3608 - ajax(answer) then (failure, answer), 3624 + //ajax(answer) then (failure, answer),
3609 //ajax with modified session that must be saved 3625 //ajax with modified session that must be saved
3610 - ajax(session, answer) then (success(session), answer), 3626 + ajax(session, answer) then (session, answer),
3611 3627
3612 - ajax(content, additional_script) then (failure, json(http_ok, to_html_ajax_content(content, cinfo, additional_script))),  
3613 - ajax(session, content, additional_script) then (success(session), json(http_ok, to_html_ajax_content(content, cinfo, additional_script))),  
3614 - ajax(content, additional_script) then (failure, json(http_ok, to_html_ajax_content(content, additional_script))),  
3615 - ajax(session, content, additional_script) then (success(session), json(http_ok, to_html_ajax_content(content, additional_script))),  
3616 - send_file(file_path) then (failure, send_file(file_path)) 3628 + //ajax(content, additional_script) then (failure, json(http_ok, to_html_ajax_content(content, cinfo, additional_script))),
  3629 + ajax(session, content, additional_script) then (session, json(http_ok, to_html_ajax_content(content, cinfo, additional_script))),
  3630 + //ajax(content, additional_script) then (failure, json(http_ok, to_html_ajax_content(content, additional_script))),
  3631 + ajax(session, content, additional_script) then (session, json(http_ok, to_html_ajax_content(content, additional_script))),
  3632 + send_file(file_path) then (failure, send_file(file_path)),
  3633 + renderer_content(session, title, content) then
  3634 + with the_session = if session is {failure then _session, success(__session) then __session},
  3635 + with page_renderer = get_page_renderer(the_session, _current_page_renderer, page_renderers),
  3636 + (session, page_renderer.page_layout(the_session, title, content))
3617 } 3637 }
3618 } 3638 }
3619 . 3639 .
3620 3640
  3641 +
  3642 +
3621 public define Web_Site 3643 public define Web_Site
3622 make_web_site_controller_description 3644 make_web_site_controller_description
3623 ( 3645 (
@@ -3632,11 +3654,12 @@ public define Web_Site @@ -3632,11 +3654,12 @@ public define Web_Site
3632 (WEB_Session, 3654 (WEB_Session,
3633 HTTP_Info, 3655 HTTP_Info,
3634 Var(List(Web_arg)), 3656 Var(List(Web_arg)),
3635 - Bool is_https) -> WEB_Session expired_session,  
3636 - Var(List(WEB_Controller)) web_controllers,  
3637 - Maybe(WEB_Session) -> List(HTTP_header) additional_headers,  
3638 - Int timeout,  
3639 - Redirections redirections, 3657 + Bool is_https) -> WEB_Session expired_session,
  3658 + Var(List(WEB_Controller)) web_controllers,
  3659 + Var(List(WEB_Page_Renderer)) web_page_renderers,
  3660 + Maybe(WEB_Session) -> List(HTTP_header) additional_headers,
  3661 + Int timeout,
  3662 + Redirections redirections,
3640 String charset, 3663 String charset,
3641 List(String) journal_extensions, 3664 List(String) journal_extensions,
3642 List(String) journal_headers, 3665 List(String) journal_headers,
@@ -3660,7 +3683,8 @@ public define Web_Site @@ -3660,7 +3683,8 @@ public define Web_Site
3660 // 3683 //
3661 // construct tool functions 3684 // construct tool functions
3662 // TODO 'make_separate_web_args_function' must retrieve state_cookies before parsing web_args if using_state_cookies is true 3685 // TODO 'make_separate_web_args_function' must retrieve state_cookies before parsing web_args if using_state_cookies is true
3663 - with save_session = make_save_session_function(timeout, state_directory), 3686 + with save_session = make_save_session_function(timeout, state_directory),
  3687 + with current_page_renderer = var((WEB_Page_Renderer)default_page_renderer),
3664 // retrieve_session = make_retrieve_session_function(state_directory, website_name), 3688 // retrieve_session = make_retrieve_session_function(state_directory, website_name),
3665 //separate_web_args = make_separate_web_args_function(state_directory, retrieve_state), 3689 //separate_web_args = make_separate_web_args_function(state_directory, retrieve_state),
3666 //apply_action = make_apply_action_function(actions), 3690 //apply_action = make_apply_action_function(actions),
@@ -3683,11 +3707,11 @@ public define Web_Site @@ -3683,11 +3707,11 @@ public define Web_Site
3683 with current_session = if retrieve_session(http_info, state_directory, website_name) is 3707 with current_session = if retrieve_session(http_info, state_directory, website_name) is
3684 { 3708 {
3685 not_found then 3709 not_found then
3686 - //println("previous state not found"); 3710 + println("previous state not found");
3687 initial_session(http_info, var(_lwa), is_https), 3711 initial_session(http_info, var(_lwa), is_https),
3688 3712
3689 out_of_date(previous_session) then 3713 out_of_date(previous_session) then
3690 - //println("previous out_of_date"); 3714 + println("previous out_of_date");
3691 expired_session(previous_session, http_info, var(_lwa), is_https), 3715 expired_session(previous_session, http_info, var(_lwa), is_https),
3692 3716
3693 still_valid(previous_session) then 3717 still_valid(previous_session) then
@@ -3704,7 +3728,7 @@ public define Web_Site @@ -3704,7 +3728,7 @@ public define Web_Site
3704 (failure, error_page(http_not_found, "Controller not found", current_session)), 3728 (failure, error_page(http_not_found, "Controller not found", current_session)),
3705 3729
3706 success(new_controller) then 3730 success(new_controller) then
3707 - apply_controller_action(new_controller, *web_controllers, cinfo, current_session, failure, initial_session), 3731 + apply_controller_action(new_controller, *web_controllers, *current_page_renderer, *web_page_renderers, cinfo, current_session, failure, initial_session),
3708 } 3732 }
3709 is (mb_new_session, http_answer), 3733 is (mb_new_session, http_answer),
3710 3734
@@ -5823,12 +5847,12 @@ define Printable_tree @@ -5823,12 +5847,12 @@ define Printable_tree
5823 format(cinfo,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags), 5847 format(cinfo,ic_v,any_text(opts,t),format_element,is_https, action_count, head_tags),
5824 preformated(o,s) then 5848 preformated(o,s) then
5825 format(cinfo,ic_v,any_preformated(o,s),format_element,is_https, action_count, head_tags), 5849 format(cinfo,ic_v,any_preformated(o,s),format_element,is_https, action_count, head_tags),
5826 - paragraph(opts,t) then  
5827 - format(cinfo,ic_v,any_paragraph(opts,t),format_element,is_https, action_count, head_tags),  
5828 - image(opts,url,alt) then  
5829 - format(cinfo,ic_v,any_image(opts,url,alt),format_element,is_https, action_count, head_tags),  
5830 - image(opts,url,alt,w,h) then  
5831 - format(cinfo,ic_v,any_image(opts,url,alt,w,h),format_element,is_https, action_count, head_tags), 5850 +// paragraph(opts,t) then
  5851 +// format(cinfo,ic_v,any_paragraph(opts,t),format_element,is_https, action_count, head_tags),
  5852 +// image(opts,url,alt) then
  5853 +// format(cinfo,ic_v,any_image(opts,url,alt),format_element,is_https, action_count, head_tags),
  5854 +// image(opts,url,alt,w,h) then
  5855 +// format(cinfo,ic_v,any_image(opts,url,alt,w,h),format_element,is_https, action_count, head_tags),
5832 table(opts,header_row, rows, footer_row) then 5856 table(opts,header_row, rows, footer_row) then
5833 format(cinfo,ic_v,any_table(opts,header_row, rows, footer_row),format_element,is_https, action_count, head_tags), 5857 format(cinfo,ic_v,any_table(opts,header_row, rows, footer_row),format_element,is_https, action_count, head_tags),
5834 center(e) then 5858 center(e) then
@@ -5890,14 +5914,14 @@ define Printable_tree @@ -5890,14 +5914,14 @@ define Printable_tree
5890 in_form(fn, content) then 5914 in_form(fn, content) then
5891 if fn is html_Id(id) then 5915 if fn is html_Id(id) then
5892 format(cinfo,id,ic_v, content,is_https, action_count, head_tags), 5916 format(cinfo,id,ic_v, content,is_https, action_count, head_tags),
5893 - div(options, e) then  
5894 - format(cinfo, ic_v, any_div(options, e), format_element, is_https, action_count, head_tags), 5917 +// div(options, e) then
  5918 +// format(cinfo, ic_v, any_div(options, e), format_element, is_https, action_count, head_tags),
5895 div(options, p_content) then 5919 div(options, p_content) then
5896 with html_elements = map((HTML_Partial_Content pc) |-> since pc is partial_content(tags, html_elem), head_tags <- *head_tags +tags; html_elem, p_content), 5920 with html_elements = map((HTML_Partial_Content pc) |-> since pc is partial_content(tags, html_elem), head_tags <- *head_tags +tags; html_elem, p_content),
5897 5921
5898 format(cinfo, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags), 5922 format(cinfo, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags),
5899 - div_empty(options) then  
5900 - format(cinfo, ic_v, any_div_empty(options), format_element, is_https, action_count, head_tags), 5923 +// div_empty(options) then
  5924 +// format(cinfo, ic_v, any_div_empty(options), format_element, is_https, action_count, head_tags),
5901 iframe(options, css_styles, css_files, js_files, body) then 5925 iframe(options, css_styles, css_files, js_files, body) then
5902 if body is body(body_options,elem) then 5926 if body is body(body_options,elem) then
5903 [ "<iframe", format_attrs(options), ">\n", 5927 [ "<iframe", format_attrs(options), ">\n",
@@ -5917,30 +5941,27 @@ define Printable_tree @@ -5917,30 +5941,27 @@ define Printable_tree
5917 if p_content is partial_content(tags, html_elements) then 5941 if p_content is partial_content(tags, html_elements) then
5918 head_tags <- *head_tags + tags; 5942 head_tags <- *head_tags + tags;
5919 format(cinfo, ic_v, html_elements, is_https, action_count, head_tags), 5943 format(cinfo, ic_v, html_elements, is_https, action_count, head_tags),
5920 - br then ["<br>"], 5944 +// br then ["<br>"],
5921 progress(options, value, max) then ["<progress max=\"",value,"\" value=\"",max,"\"",format_attrs(options),"></progress>"], 5945 progress(options, value, max) then ["<progress max=\"",value,"\" value=\"",max,"\"",format_attrs(options),"></progress>"],
5922 - ol(opts, t) then  
5923 - format(cinfo,ic_v,any_ol(opts,t),format_element,is_https, action_count, head_tags),  
5924 - ul(opts, t) then  
5925 - format(cinfo,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags),  
5926 - li(opts, t) then  
5927 - format(cinfo,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags),  
5928 - button(options, e) then  
5929 - format(cinfo, ic_v, any_button(options, e), format_element, is_https, action_count, head_tags), 5946 +// ol(opts, t) then
  5947 +// format(cinfo,ic_v,any_ol(opts,t),format_element,is_https, action_count, head_tags),
  5948 +// ul(opts, t) then
  5949 +// format(cinfo,ic_v,any_ul(opts,t),format_element,is_https, action_count, head_tags),
  5950 +// li(opts, t) then
  5951 +// format(cinfo,ic_v,any_li(opts,t),format_element,is_https, action_count, head_tags),
  5952 +// button(options, e) then
  5953 +// format(cinfo, ic_v, any_button(options, e), format_element, is_https, action_count, head_tags),
5930 i(opts, t) then 5954 i(opts, t) then
5931 format(cinfo,ic_v,any_i(opts,t),format_element,is_https, action_count, head_tags), 5955 format(cinfo,ic_v,any_i(opts,t),format_element,is_https, action_count, head_tags),
5932 - span(opts,t) then  
5933 - format(cinfo,ic_v,any_span(opts,t),format_element,is_https, action_count, head_tags),  
5934 - strong(opts, l) then ["<strong", format_attrs(opts), ">",flat(map(format_element,l)),"</strong>\n"], 5956 +// span(opts,t) then
  5957 +// format(cinfo,ic_v,any_span(opts,t),format_element,is_https, action_count, head_tags),
  5958 +
5935 5959
5936 - hr(opts) then  
5937 - format(cinfo,ic_v,any_hr(opts),format_element,is_https, action_count, head_tags),  
5938 - h1(opts, l) then ["<h1", format_attrs(opts), ">",flat(map(format_element,l)),"</h1>\n"],  
5939 - h2(opts, l) then ["<h2", format_attrs(opts), ">",flat(map(format_element,l)),"</h2>\n"],  
5940 - h3(opts, l) then ["<h3", format_attrs(opts), ">",flat(map(format_element,l)),"</h3>\n"],  
5941 - h4(opts, l) then ["<h4", format_attrs(opts), ">",flat(map(format_element,l)),"</h4>\n"],  
5942 - h5(opts, l) then ["<h5", format_attrs(opts), ">",flat(map(format_element,l)),"</h5>\n"],  
5943 - h6(opts, l) then ["<h6", format_attrs(opts), ">",flat(map(format_element,l)),"</h6>\n"], 5960 +// hr(opts) then
  5961 +// format(cinfo,ic_v,any_hr(opts),format_element,is_https, action_count, head_tags),
  5962 +// nav(opts, l) then ["<nav", format_attrs(opts), ">",flat(map(format_element,l)),"</nav>\n"],
  5963 + html_tag(tag_name, opts, l) then ["<",tag_name, format_attrs(opts), ">",flat(map(format_element,l)),"</",tag_name,">\n"],
  5964 + html_void_tag(tag_name, opts) then ["<",tag_name, format_attrs(opts), ">"],
5944 }. 5965 }.
5945 5966
5946 *** [5.10] Formating meta-tags. 5967 *** [5.10] Formating meta-tags.
web/CXM_page_message.anubis
@@ -169,3 +169,22 @@ public define HTML_Off_Form @@ -169,3 +169,22 @@ public define HTML_Off_Form
169 String txt 169 String txt
170 ) = 170 ) =
171 display_info_line("informations", html_class, txt, left). 171 display_info_line("informations", html_class, txt, left).
  172 +
  173 +public define HTML_Off_Form
  174 + show_page_message
  175 + (
  176 + Page_Message page_message
  177 + )=
  178 + if page_message is
  179 + {
  180 + no_message then empty,
  181 + info(txt) then display_main_info_line("msg_infos", txt),
  182 + info_translate(txt) then display_main_info_line("msg_infos", txt),
  183 + ok(txt) then display_main_info_line("msg_success", txt),
  184 + ok_translate(txt) then display_main_info_line("msg_success", txt),
  185 + warning(txt) then display_main_info_line("msg_warning", txt),
  186 + warning_translate(txt) then display_main_info_line("msg_warning", txt),
  187 + error(txt, align) then display_main_info_line("msg_error",txt, align),
  188 + error_translate(txt, align) then display_main_info_line("msg_error",txt, align),
  189 + }
  190 +.
web/jQuery/CXM_jquery_button.anubis
@@ -239,10 +239,10 @@ public define HTML_Off_Form @@ -239,10 +239,10 @@ public define HTML_Off_Form
239 button([id(button_id), class("jq_img_btn")], 239 button([id(button_id), class("jq_img_btn")],
240 if orientation is 240 if orientation is
241 { 241 {
242 - top then table([class("jq_img_btn_table")],[ row( cell(image(img_url))), row( cell(text(label_text))) ]),  
243 - bottom then table([class("jq_img_btn_table")],[ row( cell(text(label_text))), row( cell(image(img_url))) ]),  
244 - left then table([class("jq_img_btn_table")],[ row( [cell(image(img_url)), cell(text(label_text)) ]) ]),  
245 - right then table([class("jq_img_btn_table")],[ row( [cell(text(label_text)), cell(image(img_url)) ]) ]), 242 + top then table([class("jq_img_btn_table")],[ row( cell(img(img_url))), row( cell(text(label_text))) ]),
  243 + bottom then table([class("jq_img_btn_table")],[ row( cell(text(label_text))), row( cell(img(img_url))) ]),
  244 + left then table([class("jq_img_btn_table")],[ row( [cell(img(img_url)), cell(text(label_text)) ]) ]),
  245 + right then table([class("jq_img_btn_table")],[ row( [cell(text(label_text)), cell(img(img_url)) ]) ]),
246 }). 246 }).
247 247
248 248
web/jQuery/CXM_jquery_dialog.anubis
@@ -72,7 +72,7 @@ $( \&quot;#&quot;+dlg_id+&quot;\&quot; ).dialog({ @@ -72,7 +72,7 @@ $( \&quot;#&quot;+dlg_id+&quot;\&quot; ).dialog({
72 ajax(_url) then 72 ajax(_url) then
73 with url = format_web_action_name(_url), 73 with url = format_web_action_name(_url),
74 //println("jq_dialog_create : \njs_str ->"+js_str+"\nurl ->"+url); 74 //println("jq_dialog_create : \njs_str ->"+js_str+"\nurl ->"+url);
75 - partial_content( [js], div_empty([id(dlg_id), attr("ajax_url",url)])) 75 + partial_content( [js], div([id(dlg_id), attr("ajax_url",url)]))
76 }. 76 }.
77 77
78 public define HTML_Partial_Content 78 public define HTML_Partial_Content
web/widgets/left_menu.anubis
@@ -30,6 +30,13 @@ public type Left_Menu: @@ -30,6 +30,13 @@ public type Left_Menu:
30 List(Left_Menu_Entry) entries, 30 List(Left_Menu_Entry) entries,
31 String selected). 31 String selected).
32 32
  33 +public type Plugin_Left_Menu:
  34 + plugin_left_menu(
  35 + String name, //plug in name
  36 + Left_Menu left_menu
  37 + )
  38 +.
  39 +
33 public define Left_Menu_Entry 40 public define Left_Menu_Entry
34 left_menu_entry 41 left_menu_entry
35 ( 42 (
@@ -103,9 +110,9 @@ define List(HTML_Off_Form) @@ -103,9 +110,9 @@ define List(HTML_Off_Form)
103 if h is 110 if h is
104 { 111 {
105 left_menu_entry(_menu_id, _classes, _action, _text, _extra) then 112 left_menu_entry(_menu_id, _classes, _action, _text, _extra) then
106 - (HTML_Off_Form)paragraph([class("item "+_menu_id+"_icon"+if _menu_id=selected then " selected" else ""+ " "+join(" ", _classes))],actioner(same,same, link(_T(_text)),_action,_extra)), 113 + p([class("item "+_menu_id+"_icon"+if _menu_id=selected then " selected" else ""+ " "+join(" ", _classes))],actioner(same,same, link(_T(_text)),_action,_extra)),
107 title(_title_id, _classes, _text) then 114 title(_title_id, _classes, _text) then
108 - (HTML_Off_Form)paragraph([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) 115 + p([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text)))
109 }, 116 },
110 make_left_menu(_T, t, selected, [ entry . so_far]) 117 make_left_menu(_T, t, selected, [ entry . so_far])
111 }. 118 }.
web/widgets/menu.anubis
@@ -159,7 +159,7 @@ define List(HTML_Off_Form) @@ -159,7 +159,7 @@ define List(HTML_Off_Form)
159 //format the icon if need 159 //format the icon if need
160 to_HTML(_icon), 160 to_HTML(_icon),
161 //format the text if need 161 //format the text if need
162 - if _text = "" then empty else span(_T(_text)), /*link(help_string(_text, _T))*/ 162 + if _text = "" then empty else span(text(_T(_text))), /*link(help_string(_text, _T))*/
163 //span(1), 163 //span(1),
164 ])), 164 ])),
165 165
web/widgets/specialized_elements.anubis
@@ -19,7 +19,7 @@ public define HTML_Off_Form @@ -19,7 +19,7 @@ public define HTML_Off_Form
19 else 19 else
20 with _attrs = [data("phone-number", phone_number), event(onclick, "hk_phone_call(this)"), class("phone_click") . attrs], 20 with _attrs = [data("phone-number", phone_number), event(onclick, "hk_phone_call(this)"), class("phone_click") . attrs],
21 div([ 21 div([
22 - image(_attrs, "/icons/16x16/phone.png"), 22 + img(_attrs, "/icons/16x16/phone.png"),
23 if image_only then empty else 23 if image_only then empty else
24 text(_attrs, phone_number) 24 text(_attrs, phone_number)
25 ]) 25 ])
@@ -50,7 +50,7 @@ public define HTML_Off_Form @@ -50,7 +50,7 @@ public define HTML_Off_Form
50 else 50 else
51 with _attrs = [data("email", email_str), event(onclick, "hk_send_email(this)"), class("email_click") . attrs], 51 with _attrs = [data("email", email_str), event(onclick, "hk_send_email(this)"), class("email_click") . attrs],
52 div([ 52 div([
53 - image(_attrs, "/icons/16x16/email.png"), 53 + img(_attrs, "/icons/16x16/email.png"),
54 text(_attrs, email_str) 54 text(_attrs, email_str)
55 ]) 55 ])
56 . 56 .