Commit 2603edadb50b91d87b157ee960f077635f68c65e

Authored by Julien Verneuil
2 parents 90bc4287 c5c6fea1

Merge branch 'release/ANUBIS_1_14' of ssh://gitlab.calexium.com:33022/calexium/c…

…alexium_lib into release/ANUBIS_1_14
database/vtm/view_table_renderer.anubis
@@ -25,7 +25,8 @@ read calexium_lib/web/CXM_making_a_web_site.anubis @@ -25,7 +25,8 @@ read calexium_lib/web/CXM_making_a_web_site.anubis
25 read calexium_lib/web/CXM_multihost_http_server.anubis 25 read calexium_lib/web/CXM_multihost_http_server.anubis
26 read calexium_lib/web/jQuery/CXM_jquery_datatable.anubis 26 read calexium_lib/web/jQuery/CXM_jquery_datatable.anubis
27 read calexium_lib/web/jQuery/CXM_jquery_datatable_types.anubis 27 read calexium_lib/web/jQuery/CXM_jquery_datatable_types.anubis
28 -read calexium_lib/web/jQuery/CXM_jquery_dialog.anubis 28 +read calexium_lib/web/jQuery/CXM_jquery_dialog.anubis
  29 +read calexium_lib/web/jQuery/CXM_jquery_button.anubis
