Commit d9e8ff9065a2ab0d019de4632ee1a52387d92641

Authored by David RENÉ
1 parent 8667334b

add alternative "empty" for HTML_Row

add helper for HTML "a" with list of (HTML_Off_Form)
web/CXM_making_a_web_site.anubis
... ... @@ -488,7 +488,7 @@ define WEB_Session -> String // the function constructed returns the name of
488 488 session_name = s_var.session_id,
489 489 //println("make_save_state_function " + state_directory+"/s"+state_name);
490 490 if save(to_be_saved,state_directory+"/"+session_name) is ok then
491   - logger(logInfo, "----- session ["+session_name+"] saved"+dump_WEB_Session_Fields(*s_var.fields));
  491 + //logger(logInfo, "----- session ["+session_name+"] saved"+dump_WEB_Session_Fields(*s_var.fields));
492 492 session_name
493 493 else
494 494 logger(logError, ("Cannot create session file in '"+state_directory+"'.\n"));
... ... @@ -1556,6 +1556,7 @@ public define HTML_Off_Form a(List(CoreAttrs) attrs, A_href _href, A_target _tar
1556 1556 public define HTML_Off_Form a(CoreAttrs attr, A_href _href, A_target _target, HTML_Off_Form content) = a([attr], _href, _target, [content]).
1557 1557 public define HTML_Off_Form a(A_href _href, A_target _target, HTML_Off_Form content) = a([], _href, _target, [content]).
1558 1558 public define HTML_Off_Form a(A_href _href, A_target _target, List(HTML_Off_Form) content) = a([], _href, _target, content).
  1559 +public define HTML_Off_Form a(CoreAttrs attr, A_href _href, A_target _target, List(HTML_Off_Form) content) = a([attr], _href, _target, content).
1559 1560  
1560 1561 // <article>
1561 1562 public define HTML_Off_Form article(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("article", attrs, content).
... ... @@ -3295,10 +3296,10 @@ define WEB_Page_Renderer
3295 3296 default_page_renderer,
3296 3297 [h . t] then
3297 3298 if h.name = renderer_name then
3298   - println("renderer_name ["+renderer_name+"] found");
  3299 + //println("renderer_name ["+renderer_name+"] found");
3299 3300 h
3300 3301 else
3301   - println("renderer_name "+renderer_name+" not matching");
  3302 + //println("renderer_name "+renderer_name+" not matching");
3302 3303 get_page_renderer(renderer_name, t, logger)
3303 3304 }
3304 3305 .
... ... @@ -3363,7 +3364,7 @@ define (Maybe(WEB_Session), HTTP_Answer)
3363 3364 success(new_controller) then apply_controller_action(new_controller, plugins, controllers, _current_page_renderer, page_renderers, cinfo, new_session, failure, initial_session, logger),
3364 3365 },
3365 3366 success(action_name) then
3366   - logger(logInfo, "ACTION_NAME ["+action_name+"] from IP "+get_String(_session.fields, "IP", ""));
  3367 + //logger(logInfo, "ACTION_NAME ["+action_name+"] from IP "+get_String(_session.fields, "IP", ""));
3367 3368 if apply_action(_session, action_name, *controller.controller_actions) is
3368 3369 {
3369 3370 http_answer(session, answer) then
... ... @@ -3503,7 +3504,7 @@ public define Web_Site
3503 3504 Bool is_https) |->
3504 3505 //(Printable_tree)
3505 3506 logger(logTrace,"host_name "+host_name);
3506   - logger(logTrace,dump_http_info(http_info));
  3507 + logger(logTrace, dump_http_info(http_info));
3507 3508 logger(logTrace, dump_web_arg_values(_lwa));
3508 3509 with cinfo = info(host_name, http_port, https_port, site_directory, secret),
3509 3510  
... ... @@ -3518,12 +3519,12 @@ public define Web_Site
3518 3519 logger(logInfo, "previous out_of_date");
3519 3520 //expired_session(previous_session, http_info, var(_lwa), is_https),
3520 3521 since previous_session is web_session(id, lang, entries, previous, _, draw),
3521   - replace_String(entries, "IP", get_String(_lwa, "x-forwarded-for", ip_addr_to_string(http_info.ip_address)));
  3522 + replace_String(entries, "IP", http_header_value(http_info.http_headers, "x-forwarded-for", ip_addr_to_string(http_info.ip_address)));
3522 3523 web_session(id, lang, entries, web_request(http_info, var(_lwa), is_https), previous, draw)
3523 3524  
3524 3525 still_valid(previous_session) then
3525 3526 since previous_session is web_session(id, lang, entries, previous, _, draw),
3526   - replace_String(entries, "IP", get_String(_lwa, "x-forwarded-for", ip_addr_to_string(http_info.ip_address)));
  3527 + replace_String(entries, "IP", http_header_value(http_info.http_headers, "x-forwarded-for", ip_addr_to_string(http_info.ip_address)));
