Commit f0b6401da5f26bef1565d7c54ac7e4ca093c9c4a
1 parent
dc3a74bc
fix get(XXX) type which come with Var(List... and not List only
Add AWS_SESSION_STEP counter in web session.
Showing
2 changed files
with
74 additions
and
59 deletions
Show diff stats
web/CXM_making_a_web_site.anubis
| @@ -333,6 +333,9 @@ public type WEB_Controller_Result: | @@ -333,6 +333,9 @@ public type WEB_Controller_Result: | ||
| 333 | String action_name | 333 | String action_name |
| 334 | ), | 334 | ), |
| 335 | redirect_to_previous, | 335 | redirect_to_previous, |
| 336 | + redirect_to_previous( | ||
| 337 | + Var(List(WEB_Session_Field)) fields | ||
| 338 | + ), | ||
| 336 | ajax( | 339 | ajax( |
| 337 | HTTP_Answer http_answer | 340 | HTTP_Answer http_answer |
| 338 | ) | 341 | ) |
| @@ -2980,6 +2983,8 @@ define WEB_Controller_Result | @@ -2980,6 +2983,8 @@ define WEB_Controller_Result | ||
| 2980 | url(url) then url, | 2983 | url(url) then url, |
| 2981 | }, | 2984 | }, |
| 2982 | if requested_action_name = action_name then | 2985 | if requested_action_name = action_name then |
| 2986 | + with step = get_Int(_session.fields, "AWS_SESSION_STEP", 0) + 1, | ||
| 2987 | + replace_Int(_session.fields, "AWS_SESSION_STEP", step); | ||
| 2983 | if h.allowed_proto is | 2988 | if h.allowed_proto is |
| 2984 | { | 2989 | { |
| 2985 | //Action only in HTTP | 2990 | //Action only in HTTP |
| @@ -3082,7 +3087,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3082,7 +3087,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3082 | if get_controller(r_controller_name, controllers) is | 3087 | if get_controller(r_controller_name, controllers) is |
| 3083 | { | 3088 | { |
| 3084 | failure then (failure, error_page(http_not_found, "Redirect Controller "+r_controller_name+" not found", new_session)), | 3089 | failure then (failure, error_page(http_not_found, "Redirect Controller "+r_controller_name+" not found", new_session)), |
| 3085 | - success(new_controller) then | 3090 | + success(new_controller) then |
| 3086 | apply_controller_action(new_controller, controllers, new_session, success(r_action_name), initial_session), | 3091 | apply_controller_action(new_controller, controllers, new_session, success(r_action_name), initial_session), |
| 3087 | }, | 3092 | }, |
| 3088 | 3093 | ||
| @@ -3094,6 +3099,14 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3094,6 +3099,14 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3094 | since _session is web_session(lang, entries, _, previous), | 3099 | since _session is web_session(lang, entries, _, previous), |
| 3095 | apply_controller_action(new_controller, controllers, web_session(lang, entries, previous, previous), failure, initial_session), | 3100 | apply_controller_action(new_controller, controllers, web_session(lang, entries, previous, previous), failure, initial_session), |
| 3096 | }, | 3101 | }, |
| 3102 | + redirect_to_previous(entries) then | ||
| 3103 | + if get_controller(get_String(_session.previous_web_request.lwa, "aws_controller", "root"), controllers) is | ||
| 3104 | + { | ||
| 3105 | + failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), | ||
| 3106 | + success(new_controller) then | ||
| 3107 | + since _session is web_session(lang, _, _, previous), | ||
| 3108 | + apply_controller_action(new_controller, controllers, web_session(lang, entries, previous, previous), failure, initial_session), | ||
| 3109 | + }, | ||
| 3097 | ajax(answer) then (failure, answer), | 3110 | ajax(answer) then (failure, answer), |
| 3098 | } | 3111 | } |
| 3099 | } | 3112 | } |
web/CXM_web_session.anubis
| @@ -190,7 +190,9 @@ define One | @@ -190,7 +190,9 @@ define One | ||
| 190 | { | 190 | { |
| 191 | [] then fields_org <- [session_field(_field_name, _field_type, var(_field_value)) . *fields_org], | 191 | [] then fields_org <- [session_field(_field_name, _field_type, var(_field_value)) . *fields_org], |
| 192 | [h . t] then | 192 | [h . t] then |
| 193 | + println("h.field_name = "+h.field_name+" _field_name = "+_field_name); | ||
| 193 | if h.field_name = _field_name & h.field_type = _field_type then | 194 | if h.field_name = _field_name & h.field_type = _field_type then |
| 195 | + println("replace field_name found"); | ||
| 194 | h.field_datum <- _field_value | 196 | h.field_datum <- _field_value |
| 195 | else | 197 | else |
| 196 | replace_any(t, _field_type, _field_name, _field_value, fields_org) | 198 | replace_any(t, _field_type, _field_name, _field_value, fields_org) |
| @@ -282,10 +284,10 @@ public define One | @@ -282,10 +284,10 @@ public define One | ||
| 282 | public define Maybe(Bool) | 284 | public define Maybe(Bool) |
| 283 | get_Bool | 285 | get_Bool |
| 284 | ( | 286 | ( |
| 285 | - List(WEB_Session_Field) fields, | ||
| 286 | - String _field_name | 287 | + Var(List(WEB_Session_Field)) fields, |
| 288 | + String _field_name | ||
| 287 | ) = | 289 | ) = |
| 288 | - if get_field(fields, bool_t, _field_name) is | 290 | + if get_field(*fields, bool_t, _field_name) is |
| 289 | { | 291 | { |
| 290 | failure then failure, | 292 | failure then failure, |
| 291 | success(datum) then | 293 | success(datum) then |
| @@ -299,9 +301,9 @@ public define Maybe(Bool) | @@ -299,9 +301,9 @@ public define Maybe(Bool) | ||
| 299 | public define Bool | 301 | public define Bool |
| 300 | get_Bool | 302 | get_Bool |
| 301 | ( | 303 | ( |
| 302 | - List(WEB_Session_Field) fields, | ||
| 303 | - String _field_name, | ||
| 304 | - Bool default_value | 304 | + Var(List(WEB_Session_Field)) fields, |
| 305 | + String _field_name, | ||
| 306 | + Bool default_value | ||
| 305 | ) = | 307 | ) = |
| 306 | if get_Bool(fields, _field_name) is | 308 | if get_Bool(fields, _field_name) is |
| 307 | { | 309 | { |
| @@ -347,10 +349,10 @@ public define One | @@ -347,10 +349,10 @@ public define One | ||
| 347 | public define Maybe(Int) | 349 | public define Maybe(Int) |
| 348 | get_Int | 350 | get_Int |
| 349 | ( | 351 | ( |
| 350 | - List(WEB_Session_Field) fields, | ||
| 351 | - String _field_name | 352 | + Var(List(WEB_Session_Field)) fields, |
| 353 | + String _field_name, | ||
| 352 | ) = | 354 | ) = |
| 353 | - if get_field(fields, int_t, _field_name) is | 355 | + if get_field(*fields, int_t, _field_name) is |
| 354 | { | 356 | { |
| 355 | failure then failure, | 357 | failure then failure, |
| 356 | success(datum) then | 358 | success(datum) then |
| @@ -364,9 +366,9 @@ public define Maybe(Int) | @@ -364,9 +366,9 @@ public define Maybe(Int) | ||
| 364 | public define Int | 366 | public define Int |
| 365 | get_Int | 367 | get_Int |
| 366 | ( | 368 | ( |
| 367 | - List(WEB_Session_Field) fields, | ||
| 368 | - String _field_name, | ||
| 369 | - Int default_value | 369 | + Var(List(WEB_Session_Field)) fields, |
| 370 | + String _field_name, | ||
| 371 | + Int default_value | ||
| 370 | ) = | 372 | ) = |
| 371 | if get_Int(fields, _field_name) is | 373 | if get_Int(fields, _field_name) is |
| 372 | { | 374 | { |
| @@ -476,10 +478,10 @@ public define One | @@ -476,10 +478,10 @@ public define One | ||
| 476 | public define Maybe(ByteArray) | 478 | public define Maybe(ByteArray) |
| 477 | get_ByteArray | 479 | get_ByteArray |
| 478 | ( | 480 | ( |
| 479 | - List(WEB_Session_Field) fields, | ||
| 480 | - String _field_name | 481 | + Var(List(WEB_Session_Field)) fields, |
| 482 | + String _field_name, | ||
| 481 | ) = | 483 | ) = |
| 482 | - if get_field(fields, byte_array_t, _field_name) is | 484 | + if get_field(*fields, byte_array_t, _field_name) is |
| 483 | { | 485 | { |
| 484 | failure then failure, | 486 | failure then failure, |
| 485 | success(datum) then | 487 | success(datum) then |
| @@ -493,9 +495,9 @@ public define Maybe(ByteArray) | @@ -493,9 +495,9 @@ public define Maybe(ByteArray) | ||
| 493 | public define ByteArray | 495 | public define ByteArray |
| 494 | get_ByteArray | 496 | get_ByteArray |
| 495 | ( | 497 | ( |
| 496 | - List(WEB_Session_Field) fields, | ||
| 497 | - String _field_name, | ||
| 498 | - ByteArray default_value | 498 | + Var(List(WEB_Session_Field)) fields, |
| 499 | + String _field_name, | ||
| 500 | + ByteArray default_value | ||
| 499 | ) = | 501 | ) = |
| 500 | if get_ByteArray(fields, _field_name) is | 502 | if get_ByteArray(fields, _field_name) is |
| 501 | { | 503 | { |
| @@ -540,10 +542,10 @@ public define One | @@ -540,10 +542,10 @@ public define One | ||
| 540 | public define Maybe(Float) | 542 | public define Maybe(Float) |
| 541 | get_Float | 543 | get_Float |
| 542 | ( | 544 | ( |
| 543 | - List(WEB_Session_Field) fields, | ||
| 544 | - String _field_name | 545 | + Var(List(WEB_Session_Field)) fields, |
| 546 | + String _field_name, | ||
| 545 | ) = | 547 | ) = |
| 546 | - if get_field(fields, float_t, _field_name) is | 548 | + if get_field(*fields, float_t, _field_name) is |
| 547 | { | 549 | { |
| 548 | failure then failure, | 550 | failure then failure, |
| 549 | success(datum) then | 551 | success(datum) then |
| @@ -557,9 +559,9 @@ public define Maybe(Float) | @@ -557,9 +559,9 @@ public define Maybe(Float) | ||
| 557 | public define Float | 559 | public define Float |
| 558 | get_Float | 560 | get_Float |
| 559 | ( | 561 | ( |
| 560 | - List(WEB_Session_Field) fields, | ||
| 561 | - String _field_name, | ||
| 562 | - Float default_value | 562 | + Var(List(WEB_Session_Field)) fields, |
| 563 | + String _field_name, | ||
| 564 | + Float default_value | ||
| 563 | ) = | 565 | ) = |
| 564 | if get_Float(fields, _field_name) is | 566 | if get_Float(fields, _field_name) is |
| 565 | { | 567 | { |
| @@ -604,10 +606,10 @@ public define One | @@ -604,10 +606,10 @@ public define One | ||
| 604 | public define Maybe(Word128) | 606 | public define Maybe(Word128) |
| 605 | get_Word128 | 607 | get_Word128 |
| 606 | ( | 608 | ( |
| 607 | - List(WEB_Session_Field) fields, | ||
| 608 | - String _field_name | 609 | + Var(List(WEB_Session_Field)) fields, |
| 610 | + String _field_name, | ||
| 609 | ) = | 611 | ) = |
| 610 | - if get_field(fields, word128_t, _field_name) is | 612 | + if get_field(*fields, word128_t, _field_name) is |
| 611 | { | 613 | { |
| 612 | failure then failure, | 614 | failure then failure, |
| 613 | success(datum) then | 615 | success(datum) then |
| @@ -621,9 +623,9 @@ public define Maybe(Word128) | @@ -621,9 +623,9 @@ public define Maybe(Word128) | ||
| 621 | public define Word128 | 623 | public define Word128 |
| 622 | get_Word128 | 624 | get_Word128 |
| 623 | ( | 625 | ( |
| 624 | - List(WEB_Session_Field) fields, | ||
| 625 | - String _field_name, | ||
| 626 | - Word128 default_value | 626 | + Var(List(WEB_Session_Field)) fields, |
| 627 | + String _field_name, | ||
| 628 | + Word128 default_value | ||
| 627 | ) = | 629 | ) = |
| 628 | if get_Word128(fields, _field_name) is | 630 | if get_Word128(fields, _field_name) is |
| 629 | { | 631 | { |
| @@ -668,10 +670,10 @@ public define One | @@ -668,10 +670,10 @@ public define One | ||
| 668 | public define Maybe(Word64) | 670 | public define Maybe(Word64) |
| 669 | get_Word64 | 671 | get_Word64 |
| 670 | ( | 672 | ( |
| 671 | - List(WEB_Session_Field) fields, | ||
| 672 | - String _field_name | 673 | + Var(List(WEB_Session_Field)) fields, |
| 674 | + String _field_name, | ||
| 673 | ) = | 675 | ) = |
| 674 | - if get_field(fields, word64_t, _field_name) is | 676 | + if get_field(*fields, word64_t, _field_name) is |
| 675 | { | 677 | { |
| 676 | failure then failure, | 678 | failure then failure, |
| 677 | success(datum) then | 679 | success(datum) then |
| @@ -685,9 +687,9 @@ public define Maybe(Word64) | @@ -685,9 +687,9 @@ public define Maybe(Word64) | ||
| 685 | public define Word64 | 687 | public define Word64 |
| 686 | get_Word64 | 688 | get_Word64 |
| 687 | ( | 689 | ( |
| 688 | - List(WEB_Session_Field) fields, | ||
| 689 | - String _field_name, | ||
| 690 | - Word64 default_value | 690 | + Var(List(WEB_Session_Field)) fields, |
| 691 | + String _field_name, | ||
| 692 | + Word64 default_value | ||
| 691 | ) = | 693 | ) = |
| 692 | if get_Word64(fields, _field_name) is | 694 | if get_Word64(fields, _field_name) is |
| 693 | { | 695 | { |
| @@ -732,10 +734,10 @@ public define One | @@ -732,10 +734,10 @@ public define One | ||
| 732 | public define Maybe(Word32) | 734 | public define Maybe(Word32) |
| 733 | get_Word32 | 735 | get_Word32 |
| 734 | ( | 736 | ( |
| 735 | - List(WEB_Session_Field) fields, | ||
| 736 | - String _field_name | 737 | + Var(List(WEB_Session_Field)) fields, |
| 738 | + String _field_name, | ||
| 737 | ) = | 739 | ) = |
| 738 | - if get_field(fields, word32_t, _field_name) is | 740 | + if get_field(*fields, word32_t, _field_name) is |
| 739 | { | 741 | { |
| 740 | failure then failure, | 742 | failure then failure, |
| 741 | success(datum) then | 743 | success(datum) then |
| @@ -749,9 +751,9 @@ public define Maybe(Word32) | @@ -749,9 +751,9 @@ public define Maybe(Word32) | ||
| 749 | public define Word32 | 751 | public define Word32 |
| 750 | get_Word32 | 752 | get_Word32 |
| 751 | ( | 753 | ( |
| 752 | - List(WEB_Session_Field) fields, | ||
| 753 | - String _field_name, | ||
| 754 | - Word32 default_value | 754 | + Var(List(WEB_Session_Field)) fields, |
| 755 | + String _field_name, | ||
| 756 | + Word32 default_value | ||
| 755 | ) = | 757 | ) = |
| 756 | if get_Word32(fields, _field_name) is | 758 | if get_Word32(fields, _field_name) is |
| 757 | { | 759 | { |
| @@ -796,10 +798,10 @@ public define One | @@ -796,10 +798,10 @@ public define One | ||
| 796 | public define Maybe(Word16) | 798 | public define Maybe(Word16) |
| 797 | get_Word16 | 799 | get_Word16 |
| 798 | ( | 800 | ( |
| 799 | - List(WEB_Session_Field) fields, | ||
| 800 | - String _field_name | 801 | + Var(List(WEB_Session_Field)) fields, |
| 802 | + String _field_name, | ||
| 801 | ) = | 803 | ) = |
| 802 | - if get_field(fields, word16_t, _field_name) is | 804 | + if get_field(*fields, word16_t, _field_name) is |
| 803 | { | 805 | { |
| 804 | failure then failure, | 806 | failure then failure, |
| 805 | success(datum) then | 807 | success(datum) then |
| @@ -813,8 +815,8 @@ public define Maybe(Word16) | @@ -813,8 +815,8 @@ public define Maybe(Word16) | ||
| 813 | public define Word16 | 815 | public define Word16 |
| 814 | get_Word16 | 816 | get_Word16 |
| 815 | ( | 817 | ( |
| 816 | - List(WEB_Session_Field) fields, | ||
| 817 | - String _field_name, | 818 | + Var(List(WEB_Session_Field)) fields, |
| 819 | + String _field_name, | ||
| 818 | Word16 default_value | 820 | Word16 default_value |
| 819 | ) = | 821 | ) = |
| 820 | if get_Word16(fields, _field_name) is | 822 | if get_Word16(fields, _field_name) is |
| @@ -860,10 +862,10 @@ public define One | @@ -860,10 +862,10 @@ public define One | ||
| 860 | public define Maybe(Word8) | 862 | public define Maybe(Word8) |
| 861 | get_Word8 | 863 | get_Word8 |
| 862 | ( | 864 | ( |
| 863 | - List(WEB_Session_Field) fields, | ||
| 864 | - String _field_name | 865 | + Var(List(WEB_Session_Field)) fields, |
| 866 | + String _field_name, | ||
| 865 | ) = | 867 | ) = |
| 866 | - if get_field(fields, word8_t, _field_name) is | 868 | + if get_field(*fields, word8_t, _field_name) is |
| 867 | { | 869 | { |
| 868 | failure then failure, | 870 | failure then failure, |
| 869 | success(datum) then | 871 | success(datum) then |
| @@ -877,9 +879,9 @@ public define Maybe(Word8) | @@ -877,9 +879,9 @@ public define Maybe(Word8) | ||
| 877 | public define Word8 | 879 | public define Word8 |
| 878 | get_Word8 | 880 | get_Word8 |
| 879 | ( | 881 | ( |
| 880 | - List(WEB_Session_Field) fields, | ||
| 881 | - String _field_name, | ||
| 882 | - Word8 default_value | 882 | + Var(List(WEB_Session_Field)) fields, |
| 883 | + String _field_name, | ||
| 884 | + Word8 default_value | ||
| 883 | ) = | 885 | ) = |
| 884 | if get_Word8(fields, _field_name) is | 886 | if get_Word8(fields, _field_name) is |
| 885 | { | 887 | { |
| @@ -924,10 +926,10 @@ public define One | @@ -924,10 +926,10 @@ public define One | ||
| 924 | public define Maybe(Word4) | 926 | public define Maybe(Word4) |
| 925 | get_Word4 | 927 | get_Word4 |
| 926 | ( | 928 | ( |
| 927 | - List(WEB_Session_Field) fields, | ||
| 928 | - String _field_name | 929 | + Var(List(WEB_Session_Field)) fields, |
| 930 | + String _field_name, | ||
| 929 | ) = | 931 | ) = |
| 930 | - if get_field(fields, word4_t, _field_name) is | 932 | + if get_field(*fields, word4_t, _field_name) is |
| 931 | { | 933 | { |
| 932 | failure then failure, | 934 | failure then failure, |
| 933 | success(datum) then | 935 | success(datum) then |
| @@ -941,8 +943,8 @@ public define Maybe(Word4) | @@ -941,8 +943,8 @@ public define Maybe(Word4) | ||
| 941 | public define Word4 | 943 | public define Word4 |
| 942 | get_Word4 | 944 | get_Word4 |
| 943 | ( | 945 | ( |
| 944 | - List(WEB_Session_Field) fields, | ||
| 945 | - String _field_name, | 946 | + Var(List(WEB_Session_Field)) fields, |
| 947 | + String _field_name, | ||
| 946 | Word4 default_value | 948 | Word4 default_value |
| 947 | ) = | 949 | ) = |
| 948 | if get_Word4(fields, _field_name) is | 950 | if get_Word4(fields, _field_name) is |