Commit d937aea49a10c1f55560ef76fe53ce7388ee0ad8

Authored by totoro
1 parent 51afb363

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
@@ -692,7 +692,8 @@ public define Web_Site @@ -692,7 +692,8 @@ public define Web_Site
692 Bool is_https) -> $State ticket_lost_state, 692 Bool is_https) -> $State ticket_lost_state,
693 List(Web_Action($State)) actions, 693 List(Web_Action($State)) actions,
694 $State -> HTTP_Answer compute_page, 694 $State -> HTTP_Answer compute_page,
695 - $State -> List(HTTP_header) additional_headers, 695 + $State -> List(HTTP_header) additional_headers,
  696 + List(HTTP_header) constant_additional_headers,
696 Int timeout, // seconds (todo: minutes) 697 Int timeout, // seconds (todo: minutes)
697 Redirections redirections, 698 Redirections redirections,
698 String charset, 699 String charset,
@@ -1086,7 +1087,8 @@ public type I18n: @@ -1086,7 +1087,8 @@ public type I18n:
1086 1087
1087 A list of 'DIV_Option' must be given with each DIV you want to put in your page. 1088 A list of 'DIV_Option' must be given with each DIV you want to put in your page.
1088 1089
1089 -define String event_name 1090 +public define String
  1091 + event_name
1090 ( 1092 (
1091 HtmlEvents e 1093 HtmlEvents e
1092 ) = 1094 ) =
@@ -3397,7 +3399,8 @@ public define Web_Site @@ -3397,7 +3399,8 @@ public define Web_Site
3397 Bool is_https) -> $State ticket_lost_state, 3399 Bool is_https) -> $State ticket_lost_state,
3398 List(Web_Action($State)) actions, 3400 List(Web_Action($State)) actions,
3399 $State -> HTTP_Answer compute_page, 3401 $State -> HTTP_Answer compute_page,
3400 - $State -> List(HTTP_header) additional_headers, 3402 + $State -> List(HTTP_header) additional_headers,
  3403 + List(HTTP_header) constant_additional_headers,
3401 Int timeout, 3404 Int timeout,
3402 Redirections redirections, 3405 Redirections redirections,
3403 String charset, 3406 String charset,
@@ -3500,6 +3503,7 @@ public define Web_Site @@ -3500,6 +3503,7 @@ public define Web_Site
3500 secret, 3503 secret,
3501 known_mime_types, 3504 known_mime_types,
3502 site_handler(http_port, https_port), 3505 site_handler(http_port, https_port),
  3506 + constant_additional_headers,
3503 (HTTP_Info http_info, List(Web_arg) lwa) |-> if separate_web_args(lwa, http_info ) is 3507 (HTTP_Info http_info, List(Web_arg) lwa) |-> if separate_web_args(lwa, http_info ) is
3504 swa(mb_previous_state,mb_action_name,operands) then 3508 swa(mb_previous_state,mb_action_name,operands) then
3505 if mb_action_name is 3509 if mb_action_name is
@@ -3803,12 +3807,13 @@ public define Web_Site @@ -3803,12 +3807,13 @@ public define Web_Site
3803 (WEB_Session, 3807 (WEB_Session,
3804 HTTP_Info, 3808 HTTP_Info,
3805 Var(List(Web_arg)), 3809 Var(List(Web_arg)),
3806 - Bool is_https) -> WEB_Session expired_session, 3810 + Bool is_https) -> WEB_Session expired_session,
3807 Var(List(WEB_Controller)) web_controllers, 3811 Var(List(WEB_Controller)) web_controllers,
3808 Var(List(WEB_Page_Renderer)) web_page_renderers, 3812 Var(List(WEB_Page_Renderer)) web_page_renderers,
3809 - Maybe(WEB_Session) -> List(HTTP_header) additional_headers,  
3810 - Int timeout,  
3811 - Redirections redirections, 3813 + Maybe(WEB_Session) -> List(HTTP_header) additional_headers,
  3814 + List(HTTP_header) constant_additional_headers,
  3815 + Int timeout,
  3816 + Redirections redirections,
3812 String charset, 3817 String charset,
3813 List(String) journal_extensions, 3818 List(String) journal_extensions,
3814 List(String) journal_headers, 3819 List(String) journal_headers,
@@ -3917,6 +3922,7 @@ public define Web_Site @@ -3917,6 +3922,7 @@ public define Web_Site
3917 secret, 3922 secret,
3918 known_mime_types, 3923 known_mime_types,
3919 site_handler(http_port,https_port), 3924 site_handler(http_port,https_port),
  3925 + constant_additional_headers,
3920 (HTTP_Info http_info, List(Web_arg) lwa) |-> unique 3926 (HTTP_Info http_info, List(Web_arg) lwa) |-> unique
3921 // if separate_web_args(lwa, http_info ) is 3927 // if separate_web_args(lwa, http_info ) is
3922 // swa(mb_previous_state,mb_action_name,operands) then 3928 // swa(mb_previous_state,mb_action_name,operands) then
@@ -3975,7 +3981,8 @@ public define Web_Site @@ -3975,7 +3981,8 @@ public define Web_Site
3975 Bool is_https) -> $State ticket_lost_state, 3981 Bool is_https) -> $State ticket_lost_state,
3976 List(Web_Action($State)) actions, 3982 List(Web_Action($State)) actions,
3977 $State -> HTTP_Answer compute_page, 3983 $State -> HTTP_Answer compute_page,
3978 - $State -> List(HTTP_header) additional_headers, 3984 + $State -> List(HTTP_header) additional_headers,
  3985 + List(HTTP_header) constant_additional_headers,
