Commit bc3e455cbd32d678e217552e54f2c879392955c3
1 parent
4b855b69
Big refactoring to avoid confusion in form element arguments order.
Showing
2 changed files
with
285 additions
and
105 deletions
Show diff stats
calexium_lib/web/CXM_generic_form.anubis
| ... | ... | @@ -199,8 +199,8 @@ public define HTML_Off_Form |
| 199 | 199 | |
| 200 | 200 | --- That's all for the public part ! -------------------------------------------------- |
| 201 | 201 | |
| 202 | - | |
| 203 | -define HTML_Row(HTML_In_Form) | |
| 202 | +// TO DO update code of CXM generic form | |
| 203 | + define HTML_Row(HTML_In_Form) | |
| 204 | 204 | format_form_field |
| 205 | 205 | ( |
| 206 | 206 | FormField ff |
| ... | ... | @@ -453,7 +453,8 @@ define HTML_Row(HTML_In_Form) |
| 453 | 453 | |
| 454 | 454 | |
| 455 | 455 | |
| 456 | -public define HTML_Off_Form | |
| 456 | +// TO DO update code of CXM generic form | |
| 457 | + public define HTML_Off_Form | |
| 457 | 458 | generic_form |
| 458 | 459 | ( |
| 459 | 460 | String form_name, | ... | ... |
calexium_lib/web/CXM_making_a_web_site.anubis
| ... | ... | @@ -655,29 +655,132 @@ public type Reading_Way: |
| 655 | 655 | rtl. //the text is readable from "Right To Left" like arabic |
| 656 | 656 | |
| 657 | 657 | |
| 658 | +// Following types are define to prohib any arguments order error | |
| 659 | + | |
| 660 | +/** | |
| 661 | + * String value for 'id' attribut | |
| 662 | + */ | |
| 663 | +public type HtmlId: | |
| 664 | + htmlId(String id). | |
| 665 | + | |
| 666 | +/** | |
| 667 | + * String value for 'class' attribut | |
| 668 | + */ | |
| 669 | +public type HtmlClass: | |
| 670 | + htmlClass(String class). | |
| 671 | + | |
| 672 | +/** | |
| 673 | + * Name used in arguments list when form is submitted. | |
| 674 | + */ | |
| 675 | +public type WebArgName: | |
| 676 | + wan(String name). | |
| 677 | + | |
| 678 | +/** | |
| 679 | + * Value passed to arguments list when form is submitted (for RadioButton and CheckBox). | |
| 680 | + */ | |
| 681 | +public type WebArgValue: | |
| 682 | + wav(String value). | |
| 683 | + | |
| 684 | +/** | |
| 685 | + * Initial value of an input field. | |
| 686 | + */ | |
| 687 | +public type InitialValue: | |
| 688 | + init(String value). | |
| 689 | + | |
| 690 | +public define Printable_tree [HtmlId x . Printable_tree y] = str_pt(x.id, y). | |
| 691 | +public define Printable_tree [HtmlClass x . Printable_tree y] = str_pt(x.class, y). | |
| 692 | +public define Printable_tree [WebArgName x . Printable_tree y] = str_pt(x.name, y). | |
| 693 | +public define Printable_tree [WebArgValue x . Printable_tree y] = str_pt(x.value, y). | |
| 694 | +public define Printable_tree [InitialValue x . Printable_tree y] = str_pt(x.value, y). | |
| 695 | + | |
| 696 | + | |
| 697 | +public type HtmlEvents: | |
| 698 | + // Form element events | |
| 699 | + onchange, | |
| 700 | + onsubmit, | |
| 701 | + onreset, | |
| 702 | + onselect, | |
| 703 | + onblur, | |
| 704 | + onfocus, | |
| 705 | + // Keyboard events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) | |
| 706 | + onkeydown, | |
| 707 | + onkeypress, | |
| 708 | + onkeyup, | |
| 709 | + // Mouse events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) | |
| 710 | + onclick, | |
| 711 | + ondblclick, | |
| 712 | + onmousedown, | |
| 713 | + onmousemove, | |
| 714 | + onmouseout, | |
| 715 | + onmouseover, | |
| 716 | + onmouseup. | |
| 658 | 717 | |
| 659 | 718 | public type CoreAttrs: |
| 660 | - id (String), | |
| 661 | - class (String), | |
| 662 | - style (String), | |
| 663 | - title (String). | |
| 719 | + id (String), | |
| 720 | + class (String), | |
| 721 | + style (String), | |
| 722 | + tooltip (String), | |
| 723 | + lang (String), | |
| 724 | + dir (Reading_Way), | |
| 725 | + accesskey (Word8), | |
| 726 | + tabindex (Int32), | |
| 727 | + attr (String, String), | |
| 728 | + event (HtmlEvents, String). | |
| 729 | + | |
| 730 | +public type InputAttrs: | |
| 731 | + class (String), | |
| 732 | + style (String), | |
| 733 | + tooltip (String), | |
| 734 | + lang (String), | |
| 735 | + dir (Reading_Way), | |
| 736 | + accesskey (Word8), | |
| 737 | + tabindex (Int32), | |
| 738 | + attr (String, String), | |
| 739 | + event (HtmlEvents, String). | |
| 664 | 740 | |
| 665 | 741 | public type I18n: |
| 666 | 742 | lang (String), |
| 667 | 743 | dir (Reading_Way). |
| 668 | 744 | |
| 669 | -public type DIV_Option: | |
| 670 | - id (String), | |
| 671 | - class (String), | |
| 672 | - style (String), | |
| 673 | - title (String), | |
| 674 | - lang (String), | |
| 675 | - dir (Reading_Way), | |
| 676 | - attr (String, String). | |
| 677 | - | |
| 745 | +//public type DIV_Option: | |
| 746 | +// id (String), | |
| 747 | +// class (String), | |
| 748 | +// style (String), | |
| 749 | +// tooltip (String), | |
| 750 | +// lang (String), | |
| 751 | +// dir (Reading_Way), | |
| 752 | +// attr (String, String), | |
| 753 | +// event (HtmlEvents, String). | |
| 754 | +// | |
| 678 | 755 | |
| 679 | 756 | A list of 'DIV_Option' must be given with each DIV you want to put in your page. |
| 680 | 757 | |
| 758 | +define String event_name | |
| 759 | + ( | |
| 760 | + HtmlEvents e | |
| 761 | + ) = | |
| 762 | + if e is | |
| 763 | + { | |
| 764 | + // Form element events | |
| 765 | + onchange then "onchange", | |
| 766 | + onsubmit then "onsubmit", | |
| 767 | + onreset then "onreset", | |
| 768 | + onselect then "onselect", | |
| 769 | + onblur then "onblur", | |
| 770 | + onfocus then "onfocus", | |
| 771 | + // Keyboard events | |
| 772 | + onkeydown then "onkeydown", | |
| 773 | + onkeypress then "onkeypress", | |
| 774 | + onkeyup then "onkeyup", | |
| 775 | + // Mouse events | |
| 776 | + onclick then "onclick", | |
| 777 | + ondblclick then "ondblclick", | |
| 778 | + onmousedown then "onmousedown", | |
| 779 | + onmousemove then "onmousemove", | |
| 780 | + onmouseout then "onmouseout", | |
| 781 | + onmouseover then "onmouseover", | |
| 782 | + onmouseup then "onmouseup" | |
| 783 | + }. | |
| 681 | 784 | |
| 682 | 785 | public type Table_Option: |
| 683 | 786 | background_color(RGB), // applied to all cells in the table |
| ... | ... | @@ -880,9 +983,9 @@ public type HTML_In_Form: |
| 880 | 983 | foreign_link (List(Text_Option), String url, String name), |
| 881 | 984 | private_download (String abs_path, String name, String extra_ext, |
| 882 | 985 | Maybe((String,List((String,String)))) action), |
| 883 | - text_input (String label_text, String label, String name, String init, Int32 width), | |
| 884 | - text_input_ro (String label_text, String label, String name, String init, Int32 width), | |
| 885 | - password_input (String label_text, String label, String name, Int32 width), | |
| 986 | + text_input (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width), | |
| 987 | + text_input_ro (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width), | |
| 988 | + password_input (List(InputAttrs), String label_text, HtmlId id, WebArgName name, InitialValue init, Int32 width), | |
| 886 | 989 | text_area (List(TextAreaOption), String name, String init, Int32 width, Int32 height), |
| 887 | 990 | file_upload (String name, Int32 width), |
| 888 | 991 | selector (String name, Int32 size, List(String) choices), |
| ... | ... | @@ -892,12 +995,12 @@ public type HTML_In_Form: |
| 892 | 995 | // code is the web-arg value |
| 893 | 996 | selector_c (String name, Int32 size, List((String,String)) choices), |
| 894 | 997 | selector_c (String name, Int32 size, List((String,String)) choices, String selected), |
| 895 | - radio_button (String label_text, String label, String name, String value, Bool checked), | |
| 896 | - radio_button_r (String label_text, String label, String name, String value, Bool checked), | |
| 897 | - check_box (String label_text, String label, String name, Bool checked), | |
| 898 | - check_box_r (String label_text, String label, String name, Bool checked), | |
| 899 | - div (List(DIV_Option), HTML_In_Form content), | |
| 900 | - div_empty (List(DIV_Option)), | |
| 998 | + radio_button (List(InputAttrs), String label_text, HtmlId id, WebArgName name, WebArgValue value, Bool checked), | |
| 999 | + radio_button_r (List(InputAttrs), String label_text, HtmlId id, WebArgName name, WebArgValue value, Bool checked), | |
| 1000 | + check_box (List(InputAttrs), String label_text, HtmlId id, WebArgName name, WebArgValue value, Bool checked), | |
| 1001 | + check_box_r (List(InputAttrs), String label_text, HtmlId id, WebArgName name, WebArgValue value, Bool checked), | |
| 1002 | + div (List(CoreAttrs), HTML_In_Form content), | |
| 1003 | + div_empty (List(CoreAttrs)), | |
| 901 | 1004 | hidden (String name, String value). |
| 902 | 1005 | |
| 903 | 1006 | |
| ... | ... | @@ -988,7 +1091,22 @@ public define HTML_In_Form |
| 988 | 1091 | ) = |
| 989 | 1092 | text([],s). |
| 990 | 1093 | |
| 991 | - | |
| 1094 | +public define HTML_In_Form | |
| 1095 | + radio_button (List(InputAttrs) options, String label_text, WebArgName n, WebArgValue value, Bool checked) | |
| 1096 | + = radio_button (options, label_text, htmlId(n.name), n, value, checked). | |
| 1097 | + | |
| 1098 | +public define HTML_In_Form | |
| 1099 | + radio_button_r (List(InputAttrs) options, String label_text, WebArgName n, WebArgValue value, Bool checked) | |
| 1100 | + = radio_button_r (options, label_text, htmlId(n.name), n, value, checked). | |
| 1101 | + | |
| 1102 | +public define HTML_In_Form | |
| 1103 | + check_box (List(InputAttrs) options, String label_text, WebArgName n, WebArgValue value, Bool checked) | |
| 1104 | + = check_box (options, label_text, htmlId(n.name), n, value, checked). | |
| 1105 | + | |
| 1106 | +public define HTML_In_Form | |
| 1107 | + check_box_r (List(InputAttrs) options, String label_text, WebArgName n, WebArgValue value, Bool checked) | |
| 1108 | + = check_box_r (options, label_text, htmlId(n.name), n, value, checked). | |
| 1109 | + | |
| 992 | 1110 | |
| 993 | 1111 | |
| 994 | 1112 | public type HTML_Off_Form: |
| ... | ... | @@ -1020,8 +1138,8 @@ public type HTML_Off_Form: |
| 1020 | 1138 | Maybe((String,List((String,String)))) action), |
| 1021 | 1139 | label (String name), |
| 1022 | 1140 | form (String form_name, List(CoreAttrs), HTML_In_Form content), |
| 1023 | - div (List(DIV_Option), HTML_Off_Form content), | |
| 1024 | - div_empty (List(DIV_Option)). | |
| 1141 | + div (List(CoreAttrs), HTML_Off_Form content), | |
| 1142 | + div_empty (List(CoreAttrs)). | |
| 1025 | 1143 | |
| 1026 | 1144 | 'HTML_Off_Form' defines all the elements you may put outside any form. |
| 1027 | 1145 | |
| ... | ... | @@ -2241,8 +2359,8 @@ type HTML_Any($T): |
| 2241 | 2359 | any_foreign_link (List(Text_Option), String url, String name), |
| 2242 | 2360 | any_private_download (String abs_path, String name, String extra_ext, |
| 2243 | 2361 | Maybe((String,List((String,String))))), |
| 2244 | - any_div (List(DIV_Option), $T element), | |
| 2245 | - any_div_empty (List(DIV_Option)), | |
| 2362 | + any_div (List(CoreAttrs), $T element), | |
| 2363 | + any_div_empty (List(CoreAttrs)), | |
| 2246 | 2364 | any_coreattrs (List(CoreAttrs)). |
| 2247 | 2365 | |
| 2248 | 2366 | |
| ... | ... | @@ -2761,7 +2879,7 @@ define Printable_tree |
| 2761 | 2879 | }. |
| 2762 | 2880 | |
| 2763 | 2881 | define String |
| 2764 | - format_coreattrs | |
| 2882 | + format_attrs | |
| 2765 | 2883 | ( |
| 2766 | 2884 | List(CoreAttrs) attributs |
| 2767 | 2885 | )= |
| ... | ... | @@ -2771,60 +2889,124 @@ define String |
| 2771 | 2889 | [h .t] then |
| 2772 | 2890 | with current = if h is |
| 2773 | 2891 | { |
| 2774 | - id(id_name) then | |
| 2775 | - " id=\"" + id_name + "\"", | |
| 2776 | - class(class_name) then | |
| 2777 | - " class=\"" + class_name + "\"", | |
| 2778 | - style(style_string) then | |
| 2779 | - " style=\"" + style_string + "\"", | |
| 2780 | - | |
| 2781 | - title(title_string) then | |
| 2782 | - " title=\"" + title_string + "\"", | |
| 2892 | + id(id_name) then | |
| 2893 | + " id=\"" + id_name + "\"", | |
| 2894 | + class(class_name) then | |
| 2895 | + " class=\"" + class_name + "\"", | |
| 2896 | + style(style_string) then | |
| 2897 | + " style=\"" + style_string + "\"", | |
| 2898 | + | |
| 2899 | + tooltip(title_string) then | |
| 2900 | + " title=\"" + title_string + "\"", | |
| 2901 | + | |
| 2902 | + lang(lang) then | |
| 2903 | + " xml:lang=" + lang, | |
| 2904 | + dir(reading_Way) then | |
| 2905 | + if reading_Way is | |
| 2906 | + { | |
| 2907 | + ltr then " dir=ltr", | |
| 2908 | + rtl then " dir=rtl" | |
| 2909 | + }, | |
| 2910 | + | |
| 2911 | + accesskey(key) then | |
| 2912 | + " accesskey=\"" + key + "\"", | |
| 2913 | + tabindex(index) then | |
| 2914 | + " tabindex=\"" + index + "\"", | |
| 2915 | + | |
| 2916 | + attr(name, value) then | |
| 2917 | + " " + name + "=\"" + value + "\"", | |
| 2918 | + | |
| 2919 | + event(e, value) then | |
| 2920 | + " " + event_name(e) + "=\"" + value + "\"", | |
| 2783 | 2921 | }, |
| 2784 | - current + format_coreattrs(t) | |
| 2922 | + current + format_attrs(t) | |
| 2785 | 2923 | }. |
| 2786 | 2924 | |
| 2787 | 2925 | define String |
| 2788 | - _format | |
| 2926 | + format_attrs | |
| 2789 | 2927 | ( |
| 2790 | - List(DIV_Option) opt | |
| 2928 | + List(InputAttrs) attributs | |
| 2791 | 2929 | )= |
| 2792 | - if opt is | |
| 2930 | + if attributs is | |
| 2793 | 2931 | { |
| 2794 | 2932 | [] then "", |
| 2795 | 2933 | [h .t] then |
| 2796 | 2934 | with current = if h is |
| 2797 | 2935 | { |
| 2798 | - id(id_name) then | |
| 2799 | - " id=\"" + id_name + "\"", | |
| 2800 | - class(class_name) then | |
| 2801 | - " class=\"" + class_name + "\"", | |
| 2802 | - style(style_string) then | |
| 2803 | - " style=\"" + style_string + "\"", | |
| 2804 | - | |
| 2805 | - title(title_string) then | |
| 2806 | - " title=\"" + title_string + "\"", | |
| 2807 | - lang(lang) then | |
| 2808 | - " xml:lang=" + lang, | |
| 2809 | - dir(reading_Way) then | |
| 2810 | - if reading_Way is | |
| 2811 | - { | |
| 2812 | - ltr then " dir=ltr", | |
| 2813 | - rtl then " dir=rtl" | |
| 2814 | - }, | |
| 2815 | - attr(name, value) then | |
| 2816 | - " " + name + "=\"" + value + "\"" | |
| 2936 | + class(class_name) then | |
| 2937 | + " class=\"" + class_name + "\"", | |
| 2938 | + style(style_string) then | |
| 2939 | + " style=\"" + style_string + "\"", | |
| 2940 | + | |
| 2941 | + tooltip(title_string) then | |
| 2942 | + " title=\"" + title_string + "\"", | |
| 2943 | + | |
| 2944 | + lang(lang) then | |
| 2945 | + " xml:lang=" + lang, | |
| 2946 | + dir(reading_Way) then | |
| 2947 | + if reading_Way is | |
| 2948 | + { | |
| 2949 | + ltr then " dir=ltr", | |
| 2950 | + rtl then " dir=rtl" | |
| 2951 | + }, | |
| 2952 | + | |
| 2953 | + accesskey(key) then | |
| 2954 | + " accesskey=\"" + key + "\"", | |
| 2955 | + tabindex(index) then | |
| 2956 | + " tabindex=\"" + index + "\"", | |
| 2957 | + | |
| 2958 | + attr(name, value) then | |
| 2959 | + " " + name + "=\"" + value + "\"", | |
| 2960 | + | |
| 2961 | + event(e, value) then | |
| 2962 | + " " + event_name(e) + "=\"" + value + "\"", | |
| 2817 | 2963 | }, |
| 2818 | - current + _format(t) | |
| 2819 | - } | |
| 2820 | - . | |
| 2964 | + current + format_attrs(t) | |
| 2965 | + }. | |
| 2966 | + | |
| 2967 | +//define String | |
| 2968 | +// _format | |
| 2969 | +// ( | |
| 2970 | +// List(CoreAttrs) opt | |
| 2971 | +// )= | |
| 2972 | +// if opt is | |
| 2973 | +// { | |
| 2974 | +// [] then "", | |
| 2975 | +// [h .t] then | |
| 2976 | +// with current = if h is | |
| 2977 | +// { | |
| 2978 | +// id(id_name) then | |
| 2979 | +// " id=\"" + id_name + "\"", | |
| 2980 | +// class(class_name) then | |
| 2981 | +// " class=\"" + class_name + "\"", | |
| 2982 | +// style(style_string) then | |
| 2983 | +// " style=\"" + style_string + "\"", | |
| 2984 | +// | |
| 2985 | +// title(title_string) then | |
| 2986 | +// " title=\"" + title_string + "\"", | |
| 2987 | +// lang(lang) then | |
| 2988 | +// " xml:lang=" + lang, | |
| 2989 | +// dir(reading_Way) then | |
| 2990 | +// if reading_Way is | |
| 2991 | +// { | |
| 2992 | +// ltr then " dir=ltr", | |
| 2993 | +// rtl then " dir=rtl" | |
| 2994 | +// }, | |
| 2995 | +// attr(name, value) then | |
| 2996 | +// " " + name + "=\"" + value + "\"", | |
| 2997 | +// event(e, value) then | |
| 2998 | +// " " + event_name(e) + "=\"" + value + "\"" | |
| 2999 | +// }, | |
| 3000 | +// current + _format(t) | |
| 3001 | +// } | |
| 3002 | +// . | |
| 2821 | 3003 | |
| 2822 | 3004 | define Printable_tree |
| 2823 | 3005 | format_div_option |
| 2824 | 3006 | ( |
| 2825 | - List(DIV_Option) options | |
| 3007 | + List(CoreAttrs) options | |
| 2826 | 3008 | )= |
| 2827 | - ["<div" + _format(options) + ">"] . | |
| 3009 | + ["<div" + format_attrs(options) + ">"] . | |
| 2828 | 3010 | |
| 2829 | 3011 | |
| 2830 | 3012 | define Printable_tree |
| ... | ... | @@ -2865,22 +3047,22 @@ define Printable_tree |
| 2865 | 3047 | [ |
| 2866 | 3048 | if action is |
| 2867 | 3049 | { |
| 2868 | - url(u) then ["<a href=\"",u,"\"", format_coreattrs(options), ">", | |
| 3050 | + url(u) then ["<a href=\"",u,"\"", format_attrs(options), ">", | |
| 2869 | 3051 | text, "</a>" |
| 2870 | 3052 | ], |
| 2871 | 3053 | javascript(s,h) then |
| 2872 | - [s,"<INPUT TYPE =\"button\" Value=\"",text,"\"", format_coreattrs(options), " onClick=\"",h,"\">"] | |
| 3054 | + [s,"<INPUT TYPE =\"button\" Value=\"",text,"\"", format_attrs(options), " onClick=\"",h,"\">"] | |
| 2873 | 3055 | } |
| 2874 | 3056 | ], |
| 2875 | 3057 | submit(options, text) then |
| 2876 | 3058 | [ |
| 2877 | 3059 | if action is |
| 2878 | 3060 | { |
| 2879 | - url(u) then ["<a href=\"",u,"\"", format_coreattrs(options), ">", | |
| 3061 | + url(u) then ["<a href=\"",u,"\"", format_attrs(options), ">", | |
| 2880 | 3062 | text, "</a>" |
| 2881 | 3063 | ], |
| 2882 | 3064 | javascript(s,h) then |
| 2883 | - [s,"<INPUT TYPE =\"submit\" Value=\"",text,"\"", format_coreattrs(options), " onClick=\"",h,"\">"] | |
| 3065 | + [s,"<INPUT TYPE =\"submit\" Value=\"",text,"\"", format_attrs(options), " onClick=\"",h,"\">"] | |
| 2884 | 3066 | } |
| 2885 | 3067 | ], |
| 2886 | 3068 | |
| ... | ... | @@ -3054,7 +3236,7 @@ define String |
| 3054 | 3236 | [h . t] then |
| 3055 | 3237 | if h is |
| 3056 | 3238 | { |
| 3057 | - core_attrs(core_attr_list) then format_coreattrs(core_attr_list), | |
| 3239 | + core_attrs(core_attr_list) then format_attrs(core_attr_list), | |
| 3058 | 3240 | left then " align=left", |
| 3059 | 3241 | h_center then " align=center", |
| 3060 | 3242 | right then " align=right", |
| ... | ... | @@ -3448,7 +3630,7 @@ define Printable_tree |
| 3448 | 3630 | any_div_empty(options) then |
| 3449 | 3631 | [format_div_option(options), "</div>\n"], |
| 3450 | 3632 | any_coreattrs(attributs) then |
| 3451 | - [format_coreattrs(attributs)] | |
| 3633 | + [format_attrs(attributs)] | |
| 3452 | 3634 | }. |
| 3453 | 3635 | |
| 3454 | 3636 | |
| ... | ... | @@ -3503,18 +3685,15 @@ define Printable_tree |
| 3503 | 3685 | format(cinfo,sn,ic_v,any_foreign_link(options,url,name),format_element,is_https), |
| 3504 | 3686 | private_download(url,name,extra,action) then |
| 3505 | 3687 | format(cinfo,sn,ic_v,any_private_download(url,name,extra,action),format_element,is_https), |
| 3506 | - text_input(label_text, label, name,i,w) then | |
| 3507 | - [ "<label for=\"",label,"\">",label_text,"</label>", | |
| 3508 | - "<input type=text name=o",name," id=",label," size=",w," value=\"",i,"\">"], | |
| 3509 | - //[" <input type=text name=o",n," size=",w," value=\"",i,"\">"], | |
| 3510 | - text_input_ro(label_text, label, name,i,w) then | |
| 3511 | - [ "<label for=\"",label,"\">",label_text,"</label>", | |
| 3512 | - "<input readonly=\"readonly\" type=text name=o",name," id=",label," size=",w," value=\"",i,"\">"], | |
| 3513 | - //[" <input type=text name=o",n," size=",w," value=\"",i,"\">"], | |
| 3514 | - password_input(label_text, label, name,w) then | |
| 3515 | - [ "<label for=\"",label,"\">",label_text,"</label>", | |
| 3516 | - "<input type=password name=p",name," id=",label," size=",w,">"], | |
| 3517 | - //[" <input type=password name=p",n," size=",w,">"], | |
| 3688 | + text_input(options, label_text, id, name, i, w) then | |
| 3689 | + [ "<label for=\"",id,"\">",label_text,"</label>", | |
| 3690 | + "<input type=text name=o",name," id=",id," size=",w," value=\"",i,"\"",format_attrs(options),">"], | |
| 3691 | + text_input_ro(options, label_text, id, name,i,w) then | |
| 3692 | + [ "<label for=\"",id,"\">",label_text,"</label>", | |
| 3693 | + "<input readonly=\"readonly\" type=text name=o",name," id=",id," size=",w," value=\"",i,"\"",format_attrs(options),">"], | |
| 3694 | + password_input(options, label_text, id, name,i,w) then | |
| 3695 | + [ "<label for=\"",id,"\">",label_text,"</label>", | |
| 3696 | + "<input type=password name=p",name," id=",id," size=",w," value=\"",i,"\"",format_attrs(options),">"], | |
| 3518 | 3697 | text_area(opts,n,i,w,h) then |
| 3519 | 3698 | ["<textarea ",format(opts)," name=o",n," cols=",w," rows=",h,">",i,"</textarea>"], |
| 3520 | 3699 | file_upload(n,w) then |
| ... | ... | @@ -3528,18 +3707,18 @@ define Printable_tree |
| 3528 | 3707 | selector_c(n,s,cs,sd) then |
| 3529 | 3708 | ["<select name=o",n," size=",s,">",format_choices(cs,sd),"</select>"], |
| 3530 | 3709 | |
| 3531 | - radio_button(label_text,label,n,v,c) then | |
| 3532 | - [ "<label for=\"",label,"\">",label_text,"</label>", | |
| 3533 | - "<input type=radio name=o",n," id=",label," value=\"",v,"\"",(if c then " checked" else ""),">"], | |
| 3534 | - radio_button_r(label_text,label,n,v,c) then | |
| 3535 | - [ "<input type=radio name=o",n," id=",label," value=\"",v,"\"",(if c then " checked" else ""),">", | |
| 3536 | - "<label for=\"",label,"\">",label_text,"</label>"], | |
| 3537 | - check_box(label_text, label,n,c) then | |
| 3538 | - [ if length(label_text) > 0 then "<label for=\""+label+"\">"+label_text+"</label>" else "", | |
| 3539 | - "<input type=checkbox name=o",n," id=\"",label,"\""+(if c then " checked " else ""),">"] | |
| 3540 | - check_box_r(label_text, label,n,c) then | |
| 3541 | - [ "<input type=checkbox name=o",n," id=\"",label,"\""+(if c then " checked " else ""),">", | |
| 3542 | - if length(label_text) > 0 then "<label for=\""+label+"\">"+label_text+"</label>" else "" ] | |
| 3710 | + radio_button(options, label_text, id, n, v, c) then | |
| 3711 | + [ "<label for=\"",id,"\">",label_text,"</label>", | |
| 3712 | + "<input type=radio name=\"",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\"" else ""),format_attrs(options),">"], | |
| 3713 | + radio_button_r(options, label_text, id, n, v, c) then | |
| 3714 | + [ "<input type=radio name=\"",n,"\" id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\"" else ""),format_attrs(options),">", | |
| 3715 | + "<label for=\"",id,"\">",label_text,"</label>"], | |
| 3716 | + check_box(options, label_text, id, n, v, c) then | |
| 3717 | + [ if length(label_text) > 0 then ["<label for=\"",id,"\">",label_text,"</label>"] else [""], | |
| 3718 | + "<input type=checkbox name=o",n," id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\" " else ""),format_attrs(options),">"] | |
| 3719 | + check_box_r(options, label_text, id, n, v, c) then | |
| 3720 | + [ "<input type=checkbox name=o",n," id=\"",id,"\" value=\"",v,"\"",(if c then " checked=\"checked\" " else ""),format_attrs(options),">", | |
| 3721 | + if length(label_text) > 0 then ["<label for=\"",id,"\">",label_text,"</label>"] else [""] ] | |
| 3543 | 3722 | div(options, e) then |
| 3544 | 3723 | format(cinfo,sn,ic_v,any_div(options, e),format_element,is_https), |
| 3545 | 3724 | div_empty(options) then |
| ... | ... | @@ -3597,19 +3776,19 @@ define Bool |
| 3597 | 3776 | foreign_link(o,u) then false, |
| 3598 | 3777 | foreign_link(o,u,n) then false, |
| 3599 | 3778 | private_download(p,n,e,a) then false, |
| 3600 | - text_input(lt,l,n,i,w) then false, | |
| 3601 | - text_input_ro(lt,l,n,i,w) then false, | |
| 3602 | - password_input(lt,l,n,w) then false, | |
| 3779 | + text_input(o,lt,l,n,i,w) then false, | |
| 3780 | + text_input_ro(o,lt,l,n,i,w) then false, | |
| 3781 | + password_input(o,lt,l,n,i,w) then false, | |
| 3603 | 3782 | text_area(o,n,i,w,h) then false, |
| 3604 | 3783 | file_upload(n,w) then true, |
| 3605 | 3784 | selector(n,s,c) then false, |
| 3606 | 3785 | selector(n,s,c,p) then false, |
| 3607 | 3786 | selector_c(n,s,c) then false, |
| 3608 | 3787 | selector_c(n,s,c,p) then false, |
| 3609 | - radio_button(_,_,n,v,c) then false, | |
| 3610 | - radio_button_r(_,_,n,v,c) then false, | |
| 3611 | - check_box(_,_,n,c) then false, | |
| 3612 | - check_box_r(_,_,n,c) then false, | |
| 3788 | + radio_button(o,_,_,n,v,c) then false, | |
| 3789 | + radio_button_r(o,_,_,n,v,c) then false, | |
| 3790 | + check_box(o,_,_,n,v,c) then false, | |
| 3791 | + check_box_r(o,_,_,n,v,c) then false, | |
| 3613 | 3792 | div(o,c) then false, |
| 3614 | 3793 | div_empty(o) then false, |
| 3615 | 3794 | hidden(_,_) then false | ... | ... |