From d80e09a7a66e812ea8e3e5c8f1ddc40d08670b2e Mon Sep 17 00:00:00 2001 From: Cedric RICARD Date: Sun, 2 Mar 2008 03:26:52 +0000 Subject: [PATCH] Several minor improvements on web objects. No compatibility loose except for file upload input. --- calexium_lib/web/CXM_making_a_web_site.anubis | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 54 insertions(+), 30 deletions(-) diff --git a/calexium_lib/web/CXM_making_a_web_site.anubis b/calexium_lib/web/CXM_making_a_web_site.anubis index 9b35d16..d8b92cc 100644 --- a/calexium_lib/web/CXM_making_a_web_site.anubis +++ b/calexium_lib/web/CXM_making_a_web_site.anubis @@ -647,7 +647,7 @@ public type Text_Option: nowrap, class(String), //CSS class id(String), -// name(String), + style(String), tooltip(String). A list of 'Text_Option' must be given with each text you want to put in your page. @@ -922,8 +922,8 @@ public type Actioner_Aspect: button (String url_off, String url_on), // rollover button button (String url_off, String url_on, Int32 w, Int32 h), // idem with size submit (List(CoreAttrs),String text), - immediate_selector (WebArgName name, Int32 size, List((WebArgValue,String)) choices), - immediate_selector (WebArgName name, Int32 size, List((WebArgValue,String)) choices, InitialValue selected). + immediate_selector (List(CoreAttrs),WebArgName name, Int32 size, List((WebArgValue,String)) choices), + immediate_selector (List(CoreAttrs),WebArgName name, Int32 size, List((WebArgValue,String)) choices, InitialValue selected). @@ -1005,7 +1005,7 @@ public type HTML_In_Form: text_input_ro (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width), password_input (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width), text_area (List(TextAreaOption), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width, Int32 height), - file_upload (String label, HtmlId id, WebArgName name, Int32 width), + file_upload (List(InputAttrs), String label, HtmlId id, WebArgName name, Int32 width), selector (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int32 size, List(String) choices), selector (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int32 size, List(String) choices, InitialValue selected), // List((String,String)) = List((code,name)) where : @@ -1155,7 +1155,7 @@ public define HTML_In_Form public define HTML_In_Form file_upload (WebArgName name, Int32 width) - = file_upload("", htmlId(""), name, width). + = file_upload([], "", htmlId(""), name, width). public type HTML_Off_Form: @@ -1187,8 +1187,8 @@ public type HTML_Off_Form: private_download (String abs_path, String name, String extra_ext, Maybe((String,List((String,String)))) action), label (String name), - form (String form_name, List(CoreAttrs), HTML_In_Form content), - form (String form_name, List(CoreAttrs), + form (HtmlId form_id, List(CoreAttrs), HTML_In_Form content), + form (HtmlId form_id, List(CoreAttrs), String action_name, List((String,String)) extra_ops, HTML_In_Form content), div (List(CoreAttrs), HTML_Off_Form content), @@ -1196,6 +1196,27 @@ public type HTML_Off_Form: 'HTML_Off_Form' defines all the elements you may put outside any form. + +public define HTML_Off_Form + form + ( + String form_name, + List(CoreAttrs) options, + HTML_In_Form content + ) = + form(htmlId(form_name), options, content). + +public define HTML_Off_Form + form + ( + String form_name, + List(CoreAttrs) options, + String action_name, + List((String,String)) extra_ops, + HTML_In_Form content + ) = + form(htmlId(form_name), options, action_name, extra_ops, content). + public define HTML_Off_Form literal(Printable_tree t) = literal_pt(t). public define HTML_Off_Form fixed_size(HTML_Size width, HTML_Size height, String name_of_HTML_file) @@ -2894,8 +2915,8 @@ define List(Text_Option) get_text_options(t) else if h is id(_) then get_text_options(t) -// else if h is name(_) then -// get_text_options(t) + else if h is style(_) then + get_text_options(t) else if h is tooltip(_) then get_text_options(t) else @@ -2922,8 +2943,8 @@ define List(CoreAttrs) [ class(name) . get_css_class(t) ] else if h is id(name) then [ id(name) . get_css_class(t) ] -// else if h is name(the_name) then -// [ name(the_name) . get_css_class(t) ] + else if h is style(the_style) then + [ style(the_style) . get_css_class(t) ] else if h is tooltip(name) then [ tooltip(name) . get_css_class(t) ] else @@ -2963,7 +2984,7 @@ public define String " class=\"" + class_name + "\"", style(style_string) then " style=\"" + style_string + "\"", - + tooltip(title_string) then " title=\"" + title_string + "\"", @@ -3123,8 +3144,8 @@ define Maybe(String) button(_,_) then failure, button(_,_,_,_) then failure, submit(opts,_) then extract_id(opts), - immediate_selector(_,_,_) then failure, - immediate_selector(_,_,_,_) then failure, + immediate_selector(_,_,_,_) then failure, + immediate_selector(_,_,_,_,_) then failure, }. to do Complete format_foreign_link @@ -3169,9 +3190,9 @@ define Printable_tree submit(options, text) then [ ], - immediate_selector(name,size,choices) then + immediate_selector(opt,name,size,choices) then [ ], - immediate_selector(name,size,choices,selected) then + immediate_selector(opt,name,size,choices,selected) then [ ], }. @@ -3264,22 +3285,22 @@ define Printable_tree } ], - immediate_selector(name,size,choices) then + immediate_selector(options,name,size,choices) then [ if action is { url(u) then ["" ], - immediate_selector(name,size,choices,selected) then + immediate_selector(options,name,size,choices,selected) then [ if action is { url(u) then ["" ], }. @@ -3317,8 +3338,8 @@ define Printable_tree " onMouseOut=\"this.src='",url_off,"'\">", ], submit(opt, text) then [text], - immediate_selector(name,size,choices) then alert, - immediate_selector(name,size,choices,selected) then alert, + immediate_selector(options,name,size,choices) then alert, + immediate_selector(options,name,size,choices,selected) then alert, }, ""]. @@ -3608,7 +3629,8 @@ define String line_through then "text-decoration:line-through", nowrap then "white-space:nowrap", class(class_name)then " class=\"" + class_name +"\"", - id(id_name) then " id=\"" + id_name +"\"" + id(id_name) then " id=\"" + id_name +"\"", + style(style_string) then " style=\"" + style_string + "\"", tooltip(title) then " title=\"" + title +"\"" } + if t is [ ] then "" else ("; "+format(t)) }. @@ -3858,9 +3880,9 @@ define Printable_tree ""], text_area(opts,label_text, id, n,i,w,h) then [ maybe_label(label_text, id), ""], - file_upload(label, id, n, w) then + file_upload(options, label, id, n, w) then [ maybe_label(label, id), - ""], + ""], selector(opts, label, id, n,s,cs) then [ maybe_label(label, id), ""], @@ -3961,7 +3983,7 @@ define Bool text_input_ro(o,lt,l,n,i,w) then false, password_input(o,lt,l,n,i,w) then false, text_area(o,lt,id,n,i,w,h) then false, - file_upload(l,i,n,w) then true, + file_upload(o,l,i,n,w) then true, selector(o,l,i,n,s,c) then false, selector(o,l,i,n,s,c,p) then false, selector_c(o,l,i,n,s,c) then false, @@ -4039,7 +4061,7 @@ define Printable_tree label(n) then [""], form(fn,attributs, c) then [ - "
", // action is set dynamically by // the actioner using JavaScript - format(cinfo,fn,sn,ic_v,c,is_https), + if fn is htmlId(id) then + format(cinfo,id,sn,ic_v,c,is_https), "
" ] form(fn,attributs, action_name, extra_ops, c) then with url = make_actioner_url(cinfo, same, same, sn, action_name, extra_ops, is_https), [ - "
", // action is set dynamically by // the actioner using JavaScript - format(cinfo,fn,sn,ic_v,c,is_https), + if fn is htmlId(id) then + format(cinfo,id,sn,ic_v,c,is_https), "
" ] div(options, e) then -- libgit2 0.21.4