3979 Int timeout, 3986 Int timeout,
3980 Redirections redirections, 3987 Redirections redirections,
3981 String charset, 3988 String charset,
@@ -3990,8 +3997,7 @@ public define Web_Site @@ -3990,8 +3997,7 @@ public define Web_Site
3990 = 3997 =
3991 //generate an unique ID if doesn't exist in root of site_directory 3998 //generate an unique ID if doesn't exist in root of site_directory
3992 with site_UID = get_site_uid(site_directory), 3999 with site_UID = get_site_uid(site_directory),
3993 - println("site_UID : "+site_UID);  
3994 - 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) 4000 + 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)
3995 . 4001 .
3996 4002
3997 4003
web/CXM_multihost_http_server.anubis
@@ -233,7 +233,9 @@ public type Web_Site_Description: @@ -233,7 +233,9 @@ public type Web_Site_Description:
233 HTTP_Info http_info, 233 HTTP_Info http_info,
234 List(Web_arg) lwa, 234 List(Web_arg) lwa,
235 Bool is_https) -> AWP_Handler_Answer awp_handler, 235 Bool is_https) -> AWP_Handler_Answer awp_handler,
  236 + List(HTTP_header) constant_additional_headers,
236 (HTTP_Info http_info, 237 (HTTP_Info http_info,
  238 +
237 List(Web_arg) lwa) -> One before_send_file 239 List(Web_arg) lwa) -> One before_send_file
238 //Bool using_state_cookies, 240 //Bool using_state_cookies,
239 ). 241 ).
@@ -2501,14 +2503,14 @@ define One @@ -2501,14 +2503,14 @@ define One
2501 printable_tree(answer_headers_body) then 2503 printable_tree(answer_headers_body) then
2502 forget(reliable_write(connection, answer_headers_body)), 2504 forget(reliable_write(connection, answer_headers_body)),
2503 send_file(file_path, content_disposition) then 2505 send_file(file_path, content_disposition) then
2504 - send_file_answer(desc, connection, uri, file_path, content_disposition, headers, standard_headers, 2506 + send_file_answer(desc, connection, uri, file_path, content_disposition, headers, standard_headers + constant_additional_headers(desc),
2505 (One u) |-> before_send_file(desc)(http_inf, all_web_args)) 2507 (One u) |-> before_send_file(desc)(http_inf, all_web_args))
2506 } 2508 }
2507 else (send_file(desc, 2509 else (send_file(desc,
2508 connection, 2510 connection,
2509 uri, 2511 uri,
2510 headers, 2512 headers,
2511 - standard_headers, 2513 + standard_headers + constant_additional_headers(desc),
2512 if web_arg_value(all_web_args,"zauth") is 2514 if web_arg_value(all_web_args,"zauth") is
2513 { 2515 {
2514 not_found then failure, 2516 not_found then failure,
@@ -3211,7 +3213,7 @@ define Maybe((String,Web_Site_Description)) @@ -3211,7 +3213,7 @@ define Maybe((String,Web_Site_Description))
3211 { 3213 {
3212 [ ] then print("Requested host '"+requested_host+"' does not exist.\n"); failure, 3214 [ ] then print("Requested host '"+requested_host+"' does not exist.\n"); failure,
3213 [site1 . others] then 3215 [site1 . others] then
3214 - if site1 is web_site_description(common_names,_,_,_,_,_,_,_,_,_) then 3216 + if site1 is web_site_description(common_names,_,_,_,_,_,_,_,_,_,_) then
3215 if member(common_names,requested_host) 3217 if member(common_names,requested_host)
3216 then success((requested_host,site1)) 3218 then success((requested_host,site1))
3217 else get_site(requested_host,others) 3219 else get_site(requested_host,others)
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")). @@ -134,31 +134,6 @@ define HTML_Head_Tag required_js = js(js_file("js/cxm/cxm_jquery_animate.js")).
134 134
135 define String js_anim_function_name = "CalexiumToolBox.CXM_Animate.animate". 135 define String js_anim_function_name = "CalexiumToolBox.CXM_Animate.animate".
136 136
137 -define String  
138 - format_html_event_to_js  
139 - (  
140 - HtmlEvents ev  
141 - ) =  
142 - if ev is  
143 - {  
144 - onchange then "change",  
145 - onsubmit then "submit",  
146 - onreset then "reset",  
147 - onselect then "select",  
148 - onblur then "blur",  
149 - onfocus then "focus",  
150 - onkeydown then "keydown"  
151 - onkeypress then "keypress",  
152 - onkeyup then "keyup",  
153 - onclick then "click",  
154 - ondblclick then "dblclick",  
155 - onmousedown then "mousedown",  
156 - onmousemove then "mousemove",  
157 - onmouseout then "mouseout",  
158 - onmouseover then "mouseover",  
159 - onmouseup then "mouseup"  
160 - }.  
161 -  
162 define List(JsonMember) 137 define List(JsonMember)
163 animatables_to_json_members 138 animatables_to_json_members
164 ( 139 (
@@ -238,7 +213,7 @@ define JQueryFormattedAnimation @@ -238,7 +213,7 @@ define JQueryFormattedAnimation
238 ) = 213 ) =
239 with css_props_as_json_members = animatables_to_json_members(styles), 214 with css_props_as_json_members = animatables_to_json_members(styles),
240 easing_str = format_easing(type), 215 easing_str = format_easing(type),
241 - trigger_str = format_html_event_to_js(trigger), 216 + trigger_str = event_name(trigger),
242 217
243 id_str = if id is id(id_str) then id_str, 218 id_str = if id is id(id_str) then id_str,
244 219