Commit 853e7a2c58b3ee50bc214a4df53f3a5b11ee1491

Authored by Cédric RICARD
1 parent 3d16bf3e

Renaming 'tooltip' attribute to 'title' to make it more 'HTML compliant'

Fix HTML code generated by CXM_dojo.anubis to be more W3C compliant.
calexium_lib/web/CXM_dojo.anubis
... ... @@ -40,26 +40,35 @@ public define HTML_Off_Form
40 40 dojo_dialog
41 41 (
42 42 String name,
43   - String id,
  43 + String dialog_id,
44 44 String execute,
45 45 )
46 46 =
47 47 sequence[
48   - dojo_button(name,"dijit.byId('"+id+"').show()", "dialog_id"),
49   - literal("
50   - <div dojoType=\"dijit.Dialog\" id=\""+id+"\" title=\""+name+"\"
51   - execute=\""+execute+"\">
52   - <table>
53   - <tr>
54   - <td><input dojoType=dijit.form.TextBox type=\"text\" name=\"name\" id=\"name_"+id+"\"></td>
55   - </tr>
56   -
57   - <tr>
58   - <td colspan=\"2\" align=\"center\">
59   - <button dojoType=dijit.form.Button type=\"submit\">OK</button></td>
60   - </tr>
61   - </table>
62   -</div></br>")
  48 + dojo_button(name,"dijit.byId('"+dialog_id+"').show()", "dialog_id"),
  49 + div([attr("dojoType", "dijit.Dialog"), id(dialog_id), title(name), attr("execute", execute)],
  50 + table([],
  51 + empty,
  52 + [
  53 + row([], [cell([], literal("<input dojoType=dijit.form.TextBox type=\"text\" name=\"name\" id=\"name_"+dialog_id+"\" />"))]),
  54 + row([], [cell([columns(2), h_center], literal("<button dojoType=dijit.form.Button type=\"submit\">OK</button>"))]),
  55 + ],
  56 + empty)),
  57 + literal("<br/>"),
  58 +// literal("
  59 +// <div dojoType=\"dijit.Dialog\" id=\""+id+"\" title=\""+name+"\"
  60 +// execute=\""+execute+"\">
  61 +// <table>
  62 +// <tr>
  63 +// <td><input dojoType=dijit.form.TextBox type=\"text\" name=\"name\" id=\"name_"+id+"\"></td>
  64 +// </tr>
  65 +//
  66 +// <tr>
  67 +// <td colspan=\"2\" align=\"center\">
  68 +// <button dojoType=dijit.form.Button type=\"submit\">OK</button></td>
  69 +// </tr>
  70 +// </table>
  71 +// </div><br />")
63 72 ]
64 73 .
65 74  
... ... @@ -74,7 +83,7 @@ public define HTML_Off_Form
74 83 Bool can_edit
75 84 )
76 85 =
77   - literal("<script>
  86 + literal("<script type=\"text/javascript\">
78 87 dojo.addOnLoad(function(){
79 88 init_dojo_grid(\""+colum1+"\",\""+colum2+"\", \""+colum3+"\", \""+colum4+"\", "+ (if can_edit then "1" else "0")+");
80 89 }
... ... @@ -92,13 +101,13 @@ public define HTML_Off_Form
92 101 )
93 102 =
94 103 sequence([
95   - literal("</br>"),
  104 + literal("<br/>"),
96 105 div([class("message_box")],
97 106 sequence([
98 107 div([id("node3"), class("box nopad hidden")], name1),
99 108 div([id("node4"), class("box two nopad")], name2),
100 109 ])),
101   - literal("</br>"),
  110 + literal("<br/>"),
102 111 ]).
103 112  
104 113  
... ...
calexium_lib/web/CXM_making_a_web_site.anubis
... ... @@ -649,7 +649,10 @@ public type Text_Option:
649 649 class(String), //CSS class
650 650 id(String),
651 651 style(String),
652   - tooltip(String).
  652 + title(String).
  653 +
  654 +public define Text_Option
  655 + tooltip(String s) = title(s).
653 656  
654 657 A list of 'Text_Option' must be given with each text you want to put in your page.
655 658  
... ... @@ -723,7 +726,7 @@ public type CoreAttrs:
723 726 id (String),
724 727 class (String),
725 728 style (String),
726   - tooltip (String),
  729 + title (String),
727 730 lang (String),
728 731 dir (Reading_Way),
729 732 accesskey (Word8),
... ... @@ -734,7 +737,7 @@ public type CoreAttrs:
734 737 public type InputAttrs:
735 738 class (String),
736 739 style (String),
737   - tooltip (String),
  740 + title (String),
738 741 lang (String),
739 742 dir (Reading_Way),
740 743 accesskey (Word8),
... ... @@ -742,6 +745,11 @@ public type InputAttrs:
742 745 attr (String, String),
743 746 event (HtmlEvents, String).
744 747  
  748 +public define CoreAttrs
  749 + tooltip(String s) = title(s).
  750 +public define InputAttrs
  751 + tooltip(String s) = title(s).
  752 +
745 753 public type I18n:
746 754 lang (String),
747 755 dir (Reading_Way).
... ... @@ -1474,6 +1482,8 @@ public type HTTP_Answer:
1474 1482 String content),
1475 1483 custom_binary(String mime_type,
1476 1484 ByteArray content),
  1485 + custom_tree(String mime_type,
  1486 + Printable_tree content),
1477 1487 http_raw(Printable_tree).
1478 1488  
1479 1489 public define HTTP_Answer
... ... @@ -2926,7 +2936,7 @@ define List(Text_Option)
2926 2936 get_text_options(t)
2927 2937 else if h is style(_) then
2928 2938 get_text_options(t)
2929   - else if h is tooltip(_) then
  2939 + else if h is title(_) then
2930 2940 get_text_options(t)
2931 2941 else
2932 2942 [ h . get_text_options(t) ]
... ... @@ -2954,7 +2964,7 @@ define List(CoreAttrs)
2954 2964 [ id(name) . get_css_class(t) ]
2955 2965 else if h is style(the_style) then
2956 2966 [ style(the_style) . get_css_class(t) ]
2957   - else if h is tooltip(name) then
  2967 + else if h is title(name) then
2958 2968 [ tooltip(name) . get_css_class(t) ]
2959 2969 else
2960 2970 get_css_class(t)
... ... @@ -2994,7 +3004,7 @@ public define String
2994 3004 style(style_string) then
2995 3005 " style=\"" + style_string + "\"",
2996 3006  
2997   - tooltip(title_string) then
  3007 + title(title_string) then
2998 3008 " title=\"" + title_string + "\"",
2999 3009  
3000 3010 lang(lang) then
... ... @@ -3036,7 +3046,7 @@ define String
3036 3046 style(style_string) then
3037 3047 " style=\"" + style_string + "\"",
3038 3048  
3039   - tooltip(title_string) then
  3049 + title(title_string) then
3040 3050 " title=\"" + title_string + "\"",
3041 3051  
3042 3052 lang(lang) then
... ... @@ -3602,7 +3612,7 @@ define String
3602 3612 class(class_name)then " class=\"" + class_name +"\"",
3603 3613 id(id_name) then " id=\"" + id_name +"\"",
3604 3614 style(style_string) then " style=\"" + style_string + "\"",
3605   - tooltip(title) then " title=\"" + title +"\""
  3615 + title(s) then " title=\"" + s +"\""
3606 3616 } + if t is [ ] then "" else ("; "+format(t))
3607 3617 }.
3608 3618  
... ... @@ -4297,6 +4307,15 @@ define Printable_tree
4297 4307 content . (Printable_tree)[]
4298 4308 ],
4299 4309  
  4310 + custom_tree(String mime_type, Printable_tree content) then
  4311 + [ "HTTP/1.1 200 OK", crlf,
  4312 + format_headers(standard_headers),
  4313 + format_headers(standard_headers_for(mime_type, length(content), success(charset))),
  4314 + format_headers(additional_headers),
  4315 + crlf .
  4316 + content
  4317 + ],
  4318 +
4300 4319 http_raw(Printable_tree content) then content
4301 4320 }.
4302 4321  
... ...