Commit 8b4b368f40fb62c5583b14081d817309aa56337a
1 parent
5f98667f
add now for DB_date and DB_time
add parameter to specialized element phone to show only the image the get_mb_bool from web arg check the presence of the arg_name with prefixed '~'. If this ~name exists this means that comes from a form and the checkbox is not checked. I made this hack on web form which always create the hidden input with prefixed ~ name. This method allow to determine if the arg name was really sent or not. add more ajax possibilities in web_controller_result. the div can has list of partial_content
Showing
5 changed files
with
155 additions
and
35 deletions
Show diff stats
database/db_types.anubis
| @@ -186,7 +186,16 @@ public define DB_datetime | @@ -186,7 +186,16 @@ public define DB_datetime | ||
| 186 | now | 186 | now |
| 187 | = | 187 | = |
| 188 | db_datetime(_Int_to_ISO_8601_datetime(now)). | 188 | db_datetime(_Int_to_ISO_8601_datetime(now)). |
| 189 | - | 189 | + |
| 190 | +public define DB_date | ||
| 191 | + now | ||
| 192 | + = | ||
| 193 | + db_date(_Int_to_ISO_8601_date(now)). | ||
| 194 | + | ||
| 195 | +public define DB_time | ||
| 196 | + now | ||
| 197 | + = | ||
| 198 | + db_time(_Int_to_ISO_8601_time(now)). | ||
| 190 | 199 | ||
| 191 | public define DB_time | 200 | public define DB_time |
| 192 | get_dummy_DB_time | 201 | get_dummy_DB_time |
database/db_utils.anubis
| @@ -268,7 +268,14 @@ public define List(Int) | @@ -268,7 +268,14 @@ public define List(Int) | ||
| 268 | with s = (Int)db_integer(explorer)(0), | 268 | with s = (Int)db_integer(explorer)(0), |
| 269 | db_get_integer_list(table_cursor, [s . so_far]) | 269 | db_get_integer_list(table_cursor, [s . so_far]) |
| 270 | }. | 270 | }. |
| 271 | - | 271 | + |
| 272 | +public define List(Int) | ||
| 273 | + db_get_integer_list | ||
| 274 | + ( | ||
| 275 | + One -> SQLite3Row table_cursor | ||
| 276 | + ) = | ||
| 277 | + db_get_integer_list(table_cursor, []). | ||
| 278 | + | ||
| 272 | public define List(Int) | 279 | public define List(Int) |
| 273 | db_get_integer_list | 280 | db_get_integer_list |
| 274 | ( | 281 | ( |
| @@ -284,7 +291,14 @@ public define List(Int) | @@ -284,7 +291,14 @@ public define List(Int) | ||
| 284 | db_get_integer_list(table_cursor, [s . so_far]) | 291 | db_get_integer_list(table_cursor, [s . so_far]) |
| 285 | }. | 292 | }. |
| 286 | 293 | ||
| 287 | - | 294 | +public define List(Int) |
| 295 | + db_get_integer_list | ||
| 296 | + ( | ||
| 297 | + One -> DbRow table_cursor, | ||
| 298 | + ) = | ||
| 299 | + db_get_integer_list(table_cursor, []). | ||
| 300 | + | ||
| 301 | + | ||
| 288 | Help to construct clause and a list of bind according to list of SQLite3_update_field. | 302 | Help to construct clause and a list of bind according to list of SQLite3_update_field. |
| 289 | This is useful when we want to construct a SQL query with only needs fields. | 303 | This is useful when we want to construct a SQL query with only needs fields. |
| 290 | 304 |
web/CXM_making_a_web_site.anubis
| @@ -302,7 +302,7 @@ public type HTTP_Answer:... | @@ -302,7 +302,7 @@ public type HTTP_Answer:... | ||
| 302 | taken from the data bases. | 302 | taken from the data bases. |
| 303 | 303 | ||
| 304 | 304 | ||
| 305 | - | 305 | +public type HTML_Partial_Content:... |
| 306 | 306 | ||
| 307 | 307 | ||
| 308 | 308 | ||
| @@ -332,9 +332,57 @@ public type WEB_Controller_Result: | @@ -332,9 +332,57 @@ public type WEB_Controller_Result: | ||
| 332 | ajax( | 332 | ajax( |
| 333 | WEB_Session session, //modified session | 333 | WEB_Session session, //modified session |
| 334 | HTTP_Answer http_answer //http answer | 334 | HTTP_Answer http_answer //http answer |
| 335 | - ) | 335 | + ), |
| 336 | + ajax( | ||
| 337 | + HTML_Partial_Content content, | ||
| 338 | + String additional_script | ||
| 339 | + ), | ||
| 340 | + ajax( | ||
| 341 | + WEB_Session session, //modified session | ||
| 342 | + HTML_Partial_Content content, | ||
| 343 | + String additional_script | ||
| 344 | + ), | ||
| 345 | + ajax( | ||
| 346 | + Printable_tree content, | ||
| 347 | + String additional_script | ||
| 348 | + ), | ||
| 349 | + ajax( | ||
| 350 | + WEB_Session session, //modified session | ||
| 351 | + Printable_tree content, | ||
| 352 | + String additional_script | ||
| 353 | + ) | ||
| 336 | . | 354 | . |
| 337 | 355 | ||
| 356 | +public define WEB_Controller_Result | ||
| 357 | + ajax | ||
| 358 | + ( | ||
| 359 | + HTML_Partial_Content content | ||
| 360 | + )= | ||
| 361 | + ajax(content, ""). | ||
| 362 | + | ||
| 363 | +public define WEB_Controller_Result | ||
| 364 | + ajax | ||
| 365 | + ( | ||
| 366 | + WEB_Session session, //modified session | ||
| 367 | + HTML_Partial_Content content | ||
| 368 | + )= | ||
| 369 | + ajax(session, content, ""). | ||
| 370 | + | ||
| 371 | +public define WEB_Controller_Result | ||
| 372 | + ajax | ||
| 373 | + ( | ||
| 374 | + Printable_tree content | ||
| 375 | + )= | ||
| 376 | + ajax(content, ""). | ||
| 377 | + | ||
| 378 | +public define WEB_Controller_Result | ||
| 379 | + ajax | ||
| 380 | + ( | ||
| 381 | + WEB_Session session, //modified session | ||
| 382 | + Printable_tree content | ||
| 383 | + )= | ||
| 384 | + ajax(session, content, ""). | ||
| 385 | + | ||
| 338 | public type WEB_Action_Allowed_Protocol: | 386 | public type WEB_Action_Allowed_Protocol: |
| 339 | http, | 387 | http, |
| 340 | https, | 388 | https, |
| @@ -1669,7 +1717,7 @@ public type HTML_Off_Form: | @@ -1669,7 +1717,7 @@ public type HTML_Off_Form: | ||
| 1669 | List(HTML_In_Form) content), | 1717 | List(HTML_In_Form) content), |
| 1670 | in_form (HTML_Id form_id, HTML_In_Form content), | 1718 | in_form (HTML_Id form_id, HTML_In_Form content), |
| 1671 | div (List(CoreAttrs), List(HTML_Off_Form) content), | 1719 | div (List(CoreAttrs), List(HTML_Off_Form) content), |
| 1672 | - div (List(CoreAttrs), HTML_Partial_Content p_content), | 1720 | + div (List(CoreAttrs), List(HTML_Partial_Content) p_content), |
| 1673 | div_empty (List(CoreAttrs)), | 1721 | div_empty (List(CoreAttrs)), |
| 1674 | iframe (List(CoreAttrs), | 1722 | iframe (List(CoreAttrs), |
| 1675 | List(CSS_Style) /*styles*/, | 1723 | List(CSS_Style) /*styles*/, |
| @@ -1977,6 +2025,30 @@ public define HTML_Off_Form | @@ -1977,6 +2025,30 @@ public define HTML_Off_Form | ||
| 1977 | div([], elements) | 2025 | div([], elements) |
| 1978 | . | 2026 | . |
| 1979 | 2027 | ||
| 2028 | +public define HTML_Off_Form | ||
| 2029 | + div | ||
| 2030 | + ( | ||
| 2031 | + HTML_Partial_Content element | ||
| 2032 | + )= | ||
| 2033 | + div([], [element]) | ||
| 2034 | +. | ||
| 2035 | + | ||
| 2036 | +public define HTML_Off_Form | ||
| 2037 | + div | ||
| 2038 | + ( | ||
| 2039 | + List(CoreAttrs) attrs, | ||
| 2040 | + HTML_Partial_Content element | ||
| 2041 | + )= | ||
| 2042 | + div(attrs, [element]) | ||
| 2043 | +. | ||
| 2044 | + | ||
| 2045 | +public define HTML_Off_Form | ||
| 2046 | + div | ||
| 2047 | + ( | ||
| 2048 | + List(HTML_Partial_Content) elements | ||
| 2049 | + )= | ||
| 2050 | + div([], elements) | ||
| 2051 | +. | ||
| 1980 | 2052 | ||
| 1981 | public define HTML_Off_Form | 2053 | public define HTML_Off_Form |
| 1982 | li | 2054 | li |
| @@ -3354,18 +3426,22 @@ define Maybe(WEB_Controller) | @@ -3354,18 +3426,22 @@ define Maybe(WEB_Controller) | ||
| 3354 | failure, | 3426 | failure, |
| 3355 | [h . t] then | 3427 | [h . t] then |
| 3356 | if h.name = controller_name then | 3428 | if h.name = controller_name then |
| 3357 | - println("Controller ["+controller_name+"] found"); | 3429 | + //println("Controller ["+controller_name+"] found"); |
| 3358 | success(h) | 3430 | success(h) |
| 3359 | else | 3431 | else |
| 3360 | get_controller(controller_name, t) | 3432 | get_controller(controller_name, t) |
| 3361 | } | 3433 | } |
| 3362 | . | 3434 | . |
| 3363 | 3435 | ||
| 3436 | +public define JsonValue to_html_ajax_content(Printable_tree content_HTML, String additional_script). | ||
| 3437 | +public define JsonValue to_html_ajax_content(HTML_Partial_Content content_HTML, CommonInfo cinfo, String additional_script). | ||
| 3438 | + | ||
| 3364 | define (Maybe(WEB_Session), HTTP_Answer) | 3439 | define (Maybe(WEB_Session), HTTP_Answer) |
| 3365 | apply_controller_action | 3440 | apply_controller_action |
| 3366 | ( | 3441 | ( |
| 3367 | WEB_Controller controller, | 3442 | WEB_Controller controller, |
| 3368 | List(WEB_Controller) controllers, | 3443 | List(WEB_Controller) controllers, |
| 3444 | + CommonInfo cinfo, | ||
| 3369 | WEB_Session _session, | 3445 | WEB_Session _session, |
| 3370 | Maybe(String) _mb_action_name, | 3446 | Maybe(String) _mb_action_name, |
| 3371 | (HTTP_Info, | 3447 | (HTTP_Info, |
| @@ -3388,7 +3464,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3388,7 +3464,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3388 | if get_controller(get_String(new_session.web_request.lwa, "aws_controller", "root"), controllers) is | 3464 | if get_controller(get_String(new_session.web_request.lwa, "aws_controller", "root"), controllers) is |
| 3389 | { | 3465 | { |
| 3390 | failure then (failure, error_page(http_not_found, "Initial Session Controller not found", new_session)), | 3466 | failure then (failure, error_page(http_not_found, "Initial Session Controller not found", new_session)), |
| 3391 | - success(new_controller) then apply_controller_action(new_controller, controllers, new_session, failure, initial_session), | 3467 | + success(new_controller) then apply_controller_action(new_controller, controllers, cinfo, new_session, failure, initial_session), |
| 3392 | }, | 3468 | }, |
| 3393 | success(action_name) then | 3469 | success(action_name) then |
| 3394 | println("ACTION_NAME ["+action_name+"]"); | 3470 | println("ACTION_NAME ["+action_name+"]"); |
| @@ -3400,7 +3476,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3400,7 +3476,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3400 | if get_controller(get_String(new_session.web_request.lwa, "aws_controller", "root"), controllers) is | 3476 | if get_controller(get_String(new_session.web_request.lwa, "aws_controller", "root"), controllers) is |
| 3401 | { | 3477 | { |
| 3402 | failure then (failure, error_page(http_not_found, "Redirect Controller not found", new_session)), | 3478 | failure then (failure, error_page(http_not_found, "Redirect Controller not found", new_session)), |
| 3403 | - success(new_controller) then apply_controller_action(new_controller, controllers, new_session, failure, initial_session), | 3479 | + success(new_controller) then apply_controller_action(new_controller, controllers, cinfo, new_session, failure, initial_session), |
| 3404 | }, | 3480 | }, |
| 3405 | 3481 | ||
| 3406 | redirect(new_session, r_controller_name, r_action_name) then | 3482 | redirect(new_session, r_controller_name, r_action_name) then |
| @@ -3408,7 +3484,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3408,7 +3484,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3408 | { | 3484 | { |
| 3409 | failure then (failure, error_page(http_not_found, "Redirect Controller "+r_controller_name+" not found", new_session)), | 3485 | failure then (failure, error_page(http_not_found, "Redirect Controller "+r_controller_name+" not found", new_session)), |
| 3410 | success(new_controller) then | 3486 | success(new_controller) then |
| 3411 | - apply_controller_action(new_controller, controllers, new_session, success(r_action_name), initial_session), | 3487 | + apply_controller_action(new_controller, controllers, cinfo, new_session, success(r_action_name), initial_session), |
| 3412 | }, | 3488 | }, |
| 3413 | 3489 | ||
| 3414 | redirect_to_previous then | 3490 | redirect_to_previous then |
| @@ -3417,7 +3493,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3417,7 +3493,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3417 | failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), | 3493 | failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), |
| 3418 | success(new_controller) then | 3494 | success(new_controller) then |
| 3419 | since _session is web_session(lang, entries, _, previous), | 3495 | since _session is web_session(lang, entries, _, previous), |
| 3420 | - apply_controller_action(new_controller, controllers, web_session(lang, entries, previous, previous), failure, initial_session), | 3496 | + apply_controller_action(new_controller, controllers, cinfo, web_session(lang, entries, previous, previous), failure, initial_session), |
| 3421 | }, | 3497 | }, |
| 3422 | redirect_to_previous(entries) then | 3498 | redirect_to_previous(entries) then |
| 3423 | if get_controller(get_String(_session.previous_web_request.lwa, "aws_controller", "root"), controllers) is | 3499 | if get_controller(get_String(_session.previous_web_request.lwa, "aws_controller", "root"), controllers) is |
| @@ -3425,11 +3501,17 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3425,11 +3501,17 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3425 | failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), | 3501 | failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), |
| 3426 | success(new_controller) then | 3502 | success(new_controller) then |
| 3427 | since _session is web_session(lang, _, _, previous), | 3503 | since _session is web_session(lang, _, _, previous), |
| 3428 | - apply_controller_action(new_controller, controllers, web_session(lang, entries, previous, previous), failure, initial_session), | 3504 | + apply_controller_action(new_controller, controllers, cinfo, web_session(lang, entries, previous, previous), failure, initial_session), |
| 3429 | }, | 3505 | }, |
| 3430 | - ajax(answer) then (failure, answer), | 3506 | + ajax(answer) then (failure, answer), |
| 3431 | //ajax with modified session that must be saved | 3507 | //ajax with modified session that must be saved |
| 3432 | - ajax(session, answer) then (success(session), answer), | 3508 | + ajax(session, answer) then (success(session), answer), |
| 3509 | + | ||
| 3510 | + ajax(content, additional_script) then (failure, json(http_ok, to_html_ajax_content(content, cinfo, additional_script))), | ||
| 3511 | + ajax(session, content, additional_script) then (success(session), json(http_ok, to_html_ajax_content(content, cinfo, additional_script))), | ||
| 3512 | + ajax(content, additional_script) then (failure, json(http_ok, to_html_ajax_content(content, additional_script))), | ||
| 3513 | + ajax(session, content, additional_script) then (success(session), json(http_ok, to_html_ajax_content(content, additional_script))), | ||
| 3514 | + | ||
| 3433 | } | 3515 | } |
| 3434 | } | 3516 | } |
| 3435 | . | 3517 | . |
| @@ -3463,7 +3545,7 @@ public define Web_Site | @@ -3463,7 +3545,7 @@ public define Web_Site | ||
| 3463 | )= | 3545 | )= |
| 3464 | //call the initialization function | 3546 | //call the initialization function |
| 3465 | init(unique); | 3547 | init(unique); |
| 3466 | - | 3548 | + |
| 3467 | 3549 | ||
| 3468 | // | 3550 | // |
| 3469 | // make required directories (if needed) | 3551 | // make required directories (if needed) |
| @@ -3471,7 +3553,8 @@ public define Web_Site | @@ -3471,7 +3553,8 @@ public define Web_Site | ||
| 3471 | with //web_sites_directory = (String) make_directory(my_anubis_directory+"/web_sites"), | 3553 | with //web_sites_directory = (String) make_directory(my_anubis_directory+"/web_sites"), |
| 3472 | base_directory = (String) make_directory(site_directory), | 3554 | base_directory = (String) make_directory(site_directory), |
| 3473 | // state_directory = make_directory(site_directory+"/states"), | 3555 | // state_directory = make_directory(site_directory+"/states"), |
| 3474 | - forget((String)make_directory(site_directory+"/public")); | 3556 | + forget((String)make_directory(site_directory+"/public")); |
| 3557 | + | ||
| 3475 | // | 3558 | // |
| 3476 | // construct tool functions | 3559 | // construct tool functions |
| 3477 | // TODO 'make_separate_web_args_function' must retrieve state_cookies before parsing web_args if using_state_cookies is true | 3560 | // TODO 'make_separate_web_args_function' must retrieve state_cookies before parsing web_args if using_state_cookies is true |
| @@ -3492,7 +3575,7 @@ public define Web_Site | @@ -3492,7 +3575,7 @@ public define Web_Site | ||
| 3492 | //println("host_name "+host_name); | 3575 | //println("host_name "+host_name); |
| 3493 | //println(dump_http_info(http_info)); | 3576 | //println(dump_http_info(http_info)); |
| 3494 | println(dump_web_arg_values(_lwa)); | 3577 | println(dump_web_arg_values(_lwa)); |
| 3495 | - | 3578 | + with cinfo = info(host_name, http_port, https_port, site_directory, secret), |
| 3496 | 3579 | ||
| 3497 | //retrieve the previous session and determine the new one | 3580 | //retrieve the previous session and determine the new one |
| 3498 | with current_session = if retrieve_session(http_info, state_directory, website_name) is | 3581 | with current_session = if retrieve_session(http_info, state_directory, website_name) is |
| @@ -3519,7 +3602,7 @@ public define Web_Site | @@ -3519,7 +3602,7 @@ public define Web_Site | ||
| 3519 | (failure, error_page(http_not_found, "Controller not found", current_session)), | 3602 | (failure, error_page(http_not_found, "Controller not found", current_session)), |
| 3520 | 3603 | ||
| 3521 | success(new_controller) then | 3604 | success(new_controller) then |
| 3522 | - apply_controller_action(new_controller, *web_controllers, current_session, failure, initial_session), | 3605 | + apply_controller_action(new_controller, *web_controllers, cinfo, current_session, failure, initial_session), |
| 3523 | } | 3606 | } |
| 3524 | is (mb_new_session, http_answer), | 3607 | is (mb_new_session, http_answer), |
| 3525 | 3608 | ||
| @@ -3534,7 +3617,7 @@ public define Web_Site | @@ -3534,7 +3617,7 @@ public define Web_Site | ||
| 3534 | }, | 3617 | }, |
| 3535 | 3618 | ||
| 3536 | //formatting and send http answer because this is the last function | 3619 | //formatting and send http answer because this is the last function |
| 3537 | - format(info(host_name, http_port, https_port, site_directory, secret), | 3620 | + format(cinfo, |
| 3538 | //state_name, | 3621 | //state_name, |
| 3539 | additional_headers(mb_new_session) + cookie_headers, | 3622 | additional_headers(mb_new_session) + cookie_headers, |
| 3540 | http_answer, | 3623 | http_answer, |
| @@ -5428,9 +5511,9 @@ define Printable_tree | @@ -5428,9 +5511,9 @@ define Printable_tree | ||
| 5428 | format_label(label, id)], | 5511 | format_label(label, id)], |
| 5429 | check_box(options, label, id, n, v, c) then | 5512 | check_box(options, label, id, n, v, c) then |
| 5430 | [ format_label(label, id), | 5513 | [ format_label(label, id), |
| 5431 | - "<input type=\"checkbox\" name=\"",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\" " else ""),format_attrs([class("in") . options])," />"] | 5514 | + "<input type=\"hidden\" name=\"~",n,"\" value=\"~",v,"\" /><input type=\"checkbox\" name=\"",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\" " else ""),format_attrs([class("in") . options])," />"] |
| 5432 | check_box_r(options, label, id, n, v, c) then | 5515 | check_box_r(options, label, id, n, v, c) then |
| 5433 | - [ "<input type=\"checkbox\" name=\"",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\" " else ""),format_attrs([class("in") . options])," />", | 5516 | + [ "<input type=\"hidden\" name=\"~",n,"\" value=\"~",v,"\" /><input type=\"checkbox\" name=\"",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\" " else ""),format_attrs([class("in") . options])," />", |
| 5434 | format_label(label, id)] | 5517 | format_label(label, id)] |
| 5435 | div(options, e) then | 5518 | div(options, e) then |
| 5436 | format(cinfo,ic_v,any_div(options, e),format_element,is_https, action_count, head_tags), | 5519 | format(cinfo,ic_v,any_div(options, e),format_element,is_https, action_count, head_tags), |
| @@ -5659,9 +5742,9 @@ define Printable_tree | @@ -5659,9 +5742,9 @@ define Printable_tree | ||
| 5659 | div(options, e) then | 5742 | div(options, e) then |
| 5660 | format(cinfo, ic_v, any_div(options, e), format_element, is_https, action_count, head_tags), | 5743 | format(cinfo, ic_v, any_div(options, e), format_element, is_https, action_count, head_tags), |
| 5661 | div(options, p_content) then | 5744 | div(options, p_content) then |
| 5662 | - if p_content is partial_content(tags, html_elements) then | ||
| 5663 | - head_tags <- *head_tags +tags; | ||
| 5664 | - format(cinfo, ic_v, any_div(options, [html_elements]), format_element, is_https, action_count, head_tags), | 5745 | + 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), |
| 5746 | + | ||
| 5747 | + format(cinfo, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags), | ||
| 5665 | div_empty(options) then | 5748 | div_empty(options) then |
| 5666 | format(cinfo, ic_v, any_div_empty(options), format_element, is_https, action_count, head_tags), | 5749 | format(cinfo, ic_v, any_div_empty(options), format_element, is_https, action_count, head_tags), |
| 5667 | iframe(options, css_styles, css_files, js_files, body) then | 5750 | iframe(options, css_styles, css_files, js_files, body) then |
| @@ -5898,13 +5981,6 @@ public define HTML_ajax_content | @@ -5898,13 +5981,6 @@ public define HTML_ajax_content | ||
| 5898 | html_ajax_content(to_String(content), script, js_file, css_file). | 5981 | html_ajax_content(to_String(content), script, js_file, css_file). |
| 5899 | 5982 | ||
| 5900 | 5983 | ||
| 5901 | -public define HTML_ajax_content | ||
| 5902 | - to_html_ajax_content | ||
| 5903 | - ( | ||
| 5904 | - HTML_Partial_Content content_HTML, | ||
| 5905 | - CommonInfo cinfo | ||
| 5906 | - )= to_html_ajax_content(partial(content_HTML), cinfo). | ||
| 5907 | - | ||
| 5908 | public define JsonValue | 5984 | public define JsonValue |
| 5909 | to_html_ajax_content | 5985 | to_html_ajax_content |
| 5910 | ( | 5986 | ( |
| @@ -5924,6 +6000,13 @@ public define JsonValue | @@ -5924,6 +6000,13 @@ public define JsonValue | ||
| 5924 | public define JsonValue | 6000 | public define JsonValue |
| 5925 | to_html_ajax_content | 6001 | to_html_ajax_content |
| 5926 | ( | 6002 | ( |
| 6003 | + HTML_Partial_Content content_HTML, | ||
| 6004 | + CommonInfo cinfo | ||
| 6005 | + )= to_html_ajax_content(content_HTML, cinfo, ""). | ||
| 6006 | + | ||
| 6007 | +public define JsonValue | ||
| 6008 | + to_html_ajax_content | ||
| 6009 | + ( | ||
| 5927 | Printable_tree content_HTML, | 6010 | Printable_tree content_HTML, |
| 5928 | String additional_script | 6011 | String additional_script |
| 5929 | )= | 6012 | )= |
web/CXM_web_arg_utils.anubis
| @@ -157,8 +157,13 @@ public define Maybe(Bool) | @@ -157,8 +157,13 @@ public define Maybe(Bool) | ||
| 157 | ) = | 157 | ) = |
| 158 | if web_arg_value(lwa, arg_name) is | 158 | if web_arg_value(lwa, arg_name) is |
| 159 | { | 159 | { |
| 160 | - not_found then failure, | ||
| 161 | - found(value) then success(to_Bool(value)) | 160 | + not_found then |
| 161 | + if web_arg_value(lwa, "~"+arg_name) is | ||
| 162 | + { | ||
| 163 | + not_found then failure, | ||
| 164 | + found(_) then success(false) | ||
| 165 | + }, | ||
| 166 | + found(_) then success(true) | ||
| 162 | }. | 167 | }. |
| 163 | 168 | ||
| 164 | public define Bool | 169 | public define Bool |
web/widgets/specialized_elements.anubis
| @@ -12,20 +12,29 @@ public define HTML_Off_Form | @@ -12,20 +12,29 @@ public define HTML_Off_Form | ||
| 12 | phone | 12 | phone |
| 13 | ( | 13 | ( |
| 14 | List(CoreAttrs) attrs, | 14 | List(CoreAttrs) attrs, |
| 15 | - String phone_number | 15 | + String phone_number, |
| 16 | + Bool image_only | ||
| 16 | )= | 17 | )= |
| 17 | if phone_number = "" then empty | 18 | if phone_number = "" then empty |
| 18 | else | 19 | else |
| 19 | 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], |
| 20 | div([ | 21 | div([ |
| 21 | image(_attrs, "/icons/16x16/phone.png"), | 22 | image(_attrs, "/icons/16x16/phone.png"), |
| 22 | - text(_attrs, phone_number) | 23 | + if image_only then empty else |
| 24 | + text(_attrs, phone_number) | ||
| 23 | ]) | 25 | ]) |
| 24 | . | 26 | . |
| 25 | 27 | ||
| 26 | public define HTML_Off_Form | 28 | public define HTML_Off_Form |
| 27 | phone | 29 | phone |
| 28 | ( | 30 | ( |
| 31 | + List(CoreAttrs) attrs, | ||
| 32 | + String phone_number | ||
| 33 | + )= phone(attrs, phone_number, false). | ||
| 34 | + | ||
| 35 | +public define HTML_Off_Form | ||
| 36 | + phone | ||
| 37 | + ( | ||
| 29 | String phone_number | 38 | String phone_number |
| 30 | )= | 39 | )= |
| 31 | phone([], phone_number) | 40 | phone([], phone_number) |