Commit 56ebceb21a7e10c580c45f3265132fc64d1387d6
1 parent
f715c0d9
enhance the Action_Name management
Add WEB_Session
Showing
7 changed files
with
1235 additions
and
99 deletions
Show diff stats
web/CXM_jquery.anubis
| @@ -12,14 +12,15 @@ read tools/basis.anubis | @@ -12,14 +12,15 @@ read tools/basis.anubis | ||
| 12 | 12 | ||
| 13 | /* jQuery Actioner type */ | 13 | /* jQuery Actioner type */ |
| 14 | public type JQuery_Actioner_type: | 14 | public type JQuery_Actioner_type: |
| 15 | - jqform, | ||
| 16 | - jqlink, | ||
| 17 | - jqflink, | ||
| 18 | - jqscript. | 15 | + jqform ( String form), |
| 16 | + jqlink ( WEB_Action_Name name), | ||
| 17 | + jqflink ( String link), | ||
| 18 | + jqscript( String script) | ||
| 19 | +. | ||
| 19 | 20 | ||
| 20 | /* jQuery Actioner */ | 21 | /* jQuery Actioner */ |
| 21 | public type JQuery_Actioner: | 22 | public type JQuery_Actioner: |
| 22 | - jQuery_actioner(Actioner_Target target, JQuery_Actioner_type type, String url_or_form_id_or_script). | 23 | + jQuery_actioner(Actioner_Target target, JQuery_Actioner_type type). //, String url_or_form_id_or_script |
| 23 | 24 | ||
| 24 | /* jQuery Selector - http://api.jquery.com/category/selectors/ */ | 25 | /* jQuery Selector - http://api.jquery.com/category/selectors/ */ |
| 25 | public type JQuerySelector: | 26 | public type JQuerySelector: |
| @@ -64,32 +65,54 @@ public define String | @@ -64,32 +65,54 @@ public define String | ||
| 64 | JQuery_Actioner actioner | 65 | JQuery_Actioner actioner |
| 65 | ) | 66 | ) |
| 66 | = | 67 | = |
| 67 | - if actioner is jQuery_actioner(target, act_type, str) then | 68 | + if actioner is jQuery_actioner(target, act_type) then |
| 68 | if target is | 69 | if target is |
| 69 | { | 70 | { |
| 70 | same then | 71 | same then |
| 71 | if act_type is | 72 | if act_type is |
| 72 | { | 73 | { |
| 73 | - jqform then "$('#"+str+"').submit();", | ||
| 74 | - jqlink then "document.location='/?a="+str+"';", | ||
| 75 | - jqflink then "document.location='"+str+"';", | ||
| 76 | - jqscript then str | 74 | + jqform(form) then "$('#"+form+"').submit();", |
| 75 | + jqlink(control_action) then | ||
| 76 | + if control_action is | ||
| 77 | + { | ||
| 78 | + controller_action(ctrl, action) then "document.location='/?aws_controller="+ctrl+"&aws_action="+action+"';", | ||
| 79 | + action_name(action) then "document.location='/?aws_action="+action+"';", | ||
| 80 | + url(url) then "document.location='"+url+"';", | ||
| 81 | + } | ||
| 82 | + jqflink(link) then "document.location='"+link+"';", | ||
| 83 | + jqscript(script) then script | ||
| 77 | }, | 84 | }, |
| 78 | same(label) then | 85 | same(label) then |
| 79 | if act_type is | 86 | if act_type is |
| 80 | { | 87 | { |
| 81 | - jqform then "$('#"+str+"').submit();", | ||
| 82 | - jqlink then "document.location='/?a="+str+"';", | ||
| 83 | - jqflink then "document.location='"+str+"';", | ||
| 84 | - jqscript then str | 88 | + jqform(form) then "$('#"+form+"').submit();", |
| 89 | + jqlink(control_action) then | ||
| 90 | + if control_action is | ||
| 91 | + { | ||
| 92 | + controller_action(ctrl, action) then "document.location='/?aws_controller="+ctrl+"&aws_action="+action+"';", | ||
| 93 | + action_name(action) then "document.location='/?aws_action="+action+"';", | ||
| 94 | + url(url) then "document.location='"+url+"';", | ||
| 95 | + } | ||
| 96 | + jqflink(link) then "document.location='"+link+"';", | ||
| 97 | + jqscript(script) then script | ||
| 85 | }, | 98 | }, |
| 86 | other(window_name, window_options) then | 99 | other(window_name, window_options) then |
| 87 | if act_type is | 100 | if act_type is |
| 88 | { | 101 | { |
| 89 | - jqform then "$('#"+str+"').submit();", //il s'agit d'une soumision d'un formulaire => cela se fait uniquement dans la même fenêtre ! | ||
| 90 | - jqlink then "window.open('"+str+"', '"+window_name+"', '"+jquery_button_get_onclick_action_window_options(window_options, "")+"');", | ||
| 91 | - jqflink then "document.location='"+str+"';", | ||
| 92 | - jqscript then str | 102 | + jqform(form) then "$('#"+form+"').submit();",//il s'agit d'une soumision d'un formulaire => cela se fait uniquement dans la même fenêtre ! |
| 103 | + jqlink(control_action) then | ||
| 104 | + if control_action is | ||
| 105 | + { | ||
| 106 | + controller_action(ctrl, action) then | ||
| 107 | + "window.open('aws_controller="+ctrl+"&aws_action="+action+"', '"+window_name+"', '"+jquery_button_get_onclick_action_window_options(window_options, "")+"');", | ||
| 108 | + //"document.location='/?aws_controller="+ctrl+"&aws_action="+action+"';", | ||
| 109 | + action_name(action) then | ||
| 110 | + "window.open('"+action+"', '"+window_name+"', '"+jquery_button_get_onclick_action_window_options(window_options, "")+"');", | ||
| 111 | + url(url) then "document.location='"+url+"';", | ||
| 112 | + } | ||
| 113 | + jqflink(link) then "document.location='"+link+"';", | ||
| 114 | + jqscript(script) then script | ||
| 115 | + | ||
| 93 | } | 116 | } |
| 94 | }. | 117 | }. |
| 95 | 118 |
web/CXM_making_a_web_site.anubis
| @@ -62,6 +62,7 @@ read CXM_cookies.anubis | @@ -62,6 +62,7 @@ read CXM_cookies.anubis | ||
| 62 | read CXM_json.anubis | 62 | read CXM_json.anubis |
| 63 | transmit CXM_web_dump.anubis | 63 | transmit CXM_web_dump.anubis |
| 64 | transmit CXM_web_arg_utils.anubis | 64 | transmit CXM_web_arg_utils.anubis |
| 65 | +transmit CXM_web_session.anubis | ||
| 65 | 66 | ||
| 66 | //read CXM_html_tooltip.anubis | 67 | //read CXM_html_tooltip.anubis |
| 67 | 68 | ||
| @@ -303,31 +304,15 @@ public type WEB_Action_Name: | @@ -303,31 +304,15 @@ public type WEB_Action_Name: | ||
| 303 | String action_name | 304 | String action_name |
| 304 | ), | 305 | ), |
| 305 | action_name( | 306 | action_name( |
| 306 | - String name | 307 | + String action_name |
| 308 | + ), | ||
| 309 | + //url is raw action, hence we will onlu copy that url in final link | ||
| 310 | + url( | ||
| 311 | + String url_name | ||
| 307 | ) | 312 | ) |
| 308 | . | 313 | . |
| 309 | 314 | ||
| 310 | -public type WEB_Session_Entry: | ||
| 311 | - session_entry( | ||
| 312 | - String field, | ||
| 313 | - String value | ||
| 314 | - ). | ||
| 315 | 315 | ||
| 316 | -public type WEB_Request: | ||
| 317 | - web_request( | ||
| 318 | - HTTP_Info http_info, | ||
| 319 | - List(Web_arg) lwa, | ||
| 320 | - Bool is_https, | ||
| 321 | - ) | ||
| 322 | -. | ||
| 323 | - | ||
| 324 | -public type WEB_Session: | ||
| 325 | - web_session( | ||
| 326 | - String language, | ||
| 327 | - List(WEB_Session_Entry) entries, | ||
| 328 | - WEB_Request web_request, | ||
| 329 | - WEB_Request previous_request | ||
| 330 | - ). | ||
| 331 | 316 | ||
| 332 | 317 | ||
| 333 | 318 | ||
| @@ -342,6 +327,11 @@ public type WEB_Controller_Result: | @@ -342,6 +327,11 @@ public type WEB_Controller_Result: | ||
| 342 | redirect( //internal redirection, session is modified to call the right controller and action | 327 | redirect( //internal redirection, session is modified to call the right controller and action |
| 343 | WEB_Session session | 328 | WEB_Session session |
| 344 | ), | 329 | ), |
| 330 | + redirect( //internal redirection, session is modified to call the right controller and action | ||
| 331 | + WEB_Session session, | ||
| 332 | + String controller, | ||
| 333 | + String action_name | ||
| 334 | + ), | ||
| 345 | redirect_to_previous, | 335 | redirect_to_previous, |
| 346 | ajax( | 336 | ajax( |
| 347 | HTTP_Answer http_answer | 337 | HTTP_Answer http_answer |
| @@ -389,9 +379,10 @@ define WEB_Session -> String // the function constructed returns the name of | @@ -389,9 +379,10 @@ define WEB_Session -> String // the function constructed returns the name of | ||
| 389 | Int timeout, | 379 | Int timeout, |
| 390 | String state_directory | 380 | String state_directory |
| 391 | ) = | 381 | ) = |
| 392 | - (WEB_Session s) |-> | 382 | + (WEB_Session s_var) |-> |
| 393 | //Set the new timeout | 383 | //Set the new timeout |
| 394 | with time_stamp = now+timeout, | 384 | with time_stamp = now+timeout, |
| 385 | + s = to_WEB_Session_No_Var(s_var), | ||
| 395 | to_be_saved = (time_stamp,s), | 386 | to_be_saved = (time_stamp,s), |
| 396 | //generate new session name | 387 | //generate new session name |
| 397 | session_name = to_ascii(sha1(s)), | 388 | session_name = to_ascii(sha1(s)), |
| @@ -428,9 +419,12 @@ define Previous_Session | @@ -428,9 +419,12 @@ define Previous_Session | ||
| 428 | with session_name = value(cookie), | 419 | with session_name = value(cookie), |
| 429 | with file_path = session_directory+"/"+session_name, | 420 | with file_path = session_directory+"/"+session_name, |
| 430 | //unserialize the stored session and his timeout value | 421 | //unserialize the stored session and his timeout value |
| 431 | - if (RetrieveResult((Int, WEB_Session)))retrieve(file_path) is ok(d) then | 422 | + println("retrieve session ["+session_name+"]"); |
| 423 | + if (RetrieveResult((Int, WEB_Session_No_Var)))retrieve(file_path) is ok(d) then | ||
| 432 | ( | 424 | ( |
| 433 | - since d is (time_stamp, s), | 425 | + println("retrieve session OK ["+session_name+"]"); |
| 426 | + since d is (time_stamp, s_no_var), | ||
| 427 | + with s = to_WEB_Session(s_no_var), | ||
| 434 | if time_stamp < now then | 428 | if time_stamp < now then |
| 435 | ( | 429 | ( |
| 436 | forget(remove(file_path)); | 430 | forget(remove(file_path)); |
| @@ -2849,7 +2843,9 @@ public define Web_Site | @@ -2849,7 +2843,9 @@ public define Web_Site | ||
| 2849 | define HTTP_Answer | 2843 | define HTTP_Answer |
| 2850 | error_page | 2844 | error_page |
| 2851 | ( | 2845 | ( |
| 2852 | - HTTP_Status http_status | 2846 | + HTTP_Status http_status, |
| 2847 | + String message, | ||
| 2848 | + WEB_Session _session, | ||
| 2853 | ) | 2849 | ) |
| 2854 | = | 2850 | = |
| 2855 | html_page | 2851 | html_page |
| @@ -2867,7 +2863,11 @@ define HTTP_Answer | @@ -2867,7 +2863,11 @@ define HTTP_Answer | ||
| 2867 | sequence([ | 2863 | sequence([ |
| 2868 | text([size(16)], "Anubis Web Server 1.14"), | 2864 | text([size(16)], "Anubis Web Server 1.14"), |
| 2869 | br, | 2865 | br, |
| 2870 | - text([size(16)],"Error "+to_String(http_status)) | 2866 | + text([size(16)],"Error "+to_String(http_status)), |
| 2867 | + br, | ||
| 2868 | + text([], "Internal message :"+message), | ||
| 2869 | + br,br, | ||
| 2870 | + in_form(html_Id(""),text_area(wan(""), init(dump(_session)), 120, 60)) | ||
| 2871 | ]) | 2871 | ]) |
| 2872 | ) | 2872 | ) |
| 2873 | ) | 2873 | ) |
| @@ -2880,14 +2880,16 @@ define WEB_Controller_Result | @@ -2880,14 +2880,16 @@ define WEB_Controller_Result | ||
| 2880 | String requested_action_name, | 2880 | String requested_action_name, |
| 2881 | List(WEB_Action) actions_list | 2881 | List(WEB_Action) actions_list |
| 2882 | ) = | 2882 | ) = |
| 2883 | + //println("apply_action "); | ||
| 2883 | if actions_list is | 2884 | if actions_list is |
| 2884 | { | 2885 | { |
| 2885 | - [] then http_answer(error_page(http_not_found)), | 2886 | + [] then http_answer(error_page(http_not_found, "No action found", _session)), |
| 2886 | [h . t] then | 2887 | [h . t] then |
| 2887 | with action_name = if h.name is | 2888 | with action_name = if h.name is |
| 2888 | { | 2889 | { |
| 2889 | controller_action(_, name) then name, | 2890 | controller_action(_, name) then name, |
| 2890 | - action_name(name) then name | 2891 | + action_name(name) then name, |
| 2892 | + url(url) then url, | ||
| 2891 | }, | 2893 | }, |
| 2892 | if requested_action_name = action_name then | 2894 | if requested_action_name = action_name then |
| 2893 | if h.allowed_proto is | 2895 | if h.allowed_proto is |
| @@ -2895,13 +2897,13 @@ define WEB_Controller_Result | @@ -2895,13 +2897,13 @@ define WEB_Controller_Result | ||
| 2895 | //Action only in HTTP | 2897 | //Action only in HTTP |
| 2896 | http then | 2898 | http then |
| 2897 | if _session.web_request.is_https then | 2899 | if _session.web_request.is_https then |
| 2898 | - http_answer(error_page(http_forbidden)) | 2900 | + http_answer(error_page(http_forbidden, "Only HTTP authorized", _session)) |
| 2899 | else | 2901 | else |
| 2900 | //ask to the server the authorization to execute that action | 2902 | //ask to the server the authorization to execute that action |
| 2901 | if h.allow(_session) then | 2903 | if h.allow(_session) then |
| 2902 | h.do_it(_session) | 2904 | h.do_it(_session) |
| 2903 | else | 2905 | else |
| 2904 | - http_answer(error_page(http_unauthorized)) | 2906 | + http_answer(error_page(http_unauthorized, "you are not authorized for this action", _session)) |
| 2905 | 2907 | ||
| 2906 | //Action only in HTTPS | 2908 | //Action only in HTTPS |
| 2907 | https then | 2909 | https then |
| @@ -2910,16 +2912,17 @@ define WEB_Controller_Result | @@ -2910,16 +2912,17 @@ define WEB_Controller_Result | ||
| 2910 | if h.allow(_session) then | 2912 | if h.allow(_session) then |
| 2911 | h.do_it(_session) | 2913 | h.do_it(_session) |
| 2912 | else | 2914 | else |
| 2913 | - http_answer(error_page(http_unauthorized)) | 2915 | + http_answer(error_page(http_unauthorized, "you are not authorized for this action", _session)) |
| 2914 | else | 2916 | else |
| 2915 | - http_answer(error_page(http_forbidden)) | 2917 | + http_answer(error_page(http_forbidden, "Only HTTPS authorized", _session)) |
| 2916 | //Action in both HTTP / HTTPS | 2918 | //Action in both HTTP / HTTPS |
| 2917 | http_https then | 2919 | http_https then |
| 2918 | //ask to the server the authorization to execute that action | 2920 | //ask to the server the authorization to execute that action |
| 2919 | if h.allow(_session) then | 2921 | if h.allow(_session) then |
| 2922 | + //println("do_it "+action_name); | ||
| 2920 | h.do_it(_session) | 2923 | h.do_it(_session) |
| 2921 | else | 2924 | else |
| 2922 | - http_answer(error_page(http_unauthorized)) | 2925 | + http_answer(error_page(http_unauthorized, "you are not authorized for this action", _session)) |
| 2923 | 2926 | ||
| 2924 | } | 2927 | } |
| 2925 | else | 2928 | else |
| @@ -2938,6 +2941,7 @@ define Maybe(WEB_Controller) | @@ -2938,6 +2941,7 @@ define Maybe(WEB_Controller) | ||
| 2938 | [] then failure, | 2941 | [] then failure, |
| 2939 | [h . t] then | 2942 | [h . t] then |
| 2940 | if h.name = controller_name then | 2943 | if h.name = controller_name then |
| 2944 | + | ||
| 2941 | success(h) | 2945 | success(h) |
| 2942 | else | 2946 | else |
| 2943 | get_controller(controller_name, t) | 2947 | get_controller(controller_name, t) |
| @@ -2949,14 +2953,32 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -2949,14 +2953,32 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 2949 | ( | 2953 | ( |
| 2950 | WEB_Controller controller, | 2954 | WEB_Controller controller, |
| 2951 | List(WEB_Controller) controllers, | 2955 | List(WEB_Controller) controllers, |
| 2952 | - WEB_Session _session | 2956 | + WEB_Session _session, |
| 2957 | + Maybe(String) _mb_action_name, | ||
| 2958 | + (HTTP_Info, | ||
| 2959 | + List(Web_arg), | ||
| 2960 | + Bool is_https) -> WEB_Session initial_session, | ||
| 2953 | )= | 2961 | )= |
| 2954 | //get the action name | 2962 | //get the action name |
| 2955 | - if get_String(_session.web_request.lwa, "aws_action") is | 2963 | + with mb_action_name = |
| 2964 | + if _mb_action_name is | ||
| 2965 | + { | ||
| 2966 | + failure then get_String(_session.web_request.lwa, "aws_action"), | ||
| 2967 | + success(_an) then success(_an) | ||
| 2968 | + }, | ||
| 2969 | + | ||
| 2970 | + if mb_action_name is | ||
| 2956 | { | 2971 | { |
| 2957 | - failure then (failure, error_page(http_not_found)), | 2972 | + failure then |
| 2973 | + //(failure, error_page(http_not_found, "Action name failure", _session)), | ||
| 2974 | + with new_session = initial_session(_session.web_request.http_info, _session.web_request.lwa, _session.web_request.is_https), | ||
| 2975 | + if get_controller(get_String(new_session.web_request.lwa, "aws_controller", "root"), controllers) is | ||
| 2976 | + { | ||
| 2977 | + failure then (failure, error_page(http_not_found, "Initial Session Controller not found", new_session)), | ||
| 2978 | + success(new_controller) then apply_controller_action(new_controller, controllers, new_session, failure, initial_session), | ||
| 2979 | + }, | ||
| 2958 | success(action_name) then | 2980 | success(action_name) then |
| 2959 | - | 2981 | + println("ACTION_NAME ["+action_name+"]"); |
| 2960 | if apply_action(_session, action_name, *controller.controller_actions) is | 2982 | if apply_action(_session, action_name, *controller.controller_actions) is |
| 2961 | { | 2983 | { |
| 2962 | http_answer(session, answer) then (success(session), answer), | 2984 | http_answer(session, answer) then (success(session), answer), |
| @@ -2964,19 +2986,26 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -2964,19 +2986,26 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 2964 | redirect(new_session) then | 2986 | redirect(new_session) then |
| 2965 | if get_controller(get_String(new_session.web_request.lwa, "aws_controller", "root"), controllers) is | 2987 | if get_controller(get_String(new_session.web_request.lwa, "aws_controller", "root"), controllers) is |
| 2966 | { | 2988 | { |
| 2967 | - failure then (failure, error_page(http_not_found)), | ||
| 2968 | - success(new_controller) then apply_controller_action(new_controller, controllers, new_session), | ||
| 2969 | - } | 2989 | + failure then (failure, error_page(http_not_found, "Redirect Controller not found", new_session)), |
| 2990 | + success(new_controller) then apply_controller_action(new_controller, controllers, new_session, failure, initial_session), | ||
| 2991 | + }, | ||
| 2992 | + | ||
| 2993 | + redirect(new_session, r_controller_name, r_action_name) then | ||
| 2994 | + if get_controller(r_controller_name, controllers) is | ||
| 2995 | + { | ||
| 2996 | + failure then (failure, error_page(http_not_found, "Redirect Controller "+r_controller_name+" not found", new_session)), | ||
| 2997 | + success(new_controller) then | ||
| 2998 | + apply_controller_action(new_controller, controllers, new_session, success(r_action_name), initial_session), | ||
| 2999 | + }, | ||
| 2970 | 3000 | ||
| 2971 | - redirect_to_previous then | ||
| 2972 | - if get_controller(get_String(_session.previous_request.lwa, "aws_controller", "root"), controllers) is | 3001 | + redirect_to_previous then |
| 3002 | + if get_controller(get_String(_session.previous_web_request.lwa, "aws_controller", "root"), controllers) is | ||
| 2973 | { | 3003 | { |
| 2974 | - failure then (failure, error_page(http_not_found)), | 3004 | + failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), |
| 2975 | success(new_controller) then | 3005 | success(new_controller) then |
| 2976 | since _session is web_session(lang, entries, _, previous), | 3006 | since _session is web_session(lang, entries, _, previous), |
| 2977 | - apply_controller_action(new_controller, controllers, web_session(lang, entries, previous, previous)), | ||
| 2978 | - } | ||
| 2979 | - | 3007 | + apply_controller_action(new_controller, controllers, web_session(lang, entries, previous, previous), failure, initial_session), |
| 3008 | + }, | ||
| 2980 | ajax(answer) then (failure, answer), | 3009 | ajax(answer) then (failure, answer), |
| 2981 | } | 3010 | } |
| 2982 | } | 3011 | } |
| @@ -3063,8 +3092,11 @@ public define Web_Site | @@ -3063,8 +3092,11 @@ public define Web_Site | ||
| 3063 | //since apply_controller_action(get_controller(get_String(lwa, "aws_controller", "root"), *web_controllers), *web_controllers, current_session) | 3092 | //since apply_controller_action(get_controller(get_String(lwa, "aws_controller", "root"), *web_controllers), *web_controllers, current_session) |
| 3064 | since if get_controller(get_String(current_session.web_request.lwa, "aws_controller", "root"), *web_controllers) is | 3093 | since if get_controller(get_String(current_session.web_request.lwa, "aws_controller", "root"), *web_controllers) is |
| 3065 | { | 3094 | { |
| 3066 | - failure then (failure, error_page(http_not_found)), | ||
| 3067 | - success(new_controller) then apply_controller_action(new_controller, *web_controllers, current_session), | 3095 | + failure then |
| 3096 | + (failure, error_page(http_not_found, "Controller not found", current_session)), | ||
| 3097 | + | ||
| 3098 | + success(new_controller) then | ||
| 3099 | + apply_controller_action(new_controller, *web_controllers, current_session, failure, initial_session), | ||
| 3068 | } | 3100 | } |
| 3069 | is (mb_new_session, http_answer), | 3101 | is (mb_new_session, http_answer), |
| 3070 | 3102 | ||
| @@ -3503,6 +3535,19 @@ define Int | @@ -3503,6 +3535,19 @@ define Int | ||
| 3503 | The next function composes the URL. It is a JavaScript URL when the target is another | 3535 | The next function composes the URL. It is a JavaScript URL when the target is another |
| 3504 | window. | 3536 | window. |
| 3505 | 3537 | ||
| 3538 | +public define String | ||
| 3539 | + format_web_action_name | ||
| 3540 | + ( | ||
| 3541 | + WEB_Action_Name action | ||
| 3542 | + )= | ||
| 3543 | + if action is | ||
| 3544 | + { | ||
| 3545 | + controller_action(controller, action_name) then "?aws_controller="+controller+"&aws_action="+action_name, | ||
| 3546 | + action_name(action_name) then "?aws_action="+action_name, | ||
| 3547 | + url(url) then url | ||
| 3548 | + } | ||
| 3549 | +. | ||
| 3550 | + | ||
| 3506 | define String | 3551 | define String |
| 3507 | make_actioner_url | 3552 | make_actioner_url |
| 3508 | ( | 3553 | ( |
| @@ -3530,12 +3575,7 @@ define String | @@ -3530,12 +3575,7 @@ define String | ||
| 3530 | "https://"+common_name+":"+https_port+"/", | 3575 | "https://"+common_name+":"+https_port+"/", |
| 3531 | } + | 3576 | } + |
| 3532 | //with action_string = | 3577 | //with action_string = |
| 3533 | - if action is | ||
| 3534 | - { | ||
| 3535 | - controller_action(controller, action_name) then "?aws_controller="+controller+"&aws_action="+action_name, | ||
| 3536 | - action_name(action_name) then "?aws_action="+action_name | ||
| 3537 | - } | ||
| 3538 | - //"?a=" + action_name + | 3578 | + format_web_action_name(action) |
| 3539 | + | 3579 | + |
| 3540 | format_extra_operands(extra_ops), | 3580 | format_extra_operands(extra_ops), |
| 3541 | if target is | 3581 | if target is |
| @@ -4042,7 +4082,8 @@ define Printable_tree | @@ -4042,7 +4082,8 @@ define Printable_tree | ||
| 4042 | //if action name is empty, format options on image because maybe there onclick action | 4082 | //if action name is empty, format options on image because maybe there onclick action |
| 4043 | with action_name = if action is { | 4083 | with action_name = if action is { |
| 4044 | controller_action(_, an) then an, | 4084 | controller_action(_, an) then an, |
| 4045 | - action_name(an) then an | 4085 | + action_name(an) then an, |
| 4086 | + url(_) then "" | ||
| 4046 | }, | 4087 | }, |
| 4047 | if action_name ="" then | 4088 | if action_name ="" then |
| 4048 | [ | 4089 | [ |
| @@ -4062,12 +4103,13 @@ define Printable_tree | @@ -4062,12 +4103,13 @@ define Printable_tree | ||
| 4062 | text, "</a>" | 4103 | text, "</a>" |
| 4063 | ], | 4104 | ], |
| 4064 | javascript(s,h) then | 4105 | javascript(s,h) then |
| 4065 | - with action_name = | ||
| 4066 | - if action is | ||
| 4067 | - { | ||
| 4068 | - controller_action(_, an) then an, | ||
| 4069 | - action_name(an) then an | ||
| 4070 | - }, | 4106 | + with action_name = |
| 4107 | + if action is | ||
| 4108 | + { | ||
| 4109 | + controller_action(_, an) then an, | ||
| 4110 | + action_name(an) then an, | ||
| 4111 | + url(_) then "" | ||
| 4112 | + }, | ||
| 4071 | if action_name = "" then | 4113 | if action_name = "" then |
| 4072 | ["<input type=\"button\" value=\"",text,"\"", format_attrs(options), " />"] | 4114 | ["<input type=\"button\" value=\"",text,"\"", format_attrs(options), " />"] |
| 4073 | else | 4115 | else |
| @@ -4110,7 +4152,8 @@ define Printable_tree | @@ -4110,7 +4152,8 @@ define Printable_tree | ||
| 4110 | javascript(s,h) then | 4152 | javascript(s,h) then |
| 4111 | with action_name = if action is { | 4153 | with action_name = if action is { |
| 4112 | controller_action(_, an) then an, | 4154 | controller_action(_, an) then an, |
| 4113 | - action_name(an) then an | 4155 | + action_name(an) then an, |
| 4156 | + url(_) then "" | ||
| 4114 | }, | 4157 | }, |
| 4115 | if action_name = "" then // special case where URL (so the action_name) is provided by the form itself | 4158 | if action_name = "" then // special case where URL (so the action_name) is provided by the form itself |
| 4116 | // so javascript isn't needed. This is the standard HMTL way. | 4159 | // so javascript isn't needed. This is the standard HMTL way. |
web/CXM_multihost_http_server.anubis
| @@ -1579,7 +1579,9 @@ define List(Web_arg) | @@ -1579,7 +1579,9 @@ define List(Web_arg) | ||
| 1579 | then with second1 = read_name_or_value(s,i+1,i+1), | 1579 | then with second1 = read_name_or_value(s,i+1,i+1), |
| 1580 | // print("\""+second1+"\"\n"); | 1580 | // print("\""+second1+"\"\n"); |
| 1581 | with second = web_to_ascii(second1,0,[]), | 1581 | with second = web_to_ascii(second1,0,[]), |
| 1582 | - [web_arg(first,second) . read_www_url_encoded_web_args(s,i+length(second1)+2)] | 1582 | + //println("first ["+first+"] second ["+second+"]"); |
| 1583 | + with _first = if substr(first,0,4) = "amp;" then substr(first, 4, length(first) - 4) else first, | ||
| 1584 | + [web_arg(_first,second) . read_www_url_encoded_web_args(s,i+length(second1)+2)] | ||
| 1583 | else print("**** ALERT **** badly formatted argument [" + s + "]!!!\n"); | 1585 | else print("**** ALERT **** badly formatted argument [" + s + "]!!!\n"); |
| 1584 | [] | 1586 | [] |
| 1585 | }. | 1587 | }. |
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: フランスのトトロ aka (David RENÉ) | ||
| 4 | + * Date: 17/02/2017 | ||
| 5 | + * Time: 17:18 | ||
| 6 | + * © Calexium | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +read system/convert.anubis | ||
| 10 | +read system/muscle.anubis | ||
| 11 | +read CXM_common.anubis | ||
| 12 | +read CXM_web_dump.anubis | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +public type WEB_Session_Field_Datum: | ||
| 16 | + string(String), //fully implented | ||
| 17 | + bool(Bool), //fully implented | ||
| 18 | + int(Int), //fully implented | ||
| 19 | + message(Message), //fully implented | ||
| 20 | + byte_array(ByteArray), | ||
| 21 | + float(Float), | ||
| 22 | + word128(Word128), | ||
| 23 | + word64(Word64), | ||
| 24 | + word32(Word32), | ||
| 25 | + word16(Word16), | ||
| 26 | + word8(Word8), | ||
| 27 | + word4(Word4) | ||
| 28 | +. | ||
| 29 | + | ||
| 30 | +public type WEB_Session_Field_Type: | ||
| 31 | + string_t, | ||
| 32 | + bool_t, | ||
| 33 | + int_t, | ||
| 34 | + message_t, | ||
| 35 | + byte_array_t, | ||
| 36 | + float_t, | ||
| 37 | + word128_t, | ||
| 38 | + word64_t, | ||
| 39 | + word32_t, | ||
| 40 | + word16_t, | ||
| 41 | + word8_t, | ||
| 42 | + word4_t | ||
| 43 | +. | ||
| 44 | + | ||
| 45 | +public type WEB_Session_Field: | ||
| 46 | + session_field( | ||
| 47 | + String field_name, | ||
| 48 | + WEB_Session_Field_Type field_type, | ||
| 49 | + Var(WEB_Session_Field_Datum) field_datum //Var because it can be replaced | ||
| 50 | + ). | ||
| 51 | + | ||
| 52 | +public type WEB_Session_Field_No_Var: | ||
| 53 | + session_field( | ||
| 54 | + String field_name, | ||
| 55 | + WEB_Session_Field_Type field_type, | ||
| 56 | + WEB_Session_Field_Datum field_datum //Var because it can be replaced | ||
| 57 | + ). | ||
| 58 | + | ||
| 59 | +public type WEB_Request: | ||
| 60 | + web_request( | ||
| 61 | + HTTP_Info http_info, | ||
| 62 | + List(Web_arg) lwa, | ||
| 63 | + Bool is_https, | ||
| 64 | + ) | ||
| 65 | +. | ||
| 66 | + | ||
| 67 | +public type WEB_Session: | ||
| 68 | + web_session( | ||
| 69 | + String language, | ||
| 70 | + Var(List(WEB_Session_Field)) fields, | ||
| 71 | + WEB_Request web_request, | ||
| 72 | + WEB_Request previous_web_request | ||
| 73 | + ). | ||
| 74 | + | ||
| 75 | +public type WEB_Session_No_Var: | ||
| 76 | + web_session( | ||
| 77 | + String language, | ||
| 78 | + List(WEB_Session_Field_No_Var) fields, | ||
| 79 | + WEB_Request web_request, | ||
| 80 | + WEB_Request previous_web_request | ||
| 81 | + ). | ||
| 82 | + | ||
| 83 | +public define Var(List(WEB_Session_Field)) | ||
| 84 | + empty_fields_list = | ||
| 85 | + var([]). | ||
| 86 | + | ||
| 87 | +public define WEB_Session_Field | ||
| 88 | + session_field | ||
| 89 | + ( | ||
| 90 | + String _field_name, | ||
| 91 | + String _string | ||
| 92 | + )= | ||
| 93 | + session_field(_field_name, string_t, var(string(_string))) | ||
| 94 | +. | ||
| 95 | + | ||
| 96 | + *----------------------------------------------------------------* | ||
| 97 | + | ||
| 98 | +define Var(List(WEB_Session_Field)) | ||
| 99 | + to_WEB_Session_Field | ||
| 100 | + ( | ||
| 101 | + List(WEB_Session_Field_No_Var) fields | ||
| 102 | + )= | ||
| 103 | + var(map((WEB_Session_Field_No_Var field) |-> session_field(field.field_name, field.field_type, var(field.field_datum)), fields)) | ||
| 104 | +. | ||
| 105 | + | ||
| 106 | +define List(WEB_Session_Field_No_Var) | ||
| 107 | + to_WEB_Session_Field_No_Var | ||
| 108 | + ( | ||
| 109 | + List(WEB_Session_Field) fields | ||
| 110 | + )= | ||
| 111 | + map((WEB_Session_Field field) |-> session_field(field.field_name, field.field_type, *field.field_datum), fields) | ||
| 112 | +. | ||
| 113 | + | ||
| 114 | +public define WEB_Session | ||
| 115 | + to_WEB_Session | ||
| 116 | + ( | ||
| 117 | + WEB_Session_No_Var _session | ||
| 118 | + )= | ||
| 119 | + since _session is web_session(language, fields, web_request, previous_web_request), | ||
| 120 | + web_session(language, to_WEB_Session_Field(fields), web_request, previous_web_request) | ||
| 121 | +. | ||
| 122 | + | ||
| 123 | +public define WEB_Session_No_Var | ||
| 124 | + to_WEB_Session_No_Var | ||
| 125 | + ( | ||
| 126 | + WEB_Session _session | ||
| 127 | + )= | ||
| 128 | + since _session is web_session(language, fields, web_request, previous_web_request), | ||
| 129 | + web_session(language, to_WEB_Session_Field_No_Var(*fields), web_request, previous_web_request) | ||
| 130 | +. | ||
| 131 | + | ||
| 132 | +public define Maybe(WEB_Session_Field_Datum) | ||
| 133 | + get_field | ||
| 134 | + ( | ||
| 135 | + List(WEB_Session_Field) fields, | ||
| 136 | + WEB_Session_Field_Type _field_type, | ||
| 137 | + String _field_name | ||
| 138 | + ) = | ||
| 139 | + if fields is | ||
| 140 | + { | ||
| 141 | + [] then failure, | ||
| 142 | + [h . t] then | ||
| 143 | + if h.field_name = _field_name & h.field_type = _field_type then | ||
| 144 | + success(*h.field_datum) | ||
| 145 | + else | ||
| 146 | + get_field(t, _field_type, _field_name) | ||
| 147 | + } | ||
| 148 | +. | ||
| 149 | + /******** ANY functions ***************/ | ||
| 150 | + | ||
| 151 | + | ||
| 152 | +define List(WEB_Session_Field) | ||
| 153 | + _remove_any | ||
| 154 | + ( | ||
| 155 | + List(WEB_Session_Field) fields, | ||
| 156 | + WEB_Session_Field_Type _field_type, | ||
| 157 | + String _field_name | ||
| 158 | + )= | ||
| 159 | + if fields is | ||
| 160 | + { | ||
| 161 | + [] then [], | ||
| 162 | + [h . t] then | ||
| 163 | + if h.field_name = _field_name & h.field_type = _field_type then | ||
| 164 | + _remove_any(t, _field_type, _field_name) | ||
| 165 | + else | ||
| 166 | + [ h. _remove_any(t, _field_type, _field_name) ] | ||
| 167 | + } | ||
| 168 | +. | ||
| 169 | + | ||
| 170 | +define One | ||
| 171 | + remove_any | ||
| 172 | + ( | ||
| 173 | + Var(List(WEB_Session_Field)) fields, | ||
| 174 | + WEB_Session_Field_Type _field_type, | ||
| 175 | + String _field_name | ||
| 176 | + )= | ||
| 177 | + fields <- _remove_any(*fields, _field_type, _field_name) | ||
| 178 | +. | ||
| 179 | + | ||
| 180 | +define One | ||
| 181 | + replace_any | ||
| 182 | + ( | ||
| 183 | + List(WEB_Session_Field) fields, | ||
| 184 | + WEB_Session_Field_Type _field_type, | ||
| 185 | + String _field_name, | ||
| 186 | + WEB_Session_Field_Datum _field_value, | ||
| 187 | + Var(List(WEB_Session_Field)) fields_org, | ||
| 188 | + )= | ||
| 189 | + if fields is | ||
| 190 | + { | ||
| 191 | + [] then fields_org <- [session_field(_field_name, _field_type, var(_field_value)) . *fields_org], | ||
| 192 | + [h . t] then | ||
| 193 | + if h.field_name = _field_name & h.field_type = _field_type then | ||
| 194 | + h.field_datum <- _field_value | ||
| 195 | + else | ||
| 196 | + replace_any(t, _field_type, _field_name, _field_value, fields_org) | ||
| 197 | + } | ||
| 198 | +. | ||
| 199 | + | ||
| 200 | + | ||
| 201 | +define One | ||
| 202 | + replace_any | ||
| 203 | + ( | ||
| 204 | + Var(List(WEB_Session_Field)) fields, | ||
| 205 | + WEB_Session_Field_Type _field_type, | ||
| 206 | + String _field_name, | ||
| 207 | + WEB_Session_Field_Datum _field_value | ||
| 208 | + )= | ||
| 209 | + replace_any(*fields, _field_type, _field_name, _field_value, fields) | ||
| 210 | +. | ||
| 211 | + | ||
| 212 | + /*************** String *****************/ | ||
| 213 | + | ||
| 214 | + Maybe(String) get_String(fields, _field_name) | ||
| 215 | + String get_String(fiels, _field_name, default_value) | ||
| 216 | + | ||
| 217 | +public define Maybe(String) | ||
| 218 | + get_String | ||
| 219 | + ( | ||
| 220 | + Var(List(WEB_Session_Field)) fields, | ||
| 221 | + String _field_name | ||
| 222 | + ) = | ||
| 223 | + if get_field(*fields, string_t, _field_name) is | ||
| 224 | + { | ||
| 225 | + failure then failure, | ||
| 226 | + success(datum) then | ||
| 227 | + if datum is string(value) then | ||
| 228 | + success(value) | ||
| 229 | + else | ||
| 230 | + failure | ||
| 231 | + } | ||
| 232 | +. | ||
| 233 | + | ||
| 234 | +public define String | ||
| 235 | + get_String | ||
| 236 | + ( | ||
| 237 | + Var(List(WEB_Session_Field)) fields, | ||
| 238 | + String _field_name, | ||
| 239 | + String default_value | ||
| 240 | + ) = | ||
| 241 | + if get_String(fields, _field_name) is | ||
| 242 | + { | ||
| 243 | + failure then default_value | ||
| 244 | + success(value) then value | ||
| 245 | + }. | ||
| 246 | + | ||
| 247 | +public define One | ||
| 248 | + put_String | ||
| 249 | + ( | ||
| 250 | + Var(List(WEB_Session_Field)) fields, | ||
| 251 | + String _field_name, | ||
| 252 | + String _field_value | ||
| 253 | + )= | ||
| 254 | + fields <- [session_field(_field_name, string_t, var(string(_field_value))) . *fields] | ||
| 255 | +. | ||
| 256 | + | ||
| 257 | +public define One | ||
| 258 | + replace_String | ||
| 259 | + ( | ||
| 260 | + Var(List(WEB_Session_Field)) fields, | ||
| 261 | + String _field_name, | ||
| 262 | + String _field_value | ||
| 263 | + )= | ||
| 264 | + replace_any(fields, string_t, _field_name, string(_field_value)) | ||
| 265 | +. | ||
| 266 | + | ||
| 267 | + | ||
| 268 | +public define One | ||
| 269 | + remove_String | ||
| 270 | + ( | ||
| 271 | + Var(List(WEB_Session_Field)) fields, | ||
| 272 | + String _field_name | ||
| 273 | + )= | ||
| 274 | + remove_any(fields, string_t, _field_name) | ||
| 275 | +. | ||
| 276 | + | ||
| 277 | + /*************** Bool *****************/ | ||
| 278 | + | ||
| 279 | + Maybe(Bool) get_Bool(fields, _field_name) | ||
| 280 | + Bool get_Bool(fiels, _field_name, default_value) | ||
| 281 | + | ||
| 282 | +public define Maybe(Bool) | ||
| 283 | + get_Bool | ||
| 284 | + ( | ||
| 285 | + List(WEB_Session_Field) fields, | ||
| 286 | + String _field_name | ||
| 287 | + ) = | ||
| 288 | + if get_field(fields, bool_t, _field_name) is | ||
| 289 | + { | ||
| 290 | + failure then failure, | ||
| 291 | + success(datum) then | ||
| 292 | + if datum is bool(value) then | ||
| 293 | + success(value) | ||
| 294 | + else | ||
| 295 | + failure | ||
| 296 | + } | ||
| 297 | +. | ||
| 298 | + | ||
| 299 | +public define Bool | ||
| 300 | + get_Bool | ||
| 301 | + ( | ||
| 302 | + List(WEB_Session_Field) fields, | ||
| 303 | + String _field_name, | ||
| 304 | + Bool default_value | ||
| 305 | + ) = | ||
| 306 | + if get_Bool(fields, _field_name) is | ||
| 307 | + { | ||
| 308 | + failure then default_value | ||
| 309 | + success(value) then value | ||
| 310 | + }. | ||
| 311 | + | ||
| 312 | +public define One | ||
| 313 | + put_Bool | ||
| 314 | + ( | ||
| 315 | + Var(List(WEB_Session_Field)) fields, | ||
| 316 | + String _field_name, | ||
| 317 | + Bool _field_value | ||
| 318 | + )= | ||
| 319 | + fields <- [session_field(_field_name, bool_t, var(bool(_field_value))) . *fields] | ||
| 320 | +. | ||
| 321 | + | ||
| 322 | +public define One | ||
| 323 | + replace_Bool | ||
| 324 | + ( | ||
| 325 | + Var(List(WEB_Session_Field)) fields, | ||
| 326 | + String _field_name, | ||
| 327 | + Bool _field_value | ||
| 328 | + )= | ||
| 329 | + replace_any(fields, bool_t, _field_name, bool(_field_value)) | ||
| 330 | +. | ||
| 331 | + | ||
| 332 | + | ||
| 333 | +public define One | ||
| 334 | + remove_Bool | ||
| 335 | + ( | ||
| 336 | + Var(List(WEB_Session_Field)) fields, | ||
| 337 | + String _field_name | ||
| 338 | + )= | ||
| 339 | + remove_any(fields, bool_t, _field_name) | ||
| 340 | +. | ||
| 341 | + | ||
| 342 | + /*************** Int *****************/ | ||
| 343 | + | ||
| 344 | + Maybe(String) get_Int(fields, _field_name) | ||
| 345 | + String get_Int(fiels, _field_name, default_value) | ||
| 346 | + | ||
| 347 | +public define Maybe(Int) | ||
| 348 | + get_Int | ||
| 349 | + ( | ||
| 350 | + List(WEB_Session_Field) fields, | ||
| 351 | + String _field_name | ||
| 352 | + ) = | ||
| 353 | + if get_field(fields, int_t, _field_name) is | ||
| 354 | + { | ||
| 355 | + failure then failure, | ||
| 356 | + success(datum) then | ||
| 357 | + if datum is int(value) then | ||
| 358 | + success(value) | ||
| 359 | + else | ||
| 360 | + failure | ||
| 361 | + } | ||
| 362 | +. | ||
| 363 | + | ||
| 364 | +public define Int | ||
| 365 | + get_Int | ||
| 366 | + ( | ||
| 367 | + List(WEB_Session_Field) fields, | ||
| 368 | + String _field_name, | ||
| 369 | + Int default_value | ||
| 370 | + ) = | ||
| 371 | + if get_Int(fields, _field_name) is | ||
| 372 | + { | ||
| 373 | + failure then default_value | ||
| 374 | + success(value) then value | ||
| 375 | + }. | ||
| 376 | + | ||
| 377 | +public define One | ||
| 378 | + put_Int | ||
| 379 | + ( | ||
| 380 | + Var(List(WEB_Session_Field)) fields, | ||
| 381 | + String _field_name, | ||
| 382 | + Int _field_value | ||
| 383 | + )= | ||
| 384 | + fields <- [session_field(_field_name, int_t, var(int(_field_value))) . *fields] | ||
| 385 | +. | ||
| 386 | + | ||
| 387 | +public define One | ||
| 388 | + replace_Int | ||
| 389 | + ( | ||
| 390 | + Var(List(WEB_Session_Field)) fields, | ||
| 391 | + String _field_name, | ||
| 392 | + Int _field_value | ||
| 393 | + )= | ||
| 394 | + replace_any(fields, int_t, _field_name, int(_field_value)) | ||
| 395 | +. | ||
| 396 | + | ||
| 397 | + | ||
| 398 | +public define One | ||
| 399 | + remove_Int | ||
| 400 | + ( | ||
| 401 | + Var(List(WEB_Session_Field)) fields, | ||
| 402 | + String _field_name | ||
| 403 | + )= | ||
| 404 | + remove_any(fields, int_t, _field_name) | ||
| 405 | +. | ||
| 406 | + | ||
| 407 | + /*************** Message *****************/ | ||
| 408 | + | ||
| 409 | + Maybe(String) get_Message(fields, _field_name) | ||
| 410 | + String get_Message(fiels, _field_name, default_value) | ||
| 411 | + | ||
| 412 | +public define Maybe(Message) | ||
| 413 | + get_Message | ||
| 414 | + ( | ||
| 415 | + Var(List(WEB_Session_Field)) fields, | ||
| 416 | + String _field_name | ||
| 417 | + ) = | ||
| 418 | + if get_field(*fields, message_t, _field_name) is | ||
| 419 | + { | ||
| 420 | + failure then failure, | ||
| 421 | + success(datum) then | ||
| 422 | + if datum is message(value) then | ||
| 423 | + success(value) | ||
| 424 | + else | ||
| 425 | + failure | ||
| 426 | + } | ||
| 427 | +. | ||
| 428 | + | ||
| 429 | +public define Message | ||
| 430 | + get_Message | ||
| 431 | + ( | ||
| 432 | + Var(List(WEB_Session_Field)) fields, | ||
| 433 | + String _field_name, | ||
| 434 | + Message default_value | ||
| 435 | + ) = | ||
| 436 | + if get_Message(fields, _field_name) is | ||
| 437 | + { | ||
| 438 | + failure then default_value | ||
| 439 | + success(value) then value | ||
| 440 | + }. | ||
| 441 | + | ||
| 442 | +public define One | ||
| 443 | + put_Message | ||
| 444 | + ( | ||
| 445 | + Var(List(WEB_Session_Field)) fields, | ||
| 446 | + String _field_name, | ||
| 447 | + Message _field_value | ||
| 448 | + )= | ||
| 449 | + fields <- [session_field(_field_name, message_t, var(message(_field_value))) . *fields] | ||
| 450 | +. | ||
| 451 | + | ||
| 452 | +public define One | ||
| 453 | + replace_Message | ||
| 454 | + ( | ||
| 455 | + Var(List(WEB_Session_Field)) fields, | ||
| 456 | + String _field_name, | ||
| 457 | + Message _field_value | ||
| 458 | + )= | ||
| 459 | + replace_any(fields, message_t, _field_name, message(_field_value)) | ||
| 460 | +. | ||
| 461 | + | ||
| 462 | +public define One | ||
| 463 | + remove_Message | ||
| 464 | + ( | ||
| 465 | + Var(List(WEB_Session_Field)) fields, | ||
| 466 | + String _field_name | ||
| 467 | + )= | ||
| 468 | + remove_any(fields, message_t, _field_name) | ||
| 469 | +. | ||
| 470 | + | ||
| 471 | + /*************** ByteArray *****************/ | ||
| 472 | + | ||
| 473 | + Maybe(ByteArray) get_ByteArray(fields, _field_name) | ||
| 474 | + ByteArray get_ByteArray(fiels, _field_name, default_value) | ||
| 475 | + | ||
| 476 | +public define Maybe(ByteArray) | ||
| 477 | + get_ByteArray | ||
| 478 | + ( | ||
| 479 | + List(WEB_Session_Field) fields, | ||
| 480 | + String _field_name | ||
| 481 | + ) = | ||
| 482 | + if get_field(fields, byte_array_t, _field_name) is | ||
| 483 | + { | ||
| 484 | + failure then failure, | ||
| 485 | + success(datum) then | ||
| 486 | + if datum is byte_array(value) then | ||
| 487 | + success(value) | ||
| 488 | + else | ||
| 489 | + failure | ||
| 490 | + } | ||
| 491 | +. | ||
| 492 | + | ||
| 493 | +public define ByteArray | ||
| 494 | + get_ByteArray | ||
| 495 | + ( | ||
| 496 | + List(WEB_Session_Field) fields, | ||
| 497 | + String _field_name, | ||
| 498 | + ByteArray default_value | ||
| 499 | + ) = | ||
| 500 | + if get_ByteArray(fields, _field_name) is | ||
| 501 | + { | ||
| 502 | + failure then default_value | ||
| 503 | + success(value) then value | ||
| 504 | + }. | ||
| 505 | + | ||
| 506 | +public define One | ||
| 507 | + put_ByteArray | ||
| 508 | + ( | ||
| 509 | + Var(List(WEB_Session_Field)) fields, | ||
| 510 | + String _field_name, | ||
| 511 | + ByteArray _field_value | ||
| 512 | + )= | ||
| 513 | + fields <- [session_field(_field_name, byte_array_t, var(byte_array(_field_value))) . *fields] | ||
| 514 | +. | ||
| 515 | + | ||
| 516 | +public define One | ||
| 517 | + replace_ByteArray | ||
| 518 | + ( | ||
| 519 | + Var(List(WEB_Session_Field)) fields, | ||
| 520 | + String _field_name, | ||
| 521 | + ByteArray _field_value | ||
| 522 | + )= | ||
| 523 | + replace_any(fields, byte_array_t, _field_name, byte_array(_field_value)) | ||
| 524 | +. | ||
| 525 | + | ||
| 526 | +public define One | ||
| 527 | + remove_ByteArray | ||
| 528 | + ( | ||
| 529 | + Var(List(WEB_Session_Field)) fields, | ||
| 530 | + String _field_name | ||
| 531 | + )= | ||
| 532 | + remove_any(fields, byte_array_t, _field_name) | ||
| 533 | +. | ||
| 534 | + | ||
| 535 | + /*************** Float *****************/ | ||
| 536 | + | ||
| 537 | + Maybe(Float) get_Float(fields, _field_name) | ||
| 538 | + Float get_Float(fiels, _field_name, default_value) | ||
| 539 | + | ||
| 540 | +public define Maybe(Float) | ||
| 541 | + get_Float | ||
| 542 | + ( | ||
| 543 | + List(WEB_Session_Field) fields, | ||
| 544 | + String _field_name | ||
| 545 | + ) = | ||
| 546 | + if get_field(fields, float_t, _field_name) is | ||
| 547 | + { | ||
| 548 | + failure then failure, | ||
| 549 | + success(datum) then | ||
| 550 | + if datum is float(value) then | ||
| 551 | + success(value) | ||
| 552 | + else | ||
| 553 | + failure | ||
| 554 | + } | ||
| 555 | +. | ||
| 556 | + | ||
| 557 | +public define Float | ||
| 558 | + get_Float | ||
| 559 | + ( | ||
| 560 | + List(WEB_Session_Field) fields, | ||
| 561 | + String _field_name, | ||
| 562 | + Float default_value | ||
| 563 | + ) = | ||
| 564 | + if get_Float(fields, _field_name) is | ||
| 565 | + { | ||
| 566 | + failure then default_value | ||
| 567 | + success(value) then value | ||
| 568 | + }. | ||
| 569 | + | ||
| 570 | +public define One | ||
| 571 | + put_Float | ||
| 572 | + ( | ||
| 573 | + Var(List(WEB_Session_Field)) fields, | ||
| 574 | + String _field_name, | ||
| 575 | + Float _field_value | ||
| 576 | + )= | ||
| 577 | + fields <- [session_field(_field_name, float_t, var(float(_field_value))) . *fields] | ||
| 578 | +. | ||
| 579 | + | ||
| 580 | +public define One | ||
| 581 | + replace_Float | ||
| 582 | + ( | ||
| 583 | + Var(List(WEB_Session_Field)) fields, | ||
| 584 | + String _field_name, | ||
| 585 | + Float _field_value | ||
| 586 | + )= | ||
| 587 | + replace_any(fields, float_t, _field_name, float(_field_value)) | ||
| 588 | +. | ||
| 589 | + | ||
| 590 | +public define One | ||
| 591 | + remove_Float | ||
| 592 | + ( | ||
| 593 | + Var(List(WEB_Session_Field)) fields, | ||
| 594 | + String _field_name | ||
| 595 | + )= | ||
| 596 | + remove_any(fields, float_t, _field_name) | ||
| 597 | +. | ||
| 598 | + | ||
| 599 | + /*************** Word128 *****************/ | ||
| 600 | + | ||
| 601 | + Maybe(Word128) get_Word128t(fields, _field_name) | ||
| 602 | + Word128 get_Word128(fields, _field_name, default_value) | ||
| 603 | + | ||
| 604 | +public define Maybe(Word128) | ||
| 605 | + get_Word128 | ||
| 606 | + ( | ||
| 607 | + List(WEB_Session_Field) fields, | ||
| 608 | + String _field_name | ||
| 609 | + ) = | ||
| 610 | + if get_field(fields, word128_t, _field_name) is | ||
| 611 | + { | ||
| 612 | + failure then failure, | ||
| 613 | + success(datum) then | ||
| 614 | + if datum is word128(value) then | ||
| 615 | + success(value) | ||
| 616 | + else | ||
| 617 | + failure | ||
| 618 | + } | ||
| 619 | +. | ||
| 620 | + | ||
| 621 | +public define Word128 | ||
| 622 | + get_Word128 | ||
| 623 | + ( | ||
| 624 | + List(WEB_Session_Field) fields, | ||
| 625 | + String _field_name, | ||
| 626 | + Word128 default_value | ||
| 627 | + ) = | ||
| 628 | + if get_Word128(fields, _field_name) is | ||
| 629 | + { | ||
| 630 | + failure then default_value | ||
| 631 | + success(value) then value | ||
| 632 | + }. | ||
| 633 | + | ||
| 634 | +public define One | ||
| 635 | + put_Word128 | ||
| 636 | + ( | ||
| 637 | + Var(List(WEB_Session_Field)) fields, | ||
| 638 | + String _field_name, | ||
| 639 | + Word128 _field_value | ||
| 640 | + )= | ||
| 641 | + fields <- [session_field(_field_name, word128_t, var(word128(_field_value))) . *fields] | ||
| 642 | +. | ||
| 643 | + | ||
| 644 | +public define One | ||
| 645 | + replace_Word128 | ||
| 646 | + ( | ||
| 647 | + Var(List(WEB_Session_Field)) fields, | ||
| 648 | + String _field_name, | ||
| 649 | + Word128 _field_value | ||
| 650 | + )= | ||
| 651 | + replace_any(fields, word128_t, _field_name, word128(_field_value)) | ||
| 652 | +. | ||
| 653 | + | ||
| 654 | +public define One | ||
| 655 | + remove_Word128 | ||
| 656 | + ( | ||
| 657 | + Var(List(WEB_Session_Field)) fields, | ||
| 658 | + String _field_name | ||
| 659 | + )= | ||
| 660 | + remove_any(fields, word128_t, _field_name) | ||
| 661 | +. | ||
| 662 | + | ||
| 663 | + /*************** Word64 *****************/ | ||
| 664 | + | ||
| 665 | + Maybe(Word64) get_Word64(fields, _field_name) | ||
| 666 | + Word64 get_Word64(fields, _field_name, default_value) | ||
| 667 | + | ||
| 668 | +public define Maybe(Word64) | ||
| 669 | + get_Word64 | ||
| 670 | + ( | ||
| 671 | + List(WEB_Session_Field) fields, | ||
| 672 | + String _field_name | ||
| 673 | + ) = | ||
| 674 | + if get_field(fields, word64_t, _field_name) is | ||
| 675 | + { | ||
| 676 | + failure then failure, | ||
| 677 | + success(datum) then | ||
| 678 | + if datum is word64(value) then | ||
| 679 | + success(value) | ||
| 680 | + else | ||
| 681 | + failure | ||
| 682 | + } | ||
| 683 | +. | ||
| 684 | + | ||
| 685 | +public define Word64 | ||
| 686 | + get_Word64 | ||
| 687 | + ( | ||
| 688 | + List(WEB_Session_Field) fields, | ||
| 689 | + String _field_name, | ||
| 690 | + Word64 default_value | ||
| 691 | + ) = | ||
| 692 | + if get_Word64(fields, _field_name) is | ||
| 693 | + { | ||
| 694 | + failure then default_value | ||
| 695 | + success(value) then value | ||
| 696 | + }. | ||
| 697 | + | ||
| 698 | +public define One | ||
| 699 | + put_Word64 | ||
| 700 | + ( | ||
| 701 | + Var(List(WEB_Session_Field)) fields, | ||
| 702 | + String _field_name, | ||
| 703 | + Word64 _field_value | ||
| 704 | + )= | ||
| 705 | + fields <- [session_field(_field_name, word64_t, var(word64(_field_value))) . *fields] | ||
| 706 | +. | ||
| 707 | + | ||
| 708 | +public define One | ||
| 709 | + replace_Word64 | ||
| 710 | + ( | ||
| 711 | + Var(List(WEB_Session_Field)) fields, | ||
| 712 | + String _field_name, | ||
| 713 | + Word64 _field_value | ||
| 714 | + )= | ||
| 715 | + replace_any(fields, word64_t, _field_name, word64(_field_value)) | ||
| 716 | +. | ||
| 717 | + | ||
| 718 | +public define One | ||
| 719 | + remove_Word64 | ||
| 720 | + ( | ||
| 721 | + Var(List(WEB_Session_Field)) fields, | ||
| 722 | + String _field_name | ||
| 723 | + )= | ||
| 724 | + remove_any(fields, word64_t, _field_name) | ||
| 725 | +. | ||
| 726 | + | ||
| 727 | + /*************** Word32 *****************/ | ||
| 728 | + | ||
| 729 | + Maybe(Word32) get_Word32(fields, _field_name) | ||
| 730 | + Word32 get_Word32(fields, _field_name, default_value) | ||
| 731 | + | ||
| 732 | +public define Maybe(Word32) | ||
| 733 | + get_Word32 | ||
| 734 | + ( | ||
| 735 | + List(WEB_Session_Field) fields, | ||
| 736 | + String _field_name | ||
| 737 | + ) = | ||
| 738 | + if get_field(fields, word32_t, _field_name) is | ||
| 739 | + { | ||
| 740 | + failure then failure, | ||
| 741 | + success(datum) then | ||
| 742 | + if datum is word32(value) then | ||
| 743 | + success(value) | ||
| 744 | + else | ||
| 745 | + failure | ||
| 746 | + } | ||
| 747 | +. | ||
| 748 | + | ||
| 749 | +public define Word32 | ||
| 750 | + get_Word32 | ||
| 751 | + ( | ||
| 752 | + List(WEB_Session_Field) fields, | ||
| 753 | + String _field_name, | ||
| 754 | + Word32 default_value | ||
| 755 | + ) = | ||
| 756 | + if get_Word32(fields, _field_name) is | ||
| 757 | + { | ||
| 758 | + failure then default_value | ||
| 759 | + success(value) then value | ||
| 760 | + }. | ||
| 761 | + | ||
| 762 | +public define One | ||
| 763 | + put_Word32 | ||
| 764 | + ( | ||
| 765 | + Var(List(WEB_Session_Field)) fields, | ||
| 766 | + String _field_name, | ||
| 767 | + Word32 _field_value | ||
| 768 | + )= | ||
| 769 | + fields <- [session_field(_field_name, word32_t, var(word32(_field_value))) . *fields] | ||
| 770 | +. | ||
| 771 | + | ||
| 772 | +public define One | ||
| 773 | + replace_Word32 | ||
| 774 | + ( | ||
| 775 | + Var(List(WEB_Session_Field)) fields, | ||
| 776 | + String _field_name, | ||
| 777 | + Word32 _field_value | ||
| 778 | + )= | ||
| 779 | + replace_any(fields, word32_t, _field_name, word32(_field_value)) | ||
| 780 | +. | ||
| 781 | + | ||
| 782 | +public define One | ||
| 783 | + remove_Word32 | ||
| 784 | + ( | ||
| 785 | + Var(List(WEB_Session_Field)) fields, | ||
| 786 | + String _field_name | ||
| 787 | + )= | ||
| 788 | + remove_any(fields, word32_t, _field_name) | ||
| 789 | +. | ||
| 790 | + | ||
| 791 | + /*************** Word16 *****************/ | ||
| 792 | + | ||
| 793 | + Maybe(Word16) get_Word16(fields, _field_name) | ||
| 794 | + Word16 get_Word16(fields, _field_name, default_value) | ||
| 795 | + | ||
| 796 | +public define Maybe(Word16) | ||
| 797 | + get_Word16 | ||
| 798 | + ( | ||
| 799 | + List(WEB_Session_Field) fields, | ||
| 800 | + String _field_name | ||
| 801 | + ) = | ||
| 802 | + if get_field(fields, word16_t, _field_name) is | ||
| 803 | + { | ||
| 804 | + failure then failure, | ||
| 805 | + success(datum) then | ||
| 806 | + if datum is word16(value) then | ||
| 807 | + success(value) | ||
| 808 | + else | ||
| 809 | + failure | ||
| 810 | + } | ||
| 811 | +. | ||
| 812 | + | ||
| 813 | +public define Word16 | ||
| 814 | + get_Word16 | ||
| 815 | + ( | ||
| 816 | + List(WEB_Session_Field) fields, | ||
| 817 | + String _field_name, | ||
| 818 | + Word16 default_value | ||
| 819 | + ) = | ||
| 820 | + if get_Word16(fields, _field_name) is | ||
| 821 | + { | ||
| 822 | + failure then default_value | ||
| 823 | + success(value) then value | ||
| 824 | + }. | ||
| 825 | + | ||
| 826 | +public define One | ||
| 827 | + put_Word16 | ||
| 828 | + ( | ||
| 829 | + Var(List(WEB_Session_Field)) fields, | ||
| 830 | + String _field_name, | ||
| 831 | + Word16 _field_value | ||
| 832 | + )= | ||
| 833 | + fields <- [session_field(_field_name, word16_t, var(word16(_field_value))) . *fields] | ||
| 834 | +. | ||
| 835 | + | ||
| 836 | +public define One | ||
| 837 | + replace_Word16 | ||
| 838 | + ( | ||
| 839 | + Var(List(WEB_Session_Field)) fields, | ||
| 840 | + String _field_name, | ||
| 841 | + Word16 _field_value | ||
| 842 | + )= | ||
| 843 | + replace_any(fields, word16_t, _field_name, word16(_field_value)) | ||
| 844 | +. | ||
| 845 | + | ||
| 846 | +public define One | ||
| 847 | + remove_Word16 | ||
| 848 | + ( | ||
| 849 | + Var(List(WEB_Session_Field)) fields, | ||
| 850 | + String _field_name | ||
| 851 | + )= | ||
| 852 | + remove_any(fields, word16_t, _field_name) | ||
| 853 | +. | ||
| 854 | + | ||
| 855 | + /*************** Word8 *****************/ | ||
| 856 | + | ||
| 857 | + Maybe(Word8) get_Word8(fields, _field_name) | ||
| 858 | + Word8 get_Word8(fields, _field_name, default_value) | ||
| 859 | + | ||
| 860 | +public define Maybe(Word8) | ||
| 861 | + get_Word8 | ||
| 862 | + ( | ||
| 863 | + List(WEB_Session_Field) fields, | ||
| 864 | + String _field_name | ||
| 865 | + ) = | ||
| 866 | + if get_field(fields, word8_t, _field_name) is | ||
| 867 | + { | ||
| 868 | + failure then failure, | ||
| 869 | + success(datum) then | ||
| 870 | + if datum is word8(value) then | ||
| 871 | + success(value) | ||
| 872 | + else | ||
| 873 | + failure | ||
| 874 | + } | ||
| 875 | +. | ||
| 876 | + | ||
| 877 | +public define Word8 | ||
| 878 | + get_Word8 | ||
| 879 | + ( | ||
| 880 | + List(WEB_Session_Field) fields, | ||
| 881 | + String _field_name, | ||
| 882 | + Word8 default_value | ||
| 883 | + ) = | ||
| 884 | + if get_Word8(fields, _field_name) is | ||
| 885 | + { | ||
| 886 | + failure then default_value | ||
| 887 | + success(value) then value | ||
| 888 | + }. | ||
| 889 | + | ||
| 890 | +public define One | ||
| 891 | + put_Word8 | ||
| 892 | + ( | ||
| 893 | + Var(List(WEB_Session_Field)) fields, | ||
| 894 | + String _field_name, | ||
| 895 | + Word8 _field_value | ||
| 896 | + )= | ||
| 897 | + fields <- [session_field(_field_name, word8_t, var(word8(_field_value))) . *fields] | ||
| 898 | +. | ||
| 899 | + | ||
| 900 | +public define One | ||
| 901 | + replace_Word8 | ||
| 902 | + ( | ||
| 903 | + Var(List(WEB_Session_Field)) fields, | ||
| 904 | + String _field_name, | ||
| 905 | + Word8 _field_value | ||
| 906 | + )= | ||
| 907 | + replace_any(fields, word8_t, _field_name, word8(_field_value)) | ||
| 908 | +. | ||
| 909 | + | ||
| 910 | +public define One | ||
| 911 | + remove_Word8 | ||
| 912 | + ( | ||
| 913 | + Var(List(WEB_Session_Field)) fields, | ||
| 914 | + String _field_name | ||
| 915 | + )= | ||
| 916 | + remove_any(fields, word8_t, _field_name) | ||
| 917 | +. | ||
| 918 | + | ||
| 919 | + /*************** Word4 *****************/ | ||
| 920 | + | ||
| 921 | + Maybe(Word4) get_Word4(fields, _field_name) | ||
| 922 | + Word4 get_Word4(fields, _field_name, default_value) | ||
| 923 | + | ||
| 924 | +public define Maybe(Word4) | ||
| 925 | + get_Word4 | ||
| 926 | + ( | ||
| 927 | + List(WEB_Session_Field) fields, | ||
| 928 | + String _field_name | ||
| 929 | + ) = | ||
| 930 | + if get_field(fields, word4_t, _field_name) is | ||
| 931 | + { | ||
| 932 | + failure then failure, | ||
| 933 | + success(datum) then | ||
| 934 | + if datum is word4(value) then | ||
| 935 | + success(value) | ||
| 936 | + else | ||
| 937 | + failure | ||
| 938 | + } | ||
| 939 | +. | ||
| 940 | + | ||
| 941 | +public define Word4 | ||
| 942 | + get_Word4 | ||
| 943 | + ( | ||
| 944 | + List(WEB_Session_Field) fields, | ||
| 945 | + String _field_name, | ||
| 946 | + Word4 default_value | ||
| 947 | + ) = | ||
| 948 | + if get_Word4(fields, _field_name) is | ||
| 949 | + { | ||
| 950 | + failure then default_value | ||
| 951 | + success(value) then value | ||
| 952 | + }. | ||
| 953 | + | ||
| 954 | +public define One | ||
| 955 | + put_Word4 | ||
| 956 | + ( | ||
| 957 | + Var(List(WEB_Session_Field)) fields, | ||
| 958 | + String _field_name, | ||
| 959 | + Word4 _field_value | ||
| 960 | + )= | ||
| 961 | + fields <- [session_field(_field_name, word4_t, var(word4(_field_value))) . *fields] | ||
| 962 | +. | ||
| 963 | + | ||
| 964 | +public define One | ||
| 965 | + replace_Word4 | ||
| 966 | + ( | ||
| 967 | + Var(List(WEB_Session_Field)) fields, | ||
| 968 | + String _field_name, | ||
| 969 | + Word4 _field_value | ||
| 970 | + )= | ||
| 971 | + replace_any(fields, word4_t, _field_name, word4(_field_value)) | ||
| 972 | +. | ||
| 973 | + | ||
| 974 | +public define One | ||
| 975 | + remove_Word4 | ||
| 976 | + ( | ||
| 977 | + Var(List(WEB_Session_Field)) fields, | ||
| 978 | + String _field_name | ||
| 979 | + )= | ||
| 980 | + remove_any(fields, word4_t, _field_name) | ||
| 981 | +. | ||
| 982 | + | ||
| 983 | +public define String | ||
| 984 | + dump_WEB_Session_Field | ||
| 985 | + ( | ||
| 986 | + WEB_Session_Field _field | ||
| 987 | + )= | ||
| 988 | + with name = "Name = ["+_field.field_name+"]", | ||
| 989 | + if *_field.field_datum is | ||
| 990 | + { | ||
| 991 | + string(_string) then name+", Type = String, Value = ["+_string+"]", | ||
| 992 | + bool(_bool) then name+", Type = Bool, Value = ["+to_String(_bool)+"]", | ||
| 993 | + int(_int) then name+", Type = Int, Value = ["+_int+"]", | ||
| 994 | + message(_message) then name+", Type = Message, Value = ["+dump(_message)+"]", | ||
| 995 | + byte_array(_byte_array) then name+", Type = ByteArray", | ||
| 996 | + float(_float) then name+", Type = Float, Value = ["+float_to_string(_float, 10)+"]", | ||
| 997 | + word128(_word128) then name+", Type = Word128, Value = ["+to_decimal(_word128)+"]", | ||
| 998 | + word64(_word64) then name+", Type = Word64, Value = ["+to_decimal(_word64)+"]", | ||
| 999 | + word32(_word32) then name+", Type = Word32, Value = ["+to_decimal(_word32)+"]", | ||
| 1000 | + word16(_word16) then name+", Type = Word16, Value = ["+to_decimal(_word16)+"]", | ||
| 1001 | + word8(_word8) then name+", Type = Word8, Value = ["+to_decimal(_word8)+"]", | ||
| 1002 | + word4(_word4) then name+", Type = Word4, Value = ["+to_decimal(_word4)+"]", | ||
| 1003 | + } | ||
| 1004 | +. | ||
| 1005 | + | ||
| 1006 | +public define String | ||
| 1007 | + dump_WEB_Session_Field_list | ||
| 1008 | + ( | ||
| 1009 | + List(WEB_Session_Field) _fields | ||
| 1010 | + )= | ||
| 1011 | + join("\n", map((WEB_Session_Field _field) |-> dump_WEB_Session_Field(_field), _fields)) | ||
| 1012 | +. | ||
| 1013 | + | ||
| 1014 | + | ||
| 1015 | +public define String | ||
| 1016 | + dump_WEB_Session_Fields | ||
| 1017 | + ( | ||
| 1018 | + List(WEB_Session_Field) _fields | ||
| 1019 | + )= | ||
| 1020 | + "\n"+ | ||
| 1021 | + "-- BEGIN Fields of Session:---------------- \n"+ | ||
| 1022 | + join("\n", map((WEB_Session_Field _field) |-> dump_WEB_Session_Field(_field), _fields))+ | ||
| 1023 | + "\n-- END Fields of Session:---------------- \n" | ||
| 1024 | +. | ||
| 1025 | + | ||
| 1026 | +public define String | ||
| 1027 | + dump_WEB_Session_Fields | ||
| 1028 | + ( | ||
| 1029 | + Var(List(WEB_Session_Field)) _fields | ||
| 1030 | + )= | ||
| 1031 | + dump_WEB_Session_Fields(*_fields) | ||
| 1032 | +. | ||
| 1033 | + | ||
| 1034 | + *---------------------- DUMP ------------------* | ||
| 1035 | + | ||
| 1036 | + String language, | ||
| 1037 | + List(WEB_Session_Field) fields, | ||
| 1038 | + WEB_Request web_request, | ||
| 1039 | + WEB_Request previous_web_request | ||
| 1040 | + | ||
| 1041 | +public define String | ||
| 1042 | + dump | ||
| 1043 | + ( | ||
| 1044 | + WEB_Session _session | ||
| 1045 | + )= | ||
| 1046 | + since _session is web_session(language, fields, web_request, previous_web_request), | ||
| 1047 | + "WEB Session Dump: \n"+ | ||
| 1048 | + "----------------- \n"+ | ||
| 1049 | + "Language : ["+language+"]\n\n"+ | ||
| 1050 | + dump_WEB_Session_Fields(*fields)+ | ||
| 1051 | + "-----------------------------------------------------------------------------\n"+ | ||
| 1052 | + "Current WEB REQUEST:\n"+ | ||
| 1053 | + "-----------------------------------------------------------------------------\n"+ | ||
| 1054 | + "http_info:\n"+ | ||
| 1055 | + dump_http_info(web_request.http_info)+"\n"+ | ||
| 1056 | + "web arguments:"+ | ||
| 1057 | + dump_web_arg_values(web_request.lwa)+"\n\n"+ | ||
| 1058 | + "-----------------------------------------------------------------------------\n"+ | ||
| 1059 | + "Previous WEB REQUEST:\n"+ | ||
| 1060 | + "-----------------------------------------------------------------------------\n"+ | ||
| 1061 | + "is https "+to_String(previous_web_request.is_https)+"\n"+ | ||
| 1062 | + "http_info:\n"+ | ||
| 1063 | + dump_http_info(previous_web_request.http_info)+"\n"+ | ||
| 1064 | + "web arguments:"+ | ||
| 1065 | + dump_web_arg_values(previous_web_request.lwa)+"\n" | ||
| 1066 | + | ||
| 1067 | +. |
web/jQuery/CXM_jquery_button.anubis
| @@ -287,7 +287,7 @@ public define HTML_Partial_Content | @@ -287,7 +287,7 @@ public define HTML_Partial_Content | ||
| 287 | cancel: " + to_JS_String(dlg_cancel) + "};", | 287 | cancel: " + to_JS_String(dlg_cancel) + "};", |
| 288 | 288 | ||
| 289 | button_name = uid, | 289 | button_name = uid, |
| 290 | - _actioner = jQuery_actioner(same, jqscript, "CalexiumToolBox.make_confirm_dialog(this, " /*+ to_js_string("/?a=" + url + format_extra_operands(extra_ops))+*/ + to_JS_String(jquery_button_get_onclick_action(actioner)) + ");"), | 290 | + _actioner = jQuery_actioner(same, jqscript("CalexiumToolBox.make_confirm_dialog(this, " /*+ to_js_string("/?a=" + url + format_extra_operands(extra_ops))+*/ + to_JS_String(jquery_button_get_onclick_action(actioner)) + ");")), |
| 291 | 291 | ||
| 292 | partial_content([js(js_file("js/cxm/cxm.js")), js_inline(jquery_ready(js_data))],sequence([ | 292 | partial_content([js(js_file("js/cxm/cxm.js")), js_inline(jquery_ready(js_data))],sequence([ |
| 293 | partial(jquery_button(jQuery_button(button, uid, button_name, button_label, _actioner, jq_icon_none, jq_icon_none))) | 293 | partial(jquery_button(jQuery_button(button, uid, button_name, button_label, _actioner, jq_icon_none, jq_icon_none))) |
| @@ -316,7 +316,7 @@ public define HTML_Partial_Content | @@ -316,7 +316,7 @@ public define HTML_Partial_Content | ||
| 316 | cancel: " + to_JS_String(dlg_cancel) + "};", | 316 | cancel: " + to_JS_String(dlg_cancel) + "};", |
| 317 | 317 | ||
| 318 | _button_name = uid, | 318 | _button_name = uid, |
| 319 | - _actioner = jQuery_actioner(same, jqscript, "CalexiumToolBox.make_confirm_dialog(this, " + to_JS_String(jquery_button_get_onclick_action(actioner)) +");"), | 319 | + _actioner = jQuery_actioner(same, jqscript("CalexiumToolBox.make_confirm_dialog(this, " + to_JS_String(jquery_button_get_onclick_action(actioner)) +");")), |
| 320 | 320 | ||
| 321 | partial_content([js(js_file("js/cxm/cxm.js")), js_inline(jquery_ready(js_data))],sequence([ | 321 | partial_content([js(js_file("js/cxm/cxm.js")), js_inline(jquery_ready(js_data))],sequence([ |
| 322 | partial(jquery_button(jquery_img_button(img_url, button_label, _button_name, _actioner, orientation))) | 322 | partial(jquery_button(jquery_img_button(img_url, button_label, _button_name, _actioner, orientation))) |
| @@ -328,13 +328,13 @@ public define HTML_Partial_Content | @@ -328,13 +328,13 @@ public define HTML_Partial_Content | ||
| 328 | String label, //translated label of the button | 328 | String label, //translated label of the button |
| 329 | String form_id // | 329 | String form_id // |
| 330 | )= | 330 | )= |
| 331 | - jquery_button(jquery_img_button(icn16_check, label, "", jQuery_actioner(same, jqform, form_id), left)). | 331 | + jquery_button(jquery_img_button(icn16_check, label, "", jQuery_actioner(same, jqform(form_id)), left)). |
| 332 | 332 | ||
| 333 | public define HTML_Partial_Content | 333 | public define HTML_Partial_Content |
| 334 | img_button | 334 | img_button |
| 335 | ( | 335 | ( |
| 336 | String icon, | 336 | String icon, |
| 337 | String label, //translated label of the button | 337 | String label, //translated label of the button |
| 338 | - String action | 338 | + WEB_Action_Name action |
| 339 | )= | 339 | )= |
| 340 | - jquery_button(jquery_img_button(icon, label, "", jQuery_actioner(same, jqlink, action), left)). | 340 | + jquery_button(jquery_img_button(icon, label, "", jQuery_actioner(same, jqlink(action)), left)). |
web/jQuery/CXM_jquery_dialog.anubis
| @@ -16,7 +16,7 @@ public type JQuery_dialog_id: | @@ -16,7 +16,7 @@ public type JQuery_dialog_id: | ||
| 16 | public type JQuery_dialog: | 16 | public type JQuery_dialog: |
| 17 | p_content(HTML_Partial_Content content), | 17 | p_content(HTML_Partial_Content content), |
| 18 | off_form(HTML_Off_Form o_form), | 18 | off_form(HTML_Off_Form o_form), |
| 19 | - ajax(String url). | 19 | + ajax(WEB_Action_Name url). |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | public define HTML_Partial_Content | 22 | public define HTML_Partial_Content |
| @@ -43,12 +43,13 @@ public define HTML_Partial_Content | @@ -43,12 +43,13 @@ public define HTML_Partial_Content | ||
| 43 | 43 | ||
| 44 | if content is | 44 | if content is |
| 45 | { | 45 | { |
| 46 | - p_content(pc) then | 46 | + p_content(pc) then |
| 47 | if pc is partial_content(tags, html) then | 47 | if pc is partial_content(tags, html) then |
| 48 | partial_content( [js . tags ], html), //html code of the dialog | 48 | partial_content( [js . tags ], html), //html code of the dialog |
| 49 | off_form(html) then | 49 | off_form(html) then |
| 50 | partial_content( [js], html), //html code of the dialog | 50 | partial_content( [js], html), //html code of the dialog |
| 51 | - ajax(url) then | 51 | + ajax(_url) then |
| 52 | + with url = format_web_action_name(_url), | ||
| 52 | partial_content( [js], div_empty([id(dlg_id), attr("ajax_url",url)])) | 53 | partial_content( [js], div_empty([id(dlg_id), attr("ajax_url",url)])) |
| 53 | }. | 54 | }. |
| 54 | 55 |
web/widgets/left_menu.anubis
| @@ -12,10 +12,10 @@ read system/string.anubis | @@ -12,10 +12,10 @@ read system/string.anubis | ||
| 12 | 12 | ||
| 13 | public type Left_Menu_Entry: | 13 | public type Left_Menu_Entry: |
| 14 | left_menu_entry( //MENU entry hence no selectable | 14 | left_menu_entry( //MENU entry hence no selectable |
| 15 | - String entry_id, //it's also use as icon prefix | ||
| 16 | - List(String) classes, //additional classes if need (for disabling entry, change background color, etc.) | ||
| 17 | - String action, //action (url to apply when click | ||
| 18 | - String text, //text to show | 15 | + String entry_id, //it's also use as icon prefix |
| 16 | + List(String) classes, //additional classes if need (for disabling entry, change background color, etc.) | ||
| 17 | + WEB_Action_Name action, //action (url to apply when click | ||
| 18 | + String text, //text to show | ||
| 19 | List((String, String)) extra //extra web arguments to send when click | 19 | List((String, String)) extra //extra web arguments to send when click |
| 20 | ), | 20 | ), |
| 21 | title( //TITLE entry hence no selectable | 21 | title( //TITLE entry hence no selectable |
| @@ -33,9 +33,9 @@ public type Left_Menu: | @@ -33,9 +33,9 @@ public type Left_Menu: | ||
| 33 | public define Left_Menu_Entry | 33 | public define Left_Menu_Entry |
| 34 | left_menu_entry | 34 | left_menu_entry |
| 35 | ( | 35 | ( |
| 36 | - String entry_id, | ||
| 37 | - String action, | ||
| 38 | - String text | 36 | + String entry_id, |
| 37 | + WEB_Action_Name action, | ||
| 38 | + String text | ||
| 39 | )= | 39 | )= |
| 40 | left_menu_entry(entry_id, [], action, text, []) | 40 | left_menu_entry(entry_id, [], action, text, []) |
| 41 | . | 41 | . |
| @@ -43,9 +43,9 @@ public define Left_Menu_Entry | @@ -43,9 +43,9 @@ public define Left_Menu_Entry | ||
| 43 | public define Left_Menu_Entry | 43 | public define Left_Menu_Entry |
| 44 | left_menu_entry | 44 | left_menu_entry |
| 45 | ( | 45 | ( |
| 46 | - String entry_id, //it's also use as icon prefix | ||
| 47 | - String action, //action (url to apply when click | ||
| 48 | - String text, //text to show | 46 | + String entry_id, //it's also use as icon prefix |
| 47 | + WEB_Action_Name action, //action (url to apply when click | ||
| 48 | + String text, //text to show | ||
| 49 | List((String, String)) extra //extra web arguments to send when click | 49 | List((String, String)) extra //extra web arguments to send when click |
| 50 | )= | 50 | )= |
| 51 | left_menu_entry(entry_id, [], action, text, extra) | 51 | left_menu_entry(entry_id, [], action, text, extra) |