diff --git a/web/CXM_making_a_web_site.anubis b/web/CXM_making_a_web_site.anubis index d650161..233114d 100644 --- a/web/CXM_making_a_web_site.anubis +++ b/web/CXM_making_a_web_site.anubis @@ -1048,13 +1048,14 @@ public type HTML_Head_Tag: * - a List of HTML_Head_Tag representing necessaries head tags for the content. ex: jquery js files, js script, css specific styles, ... * - a HTML_Off_Form representing the HTML code for the part of the page we want to display */ +public type HTML_In_Form:... + public type HTML_Partial_Content: partial_content ( List(HTML_Head_Tag), HTML_Off_Form - ) - . + ). public define List(HTML_Head_Tag) @@ -1295,7 +1296,9 @@ public type HTML_Off_Form: form (HtmlId form_id, List(CoreAttrs), String action_name, List((String,String)) extra_ops, HTML_In_Form content), + in_form (HtmlId form_id, HTML_In_Form content), div (List(CoreAttrs), HTML_Off_Form content), + div (List(CoreAttrs), HTML_Partial_Content p_content), div_empty (List(CoreAttrs)), iframe (List(CoreAttrs), List(CSS_Style) /*styles*/, @@ -1602,14 +1605,14 @@ public type HTTP_Answer: plain_text (HTTP_Status /*http_status*/, String /*text*/), custom_text (HTTP_Status /*http_status*/, - String /*mime_type*/, + MIME /*mime_type*/, String /*content*/), custom_binary(HTTP_Status /*http_status*/, - String /*mime_type*/, + MIME /*mime_type*/, ByteArray /*content*/, List(HTTP_header)/*other headers*/), custom_tree (HTTP_Status /*http_status*/, - String /*mime_type*/, + MIME /*mime_type*/, Printable_tree /*content*/), http_raw (Printable_tree), html_content (HTTP_Status /*http_status*/, @@ -1826,7 +1829,7 @@ public define HTTP_Answer *** [5.10] Formating meta-tags. --------------------------------------------------------------------------------------- -type CommonInfo:... +public type CommonInfo:... define Printable_tree format @@ -2394,7 +2397,7 @@ define List(HTTP_header) public define Web_Site make_web_site_description ( - String website_name, + String website_name, // site_UID List(String) common_names, // for example: ["www.our-business.com"] String site_directory, String state_directory, @@ -4486,11 +4489,18 @@ define Printable_tree if fn is htmlId(id) then format(cinfo,id,sn,ic_v,c,is_https, action_count, head_tags), "" - ] + ], + in_form(fn, content) then + if fn is htmlId(id) then + format(cinfo,id,sn,ic_v, content,is_https, action_count, head_tags), div(options, e) then - format(cinfo,sn,ic_v,any_div(options, e),format_element,is_https, action_count, head_tags), + format(cinfo, sn, ic_v, any_div(options, e), format_element, is_https, action_count, head_tags), + div(options, p_content) then + if p_content is partial_content(tags, html_elements) then + head_tags <- tags + *head_tags; + format(cinfo, sn, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags), div_empty(options) then - format(cinfo,sn,ic_v,any_div_empty(options),format_element,is_https, action_count, head_tags), + format(cinfo, sn, ic_v, any_div_empty(options), format_element, is_https, action_count, head_tags), iframe(options, css_styles, css_files, js_files, body) then if body is body(body_options,element) then [ "\n", @@ -4640,7 +4650,53 @@ public define Printable_tree _format_html_head(lwf, []) } . - + +public type HTML_ajax_content: + html_ajax_content( String html_body, String script, List(String) js_file, List(String) css_file). + +public define HTML_ajax_content + sort_head_tag + ( + List(HTML_Head_Tag) lwf, + String script, + List(String) js_file, + List(String) css_file + )= + if lwf is + { + [] then html_ajax_content("", script, reverse(js_file), reverse(css_file)), + [ h . t ] then + if h is + { + meta(meta) then sort_head_tag(t, script, js_file, css_file), + title(title) then sort_head_tag(t, script, js_file, css_file), + js(jsf) then sort_head_tag(t, script, [file_name(jsf) . js_file], css_file), + js_inline(jsi) then sort_head_tag(t, script + content(jsi), js_file, css_file), + css(cssf) then sort_head_tag(t, script, js_file, [file_name(cssf) . css_file]), + css_inline(cssi) then sort_head_tag(t, script, js_file, css_file) + } + }. + +public define HTML_ajax_content + to_html_ajax_content + ( + HTML_Off_Form content_HTML, + CommonInfo cinfo, + String state_name + )= + with p_content_head_tags = var((List(HTML_Head_Tag))[]), + with content = format(cinfo, state_name, var((Int)0), content_HTML, false, var(0), p_content_head_tags), + if sort_head_tag(*p_content_head_tags, "", [], []) is html_ajax_content(_, script, js_file, css_file) then + html_ajax_content(to_String(content), script, js_file, css_file). + +public define HTML_ajax_content + to_html_ajax_content + ( + HTML_Off_Form content_HTML, + CommonInfo cinfo + )= to_html_ajax_content(content_HTML, cinfo, ""). + + public define Printable_tree format ( @@ -4735,21 +4791,21 @@ public define Printable_tree text . (Printable_tree)[] ], - custom_text(HTTP_Status status, String mime_type, String content) then + custom_text(HTTP_Status status, mime_type, String content) then if format(status) is (status_string, status_headers) then [ "HTTP/1.1 " + status_string, crlf, format_headers(standard_headers), - format_headers(standard_headers_for(mime_type, length(content), success(charset))), + format_headers(standard_headers_for(to_String(mime_type), length(content), success(charset))), format_headers(status_headers), format_headers(additional_headers), crlf, content . (Printable_tree)[] ], - custom_binary(HTTP_Status status, String mime_type, ByteArray content, List(HTTP_header) other_headers) then + custom_binary(HTTP_Status status, mime_type, ByteArray content, List(HTTP_header) other_headers) then if format(status) is (status_string, status_headers) then [ "HTTP/1.1 " + status_string, crlf, format_headers(status_headers), - format_headers(standard_headers_for(mime_type, length(content), failure)), + format_headers(standard_headers_for(to_String(mime_type), length(content), failure)), format_headers(status_headers), format_headers(other_headers), format_headers(additional_headers), @@ -4757,11 +4813,11 @@ public define Printable_tree content . (Printable_tree)[] ], - custom_tree(HTTP_Status status, String mime_type, Printable_tree content) then + custom_tree(HTTP_Status status, mime_type, Printable_tree content) then if format(status) is (status_string, status_headers) then [ "HTTP/1.1 " + status_string, crlf, format_headers(standard_headers), - format_headers(standard_headers_for(mime_type, length(content), success(charset))), + format_headers(standard_headers_for(to_String(mime_type), length(content), success(charset))), format_headers(status_headers), format_headers(additional_headers), crlf . diff --git a/web/jQuery/CXM_jquery_dialog.anubis b/web/jQuery/CXM_jquery_dialog.anubis index efe3857..01bb241 100644 --- a/web/jQuery/CXM_jquery_dialog.anubis +++ b/web/jQuery/CXM_jquery_dialog.anubis @@ -65,7 +65,7 @@ define String JQuery_dialog_id dialog_id, String params )= - with js_function = "jquery_dialog_click('"+id(dialog_id)+"', "+(if length(params)=0 then "''" else params) +");", + with js_function = "CalexiumToolBox.jquery_dialog_click('"+id(dialog_id)+"', "+(if length(params)=0 then "''" else params) +");", if mb_html is { failure then js_function, @@ -93,22 +93,7 @@ public define List(HTML_Head_Tag) = [ js_inline(jquery_ready(" - jquery_dialog_click = function (dialog_id, url_args) { - var dialog_elem = $('#'+dialog_id); - if (dialog_elem.is('[ajax_url]')) { - $.ajax({ - url: $('#'+dialog_id).attr('ajax_url')+((url_args !== '')?'&':'')+url_args - }).done(function (data) { - var dialog_elem = $('#'+dialog_id); - - dialog_elem.html(data); - dialog_elem.dialog('open'); - }); - return; - } - - dialog_elem.dialog('open'); - }; + ")) ]. diff --git a/web/jQuery/CXM_jquery_tabs.anubis b/web/jQuery/CXM_jquery_tabs.anubis index 7e98643..b1c34b2 100644 --- a/web/jQuery/CXM_jquery_tabs.anubis +++ b/web/jQuery/CXM_jquery_tabs.anubis @@ -26,7 +26,6 @@ public define JQuery_tab )= jQuery_tab(title, partial_content([], content)). - define HTML_Partial_Content _jquery_tabs ( -- libgit2 0.21.4