29 read calexium_lib/web/jQuery/ui-addon/datetimepicker.anubis 30 read calexium_lib/web/jQuery/ui-addon/datetimepicker.anubis
30 read calexium_lib/web/CXM_form.anubis 31 read calexium_lib/web/CXM_form.anubis
31 read calexium_lib/web/widgets/css_helper.anubis 32 read calexium_lib/web/widgets/css_helper.anubis
@@ -204,9 +205,14 @@ public define HTML_Partial_Content @@ -204,9 +205,14 @@ public define HTML_Partial_Content
204 partial_content( 205 partial_content(
205 div( [/*class("tableau")*/], 206 div( [/*class("tableau")*/],
206 sequence( 207 sequence(
207 - [ actioner(same,same, link([class("my_button")],_T("NEW")),"edit_table",[("table_name", rows.table_name)]), 208 +<<<<<<< HEAD
  209 + [
  210 + partial(jquery_button(jQuery_button(button, "edit_table_"+rows.table_name, "", _T("NEW"), jQuery_actioner(same, jqlink, "edit_table&table_name="+rows.table_name)))),
  211 +=======
  212 + [ partial(jquery_button(jQuery_button(button, "", _T("NEW"), jQuery_actioner(same, jqlink, "table_name"), jq_icon_none, jq_icon_none)))/*actioner(same,same, link([class("my_button")],_T("NEW")),"edit_table",[("table_name", rows.table_name)])*/,
  213 +>>>>>>> 50b6dd00541faf76383aa5ad807b547c3f882842
208 //dialog used by datatable entries 214 //dialog used by datatable entries
209 - partial(jq_dialog_create(dialog_id("edit_table_dlg_ajax"), ajax("?a=ajax_edit_table&table_name="+rows.table_name))), 215 + partial(jq_dialog_create(dialog_id(action_name+"_dlg_ajax"), ajax("?a=ajax_edit_table&table_name="+rows.table_name))),
210 216
211 table([core_attrs([id("table_view"), class("tableau display compact nowrap")])], 217 table([core_attrs([id("table_view"), class("tableau display compact nowrap")])],
212 make_header(_T, rows.header.list, [action_header_cell]), 218 make_header(_T, rows.header.list, [action_header_cell]),
web/CXM_jquery.anubis
@@ -126,7 +126,7 @@ define List(HTML_Head_Tag) @@ -126,7 +126,7 @@ define List(HTML_Head_Tag)
126 jquery_defaults 126 jquery_defaults
127 = 127 =
128 [ 128 [
129 - js(js_file("/js/jquery/jquery-1.11.3.js")), 129 + js(js_file("/js/jquery/jquery-1.11.3.min.js")),
130 js(js_file("/js/jquery/jquery-ui-1.11.4/jquery-ui.min.js")), 130 js(js_file("/js/jquery/jquery-ui-1.11.4/jquery-ui.min.js")),
131 ]. 131 ].
132 132
web/CXM_making_a_web_site.anubis
@@ -2695,12 +2695,14 @@ public define Start_Web_Sites_Result @@ -2695,12 +2695,14 @@ public define Start_Web_Sites_Result
2695 with http_server_r = 2695 with http_server_r =
2696 start_http_server(ip_address,http_port, 2696 start_http_server(ip_address,http_port,
2697 map(get_description,web_sites), 2697 map(get_description,web_sites),
2698 - load_denial_of_service_info), 2698 + load_denial_of_service_info,
  2699 + shutdown_required),
2699 with https_server_r = 2700 with https_server_r =
2700 start_https_server(ip_address,https_port, 2701 start_https_server(ip_address,https_port,
2701 ssl_certificate_common_name, 2702 ssl_certificate_common_name,
2702 map(get_description,web_sites), 2703 map(get_description,web_sites),
2703 - load_denial_of_service_info), 2704 + load_denial_of_service_info,
  2705 + shutdown_required),
2704 if http_server_r is ok(http_server) 2706 if http_server_r is ok(http_server)
2705 then 2707 then
2706 ( 2708 (
web/CXM_multihost_http_server.anubis
@@ -3168,12 +3168,17 @@ define One @@ -3168,12 +3168,17 @@ define One
3168 BufferedConnection connection, 3168 BufferedConnection connection,
3169 Bool is_https, 3169 Bool is_https,
3170 DenialOfService dos, 3170 DenialOfService dos,
3171 - SState s 3171 + SState s,
  3172 + (One) -> Bool shutdown_required
3172 ) = 3173 ) =
3173 //t0 <- (UTime)unow; 3174 //t0 <- (UTime)unow;
3174 with start_time = (Int)now, 3175 with start_time = (Int)now,
3175 s.sttm <- start_time; 3176 s.sttm <- start_time;
3176 //println("Request time: " + format_http_date(start_time)); 3177 //println("Request time: " + format_http_date(start_time));
  3178 + if shutdown_required(unique) then
  3179 + println("shutdown required on http_https_handler");
  3180 + unique
  3181 + else
3177 if dos is denial_of_service(mc_v,rld_v,hd_v,ad_v,ld_v,ra_v) then 3182 if dos is denial_of_service(mc_v,rld_v,hd_v,ad_v,ld_v,ra_v) then
3178 if remote_IP_address_and_port(connection.conn) is (ip_addr,port) then 3183 if remote_IP_address_and_port(connection.conn) is (ip_addr,port) then
3179 if read_request_line(connection) is 3184 if read_request_line(connection) is
@@ -3210,7 +3215,7 @@ define One @@ -3210,7 +3215,7 @@ define One
3210 ok(body) then 3215 ok(body) then
3211 www_url_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, body, generate_tt); 3216 www_url_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, body, generate_tt);
3212 //it's HTTP 1.1 keep-alive is default 3217 //it's HTTP 1.1 keep-alive is default
3213 - http_https_handler(sites, connection, is_https, dos, s) 3218 + http_https_handler(sites, connection, is_https, dos, s, shutdown_required)
3214 } 3219 }
3215 //MULTIPART_FORM_DATA 3220 //MULTIPART_FORM_DATA
3216 multipart_form_data then 3221 multipart_form_data then
@@ -3250,7 +3255,7 @@ define One @@ -3250,7 +3255,7 @@ define One
3250 multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, generate_tt, s); 3255 multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, generate_tt, s);
3251 3256
3252 //it's HTTP 1.1 keep-alive is default 3257 //it's HTTP 1.1 keep-alive is default
3253 - http_https_handler(sites, connection, is_https, dos, s) 3258 + http_https_handler(sites, connection, is_https, dos, s, shutdown_required)
3254 3259
3255 else 3260 else
3256 println("Can't copy data from stream to temporary file "), 3261 println("Can't copy data from stream to temporary file "),
@@ -3264,7 +3269,7 @@ define One @@ -3264,7 +3269,7 @@ define One
3264 multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, generate_tt, s); 3269 multipart_form_data_answer(host_name, desc, connection.conn, ip_addr, rqline2, headers, desc.site_directory + tmp_body_file, generate_tt, s);
3265 3270
3266 //it's HTTP 1.1 keep-alive is default 3271 //it's HTTP 1.1 keep-alive is default
3267 - http_https_handler(sites, connection, is_https, dos, s) 3272 + http_https_handler(sites, connection, is_https, dos, s, shutdown_required)
3268 3273
3269 else 3274 else
3270 println("Can't copy data from stream to temporary file ") 3275 println("Can't copy data from stream to temporary file ")
@@ -3300,7 +3305,8 @@ define Server -&gt; ((RWStream) -&gt; One) @@ -3300,7 +3305,8 @@ define Server -&gt; ((RWStream) -&gt; One)
3300 make_http_handler 3305 make_http_handler
3301 ( 3306 (
3302 List(Web_Site_Description) sites, 3307 List(Web_Site_Description) sites,
3303 - DenialOfService dos 3308 + DenialOfService dos,
  3309 + (One) -> Bool shutdown_required
3304 ) = 3310 ) =
3305 (Server server) |-> (RWStream conn) |-> 3311 (Server server) |-> (RWStream conn) |->
3306 if remote_IP_address_and_port(conn) is (addr,_) then 3312 if remote_IP_address_and_port(conn) is (addr,_) then
@@ -3308,31 +3314,33 @@ define Server -&gt; ((RWStream) -&gt; One) @@ -3308,31 +3314,33 @@ define Server -&gt; ((RWStream) -&gt; One)
3308 then print("Rejecting dubious IP address "+ip_addr_to_string(addr)+"\n") 3314 then print("Rejecting dubious IP address "+ip_addr_to_string(addr)+"\n")
3309 else 3315 else
3310 with connection = buffered_connection(tcp(conn), var(constant_byte_array(0, 0)), var(0), var([])), 3316 with connection = buffered_connection(tcp(conn), var(constant_byte_array(0, 0)), var(0), var([])),
3311 - http_https_handler(sites, connection, false, dos, sstate(var(0),var(0))). 3317 + http_https_handler(sites, connection, false, dos, sstate(var(0),var(0)), shutdown_required).
3312 public define One 3318 public define One
3313 http_direct_handler 3319 http_direct_handler
3314 ( 3320 (
3315 List(Web_Site_Description) sites, 3321 List(Web_Site_Description) sites,
3316 RWStream conn, 3322 RWStream conn,
3317 - DenialOfService dos 3323 + DenialOfService dos,
  3324 + (One) -> Bool shutdown_required
3318 ) = 3325 ) =
3319 if remote_IP_address_and_port(conn) is (addr,_) then 3326 if remote_IP_address_and_port(conn) is (addr,_) then
3320 if is_dubious_IP(addr,dos) 3327 if is_dubious_IP(addr,dos)
3321 then print("Rejecting dubious IP address "+ip_addr_to_string(addr)+"\n") 3328 then print("Rejecting dubious IP address "+ip_addr_to_string(addr)+"\n")
3322 else 3329 else
3323 with connection = buffered_connection(tcp(conn), var(constant_byte_array(0, 0)), var(0), var([])), 3330 with connection = buffered_connection(tcp(conn), var(constant_byte_array(0, 0)), var(0), var([])),
3324 - http_https_handler(sites, connection, false, dos, sstate(var(0),var(0))). 3331 + http_https_handler(sites, connection, false, dos, sstate(var(0),var(0)), shutdown_required).
3325 3332
3326 3333
3327 define Server -> (SSL_Connection -> One) 3334 define Server -> (SSL_Connection -> One)
3328 make_https_handler 3335 make_https_handler
3329 ( 3336 (
3330 List(Web_Site_Description) sites, 3337 List(Web_Site_Description) sites,
3331 - DenialOfService dos 3338 + DenialOfService dos,
  3339 + (One) -> Bool shutdown_required
3332 ) = 3340 ) =
3333 (Server server) |-> (SSL_Connection conn) |-> 3341 (Server server) |-> (SSL_Connection conn) |->
3334 with connection = buffered_connection(ssl(conn), var(constant_byte_array(0, 0)), var(0), var([])), 3342 with connection = buffered_connection(ssl(conn), var(constant_byte_array(0, 0)), var(0), var([])),
3335 - http_https_handler(sites, connection, true, dos, sstate(var(0),var(0))). 3343 + http_https_handler(sites, connection, true, dos, sstate(var(0),var(0)), shutdown_required).
3336 3344
3337 3345
3338 3346
@@ -3615,11 +3623,12 @@ public define StartServerResult @@ -3615,11 +3623,12 @@ public define StartServerResult
3615 Word32 ip_address, 3623 Word32 ip_address,
3616 Word32 port, 3624 Word32 port,
3617 List(Web_Site_Description) sites, 3625 List(Web_Site_Description) sites,
3618 - DenialOfService dos 3626 + DenialOfService dos,
  3627 + (One) -> Bool shutdown_required
3619 ) = 3628 ) =
3620 create_directories(sites); 3629 create_directories(sites);
3621 start_http_server(ip_address,port, 3630 start_http_server(ip_address,port,
3622 - make_http_handler(sites, dos), 3631 + make_http_handler(sites, dos, shutdown_required),
3623 0, 3632 0,
3624 dos). 3633 dos).
3625 3634
@@ -3663,11 +3672,12 @@ public define StartServerResult @@ -3663,11 +3672,12 @@ public define StartServerResult
3663 Word32 port, 3672 Word32 port,
3664 String certificate_common_name, // of SSL server certificate 3673 String certificate_common_name, // of SSL server certificate
3665 List(Web_Site_Description) sites, 3674 List(Web_Site_Description) sites,
3666 - DenialOfService dos 3675 + DenialOfService dos,
  3676 + (One) -> Bool shutdown_required
3667 ) = 3677 ) =
3668 create_directories(sites); 3678 create_directories(sites);
3669 start_https_server(ip_address,port,certificate_common_name, 3679 start_https_server(ip_address,port,certificate_common_name,
3670 - make_https_handler(sites, dos), 3680 + make_https_handler(sites, dos, shutdown_required),
3671 0,dos). 3681 0,dos).
3672 3682
3673 3683
web/jQuery/ui-addon/datetimepicker.anubis
@@ -17,9 +17,9 @@ read calexium_lib/web/CXM_jquery.anubis @@ -17,9 +17,9 @@ read calexium_lib/web/CXM_jquery.anubis
17 css(css_file("/css/jquery/ui/datetimepicker.css")), 17 css(css_file("/css/jquery/ui/datetimepicker.css")),
18 js(js_file("js/jquery/ui/jquery-ui-timepicker-addon.js")), 18 js(js_file("js/jquery/ui/jquery-ui-timepicker-addon.js")),
19 js_inline(jquery_ready("// Datepicker\n 19 js_inline(jquery_ready("// Datepicker\n
20 - $('.datepicker').datepicker({inline: true});  
21 - $('.datetimepicker').datetimepicker({inline: true});  
22 - ")) 20 + $('.datepicker').datepicker({inline: true});
  21 + $('.datetimepicker').datetimepicker({inline: true});
  22 + "))
23 ] 23 ]
24 . 24 .
25 25
@@ -28,16 +28,43 @@ read calexium_lib/web/CXM_jquery.anubis @@ -28,16 +28,43 @@ read calexium_lib/web/CXM_jquery.anubis
28 public define List(HTML_Head_Tag) 28 public define List(HTML_Head_Tag)
29 jq_datetimepicker_init 29 jq_datetimepicker_init
30 ( 30 (
31 - String lang 31 + String lang,
  32 + Bool add_icon
32 ) 33 )
33 = 34 =
34 [ 35 [
35 css(css_file("js/jquery/plug-in/datetimepicker/datetimepicker.css")), 36 css(css_file("js/jquery/plug-in/datetimepicker/datetimepicker.css")),
36 js(js_file("js/jquery/plug-in/datetimepicker/datetimepicker.js")), 37 js(js_file("js/jquery/plug-in/datetimepicker/datetimepicker.js")),
37 js_inline(jquery_ready("// Datetimepicker\n 38 js_inline(jquery_ready("// Datetimepicker\n
38 - $('.datepicker').datetimepicker({lang:'"+lang+"',timepicker:false,format:'d/m/Y'});  
39 - $('.datetimepicker').datetimepicker({lang:'"+lang+"',format:'Y-m-d H:i'});  
40 - $('.timepicker').datetimepicker({lang:'"+lang+"',datepicker:false,format:'H:i',step:5})  
41 - ")) 39 + $('.datepicker').datetimepicker({lang:'"+lang+"',timepicker:false,format:'d/m/Y'});
  40 + $('.datetimepicker').datetimepicker({lang:'"+lang+"',format:'Y-m-d H:i'});
  41 + $('.timepicker').datetimepicker({lang:'"+lang+"',datepicker:false,format:'H:i',step:5});
  42 + " + if add_icon then "
  43 + var items_add_func = function (index) {
  44 + var icon_file = 'icon_calendar.gif';
  45 + var dt_picker = $(this);
  46 +
  47 + if (dt_picker.hasClass('timepicker')) {
  48 + icon_file = 'icon_clock.gif';
  49 + }
  50 +
  51 + var icon = $('<img src=\"icons/16x16/'+icon_file+'\"/>');
  52 +
  53 + icon.click(function () { dt_picker.datetimepicker('show'); });
  54 + icon.hover(function() { $(this).css('cursor','pointer'); });
  55 + dt_picker.after(icon);
  56 + };
  57 +
  58 + $('.datepicker').each(items_add_func);
  59 + $('.datetimepicker').each(items_add_func);
  60 + $('.timepicker').each(items_add_func);
  61 + " else ""))
42 ] 62 ]
43 . 63 .
  64 +
  65 +public define List(HTML_Head_Tag)
  66 + jq_datetimepicker_init
  67 + (
  68 + String lang
  69 + )
  70 + = jq_datetimepicker_init(lang, true).