diff --git a/ds_files/ds_types.anubis b/ds_files/ds_types.anubis index 6532e5a..cbf0004 100644 --- a/ds_files/ds_types.anubis +++ b/ds_files/ds_types.anubis @@ -123,7 +123,8 @@ public define List(DS_Type_File) calexium_lib_types_description = component(list, ds_type("Email_Address"), "cc", comment("email sent as copy to that list of recipients")), component(list, ds_type("Email_Address"), "bcc", comment("email sent as blank carbon copy to that list of recipients")), component(string, "subject", comment("subject of email. Supposed to be UTF8")), - component(string, "content", comment("content of the email")), + component(string, "text_content", comment("content of the email in text format")), + component(string, "html_content", comment("content of the email in html format")), component(list, ds_type("File_ref"), "attached_files", comment("list of files to attach to this email")), component(bool, "send_copy",comment("send copy to sender by bcc (useful when the email is sent by an automat)")), component(string, "reply_to", comment("reply to !!")) diff --git a/examples/minimal_web_site.anubis b/examples/minimal_web_site.anubis deleted file mode 100644 index a77815a..0000000 --- a/examples/minimal_web_site.anubis +++ /dev/null @@ -1,230 +0,0 @@ - - - *Project* The Anubis Project - - *Title* A minimal web site. - - *Copyright* Copyright © David RENÉ - - *Released* - - *Author* David RENÉ - - *Overview* - - This file is just an example which may help to start making a web site with - Anubis Calexium Library - It was based on the example for making a minimal web site made by Alain Prouté and located - in examples/network folder in standard library example - - This example is absolutely minimalist and manage only page. - - -read tools/basis.anubis // required for 'make_directory' and . -read system/convert.anubis -read web/CXM_common.anubis // required for type 'Web_arg' -read web/CXM_multihost_http_server.anubis // required for type 'HTTP_Info' -read web/CXM_making_a_web_site.anubis -read web/mime.anubis // required for list of known MIME types - - - - - *** Server directory. - - A directory for putting files for all web sites. There will be one subdirectory per web - site. - -define String web_sites_directory = my_anubis_directory+"/web_sites". - - - *** Example site 1. - - Computing the pages of site 1. There is just one page. The type '$State' (see - 'web/CXM_making_a_web_site.anubis') has been chosen as 'One'. If this type were more - elaborate, the function 'compute_page_1' could compute several different pages (for - example, one per alternative of this type). Anyway, there is only one such function for - each web site. - -define HTTP_Answer - compute_page_1 - ( - One state - )= - html_page - ( - "Example Site 1", // title of web site - [], // list of 'META' tags (empty for this site) - body // body of page - ( - // list of body options - [ - background_color(rgb(255,200,200)) - // add more body options here - ], - - // content of page - center(text([size(14)],"This is the 'Example 1' web site.")) - ) - ) -. - - - - Making the description of web site 1. In this description, several elements are the - bare minimum. There is no action at all, no data base, almost nothing. See - 'web/making_a_web_site.anubis' for the declaration of the function - 'make_web_site_description'. - -define Web_Site - example_site_1 - = - // make the directory for web site 1 - // (subdirectories of it will be created automatically by the HTTP server) - forget((String)make_directory(web_sites_directory+"/example_site_1")); - - // make a list of all possible 'host names' for web site 1: - with addresses = (List(String)) - [ - "example-site-1", - "127.0.0.1", - "192.168.0.1" - // add more adresses here - ], - - // now make the description of the web site - make_web_site_description( - - //this is the unique ID of the web site. This ID will be use for prepend the cookies - //names belonging to that web site - "example", - - // the list of addresses defined above - addresses, - - // directory for the files of web site 1 - web_sites_directory+"/example_site_1", - - // directory for the states of that web_site - web_sites_directory+"/example_site_1/states", - - // initializing function - (One u) |-> u, // nothing to initialize for web site 1 - - // the function producing the initial state - (HTTP_Info info, - List(Web_arg) lwa, - Bool is_https) |-> unique, // there is ony one possible state for web site 1 - - // the function for handling expired tickets - // (tickets are kept on the server's disk and represent states. They are used for - // passing session informations from pages to pages. See - // 'web/CXM_making_a_web_site.anubis' for detailed explanations.) - (One expired, - Maybe(String) mb_action_name, - HTTP_Info info, - List(Web_arg) lwa, - Bool is_https) |-> unique, // keep the same state - - // the function for handling lost tickets - (Maybe(String) mb_action_name, - HTTP_Info info, - List(Web_arg) lwa, - Bool is_https) |-> unique, // restart with default state - - // list of all actions - [ ], // no action for web site 1 - - // the function for computing the pages of web site 1 (it is defined above) - compute_page_1, - - // the function for producing additional HTTP headers - (One u) |-> [], - - // timeout for tickets (in seconds) - 3600, // does'nt matter since only one state - - // list of redirections (one for each address) - // (see 'web/CXM_common.anubis' for the type 'Redirection') - redirection_list(map((String address) |-> redirect("/",address,"/site1.awp"), addresses)), - - // character encoding for web site 1 - "UTF-8", - - // list of URI extensions producing a console/journal message - [ - ".awp", // pages computed by this program - ".jpg", // images, etc... - ".gif", - ".png" - // add more extensions here (they must be known; see 'web/mime.anubis') - ], - - // list of HTTP headers which are traced in the console/journal messages - [ - "host", - "user-agent" - // add more HTTP headers here - ], - - // secret string (used by 'private download') - "HUD76GRD56FD7GFDS4RT", // for a real site, please choose another one - // it must remain secret - - // list of known MIME types (taken from 'web/mime.anubis') - known_mime_types, - - // action to be performed before a file is sent - // (for example, this may be used for counting downloads) - (String action_name, - List(Web_arg) lwa) |-> unique // no action at all - ) -. - - - - - *** Example site 2. - - Imagine another web site here... - - - - - - *** Starting all our web sites together. - -global define One - minimal_web_site - ( - List(String) args - ) = - // make the directory for all web sites (if needed) - forget((String) make_directory(web_sites_directory)); - - with http_port = (Word32)8000, - https_port = (Word32)4430, - // create a variable for handling the shutdown of our web sites - with shutdown_required = var(false), - with is_shutdown = (One u) |-> *shutdown_required, - - // start all web sites - if start_web_sites( - 0, // listen on all IP addresses - http_port, // port for HTTP - https_port, // port for HTTPS - "www.georges.example.com", // common name of SSL certificate - [ - example_site_1 - // add other web sites here - ], - is_shutdown) is - { - cannot_bind_to_port(n) then println("Cannot bind to port: "+n), - cannot_bind_to_port(n,m) then println("Cannot bind to ports: "+n+", "+m), - ok(s1,s2) then println("Servers started on ports "+http_port+" (HTTP) and "+https_port+" (HTTPS).") - } -. - - - diff --git a/examples/minimal_web_site_vc.anubis b/examples/minimal_web_site_vc.anubis deleted file mode 100644 index c4d17fe..0000000 --- a/examples/minimal_web_site_vc.anubis +++ /dev/null @@ -1,282 +0,0 @@ - - - *Project* The Anubis Project - - *Title* A minimal web site. - - *Copyright* Copyright © David RENÉ. - - *Released* - - *Author* David RENÉ - - *Overview* - - This file is just an example which may help to start making a web site with - Anubis Calexium Library - It was based on the example for making a minimal web site made by Alain Prouté and located - in examples/network folder in standard library example - - This example is absolutely minimalist and manage only page. - - -read tools/basis.anubis // required for 'make_directory' and . -read system/convert.anubis -read calexium_lib/web/CXM_common.anubis // required for type 'Web_arg' -read calexium_lib/web/CXM_multihost_http_server.anubis // required for type 'HTTP_Info' -read calexium_lib/web/CXM_controller.anubis -read calexium_lib/web/CXM_making_a_web_site.anubis -read web/mime.anubis // required for list of known MIME types -read calexium_lib/web/CXM_web_arg_utils.anubis -read calexium_lib/web/CXM_form.anubis -read calexium_lib/web/jQuery/CXM_jquery_button.anubis - - *** Server directory. - - A directory for putting files for all web sites. There will be one subdirectory per web - site. - -define String web_sites_directory = my_anubis_directory+"/web_sites". - - -define HTML_Partial_Content - create_login_form - = - - partial_content( - [css(css_file("css/login.css"))], - div([id("login")], - sequence([ - //BODY - div([id("login_body")], - cxm_form( "login_form", [], "do_login", [], [], - [ - input (label(("LOGIN_NAME"), no_help), wan("login_name"), init(""), narrow, non_mandatory), - password_input(label(("PASSWORD"), no_help), wan("password"), init(""), narrow, non_mandatory), - partial(img_submit_button(("CONNECTION"), "login_form" )) - ]) - ), - ]) - )). - -define HTTP_Answer - go_login - ( - One state - )= - html_page - ( - "Example Site 1", // title of web site - [], // list of 'META' tags (empty for this site) - body // body of page - ( - // list of body options - [ - background_color(rgb(255,200,200)) - // add more body options here - ], - - // content of page - partial(create_login_form) - ) - ) -. - -define HTTP_Answer - compute_page_1 - ( - One state - )= - html_page - ( - "Example Site 1", // title of web site - [], // list of 'META' tags (empty for this site) - body // body of page - ( - // list of body options - [ - background_color(rgb(255,200,200)) - // add more body options here - ], - - // content of page - center(text([size(14)],"This is the 'Example 1' web site.")) - ) - ) -. - -define (One, HTTP_Answer) - root_controller - ( - HTTP_Info http_info, - List(Web_arg) lwa, - Bool is_https, - One toto - )= - - with action = get_String(lwa, "action", "go_login"), - if action = "go_login" then - (unique, go_login(unique)) - else - (unique, compute_page_1(unique)). - - -define WEB_Controller(One) - make_root_controller - = - web_controller("root", root_controller) -. - - Making the description of web site 1. In this description, several elements are the - bare minimum. There is no action at all, no data base, almost nothing. See - 'web/making_a_web_site.anubis' for the declaration of the function - 'make_web_site_description'. - -define Web_Site - example_site_1 - = - // make the directory for web site 1 - // (subdirectories of it will be created automatically by the HTTP server) - forget((String)make_directory(web_sites_directory+"/example_site_1")); - - // make a list of all possible 'host names' for web site 1: - with addresses = (List(String)) - [ - "example-site-1", - "127.0.0.1", - "192.168.0.1" - // add more adresses here - ], - - // now make the description of the web site - make_web_site_controller_description( - - //this is the unique ID of the web site. This ID will be use for prepend the cookies - //names belonging to that web site - "example", - - // the list of addresses defined above - addresses, - - // directory for the files of web site 1 - web_sites_directory+"/example_site_1", - - // directory for the states of that web_site - web_sites_directory+"/example_site_1/states", - - // initializing function - (One u) |-> u, // nothing to initialize for web site 1 - - // the function producing the initial state - (HTTP_Info info, - List(Web_arg) lwa, - Bool is_https) |-> unique, // there is ony one possible state for web site 1 - - // the function for handling expired tickets - // (tickets are kept on the server's disk and represent states. They are used for - // passing session informations from pages to pages. See - // 'web/CXM_making_a_web_site.anubis' for detailed explanations.) - (One expired, - Maybe(String) mb_action_name, - HTTP_Info info, - List(Web_arg) lwa, - Bool is_https) |-> unique, // keep the same state - - // the function for handling lost tickets - (Maybe(String) mb_action_name, - HTTP_Info info, - List(Web_arg) lwa, - Bool is_https) |-> unique, // restart with default state - - var([make_root_controller]), - - // the function for producing additional HTTP headers - (One u) |-> [], - - // timeout for tickets (in seconds) - 3600, // does'nt matter since only one state - - // list of redirections (one for each address) - // (see 'web/CXM_common.anubis' for the type 'Redirection') - redirection_list(map((String address) |-> redirect("/",address,"/index.awp"), addresses)), - - // character encoding for web site 1 - "UTF-8", - - // list of URI extensions producing a console/journal message - [ - ".awp", // pages computed by this program - ".jpg", // images, etc... - ".gif", - ".png" - // add more extensions here (they must be known; see 'web/mime.anubis') - ], - - // list of HTTP headers which are traced in the console/journal messages - [ - "host", - "user-agent" - // add more HTTP headers here - ], - - // secret string (used by 'private download') - "HUD76GRD56FD7GFDS4RT", // for a real site, please choose another one - // it must remain secret - - // list of known MIME types (taken from 'web/mime.anubis') - known_mime_types, - - // action to be performed before a file is sent - // (for example, this may be used for counting downloads) - (String action_name, - List(Web_arg) lwa) |-> unique // no action at all - ) -. - - - - - *** Example site 2. - - Imagine another web site here... - - - - - - *** Starting all our web sites together. - -global define One - minimal_web_site_vc - ( - List(String) args - ) = - // make the directory for all web sites (if needed) - forget((String) make_directory(web_sites_directory)); - - with http_port = (Word32)8000, - https_port = (Word32)4430, - // create a variable for handling the shutdown of our web sites - with shutdown_required = var(false), - with is_shutdown = (One u) |-> *shutdown_required, - - // start all web sites - if start_web_sites( - 0, // listen on all IP addresses - http_port, // port for HTTP - https_port, // port for HTTPS - "www.georges.example.com", // common name of SSL certificate - [ - example_site_1 - // add other web sites here - ], - is_shutdown) is - { - cannot_bind_to_port(n) then println("Cannot bind to port: "+n), - cannot_bind_to_port(n,m) then println("Cannot bind to ports: "+n+", "+m), - ok(s1,s2) then println("Servers started on ports "+http_port+" (HTTP) and "+https_port+" (HTTPS).") - } -. - - - diff --git a/mail/types/generated/email_to_send.anubis b/mail/types/generated/email_to_send.anubis index 3a8aa24..fbf89ff 100644 --- a/mail/types/generated/email_to_send.anubis +++ b/mail/types/generated/email_to_send.anubis @@ -1,8 +1,8 @@ -/* +/* * Created by 伝作 (Densaku). * Types & Messages generator written by フランスのトトロ aka (David RENÉ) - * Date: 2019-05-17 - * Time: 19:05:20 + * Date: 2020-04-01 + * Time: 09:43:06 * */ @@ -10,8 +10,8 @@ transmit system/muscle.anubis transmit system/convert.anubis transmit tools/basis.anubis -transmit calexium_lib/types/generated/file_ref.anubis -transmit calexium_lib/mail/types/generated/email_address.anubis +transmit types/generated/file_ref.anubis +transmit types/generated/email_address.anubis @@ -22,7 +22,8 @@ public type Email_to_send: List(Email_Address) cc, //email sent as copy to that list of recipients List(Email_Address) bcc, //email sent as blank carbon copy to that list of recipients String subject, //subject of email. Supposed to be UTF8 - String content, //content of the email + String text_content, //content of the email in text format + String html_content, //content of the email in html format List(File_ref) attached_files, //list of files to attach to this email Bool send_copy, //send copy to sender by bcc (useful when the email is sent by an automat) String reply_to //reply to !! @@ -43,7 +44,7 @@ public define Message if _email_to_send is { //Alternative data_to_send - data_to_send(_from, __to, __cc, __bcc, _subject, _content, __attached_files, _send_copy, _reply_to) then + data_to_send(_from, __to, __cc, __bcc, _subject, _text_content, _html_content, __attached_files, _send_copy, _reply_to) then forget(add_string(_email_to_send_message, "__TYPE_ALT__", "data_to_send")); // [type = Email_Address] data_to_send.from forget(add_message(_email_to_send_message, "from", to_Message(_from))); @@ -55,8 +56,10 @@ public define Message map_forget((Email_Address _bcc) |-> add_message(_email_to_send_message, "bcc", to_Message(_bcc)), __bcc); // [type = String] data_to_send.subject forget(add_string(_email_to_send_message, "subject", _subject)); - // [type = String] data_to_send.content - forget(add_string(_email_to_send_message, "content", _content)); + // [type = String] data_to_send.text_content + forget(add_string(_email_to_send_message, "text_content", _text_content)); + // [type = String] data_to_send.html_content + forget(add_string(_email_to_send_message, "html_content", _html_content)); // [type = List(File_ref)] data_to_send.attached_files map_forget((File_ref _attached_files) |-> add_message(_email_to_send_message, "attached_files", to_Message(_attached_files)), __attached_files); // [type = Bool] data_to_send.send_copy @@ -92,8 +95,10 @@ public define Maybe(Email_to_send) if mb__bcc_ is {failure then failure, success(_bcc_) then // [type = String] data_to_send.subject if find_string(_email_to_send_message, "subject") is {failure then failure, success(_subject_) then - // [type = String] data_to_send.content - if find_string(_email_to_send_message, "content") is {failure then failure, success(_content_) then + // [type = String] data_to_send.text_content + if find_string(_email_to_send_message, "text_content") is {failure then failure, success(_text_content_) then + // [type = String] data_to_send.html_content + if find_string(_email_to_send_message, "html_content") is {failure then failure, success(_html_content_) then // [type = List(File_ref)] data_to_send.attached_files with mb__attached_files_ = map_escape(( Message msg ) |-> (Maybe(File_ref)) from_Message(msg), find_messages(_email_to_send_message, "attached_files")), if mb__attached_files_ is {failure then failure, success(_attached_files_) then @@ -102,8 +107,8 @@ public define Maybe(Email_to_send) // [type = String] data_to_send.reply_to if find_string(_email_to_send_message, "reply_to") is {failure then failure, success(_reply_to_) then - success(data_to_send(_from_, _to_, _cc_, _bcc_, _subject_, _content_, _attached_files_, _send_copy_, _reply_to_)) - }}}}}}}}}} + success(data_to_send(_from_, _to_, _cc_, _bcc_, _subject_, _text_content_, _html_content_, _attached_files_, _send_copy_, _reply_to_)) + }}}}}}}}}}} else failure //No valid Alternative found ! else -- libgit2 0.21.4