Commit db16493adc78ec9900542b5c04032393af1a1d07
1 parent
aba83952
add alternative to HTML_Off_Form:
- in_form for HTML_In_Form - div (..., HTML_Partial_Content p_content) The custom_text, custom_binary and custom_tree has MIME type instead of String add to_html_ajax_content which return an html_ajax_content from HTML_Off_Form
Showing
3 changed files
with
75 additions
and
35 deletions
Show diff stats
web/CXM_making_a_web_site.anubis
| @@ -1048,13 +1048,14 @@ public type HTML_Head_Tag: | @@ -1048,13 +1048,14 @@ public type HTML_Head_Tag: | ||
| 1048 | * - a List of HTML_Head_Tag representing necessaries head tags for the content. ex: jquery js files, js script, css specific styles, ... | 1048 | * - a List of HTML_Head_Tag representing necessaries head tags for the content. ex: jquery js files, js script, css specific styles, ... |
| 1049 | * - a HTML_Off_Form representing the HTML code for the part of the page we want to display | 1049 | * - a HTML_Off_Form representing the HTML code for the part of the page we want to display |
| 1050 | */ | 1050 | */ |
| 1051 | +public type HTML_In_Form:... | ||
| 1052 | + | ||
| 1051 | public type HTML_Partial_Content: | 1053 | public type HTML_Partial_Content: |
| 1052 | partial_content | 1054 | partial_content |
| 1053 | ( | 1055 | ( |
| 1054 | List(HTML_Head_Tag), | 1056 | List(HTML_Head_Tag), |
| 1055 | HTML_Off_Form | 1057 | HTML_Off_Form |
| 1056 | - ) | ||
| 1057 | - . | 1058 | + ). |
| 1058 | 1059 | ||
| 1059 | 1060 | ||
| 1060 | public define List(HTML_Head_Tag) | 1061 | public define List(HTML_Head_Tag) |
| @@ -1295,7 +1296,9 @@ public type HTML_Off_Form: | @@ -1295,7 +1296,9 @@ public type HTML_Off_Form: | ||
| 1295 | form (HtmlId form_id, List(CoreAttrs), | 1296 | form (HtmlId form_id, List(CoreAttrs), |
| 1296 | String action_name, List((String,String)) extra_ops, | 1297 | String action_name, List((String,String)) extra_ops, |
| 1297 | HTML_In_Form content), | 1298 | HTML_In_Form content), |
| 1299 | + in_form (HtmlId form_id, HTML_In_Form content), | ||
| 1298 | div (List(CoreAttrs), HTML_Off_Form content), | 1300 | div (List(CoreAttrs), HTML_Off_Form content), |
| 1301 | + div (List(CoreAttrs), HTML_Partial_Content p_content), | ||
| 1299 | div_empty (List(CoreAttrs)), | 1302 | div_empty (List(CoreAttrs)), |
| 1300 | iframe (List(CoreAttrs), | 1303 | iframe (List(CoreAttrs), |
| 1301 | List(CSS_Style) /*styles*/, | 1304 | List(CSS_Style) /*styles*/, |
| @@ -1602,14 +1605,14 @@ public type HTTP_Answer: | @@ -1602,14 +1605,14 @@ public type HTTP_Answer: | ||
| 1602 | plain_text (HTTP_Status /*http_status*/, | 1605 | plain_text (HTTP_Status /*http_status*/, |
| 1603 | String /*text*/), | 1606 | String /*text*/), |
| 1604 | custom_text (HTTP_Status /*http_status*/, | 1607 | custom_text (HTTP_Status /*http_status*/, |
| 1605 | - String /*mime_type*/, | 1608 | + MIME /*mime_type*/, |
| 1606 | String /*content*/), | 1609 | String /*content*/), |
| 1607 | custom_binary(HTTP_Status /*http_status*/, | 1610 | custom_binary(HTTP_Status /*http_status*/, |
| 1608 | - String /*mime_type*/, | 1611 | + MIME /*mime_type*/, |
| 1609 | ByteArray /*content*/, | 1612 | ByteArray /*content*/, |
| 1610 | List(HTTP_header)/*other headers*/), | 1613 | List(HTTP_header)/*other headers*/), |
| 1611 | custom_tree (HTTP_Status /*http_status*/, | 1614 | custom_tree (HTTP_Status /*http_status*/, |
| 1612 | - String /*mime_type*/, | 1615 | + MIME /*mime_type*/, |
| 1613 | Printable_tree /*content*/), | 1616 | Printable_tree /*content*/), |
| 1614 | http_raw (Printable_tree), | 1617 | http_raw (Printable_tree), |
| 1615 | html_content (HTTP_Status /*http_status*/, | 1618 | html_content (HTTP_Status /*http_status*/, |
| @@ -1826,7 +1829,7 @@ public define HTTP_Answer | @@ -1826,7 +1829,7 @@ public define HTTP_Answer | ||
| 1826 | *** [5.10] Formating meta-tags. | 1829 | *** [5.10] Formating meta-tags. |
| 1827 | 1830 | ||
| 1828 | --------------------------------------------------------------------------------------- | 1831 | --------------------------------------------------------------------------------------- |
| 1829 | -type CommonInfo:... | 1832 | +public type CommonInfo:... |
| 1830 | 1833 | ||
| 1831 | define Printable_tree | 1834 | define Printable_tree |
| 1832 | format | 1835 | format |
| @@ -2394,7 +2397,7 @@ define List(HTTP_header) | @@ -2394,7 +2397,7 @@ define List(HTTP_header) | ||
| 2394 | public define Web_Site | 2397 | public define Web_Site |
| 2395 | make_web_site_description | 2398 | make_web_site_description |
| 2396 | ( | 2399 | ( |
| 2397 | - String website_name, | 2400 | + String website_name, // site_UID |
| 2398 | List(String) common_names, // for example: ["www.our-business.com"] | 2401 | List(String) common_names, // for example: ["www.our-business.com"] |
| 2399 | String site_directory, | 2402 | String site_directory, |
| 2400 | String state_directory, | 2403 | String state_directory, |
| @@ -4486,11 +4489,18 @@ define Printable_tree | @@ -4486,11 +4489,18 @@ define Printable_tree | ||
| 4486 | if fn is htmlId(id) then | 4489 | if fn is htmlId(id) then |
| 4487 | format(cinfo,id,sn,ic_v,c,is_https, action_count, head_tags), | 4490 | format(cinfo,id,sn,ic_v,c,is_https, action_count, head_tags), |
| 4488 | "</form>" | 4491 | "</form>" |
| 4489 | - ] | 4492 | + ], |
| 4493 | + in_form(fn, content) then | ||
| 4494 | + if fn is htmlId(id) then | ||
| 4495 | + format(cinfo,id,sn,ic_v, content,is_https, action_count, head_tags), | ||
| 4490 | div(options, e) then | 4496 | div(options, e) then |
| 4491 | - format(cinfo,sn,ic_v,any_div(options, e),format_element,is_https, action_count, head_tags), | 4497 | + format(cinfo, sn, ic_v, any_div(options, e), format_element, is_https, action_count, head_tags), |
| 4498 | + div(options, p_content) then | ||
| 4499 | + if p_content is partial_content(tags, html_elements) then | ||
| 4500 | + head_tags <- tags + *head_tags; | ||
| 4501 | + format(cinfo, sn, ic_v, any_div(options, html_elements), format_element, is_https, action_count, head_tags), | ||
| 4492 | div_empty(options) then | 4502 | div_empty(options) then |
| 4493 | - format(cinfo,sn,ic_v,any_div_empty(options),format_element,is_https, action_count, head_tags), | 4503 | + format(cinfo, sn, ic_v, any_div_empty(options), format_element, is_https, action_count, head_tags), |
| 4494 | iframe(options, css_styles, css_files, js_files, body) then | 4504 | iframe(options, css_styles, css_files, js_files, body) then |
| 4495 | if body is body(body_options,element) then | 4505 | if body is body(body_options,element) then |
| 4496 | [ "<iframe", format_attrs(options), ">\n", | 4506 | [ "<iframe", format_attrs(options), ">\n", |
| @@ -4640,7 +4650,53 @@ public define Printable_tree | @@ -4640,7 +4650,53 @@ public define Printable_tree | ||
| 4640 | _format_html_head(lwf, []) | 4650 | _format_html_head(lwf, []) |
| 4641 | } | 4651 | } |
| 4642 | . | 4652 | . |
| 4643 | - | 4653 | + |
| 4654 | +public type HTML_ajax_content: | ||
| 4655 | + html_ajax_content( String html_body, String script, List(String) js_file, List(String) css_file). | ||
| 4656 | + | ||
| 4657 | +public define HTML_ajax_content | ||
| 4658 | + sort_head_tag | ||
| 4659 | + ( | ||
| 4660 | + List(HTML_Head_Tag) lwf, | ||
| 4661 | + String script, | ||
| 4662 | + List(String) js_file, | ||
| 4663 | + List(String) css_file | ||
| 4664 | + )= | ||
| 4665 | + if lwf is | ||
| 4666 | + { | ||
| 4667 | + [] then html_ajax_content("", script, reverse(js_file), reverse(css_file)), | ||
| 4668 | + [ h . t ] then | ||
| 4669 | + if h is | ||
| 4670 | + { | ||
| 4671 | + meta(meta) then sort_head_tag(t, script, js_file, css_file), | ||
| 4672 | + title(title) then sort_head_tag(t, script, js_file, css_file), | ||
| 4673 | + js(jsf) then sort_head_tag(t, script, [file_name(jsf) . js_file], css_file), | ||
| 4674 | + js_inline(jsi) then sort_head_tag(t, script + content(jsi), js_file, css_file), | ||
| 4675 | + css(cssf) then sort_head_tag(t, script, js_file, [file_name(cssf) . css_file]), | ||
| 4676 | + css_inline(cssi) then sort_head_tag(t, script, js_file, css_file) | ||
| 4677 | + } | ||
| 4678 | + }. | ||
| 4679 | + | ||
| 4680 | +public define HTML_ajax_content | ||
| 4681 | + to_html_ajax_content | ||
| 4682 | + ( | ||
| 4683 | + HTML_Off_Form content_HTML, | ||
| 4684 | + CommonInfo cinfo, | ||
| 4685 | + String state_name | ||
| 4686 | + )= | ||
| 4687 | + with p_content_head_tags = var((List(HTML_Head_Tag))[]), | ||
| 4688 | + with content = format(cinfo, state_name, var((Int)0), content_HTML, false, var(0), p_content_head_tags), | ||
| 4689 | + if sort_head_tag(*p_content_head_tags, "", [], []) is html_ajax_content(_, script, js_file, css_file) then | ||
| 4690 | + html_ajax_content(to_String(content), script, js_file, css_file). | ||
| 4691 | + | ||
| 4692 | +public define HTML_ajax_content | ||
| 4693 | + to_html_ajax_content | ||
| 4694 | + ( | ||
| 4695 | + HTML_Off_Form content_HTML, | ||
| 4696 | + CommonInfo cinfo | ||
| 4697 | + )= to_html_ajax_content(content_HTML, cinfo, ""). | ||
| 4698 | + | ||
| 4699 | + | ||
| 4644 | public define Printable_tree | 4700 | public define Printable_tree |
| 4645 | format | 4701 | format |
| 4646 | ( | 4702 | ( |
| @@ -4735,21 +4791,21 @@ public define Printable_tree | @@ -4735,21 +4791,21 @@ public define Printable_tree | ||
| 4735 | text . (Printable_tree)[] | 4791 | text . (Printable_tree)[] |
| 4736 | ], | 4792 | ], |
| 4737 | 4793 | ||
| 4738 | - custom_text(HTTP_Status status, String mime_type, String content) then | 4794 | + custom_text(HTTP_Status status, mime_type, String content) then |
| 4739 | if format(status) is (status_string, status_headers) then | 4795 | if format(status) is (status_string, status_headers) then |
| 4740 | [ "HTTP/1.1 " + status_string, crlf, | 4796 | [ "HTTP/1.1 " + status_string, crlf, |
| 4741 | format_headers(standard_headers), | 4797 | format_headers(standard_headers), |
| 4742 | - format_headers(standard_headers_for(mime_type, length(content), success(charset))), | 4798 | + format_headers(standard_headers_for(to_String(mime_type), length(content), success(charset))), |
| 4743 | format_headers(status_headers), | 4799 | format_headers(status_headers), |
| 4744 | format_headers(additional_headers), | 4800 | format_headers(additional_headers), |
| 4745 | crlf, | 4801 | crlf, |
| 4746 | content . (Printable_tree)[] | 4802 | content . (Printable_tree)[] |
| 4747 | ], | 4803 | ], |
| 4748 | - custom_binary(HTTP_Status status, String mime_type, ByteArray content, List(HTTP_header) other_headers) then | 4804 | + custom_binary(HTTP_Status status, mime_type, ByteArray content, List(HTTP_header) other_headers) then |
| 4749 | if format(status) is (status_string, status_headers) then | 4805 | if format(status) is (status_string, status_headers) then |
| 4750 | [ "HTTP/1.1 " + status_string, crlf, | 4806 | [ "HTTP/1.1 " + status_string, crlf, |
| 4751 | format_headers(status_headers), | 4807 | format_headers(status_headers), |
| 4752 | - format_headers(standard_headers_for(mime_type, length(content), failure)), | 4808 | + format_headers(standard_headers_for(to_String(mime_type), length(content), failure)), |
| 4753 | format_headers(status_headers), | 4809 | format_headers(status_headers), |
| 4754 | format_headers(other_headers), | 4810 | format_headers(other_headers), |
| 4755 | format_headers(additional_headers), | 4811 | format_headers(additional_headers), |
| @@ -4757,11 +4813,11 @@ public define Printable_tree | @@ -4757,11 +4813,11 @@ public define Printable_tree | ||
| 4757 | content . (Printable_tree)[] | 4813 | content . (Printable_tree)[] |
| 4758 | ], | 4814 | ], |
| 4759 | 4815 | ||
| 4760 | - custom_tree(HTTP_Status status, String mime_type, Printable_tree content) then | 4816 | + custom_tree(HTTP_Status status, mime_type, Printable_tree content) then |
| 4761 | if format(status) is (status_string, status_headers) then | 4817 | if format(status) is (status_string, status_headers) then |
| 4762 | [ "HTTP/1.1 " + status_string, crlf, | 4818 | [ "HTTP/1.1 " + status_string, crlf, |
| 4763 | format_headers(standard_headers), | 4819 | format_headers(standard_headers), |
| 4764 | - format_headers(standard_headers_for(mime_type, length(content), success(charset))), | 4820 | + format_headers(standard_headers_for(to_String(mime_type), length(content), success(charset))), |
| 4765 | format_headers(status_headers), | 4821 | format_headers(status_headers), |
| 4766 | format_headers(additional_headers), | 4822 | format_headers(additional_headers), |
| 4767 | crlf . | 4823 | crlf . |
web/jQuery/CXM_jquery_dialog.anubis
| @@ -65,7 +65,7 @@ define String | @@ -65,7 +65,7 @@ define String | ||
| 65 | JQuery_dialog_id dialog_id, | 65 | JQuery_dialog_id dialog_id, |
| 66 | String params | 66 | String params |
| 67 | )= | 67 | )= |
| 68 | - with js_function = "jquery_dialog_click('"+id(dialog_id)+"', "+(if length(params)=0 then "''" else params) +");", | 68 | + with js_function = "CalexiumToolBox.jquery_dialog_click('"+id(dialog_id)+"', "+(if length(params)=0 then "''" else params) +");", |
| 69 | if mb_html is | 69 | if mb_html is |
| 70 | { | 70 | { |
| 71 | failure then js_function, | 71 | failure then js_function, |
| @@ -93,22 +93,7 @@ public define List(HTML_Head_Tag) | @@ -93,22 +93,7 @@ public define List(HTML_Head_Tag) | ||
| 93 | = | 93 | = |
| 94 | [ | 94 | [ |
| 95 | js_inline(jquery_ready(" | 95 | js_inline(jquery_ready(" |
| 96 | - jquery_dialog_click = function (dialog_id, url_args) { | ||
| 97 | - var dialog_elem = $('#'+dialog_id); | ||
| 98 | - if (dialog_elem.is('[ajax_url]')) { | ||
| 99 | - $.ajax({ | ||
| 100 | - url: $('#'+dialog_id).attr('ajax_url')+((url_args !== '')?'&':'')+url_args | ||
| 101 | - }).done(function (data) { | ||
| 102 | - var dialog_elem = $('#'+dialog_id); | ||
| 103 | - | ||
| 104 | - dialog_elem.html(data); | ||
| 105 | - dialog_elem.dialog('open'); | ||
| 106 | - }); | ||
| 107 | - return; | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - dialog_elem.dialog('open'); | ||
| 111 | - }; | 96 | + |
| 112 | ")) | 97 | ")) |
| 113 | ]. | 98 | ]. |
| 114 | 99 |
web/jQuery/CXM_jquery_tabs.anubis
| @@ -26,7 +26,6 @@ public define JQuery_tab | @@ -26,7 +26,6 @@ public define JQuery_tab | ||
| 26 | )= | 26 | )= |
| 27 | jQuery_tab(title, partial_content([], content)). | 27 | jQuery_tab(title, partial_content([], content)). |
| 28 | 28 | ||
| 29 | - | ||
| 30 | define HTML_Partial_Content | 29 | define HTML_Partial_Content |
| 31 | _jquery_tabs | 30 | _jquery_tabs |
| 32 | ( | 31 | ( |