Commit e88ea85f286e5b734b033a8e14111fc4e71df90d
1 parent
3f69ca7e
Minor improvements on selectors
Showing
1 changed file
with
25 additions
and
21 deletions
Show diff stats
calexium_lib/web/CXM_making_a_web_site.anubis
| @@ -916,7 +916,7 @@ public type Actioner_Aspect: | @@ -916,7 +916,7 @@ public type Actioner_Aspect: | ||
| 916 | button (String url_off, String url_on), // rollover button | 916 | button (String url_off, String url_on), // rollover button |
| 917 | button (String url_off, String url_on, Int32 w, Int32 h), // idem with size | 917 | button (String url_off, String url_on, Int32 w, Int32 h), // idem with size |
| 918 | immediate_selector (WebArgName name, Int32 size, List((WebArgValue,String)) choices), | 918 | immediate_selector (WebArgName name, Int32 size, List((WebArgValue,String)) choices), |
| 919 | - immediate_selector (WebArgName name, Int32 size, List((WebArgValue,String)) choices, String selected). | 919 | + immediate_selector (WebArgName name, Int32 size, List((WebArgValue,String)) choices, InitialValue selected). |
| 920 | 920 | ||
| 921 | 921 | ||
| 922 | 922 | ||
| @@ -991,13 +991,13 @@ public type HTML_In_Form: | @@ -991,13 +991,13 @@ public type HTML_In_Form: | ||
| 991 | password_input (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width), | 991 | password_input (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width), |
| 992 | text_area (List(TextAreaOption), String name, String init, Int32 width, Int32 height), | 992 | text_area (List(TextAreaOption), String name, String init, Int32 width, Int32 height), |
| 993 | file_upload (String label, HtmlId id, WebArgName name, Int32 width), | 993 | file_upload (String label, HtmlId id, WebArgName name, Int32 width), |
| 994 | - selector (WebArgName name, Int32 size, List(String) choices), | ||
| 995 | - selector (WebArgName name, Int32 size, List(String) choices, String selected), | 994 | + selector (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int32 size, List(String) choices), |
| 995 | + selector (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int32 size, List(String) choices, InitialValue selected), | ||
| 996 | // List((String,String)) = List((code,name)) where : | 996 | // List((String,String)) = List((code,name)) where : |
| 997 | // code is the web-arg value | 997 | // code is the web-arg value |
| 998 | // name appears in selector | 998 | // name appears in selector |
| 999 | - selector_c (WebArgName name, Int32 size, List((WebArgValue,String)) choices), | ||
| 1000 | - selector_c (WebArgName name, Int32 size, List((WebArgValue,String)) choices, String selected), | 999 | + selector_c (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int32 size, List((WebArgValue,String)) choices), |
| 1000 | + selector_c (List(InputAttrs), String label_text, HtmlId id, WebArgName name, Int32 size, List((WebArgValue,String)) choices, InitialValue selected), | ||
| 1001 | radio_button (List(InputAttrs), String label_text, HtmlId id, WebArgName name, WebArgValue value, Bool checked), | 1001 | radio_button (List(InputAttrs), String label_text, HtmlId id, WebArgName name, WebArgValue value, Bool checked), |
| 1002 | radio_button_r (List(InputAttrs), String label_text, HtmlId id, WebArgName name, WebArgValue value, Bool checked), | 1002 | radio_button_r (List(InputAttrs), String label_text, HtmlId id, WebArgName name, WebArgValue value, Bool checked), |
| 1003 | check_box (List(InputAttrs), String label_text, HtmlId id, WebArgName name, WebArgValue value, Bool checked), | 1003 | check_box (List(InputAttrs), String label_text, HtmlId id, WebArgName name, WebArgValue value, Bool checked), |
| @@ -2664,12 +2664,12 @@ public define Printable_tree | @@ -2664,12 +2664,12 @@ public define Printable_tree | ||
| 2664 | format_choices | 2664 | format_choices |
| 2665 | ( | 2665 | ( |
| 2666 | List(String) l, | 2666 | List(String) l, |
| 2667 | - String selected | 2667 | + InitialValue selected |
| 2668 | ) = | 2668 | ) = |
| 2669 | if l is | 2669 | if l is |
| 2670 | { | 2670 | { |
| 2671 | [ ] then [ ], | 2671 | [ ] then [ ], |
| 2672 | - [h . t] then if h = selected | 2672 | + [h . t] then if h = selected.value |
| 2673 | then ["<option selected>",h . format_choices(t)] | 2673 | then ["<option selected>",h . format_choices(t)] |
| 2674 | else ["<option>",h . format_choices(t,selected)] | 2674 | else ["<option>",h . format_choices(t,selected)] |
| 2675 | }. | 2675 | }. |
| @@ -2692,14 +2692,14 @@ public define Printable_tree | @@ -2692,14 +2692,14 @@ public define Printable_tree | ||
| 2692 | format_choices | 2692 | format_choices |
| 2693 | ( | 2693 | ( |
| 2694 | List((WebArgValue,String)) l, | 2694 | List((WebArgValue,String)) l, |
| 2695 | - String selected | 2695 | + InitialValue selected |
| 2696 | ) = | 2696 | ) = |
| 2697 | if l is | 2697 | if l is |
| 2698 | { | 2698 | { |
| 2699 | [ ] then [ ], | 2699 | [ ] then [ ], |
| 2700 | [h . t] then | 2700 | [h . t] then |
| 2701 | if h is (val,item) then | 2701 | if h is (val,item) then |
| 2702 | - if item = selected | 2702 | + if item = selected.value |
| 2703 | then ["<option value=\""+val.value+"\" selected>",item . format_choices(t)] | 2703 | then ["<option value=\""+val.value+"\" selected>",item . format_choices(t)] |
| 2704 | else ["<option value=\""+val.value+"\">",item . format_choices(t,selected)] | 2704 | else ["<option value=\""+val.value+"\">",item . format_choices(t,selected)] |
| 2705 | }. | 2705 | }. |
| @@ -3743,14 +3743,18 @@ define Printable_tree | @@ -3743,14 +3743,18 @@ define Printable_tree | ||
| 3743 | file_upload(label, id, n, w) then | 3743 | file_upload(label, id, n, w) then |
| 3744 | ["<label for=\"",id,"\">",label,"</label>", | 3744 | ["<label for=\"",id,"\">",label,"</label>", |
| 3745 | "<input type=file id=",id," size=",w," name=o",n,">"], | 3745 | "<input type=file id=",id," size=",w," name=o",n,">"], |
| 3746 | - selector(n,s,cs) then | ||
| 3747 | - ["<select name=o",n," size=",s,">",format_choices(cs),"</select>"], | ||
| 3748 | - selector(n,s,cs,sd) then | ||
| 3749 | - ["<select name=o",n," size=",s,">",format_choices(cs,sd),"</select>"], | ||
| 3750 | - selector_c(n,s,cs) then | ||
| 3751 | - ["<select name=o",n," size=",s,">",format_choices(cs),"</select>"], | ||
| 3752 | - selector_c(n,s,cs,sd) then | ||
| 3753 | - ["<select name=o",n," size=",s,">",format_choices(cs,sd),"</select>"], | 3746 | + selector(opts, label, id, n,s,cs) then |
| 3747 | + ["<label for=\"",id,"\">",label,"</label>", | ||
| 3748 | + "<select name=o",n," size=",s,format_attrs(opts),">",format_choices(cs),"</select>"], | ||
| 3749 | + selector(opts, label, id, n,s,cs,sd) then | ||
| 3750 | + ["<label for=\"",id,"\">",label,"</label>", | ||
| 3751 | + "<select name=o",n," size=",s,format_attrs(opts),">",format_choices(cs,sd),"</select>"], | ||
| 3752 | + selector_c(opts, label, id, n,s,cs) then | ||
| 3753 | + ["<label for=\"",id,"\">",label,"</label>", | ||
| 3754 | + "<select name=o",n," size=",s,format_attrs(opts),">",format_choices(cs),"</select>"], | ||
| 3755 | + selector_c(opts, label, id, n,s,cs,sd) then | ||
| 3756 | + ["<label for=\"",id,"\">",label,"</label>", | ||
| 3757 | + "<select name=o",n," size=",s,format_attrs(opts),">",format_choices(cs,sd),"</select>"], | ||
| 3754 | 3758 | ||
| 3755 | radio_button(options, label_text, id, n, v, c) then | 3759 | radio_button(options, label_text, id, n, v, c) then |
| 3756 | [ "<label for=\"",id,"\">",label_text,"</label>", | 3760 | [ "<label for=\"",id,"\">",label_text,"</label>", |
| @@ -3826,10 +3830,10 @@ define Bool | @@ -3826,10 +3830,10 @@ define Bool | ||
| 3826 | password_input(o,lt,l,n,i,w) then false, | 3830 | password_input(o,lt,l,n,i,w) then false, |
| 3827 | text_area(o,n,i,w,h) then false, | 3831 | text_area(o,n,i,w,h) then false, |
| 3828 | file_upload(l,i,n,w) then true, | 3832 | file_upload(l,i,n,w) then true, |
| 3829 | - selector(n,s,c) then false, | ||
| 3830 | - selector(n,s,c,p) then false, | ||
| 3831 | - selector_c(n,s,c) then false, | ||
| 3832 | - selector_c(n,s,c,p) then false, | 3833 | + selector(o,l,i,n,s,c) then false, |
| 3834 | + selector(o,l,i,n,s,c,p) then false, | ||
| 3835 | + selector_c(o,l,i,n,s,c) then false, | ||
| 3836 | + selector_c(o,l,i,n,s,c,p) then false, | ||
| 3833 | radio_button(o,_,_,n,v,c) then false, | 3837 | radio_button(o,_,_,n,v,c) then false, |
| 3834 | radio_button_r(o,_,_,n,v,c) then false, | 3838 | radio_button_r(o,_,_,n,v,c) then false, |
| 3835 | check_box(o,_,_,n,v,c) then false, | 3839 | check_box(o,_,_,n,v,c) then false, |