Commit 9f93ff8f8963f90936e72b95774b856704ba60b7
1 parent
4dc487a7
add support of no action from WEB_Action_Name
Showing
2 changed files
with
60 additions
and
50 deletions
Show diff stats
web/CXM_making_a_web_site.anubis
| @@ -65,6 +65,8 @@ transmit CXM_web_arg_utils.anubis | @@ -65,6 +65,8 @@ transmit CXM_web_arg_utils.anubis | ||
| 65 | transmit CXM_web_session.anubis | 65 | transmit CXM_web_session.anubis |
| 66 | transmit CXM_web_action.anubis | 66 | transmit CXM_web_action.anubis |
| 67 | 67 | ||
| 68 | +transmit calexium_lib/web/types/web_action_name.anubis | ||
| 69 | + | ||
| 68 | //read CXM_html_tooltip.anubis | 70 | //read CXM_html_tooltip.anubis |
| 69 | 71 | ||
| 70 | * (1) Structure of a web site. | 72 | * (1) Structure of a web site. |
| @@ -3025,48 +3027,52 @@ define WEB_Controller_Result | @@ -3025,48 +3027,52 @@ define WEB_Controller_Result | ||
| 3025 | { | 3027 | { |
| 3026 | [] then http_answer(error_page(http_not_found, "No action found", _session)), | 3028 | [] then http_answer(error_page(http_not_found, "No action found", _session)), |
| 3027 | [h . t] then | 3029 | [h . t] then |
| 3028 | - with action_name = if h.name is | 3030 | + if h.name = no_action then |
| 3031 | + http_answer( _session, html_content(http_no_content, empty)) | ||
| 3032 | + else | ||
| 3033 | + with action_name = if h.name is | ||
| 3029 | { | 3034 | { |
| 3035 | + no_action then "", | ||
| 3030 | controller_action(_, name) then name, | 3036 | controller_action(_, name) then name, |
| 3031 | action_name(name) then name, | 3037 | action_name(name) then name, |
| 3032 | url(url) then url, | 3038 | url(url) then url, |
| 3033 | }, | 3039 | }, |
| 3034 | - if requested_action_name = action_name then | ||
| 3035 | - with step = get_Int(_session.fields, "AWS_SESSION_STEP", 0) + 1, | ||
| 3036 | - replace_Int(_session.fields, "AWS_SESSION_STEP", step); | ||
| 3037 | - if h.allowed_proto is | ||
| 3038 | - { | ||
| 3039 | - //Action only in HTTP | ||
| 3040 | - http then | ||
| 3041 | - if _session.web_request.is_https then | ||
| 3042 | - http_answer(error_page(http_forbidden, "Only HTTP authorized", _session)) | ||
| 3043 | - else | ||
| 3044 | - //ask to the server the authorization to execute that action | ||
| 3045 | - if h.allow(_session) then | ||
| 3046 | - h.do_it(_session) | ||
| 3047 | - else | ||
| 3048 | - http_answer(error_page(http_unauthorized, "you are not authorized for this action", _session)) | ||
| 3049 | - | ||
| 3050 | - //Action only in HTTPS | ||
| 3051 | - https then | ||
| 3052 | - if _session.web_request.is_https then | ||
| 3053 | - //ask to the server the authorization to execute that action | ||
| 3054 | - if h.allow(_session) then | ||
| 3055 | - h.do_it(_session) | ||
| 3056 | - else | ||
| 3057 | - http_answer(error_page(http_unauthorized, "you are not authorized for this action", _session)) | ||
| 3058 | - else | ||
| 3059 | - http_answer(error_page(http_forbidden, "Only HTTPS authorized", _session)) | ||
| 3060 | - //Action in both HTTP / HTTPS | ||
| 3061 | - http_https then | ||
| 3062 | - //ask to the server the authorization to execute that action | ||
| 3063 | - if h.allow(_session) then | ||
| 3064 | - //println("do_it "+action_name); | ||
| 3065 | - h.do_it(_session) | ||
| 3066 | - else | ||
| 3067 | - http_answer(error_page(http_unauthorized, "you are not authorized for this action", _session)) | ||
| 3068 | - | ||
| 3069 | - } | 3040 | + if requested_action_name = action_name then |
| 3041 | + with step = get_Int(_session.fields, "AWS_SESSION_STEP", 0) + 1, | ||
| 3042 | + replace_Int(_session.fields, "AWS_SESSION_STEP", step); | ||
| 3043 | + if h.allowed_proto is | ||
| 3044 | + { | ||
| 3045 | + //Action only in HTTP | ||
| 3046 | + http then | ||
| 3047 | + if _session.web_request.is_https then | ||
| 3048 | + http_answer(error_page(http_forbidden, "Only HTTP authorized", _session)) | ||
| 3049 | + else | ||
| 3050 | + //ask to the server the authorization to execute that action | ||
| 3051 | + if h.allow(_session) then | ||
| 3052 | + h.do_it(_session) | ||
| 3053 | + else | ||
| 3054 | + http_answer(error_page(http_unauthorized, "you are not authorized for this action", _session)) | ||
| 3055 | + | ||
| 3056 | + //Action only in HTTPS | ||
| 3057 | + https then | ||
| 3058 | + if _session.web_request.is_https then | ||
| 3059 | + //ask to the server the authorization to execute that action | ||
| 3060 | + if h.allow(_session) then | ||
| 3061 | + h.do_it(_session) | ||
| 3062 | + else | ||
| 3063 | + http_answer(error_page(http_unauthorized, "you are not authorized for this action", _session)) | ||
| 3064 | + else | ||
| 3065 | + http_answer(error_page(http_forbidden, "Only HTTPS authorized", _session)) | ||
| 3066 | + //Action in both HTTP / HTTPS | ||
| 3067 | + http_https then | ||
| 3068 | + //ask to the server the authorization to execute that action | ||
| 3069 | + if h.allow(_session) then | ||
| 3070 | + //println("do_it "+action_name); | ||
| 3071 | + h.do_it(_session) | ||
| 3072 | + else | ||
| 3073 | + http_answer(error_page(http_unauthorized, "you are not authorized for this action", _session)) | ||
| 3074 | + | ||
| 3075 | + } | ||
| 3070 | else | 3076 | else |
| 3071 | apply_action(_session, requested_action_name, t) | 3077 | apply_action(_session, requested_action_name, t) |
| 3072 | } | 3078 | } |
| @@ -3695,6 +3701,7 @@ public define String | @@ -3695,6 +3701,7 @@ public define String | ||
| 3695 | )= | 3701 | )= |
| 3696 | if action is | 3702 | if action is |
| 3697 | { | 3703 | { |
| 3704 | + no_action then "", | ||
| 3698 | controller_action(controller, action_name) then "?aws_controller="+controller+"&aws_action="+action_name, | 3705 | controller_action(controller, action_name) then "?aws_controller="+controller+"&aws_action="+action_name, |
| 3699 | action_name(action_name) then "?aws_action="+action_name, | 3706 | action_name(action_name) then "?aws_action="+action_name, |
| 3700 | url(url) then url | 3707 | url(url) then url |
| @@ -4234,6 +4241,7 @@ define Printable_tree | @@ -4234,6 +4241,7 @@ define Printable_tree | ||
| 4234 | img_link(options, img, alt_text) then | 4241 | img_link(options, img, alt_text) then |
| 4235 | //if action name is empty, format options on image because maybe there onclick action | 4242 | //if action name is empty, format options on image because maybe there onclick action |
| 4236 | with action_name = if action is { | 4243 | with action_name = if action is { |
| 4244 | + no_action then "" | ||
| 4237 | controller_action(_, an) then an, | 4245 | controller_action(_, an) then an, |
| 4238 | action_name(an) then an, | 4246 | action_name(an) then an, |
| 4239 | url(_) then "" | 4247 | url(_) then "" |
| @@ -4259,6 +4267,7 @@ define Printable_tree | @@ -4259,6 +4267,7 @@ define Printable_tree | ||
| 4259 | with action_name = | 4267 | with action_name = |
| 4260 | if action is | 4268 | if action is |
| 4261 | { | 4269 | { |
| 4270 | + no_action then "", | ||
| 4262 | controller_action(_, an) then an, | 4271 | controller_action(_, an) then an, |
| 4263 | action_name(an) then an, | 4272 | action_name(an) then an, |
| 4264 | url(_) then "" | 4273 | url(_) then "" |
| @@ -4304,6 +4313,7 @@ define Printable_tree | @@ -4304,6 +4313,7 @@ define Printable_tree | ||
| 4304 | ], | 4313 | ], |
| 4305 | javascript(s,h) then | 4314 | javascript(s,h) then |
| 4306 | with action_name = if action is { | 4315 | with action_name = if action is { |
| 4316 | + no_action then "", | ||
| 4307 | controller_action(_, an) then an, | 4317 | controller_action(_, an) then an, |
| 4308 | action_name(an) then an, | 4318 | action_name(an) then an, |
| 4309 | url(_) then "" | 4319 | url(_) then "" |
web/CXM_web_action.anubis
| @@ -7,16 +7,16 @@ | @@ -7,16 +7,16 @@ | ||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | 9 | ||
| 10 | -public type WEB_Action_Name: | ||
| 11 | - controller_action( | ||
| 12 | - String controller, | ||
| 13 | - String action_name | ||
| 14 | - ), | ||
| 15 | - action_name( | ||
| 16 | - String action_name | ||
| 17 | - ), | ||
| 18 | - //url is raw action, hence we will only copy that url in final link | ||
| 19 | - url( | ||
| 20 | - String url_name | ||
| 21 | - ) | ||
| 22 | -. | 10 | +//public type WEB_Action_Name: |
| 11 | +// controller_action( | ||
| 12 | +// String controller, | ||
| 13 | +// String action_name | ||
| 14 | +// ), | ||
| 15 | +// action_name( | ||
| 16 | +// String action_name | ||
| 17 | +// ), | ||
| 18 | +// //url is raw action, hence we will only copy that url in final link | ||
| 19 | +// url( | ||
| 20 | +// String url_name | ||
| 21 | +// ) | ||
| 22 | +//. |