diff --git a/calexium_lib/web/CXM_making_a_web_site.anubis b/calexium_lib/web/CXM_making_a_web_site.anubis index 4107b50..e552b6d 100644 --- a/calexium_lib/web/CXM_making_a_web_site.anubis +++ b/calexium_lib/web/CXM_making_a_web_site.anubis @@ -2704,7 +2704,7 @@ public define Printable_tree variable Int32 count = 0. Note: this counter is private to the virtual machine, hence there is one counter by - client. + client and by page : it seems that a new VM (simply a delegate) is started for each request. define Int32 new_count @@ -2764,14 +2764,6 @@ type URL_or_JavaScript: url (String), javascript (Printable_tree script, Printable_tree handler). - define URL_or_JavaScript - format_action - ( - String the_url, - Maybe(String) mb_form_name - ) = - url(the_url). - It was as shown below, in order to allow submission of a form from outside the form, but this makes problems: @@ -2780,6 +2772,7 @@ define URL_or_JavaScript format_action ( String the_url, + Maybe(String) mb_id, Maybe(String) mb_form_name ) = if mb_form_name is @@ -2788,17 +2781,22 @@ define URL_or_JavaScript url(the_url), success(form_name) then with n = new_count, + fn_name = "pfu_" + if mb_id is + { + failure then form_name + n, + success(id) then id, + }, javascript( [ "" ], - ["pfu",form_name,n,"();"] + [fn_name,"();"] ) }. @@ -3010,7 +3008,35 @@ define Printable_tree )= [""] . - + +define Maybe(String) + extract_id + ( + List(CoreAttrs) attrbs + ) = + if attrbs is + { + [] then failure, + [h . t] then + if h is id(value) then success(value) + else extract_id(t) + }. + +define Maybe(String) + extract_id + ( + Actioner_Aspect aspect + ) = + if aspect is + { + link(_,_) then failure, + push_button(opts,_) then extract_id(opts), + submit(opts,_) then extract_id(opts), + button(_,_) then failure, + button(_,_,_,_) then failure, + immediate_selector(_,_,_) then failure, + }. + define Printable_tree format_actioner ( @@ -3028,7 +3054,7 @@ define Printable_tree if cinfo is info(common_name,http_port,https_port,site_dir,secret) then with url = make_actioner_url(cinfo,connection,target, state_name,action_name,extra_ops,is_https), - with action = format_action(url,mb_form_name), + with action = format_action(url, extract_id(aspect), mb_form_name), if aspect is { @@ -3514,7 +3540,7 @@ define Printable_tree ]. - +/* define Printable_tree popup_topbar ( @@ -3569,7 +3595,7 @@ define Printable_tree result. - +*/ // The function below formats a datum of type 'HTML_Any($T)'. @@ -3856,7 +3882,7 @@ define Printable_tree private_download(url,name,extra,action) then format(cinfo,sn,ic_v,any_private_download(url,name,extra,action),format_element,is_https), label(n) then [""], - form(fn,attributs, c) then + form(fn,attributs, c) then [ "