From d937aea49a10c1f55560ef76fe53ce7388ee0ad8 Mon Sep 17 00:00:00 2001 From: totoro Date: Thu, 7 Dec 2017 10:16:10 +0900 Subject: [PATCH] add the list of the constant additional header to always put in HTML header. make "javascript" event_name public --- web/CXM_making_a_web_site.anubis | 26 ++++++++++++++++---------- web/CXM_multihost_http_server.anubis | 8 +++++--- web/jQuery/CXM_jquery_animate.anubis | 27 +-------------------------- 3 files changed, 22 insertions(+), 39 deletions(-) diff --git a/web/CXM_making_a_web_site.anubis b/web/CXM_making_a_web_site.anubis index bc85b21..3fa4dbc 100644 --- a/web/CXM_making_a_web_site.anubis +++ b/web/CXM_making_a_web_site.anubis @@ -692,7 +692,8 @@ public define Web_Site Bool is_https) -> $State ticket_lost_state, List(Web_Action($State)) actions, $State -> HTTP_Answer compute_page, - $State -> List(HTTP_header) additional_headers, + $State -> List(HTTP_header) additional_headers, + List(HTTP_header) constant_additional_headers, Int timeout, // seconds (todo: minutes) Redirections redirections, String charset, @@ -1086,7 +1087,8 @@ public type I18n: A list of 'DIV_Option' must be given with each DIV you want to put in your page. -define String event_name +public define String + event_name ( HtmlEvents e ) = @@ -3397,7 +3399,8 @@ public define Web_Site Bool is_https) -> $State ticket_lost_state, List(Web_Action($State)) actions, $State -> HTTP_Answer compute_page, - $State -> List(HTTP_header) additional_headers, + $State -> List(HTTP_header) additional_headers, + List(HTTP_header) constant_additional_headers, Int timeout, Redirections redirections, String charset, @@ -3500,6 +3503,7 @@ public define Web_Site secret, known_mime_types, site_handler(http_port, https_port), + constant_additional_headers, (HTTP_Info http_info, List(Web_arg) lwa) |-> if separate_web_args(lwa, http_info ) is swa(mb_previous_state,mb_action_name,operands) then if mb_action_name is @@ -3803,12 +3807,13 @@ public define Web_Site (WEB_Session, HTTP_Info, Var(List(Web_arg)), - Bool is_https) -> WEB_Session expired_session, + Bool is_https) -> WEB_Session expired_session, Var(List(WEB_Controller)) web_controllers, Var(List(WEB_Page_Renderer)) web_page_renderers, - Maybe(WEB_Session) -> List(HTTP_header) additional_headers, - Int timeout, - Redirections redirections, + Maybe(WEB_Session) -> List(HTTP_header) additional_headers, + List(HTTP_header) constant_additional_headers, + Int timeout, + Redirections redirections, String charset, List(String) journal_extensions, List(String) journal_headers, @@ -3917,6 +3922,7 @@ public define Web_Site secret, known_mime_types, site_handler(http_port,https_port), + constant_additional_headers, (HTTP_Info http_info, List(Web_arg) lwa) |-> unique // if separate_web_args(lwa, http_info ) is // swa(mb_previous_state,mb_action_name,operands) then @@ -3975,7 +3981,8 @@ public define Web_Site Bool is_https) -> $State ticket_lost_state, List(Web_Action($State)) actions, $State -> HTTP_Answer compute_page, - $State -> List(HTTP_header) additional_headers, + $State -> List(HTTP_header) additional_headers, + List(HTTP_header) constant_additional_headers, Int timeout, Redirections redirections, String charset, @@ -3990,8 +3997,7 @@ public define Web_Site = //generate an unique ID if doesn't exist in root of site_directory with site_UID = get_site_uid(site_directory), - println("site_UID : "+site_UID); - make_web_site_description(site_UID, common_names, site_directory, state_directory, init, initial_state, ticket_expired_state, ticket_lost_state, actions, compute_page, additional_headers, timeout, redirections, charset, journal_extensions, journal_headers, secret, known_mime_types, before_send_file) + make_web_site_description(site_UID, common_names, site_directory, state_directory, init, initial_state, ticket_expired_state, ticket_lost_state, actions, compute_page, additional_headers, constant_additional_headers, timeout, redirections, charset, journal_extensions, journal_headers, secret, known_mime_types, before_send_file) . diff --git a/web/CXM_multihost_http_server.anubis b/web/CXM_multihost_http_server.anubis index 0a8cac4..e55ffa2 100644 --- a/web/CXM_multihost_http_server.anubis +++ b/web/CXM_multihost_http_server.anubis @@ -233,7 +233,9 @@ public type Web_Site_Description: HTTP_Info http_info, List(Web_arg) lwa, Bool is_https) -> AWP_Handler_Answer awp_handler, + List(HTTP_header) constant_additional_headers, (HTTP_Info http_info, + List(Web_arg) lwa) -> One before_send_file //Bool using_state_cookies, ). @@ -2501,14 +2503,14 @@ define One printable_tree(answer_headers_body) then forget(reliable_write(connection, answer_headers_body)), send_file(file_path, content_disposition) then - send_file_answer(desc, connection, uri, file_path, content_disposition, headers, standard_headers, + send_file_answer(desc, connection, uri, file_path, content_disposition, headers, standard_headers + constant_additional_headers(desc), (One u) |-> before_send_file(desc)(http_inf, all_web_args)) } else (send_file(desc, connection, uri, headers, - standard_headers, + standard_headers + constant_additional_headers(desc), if web_arg_value(all_web_args,"zauth") is { not_found then failure, @@ -3211,7 +3213,7 @@ define Maybe((String,Web_Site_Description)) { [ ] then print("Requested host '"+requested_host+"' does not exist.\n"); failure, [site1 . others] then - if site1 is web_site_description(common_names,_,_,_,_,_,_,_,_,_) then + if site1 is web_site_description(common_names,_,_,_,_,_,_,_,_,_,_) then if member(common_names,requested_host) then success((requested_host,site1)) else get_site(requested_host,others) diff --git a/web/jQuery/CXM_jquery_animate.anubis b/web/jQuery/CXM_jquery_animate.anubis index e5e101b..8b7182c 100644 --- a/web/jQuery/CXM_jquery_animate.anubis +++ b/web/jQuery/CXM_jquery_animate.anubis @@ -134,31 +134,6 @@ define HTML_Head_Tag required_js = js(js_file("js/cxm/cxm_jquery_animate.js")). define String js_anim_function_name = "CalexiumToolBox.CXM_Animate.animate". -define String - format_html_event_to_js - ( - HtmlEvents ev - ) = - if ev is - { - onchange then "change", - onsubmit then "submit", - onreset then "reset", - onselect then "select", - onblur then "blur", - onfocus then "focus", - onkeydown then "keydown" - onkeypress then "keypress", - onkeyup then "keyup", - onclick then "click", - ondblclick then "dblclick", - onmousedown then "mousedown", - onmousemove then "mousemove", - onmouseout then "mouseout", - onmouseover then "mouseover", - onmouseup then "mouseup" - }. - define List(JsonMember) animatables_to_json_members ( @@ -238,7 +213,7 @@ define JQueryFormattedAnimation ) = with css_props_as_json_members = animatables_to_json_members(styles), easing_str = format_easing(type), - trigger_str = format_html_event_to_js(trigger), + trigger_str = event_name(trigger), id_str = if id is id(id_str) then id_str, -- libgit2 0.21.4