3527 3528 web_session(id, lang, entries, web_request(http_info, var(_lwa), is_https), previous, draw)
3528 3529 },
3529 3530  
... ... @@ -4818,20 +4819,24 @@ define Printable_tree
4818 4819 Formating the rows in a table.
4819 4820  
4820 4821 define Printable_tree
4821   - format
4822   - (
4823   - List(HTML_Row($T)) rows,
4824   - $T -> Printable_tree format_element,
4825   - ) =
4826   - if rows is
4827   - {
4828   - [ ] then [ ],
4829   - [h . t] then if h is row(options,cells) then
4830   - ["<tr",format(reverse(options)),">",
4831   - format(cells,format_element),
4832   - "</tr>\n"
4833   - . format(t,format_element)]
4834   - }.
  4822 + format
  4823 + (
  4824 + List(HTML_Row($T)) rows,
  4825 + $T -> Printable_tree format_element,
  4826 + )=
  4827 + if rows is
  4828 + {
  4829 + [ ] then [ ],
  4830 + [h . t] then
  4831 + if h is
  4832 + {
  4833 + empty then format(t, format_element),
  4834 + row(options, cells) then
  4835 + ["<tr",format(reverse(options)),">", format(cells, format_element), "</tr>\n"
  4836 + . format(t, format_element)]
  4837 + }
  4838 + }
  4839 +.
4835 4840  
4836 4841 define Printable_tree
4837 4842 format
... ... @@ -4883,13 +4888,15 @@ define Printable_tree
4883 4888 }.
4884 4889  
4885 4890 define Printable_tree
4886   - format
4887   - (
4888   - List(TextAreaOption) l
4889   - ) =
4890   - if member(l,wrap_lines)
4891   - then format1(l)
4892   - else [" wrap=\"off\" " . format1(l)].
  4891 + format
  4892 + (
  4893 + List(TextAreaOption) l
  4894 + )=
  4895 + if member(l, wrap_lines) then
  4896 + format1(l)
  4897 + else
  4898 + [" wrap=\"off\" " . format1(l)]
  4899 +.
4893 4900  
4894 4901  
4895 4902 *** [5.7] Formating elements which may be put anywhere.
... ... @@ -5544,18 +5551,24 @@ define Bool
5544 5551 (
5545 5552 HTML_Row(HTML_In_Form) row
5546 5553 ) =
5547   - mapor(contains_an_upload,
5548   - map(content,cells(row))).
  5554 + if row is
  5555 + {
  5556 + empty then false,
  5557 + row(_, cells) then
  5558 + mapor(contains_an_upload,
  5559 + map(content, cells))
  5560 + }
  5561 +.
5549 5562  
5550 5563 define Bool
5551   - contains_an_upload
5552   - (
5553   - HTML_Footer_Row(HTML_In_Form) row
5554   - ) =
  5564 + contains_an_upload
  5565 + (
  5566 + HTML_Footer_Row(HTML_In_Form) row
  5567 + )=
5555 5568 if row is
5556 5569 {
5557   - empty then false,
5558   - footer_row(_, cells) then
  5570 + empty then false,
  5571 + footer_row(_, cells) then
5559 5572 mapor(contains_an_upload,
5560 5573 map(content,cells))
5561 5574 }.
... ...
web/types/making_a_web_site.anubis
... ... @@ -110,15 +110,15 @@ public type HtmlEvents:
110 110 oncut, //HTML5 Fires when the user cuts the content of an element
111 111 onpaste, //HTML5 Fires when the user pastes some content in an element
112 112 //Media Events
113   - onabort, //HTML5 Script to be run on abort
114   - oncanplay, //HTML5 Script to be run when a file is ready to start playing (when it has buffered enough to begin)
  113 + onabort, //HTML5 Script to be run on abort
  114 + oncanplay, //HTML5 Script to be run when a file is ready to start playing (when it has buffered enough to begin)
115 115 oncanplaythrough, //HTML5 Script to be run when a file can be played all the way to the end without pausing for buffering
116   - oncuechange, //HTML5 Script to be run when the cue changes in a <track> element
  116 + oncuechange, //HTML5 Script to be run when the cue changes in a <track> element
117 117 ondurationchange, //HTML5 Script to be run when the length of the media changes
118   - onemptied, //HTML5 Script to be run when something bad happens and the file is suddenly unavailable (like unexpectedly disconnects)
119   - onended, //HTML5 Script to be run when the media has reach the end (a useful event for messages like "thanks for listening")
120   - onerror, //HTML5 Script to be run when an error occurs when the file is being loaded
121   - onloadeddata, //HTML5 Script to be run when media data is loaded
  118 + onemptied, //HTML5 Script to be run when something bad happens and the file is suddenly unavailable (like unexpectedly disconnects)
  119 + onended, //HTML5 Script to be run when the media has reach the end (a useful event for messages like "thanks for listening")
  120 + onerror, //HTML5 Script to be run when an error occurs when the file is being loaded
  121 + onloadeddata, //HTML5 Script to be run when media data is loaded
122 122 onloadedmetadata, //HTML5 Script to be run when meta data (like dimensions and duration) are loaded
123 123 onloadstart, //HTML5 Script to be run just as the file begins to load before anything is actually loaded
124 124 onpause, //HTML5 Script to be run when the media is paused either by the user or programmatically
... ... @@ -320,7 +320,8 @@ public type HTML_Footer_Row($T):
320 320 footer_row(List(Cell_Option) options, List(HTML_Cell($T)) cells).
321 321  
322 322 public type HTML_Row($T):
323   - row(List(Cell_Option) options, List(HTML_Cell($T)) cells).
  323 + empty,
  324 + row(List(Cell_Option) options, List(HTML_Cell($T)) cells).
324 325  
325 326 public type HTML_Header_Cell($T):
326 327 header_cell(List(Cell_Option) options, $T content).
... ...