From 8fcf167e257f3f858ece91523697ee609600b31e Mon Sep 17 00:00:00 2001 From: totoro Date: Sun, 10 May 2026 10:51:30 +0900 Subject: [PATCH] [*] BIG CHANGE. Maybe that xlib will become 2.0 Removed all HTML_In_Form, HTML_Off_Form, HTML_Partial_Content type and replaced it by the new type HTML. --- generic/types/stepper.anubis | 2 +- minimal_web_site.ide | 18 ++++++++++++++++++ web/controllers_web_site.anubis | 28 ++++++++++++++-------------- web/counter.anubis | 8 ++++---- web/dojo.anubis | 72 ++++++++++++++++++++++++++++++++++++------------------------------------ web/dropzone.anubis | 8 ++++---- web/fonts/awesome.anubis | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------- web/form.anubis | 306 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ web/form.anubis.bak | 949 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ web/form.anubis.rej | 9 +++++++++ web/frameworks/adminlte4/sidebar.anubis | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ web/generic_form.anubis | 471 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- web/generic_login.anubis | 4 ++-- web/generic_table.anubis | 785 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- web/html_tooltip.anubis | 10 +++++----- web/jQuery/jq_animate.anubis | 4 ++-- web/jQuery/jq_button.anubis | 73 +++++++++++++++++++++++++++++++++++-------------------------------------- web/jQuery/jq_checkbox.anubis | 4 ++-- web/jQuery/jq_datatable.anubis | 38 +++++++++++--------------------------- web/jQuery/jq_dialog.anubis | 33 +++++++++++++++++---------------- web/jQuery/jq_eudock.anubis | 2 +- web/jQuery/jq_jqplot.anubis | 2 +- web/jQuery/jq_radio.anubis | 8 ++++---- web/jQuery/jq_tabs.anubis | 14 +++++++------- web/jQuery/jq_tiptip.anubis | 24 ++++++++++++------------ web/jQuery/jq_toolbar.anubis | 6 +++--- web/l3/l3.anubis | 12 ++++++------ web/load_content.anubis | 15 +++++++-------- web/making_a_web_site.anubis | 3039 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- web/making_a_web_site.anubis.bak | 5892 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ web/page_message.anubis | 30 +++++++++++++++--------------- web/plugin/plugin.anubis | 2 +- web/types/controllers_web_site.anubis | 6 +++--- web/types/making_a_web_site.anubis | 250 +++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- web/types/making_a_web_site.anubis.bak | 903 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ web/types/web_stepper.anubis | 4 ++-- web/web_stepper.anubis | 18 +++++++++--------- web/widgets.anubis | 4 ++-- web/widgets/button.anubis | 73 ++++++++++++++++++++++++++++++++++++------------------------------------- web/widgets/css_helper.anubis | 166 +++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------- web/widgets/dashboard.anubis | 58 +++++++++++++++++++++++++++++++--------------------------- web/widgets/fisheye_menu.anubis | 8 ++++---- web/widgets/icon.anubis | 2 +- web/widgets/icons_set.anubis | 2 +- web/widgets/left_menu_html.anubis | 12 ++++++------ web/widgets/menu.anubis | 32 ++++++++++++++++---------------- web/widgets/pager.anubis | 6 +++--- web/widgets/specialized_elements.anubis | 22 +++++++++++----------- web_controllers/language/language_management.anubis | 49 ++++++++++++++++++++++++------------------------- 49 files changed, 9506 insertions(+), 4157 deletions(-) create mode 100644 minimal_web_site.ide create mode 100644 web/form.anubis.bak create mode 100644 web/form.anubis.rej create mode 100644 web/frameworks/adminlte4/sidebar.anubis delete mode 100644 web/generic_form.anubis delete mode 100644 web/generic_table.anubis create mode 100644 web/making_a_web_site.anubis.bak create mode 100644 web/types/making_a_web_site.anubis.bak diff --git a/generic/types/stepper.anubis b/generic/types/stepper.anubis index 1859fb9..47df615 100644 --- a/generic/types/stepper.anubis +++ b/generic/types/stepper.anubis @@ -27,7 +27,7 @@ public type Step: String name, //step name Int index, //step number (Step_Session stp_session) -> Step_Session process, - (Step_Session stp_session) -> HTML_Partial_Content view + (Step_Session stp_session) -> HTML view ) . diff --git a/minimal_web_site.ide b/minimal_web_site.ide new file mode 100644 index 0000000..1deee12 --- /dev/null +++ b/minimal_web_site.ide @@ -0,0 +1,18 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +# SharpDevelop 1.0.12.108 +Project("{B6712916-30DE-4a3e-A54C-2A79AC984AEE}") = "minimal_web_site", "minimal_web_site.aproj", "{F2C65267-0D20-4964-A5D8-602BD42C01A4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F2C65267-0D20-4964-A5D8-602BD42C01A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2C65267-0D20-4964-A5D8-602BD42C01A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F2C65267-0D20-4964-A5D8-602BD42C01A4}.Release|Any CPU.Build.0 = Release|Any CPU + {F2C65267-0D20-4964-A5D8-602BD42C01A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/web/controllers_web_site.anubis b/web/controllers_web_site.anubis index 0827e30..170d091 100644 --- a/web/controllers_web_site.anubis +++ b/web/controllers_web_site.anubis @@ -127,7 +127,7 @@ public type WEB_Page_Renderer: web_page_renderer( String app, //application String name, //renderer name - (WEB_Session _session, List(WEB_Plugin), HTML_Partial_Content _content) -> HTTP_Answer page_layout //call back for rendering page + (WEB_Session _session, List(WEB_Plugin), HTML _content) -> HTTP_Answer page_layout //call back for rendering page ) . @@ -156,7 +156,7 @@ define HTTP_Answer pre("Error "+to_String(http_status)), pre("Internal message :"+message), br, - in_form(html_Id(""),text_area(wan(""), init(dump(_session)), 120, 60)) + textarea(120, 60, text(dump(_session))) ]) ) ) @@ -183,14 +183,14 @@ public define WEB_Controller_Result public define WEB_Controller_Result ajax ( - HTML_Partial_Content content + HTML content )= ajax(failure, content, ""). public define WEB_Controller_Result ajax ( - HTML_Partial_Content content, + HTML content, String additional_script )= ajax(failure, content, additional_script). @@ -199,7 +199,7 @@ public define WEB_Controller_Result ajax ( WEB_Session session, //modified session - HTML_Partial_Content content + HTML content )= ajax(success(session), content, ""). @@ -207,7 +207,7 @@ public define WEB_Controller_Result ajax ( WEB_Session session, //modified session - HTML_Partial_Content content, + HTML content, String additional_script )= ajax(success(session), content, additional_script). @@ -246,7 +246,7 @@ public define WEB_Controller_Result public define WEB_Controller_Result renderer_content( - HTML_Partial_Content content, + HTML content, )= renderer_content(failure, content) . @@ -254,7 +254,7 @@ public define WEB_Controller_Result public define WEB_Controller_Result renderer_content( WEB_Session session, //modified session if success else failure - HTML_Partial_Content content, + HTML content, )= renderer_content(success(session), content) . @@ -262,7 +262,7 @@ public define WEB_Controller_Result public define WEB_Controller_Result partial_content ( - HTML_Partial_Content content, + HTML content, )= http_answer(html_page( "", // title of web site @@ -273,7 +273,7 @@ public define WEB_Controller_Result [], // content of page - partial(content) + content )) ) . @@ -285,7 +285,7 @@ define WEB_Page_Renderer web_page_renderer("AWS", "AWS_DEFAULT_PAGE", ( WEB_Session _session, List(WEB_Plugin) _plugins, - HTML_Partial_Content _content + HTML _content ) |-> with _title = get_page_title(_session), html_page @@ -296,7 +296,7 @@ define WEB_Page_Renderer body // body of page ( [], //body options empty - (HTML_Off_Form)partial(_content) + _content ) ) ) @@ -430,8 +430,8 @@ define WEB_Page_Renderer } . -public define JsonValue to_html_ajax_content(Printable_tree content_HTML, String additional_script). -public define JsonValue to_html_ajax_content(HTML_Partial_Content content_HTML, CommonInfo cinfo, String additional_script). +public define JsonValue to_html_ajax_content(Printable_tree content_HTML, String additional_script). +public define JsonValue to_html_ajax_content(HTML content_HTML, CommonInfo cinfo, String additional_script). define String get_controller_from_web_arg diff --git a/web/counter.anubis b/web/counter.anubis index 8e8aa7d..8b6ef7b 100644 --- a/web/counter.anubis +++ b/web/counter.anubis @@ -17,7 +17,7 @@ read web/making_a_web_site.anubis This is the counter to be inserted into a web page: -public define HTML_Off_Form +public define HTML web_counter ( String directory, // where the counter file will be located @@ -57,7 +57,7 @@ define List(Word8) else l. -define HTML_Off_Form +define HTML web_counter ( Int n, // value of counter @@ -76,7 +76,7 @@ define HTML_Off_Form -public define HTML_Off_Form +public define HTML web_counter ( String directory, // where the counter file will be located @@ -110,4 +110,4 @@ public define One }. - \ No newline at end of file + diff --git a/web/dojo.anubis b/web/dojo.anubis index b0826f4..083b116 100644 --- a/web/dojo.anubis +++ b/web/dojo.anubis @@ -49,7 +49,7 @@ define String -public define HTML_Off_Form +public define HTML dojo_button ( String name, @@ -74,11 +74,11 @@ public type InputDial: input_hidden(HTML_Id id, WebArgValue value). -define List(HTML_Off_Form) +define List(HTML) format_list_data ( List((List(CoreAttrs), WebArgValue, String)) list_data, - List(HTML_Off_Form) result_list + List(HTML) result_list )= if list_data is { @@ -88,7 +88,7 @@ define List(HTML_Off_Form) format_list_data(t, [literal("") . result_list]) }. -public define HTML_Off_Form +public define HTML dojo_combobox ( WebArgName the_name, @@ -106,7 +106,7 @@ public define HTML_Off_Form literal("") ]). -define HTML_Off_Form +define HTML _maybe_label ( String label_text, @@ -115,7 +115,7 @@ define HTML_Off_Form if length(label_text) > 0 then literal("") else literal(""). -public define HTML_Off_Form +public define HTML dojo_checkbox ( WebArgName the_name, @@ -131,7 +131,7 @@ public define HTML_Off_Form ]). -define HTML_Off_Form +define HTML input_in_dialog ( InputDial input_data @@ -189,7 +189,7 @@ define HTML_Off_Form } . -define List(HTML_Off_Form) +define List(HTML) inputs_in_dialog ( List(InputDial) inputs_data @@ -200,7 +200,7 @@ define List(HTML_Off_Form) [h . t] then [input_in_dialog(h) . inputs_in_dialog(t)] }. -public define HTML_Off_Form +public define HTML dijit_dialog ( String name, @@ -233,7 +233,7 @@ public define HTML_Off_Form ]) . -public define HTML_Off_Form +public define HTML dojo_dialog ( String name, @@ -330,7 +330,7 @@ public define String + "]; ". -public define HTML_Off_Form +public define HTML dojo_make_grid_script ( HTML_Id html_id, @@ -346,7 +346,7 @@ public define HTML_Off_Form }); "). -public define HTML_Off_Form +public define HTML dojo_grid ( HTML_Id html_id, @@ -358,7 +358,7 @@ public define HTML_Off_Form empty, [], empty). -public define HTML_Off_Form +public define HTML dojo_grid ( HTML_Id html_id, @@ -384,11 +384,11 @@ public define HTML_Off_Form //
"). -public define HTML_Off_Form +public define HTML dojo_message_box ( - HTML_Off_Form name1, - HTML_Off_Form name2, + HTML name1, + HTML name2, )= sequence([ br, @@ -401,7 +401,7 @@ public define HTML_Off_Form -public define HTML_Off_Form +public define HTML dojo_tooltip ( String title, @@ -452,13 +452,13 @@ define String }. -public define HTML_Off_Form +public define HTML dojo_ContentPane ( List(CoreAttrs) attributes, BorderContainerRegion region, Bool splitter, - HTML_Off_Form content + HTML content ) = div([ attr("dojoType", "dijit.layout.ContentPane"), attr("region", to_String(region)), @@ -478,17 +478,17 @@ public define HTML_In_Form attr("splitter", if splitter then "true" else "false") . attributes ], content). -public define HTML_Off_Form +public define HTML dojo_TabContainer ( List(CoreAttrs) attributes, - HTML_Off_Form content + HTML content ) = div([attr("dojoType", "dijit.layout.TabContainer") . attributes ], content). -public define HTML_Off_Form +public define HTML dojo_BorderContainer ( List(CoreAttrs) attributes, @@ -498,7 +498,7 @@ public define HTML_Off_Form Bool persist, Bool closable, String container, - HTML_Off_Form content + HTML content ) = with the_attributes = (List(CoreAttrs)) [attr("dojoType", "dijit.layout.BorderContainer"), attr("dojoAttachPoint", container), attr("design", to_String(design)), attr("liveSplitters", live_splitter), attr("persist", persist), @@ -532,7 +532,7 @@ public define HTML_In_Form }, div(total_attributes, content). -public define HTML_Off_Form +public define HTML dojo_tree ( List(CoreAttrs) attributes, @@ -541,24 +541,24 @@ public define HTML_Off_Form -public define HTML_Off_Form +public define HTML dojo_Toolbar ( List(CoreAttrs) attributes, - HTML_Off_Form content + HTML content )= div([attr("dojoType", "dijit.Toolbar") . attributes ], content). -public define HTML_Off_Form +public define HTML dojo_tooltip ( List(CoreAttrs) attributes, // List(Text_Option) txt_attr, HTML_Id html_id, String label, - HTML_Off_Form tooltip_content, + HTML tooltip_content, )= sequence([ text([id(html_id.id)], label), @@ -566,7 +566,7 @@ public define HTML_Off_Form ]). -public define HTML_Off_Form +public define HTML dojo_button ( HTML_Id html_id, @@ -615,12 +615,12 @@ public define HTML_In_Form }). -public define HTML_Off_Form +public define HTML dojo_declaration ( String name, List(CoreAttrs) attributes, - HTML_Off_Form content + HTML content )= div([attr("dojoType", "dijit.Declaration"), attr("widgetClass", name) . attributes ], content). @@ -636,13 +636,13 @@ public define HTML_In_Form div([attr("dojoType", "dijit.Declaration"), attr("widgetClass", name) . attributes ], content). -public define HTML_Off_Form +public define HTML dojo_editor ( List(CoreAttrs) attributes, HTML_Id html_id, WebArgName input_name, - HTML_Off_Form text, + HTML text, )= div([id(html_id.id), attr("name", input_name.name), attr("dojoType", "dijit.Editor") ,attr("extraPlugins", "['|', 'foreColor','hiliteColor',{name:'dojox.editor.plugins.FontChoice', command:'fontName', generic:true},'fontSize','formatBlock','|','createLink','insertImage']") @@ -690,7 +690,7 @@ public define HTML_In_Form // selector_c([attr("dojoType", "dijit.form.ComboBox") . attributes], label, id, name, 1, list_data, selected, non_mandatory). selector_c([attr("dojoType", "dijit.form.ComboBox") . attributes], label(label_str, no_help), id, name, 1, list_data, selected). -public define HTML_Off_Form +public define HTML dojo_toaster ( List(CoreAttrs) attributes, @@ -712,7 +712,7 @@ public define HTML_Off_Form . attributes ]), literal("")). -public define HTML_Off_Form +public define HTML dojo_progressBar ( List(CoreAttrs) attributes, @@ -725,7 +725,7 @@ public define HTML_Off_Form div([id(html_id.id), class("progress_bar"), attr("indeterminate", "true"), attr("dojoType", "dijit.ProgressBar") . attributes], literal("")) ]). -public define HTML_Off_Form +public define HTML dojo_progressBar ( List(CoreAttrs) attributes, diff --git a/web/dropzone.anubis b/web/dropzone.anubis index e937422..2eb458c 100644 --- a/web/dropzone.anubis +++ b/web/dropzone.anubis @@ -11,7 +11,7 @@ read system/string.anubis read xlib/web/making_a_web_site.anubis read xlib/web/jquery.anubis -public define HTML_Partial_Content +public define HTML dropzone ( String dropzone_form_name, @@ -23,7 +23,7 @@ public define HTML_Partial_Content List((String,String)) extra_ops, ) = with dropzone_form_id = to_lower(dropzone_form_name+"_"+generate_random_string(15)), - partial_content( + head_tags( [ js(js_file("xlib/js/dropzone.js")), css(css_file("xlib/css/dropzone.css")), js_script(" @@ -42,11 +42,11 @@ public define HTML_Partial_Content $('#"+dropzone_form_id+"').dropzone(); " ) ], - form(dropzone_form_id, [class("dropzone")], submit_action, extra_ops, empty) + form([id(dropzone_form_id), class("dropzone"), action(submit_action, extra_ops)]) ) . -public define HTML_Partial_Content +public define HTML dropzone ( String dropzone_form_name, diff --git a/web/fonts/awesome.anubis b/web/fonts/awesome.anubis index 658a381..6af68cd 100644 --- a/web/fonts/awesome.anubis +++ b/web/fonts/awesome.anubis @@ -14,7 +14,7 @@ public type Font_Awesome: ) . -public define HTML_Off_Form +public define HTML to_HTML ( Font_Awesome fa, @@ -27,7 +27,7 @@ public define HTML_Off_Form -public define HTML_Off_Form +public define HTML to_HTML ( Font_Awesome fa, @@ -36,7 +36,7 @@ public define HTML_Off_Form to_HTML(fa, attrs, "") . -public define HTML_Off_Form +public define HTML to_HTML ( Font_Awesome fa, @@ -46,7 +46,7 @@ public define HTML_Off_Form . -public define HTML_Off_Form +public define HTML to_HTML ( Font_Awesome fa, @@ -55,7 +55,7 @@ public define HTML_Off_Form to_HTML(fa, [], text) . -public define HTML_Off_Form +public define HTML to_HTML ( Font_Awesome fa @@ -63,49 +63,49 @@ public define HTML_Off_Form to_HTML(fa, [], "") . -public define HTML_In_Form - to_HTML - ( - Font_Awesome fa, - List(CoreAttrs) attrs, - String text - )= - since fa is awesome(code), - i([class("fa fa-"+code), attr("aria-hidden", "true")]+attrs, text) -. - -public define HTML_In_Form - to_HTML - ( - Font_Awesome fa, - List(CoreAttrs) attrs - )= - to_HTML(fa, attrs, "") -. - -public define HTML_In_Form - to_HTML - ( - Font_Awesome fa, - CoreAttrs attr - )= - to_HTML(fa, [attr], "") -. - - -public define HTML_In_Form - to_HTML - ( - Font_Awesome fa, - String text - )= - to_HTML(fa, [], text) -. - -public define HTML_In_Form - to_HTML - ( - Font_Awesome fa - )= - to_HTML(fa, [], "") -. +//public define HTML_In_Form +// to_HTML +// ( +// Font_Awesome fa, +// List(CoreAttrs) attrs, +// String text +// )= +// since fa is awesome(code), +// i([class("fa fa-"+code), attr("aria-hidden", "true")]+attrs, text) +//. + +//public define HTML_In_Form +// to_HTML +// ( +// Font_Awesome fa, +// List(CoreAttrs) attrs +// )= +// to_HTML(fa, attrs, "") +//. +// +//public define HTML_In_Form +// to_HTML +// ( +// Font_Awesome fa, +// CoreAttrs attr +// )= +// to_HTML(fa, [attr], "") +//. +// +// +//public define HTML_In_Form +// to_HTML +// ( +// Font_Awesome fa, +// String text +// )= +// to_HTML(fa, [], text) +//. +// +//public define HTML_In_Form +// to_HTML +// ( +// Font_Awesome fa +// )= +// to_HTML(fa, [], "") +//. diff --git a/web/form.anubis b/web/form.anubis index d53f679..6929def 100644 --- a/web/form.anubis +++ b/web/form.anubis @@ -49,44 +49,44 @@ public type CXM_Form_Field: //--- text input field ---------------------------------------------------------------- input( List(CoreAttrs) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - InitialValue init_value, - Width width, - Mandatory mandatory + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + InitialValue init_value, + Width width, + Mandatory mandatory ), input_readonly( List(CoreAttrs) options, - HTML_Label label, + HTML_Label label, HTML_Id id, - WebArgName web_arg_name, - InitialValue init_value, - Width width + WebArgName web_arg_name, + InitialValue init_value, + Width width ), //--- text area field ----------------------------------------------------------------- text_area( - List(TextAreaOption) options, - HTML_Label label, - HTML_Id id, - WebArgName web_arg_name, - InitialValue init_value, - Width width, - Int height, - Mandatory mandatory + List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + InitialValue init_value, + Width width, + Int height, + Mandatory mandatory ), //--- password input field ------------------------------------------------------------ password_input( List(CoreAttrs) options, - HTML_Label label, + HTML_Label label, HTML_Id id, WebArgName web_arg_name, InitialValue init_value, - Width width, - Mandatory mandatory), + Width width, + Mandatory mandatory), //--- phone field ------------------------------------------------------------ phone_input( @@ -162,7 +162,7 @@ public type CXM_Form_Field: HTML_Id id, WebArgName web_arg_name, Int size, - List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items, + List((List(CoreAttrs), WebArgValue, String, HTML)) items, Maybe(InitialValue) selected, Mandatory mandatory), @@ -252,13 +252,13 @@ public type CXM_Form_Field: Width width, Mandatory mandatory), - raw_in_form (HTML_In_Form html), + raw_in_form (HTML html), label_for ( String label, HTML_Id id, - HTML_In_Form input), - div (List(CoreAttrs), List(HTML_In_Form) contents), + HTML input), + div (List(CoreAttrs), List(HTML) contents), div (List(CoreAttrs), List(CXM_Form_Field) fields), - partial (HTML_Partial_Content p_content), + html (HTML p_content), br, hr (List(CoreAttrs) options), // input_with_help (CXM_Form_Field field, @@ -376,14 +376,6 @@ public define CXM_Form_Field public define CXM_Form_Field upload(HTML_Label label, HTML_Id id, WebArgName name, Width width, Mandatory mand) = upload([], label, id, name, width, mand). - - public define CXM_Form_Field - input_with_help (CXM_Form_Field field, String help_text) - = input_with_help (field, failure, help_text, 250). - - public define CXM_Form_Field - input_with_help (CXM_Form_Field field, String help_text, Int width) - = input_with_help (field, failure, help_text, width). public define CXM_Form_Field ip_input @@ -433,7 +425,7 @@ public define CXM_Form_Field div ( List(CoreAttrs) attrs, - HTML_In_Form content + HTML content )= div(attrs, [content]) . @@ -441,7 +433,7 @@ public define CXM_Form_Field public define CXM_Form_Field div ( - HTML_In_Form content + HTML content )= div([], [content]) . @@ -449,13 +441,13 @@ public define CXM_Form_Field // ////////////////////////////////////////////////////////// -define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content)) +define (List((List(CoreAttrs), WebArgValue, String)), List(HTML)) construct_selector_hide_show ( String div_id, - List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items, + List((List(CoreAttrs), WebArgValue, String, HTML)) items, List((List(CoreAttrs), WebArgValue, String)) so_far_1, - List(HTML_Partial_Content) so_far_2, + List(HTML) so_far_2, Int n ) = if items is @@ -464,17 +456,17 @@ define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content) [h . t] then since h is (cores, wav, label, content), with linked_element = div_id + n, - construct_selector_hide_show(div_id, t, [([data("linked_element", linked_element) . cores], wav, label) . so_far_1], [ partial_content([], div([id(linked_element), style("display: none")], content)) . so_far_2 ], n + 1) + construct_selector_hide_show(div_id, t, [([data("linked_element", linked_element) . cores], wav, label) . so_far_1], [ div([id(linked_element), style("display: none")], content) . so_far_2 ], n + 1) }. -define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content)) +define (List((List(CoreAttrs), WebArgValue, String)), List(HTML)) construct_selector_hide_show ( String div_id, - List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items + List((List(CoreAttrs), WebArgValue, String, HTML)) items ) = construct_selector_hide_show(div_id, items, [], [], 0). -public define HTML_In_Form +public define HTML format_div_CXM_Form_Field ( List(CXM_Form_Field) field, @@ -484,7 +476,7 @@ public define HTML_In_Form ). -public define HTML_In_Form +public define HTML format_CXM_Form_Field ( CXM_Form_Field ff, //CXM_Form_Field to format @@ -523,14 +515,11 @@ public define HTML_In_Form if ff is { - no_field then - empty, + no_field then empty, - title(t) then - literal("

