diff --git a/calexium_lib/web/CXM_dojo.anubis b/calexium_lib/web/CXM_dojo.anubis
index 88999ce..d9f0d12 100644
--- a/calexium_lib/web/CXM_dojo.anubis
+++ b/calexium_lib/web/CXM_dojo.anubis
@@ -255,7 +255,22 @@ define String
right then "right"
}.
+public type BorderContainerDesign:
+ headline,
+ sidebar.
+define String
+ to_String
+ (
+ BorderContainerDesign design
+ )=
+ if design is
+ {
+ headline then "headline",
+ sidebar then "sidebar"
+ }.
+
+
public define HTML_Off_Form
dojo_ContentPane
(
@@ -268,18 +283,7 @@ public define HTML_Off_Form
attr("region", to_String(region)),
attr("splitter", if splitter then "true" else "false") . attributes ],
content).
-// sequence([
-// literal("
").
+
public define HTML_Off_Form
@@ -328,11 +329,7 @@ public define HTML_Off_Form
)=
div([attr("dojoType", "dijit.Toolbar") . attributes ],
content).
-// sequence([
-// literal("
"),
-// content,
-// literal("
")
-// ]).
+
public define HTML_Off_Form
@@ -345,7 +342,12 @@ public define HTML_Off_Form
String execute,
)=
literal("
-
" +
+
" +
if tip_msg is
{
failure then "",
diff --git a/calexium_lib/web/CXM_json.anubis b/calexium_lib/web/CXM_json.anubis
new file mode 100644
index 0000000..4ef281b
--- /dev/null
+++ b/calexium_lib/web/CXM_json.anubis
@@ -0,0 +1,168 @@
+/*
+ * Created by PyramIDE.
+ * User: ricard
+ * Date: 18/08/2008
+ * Time: 08:12
+ *
+ * To change this template use Tools | Options | Coding | Edit Standard Headers.
+ */
+
+read tools/basis.anubis
+
+public type JsonMember:...
+
+
+public type JsonValue:
+ json_object(List(JsonMember)),
+ json_array(List(JsonValue)),
+ json_int(Int value),
+ json_float(Float value, Int precision),
+ json_string(String value),
+ json_bool(Bool value),
+ json_null.
+
+
+public type JsonMember:
+ json_member(String name,
+ JsonValue value).
+
+//-------------------------------
+// helpers
+
+public define JsonMember
+ json_member
+ (
+ String name,
+ List(JsonMember) value,
+ ) =
+ json_member(name, json_object(value)).
+
+
+public define JsonMember
+ json_member
+ (
+ String name,
+ List(JsonValue) value,
+ ) =
+ json_member(name, json_array(value)).
+
+public define JsonMember
+ json_member
+ (
+ String name,
+ Int value,
+ ) =
+ json_member(name, json_int(value)).
+
+public define JsonMember
+ json_member
+ (
+ String name,
+ Float value,
+ Int precision,
+ ) =
+ json_member(name, json_float(value, precision)).
+
+public define JsonMember
+ json_member
+ (
+ String name,
+ String value,
+ ) =
+ json_member(name, json_string(value)).
+
+public define JsonMember
+ json_member
+ (
+ String name,
+ Bool value,
+ ) =
+ json_member(name, json_bool(value)).
+
+public define JsonMember
+ json_null
+ (
+ String name,
+ ) =
+ json_member(name, json_null).
+
+//-------------------------------------------
+// Outputing Json to Printable_tree
+
+define List(Word8)
+ _format_json_esc
+ (
+ List(Word8) original,
+ List(Word8) new_string,
+ ) =
+ if original is
+ {
+ [] then new_string,
+ [h . t] then
+ if (h >=+ 32 & h +=< 33) | (h >=+ 35 & h +=< 38) |(h >=+ 40 & h +=< 91) | h >=+ 93 then // Allowed characters for JSON see RFC4627 + " ' "
+ _format_json_esc(t, [h . new_string])
+ else
+ _format_json_esc(t, [h, '\\' . new_string])
+ }.
+
+public define String
+ format_json_esc
+ (
+ String original,
+ ) =
+ implode(reverse(_format_json_esc(explode(original), [],))).
+
+
+public define Printable_tree
+ format_json
+ (
+ JsonValue json
+ ).
+
+public define Printable_tree
+ format_json_member
+ (
+ JsonMember member
+ ) =
+ if member is json_member(name, value) then
+ [ "'", name, "':" . format_json(value) ].
+
+
+define Printable_tree
+ format_json_object
+ (
+ List(JsonMember) members
+ ) =
+ if members is
+ {
+ [] then [],
+ [h . t] then [ format_json_member(h), (if t is [] then "" else ",") . format_json_object(t) ]
+ }.
+
+define Printable_tree
+ format_json_array
+ (
+ List(JsonValue) values
+ ) =
+ if values is
+ {
+ [] then [],
+ [h . t] then [ format_json(h), (if t is [] then "" else ",") . format_json_array(t) ]
+ }.
+
+public define Printable_tree
+ format_json
+ (
+ JsonValue json
+ ) =
+ if json is
+ {
+ json_object(members) then [ "{", format_json_object(members), "}" . [] ],
+ json_array(values) then [ "[", format_json_array(values), "]" . [] ],
+ json_int(i) then int_pt(i, []),
+ json_float(f, p) then str_pt(float_to_string(f, p), []),
+ json_string(s) then str_pt("'" + format_json_esc(s) + "'", []),
+ json_bool(b) then str_pt(if b then "true" else "false", []),
+ json_null then str_pt("null", [])
+ }.
+
diff --git a/calexium_lib/web/CXM_making_a_web_site.anubis b/calexium_lib/web/CXM_making_a_web_site.anubis
index ade3d4e..01b4163 100644
--- a/calexium_lib/web/CXM_making_a_web_site.anubis
+++ b/calexium_lib/web/CXM_making_a_web_site.anubis
@@ -990,6 +990,27 @@ public type TextAreaOption:
disabled,
read_only,
wrap_lines.
+
+public type CSS_Style:
+ text_options(List(Text_Option)).
+
+public type CSS_File:
+ css_file(String file_name).
+
+public type JS_Attribute:
+ attr (String, String).
+
+public type JS_File:
+ js_file(String file_name,
+ List(JS_Attribute) attributes).
+
+public define JS_File
+ js_file
+ (
+ String file_name
+ ) =
+ js_file(file_name, []).
+
public type HTML_In_Form:
literal_pt (Printable_tree),
@@ -1174,6 +1195,7 @@ public define HTML_In_Form
file_upload (WebArgName name, Int width)
= file_upload([], "", htmlId(""), name, width).
+public type HTML_Body:...
public type HTML_Off_Form:
literal_pt (Printable_tree),
@@ -1209,7 +1231,12 @@ public type HTML_Off_Form:
String action_name, List((String,String)) extra_ops,
HTML_In_Form content),
div (List(CoreAttrs), HTML_Off_Form content),
- div_empty (List(CoreAttrs)).
+ div_empty (List(CoreAttrs)),
+ iframe (List(CoreAttrs),
+ List(CSS_Style) /*styles*/,
+ List(CSS_File) /*css_files*/,
+ List(JS_File) /*js_files*/,
+ HTML_Body /*body*/).
'HTML_Off_Form' defines all the elements you may put outside any form.
@@ -1401,25 +1428,6 @@ public define HTML_Row(HTML_In_Form)
-public type CSS_Style:
- text_options(List(Text_Option)).
-
-public type CSS_File:
- css_file(String file_name).
-
-public type JS_Attribute:
- attr (String, String).
-
-public type JS_File:
- js_file(String file_name,
- List(JS_Attribute) attributes).
-
-public define JS_File
- js_file
- (
- String file_name
- ) =
- js_file(file_name, []).
define String
format
@@ -3729,6 +3737,92 @@ define Printable_tree
].
+
+define Printable_tree
+ format
+ (
+ Body_Option o
+ ) =
+ if o is
+ {
+ core_attrs(core_attr_list) then [" " + format_attrs(core_attr_list)],
+ background_color(c) then [" bgcolor=\"" , (String)html_format(c), "\""],
+ background_image(n) then [" background=", n],
+ background_image(n,o2) then [" style=\"background: url(",n,")",format(o2),"\""]
+
+ }.
+
+
+
+define Printable_tree
+ format
+ (
+ List(Body_Option) l
+ ) =
+ if l is
+ {
+ [ ] then [ ],
+ [h . t] then [format(h) . format(t)]
+ }.
+
+define Printable_tree
+ add_css_files
+ (
+ List(CSS_File) l
+ ) =
+ if l is
+ {
+ [ ] then [ ],
+ [h . t] then
+ [ ["
\n" ]
+ . add_css_files(t)]
+ }.
+
+define Printable_tree
+ add_js_files_attributes
+ (
+ List(JS_Attribute) l
+ ) =
+ if l is
+ {
+ [ ] then [ ],
+ [h . t] then
+ if h is attr(name, value) then
+ [ " " + name + "=\"" + value + "\""
+ . add_js_files_attributes(t)]
+ }.
+
+
+define Printable_tree
+ add_js_files
+ (
+ List(JS_File) l
+ ) =
+ if l is
+ {
+ [ ] then [ ],
+ [h . t] then
+ [ ["\n"
+ . add_js_files(t)] ]
+ }.
+
+define Printable_tree
+ add_css_styles
+ (
+ List(CSS_Style) css_styles
+ ) =
+
+ if css_styles is
+ {
+ [] then [],
+ [_ . _] then [ "\n"
+ ]
+ }.
+
// The function below formats a datum of type 'HTML_Any($T)'.
@@ -4086,9 +4180,24 @@ define Printable_tree
""
]
div(options, e) then
- format(cinfo,sn,ic_v,any_div(options, e),format_element,is_https),
+ format(cinfo,sn,ic_v,any_div(options, e),format_element,is_https),
div_empty(options) then
- format(cinfo,sn,ic_v,any_div_empty(options),format_element,is_https),
+ format(cinfo,sn,ic_v,any_div_empty(options),format_element,is_https),
+ iframe(options, css_styles, css_files, js_files, body) then
+ if body is body(body_options,element) then
+ [ "
\n",
+ ],
}.
@@ -4154,91 +4263,7 @@ define Printable_tree
. format(cinfo,state_name,t,is_https,charset)]
}.
-
-define Printable_tree
- format
- (
- Body_Option o
- ) =
- if o is
- {
- core_attrs(core_attr_list) then [" " + format_attrs(core_attr_list)],
- background_color(c) then [" bgcolor=\"" , (String)html_format(c), "\""],
- background_image(n) then [" background=", n],
- background_image(n,o2) then [" style=\"background: url(",n,")",format(o2),"\""]
-
- }.
-
-
-
-define Printable_tree
- format
- (
- List(Body_Option) l
- ) =
- if l is
- {
- [ ] then [ ],
- [h . t] then [format(h) . format(t)]
- }.
-
-define Printable_tree
- add_css_files
- (
- List(CSS_File) l
- ) =
- if l is
- {
- [ ] then [ ],
- [h . t] then
- [ ["
\n" ]
- . add_css_files(t)]
- }.
-
-define Printable_tree
- add_js_files_attributes
- (
- List(JS_Attribute) l
- ) =
- if l is
- {
- [ ] then [ ],
- [h . t] then
- if h is attr(name, value) then
- [ " " + name + "=\"" + value + "\""
- . add_js_files_attributes(t)]
- }.
-
-define Printable_tree
- add_js_files
- (
- List(JS_File) l
- ) =
- if l is
- {
- [ ] then [ ],
- [h . t] then
- [ ["\n"
- . add_js_files(t)] ]
- }.
-
-define Printable_tree
- add_css_styles
- (
- List(CSS_Style) css_styles
- ) =
-
- if css_styles is
- {
- [] then [],
- [_ . _] then [ "\n"
- ]
- }.
define Printable_tree
format
diff --git a/calexium_lib/web/CXM_multihost_http_server.anubis b/calexium_lib/web/CXM_multihost_http_server.anubis
index d2655b7..ff8ce60 100644
--- a/calexium_lib/web/CXM_multihost_http_server.anubis
+++ b/calexium_lib/web/CXM_multihost_http_server.anubis
@@ -2306,7 +2306,8 @@ public define List(HTTP_header)
=
[
http_header("Date", format_http_date(now)),
- http_header("Server", "Anubis Embedded Server v" + major_version_number + "." + minor_version_number)
+ http_header("Server", "Anubis Embedded Server v" + major_version_number + "." + minor_version_number),
+ http_header("Connection", "close"),
].
public define List(HTTP_header)
--
libgit2 0.21.4