"+t+"

"), + title(t) then h3(t), - message(t) then - literal(t), + message(t) then literal(t), input(options, _label, id, wan, default, w, mand) then text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), @@ -539,39 +528,38 @@ public define HTML_In_Form text_input_ro([class("in") . options], _label, id, name, init, pixels(w)), text_area(options, _label, id, wan, default, w, height, mand) then - text_area([input_attrs([class("in")]) . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w), height), + text_area([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w), height), password_input(options, _label, id, name, init, w, mand) then password_input([class("in") . options], star(_label, mand), id, name, init, pixels(w)), - phone_input(mb_sms_options, icon_options, options, _label, id, wan, default, phone_type, w, mand) then + phone_input(mb_sms_options, icon_options, options, _label, _id, wan, default, phone_type, w, mand) then sequence([ if mb_sms_options is { failure then empty, - success(sms_options) then image([event(onmouseover, "/icons/16x16/send_sms.png")]+sms_options, "/icons/16x16/sms.png", "") + success(sms_options) then img([event(onmouseover, "/icons/16x16/send_sms.png")]+sms_options, "/icons/16x16/sms.png") }, - image(icon_options, "/icons/16x16/"+to_Icon(phone_type), ""), - text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), + img(icon_options, "/icons/16x16/"+to_Icon(phone_type)), + input([class("in"), id(_id.id), name(wan.name), init(get_String(lwa, wan.name, default.value)), size(pixels(w)). options]), ]), email_input(icon_options, options, _label, id, wan, default, w, mand) then sequence([ - image(icon_options, "/icons/16x16/email_edit.png", ""), + img(icon_options, "/icons/16x16/email_edit.png"), text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), ]), url_input(icon_options, options, _label, id, wan, default, w, mand) then sequence([ - image(icon_options, "/icons/16x16/url.png", ""), + img(icon_options, "/icons/16x16/url.png"), text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), ]), - hidden(id, name, init) then - hidden(id, name, init), + hidden(h_id, wan, wav) then hidden(wan.name, wav.value), explain(t) then - div([class("sub")], literal(t)), + div(class("sub"), literal(t)), selector(options, _label, id, wan, size, items, selected, mand) then if selected is @@ -591,8 +579,8 @@ public define HTML_In_Form with div_id = generate_random_string(15), since construct_selector_hide_show(div_id, items_with_partial) is (items, partial_content_list), sequence([ - selector_c([class("in"), class("cxm_selector_hide_show"), event(onchange, "select_hide_show('" + div_id + "', this);")], star(_label, mand), id, wan, size, reverse(items), if selected is { failure then init(""), success(default) then init(get_String(lwa, wan.name, default.value)) } ), - partial(partial_content(partial_content_list)) + selector_c([class("in cxm_selector_hide_show"), event(onchange, "select_hide_show('" + div_id + "', this);")], star(_label, mand), id, wan, size, reverse(items), if selected is { failure then init(""), success(default) then init(get_String(lwa, wan.name, default.value)) } ), + sequence(partial_content_list) ]), checkbox(options, _label, id, wan, checked, mand) then @@ -604,7 +592,7 @@ public define HTML_In_Form checkbox_hide_show(options, _label, wan, checked, fields) then with div_id = generate_random_string(15), sequence([ - check_box([data("show_id", div_id), class("in"), class("cxm_checkbox_hide_show"), event(onclick, "checked_hide_show_element('"+div_id+"', this);")], _label, html_Id("checkbox_"+div_id), wan, get_Bool(lwa, wan.name, checked)), + check_box([data("show_id", div_id), class("in cxm_checkbox_hide_show"), event(onclick, "checked_hide_show_element('"+div_id+"', this);")], _label, html_Id("checkbox_"+div_id), wan, get_Bool(lwa, wan.name, checked)), div([id(div_id), style("display:"+if checked then "block" else "none")], format_div_CXM_Form_Field(fields, lwa, _class, b_with_label)) ]), @@ -644,39 +632,29 @@ public define HTML_In_Form ), ]), one_line_fields(fields) then - table([nude, class("form_one_line")],[row([], - map((CXM_Form_Field ff2) |-> cell([],format_CXM_Form_Field(ff2, lwa, _class, b_with_label)),fields))]) + table(class("form_one_line nude"),[tr( + map((CXM_Form_Field ff2) |-> td(format_CXM_Form_Field(ff2, lwa, _class, b_with_label)),fields))]) , - upload(options, _label, id, name, w, mand) then file_upload([class("in") . options], star(_label, mand), id, name, pixels(w)), - raw_in_form(html) then html, -// div([class("in")], html), - label_for(label, id, input) then + raw_in_form(html) then div(class("in"), html), + label_for(_label, _id, input) then sequence([ - if id is html_Id(_id) then - literal(""), + label(for(_id.id), _label), input ]), div(options, e) then div(options, e), div(options, fields)then div(options, format_div_CXM_Form_Field(fields, lwa, _class, b_with_label)), - partial(p_content) then partial(p_content), + html(p_content) then p_content, br then br, hr(opts) then hr(opts), -// input_with_help(input, help_title, help_text, width) then -// sequence([ -// format_CXM_Form_Field(input, lwa, html_tooltip(force_String(help_title), help_text, width)), -// ]), - - fieldset(options, legend, fields) then - sequence([ - literal(""), - literal(if length(legend) > 0 then "" + legend + "" else ""), + fieldset(options, _legend, fields) then + fieldset(options, [ + if _legend = "" then legend(_legend) else empty, format_div_CXM_Form_Field(fields, lwa, _class, b_with_label), - literal("") - ]), + ]), blank_space then div([class("blank_space")], literal(" ")), @@ -698,31 +676,8 @@ public define HTML_In_Form empty then literal("") }. - public define HTML_In_Form - format_div_CXM_Form_Field - ( - CXM_Form_Field field, - List(Web_arg) lwa, - String _class, - Bool b_with_label - )= - if field is empty then - empty - else if field is no_field then - empty - else if field is hidden(id, name, init) then - format_CXM_Form_Field(field, lwa, _class, b_with_label) - else if field is br then - format_CXM_Form_Field(field, lwa, _class, b_with_label) - else if field is text_area(options, _label, id, wan, default, w, height, mand) then - div([], format_CXM_Form_Field(field, lwa, _class, b_with_label)) - else - div([class(_class)], format_CXM_Form_Field(field, lwa, _class, b_with_label)) -. - - -public define HTML_In_Form +public define HTML format_div_CXM_Form_Field ( List(CXM_Form_Field) fields, @@ -739,7 +694,7 @@ public define HTML_In_Form empty else if field is no_field then empty - else if field is hidden(id, name, init) then + else if field is hidden(_id, name, init) then format_CXM_Form_Field(field, lwa, _class, b_with_label) else if field is br then format_CXM_Form_Field(field, lwa, _class, b_with_label) @@ -750,8 +705,8 @@ public define HTML_In_Form , fields)) . -public define HTML_In_Form - to_HTML_In_Form +public define HTML + to_HTML ( List(CXM_Form_Field) fields, List(Web_arg) lwa, @@ -761,61 +716,47 @@ public define HTML_In_Form format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) . - "form_field aligned" - - public define HTML_In_Form - fieldset - ( - CXM_Form_Field field, - List(Web_arg) lwa, - String _class, - Bool b_with_label - )= - fieldset([field], lwa, _class, b_with_label) -. - - -public define HTML_In_Form - to_HTML_In_Form +public define HTML + to_HTML ( List(CXM_Form_Field) fields, String _class, Bool b_with_label )= - to_HTML_In_Form(fields, [], _class, b_with_label). + to_HTML(fields, [], _class, b_with_label). -public define HTML_In_Form - to_HTML_In_Form +public define HTML + to_HTML ( List(CXM_Form_Field) fields, List(Web_arg) lwa )= - to_HTML_In_Form(fields, lwa, "form_field aligned", true) + to_HTML(fields, lwa, "form_field aligned", true) . -public define HTML_In_Form - to_HTML_In_Form +public define HTML + to_HTML ( CXM_Form_Field field, List(Web_arg) lwa )= - to_HTML_In_Form([field], lwa, "form_field aligned", true) + to_HTML([field], lwa, "form_field aligned", true) . -public define HTML_In_Form - to_HTML_In_Form +public define HTML + to_HTML ( List(CXM_Form_Field) fields )= - to_HTML_In_Form(fields, [], "form_field aligned", true) + to_HTML(fields, [], "form_field aligned", true) . -public define HTML_Off_Form +public define HTML cxm_form ( HTML_Id form_Id, List(CoreAttrs) options, - WEB_Action_Name action, + WEB_Action_Name _action, List((String,String)) extra_ops, List(Web_arg) lwa, List(CXM_Form_Field) fields, @@ -823,39 +764,32 @@ public define HTML_Off_Form Bool b_with_label ) = form( - form_Id, - [class("cxm_form") . options], - action, - extra_ops, + [id(form_Id.id), class("cxm_form"), action(_action, extra_ops) . options], format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) ). -public define HTML_Off_Form -/* older manner to call CXM_form with action as String. - * this function only exists for compatibility with older projects. Please consider - * to use the above function with WEB_Action_Name instead of String -*/ - cxm_form - ( - HTML_Id form_Id, - List(CoreAttrs) options, - String action, //older manner to call action with String - List((String,String)) extra_ops, - List(Web_arg) lwa, - List(CXM_Form_Field) fields, - String _class, - Bool b_with_label - ) = - - form( - form_Id, - [class("cxm_form") . options], - action_name(action), - extra_ops, - format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) - ). +//public define HTML +///* older manner to call CXM_form with action as String. +// * this function only exists for compatibility with older projects. Please consider +// * to use the above function with WEB_Action_Name instead of String +//*/ +// cxm_form +// ( +// HTML_Id form_Id, +// List(CoreAttrs) options, +// String _action, //older manner to call action with String +// List((String,String)) extra_ops, +// List(Web_arg) lwa, +// List(CXM_Form_Field) fields, +// String _class, +// Bool b_with_label +// ) = +// form( +// [class("cxm_form"), id(form_Id.id), action(_action, extra_ops) . options], +// format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) +// ). -public define HTML_Off_Form +public define HTML cxm_form ( String form_name, @@ -869,7 +803,7 @@ public define HTML_Off_Form )= cxm_form(html_Id(form_name), options, action, extra_ops, lwa, form_fields, _class, b_with_label). -public define HTML_Off_Form +public define HTML cxm_form ( String form_name, @@ -882,7 +816,7 @@ public define HTML_Off_Form cxm_form(form_name, options, action, extra_ops, lwa, form_fields, "form_field aligned", true) . -public define HTML_Off_Form +public define HTML cxm_form ( String form_name, @@ -897,7 +831,7 @@ public define HTML_Off_Form cxm_form(html_Id(form_name), options, action_name(action), extra_ops, lwa, form_fields, "form_field aligned", b_with_label) . -public define HTML_Off_Form +public define HTML cxm_form ( String form_name, @@ -910,28 +844,28 @@ public define HTML_Off_Form cxm_form(html_Id(form_name), options, action_name(action), extra_ops, lwa, form_fields, "form_field aligned", true) . -public define HTML_Off_Form +public define HTML cxm_form ( String form_id, List(CoreAttrs) options, - List(HTML_In_Form) fields, + List(HTML) fields, String _class ) = - cxm_form(html_Id(form_id), options, action_name(""), [], [], map((HTML_In_Form field) |-> raw_in_form(field), fields), _class, true ) + cxm_form(html_Id(form_id), options, action_name(""), [], [], map((HTML field) |-> raw_in_form(field), fields), _class, true ) . -public define HTML_Off_Form +public define HTML cxm_form ( String form_id, - List(CoreAttrs) options, - List(HTML_In_Form) fields + List(CoreAttrs) options, + List(HTML) fields ) = - cxm_form(html_Id(form_id), options, action_name(""), [], [], map((HTML_In_Form field) |-> raw_in_form(field), fields), "form_field aligned", true ) + cxm_form(html_Id(form_id), options, action_name(""), [], [], map((HTML field) |-> raw_in_form(field), fields), "form_field aligned", true ) . -public define HTML_Off_Form +public define HTML cxm_form ( String form_id, @@ -943,16 +877,16 @@ public define HTML_Off_Form ) = cxm_form(html_Id(form_id), options, action_name(""), [], lwa, fields, _class, b_with_label). -public define HTML_Off_Form +public define HTML cxm_form ( String form_id, - List(HTML_In_Form) fields, + List(HTML) fields, String _class ) = - cxm_form(html_Id(form_id), [], action_name(""), [], [], map((HTML_In_Form field) |-> raw_in_form(field), fields), _class, true ). + cxm_form(html_Id(form_id), [], action_name(""), [], [], map((HTML field) |-> raw_in_form(field), fields), _class, true ). -public define HTML_Off_Form +public define HTML cxm_form ( String form_id, @@ -962,7 +896,7 @@ public define HTML_Off_Form ) = cxm_form(form_id, [], lwa, fields, _class, true). -public define HTML_Off_Form +public define HTML cxm_form ( String form_id, @@ -971,7 +905,7 @@ public define HTML_Off_Form ) = cxm_form(form_id, [], lwa, fields, "form_field aligned", true). -public define HTML_Off_Form +public define HTML cxm_form ( String form_id, @@ -980,7 +914,7 @@ public define HTML_Off_Form ) = cxm_form(form_id, options, [], fields, "form_field aligned", true). -public define HTML_Off_Form +public define HTML cxm_form ( String form_id, @@ -989,7 +923,7 @@ public define HTML_Off_Form ) = cxm_form(html_Id(form_id), [], action_name(""), [], [], fields, _class, true). -public define HTML_Off_Form +public define HTML cxm_form ( String form_id, diff --git a/web/form.anubis.bak b/web/form.anubis.bak new file mode 100644 index 0000000..97845ab --- /dev/null +++ b/web/form.anubis.bak @@ -0,0 +1,949 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ + * Date: 07/12/2014 + * Time: 16:49 + * © David RENÉ + */ + +// ************************************************************************************* +// *** Generic form +// ************************************************************************************* +read tools/basis.anubis +read system/string.anubis +read xlib/web/common.anubis +read xlib/web/web_arg_utils.anubis +read xlib/web/making_a_web_site.anubis +read xlib/web/html_tooltip.anubis +read xlib/web/widgets.anubis +read xlib/web/widgets/specialized_elements.anubis + +public type Mandatory: // used to mark fields as mandatory. + mandatory, + non_mandatory. + +public type Width: + small, //10 char + narrow_small, //20 char + narrow, //50 char + wide, //70 char + custom(Int). + +public type FormFieldWidth: + auto, + custom(Int). + +public type CXM_Form_Field: + no_field, // empty field + + //--- title field --------------------------------------------------------------------- + title( + String text + ), + + //--- message field ------------------------------------------------------------------- + message( + String text + ), + + //--- text input field ---------------------------------------------------------------- + input( + List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + InitialValue init_value, + Width width, + Mandatory mandatory + ), + + input_readonly( + List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + InitialValue init_value, + Width width + ), + + //--- text area field ----------------------------------------------------------------- + text_area( + List(TextAreaOption) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + InitialValue init_value, + Width width, + Int height, + Mandatory mandatory + ), + + //--- password input field ------------------------------------------------------------ + password_input( + List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + InitialValue init_value, + Width width, + Mandatory mandatory), + + //--- phone field ------------------------------------------------------------ + phone_input( + Maybe(List(CoreAttrs)) sms_icon_options, //if there is sms available it's success with the options (generally the js call to edit sms) + List(CoreAttrs) phone_icon_options, + List(CoreAttrs) text_options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + InitialValue init_value, + Phone_Type phone_type, + Width width, + Mandatory mandatory), + + //--- email field ------------------------------------------------------------ + email_input( + List(CoreAttrs) icon_options, + List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + InitialValue init_value, + Width width, + Mandatory mandatory), + + //--- url field ------------------------------------------------------------ + url_input( + List(CoreAttrs) icon_options, + List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + InitialValue init_value, + Width width, + Mandatory mandatory), + + //--- hidden field ------------------------------------------------------------ + hidden( + HTML_Id id, + WebArgName web_arg_name, + WebArgValue init_value + ), + //--- explanation field --------------------------------------------------------------- + explain( + String text + ), + + //--- selector field ------------------------------------------------------------------ + selector( + List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + Int size, + List(String) items, + Maybe(InitialValue) selected, + Mandatory mandatory + ), + + selector_c( + List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + Int size, + List((List(CoreAttrs), WebArgValue, String)) items, + Maybe(InitialValue) selected, + Mandatory mandatory + ), + + selector_hide_show (List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + Int size, + List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items, + Maybe(InitialValue) selected, + Mandatory mandatory), + + //--- checkbox field ------------------------------------------------------------------ + checkbox (List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + Bool checked, + Mandatory mandatory), + + // the same one, but with the tag on the right of the checkbox + checkboxr( + List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + Bool checked, + Mandatory mandatory + ), + + //checkbox_hide_show + checkbox_hide_show( + List(CoreAttrs) options, + HTML_Label label, + WebArgName web_arg_name, + Bool checked, + List(CXM_Form_Field) fields + ), + + //--- radio-button field -------------------------------------------------------------- + radio_button( + List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + WebArgValue web_arg_value, + Bool checked, + Mandatory mandatory + ), + //radio_button_hide_show + radio_button_hide_show( + List(CoreAttrs) options, + HTML_Label label, + WebArgName web_arg_name, + WebArgValue web_arg_value, + Bool checked, + List(CXM_Form_Field) fields + ), + // the same one, but with the tag on the right of the radio_button + radio_buttonr (List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + WebArgValue web_arg_value, + Bool checked, + Mandatory mandatory), + + radio_button_list( + List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName web_arg_name, + List((WebArgValue, String)) web_arg_value, + Maybe(InitialValue) selected, + Mandatory mandatory, + Bool is_wide), + +// //--- fields table -------------------------------------------------------------------- +// fields_table (String tag, +// List(FormField) fields), +// +// //--- fields line --------------------------------------------------------------------- +// fields_line (String tag, +// List(FormField) fields), + one_line_fields (List(CXM_Form_Field) fields), + +// +// //--- preview field ------------------------------------------------------------------- +// preview (String html_text), + + //--- upload field ------------------------------------------------------------------- + upload (List(CoreAttrs) options, + HTML_Label label, + HTML_Id id, + WebArgName name, + Width width, + Mandatory mandatory), + + raw_in_form (HTML_Off_Form html), + label_for ( String label, + HTML_Id id, + HTML_Off_Form input), + div (List(CoreAttrs), List(HTML_Off_Form) contents), + div (List(CoreAttrs), List(CXM_Form_Field) fields), + partial (HTML_Partial_Content p_content), + br, + hr (List(CoreAttrs) options), +// input_with_help (CXM_Form_Field field, +// Maybe(String) help_title, +// String help_text, +// Int width), + + fieldset (List(CoreAttrs) options, + String legend, + List(CXM_Form_Field) fields), + + blank_space, + blank_space (HtmlClass class), + + //--- submit button ------------------------------------------------------------------- + submit (List(CoreAttrs) options, + HtmlClass class, + WEB_Action_Name action_name, + Maybe(String) label, + String button_text, + List((String,String)) extra_operands), + empty. + +// ////////////////////////////////////////////// +// Alternate constructors: + +public define CXM_Form_Field + fieldset + ( + HTML_Id fieldSetId, + List(CXM_Form_Field) fields + ) = + fieldset([id(fieldSetId.id)], "", fields). + +public define CXM_Form_Field + fieldset + ( + List(CXM_Form_Field) fields + ) = + fieldset([], "", fields). + +public define CXM_Form_Field + fieldset + ( + String legend, + List(CXM_Form_Field) fields + ) = + fieldset([], legend, fields). + +public define CXM_Form_Field + input(WebArgName n, InitialValue init_value, Width width) + = input([], no_label, html_Id(n.name), n, init_value, width, non_mandatory). + +public define CXM_Form_Field + input(HTML_Label label, WebArgName n, InitialValue init_value, Width width) + = input([], label, html_Id(n.name), n, init_value, width, non_mandatory). + +public define CXM_Form_Field + input(HTML_Label label, WebArgName n, InitialValue init_value, Width width, Mandatory mand) + = input([], label, html_Id(n.name), n, init_value, width, mand). + +public define CXM_Form_Field + input(HTML_Label label, HTML_Id id, WebArgName n, InitialValue init_value, Width width, Mandatory mand) + = input([], label, id, n, init_value, width, mand). + +public define CXM_Form_Field + input(List(CoreAttrs) options, HTML_Label label, WebArgName n, InitialValue init_value, Width width, Mandatory mand) + = input(options, label, html_Id(n.name), n, init_value, width, mand). + +public define CXM_Form_Field + input_readonly(HTML_Label label, WebArgName n, InitialValue init_value, Width width) + = input_readonly([], label, html_Id(n.name), n, init_value, width). + +public define CXM_Form_Field + password_input(HTML_Label label, WebArgName n, InitialValue init_value, Width width, Mandatory mand) + = password_input([], label, html_Id(n.name), n, init_value, width, mand). + +public define CXM_Form_Field + checkbox(HTML_Label label, WebArgName n, Bool checked, Mandatory mand) + = checkbox([], label, html_Id(n.name), n, checked, mand). + +public define CXM_Form_Field + checkboxr(HTML_Label label, WebArgName n, Bool checked, Mandatory mand) + = checkboxr([], label, html_Id(n.name), n, checked, mand). + +public define CXM_Form_Field + radio_button(HTML_Label label, WebArgName n, WebArgValue value, Bool checked, Mandatory mand) + = radio_button([], label, html_Id(n.name), n, value, checked, mand). + +public define CXM_Form_Field + radio_buttonr(HTML_Label label, WebArgName n, WebArgValue value, Bool checked, Mandatory mand) + = radio_buttonr([], label, html_Id(n.name), n, value, checked, mand). + +public define CXM_Form_Field + submit(WEB_Action_Name action_name, HtmlClass class, Maybe(String) label, String button_text, List((String,String)) extra_operands) + = submit([], class, action_name, label, button_text, extra_operands). + +public define CXM_Form_Field + submit(WEB_Action_Name action_name, Maybe(String) label, String button_text, List((String,String)) extra_operands) + = submit([], htmlClass(""), action_name, label, button_text, extra_operands). + +public define CXM_Form_Field + submit(WEB_Action_Name action_name, Maybe(String) label, String button_text) + = submit([], htmlClass(""), action_name, label, button_text, []). + +public define CXM_Form_Field //Helper for older project wich use only String as Action name + submit(String _action_name, Maybe(String) label, String button_text, List((String,String)) extra_operands) + = submit([], htmlClass(""), action_name(_action_name), label, button_text, extra_operands). + + +public define CXM_Form_Field + upload(HTML_Label label, HTML_Id id, WebArgName name, Width width) + = upload([], label, id, name, width, non_mandatory). + +public define CXM_Form_Field + upload(HTML_Label label, HTML_Id id, WebArgName name, Width width, Mandatory mand) + = upload([], label, id, name, width, mand). + +public define CXM_Form_Field + ip_input + ( + String label, + HTML_Id id, + WebArgName wan_prefix, + String ip + )= + label_for( + label, + id, + ip_input(id, wan_prefix, ip) + ). + + +public define CXM_Form_Field + partial_ip_input + ( + String label, + HTML_Id id, + WebArgName wan_prefix, + List(String) ip_fixed_part, + String ip + )= + label_for( + label, + id, + partial_ip_input(id, wan_prefix, ip_fixed_part, ip) + ). + +public define CXM_Form_Field + hidden + ( + WebArgName web_arg_name, + WebArgValue value + )= + hidden(html_Id(""), web_arg_name, value). + +public define CXM_Form_Field + hr + = + hr([]) +. + +public define CXM_Form_Field + div + ( + List(CoreAttrs) attrs, + HTML_Off_Form content + )= + div(attrs, [content]) +. + +public define CXM_Form_Field + div + ( + HTML_Off_Form content + )= + div([], [content]) +. + //--- explanation field --------------------- + +// ////////////////////////////////////////////////////////// + +define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content)) + construct_selector_hide_show + ( + String div_id, + List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items, + List((List(CoreAttrs), WebArgValue, String)) so_far_1, + List(HTML_Partial_Content) so_far_2, + Int n + ) = + if items is + { + [] then (so_far_1, so_far_2), + [h . t] then + since h is (cores, wav, label, content), + with linked_element = div_id + n, + construct_selector_hide_show(div_id, t, [([data("linked_element", linked_element) . cores], wav, label) . so_far_1], [ partial_content([], div([id(linked_element), style("display: none")], content)) . so_far_2 ], n + 1) + }. + +define (List((List(CoreAttrs), WebArgValue, String)), List(HTML_Partial_Content)) + construct_selector_hide_show + ( + String div_id, + List((List(CoreAttrs), WebArgValue, String, HTML_Partial_Content)) items + ) = construct_selector_hide_show(div_id, items, [], [], 0). + +public define HTML_Off_Form + format_div_CXM_Form_Field + ( + List(CXM_Form_Field) field, + List(Web_arg) lwa, + String _class, + Bool b_with_label + ). + + +public define HTML_Off_Form + format_CXM_Form_Field + ( + CXM_Form_Field ff, //CXM_Form_Field to format + List(Web_arg) lwa, //web arguments of the session, can be useful for the current drawing + String _class, + Bool b_with_label //if false, no need to show/generate label + ) = + with star = (HTML_Label l, Mandatory m) + |-> + (HTML_Label) + if b_with_label then + if m is + { + mandatory then + if l is + { + no_label then l, + label(str, help) then label(str + "*", help), + } + non_mandatory then l + } + else + no_label + , + pixels = (Width width) + |-> + if width is + { + small then 10, + narrow_small then 20, + narrow then 50, + wide then 70, + custom(n) then n + }, + + + if ff is + { + no_field then empty, + + title(t) then h3(t), + + message(t) then literal(t), + + input(options, _label, id, wan, default, w, mand) then + text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), + + input_readonly(options, _label, id, name, init, w) then + text_input_ro([class("in") . options], _label, id, name, init, pixels(w)), + + text_area(options, _label, id, wan, default, w, height, mand) then + text_area([input_attrs([class("in")]) . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w), height), + + password_input(options, _label, id, name, init, w, mand) then + password_input([class("in") . options], star(_label, mand), id, name, init, pixels(w)), + + phone_input(mb_sms_options, icon_options, options, _label, _id, wan, default, phone_type, w, mand) then + sequence([ + if mb_sms_options is + { + failure then empty, + success(sms_options) then img([event(onmouseover, "/icons/16x16/send_sms.png")]+sms_options, "/icons/16x16/sms.png") + }, + img(icon_options, "/icons/16x16/"+to_Icon(phone_type)), + input([class("in"), id(_id.id), name(wan.name), init(get_String(lwa, wan.name, default.value)), size(pixels(w)). options]), + ]), + + email_input(icon_options, options, _label, id, wan, default, w, mand) then + sequence([ + img(icon_options, "/icons/16x16/email_edit.png"), + text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), + ]), + + url_input(icon_options, options, _label, id, wan, default, w, mand) then + sequence([ + img(icon_options, "/icons/16x16/url.png"), + text_input([class("in") . options], star(_label, mand), id, wan, init(get_String(lwa, wan.name, default.value)), pixels(w)), + ]), + + hidden(h_id, name, init) then hidden(name, init), + + explain(t) then + div([class("sub")], literal(t)), + + selector(options, _label, id, wan, size, items, selected, mand) then + if selected is + { + failure then selector([class("in") . options], star(_label, mand), id, wan, size, items), + success(default) then selector([class("in") . options], star(_label, mand), id, wan, size, items, init(get_String(lwa, wan.name, default.value))), + }, + + selector_c(options, _label, id, wan, size, items, selected, mand) then + if selected is + { + failure then selector_c([class("in") . options], star(_label, mand), id, wan, size, items), + success(default) then selector_c([class("in") . options], star(_label, mand), id, wan, size, items, init(get_String(lwa, wan.name, default.value))), + }, + + selector_hide_show(options, _label, id, wan, size, items_with_partial, selected, mand) then + with div_id = generate_random_string(15), + since construct_selector_hide_show(div_id, items_with_partial) is (items, partial_content_list), + sequence([ + selector_c([class("in"), class("cxm_selector_hide_show"), event(onchange, "select_hide_show('" + div_id + "', this);")], star(_label, mand), id, wan, size, reverse(items), if selected is { failure then init(""), success(default) then init(get_String(lwa, wan.name, default.value)) } ), + partial(partial_content(partial_content_list)) + ]), + + checkbox(options, _label, id, wan, checked, mand) then + check_box([class("in") . options], star(_label, mand), id, wan, get_Bool(lwa, wan.name, checked)), + + checkboxr(options, _label, id, wan, checked, mand) then + check_box_r([class("in") . options], star(_label, mand), id, wan, get_Bool(lwa, wan.name, checked)), + + checkbox_hide_show(options, _label, wan, checked, fields) then + with div_id = generate_random_string(15), + sequence([ + check_box([data("show_id", div_id), class("in cxm_checkbox_hide_show"), event(onclick, "checked_hide_show_element('"+div_id+"', this);")], _label, html_Id("checkbox_"+div_id), wan, get_Bool(lwa, wan.name, checked)), + div([id(div_id), style("display:"+if checked then "block" else "none")], format_div_CXM_Form_Field(fields, lwa, _class, b_with_label)) + ]), + + radio_button(options, _label, id, wan, val, checked, mand) then + radio_button([class("in"), event(onclick, "radio_hide_show_group('"+wan.name+"', this);") . options], star(_label, mand), id, wan, val, get_Bool(lwa, wan.name, checked)), + + radio_button_hide_show(options, _label, wan, val, checked, fields) then + with div_id = generate_random_string(15), + sequence([ + radio_button([data("show_id", div_id), class("in"), class("cxm_radio_hide_show"), event(onclick, "radio_hide_show_group('"+wan.name+"', this);")], _label, html_Id("radio_button_hide_show_"+div_id), wan, val, get_Bool(lwa, wan.name, checked)), + div([id(div_id), style("display:"+if checked then "block" else "none")], format_div_CXM_Form_Field(fields, lwa, _class, b_with_label)) + ]), + + radio_buttonr(options, _label, id, wan, val, checked, mand) then + radio_button_r([class("in") . options], star(_label, mand), id, wan, val, get_Bool(lwa, wan.name, checked)), + + radio_button_list (options, _label, id, wan, items, selected, mand, wide) then + with new_selected = + if get_String(lwa, wan.name) is + { + failure then selected, + success(value) then success(init(value)) + }, + + sequence([ + //literal(""), + div( [class("radiolist")], sequence( + with i = var((Int)-1), + itemclass = if wide then "radiolistitem_wide" else "radiolistitem", + map( ((WebArgValue, String) item) |-> + i <- *i + 1; + if item is (wav, item_label) then + with _id = if id is html_Id(the_id) then html_Id(the_id + "_radio_" + *i), + div([class(itemclass)], radio_button_r(options, label(item_label), _id, wan, wav, + if new_selected is success(v) then wav.value = v.value else false)), + items)) + ), + ]), + one_line_fields(fields) then + table([nude, class("form_one_line")],[row([], + map((CXM_Form_Field ff2) |-> cell([],format_CXM_Form_Field(ff2, lwa, _class, b_with_label)),fields))]) + , + + upload(options, _label, id, name, w, mand) then + file_upload([class("in") . options], star(_label, mand), id, name, pixels(w)), + + raw_in_form(html) then html, +// div([class("in")], html), + label_for(label, id, input) then + sequence([ + if id is html_Id(_id) then + literal(""), + input + ]), + + div(options, e) then div(options, e), + div(options, fields)then div(options, format_div_CXM_Form_Field(fields, lwa, _class, b_with_label)), + partial(p_content) then partial(p_content), + br then br, + hr(opts) then hr(opts), +// input_with_help(input, help_title, help_text, width) then +// sequence([ +// format_CXM_Form_Field(input, lwa, html_tooltip(force_String(help_title), help_text, width)), +// ]), + + fieldset(options, legend, fields) then + sequence([ + literal(""), + literal(if length(legend) > 0 then "" + legend + "" else ""), + format_div_CXM_Form_Field(fields, lwa, _class, b_with_label), + literal("") + ]), + + blank_space then + div([class("blank_space")], literal(" ")), + + blank_space(htmlClass) then + div([class(htmlClass.class)], literal(" ")), + + submit(attrs, htmlClass, action_name, Maybe(String) mb_label, button_text, extra_operands) then + actioner( same, // TODO change this to allow external URL + if mb_label is + { + failure then same, + success(n) then same(n) + }, + submit(attrs + [class(htmlClass.class + " cxm_submit")], button_text), + action_name, + extra_operands + ), + empty then literal("") + }. + + +public define HTML_Off_Form + format_div_CXM_Form_Field + ( + List(CXM_Form_Field) fields, + List(Web_arg) lwa, + String _class, + Bool b_with_label + )= + //println("format_div_CXM_Form_Field"); + sequence( map((CXM_Form_Field field) + |-> + //with css_line = if line = 0 then " odd_line" else " even_line", + //println("class "+css_line+" line "+line); + if field is empty then + empty + else if field is no_field then + empty + else if field is hidden(_id, name, init) then + format_CXM_Form_Field(field, lwa, _class, b_with_label) + else if field is br then + format_CXM_Form_Field(field, lwa, _class, b_with_label) + else if field is text_area(options, _label, id, wan, default, w, height, mand) then + div([class(_class)], format_CXM_Form_Field(field, lwa, _class, b_with_label)) + else + div([class(_class)], format_CXM_Form_Field(field, lwa, _class, b_with_label)) + , fields)) +. + +public define HTML_Off_Form + to_HTML_Off_Form + ( + List(CXM_Form_Field) fields, + List(Web_arg) lwa, + String _class, + Bool b_with_label + )= + format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) +. + +public define HTML_Off_Form + to_HTML_Off_Form + ( + List(CXM_Form_Field) fields, + String _class, + Bool b_with_label + )= + to_HTML_Off_Form(fields, [], _class, b_with_label). + +public define HTML_Off_Form + to_HTML_Off_Form + ( + List(CXM_Form_Field) fields, + List(Web_arg) lwa + )= + to_HTML_Off_Form(fields, lwa, "form_field aligned", true) +. + +public define HTML_Off_Form + to_HTML_Off_Form + ( + CXM_Form_Field field, + List(Web_arg) lwa + )= + to_HTML_Off_Form([field], lwa, "form_field aligned", true) +. + +public define HTML_Off_Form + to_HTML_Off_Form + ( + List(CXM_Form_Field) fields + )= + to_HTML_Off_Form(fields, [], "form_field aligned", true) +. + +public define HTML_Off_Form + cxm_form + ( + HTML_Id form_Id, + List(CoreAttrs) options, + WEB_Action_Name action, + List((String,String)) extra_ops, + List(Web_arg) lwa, + List(CXM_Form_Field) fields, + String _class, + Bool b_with_label + ) = + form( + //form_Id, + [class("cxm_form"), id(form_Id.id) . options], + action, + extra_ops, + format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) + ). + +public define HTML_Off_Form +/* older manner to call CXM_form with action as String. + * this function only exists for compatibility with older projects. Please consider + * to use the above function with WEB_Action_Name instead of String +*/ + cxm_form + ( + HTML_Id form_Id, + List(CoreAttrs) options, + String action, //older manner to call action with String + List((String,String)) extra_ops, + List(Web_arg) lwa, + List(CXM_Form_Field) fields, + String _class, + Bool b_with_label + ) = + + form( + //form_Id, + [class("cxm_form"), id(form_Id.id) . options], + action_name(action), + extra_ops, + format_div_CXM_Form_Field(fields, lwa, _class, b_with_label) + ). + +public define HTML_Off_Form + cxm_form + ( + String form_name, + List(CoreAttrs) options, + WEB_Action_Name action, + List((String,String)) extra_ops, + List(Web_arg) lwa, + List(CXM_Form_Field) form_fields, + String _class, + Bool b_with_label + )= + cxm_form(html_Id(form_name), options, action, extra_ops, lwa, form_fields, _class, b_with_label). + +public define HTML_Off_Form + cxm_form + ( + String form_name, + List(CoreAttrs) options, + WEB_Action_Name action, + List((String,String)) extra_ops, + List(Web_arg) lwa, + List(CXM_Form_Field) form_fields + )= + cxm_form(form_name, options, action, extra_ops, lwa, form_fields, "form_field aligned", true) +. + +public define HTML_Off_Form + cxm_form + ( + String form_name, + List(CoreAttrs) options, + String action, + List((String,String)) extra_ops, + List(Web_arg) lwa, + List(CXM_Form_Field) form_fields, + + Bool b_with_label + )= + cxm_form(html_Id(form_name), options, action_name(action), extra_ops, lwa, form_fields, "form_field aligned", b_with_label) +. + +public define HTML_Off_Form + cxm_form + ( + String form_name, + List(CoreAttrs) options, + String action, + List((String,String)) extra_ops, + List(Web_arg) lwa, + List(CXM_Form_Field) form_fields + )= + cxm_form(html_Id(form_name), options, action_name(action), extra_ops, lwa, form_fields, "form_field aligned", true) +. + +public define HTML_Off_Form + cxm_form + ( + String form_id, + List(CoreAttrs) options, + List(HTML_Off_Form) fields, + String _class + ) = + cxm_form(html_Id(form_id), options, action_name(""), [], [], map((HTML_Off_Form field) |-> raw_in_form(field), fields), _class, true ) +. + +public define HTML_Off_Form + cxm_form + ( + String form_id, + List(CoreAttrs) options, + List(HTML_Off_Form) fields + ) = + cxm_form(options, action_name(""), [], [], map((HTML_Off_Form field) |-> raw_in_form(field), fields), "form_field aligned", true ) +. + +public define HTML_Off_Form + cxm_form + ( + String form_id, + List(CoreAttrs) options, + List(Web_arg) lwa, + List(CXM_Form_Field) fields, + String _class, + Bool b_with_label + ) = + cxm_form(html_Id(form_id), options, action_name(""), [], lwa, fields, _class, b_with_label). + +public define HTML_Off_Form + cxm_form + ( + String form_id, + List(HTML_Off_Form) fields, + String _class + ) = + cxm_form(html_Id(form_id), [], action_name(""), [], [], map((HTML_Off_Form field) |-> raw_in_form(field), fields), _class, true ). + +public define HTML_Off_Form + cxm_form + ( + String form_id, + List(Web_arg) lwa, + List(CXM_Form_Field) fields, + String _class + ) = + cxm_form(form_id, [], lwa, fields, _class, true). + +public define HTML_Off_Form + cxm_form + ( + String form_id, + List(Web_arg) lwa, + List(CXM_Form_Field) fields, + ) = + cxm_form(form_id, [], lwa, fields, "form_field aligned", true). + +public define HTML_Off_Form + cxm_form + ( + String form_id, + List(CoreAttrs) options, + List(CXM_Form_Field) fields, + ) = + cxm_form(form_id, options, [], fields, "form_field aligned", true). + +public define HTML_Off_Form + cxm_form + ( + String form_id, + List(CXM_Form_Field) fields, + String _class + ) = + cxm_form(html_Id(form_id), [], action_name(""), [], [], fields, _class, true). + +public define HTML_Off_Form + cxm_form + ( + String form_id, + List(CXM_Form_Field) fields + ) = + cxm_form(html_Id(form_id), [], action_name(""), [], [], fields, "form_field aligned", true). diff --git a/web/form.anubis.rej b/web/form.anubis.rej new file mode 100644 index 0000000..4bc2dd0 --- /dev/null +++ b/web/form.anubis.rej @@ -0,0 +1,9 @@ +diff a/web/form.anubis b/web/form.anubis (rejected hunks) +@@ -521,7 +521,6 @@ + + message(t) then literal(t), + +- input(options, _label, id, wan, default, w, mand) then + input(options, _label, _id, _name, default, w, mand) then + sequence([ + input([class("in"), options], name(_name.name), value(get_String(lwa, wan.name, default.value)), size(pixels(w)) . options], star(_label, mand)), diff --git a/web/frameworks/adminlte4/sidebar.anubis b/web/frameworks/adminlte4/sidebar.anubis new file mode 100644 index 0000000..868878c --- /dev/null +++ b/web/frameworks/adminlte4/sidebar.anubis @@ -0,0 +1,78 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ aka (David RENÉ) + * Date: 01/05/2026 + * Time: 15:11 + * © David RENÉ + */ + + +transmit xlib/web/widgets/left_menu.anubis +read xlib/web/making_a_web_site.anubis +read xlib/web/web_action.anubis +read xlib/web/load_content.anubis + +define List(HTML) + make_sidebar + ( + (String) -> String _T, //translator function + List(Left_Menu_Entry) entries, + String selected, + List(HTML) so_far + )= + if entries is + { + [] then reverse(so_far), //reverse to be in the right direction + [h . t] then + with entry = + if h is + { + left_menu_entry(_menu_id, subentry, _classes, _action, _text, _extra) then + with item_class = if subentry then "subitem " else "item ", + li(class("nav-item"), + p([class(item_class+_menu_id+"_icon"+(if _menu_id=selected then " selected" else "")+ " "+join(" ", _classes))],actioner(same,same, link(_T(_text)),_action,_extra))), + + left_menu_entry_js(_menu_id, subentry, _classes, _js_to_call, _text) then + with item_class = if subentry then "subitem " else "item ", + li(class("nav-item"), + p([class(item_class+"clickable "+_menu_id+"_icon"+(if _menu_id=selected then " active" else "")+ " "+join(" ", _classes)), + event(onclick, _js_to_call)],text(_T(_text)))), + + left_menu_entry_load_content(_menu_id, subentry, _classes, _action, _text, _extra, _target_id, _replace, _overlay) then + with item_class = if subentry then "subitem " else "item ", + li(class("nav-item"), + p([class(item_class+"clickable "+_menu_id+"_icon"+(if _menu_id=selected then " active" else "")+ " "+join(" ", _classes)), + event(onclick, load_content(_target_id, _action, _extra, _replace, _overlay))],text(_T(_text)))), + + title(_title_id, subtitle, _classes, _text) then + p([class(if subtitle then "menu_subtitle" else "menu_title"), class((if _title_id=selected then " active" else "")+ " "+join(" ", _classes))], text([],_T(_text))) +// p([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) + }, + make_sidebar(_T, t, selected, [ entry . so_far]) + }. + +public define HTML + make_sidebar + ( + (String) -> String _T, //translator function + Left_Menu l_menu + )= + if l_menu is + { + no_left_menu then empty, + left_menu(entries, selected) then + head_tags([css(css_file("/css/left_menu.css"))], + make_sidebar(_T, entries, selected, []) + ) + } +. + + + +public define One set_current_left_menu(WEB_Session s, String v) = replace_String(s.fields, "AWS_CURRENT_LEFT_MENU", v). +public define One set_current_left_menu(Var(List(Session_Field)) fields, String v) = replace_String(fields, "AWS_CURRENT_LEFT_MENU", v). +public define String get_current_left_menu(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_LEFT_MENU", ""). + +public define One set_selected_left_menu_entry(WEB_Session s, String v) = replace_String(s.fields, "AWS_SELECTED_LEFT_MENU_ENTRY", v). +public define One set_selected_left_menu_entry(Var(List(Session_Field)) fields, String v) = replace_String(fields, "AWS_SELECTED_LEFT_MENU_ENTRY", v). +public define String get_selected_left_menu_entry(WEB_Session s) = get_String (s.fields, "AWS_SELECTED_LEFT_MENU_ENTRY", ""). diff --git a/web/generic_form.anubis b/web/generic_form.anubis deleted file mode 100644 index 853fb66..0000000 --- a/web/generic_form.anubis +++ /dev/null @@ -1,471 +0,0 @@ - - - - *Project* The Anubis Project - - *Title* - - *Copyright* Copyright (c) Alain Prouté 2005. - - - *Author* Alain Prouté - - - - In this file we rationalize the construction of forms. - - - -read CXM_making_a_web_site.anubis -read tools/basis.anubis - - -public type Mandatory: // used to mark fields as mandatory. - mandatory, - non_mandatory. - -public type Width: - small, - narrow, - wide, - custom(Int). - -public type FormFieldWidth: - auto, - custom(Int). - - - - Sorts of fields that you can put in a form: - -public type FormField: - - //--- title field --------------------------------------------------------------------- - title (String text), - title (Int text_size, - String text), - title_f (List(Text_Option) -> HTML_In_Form), - - //--- message field ------------------------------------------------------------------- - message (Result(String,String) msg), - message_f (Result(List(Text_Option) -> HTML_In_Form,List(Text_Option) -> HTML_In_Form)), - - //--- text input field ---------------------------------------------------------------- - input (WebArgName web_arg_name, - String tag, - Width width, - InitialValue init_value, - Mandatory mandatory), - input (WebArgName web_arg_name, - Width width, - InitialValue init_value), - input_f (WebArgName web_arg_name, - List(Text_Option) -> HTML_In_Form tag, - Width width, - InitialValue init_value, - Mandatory mandatory), - - //--- password input field ------------------------------------------------------------ - password_input (WebArgName web_arg_name, - String tag, - Mandatory mandatory), - password_input_f (WebArgName web_arg_name, - List(Text_Option) -> HTML_In_Form tag, - Mandatory mandatory), - - //--- explanation field --------------------------------------------------------------- - explain (String text), - explain (String text, - FormFieldWidth width), - explain_f (List(Text_Option) -> HTML_In_Form), - - //--- selector field ------------------------------------------------------------------ - selector (WebArgName web_arg_name, - String tag, - List(String) items, - Maybe(InitialValue) selected, - Mandatory mandatory), - selector_f (WebArgName web_arg_name, - List(Text_Option) -> HTML_In_Form, - List(String) items, - Maybe(InitialValue) selected, - Mandatory mandatory), - selector_c (WebArgName web_arg_name, - String tag, - List((List(CoreAttrs), WebArgValue, String)) items, - Maybe(InitialValue) selected, - Mandatory mandatory), - - - - //--- checkbox field ------------------------------------------------------------------ - checkbox (WebArgName web_arg_name, - String tag, - Bool checked, - Mandatory mandatory), - // the same one, but with the tag on the right of the checkbox - checkboxr (WebArgName web_arg_name, - String tag, - Bool checked, - Mandatory mandatory), - checkbox_f (WebArgName web_arg_name, - List(Text_Option) -> HTML_In_Form, - Bool checked, - Mandatory mandatory), - - //--- radio-button field -------------------------------------------------------------- - radio_button (WebArgName web_arg_name, - WebArgValue web_arg_value, - String tag, - Bool checked, - Mandatory mandatory), - // the same one, but with the tag on the right of the radio_button - radio_buttonr (WebArgName web_arg_name, - WebArgValue web_arg_value, - String tag, - Bool checked, - Mandatory mandatory), - - //--- text area field ----------------------------------------------------------------- - text_area (WebArgName web_arg_name, - InitialValue initial_text), - text_area (WebArgName web_arg_name, - String tag, - InitialValue initial_text), - text_area (WebArgName web_arg_name, - String tag, - InitialValue initial_text, - Int width, - Int height), - - //--- fields table -------------------------------------------------------------------- - fields_table (String tag, - List(FormField) fields), - - //--- fields line --------------------------------------------------------------------- - fields_line (String tag, - List(FormField) fields), - fields_line (List(FormField) fields), - - //--- preview field ------------------------------------------------------------------- - preview (String html_text), - - //--- submit button ------------------------------------------------------------------- - submit (String action_name, - Maybe(String) label, - String button_text, - List((String,String)) extra_operands). - - - Convenience functions: - -public define FormField title(List(Text_Option) -> HTML_In_Form f) = title_f(f). -public define FormField - message(Result(List(Text_Option) -> HTML_In_Form,List(Text_Option) -> HTML_In_Form) f) = message_f(f). -public define FormField input(WebArgName web_arg_name, - List(Text_Option) -> HTML_In_Form tag, - Width width, - InitialValue init_value, - Mandatory mandatory) - = input_f(web_arg_name,tag,width,init_value,mandatory). -public define FormField password_input(WebArgName web_arg_name, - List(Text_Option) -> HTML_In_Form tag, - Mandatory mandatory) - = password_input_f(web_arg_name,tag,mandatory). -public define FormField explain(List(Text_Option) -> HTML_In_Form f) = explain_f(f). -public define FormField selector(WebArgName web_arg_name, - List(Text_Option) -> HTML_In_Form f, - List(String) items, - Maybe(InitialValue) selected, - Mandatory mandatory) - = selector_f(web_arg_name,f,items,selected,mandatory). -public define FormField checkbox(WebArgName web_arg_name, - List(Text_Option) -> HTML_In_Form f, - Bool checked, - Mandatory mandatory) - = checkbox_f(web_arg_name,f,checked,mandatory). - - Make the form itself with: - -public define HTML_Off_Form - generic_form - ( - String form_name, - RGB background_color, - Int width, - List(FormField) fields - ). - - - - --- That's all for the public part ! -------------------------------------------------- - -// TO DO update code of CXM generic form -define HTML_Row(HTML_In_Form) - format_form_field - ( - FormField ff - ) = - with star = (Mandatory m) |-> (HTML_In_Form)text([color(rgb(255,0,0)),size(12)], - if m is - { - mandatory then "*", - non_mandatory then "" - }), - row( - if ff is - { - title(t) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([columns(3),h_center],text([size(16),bold,color(rgb(0,0,0))],t)) - ], - - title(s,t) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([columns(3),h_center],text([size(s),bold,color(rgb(0,0,0))],t)) - ], - - title_f(t) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([columns(3),h_center],t([size(16),bold,color(rgb(0,0,0))])) - ], - - message(r) then (List(HTML_Cell(HTML_In_Form))) if r is - { - error(msg) then [cell([columns(3),h_center], - text([size(10),color(rgb(240,0,0))],msg))] - ok(msg) then [cell([columns(3),h_center], - text([size(10),color(rgb(0,150,0))],msg))] - }, - - message_f(r) then (List(HTML_Cell(HTML_In_Form))) if r is - { - error(msg) then [cell([columns(3),h_center], - msg([size(10),color(rgb(240,0,0))]))] - ok(msg) then [cell([columns(3),h_center], - msg([size(10),color(rgb(0,150,0))]))] - }, - - input(wan,tag,w,init,mand) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right ], text([size(10)],tag)), - cell([width(7) ], star(mand)), - cell([left ], text_input([], "",html_Id(""), wan, init,if w is - { - small then 10, - narrow then 50, - wide then 70, - custom(n) then n - })) - ], - - input(wan,w,init) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([left,columns(3) ], text_input([], "", html_Id(""), wan,init,if w is - { - small then 10, - narrow then 30, - wide then 70, - custom(n) then n - })) - ], - - input_f(wan,tag,w,init,mand) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right ], tag([size(10)])), - cell([width(7) ], star(mand)), - cell([left ], text_input([], "", html_Id(""),wan,init,if w is - { - small then 15, - narrow then 30, - wide then 70, - custom(n) then n - })) - ], - - password_input(wan,tag,mand) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right ], text([size(10)],tag)), - cell([width(7) ], star(mand)), - cell([left ], password_input([], "",html_Id(""), wan, init(""), 30)) - ], - - password_input_f(wan,tag,mand) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right ], tag([size(10)])), - cell([width(7) ], star(mand)), - cell([left ], password_input([], "",html_Id(""), wan, init(""), 30)) - ], - - explain(t) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([columns(3),h_center], - table([nude],[row(cell([width(500)], - paragraph([/*justified,*/size(10),color(rgb(0,100,0))],literal(t))))])) - ], - - explain(t,w) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([columns(3),h_center], - table([nude],[row(cell( - if w is - { - auto then [], - custom(i) then [width(i)] - }, - paragraph([/*justified,*/size(10),color(rgb(0,100,0))], literal(t))))])) - ], - - explain_f(t) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([columns(3),h_center], - table([nude],[row(cell([width(500)], - t([/*justified,*/size(10),color(rgb(0,100,0))])))])) - ], - - selector(wan,tag,items,selected,mand) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right ], text([size(10)],tag)), - cell([width(7)], star(mand)), - cell([left ], if selected is - { - failure then selector([], "", html_Id(""), wan,1,items) - success(sel) then selector([], "", html_Id(""), wan,1,items, sel) - }) - ], - - selector_f(wan,tag,items,selected,mand) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right ], tag([size(10)])), - cell([width(7)], star(mand)), - cell([left ], if selected is - { - failure then selector([], "", html_Id(""), wan,1,items) - success(sel) then selector([], "", html_Id(""), wan,1,items, sel) - }) - ], - - selector_c(wan,tag,items,selected,mand) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right ], text([size(10)],tag)), - cell([width(7)], star(mand)), - cell([left ], if selected is - { - failure then selector_c([], "", html_Id(""), wan,1,items) - success(sel) then selector_c([], "", html_Id(""), wan,1,items,sel) - }) - ], - - checkbox(wan,tag,checked,mand) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right ], text([size(10)],tag)), - cell([width(7)], star(mand)), - cell([left ], check_box([], "",html_Id(""),wan, wav(wan.name),checked)) - ], - - checkboxr(wan,tag,checked,mand) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right ], check_box([], "",html_Id(""),wan, wav(wan.name),checked)), - cell([width(7)], star(mand)), - cell([left ], text([size(10)],tag)) - ], - - checkbox_f(wan,tag,checked,mand) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right ], tag([size(10)])), - cell([width(7)], star(mand)), - cell([left ], check_box([], "",html_Id(""),wan,wav(wan.name),checked)) - ], - - radio_button(wan,wav,tag,checked,mand) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right ], text([size(10)],tag)), - cell([width(7)], star(mand)), - cell([left ], radio_button([], "", html_Id(""), wan, wav, checked)) - ], - - radio_buttonr(wan,wav,tag,checked,mand) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right ], radio_button([], "", html_Id(""), wan, wav, checked)), - cell([width(7)], star(mand)), - cell([left ], text([size(10)],tag)) - ], - - text_area(wan,tx) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([h_center,columns(3)],text_area([wrap_lines],wan,tx,75,10)) - ], - - text_area(wan,tag,tx) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right,top], text([size(10)],tag)), - cell([width(7)], text([],"")), - cell([h_center],text_area([wrap_lines],wan,tx,75,10)) - ], - - text_area(wan,tag,tx,w,h) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right,top], text([size(10)],tag)), - cell([width(7)], text([],"")), - cell([h_center],text_area([wrap_lines],wan,tx,w,h)) - ], - - fields_table(tag,fields) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right,top], text([size(10)],tag)), - cell([width(7)], text([],"")), - cell([left,top], table([],map((FormField ff2) |-> format_form_field(ff2),fields))) - ], - - fields_line(tag,fields) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([right,top], text([size(10)],tag)), - cell([width(7)], text([],"")), - cell([left,top], table([nude],[row([], //border(0,0,3,rgb(0,0,0)) - map((FormField ff2) |-> cell([top],table([nude],[format_form_field(ff2)])),fields))])) - ], - - fields_line(fields) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([left,top,columns(3)], table([nude],[row([], - map((FormField ff2) |-> cell([top],table([nude],[format_form_field(ff2)])),fields))])) - ], - - preview(html_text) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([top,left,columns(3),background_color(rgb(255,255,255))], - table([border(0,8,0,rgb(0,0,0))], - [row(cell([left,top,height(200)],literal(html_text)))])) - ], - - submit(action_name,mb_label,button_text,extra_operands) then (List(HTML_Cell(HTML_In_Form))) - [ - cell([columns(3),right],actioner(same, - if mb_label is - { - failure then same, - success(n) then same(n) - }, - submit([], button_text), - action_name, - extra_operands)) - ] - }). - - - -// TO DO update code of CXM generic form -public define HTML_Off_Form - generic_form - ( - String form_name, - RGB bg_color, - Int w, - List(FormField) fields - ) = - table([border(0,0,5,bg_color),percentage_width(100), - background_color(bg_color)],[row(cell([h_center], - form(form_name,[],table([border(0,2,0,bg_color)], - map(format_form_field, fields)))))]). - - diff --git a/web/generic_login.anubis b/web/generic_login.anubis index f1db55d..e1d71f6 100644 --- a/web/generic_login.anubis +++ b/web/generic_login.anubis @@ -28,7 +28,7 @@ read CXM_generic_form.anubis -public define HTML_Off_Form +public define HTML login_form ( String wrong_message, @@ -62,7 +62,7 @@ public define Maybe($User) *** [1] Connection sur site sécurisée -public define HTML_Off_Form +public define HTML login_form ( String wrong_message, diff --git a/web/generic_table.anubis b/web/generic_table.anubis deleted file mode 100644 index 0f2070f..0000000 --- a/web/generic_table.anubis +++ /dev/null @@ -1,785 +0,0 @@ - - *Project* The Anubis Project - - *Title* Generic table page. - - *Copyright* Copyright (c) Alain Prouté 2004. - - - *Author* Alain Prouté - *Author* Olivier Duvernois - *Author* David René (import into xlib) - - ---------------------------------------------------------------------------------------- - - - - -read tools/basis.anubis -read common.anubis -read making_a_web_site.anubis - - - The purpose is to print on a html browser a table from a List($Data) using the function - 'generic_table()' describe below. - - Note : the explanations are only given for HTML_Item and its components. But they are - also available for HTML_Form and HTML_Element and their components. - - - A table may have the following look : - - +-----+----------+--------+-----------------------+ ............... - | | | | name 3 | - | num | name1 | name2 |-----------+-----------+ columns_name - | | | | name 31 | name 32 | - +-----+----------+--------+-----------+-----------+ ............... - | 1 | data11 | data12 | data131 | data132 | line 1 with background color a - +-----+----------+--------+-----------+-----------+ ............... - | 2 | data21 | data22 | data231 | data232 | line 2 with background color b - +-----+----------+--------+-----------+-----------+ ............... - | 3 | data31 | data32 | data331 | data332 | line 3 with background color a - +-----+----------+--------+-----------+-----------+ ............... - - | n | datan1 | datan2 | datan31 | datan32 | line n with background color ? - +-----+----------+--------+-----------+-----------+ ............... - |total| total1 | | | total32 | total line - +-----+----------+--------+-----------+-----------+ ............... - - For the total-line, assuming that datax1 to dataxn and datax32 to datan32 are numbers - (Int, Float or Maybe(Float)). - - - The columns name are just a List(Item_Row). - - The column 'num' is in the case you want to enumerate your data. The existence of this - column depends on the line function. - - Lines are given by the function : (RGB color,Int num,$Data d) -> Item_Row - - where : - (RGB)color is the color of the background of the row (the 'a color' or 'b - color'); - - (Int)num the number of the data (to enumerate). - - So, this function must be written something like : - - (RGB color, Int num,$Data d) |-> - row([background_color(color)], // and of course possibly other row-options - [ - cell([], (Int -> $HTML)(num) ) - . ($Data -> List(Cell))d // how data is printed in cells - ]). - - But, for the above convenient function with no enumeration, you can only write : - - (RGB color, $Data d) |-> - row([background_color(color)], // and of course possibly other row-options - ($Data -> List(Cell))d // how data is printed in cells - ). - - - If you want to sum by column your data, use the following type : - -public type Total_Line($Data,$Upplet,$Row): - no_total, - total - ( - ($Upplet,$Data) -> $Upplet sum_functions, - $Upplet -> $Row print_total_line, - $Upplet initial_value - ). - - $Row is for HTML_Row($HTML). - $Upplet represents the components of $Data that will be sum. - - Example : - with the above sheme table, $Data is something like : - type $Data - data - ( - Data1 d1, - Data2 d2 - Data3 d3 - ). - and type Data3: - data3 - ( - Data31 d31, - Data32 d32 - ). - - So $Upplet will be (Data1,Data32) : sums are wanted for those 2 datum - - The function ($Upplet,$Data) -> $Upplet will be written like : - ($Upplet u,$Data d) -> if u is (u1,u2) then (u1+d1(d), u2+d32(d3(d))) - - (if of course (Data1 + Data1) and (Data32 + Data32) are defined). - - - - - Several columns - - ------------------- - - If you want to print your data on sevaral columns (i.e. considering the above table - scheme as a column), you must specify the number of columns. You will obtain : - - Here is a List($Data) : l = [a,b,c,d,e,f,g,h,i,j,k,l,m]; - and f : (RGB,Int,$Data) -> Item_Row - You want to print this list on 3 columns. - The result will be : - - - +-----------+-----------+-----------+ - | col.names | col.names | col.names | - +-----------+-----------+-----------+ - | f(a) | f(f) | f(k) | - +-----------+-----------+-----------+ - | f(b) | f(g) | f(l) | - +-----------+-----------+-----------+ Each column is a table as defined - | f(c) | f(h) | f(m) | above. - +-----------+-----------+-----------+ - | f(d) | f(i) | | - +-----------+-----------+-----------+ - | f(e) | f(j) | | - +-----------+-----------+-----------+ - - - If several columns are required, it's also asked for spaces between two colums. - - So use the following type : - -public type HowManyColumns: - _1, - several (Int col_nb, - Int spacer). - - - - - - Now the Generic table definition - - ------------------------------------ - - Here is the most customizable generic table. Below, they are some convenience functions. - -public define HTML_Off_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_Off_Form)) columns_name, - HowManyColumns number_of_columns, - (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, - RGB a_color, - RGB b_color, - Total_Line($Data,$Upplet,HTML_Row(HTML_Off_Form)) total_line - ). - -public define HTML_In_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_In_Form)) columns_name, - HowManyColumns number_of_columns, - (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, - RGB a_color, - RGB b_color, - Total_Line($Data,$Upplet,HTML_Row(HTML_In_Form)) total_line - ). - - - - Note : - List(Table_Option) : if you choose 'nude' (i.e. border(0,0,0)), don't forget a - horizontal spacer between the cells contain in the 'line_format' row. If you don't put - any, each data will be closer to the next one. - - - - - Convenience functions - - ------------------------- - - 1/ Table without multicolumns, enumeration and total-line: - -public define HTML_Off_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_Off_Form)) columns_name, - (RGB,$Data) -> HTML_Row(HTML_Off_Form) line_format, - RGB a_color, - RGB b_color - ). - -public define HTML_In_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_In_Form)) columns_name, - (RGB,$Data) -> HTML_Row(HTML_In_Form) line_format, - RGB a_color, - RGB b_color - ). - - - - 2/ Table with total-line and without multicolumns, enumeration. - - -public define HTML_Off_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_Off_Form)) columns_name, - (RGB,$Data) -> HTML_Row(HTML_Off_Form) line_format, - RGB a_color, - RGB b_color, - Total_Line($Data,$Upplet,HTML_Row(HTML_Off_Form)) total_line - ). - -public define HTML_In_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_In_Form)) columns_name, - (RGB,$Data) -> HTML_Row(HTML_In_Form) line_format, - RGB a_color, - RGB b_color, - Total_Line($Data,$Upplet,HTML_Row(HTML_In_Form)) total_line - ). - - - 3/ Table with multicolumns, enumeration, but without total - -public define HTML_Off_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_Off_Form)) columns_name, - HowManyColumns number_of_columns, - (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, - RGB a_color, - RGB b_color - ). - -public define HTML_In_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_In_Form)) columns_name, - HowManyColumns number_of_columns, - (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, - RGB a_color, - RGB b_color - ). - - - - 4/ Table with multicolumns and without enumeration & total - -public define HTML_Off_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_Off_Form)) columns_name, - HowManyColumns number_of_columns, - (RGB,$Data) -> HTML_Row(HTML_Off_Form) line_format, - RGB a_color, - RGB b_color - ). - -public define HTML_In_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_In_Form)) columns_name, - HowManyColumns number_of_columns, - (RGB,$Data) -> HTML_Row(HTML_In_Form) line_format, - RGB a_color, - RGB b_color - ). - - - --- That's all for public part. ------------------------------------------------------------------------- - - - When the datum $Data must be presented on several columns, the initial list must be - re-composed : sot the type Print_Table. - -type Print_Table($Data): - print_table - ( - $Data data, - Int num - ). - - - *** Transform List($Data) into List(Print_Table($Data)) - - -define (List(Print_Table($Data)),List($Data)) - get_n_elements - ( - List($Data) l, - List(Print_Table($Data)) result, - Int n, - Int ct, // counter - Int num - ) = - if l is - { - [] then (reverse(result),[]), - [h . t] then - if ct = n - then (reverse([print_table(h,num+1) . result]),t) - else get_n_elements(t,[print_table(h,num+1) . result],n,ct+1,num+1) - }. - - -define List(List(Print_Table($Data))) - short_lists - ( - List($Data) l, - Int nb, // number of element of short list - Int ct // counter for numbering data (initialized at 0) - ) = - if get_n_elements(l,[],nb,1,ct) is (result,unused) - then if unused is - { - [] then [result], - [_ . _] then [result . short_lists(unused,nb,ct+nb)] - }. - - - - Generic row - - --------------- - -define (List(HTML_Row($HTML)),$Upplet) - generic_rows - ( - List(Print_Table($Data)) lpt, - (RGB,Int,$Data) -> HTML_Row($HTML) line_format, - RGB a_color, - RGB b_color, - ($Upplet,$Data) -> $Upplet do_sum, - List(HTML_Row($HTML)) rows, - $Upplet sum - ) = - if lpt is - { - [] then (reverse(rows),sum), - [h . t] then - generic_rows(t,line_format,b_color,a_color,do_sum, - [line_format(a_color,num(h),data(h)) . rows],do_sum(sum,data(h))) - }. - - - - - HTML_In_Form - - ---------------- - -define List(HTML_Cell(HTML_In_Form)) - generic_cells - ( - List(List(Print_Table($Data))) print_data, - List(Table_Option) lto, - List(HTML_Row(HTML_In_Form)) names, - (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, - RGB a_color, - RGB b_color, - ($Upplet,$Data) -> $Upplet do_sum, - $Upplet -> HTML_Row(HTML_In_Form) total_line, - $Upplet value, - Int spacer - ) = - if print_data is - { - [] then (List(HTML_Cell(HTML_In_Form))) [], - [h . t] then - if generic_rows(h,line_format,a_color,b_color,do_sum,(List(HTML_Row(HTML_In_Form)))[],value) is - (rows,new_value) then - if t is [] - then [cell([top],table(lto,names+rows+[total_line(new_value)]))] - else [ - cell([top],table(lto,append(names,rows))) - . if spacer = 0 - then generic_cells - (t,lto,names,line_format,a_color,b_color,do_sum,total_line,new_value,spacer) - else [cell([width(spacer)],text([],"")) - . generic_cells - (t,lto,names,line_format,a_color,b_color,do_sum,total_line,new_value,spacer)] - ] - }. - -//public define Int -// Int x (mod Int y) -// = -// if x / y is -// { -// failure then 0, -// success(result) then -// if result is (q, r) then r -// }. -// - - -public define HTML_In_Form - generic_table - ( - List($Data) l, - List(Table_Option) lto, - List(HTML_Row(HTML_In_Form)) names, - HowManyColumns hm_col, - (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, - RGB a_color, - RGB b_color, - Total_Line($Data,$Upplet,HTML_Row(HTML_In_Form)) total_line - ) = - table([], - if l is [] - then [] - else - with nbl = length(l), - [ - row([], - if total_line is - { - no_total then - with col_nb = if hm_col is - { - _1 then 1, - several(n,_) then n - }, - with spacer = if hm_col is - { - _1 then 0, - several(n,sp) then sp - }, - generic_cells - (short_lists(l,nbl\col_nb + if (nbl (mod col_nb)) > 0 then 1 else 0,0), - lto,names,line_format,a_color,b_color, - (One u,$Data d) |-> unique,(One _) |-> row([],[]),unique,spacer), - total(sum_fct,total_line,init) then - with col_nb = if hm_col is - { - _1 then 1, - several(n,_) then n - }, - with spacer = if hm_col is - { - _1 then 0, - several(n,sp) then sp - }, - generic_cells - ( - short_lists(l,nbl\col_nb + if (nbl (mod col_nb)) > 0 then 1 else 0,0), - lto,names,line_format,a_color,b_color, - sum_fct,total_line,init,spacer - ) - }) - ]). - - - - HTML_Off_Form - - ---------------- - -define List(HTML_Cell(HTML_Off_Form)) - generic_cells - ( - List(List(Print_Table($Data))) print_data, - List(Table_Option) lto, - List(HTML_Row(HTML_Off_Form)) names, - (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, - RGB a_color, - RGB b_color, - ($Upplet,$Data) -> $Upplet do_sum, - $Upplet -> HTML_Row(HTML_Off_Form) total_line, - $Upplet value, - Int spacer - ) = - if print_data is - { - [] then (List(HTML_Cell(HTML_Off_Form))) [], - [h . t] then - if generic_rows(h,line_format,a_color,b_color,do_sum,(List(HTML_Row(HTML_Off_Form)))[],value) is - (rows,new_value) then - if t is [] - then [cell([top],table(lto,(names+rows+[total_line(new_value)])))] - else [ - cell([top],table(lto,append(names,rows))) - . if spacer =0 - then generic_cells - (t,lto,names,line_format,a_color,b_color,do_sum,total_line,new_value,spacer) - else [cell([width(spacer)],text([],"")) - . generic_cells - (t,lto,names,line_format,a_color,b_color,do_sum,total_line,new_value,spacer)] - ] - }. - -public define HTML_Off_Form - generic_table - ( - List($Data) l, - List(Table_Option) lto, - List(HTML_Row(HTML_Off_Form)) names, - HowManyColumns hm_col, - (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, - RGB a_color, - RGB b_color, - Total_Line($Data,$Upplet,HTML_Row(HTML_Off_Form)) total_line - ) = - table([], - with nbl = length(l), - [ - row([], - if total_line is - { - no_total then - with col_nb = if hm_col is - { - _1 then 1, - several(n,_) then n - }, - with spacer = if hm_col is - { - _1 then 0, - several(n,sp) then sp - }, - generic_cells - ( - short_lists(l,nbl\col_nb + if (nbl (mod col_nb)) > 0 then 1 else 0,0), - lto,names,line_format,a_color,b_color, - (One u,$Data d) |-> unique,(One _) |-> row([],[]),unique,spacer - ), - total(sum_fct,total_line,init) then - with col_nb = if hm_col is - { - _1 then 1, - several(n,_) then n - }, - with spacer = if hm_col is - { - _1 then 0, - several(n,sp) then sp - }, - generic_cells - ( - short_lists(l,nbl\col_nb + if (nbl (mod col_nb)) > 0 then 1 else 0,0), - lto,names,line_format,a_color,b_color, - sum_fct,total_line,init,spacer - ) - }) - ]). - - - - - Convenience functions : - -public define HTML_Off_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_Off_Form)) columns_name, - (RGB,$Data) -> HTML_Row(HTML_Off_Form) line_format, - RGB a_color, - RGB b_color - ) = - generic_table - ( - (List($Data)) data, - (List(Table_Option)) lto, - (List(HTML_Row(HTML_Off_Form))) columns_name, - (HowManyColumns) _1, - ((RGB,Int,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), - (RGB) a_color, - (RGB) b_color, - (Total_Line($Data,$Data,HTML_Row(HTML_Off_Form))) no_total - ). - -public define HTML_In_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_In_Form)) columns_name, - (RGB,$Data) -> HTML_Row(HTML_In_Form) line_format, - RGB a_color, - RGB b_color - ) = - generic_table - ( - (List($Data)) data, - (List(Table_Option)) lto, - (List(HTML_Row(HTML_In_Form))) columns_name, - (HowManyColumns) _1, - ((RGB,Int,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), - (RGB) a_color, - (RGB) b_color, - (Total_Line($Data,$Data,HTML_Row(HTML_In_Form))) no_total - ). - - - 2/ Table with total-line and without multicolumns, enumeration. - - -public define HTML_Off_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_Off_Form)) columns_name, - (RGB,$Data) -> HTML_Row(HTML_Off_Form) line_format, - RGB a_color, - RGB b_color, - Total_Line($Data,$Upplet,HTML_Row(HTML_Off_Form)) total_line - ) = - generic_table - ( - (List($Data)) data, - (List(Table_Option)) lto, - (List(HTML_Row(HTML_Off_Form))) columns_name, - (HowManyColumns) _1, - ((RGB,Int,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), - (RGB) a_color, - (RGB) b_color, - (Total_Line($Data,$Upplet,(HTML_Row(HTML_Off_Form)))) total_line - ). - -public define HTML_In_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_In_Form)) columns_name, - (RGB,$Data) -> HTML_Row(HTML_In_Form) line_format, - RGB a_color, - RGB b_color, - Total_Line($Data,$Upplet,HTML_Row(HTML_In_Form)) total_line - ) = - generic_table - ( - (List($Data)) data, - (List(Table_Option)) lto, - (List(HTML_Row(HTML_In_Form))) columns_name, - (HowManyColumns) _1, - ((RGB,Int,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), - (RGB) a_color, - (RGB) b_color, - (Total_Line($Data,$Upplet,(HTML_Row(HTML_In_Form)))) total_line - ). - - - - - 3/ Table with multicolumns, enumeration, but without total - -public define HTML_Off_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_Off_Form)) columns_name, - HowManyColumns number_of_columns, - (RGB,Int,$Data) -> HTML_Row(HTML_Off_Form) line_format, - RGB a_color, - RGB b_color - ) = - generic_table - ( - (List($Data)) data, - (List(Table_Option)) lto, - (List(HTML_Row(HTML_Off_Form))) columns_name, - (HowManyColumns) number_of_columns, - ((RGB,Int,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int n,$Data d) |-> line_format(r,n,d), - (RGB) a_color, - (RGB) b_color, - (Total_Line($Data,$Data,(HTML_Row(HTML_Off_Form)))) no_total - ). - - -public define HTML_In_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_In_Form)) columns_name, - HowManyColumns number_of_columns, - (RGB,Int,$Data) -> HTML_Row(HTML_In_Form) line_format, - RGB a_color, - RGB b_color - ) = - generic_table - ( - (List($Data)) data, - (List(Table_Option)) lto, - (List(HTML_Row(HTML_In_Form))) columns_name, - (HowManyColumns) number_of_columns, - ((RGB,Int,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int n,$Data d) |-> line_format(r,n,d), - (RGB) a_color, - (RGB) b_color, - (Total_Line($Data,$Data,(HTML_Row(HTML_In_Form)))) no_total - ). - - - - 4/ Table with multicolumns and without enumeration & total - -public define HTML_Off_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_Off_Form)) columns_name, - HowManyColumns number_of_columns, - (RGB,$Data) -> HTML_Row(HTML_Off_Form) line_format, - RGB a_color, - RGB b_color - ) = - generic_table - ( - (List($Data)) data, - (List(Table_Option)) lto, - (List(HTML_Row(HTML_Off_Form))) columns_name, - (HowManyColumns) number_of_columns, - ((RGB,Int,$Data) -> HTML_Row(HTML_Off_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), - (RGB) a_color, - (RGB) b_color, - (Total_Line($Data,$Data,(HTML_Row(HTML_Off_Form)))) no_total - ). - - -public define HTML_In_Form - generic_table - ( - List($Data) data, - List(Table_Option) lto, - List(HTML_Row(HTML_In_Form)) columns_name, - HowManyColumns number_of_columns, - (RGB,$Data) -> HTML_Row(HTML_In_Form) line_format, - RGB a_color, - RGB b_color - ) = - generic_table - ( - (List($Data)) data, - (List(Table_Option)) lto, - (List(HTML_Row(HTML_In_Form))) columns_name, - (HowManyColumns) number_of_columns, - ((RGB,Int,$Data) -> HTML_Row(HTML_In_Form)) (RGB r,Int n,$Data d) |-> line_format(r,d), - (RGB) a_color, - (RGB) b_color, - (Total_Line($Data,$Data,(HTML_Row(HTML_In_Form)))) no_total - ). - - - - diff --git a/web/html_tooltip.anubis b/web/html_tooltip.anubis index af733d9..2a415dc 100644 --- a/web/html_tooltip.anubis +++ b/web/html_tooltip.anubis @@ -11,9 +11,9 @@ read tools/basis.anubis read xlib/web/common.anubis read xlib/web/making_a_web_site.anubis -//public type HTML_Off_Form:... +//public type HTML:... - public define HTML_Off_Form + public define HTML html_tooltip ( String title, @@ -23,7 +23,7 @@ read xlib/web/making_a_web_site.anubis actioner(same,same, link([id("help_" + keyword), class("jTip jTip_help"), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_id", keyword)], []). - public define HTML_Off_Form + public define HTML html_tooltip ( String title, @@ -55,7 +55,7 @@ read xlib/web/making_a_web_site.anubis actioner(same,same, link([id("help_" + keyword), class("jTip jTip_help"), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_id", keyword), ("width", to_decimal(width))], []). - public define HTML_Off_Form + public define HTML html_tooltip_ext ( String title, @@ -64,7 +64,7 @@ read xlib/web/making_a_web_site.anubis ) = actioner(same,same, link([id("help_" + keyword), class("jTip jTip_"+class_suffix), attr("target", "_blank")], " ", success(title)), "ajax_show_tooltip", [("tooltip_ext", keyword)], []). - public define HTML_Off_Form + public define HTML html_tooltip_ext ( String title, diff --git a/web/jQuery/jq_animate.anubis b/web/jQuery/jq_animate.anubis index 5d8bdd2..521ac48 100644 --- a/web/jQuery/jq_animate.anubis +++ b/web/jQuery/jq_animate.anubis @@ -378,7 +378,7 @@ public define List(HTML_Head_Tag) ) = generate_head_tags(jq_selector, anims). -public define HTML_Partial_Content +public define HTML jquery_animate ( JQuerySelector jq_selector, @@ -394,7 +394,7 @@ public define List(HTML_Head_Tag) ) = generate_head_tags(jq_selector, [ anim_type ]). -public define HTML_Partial_Content +public define HTML jquery_animate ( JQuerySelector jq_selector, diff --git a/web/jQuery/jq_button.anubis b/web/jQuery/jq_button.anubis index 22c9048..877f7b2 100644 --- a/web/jQuery/jq_button.anubis +++ b/web/jQuery/jq_button.anubis @@ -68,18 +68,18 @@ define HTML_Head_Tag js_inline(jquery_ready("$('#"+button_id+"').click(function(e){" + js_action + "});")) . -define HTML_Partial_Content +define HTML _jquery_buttons ( List(JQuery_button) buttons, List(HTML_Head_Tag) html_tags, - List(HTML_Off_Form) html_buttons + List(HTML) html_buttons ) = if buttons is { [ ] then - partial_content( + head_tags( reverse(html_tags), sequence(reverse(html_buttons)) ), @@ -158,14 +158,14 @@ define HTML_Partial_Content } . -public define HTML_Partial_Content +public define HTML jquery_buttons ( String buttons_container_id, List(JQuery_button) buttons ) = - partial_content( + head_tags( [ js_inline(jquery_ready("$('#"+buttons_container_id+"').buttonset();")) ], div(id(buttons_container_id), _jquery_buttons(buttons, [], [])) // sequence([ @@ -176,7 +176,7 @@ public define HTML_Partial_Content ) . -public define HTML_Partial_Content +public define HTML jquery_button ( JQuery_button button @@ -184,11 +184,11 @@ public define HTML_Partial_Content = if button is jQuery_button(bt_type, id, name, label, actioner, primary, secondary) then with onclick_action=jquery_button_get_onclick_action(id, actioner), -// btn_seq = (HTML_Off_Form)sequence([literal("")]), - btn_seq = (HTML_Off_Form)sequence([literal("")]), +// btn_seq = (HTML)sequence([literal("")]), + btn_seq = (HTML)sequence([literal("")]), if jquery_icon_to_string(primary) = "" then if jquery_icon_to_string(secondary) = "" then - partial_content( + head_tags( [ js_inline(jquery_ready("$('#"+id+"').button();")), onclick_action @@ -198,7 +198,7 @@ public define HTML_Partial_Content //literal("") ) else - partial_content( + head_tags( [ js_inline(jquery_ready("$('#"+id+"').button({icons:{secondary:'"+jquery_icon_to_string(secondary)+"'}});")), onclick_action @@ -208,7 +208,7 @@ public define HTML_Partial_Content ) else if jquery_icon_to_string(secondary) = "" then - partial_content( + head_tags( [ js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"'}});")), onclick_action @@ -217,7 +217,7 @@ public define HTML_Partial_Content //literal("") ) else - partial_content( + head_tags( [ js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"',secondary:'"+jquery_icon_to_string(secondary)+"'}});")), onclick_action @@ -236,7 +236,7 @@ public type Icon_orientation: public type JQuery_img_button: jquery_img_button(String img_url, String label_text, String id, JQuery_Actioner jq_action, Icon_orientation orientation). -public define HTML_Off_Form +public define HTML jquery_button_html ( JQuery_img_button jq_img_button, @@ -246,15 +246,15 @@ public define HTML_Off_Form button([id(button_id), class("jq_img_btn")], if orientation is { - top then table([class("jq_img_btn_table")],[ row( cell(img(img_url))), row( cell(text(label_text))) ]), - bottom then table([class("jq_img_btn_table")],[ row( cell(text(label_text))), row( cell(img(img_url))) ]), - left then table([class("jq_img_btn_table")],[ row( [cell(img(img_url)), cell(text(label_text)) ]) ]), - right then table([class("jq_img_btn_table")],[ row( [cell(text(label_text)), cell(img(img_url)) ]) ]), + top then table(class("jq_img_btn_table"), [ tr( td( img(img_url))), tr( td( text(label_text))) ]), + bottom then table(class("jq_img_btn_table"), [ tr( td( text(label_text))), tr( td( img(img_url))) ]), + left then table(class("jq_img_btn_table"), tr( [ td(img(img_url)), td(text(label_text)) ])), + right then table(class("jq_img_btn_table"), tr( [ td(text(label_text)), td(img(img_url)) ])), }). -public define HTML_Partial_Content +public define HTML jquery_button ( JQuery_img_button button @@ -264,7 +264,7 @@ public define HTML_Partial_Content generate_random_string(10) else button_id, - partial_content( + head_tags( [ jquery_button_get_onclick_action(button_id_str, actioner), css(css_file("xlib/css/button.css")), @@ -273,7 +273,7 @@ public define HTML_Partial_Content jquery_button_html(button, button_id_str)) . -public define HTML_Partial_Content +public define HTML jq_button_confirm ( String button_label, @@ -296,18 +296,16 @@ public define HTML_Partial_Content button_name = uid, _actioner = jQuery_actioner(same, jqscript("Xlib.make_confirm_dialog(this, " /*+ to_js_string("/?a=" + url + format_extra_operands(extra_ops))+*/ + to_JS_String(jquery_button_get_onclick_action(actioner)) + ");")), - partial_content([ + head_tags([ js(js_file("xlib/js/xlib.js")), css(css_file("xlib/css/button.css")), js_inline(jquery_ready(js_data)) ], - sequence([ - partial(jquery_button(jQuery_button(button, uid, button_name, button_label, _actioner, jq_icon_none, jq_icon_none))) - ]) + jquery_button(jQuery_button(button, uid, button_name, button_label, _actioner, jq_icon_none, jq_icon_none)) ) . -public define HTML_Partial_Content +public define HTML jq_button_confirm ( JQuery_img_button button, @@ -332,17 +330,16 @@ public define HTML_Partial_Content _button_name = uid, _actioner = jQuery_actioner(same, jqscript("Xlib.make_confirm_dialog(this, " + to_JS_String(jquery_button_get_onclick_action(actioner)) +");")), - partial_content([ + head_tags([ js(js_file("xlib/js/xlib.js")), js_inline(jquery_ready(js_data)) ], - sequence([ - partial(jquery_button(jquery_img_button(img_url, button_label, _button_name, _actioner, orientation))) - ]) + jquery_button(jquery_img_button(img_url, button_label, _button_name, _actioner, orientation)) + ) . -public define HTML_Partial_Content +public define HTML img_submit_button ( String img, //path to image @@ -353,7 +350,7 @@ public define HTML_Partial_Content )= jquery_button(jquery_img_button(img, label, "", jQuery_actioner(same, jqform(form_id, action, extra_ops)), left)). -public define HTML_Partial_Content +public define HTML img_submit_button ( String img, //path to image @@ -363,7 +360,7 @@ public define HTML_Partial_Content )= jquery_button(jquery_img_button(img, label, "", jQuery_actioner(same, jqform(form_id, action, [])), left)). -public define HTML_Partial_Content +public define HTML img_submit_button ( String label, //translated label of the button @@ -372,7 +369,7 @@ public define HTML_Partial_Content )= jquery_button(jquery_img_button(icn16_check, label, "", jQuery_actioner(same, jqform(form_id, action, [])), left)). -public define HTML_Partial_Content +public define HTML img_submit_button_load ( String label, //translated label of the button @@ -383,7 +380,7 @@ public define HTML_Partial_Content )= jquery_button(jquery_img_button(icn16_check, label, "", jQuery_actioner(same, jqformload(form_id, target_id, action, extra_args)), left)). -public define HTML_Partial_Content +public define HTML img_submit_button_load ( String label, //translated label of the button @@ -394,7 +391,7 @@ public define HTML_Partial_Content jquery_button(jquery_img_button(icn16_check, label, "", jQuery_actioner(same, jqformload(form_id, target_id, action, [])), left)). -public define HTML_Partial_Content +public define HTML img_submit_button ( String label, //translated label of the button @@ -403,7 +400,7 @@ public define HTML_Partial_Content jquery_button(jquery_img_button(icn16_check, label, "", jQuery_actioner(same, jqform(form_id, no_action, [])), left)) . -public define HTML_Partial_Content +public define HTML img_button ( String icon, //URL of @@ -415,7 +412,7 @@ public define HTML_Partial_Content . -public define HTML_Partial_Content +public define HTML img_button ( String icon, //URL of @@ -427,7 +424,7 @@ public define HTML_Partial_Content jquery_button(jquery_img_button(icon, label, "", jQuery_actioner(same, jqload(target, action, extra_ops)), left)) . -public define HTML_Partial_Content +public define HTML img_button ( String icon, diff --git a/web/jQuery/jq_checkbox.anubis b/web/jQuery/jq_checkbox.anubis index b45027f..78a713f 100644 --- a/web/jQuery/jq_checkbox.anubis +++ b/web/jQuery/jq_checkbox.anubis @@ -43,7 +43,7 @@ define String " + off_script + " }". -public define HTML_Partial_Content +public define HTML jq_img_checkbox ( String checkbox_id, @@ -61,7 +61,7 @@ public define HTML_Partial_Content jquery_button(jquery_img_button(image_url, checkbox_label, checkbox_id, jQuery_actioner(same, jqscript(checkbox_onclick_script(checkbox_id, on_script, off_script))), orientation)) ). -public define HTML_Partial_Content +public define HTML jq_img_checkbox ( String checkbox_id, diff --git a/web/jQuery/jq_datatable.anubis b/web/jQuery/jq_datatable.anubis index 74455df..7b3b91a 100644 --- a/web/jQuery/jq_datatable.anubis +++ b/web/jQuery/jq_datatable.anubis @@ -59,29 +59,29 @@ public define List(HTML_Head_Tag) // js(js_file("jquery/plug-in/DataTables-1.10.7/extensions/responsive/js/dataTables.responsive.js")), ] . -public define HTML_Partial_Content +public define HTML jquery_datatable ( String table_id, - HTML_Off_Form table + HTML table ) = - partial_content(jquery_datatables_1_10_init + + head_tags(jquery_datatables_1_10_init + [ js_inline(jquery_ready("$('#"+table_id+"').DataTable();")) ], table ) . -public define HTML_Partial_Content +public define HTML jquery_datatable ( String table_id, - HTML_Off_Form table, + HTML table, Bool enable_jqueryui, ) = if enable_jqueryui then - partial_content( jquery_datatables_1_10_init + + head_tags( jquery_datatables_1_10_init + [ js_inline(jquery_ready("$('#"+table_id+"').DataTable({\"jQueryUI\":true});")) ], table ) @@ -90,11 +90,11 @@ public define HTML_Partial_Content . -public define HTML_Partial_Content +public define HTML jquery_datatable ( String table_id, - HTML_Partial_Content table, + HTML table, Bool enable_jqueryui, Bool enable_pagination, JQuery_datatable_pagination_type pagination_type, @@ -108,7 +108,7 @@ public define HTML_Partial_Content String web_dir ) = - partial_content( jquery_datatables_1_10_init + + head_tags( jquery_datatables_1_10_init + [ js_inline(jquery_ready(" $.fn.dataTable.ext.legacy.ajax = true; @@ -139,27 +139,11 @@ public define HTML_Partial_Content ) . -public define HTML_Partial_Content +public define HTML jquery_datatable ( String table_id, - HTML_Off_Form table, - Bool enable_jqueryui, - Bool enable_pagination, - JQuery_datatable_pagination_type pagination_type, - JQuery_datatable_scrollY_type scrollY, - Bool enable_change_page_length, // if true, "enable_pagination" must be true too. - Bool enable_search_field, - Bool enable_columns_sorting, - String web_dir - ) = - jquery_datatable(table_id, partial_content(table), enable_jqueryui, enable_pagination, pagination_type, false, scrollY, enable_change_page_length, enable_search_field, enable_columns_sorting, "en", no_extra, web_dir). - -public define HTML_Partial_Content - jquery_datatable - ( - String table_id, - HTML_Partial_Content table, + HTML table, Bool enable_jqueryui, Bool enable_pagination, JQuery_datatable_pagination_type pagination_type, diff --git a/web/jQuery/jq_dialog.anubis b/web/jQuery/jq_dialog.anubis index 4e5644b..42272d0 100644 --- a/web/jQuery/jq_dialog.anubis +++ b/web/jQuery/jq_dialog.anubis @@ -17,8 +17,8 @@ public type JQuery_dialog_id: public type JQuery_dialog: empty, - p_content(HTML_Partial_Content content), - off_form(HTML_Off_Form o_form), + p_content(HTML content), + off_form(HTML o_form), ajax(WEB_Action_Name url). public define JQuery_dialog ajax(String url) = ajax(action_name(url)). @@ -52,7 +52,7 @@ public define String . -public define HTML_Partial_Content +public define HTML jq_dialog_create ( JQuery_dialog_id dial_id, @@ -88,19 +88,21 @@ $( \"#"+dlg_id+"\" ).dialog({ if content is { empty then - partial_content([js], div([id(dlg_id)], empty)), + head_tags([js], div([id(dlg_id)], empty)), p_content(pc) then - if pc is partial_content(tags, html) then - partial_content( [js . tags ], div([id(dlg_id)], html)), //html code of the dialog + if pc is head_tags(tags, html) then + head_tags( [js . tags ], div(id(dlg_id), html)) //html code of the dialog + else + pc, off_form(html) then - partial_content( [js], div([id(dlg_id)], html)), //html code of the dialog + head_tags(js, div(id(dlg_id), html)), //html code of the dialog ajax(_url) then with url = format_web_action_name(_url), //println("jq_dialog_create : \njs_str ->"+js_str+"\nurl ->"+url); - partial_content( [js], div([id(dlg_id), attr("ajax_url",url)])) + head_tags( [js], div([id(dlg_id), attr("ajax_url",url)])) }. -public define HTML_Partial_Content +public define HTML jq_dialog_create ( JQuery_dialog_id dial_id, @@ -110,7 +112,7 @@ public define HTML_Partial_Content )= jq_dialog_create(dial_id, content, false, size, extra_param). -public define HTML_Partial_Content +public define HTML jq_dialog_create ( JQuery_dialog_id dial_id, @@ -119,7 +121,7 @@ public define HTML_Partial_Content )= jq_dialog_create(dial_id, content, false, size, ""). -public define HTML_Partial_Content +public define HTML jq_dialog_create ( JQuery_dialog_id dial_id, @@ -128,7 +130,7 @@ public define HTML_Partial_Content )= jq_dialog_create(dial_id, content, false, auto, extra_param). -public define HTML_Partial_Content +public define HTML jq_dialog_create ( JQuery_dialog_id dial_id, @@ -136,7 +138,7 @@ public define HTML_Partial_Content )= jq_dialog_create(dial_id, content, false, auto, ""). -public define HTML_Partial_Content +public define HTML jq_dialog_create ( JQuery_dialog_id dial_id, @@ -188,15 +190,14 @@ public define String )= _jq_dialog_open(success(html), dialog_id, params). -public define HTML_Partial_Content +public define HTML jq_dialog_open ( String html, JQuery_dialog_id dialog_id, String params )= - partial_content([], - literal(_jq_dialog_open(success(html), dialog_id, params))). + literal(_jq_dialog_open(success(html), dialog_id, params)). public define String jq_dialog_open diff --git a/web/jQuery/jq_eudock.anubis b/web/jQuery/jq_eudock.anubis index 37f0a56..cfed652 100644 --- a/web/jQuery/jq_eudock.anubis +++ b/web/jQuery/jq_eudock.anubis @@ -171,7 +171,7 @@ define String . /* Creation of an euDock */ -public define HTML_Partial_Content +public define HTML jquery_eudock ( JQ_euDock dock diff --git a/web/jQuery/jq_jqplot.anubis b/web/jQuery/jq_jqplot.anubis index af513aa..1382138 100644 --- a/web/jQuery/jq_jqplot.anubis +++ b/web/jQuery/jq_jqplot.anubis @@ -9,7 +9,7 @@ read xlib/web/making_a_web_site.anubis read tools/basis.anubis - public define HTML_Partial_Content + public define HTML jqplot ( String img_url, diff --git a/web/jQuery/jq_radio.anubis b/web/jQuery/jq_radio.anubis index 272fd46..b501e73 100644 --- a/web/jQuery/jq_radio.anubis +++ b/web/jQuery/jq_radio.anubis @@ -80,7 +80,7 @@ define String "radio.removeClass('unchecked').addClass('checked');" ) + on_script. -public define HTML_Partial_Content +public define HTML jq_img_radio ( String radio_id, @@ -92,14 +92,14 @@ public define HTML_Partial_Content String on_script, Icon_orientation orientation ) = - partial_content( + head_tags( [ js_inline(jquery_ready(radio_init_script(radio_id, radio_group, initial_state))) ], jquery_button(jquery_img_button(image_url, checkbox_label, radio_id, jQuery_actioner(same, jqscript(radio_onclick_script(radio_id, radio_group, multi_select_with_shift, on_script))), orientation)) ). -public define HTML_Partial_Content +public define HTML jq_img_radio ( String radio_id, @@ -112,7 +112,7 @@ public define HTML_Partial_Content ) = jq_img_radio(radio_id, none, initial_state, false, image_url, checkbox_label, script, orientation). -public define HTML_Partial_Content +public define HTML jq_img_radio ( String radio_id, diff --git a/web/jQuery/jq_tabs.anubis b/web/jQuery/jq_tabs.anubis index f590612..0c46b73 100644 --- a/web/jQuery/jq_tabs.anubis +++ b/web/jQuery/jq_tabs.anubis @@ -13,27 +13,27 @@ read xlib/web/common.anubis read tools/basis.anubis public type JQuery_tab: - jQuery_tab(String title, HTML_Partial_Content content) + jQuery_tab(String title, HTML content) . // Helper to be compatible with the first version of JQuery_tab which - // take HTML_Off_Form as second argument instead of HTML_Partial_Content. + // take HTML as second argument instead of HTML. public define JQuery_tab jQuery_tab ( String title, - HTML_Off_Form content + HTML content )= jQuery_tab(title, partial_content([], content)). -define HTML_Partial_Content +define HTML _jquery_tabs ( String tabs_container_id, List(JQuery_tab) tabs, String tabs_titles, - List(HTML_Off_Form) tabs_contents, + List(HTML) tabs_contents, List(HTML_Head_Tag) tabs_heads, Int count ) @@ -66,7 +66,7 @@ define HTML_Partial_Content } . -public define HTML_Partial_Content +public define HTML jquery_tabs ( String tabs_container_id, @@ -106,7 +106,7 @@ public define HTML_Partial_Content div([id(tabs_container_id)], html) ). -public define HTML_Partial_Content +public define HTML jquery_tabs ( String tabs_container_id, diff --git a/web/jQuery/jq_tiptip.anubis b/web/jQuery/jq_tiptip.anubis index 1e7680e..57ec7d8 100644 --- a/web/jQuery/jq_tiptip.anubis +++ b/web/jQuery/jq_tiptip.anubis @@ -62,13 +62,13 @@ public define List(HTML_Head_Tag) . -/* Create a tipTip tooltip with a HTML_Partial_Content and position */ -public define HTML_Partial_Content +/* Create a tipTip tooltip with a HTML and position */ +public define HTML jquery_tiptip ( String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix - HTML_Partial_Content tooltip_partial_content, + HTML tooltip_partial_content, JQ_tiptip_position position ) = @@ -91,38 +91,38 @@ public define HTML_Partial_Content ) . -/* Create a tipTip tooltip with a HTML_Off_Form and position */ -public define HTML_Partial_Content +/* Create a tipTip tooltip with a HTML and position */ +public define HTML jquery_tiptip ( String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix - HTML_Off_Form html_content, + HTML html_content, JQ_tiptip_position position ) = jquery_tiptip(rollovered_id, tooltip_id, partial_content([], html_content), position) . -/* Create a tipTip tooltip with a HTML_Partial_Content */ -public define HTML_Partial_Content +/* Create a tipTip tooltip with a HTML */ +public define HTML jquery_tiptip ( String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix - HTML_Partial_Content tooltip_partial_content + HTML tooltip_partial_content ) = jquery_tiptip(rollovered_id, tooltip_id, tooltip_partial_content, jq_tiptip_bottom) . -/* Create a tipTip tooltip with a HTML_Off_Form */ -public define HTML_Partial_Content +/* Create a tipTip tooltip with a HTML */ +public define HTML jquery_tiptip ( String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!! String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix - HTML_Off_Form html_content + HTML html_content ) = jquery_tiptip(rollovered_id, tooltip_id, partial_content([], html_content)) diff --git a/web/jQuery/jq_toolbar.anubis b/web/jQuery/jq_toolbar.anubis index 408e266..b7b04a2 100644 --- a/web/jQuery/jq_toolbar.anubis +++ b/web/jQuery/jq_toolbar.anubis @@ -9,11 +9,11 @@ read xlib/web/making_a_web_site.anubis read xlib/web/jQuery/jq_button.anubis -public define HTML_Partial_Content +public define HTML _jquery_toolbar ( List(JQuery_img_button) buttons, - List(HTML_Cell(HTML_Off_Form)) so_far + List(HTML_Cell(HTML)) so_far )= if buttons is { @@ -24,7 +24,7 @@ public define HTML_Partial_Content _jquery_toolbar(t, [ cell(partial(jquery_button(h))) . so_far]) }. -public define HTML_Partial_Content +public define HTML jquery_toolbar ( List(JQuery_img_button) buttons diff --git a/web/l3/l3.anubis b/web/l3/l3.anubis index 5b26a2d..1834bcc 100644 --- a/web/l3/l3.anubis +++ b/web/l3/l3.anubis @@ -11,10 +11,10 @@ read xlib/web/making_a_web_site.anubis transmit locale/L3.anubis transmit locale/L3LanguageInfo.anubis -define List(HTML_Off_Form) +define List(HTML) construct_language_option_list ( - List(HTML_Off_Form) so_far, + List(HTML) so_far, List(L3LanguageInfo) lang_list ) = if lang_list is @@ -26,15 +26,15 @@ define List(HTML_Off_Form) construct_language_option_list( [option(value(code_lang), text(code_lang +" | " + english_name + " | " + self_name)) . so_far], t) }. -public define List(HTML_Off_Form) +public define List(HTML) l3_get_language_option_list = construct_language_option_list([], standard_languages) . -public define List(HTML_Off_Form) +public define List(HTML) _l3_get_all_chapters_options_list ( - List(HTML_Off_Form) so_far, + List(HTML) so_far, List(String) chapters_list )= if chapters_list is @@ -45,7 +45,7 @@ public define List(HTML_Off_Form) } . -public define List(HTML_Off_Form) +public define List(HTML) l3_get_all_chapters_options_list ( String collection_name diff --git a/web/load_content.anubis b/web/load_content.anubis index e2a8adc..75782fa 100644 --- a/web/load_content.anubis +++ b/web/load_content.anubis @@ -122,7 +122,7 @@ public define String load_content(target, web_action, [], replace, true) . -public define HTML_Partial_Content +public define HTML load_content_init ( String target, @@ -131,14 +131,13 @@ public define HTML_Partial_Content Bool replace, Bool overlay )= - partial_content([ + head_tags([ js(js_file("xlib/js/xlib.js")), js_inline(script("text/javascript","$(document).ready(function(){"+load_content(target, web_action, extra_args, replace, overlay)+"});")) - ], - empty) + ]) . -public define HTML_Partial_Content +public define HTML load_content_init ( String target, @@ -149,7 +148,7 @@ public define HTML_Partial_Content load_content_init(target, web_action, extra_args, replace, true) . -public define HTML_Partial_Content +public define HTML load_content_init ( String target, @@ -159,7 +158,7 @@ public define HTML_Partial_Content load_content_init(target, web_action, extra_args, false, true) . -public define HTML_Partial_Content +public define HTML load_content_init ( String target, @@ -168,7 +167,7 @@ public define HTML_Partial_Content load_content_init(target, web_action, [], false, true) . -public define HTML_Partial_Content +public define HTML load_content_init ( String target, diff --git a/web/making_a_web_site.anubis b/web/making_a_web_site.anubis index 890505d..4d7c893 100644 --- a/web/making_a_web_site.anubis +++ b/web/making_a_web_site.anubis @@ -6,7 +6,7 @@ *Copyright* Copyright (c) Alain Prouté 2004-2005. Copyright (c) Calexium 2007-2017. - Copyright (c) David René 2007-2021. + Copyright (c) David René 2007-2026. *Authors* Alain Prouté @@ -372,26 +372,6 @@ public define String $State -> HTTP_Answer - where the type 'HTTP_Answer' (defined below in this file) abstractly represents HTML - pages. - -//public type HTTP_Answer:... - - It should be clear that states and pages are deeply linked together. Indeed, we really - understand the page shown to the client as a representation of the current state of the - conversation between the client and the web site, but also containing informations - taken from the data bases. - - -//public type HTML_Partial_Content:... - - - - - - - - public define List(HTTP_header) make_session_cookie_headers @@ -504,44 +484,6 @@ public type Web_Site:... Producing such a datum may be performed by: - public define Web_Site - make_web_site_description - ( - List(String) common_names, // for example: ["www.our-business.com", - // "192.168.0.1"] - // the second one is just for testing - String site_directory, // where 'public' and other directories are - // located (should NOT end with '/') - String state_directory, - One -> One init, - (HTTP_Info, - List(Web_arg), - Bool is_https) -> $State initial_state, - ($State expired, - Maybe(String), - HTTP_Info, - List(Web_arg), - Bool is_https) -> $State ticket_expired_state, - (Maybe(String), - HTTP_Info, - List(Web_arg), - Bool is_https) -> $State ticket_lost_state, - List(Web_Action($State)) actions, - $State -> HTTP_Answer compute_page, - $State -> List(HTTP_header) additional_headers, - List(HTTP_header) constant_additional_headers, - Int timeout, // seconds (todo: minutes) - Redirections redirections, - String charset, - List(String) journal_extensions, - List(String) journal_headers, - String authorization_secret, - List(MIME) known_mime_types, - (String action_name, - List(Web_arg) args)-> One before_send_file - ). - - Explanations: 'common_names' is the list of names of the site (the name the browser must send as the @@ -706,7 +648,7 @@ public define Start_Web_Sites_Result For easy reference, we gather below the definitions of all the types used by the HTML interface, and we comment them immediately. - //public type HTML_Off_Form:... + //public type HTML:... public define Printable_tree [HTML_Id x . Printable_tree y] = str_pt(x.id, y). @@ -719,20 +661,17 @@ public define CoreAttrs attr(String name, Bool value) = attr(name, if value th public define CoreAttrs attr(String name, Int value) = attr(name, to_String(value)). -public define InputAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). +//public define InputAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). -public define Text_Option - tooltip(String s) = title(s). +//public define Text_Option +// tooltip(String s) = title(s). A list of 'Text_Option' must be given with each text you want to put in your page. public define CoreAttrs tooltip(String s) = title(s). -public define InputAttrs - tooltip(String s) = title(s). - public type I18n: lang (String), @@ -830,100 +769,7 @@ public define String }. -public define Table_Option nude = border(0,0,0,rgb(0,0,0)). - - - A list of 'Table_Option' must be given with each table. - - - - - - - A list of 'Cell_Option' must be given with each cell and each row in a table. Options - given with a row apply to all the cells in the row, but are superseded by options given - with cells, which apply only to the cell they are given with. - - - - - - The parameter $T is later instantiated either to 'HTML_In_Form' or to 'HTML_Off_Form', - depending on where you put your table (within a form or not within a form). For your - convenience, we define the following particular case: - -public define HTML_Cell($T) - cell - ( - $T content - )= - cell([],content) -. - -public define HTML_Cell($T) - cell - ( - Cell_Option option, - $T content - ) = - cell([option],content) -. - -public define HTML_Header_Cell($T) - header_cell - ( - $T content - ) = - header_cell([],content). - - - - - Same remark as for 'HTML_Cell($T)'. We define several convenience functions: - -public define HTML_Row($T) - row - ( - List(HTML_Cell($T)) cells - )= - row([],cells). - -public define HTML_Row($T) - row - ( - HTML_Cell($T) cell - )= - row([],[cell]). - -public define HTML_Row($T) - row - ( - List(Cell_Option) options, - HTML_Cell($T) cell - )= - row(options,[cell]). - -public define HTML_Row($T) - row - ( - Cell_Option option, - HTML_Cell($T) cell - )= - row([option],[cell]). - -public define HTML_Header_Row($T) - header_row - ( - List(HTML_Header_Cell($T)) cells - ) = - header_row([],cells). - -public define HTML_Header_Row($T) - header_row - ( - HTML_Header_Cell($T) cell - ) = - header_row([],[cell]). +//public define Table_Option nude = border(0,0,0,rgb(0,0,0)). @@ -954,7 +800,7 @@ public define Actioner_Aspect public define Actioner_Aspect link ( - List(Text_Option) options, + List(CoreAttrs) options, String text )= link(options, text, failure). @@ -970,7 +816,7 @@ public define Actioner_Aspect public define Actioner_Aspect link ( - List(Text_Option) options, + List(CoreAttrs) options, Int i ) = link(options, to_decimal(i), failure). @@ -1058,7 +904,7 @@ public define HTML_Help /* It contains * - a List of HTML_Head_Tag representing necessaries head tags for the content. ex: jquery js files, js script, css specific styles, ... - * - a HTML_Off_Form representing the HTML code for the part of the page we want to display + * - a HTML representing the HTML code for the part of the page we want to display */ //public type HTML_In_Form:... @@ -1084,24 +930,13 @@ public define List(HTML_Head_Tag) convenience function: -public define HTML_In_Form text_input(HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width) = text_input([], label, id, name, init, width). -public define HTML_In_Form literal(Printable_tree t) = literal_pt(t). +public define HTML literal(Printable_tree t) = literal_pt(t). -public define HTML_In_Form image(String url) = image([], url, url). -public define HTML_In_Form image(String url, Int width, Int height) = image([], url, url, width, height). -public define HTML_In_Form - foreign_link - ( - Int tsize, - String url, - String name - ) = - foreign_link([size(tsize)],url,name). -public define HTML_In_Form +public define HTML /* Older call with String as action instead of WEB_Action_Name. * This function exists only for compatibility with older project. * Please condiser to use above function instead @@ -1118,7 +953,7 @@ public define HTML_In_Form actioner(conn,targ,asp,action_name(action),extra_ops,local_actions) . -public define HTML_In_Form +public define HTML actioner ( Actioner_Connection conn, @@ -1130,7 +965,7 @@ public define HTML_In_Form actioner(conn,targ,asp,action,extra_ops,[]) . -public define HTML_In_Form +public define HTML /* Older call with String as action instead of WEB_Action_Name. * This function exists only for compatibility with older project. * Please condiser to use above function instead @@ -1146,7 +981,7 @@ public define HTML_In_Form actioner(conn,targ,asp,action_name(action),extra_ops,[]) . -public define HTML_In_Form +public define HTML actioner ( Actioner_Connection conn, @@ -1154,62 +989,8 @@ public define HTML_In_Form Actioner_Aspect asp, )= actioner(conn, targ, asp, action_name(""), [], []). - - -public define HTML_In_Form - text_area - ( - WebArgName name, - InitialValue init, - Int width, - Int height - ) = - text_area([], no_label, html_Id(""), name,init,width,height). - -public define HTML_In_Form - text_area - ( - List(TextAreaOption) options, - WebArgName name, - InitialValue init, - Int width, - Int height - ) = - text_area(options, no_label, html_Id(""), name,init,width,height). - -public define HTML_In_Form - table - ( - List(HTML_Row(HTML_In_Form)) rows - ) = - table([],empty,rows,empty). - -public define HTML_In_Form - table - ( - List(Table_Option) options, - List(HTML_Row(HTML_In_Form)) rows - ) = - table(options,empty,rows,empty). - -public define HTML_In_Form - table - ( - HTML_Header_Row(HTML_In_Form) h_row, - List(HTML_Row(HTML_In_Form)) rows - ) = - table([],h_row,rows,empty). - -public define HTML_In_Form - table - ( - List(Table_Option) options, - HTML_Header_Row(HTML_In_Form) h_row, - List(HTML_Row(HTML_In_Form)) rows - ) = - table(options,h_row,rows,empty). - -public define HTML_In_Form + + public define HTML_In_Form private_download ( String abs_path, @@ -1218,7 +999,7 @@ public define HTML_In_Form ) = private_download(abs_path,name,extra_ext,failure). -public define HTML_In_Form + public define HTML_In_Form private_download ( String abs_path, @@ -1228,90 +1009,6 @@ public define HTML_In_Form List((String,String)) args ) = private_download(abs_path,name,extra_ext,success((action_name,args))). - - - -public define HTML_In_Form - text - ( - List(CoreAttrs) l, - Int i - ) = - text(l, to_decimal(i)). - -public define HTML_In_Form - text - ( - String s - )= - text([],s) -. - -public define HTML_In_Form - text - ( - Int i - ) = - text([], i) -. - -public define HTML_In_Form - div - ( - HTML_In_Form element - )= - div([], [element]) -. - -public define HTML_In_Form - div - ( - List(CoreAttrs) attrs, - HTML_In_Form element - )= - div(attrs, [element]) -. - -public define HTML_In_Form - span - ( - String s - )= - span([],s) -. - -public define HTML_In_Form - span - ( - Int i - ) = - span([], to_decimal(i)) -. - -public define HTML_In_Form - radio_button (List(CoreAttrs) options, HTML_Label label, WebArgName n, WebArgValue value, Bool checked) - = radio_button (options, label, html_Id(n.name), n, value, checked). - -public define HTML_In_Form - radio_button_r (List(CoreAttrs) options, HTML_Label label, WebArgName n, WebArgValue value, Bool checked) - = radio_button_r (options, label, html_Id(n.name), n, value, checked). - -public define HTML_In_Form - check_box (List(CoreAttrs) options, HTML_Label label, WebArgName n, Bool checked) - = check_box (options, label, html_Id(n.name), n, checked). - -public define HTML_In_Form - check_box_r (List(CoreAttrs) options, HTML_Label label, WebArgName n, Bool checked) - = check_box_r (options, label, html_Id(n.name), n, checked). - -public define HTML_In_Form - file_upload (WebArgName n, Int width) - = file_upload([], no_label, html_Id(n.name), n, width). - -public define HTML_In_Form - hidden (WebArgName name, WebArgValue value) - = - hidden(html_Id(""), name, value). public type Input_Type: button, @@ -1417,6 +1114,69 @@ public type FormMethod: post . +public define String format_attrs (List(CoreAttrs) attributs). + + Formating choices for a -public define HTML_Off_Form input(List(CoreAttrs) attrs) = html_void_tag("input", attrs). -public define HTML_Off_Form input(CoreAttrs attr) = html_void_tag("input", [attr]). +public define HTML input(List(CoreAttrs) attrs) = html_void_tag("input", attrs). +public define HTML input(CoreAttrs attr) = html_void_tag("input", [attr]). public define CoreAttrs type(Input_Type value)= attr("type", to_String(value)). public define CoreAttrs type(String value)= attr("type", value). @@ -1653,359 +1472,484 @@ public define CoreAttrs name(String value)= attr("name", value). public define CoreAttrs value(String value)= attr("value", value). public define CoreAttrs placeholder(String value) = attr("placeholder", value). public define CoreAttrs init(String value)= attr("value", encode_HTML_entities(value)). + //-- BEGIN of preset type - + + /// hidden value +public define HTML hidden(List(CoreAttrs) attrs, String _name, String _value, String form) = input([type(hidden), name(_name), value(encode_HTML_entities(_value)), attr("form", form) . attrs]). +public define HTML hidden(CoreAttrs attr, String name, String value, String form) = hidden([attr], name, value, form). +public define HTML hidden(String name, String value, String form) = hidden([], name, value, form). +public define HTML hidden(String _name, String _value) = input([type(hidden), name(_name), value(encode_HTML_entities(_value))]). + +public define HTML text_input(List(CoreAttrs) options, HTML_Label label, HTML_Id _id, WebArgName wan, InitialValue init, Int w) = + sequence([ + format_label(label, _id), + input([class("in"), type(text), id(_id.id), name(wan.name), size(w), value(encode_HTML_entities(init.value)). options]) + ]). + +public define HTML text_input(HTML_Label label, HTML_Id _id, WebArgName wan, InitialValue init, Int _width) = + sequence([ + format_label(label, _id), + input([class("in"), type(text), id(_id.id), name(wan.name), size(_width), value(encode_HTML_entities(init.value))]) + ]). + + +// text_input_ro(options, label_text, id, name, init, w) then +// [ format_label(label_text, id), +// ""], + +public define HTML text_input_ro(List(CoreAttrs) options, HTML_Label label, HTML_Id _id, WebArgName wan, InitialValue init, Int w) = + sequence([ + format_label(label, _id), + input([class("in"), boolean("readonly"), type(text), id(_id.id), name(wan.name), size(w), value(encode_HTML_entities(init.value)). options]) + ]). + +public define HTML password_input(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, InitialValue init, Int w) = + sequence([ + format_label(label, _id), + input([class("in"), type(password), id(_id.id), name(wan.name), size(w), value(encode_HTML_entities(init.value)). attrs]) + ]). + + /// Checkbox -public define HTML_Off_Form checkbox(List(CoreAttrs) attrs, String name, String form, Bool checked) = input([type("checkbox"), attr("name",name), attr("form", form), bool_attr(checked, "checked") . attrs]). -public define HTML_Off_Form checkbox(List(CoreAttrs) attrs, String name, Bool checked) = input([type("checkbox"), attr("name",name), bool_attr(checked, "checked") . attrs]). -public define HTML_Off_Form checkbox(String name, String form, Bool checked) = checkbox([], name, form, checked). -public define HTML_Off_Form checkbox(String name, Bool checked) = checkbox([], name, checked). + +public define HTML checkbox(List(CoreAttrs) attrs) = input([type(checkbox) . attrs]). +public define HTML checkbox(List(CoreAttrs) attrs, String _name, String _form, Bool checked) = input([type(checkbox), name(_name), form(_form), bool_attr(checked, "checked") . attrs]). +public define HTML checkbox(List(CoreAttrs) attrs, String _name, Bool checked) = input([type(checkbox), name(_name), bool_attr(checked, "checked") . attrs]). +public define HTML checkbox(String name, String form, Bool checked) = checkbox([], name, form, checked). +public define HTML checkbox(String name, Bool checked) = checkbox([], name, checked). + +public define HTML check_box(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, Bool checked) = + sequence([ + format_label(label, _id), + hidden("~"+wan.name, "~true"), + input([type(checkbox), name(wan.name), id(_id.id), value("true"), bool_attr(checked, "checked"), class("in") . attrs]) + ]) +. + +public define HTML check_box(List(CoreAttrs) attrs, HTML_Label label, WebArgName wan, Bool checked) + = check_box (attrs, label, html_Id(wan.name), wan, checked). + +public define HTML check_box_r(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, Bool checked) = + sequence([ + input([type(checkbox), name(wan.name), id(_id.id), value("true"), bool_attr(checked, "checked"), class("in") . attrs]), + format_label(label, _id), + hidden("~"+wan.name, "~true"), + ]) +. +public define HTML check_box_r(List(CoreAttrs) attrs, HTML_Label label, WebArgName wan, Bool checked) + = check_box_r (attrs, label, html_Id(wan.name), wan, checked). + +public define HTML file_upload(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, Int width)= + sequence([ + format_label(label, _id), + input([type(file), id(_id.id), size(width), name(wan.name), class("in") . attrs]) + ]) +. +public define HTML file_upload(WebArgName n, Int width)= file_upload([], no_label, html_Id(n.name), n, width). + /// Radio button -public define HTML_Off_Form radio(List(CoreAttrs) attrs, String name, String value, String form, Bool checked) = input([type("radio"), attr("name",name), attr("value",value), attr("form", form), bool_attr(checked, "checked") . attrs]). -public define HTML_Off_Form radio(List(CoreAttrs) attrs, String name, String value, String form) = radio(attrs, name, value, form, false). -public define HTML_Off_Form radio(String name, String value, String form, Bool checked) = radio([], name, value, form, checked). -public define HTML_Off_Form radio(String name, String value, String form) = radio([], name, value, form, false). +public define HTML radio(List(CoreAttrs) attrs, String _name, String _value, String _form, Bool checked) = input([type(radio), name(_name), value(_value), form(_form), bool_attr(checked, "checked") . attrs]). +public define HTML radio(List(CoreAttrs) attrs, String name, String value, String form) = radio(attrs, name, value, form, false). +public define HTML radio(String name, String value, String form, Bool checked) = radio([], name, value, form, checked). +public define HTML radio(String name, String value, String form) = radio([], name, value, form, false). +public define HTML radio(String _name, String _value) = input([type(radio), name(_name), value(_value)]). + +public define HTML radio_button(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, WebArgValue _value, Bool checked) = + sequence([ + format_label(label, _id), + input([type(radio), name(wan.name), id(_id.id), value(_value.value), bool_attr(checked, "checked"), class("in") . attrs]) + ]) +. - /// hidden value -public define HTML_Off_Form hidden(List(CoreAttrs) attrs, String name, String value, String form) = input([type("hidden"), attr("name",name), attr("value",value), attr("form", form) . attrs]). -public define HTML_Off_Form hidden(CoreAttrs attr, String name, String value, String form) = hidden([attr], name, value, form). -public define HTML_Off_Form hidden(String name, String value, String form) = hidden([], name, value, form). -public define HTML_Off_Form hidden(String _name, String _value) = input([type("hidden"), name(_name), value(_value)]). +public define HTML radio_button(List(CoreAttrs) attrs, HTML_Label label, WebArgName wan, WebArgValue value, Bool checked) + = radio_button (attrs, label, html_Id(wan.name), wan, value, checked). + + +public define HTML radio_button_r(List(CoreAttrs) attrs, HTML_Label label, HTML_Id _id, WebArgName wan, WebArgValue _value, Bool checked) = + sequence([ + input([type(radio), name(wan.name), id(_id.id), value(_value.value), bool_attr(checked, "checked"), class("in") . attrs]), + format_label(label, _id) + ]) +. +public define HTML radio_button_r(List(CoreAttrs) attrs, HTML_Label label, WebArgName wan, WebArgValue value, Bool checked) + = radio_button_r(attrs, label, html_Id(wan.name), wan, value, checked). + //-- END of preset type // -public define HTML_Off_Form img(List(CoreAttrs) attrs, String src, String alt) = html_void_tag("img", attrs + [attr("src",src), attr("alt",alt)] ). -public define HTML_Off_Form img(CoreAttrs _attr, String src, String alt) = html_void_tag("img", [_attr, attr("src",src), attr("alt",alt)] ). -public define HTML_Off_Form img(String src) = img([], src, ""). -public define HTML_Off_Form img(String src, String alt) = img([], src, alt). -public define HTML_Off_Form img(List(CoreAttrs) attrs, String src) = img(attrs, src, ""). -public define HTML_Off_Form img(CoreAttrs attr, String src) = img([attr], src, ""). -public define HTML_Off_Form img(String src, Int width, Int height) = img([attr("width",to_String(width)+"px"), attr("height",to_String(height)+"px")], src, src). -public define HTML_Off_Form img(String src, String alt, Int width, Int height) = +public define HTML img(List(CoreAttrs) attrs, String src, String alt) = html_void_tag("img", attrs + [attr("src",src), attr("alt",alt)] ). +public define HTML img(CoreAttrs _attr, String src, String alt) = html_void_tag("img", [_attr, attr("src",src), attr("alt",alt)] ). +public define HTML img(String src) = img([], src, ""). +public define HTML img(String src, String alt) = img([], src, alt). +public define HTML img(List(CoreAttrs) attrs, String src) = img(attrs, src, ""). +public define HTML img(CoreAttrs attr, String src) = img([attr], src, ""). +public define HTML img(String src, Int width, Int height) = img([attr("width",to_String(width)+"px"), attr("height",to_String(height)+"px")], src, src). +public define HTML img(String src, String alt, Int width, Int height) = html_void_tag("img", [attr("src",src), attr("alt",alt), attr("width",to_String(width)+"px"), attr("height",to_String(height)+"px")]). -public define HTML_Off_Form img(List(CoreAttrs) attrs, String src, String alt, Int width, Int height) = +public define HTML img(List(CoreAttrs) attrs, String src, String alt, Int width, Int height) = html_void_tag("img", attrs + [attr("src",src), attr("alt",alt), attr("width",to_String(width)+"px"), attr("height",to_String(height)+"px")]). -public define HTML_Off_Form img(CoreAttrs _attr, String src, String alt, Int width, Int height) = +public define HTML img(CoreAttrs _attr, String src, String alt, Int width, Int height) = html_void_tag("img", [_attr, attr("src",src), attr("alt",alt), width_px(width), height_px(height)]). //