Commit 491c5383c8cfaa9817acf8479d66affd2fb3ff02
1 parent
3ea7aa40
move all making_a_web_site type declaration into a separate file.
better management of the web plugin extend logger dump from 1024 to 2048 bytes
Showing
8 changed files
with
1027 additions
and
669 deletions
Show diff stats
net_services_protocols/logger_service.anubis
| @@ -267,7 +267,9 @@ define Message | @@ -267,7 +267,9 @@ define Message | ||
| 267 | String log_string, | 267 | String log_string, |
| 268 | Int level | 268 | Int level |
| 269 | )= | 269 | )= |
| 270 | - with string = if length(log_string) > 1024 then (if sub_string(log_string, 0, 1024) is success(s) then s else "?") + "..." | 270 | + with len = length(log_string), |
| 271 | + //println("len log string "+len); | ||
| 272 | + with string = if length(log_string) > 2048 then (if sub_string(log_string, 0, 2048) is success(s) then s else "?") + "... original log string length "+len | ||
| 271 | else log_string, | 273 | else log_string, |
| 272 | with log_msg = message(_CXM_LOGGER_LOG), | 274 | with log_msg = message(_CXM_LOGGER_LOG), |
| 273 | forget(add_string(log_msg, "LogName", logger_name)); | 275 | forget(add_string(log_msg, "LogName", logger_name)); |
web/CXM_making_a_web_site.anubis
| @@ -58,7 +58,8 @@ read system/string.anubis | @@ -58,7 +58,8 @@ read system/string.anubis | ||
| 58 | read system/logger.anubis | 58 | read system/logger.anubis |
| 59 | transmit CXM_common.anubis | 59 | transmit CXM_common.anubis |
| 60 | transmit CXM_multihost_http_server.anubis | 60 | transmit CXM_multihost_http_server.anubis |
| 61 | -read web/mime.anubis | 61 | +read web/mime.anubis |
| 62 | +read calexium_lib/web/plugin/plugin.anubis | ||
| 62 | read CXM_cookies.anubis | 63 | read CXM_cookies.anubis |
| 63 | read CXM_json.anubis | 64 | read CXM_json.anubis |
| 64 | transmit CXM_web_dump.anubis | 65 | transmit CXM_web_dump.anubis |
| @@ -67,6 +68,7 @@ transmit CXM_web_session.anubis | @@ -67,6 +68,7 @@ transmit CXM_web_session.anubis | ||
| 67 | transmit CXM_web_action.anubis | 68 | transmit CXM_web_action.anubis |
| 68 | 69 | ||
| 69 | transmit calexium_lib/web/types/web_action_name.anubis | 70 | transmit calexium_lib/web/types/web_action_name.anubis |
| 71 | +transmit calexium_lib/web/types/making_a_web_site.anubis | ||
| 70 | 72 | ||
| 71 | //TODO move anywhere | 73 | //TODO move anywhere |
| 72 | 74 | ||
| @@ -303,22 +305,7 @@ public define String | @@ -303,22 +305,7 @@ public define String | ||
| 303 | sub-boxes as there are actions. For this reason, we define the following type for | 305 | sub-boxes as there are actions. For this reason, we define the following type for |
| 304 | representing actions (where '$State' is the type representing session informations): | 306 | representing actions (where '$State' is the type representing session informations): |
| 305 | 307 | ||
| 306 | -public type Web_Action($State): | ||
| 307 | - http_action (String name, // name of action | ||
| 308 | - ($State) -> Bool allow, // true if action allowed | ||
| 309 | - (HTTP_Info http_info, | ||
| 310 | - List(Web_arg) web_args, // actually only 'operands' web arguments | ||
| 311 | - $State state) -> $State do_it), | ||
| 312 | - https_action (String name, // name of action | ||
| 313 | - ($State) -> Bool allow, // true if action allowed | ||
| 314 | - (HTTP_Info http_info, | ||
| 315 | - List(Web_arg) web_args, // actually only 'operands' web arguments | ||
| 316 | - $State state) -> $State do_it), | ||
| 317 | - http_https_action (String name, | ||
| 318 | - ($State) -> Bool allow, | ||
| 319 | - (HTTP_Info http_info, | ||
| 320 | - List(Web_arg) web_args, | ||
| 321 | - $State state) -> $State do_it). | 308 | + |
| 322 | 309 | ||
| 323 | 'http_action's are executed only under HTTP, and 'https_action's are executed only | 310 | 'http_action's are executed only under HTTP, and 'https_action's are executed only |
| 324 | under HTTPS. 'http_https_action's may be executed under both types of connections. | 311 | under HTTPS. 'http_https_action's may be executed under both types of connections. |
| @@ -352,7 +339,7 @@ public type Web_Action($State): | @@ -352,7 +339,7 @@ public type Web_Action($State): | ||
| 352 | where the type 'HTTP_Answer' (defined below in this file) abstractly represents HTML | 339 | where the type 'HTTP_Answer' (defined below in this file) abstractly represents HTML |
| 353 | pages. | 340 | pages. |
| 354 | 341 | ||
| 355 | -public type HTTP_Answer:... | 342 | +//public type HTTP_Answer:... |
| 356 | 343 | ||
| 357 | It should be clear that states and pages are deeply linked together. Indeed, we really | 344 | It should be clear that states and pages are deeply linked together. Indeed, we really |
| 358 | understand the page shown to the client as a representation of the current state of the | 345 | understand the page shown to the client as a representation of the current state of the |
| @@ -360,54 +347,11 @@ public type HTTP_Answer:... | @@ -360,54 +347,11 @@ public type HTTP_Answer:... | ||
| 360 | taken from the data bases. | 347 | taken from the data bases. |
| 361 | 348 | ||
| 362 | 349 | ||
| 363 | -public type HTML_Partial_Content:... | 350 | +//public type HTML_Partial_Content:... |
| 364 | 351 | ||
| 365 | 352 | ||
| 366 | 353 | ||
| 367 | -public type WEB_Controller_Result: | ||
| 368 | - http_answer( | ||
| 369 | - WEB_Session session, //modified session | ||
| 370 | - HTTP_Answer http_answer //http answer | ||
| 371 | - ), | ||
| 372 | - http_answer( | ||
| 373 | - HTTP_Answer http_answer //http answer | ||
| 374 | - ), | ||
| 375 | - redirect( //internal redirection, session is modified to call the right controller and action | ||
| 376 | - WEB_Session session | ||
| 377 | - ), | ||
| 378 | - redirect( //internal redirection, session is modified to call the right controller and action | ||
| 379 | - WEB_Session session, | ||
| 380 | - String controller, | ||
| 381 | - String action_name | ||
| 382 | - ), | ||
| 383 | - redirect_to_previous, | ||
| 384 | - redirect_to_previous( | ||
| 385 | - Var(List(WEB_Session_Field)) fields | ||
| 386 | - ), | ||
| 387 | - ajax( | ||
| 388 | - Maybe(WEB_Session) mb_session, //modified session if success else failure | ||
| 389 | - HTTP_Answer http_answer //http answer | ||
| 390 | - ), | ||
| 391 | - ajax( | ||
| 392 | - Maybe(WEB_Session) mb_session, //modified session if success else failure | ||
| 393 | - HTML_Partial_Content content, | ||
| 394 | - String additional_script | ||
| 395 | - ), | ||
| 396 | - ajax( | ||
| 397 | - Maybe(WEB_Session) mb_session, //modified session if success else failure | ||
| 398 | - Printable_tree content, | ||
| 399 | - String additional_script | ||
| 400 | - ), | ||
| 401 | - send_file( | ||
| 402 | - String full_path, //full path with file name of the file to send | ||
| 403 | - Content_Disposition content_disposition //in which form the file must consider by the client (inline: try to display to user, attachment: save as file) | ||
| 404 | - ), | ||
| 405 | - renderer_content( | ||
| 406 | - Maybe(WEB_Session) mb_session, //modified session if success else failure | ||
| 407 | - String title, | ||
| 408 | - HTML_Partial_Content content, | ||
| 409 | - ) | ||
| 410 | -. | 354 | + |
| 411 | 355 | ||
| 412 | public define WEB_Controller_Result | 356 | public define WEB_Controller_Result |
| 413 | ajax | 357 | ajax |
| @@ -492,50 +436,26 @@ public define WEB_Controller_Result | @@ -492,50 +436,26 @@ public define WEB_Controller_Result | ||
| 492 | 436 | ||
| 493 | public define WEB_Controller_Result | 437 | public define WEB_Controller_Result |
| 494 | renderer_content( | 438 | renderer_content( |
| 495 | - String title, | ||
| 496 | HTML_Partial_Content content, | 439 | HTML_Partial_Content content, |
| 497 | )= | 440 | )= |
| 498 | - renderer_content(failure, title, content) | 441 | + renderer_content(failure, content) |
| 499 | . | 442 | . |
| 500 | 443 | ||
| 501 | public define WEB_Controller_Result | 444 | public define WEB_Controller_Result |
| 502 | renderer_content( | 445 | renderer_content( |
| 503 | WEB_Session session, //modified session if success else failure | 446 | WEB_Session session, //modified session if success else failure |
| 504 | - String title, | ||
| 505 | HTML_Partial_Content content, | 447 | HTML_Partial_Content content, |
| 506 | )= | 448 | )= |
| 507 | - renderer_content(success(session), title, content) | 449 | + renderer_content(success(session), content) |
| 508 | . | 450 | . |
| 509 | 451 | ||
| 510 | - | ||
| 511 | -public type WEB_Action_Allowed_Protocol: | ||
| 512 | - http, | ||
| 513 | - https, | ||
| 514 | - http_https. | ||
| 515 | - | ||
| 516 | -public type WEB_Action: | ||
| 517 | - web_action( | ||
| 518 | - WEB_Action_Name name, // name of action | ||
| 519 | - WEB_Action_Allowed_Protocol allowed_proto, | ||
| 520 | - (WEB_Session) -> Bool allow, // true if action allowed | ||
| 521 | - (WEB_Session) -> WEB_Controller_Result do_it | ||
| 522 | - ) | ||
| 523 | -. | ||
| 524 | - | ||
| 525 | -public type WEB_Controller: | ||
| 526 | - web_controller( | ||
| 527 | - String name, //controller name | ||
| 528 | - Var(List(WEB_Action)) controller_actions, //list of all actions of that controller | ||
| 529 | - (WEB_Session)-> WEB_Controller_Result error //Error renderer | ||
| 530 | - ) | 452 | + public define WEB_Controller_Result |
| 453 | + redraw( | ||
| 454 | + HTML_Partial_Content content, | ||
| 455 | + )= | ||
| 456 | + redraw(failure, content) | ||
| 531 | . | 457 | . |
| 532 | 458 | ||
| 533 | -public type WEB_Page_Renderer: | ||
| 534 | - web_page_renderer( | ||
| 535 | - String name, //renderer name | ||
| 536 | - (WEB_Session _session, String title, HTML_Partial_Content _content) -> HTTP_Answer page_layout //call back for rendering page | ||
| 537 | - ) | ||
| 538 | -. | ||
| 539 | 459 | ||
| 540 | 460 | ||
| 541 | define List(HTTP_header) | 461 | define List(HTTP_header) |
| @@ -951,52 +871,16 @@ public define Start_Web_Sites_Result | @@ -951,52 +871,16 @@ public define Start_Web_Sites_Result | ||
| 951 | For easy reference, we gather below the definitions of all the types used by the HTML | 871 | For easy reference, we gather below the definitions of all the types used by the HTML |
| 952 | interface, and we comment them immediately. | 872 | interface, and we comment them immediately. |
| 953 | 873 | ||
| 954 | -public type HTML_Off_Form:... | 874 | + //public type HTML_Off_Form:... |
| 955 | 875 | ||
| 956 | -public type HTML_Size: | ||
| 957 | - absolute(Int), // in pixels | ||
| 958 | - percentage(Int). | 876 | + |
| 959 | 877 | ||
| 960 | 878 | ||
| 961 | 879 | ||
| 962 | 880 | ||
| 963 | - This indicate the way of reading text. | ||
| 964 | -public type Reading_Way: | ||
| 965 | - ltr, //the text is readable from "Left To Right" like english | ||
| 966 | - rtl. //the text is readable from "Right To Left" like arabic | ||
| 967 | - | ||
| 968 | - | ||
| 969 | -// Following types are define to prohib any arguments order error | ||
| 970 | 881 | ||
| 971 | -/** | ||
| 972 | - * String value for 'id' attribut | ||
| 973 | - */ | ||
| 974 | -public type HTML_Id: | ||
| 975 | - html_Id(String id). | ||
| 976 | - | ||
| 977 | -/** | ||
| 978 | - * String value for 'class' attribut | ||
| 979 | - */ | ||
| 980 | -public type HtmlClass: | ||
| 981 | - htmlClass(String class). | ||
| 982 | - | ||
| 983 | -/** | ||
| 984 | - * Name used in arguments list when form is submitted. | ||
| 985 | - */ | ||
| 986 | -public type WebArgName: | ||
| 987 | - wan(String name). | ||
| 988 | 882 | ||
| 989 | -/** | ||
| 990 | - * Value passed to arguments list when form is submitted (for RadioButton and CheckBox). | ||
| 991 | - */ | ||
| 992 | -public type WebArgValue: | ||
| 993 | - wav(String value). | ||
| 994 | 883 | ||
| 995 | -/** | ||
| 996 | - * Initial value of an input field. | ||
| 997 | - */ | ||
| 998 | -public type InitialValue: | ||
| 999 | - init(String value). | ||
| 1000 | 884 | ||
| 1001 | public define Printable_tree [HTML_Id x . Printable_tree y] = str_pt(x.id, y). | 885 | public define Printable_tree [HTML_Id x . Printable_tree y] = str_pt(x.id, y). |
| 1002 | public define Printable_tree [HtmlClass x . Printable_tree y] = str_pt(x.class, y). | 886 | public define Printable_tree [HtmlClass x . Printable_tree y] = str_pt(x.class, y). |
| @@ -1004,182 +888,16 @@ public define Printable_tree [WebArgName x . Printable_tree y] = str_pt(x.name | @@ -1004,182 +888,16 @@ public define Printable_tree [WebArgName x . Printable_tree y] = str_pt(x.name | ||
| 1004 | public define Printable_tree [WebArgValue x . Printable_tree y] = str_pt(x.value, y). | 888 | public define Printable_tree [WebArgValue x . Printable_tree y] = str_pt(x.value, y). |
| 1005 | public define Printable_tree [InitialValue x . Printable_tree y] = str_pt(x.value, y). | 889 | public define Printable_tree [InitialValue x . Printable_tree y] = str_pt(x.value, y). |
| 1006 | 890 | ||
| 1007 | -public type HTML_tooltip: | ||
| 1008 | - html_tooltip | ||
| 1009 | - ( | ||
| 1010 | - String title, | ||
| 1011 | - String keyword, | ||
| 1012 | - Int width, | ||
| 1013 | - ), | ||
| 1014 | - html_tooltip_ext | ||
| 1015 | - ( | ||
| 1016 | - String title, | ||
| 1017 | - String extend_type, | ||
| 1018 | - String class_suffix, | ||
| 1019 | - List((String, String)) ext_args | ||
| 1020 | - ), | ||
| 1021 | - html_tooltip_ext //same without class suffix. This means we use awesome font | ||
| 1022 | - ( | ||
| 1023 | - String title, | ||
| 1024 | - String extend_type, | ||
| 1025 | - List((String, String)) ext_args | ||
| 1026 | - ), | ||
| 1027 | - html_tooltip | ||
| 1028 | - ( | ||
| 1029 | - String title, | ||
| 1030 | - WEB_Action_Name wan, | ||
| 1031 | - List((String, String)) ext_args | ||
| 1032 | - ). | ||
| 1033 | 891 | ||
| 1034 | 892 | ||
| 1035 | -public type HtmlEvents: | ||
| 1036 | - // Window Event Attributes | ||
| 1037 | - onafterprint, //HTML5 Script to be run after the document is printed | ||
| 1038 | - onbeforeprint, //HTML5 Script to be run before the document is printed | ||
| 1039 | - onbeforeunload, //HTML5 Script to be run when the document is about to be unloaded | ||
| 1040 | - onerror, //HTML5 Script to be run when an error occurs | ||
| 1041 | - onhashchange, //HTML5 Script to be run when there has been changes to the anchor part of the a URL | ||
| 1042 | - onload, // Fires after the page is finished loading | ||
| 1043 | - onmessage, //HTML5 Script to be run when the message is triggered | ||
| 1044 | - onoffline, //HTML5 Script to be run when the browser starts to work offline | ||
| 1045 | - ononline, //HTML5 Script to be run when the browser starts to work online | ||
| 1046 | - onpagehide, //HTML5 Script to be run when a user navigates away from a page | ||
| 1047 | - onpageshow, //HTML5 Script to be run when a user navigates to a page | ||
| 1048 | - onpopstate, //HTML5 Script to be run when the window's history changes | ||
| 1049 | - onresize, //HTML5 Fires when the browser window is resized | ||
| 1050 | - onstorage, //HTML5 Script to be run when a Web Storage area is updated | ||
| 1051 | - onunload, // Fires once a page has unloaded (or the browser window has been closed) | ||
| 1052 | - // Form element events | ||
| 1053 | - onblur, // Fires the moment that the element loses focus | ||
| 1054 | - onchange, // Fires the moment when the value of the element is changed | ||
| 1055 | - oncontextmenu, //HTML5 Script to be run when a context menu is triggered | ||
| 1056 | - onfocus, // Fires the moment when the element gets focus | ||
| 1057 | - oninput, //HTML5 Script to be run when an element gets user input | ||
| 1058 | - oninvalid, //HTML5 Script to be run when an element is invalid | ||
| 1059 | - onreset, // Fires when the Reset button in a form is clicked | ||
| 1060 | - onsearch, // Fires when the user writes something in a search field (for <input="search">) | ||
| 1061 | - onselect, // Fires after some text has been selected in an element | ||
| 1062 | - onsubmit, // Fires when a form is submitted | ||
| 1063 | - // Keyboard events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) | ||
| 1064 | - onkeydown, // Fires when a user is pressing a key | ||
| 1065 | - onkeypress, // Fires when a user presses a key | ||
| 1066 | - onkeyup, // Fires when a user releases a key | ||
| 1067 | - // Mouse events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) | ||
| 1068 | - onclick, // Fires on a mouse click on the element | ||
| 1069 | - ondblclick, // Fires on a mouse double-click on the element | ||
| 1070 | - onmousedown, // Fires when a mouse button is pressed down on an element | ||
| 1071 | - onmousemove, // Fires when the mouse pointer is moving while it is over an element | ||
| 1072 | - onmouseout, // Fires when the mouse pointer moves out of an element | ||
| 1073 | - onmouseover, // Fires when the mouse pointer moves over an element | ||
| 1074 | - onmouseup, // Fires when a mouse button is released over an element | ||
| 1075 | - onwheel, //HTML5 Fires when the mouse wheel rolls up or down over an element | ||
| 1076 | - //Drag Events | ||
| 1077 | - ondrag, //HMTL5 Script to be run when an element is dragged | ||
| 1078 | - ondragend, //HTML5 Script to be run at the end of a drag operation | ||
| 1079 | - ondragenter, //HTML5 Script to be run when an element has been dragged to a valid drop target | ||
| 1080 | - ondragleave, //HTML5 Script to be run when an element leaves a valid drop target | ||
| 1081 | - ondragover, //HTML5 Script to be run when an element is being dragged over a valid drop target | ||
| 1082 | - ondragstart, //HTML5 Script to be run at the start of a drag operation | ||
| 1083 | - ondrop, //HTML5 Script to be run when dragged element is being dropped | ||
| 1084 | - onscroll, //HTML5 Script to be run when an element's scrollbar is being scrolled | ||
| 1085 | - //Clipboard Events | ||
| 1086 | - oncopy, //HTML5 Fires when the user copies the content of an element | ||
| 1087 | - oncut, //HTML5 Fires when the user cuts the content of an element | ||
| 1088 | - onpaste, //HTML5 Fires when the user pastes some content in an element | ||
| 1089 | - //Media Events | ||
| 1090 | - onabort, //HTML5 Script to be run on abort | ||
| 1091 | - oncanplay, //HTML5 Script to be run when a file is ready to start playing (when it has buffered enough to begin) | ||
| 1092 | - oncanplaythrough, //HTML5 Script to be run when a file can be played all the way to the end without pausing for buffering | ||
| 1093 | - oncuechange, //HTML5 Script to be run when the cue changes in a <track> element | ||
| 1094 | - ondurationchange, //HTML5 Script to be run when the length of the media changes | ||
| 1095 | - onemptied, //HTML5 Script to be run when something bad happens and the file is suddenly unavailable (like unexpectedly disconnects) | ||
| 1096 | - onended, //HTML5 Script to be run when the media has reach the end (a useful event for messages like "thanks for listening") | ||
| 1097 | - onerror, //HTML5 Script to be run when an error occurs when the file is being loaded | ||
| 1098 | - onloadeddata, //HTML5 Script to be run when media data is loaded | ||
| 1099 | - onloadedmetadata, //HTML5 Script to be run when meta data (like dimensions and duration) are loaded | ||
| 1100 | - onloadstart, //HTML5 Script to be run just as the file begins to load before anything is actually loaded | ||
| 1101 | - onpause, //HTML5 Script to be run when the media is paused either by the user or programmatically | ||
| 1102 | - onplay, //HTML5 Script to be run when the media is ready to start playing | ||
| 1103 | - onplaying, //HTML5 Script to be run when the media actually has started playing | ||
| 1104 | - onprogress, //HTML5 Script to be run when the browser is in the process of getting the media data | ||
| 1105 | - onratechange, //HTML5 Script to be run each time the playback rate changes (like when a user switches to a slow motion or fast forward mode) | ||
| 1106 | - onseeked, //HTML5 Script to be run when the seeking attribute is set to false indicating that seeking has ended | ||
| 1107 | - onseeking, //HTML5 Script to be run when the seeking attribute is set to true indicating that seeking is active | ||
| 1108 | - onstalled, //HTML5 Script to be run when the browser is unable to fetch the media data for whatever reason | ||
| 1109 | - onsuspend, //HTML5 Script to be run when fetching the media data is stopped before it is completely loaded for whatever reason | ||
| 1110 | - ontimeupdate, //HTML5 Script to be run when the playing position has changed (like when the user fast forwards to a different point in the media) | ||
| 1111 | - onvolumechange, //HTML5 Script to be run each time the volume is changed which (includes setting the volume to "mute") | ||
| 1112 | - onwaiting, //HTML5 Script to be run when the media has paused but is expected to resume (like when the media pauses to buffer more data) | ||
| 1113 | - //Misc Events | ||
| 1114 | - onshow, //HTML5 Fires when a <menu> element is shown as a context menu | ||
| 1115 | - ontoggle. //HTML5 Fires when the user opens or closes the <details> element | ||
| 1116 | - | ||
| 1117 | -public type CoreAttrs: | ||
| 1118 | - empty, | ||
| 1119 | - id (String), //A unique identifier for the element. | ||
| 1120 | - //There must not be multiple elements in a document that have the same id value. | ||
| 1121 | - class (String), //A name of a classification, or list of names of classifications, to which the element belongs | ||
| 1122 | - style (String), //Specifies zero or more CSS declarations that apply to the element [CSS]. | ||
| 1123 | - title (String), //Advisory information associated with the element. | ||
| 1124 | - lang (String), //Specifies the primary language for the contents of the element and for any of the element’s attributes that contain text. | ||
| 1125 | - dir (Reading_Way), //Specifies the element’s text directionality. | ||
| 1126 | - accesskey (Word8), //A key label or list of key labels with which to associate the element; each key label represents | ||
| 1127 | - //a keyboard shortcut which UAs can use to activate the element or give focus to the element. | ||
| 1128 | - tabindex (Int), //Specifies whether the element represents an element that is is focusable (that is, an element which is part of the | ||
| 1129 | - //sequence of focusable elements in the document), and the relative order of the element in the sequence of focusable | ||
| 1130 | - //elements in the document. | ||
| 1131 | - //Anubis specific | ||
| 1132 | - attr (String, String), //intended to provide unknown attritute | ||
| 1133 | - event (HtmlEvents, String), | ||
| 1134 | - tooltip (HTML_tooltip), | ||
| 1135 | - | ||
| 1136 | - //HTML5 | ||
| 1137 | - data (String name, String value), | ||
| 1138 | - contenteditable(Bool), //Specifies whether the contents of the element are editable | ||
| 1139 | - contextmenu(String), //Identifies a menu with which to associate the element as a context menu. | ||
| 1140 | - draggable(Bool), //Specifies whether the element is draggable. | ||
| 1141 | - hidden(Bool), //Specifies that the element represents an element that is not yet, or is no longer, relevant. | ||
| 1142 | - spellcheck(Bool) //Specifies whether the element represents an element whose contents are subject to spell checking and grammar checking. | ||
| 1143 | -. | 893 | + |
| 1144 | 894 | ||
| 1145 | public define CoreAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). | 895 | public define CoreAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). |
| 1146 | 896 | ||
| 1147 | -public type InputAttrs: | ||
| 1148 | - id (String), | ||
| 1149 | - class (String), | ||
| 1150 | - style (String), | ||
| 1151 | - title (String), | ||
| 1152 | - lang (String), | ||
| 1153 | - dir (Reading_Way), | ||
| 1154 | - accesskey (Word8), | ||
| 1155 | - tabindex (Int), | ||
| 1156 | - attr (String, String), | ||
| 1157 | - event (HtmlEvents, String), | ||
| 1158 | - //HTML5 | ||
| 1159 | - data (String name, String value). | ||
| 1160 | 897 | ||
| 1161 | public define InputAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). | 898 | public define InputAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). |
| 1162 | 899 | ||
| 1163 | -public type Text_Option: | ||
| 1164 | - core_attrs(List(CoreAttrs)), | ||
| 1165 | - size(Int), // size of character font to use | ||
| 1166 | - font(String), // name of character font to use (such as "helvetica",...) | ||
| 1167 | - color(RGB), // color to be used for characters | ||
| 1168 | - italic, | ||
| 1169 | - oblique, | ||
| 1170 | - small_capitals, | ||
| 1171 | - bold, | ||
| 1172 | - underlined, | ||
| 1173 | - left_justified, | ||
| 1174 | - right_justified, | ||
| 1175 | - justified, // justified on both sides | ||
| 1176 | - line_through, | ||
| 1177 | - nowrap, | ||
| 1178 | - class(String), //CSS class | ||
| 1179 | - id(String), | ||
| 1180 | - style(String), | ||
| 1181 | - title(String), | ||
| 1182 | - attr(String, String). | 900 | + |
| 1183 | 901 | ||
| 1184 | public define Text_Option | 902 | public define Text_Option |
| 1185 | tooltip(String s) = title(s). | 903 | tooltip(String s) = title(s). |
| @@ -1286,20 +1004,7 @@ public define String | @@ -1286,20 +1004,7 @@ public define String | ||
| 1286 | onshow then "onshow", //HTML5 Fires when a <menu> element is shown as a context menu | 1004 | onshow then "onshow", //HTML5 Fires when a <menu> element is shown as a context menu |
| 1287 | ontoggle then "ontoggle" | 1005 | ontoggle then "ontoggle" |
| 1288 | }. | 1006 | }. |
| 1289 | - | ||
| 1290 | -public type Table_Option: | ||
| 1291 | - core_attrs(List(CoreAttrs)), | ||
| 1292 | - background_color(RGB), // applied to all cells in the table | ||
| 1293 | - background_image(String url), | ||
| 1294 | - border(Int width_of_outer_edge, // if not present, all values are 0 | ||
| 1295 | - Int width_of_top_of_relief, | ||
| 1296 | - Int width_of_inner_edge, | ||
| 1297 | - RGB border_color), | ||
| 1298 | - width(Int), // sets a minimal width for the table | ||
| 1299 | - percentage_width(Int), | ||
| 1300 | - attr(String name, String value), | ||
| 1301 | - class(String class_name). | ||
| 1302 | - | 1007 | + |
| 1303 | 1008 | ||
| 1304 | public define Table_Option nude = border(0,0,0,rgb(0,0,0)). | 1009 | public define Table_Option nude = border(0,0,0,rgb(0,0,0)). |
| 1305 | 1010 | ||
| @@ -1307,44 +1012,17 @@ public define Table_Option nude = border(0,0,0,rgb(0,0,0)). | @@ -1307,44 +1012,17 @@ public define Table_Option nude = border(0,0,0,rgb(0,0,0)). | ||
| 1307 | A list of 'Table_Option' must be given with each table. | 1012 | A list of 'Table_Option' must be given with each table. |
| 1308 | 1013 | ||
| 1309 | 1014 | ||
| 1310 | -public type BackgroundOption: | ||
| 1311 | - repeat, // repeat the background in both directions | ||
| 1312 | - repeat_horizontal, // repeat the background only horizontally | ||
| 1313 | - repeat_vertical, // repeat the background only verticall | ||
| 1314 | - no_repeat, // don't repeat the background | ||
| 1315 | - center. | 1015 | + |
| 1316 | 1016 | ||
| 1317 | 1017 | ||
| 1318 | -public type Cell_Option: | ||
| 1319 | - core_attrs(List(CoreAttrs)), | ||
| 1320 | - left, // put the content of the cell on the left | ||
| 1321 | - h_center, // center the content of the cell horizontally | ||
| 1322 | - right, // put the content of the cell on the right | ||
| 1323 | - top, // put the content of the cell upwards | ||
| 1324 | - v_center, // center the content of tye cell vertically, | ||
| 1325 | - bottom, // put the content of the cell downwards | ||
| 1326 | - base_line, // align the content vertically according to base lines | ||
| 1327 | - background_color(RGB), | ||
| 1328 | - background_image(String url, BackgroundOption), | ||
| 1329 | - width(Int), // sets a minimal width for the cell | ||
| 1330 | - percentage_width(Int), | ||
| 1331 | - height(Int), // sets a minimal height for the cell | ||
| 1332 | - columns(Int), // lets the cell span over several columns | ||
| 1333 | - rows(Int), // lets the cell span over several rows | ||
| 1334 | - nowrap, // do not allow text wrapping within the cell | ||
| 1335 | - style(String), // in case nothing above is suitable | ||
| 1336 | - class(String class_name). | ||
| 1337 | 1018 | ||
| 1338 | A list of 'Cell_Option' must be given with each cell and each row in a table. Options | 1019 | A list of 'Cell_Option' must be given with each cell and each row in a table. Options |
| 1339 | given with a row apply to all the cells in the row, but are superseded by options given | 1020 | given with a row apply to all the cells in the row, but are superseded by options given |
| 1340 | with cells, which apply only to the cell they are given with. | 1021 | with cells, which apply only to the cell they are given with. |
| 1341 | 1022 | ||
| 1342 | 1023 | ||
| 1343 | -public type HTML_Cell($T): | ||
| 1344 | - cell(List(Cell_Option) options, $T content). | ||
| 1345 | 1024 | ||
| 1346 | -public type HTML_Header_Cell($T): | ||
| 1347 | - header_cell(List(Cell_Option) options, $T content). | 1025 | + |
| 1348 | 1026 | ||
| 1349 | The parameter $T is later instantiated either to 'HTML_In_Form' or to 'HTML_Off_Form', | 1027 | The parameter $T is later instantiated either to 'HTML_In_Form' or to 'HTML_Off_Form', |
| 1350 | depending on where you put your table (within a form or not within a form). For your | 1028 | depending on where you put your table (within a form or not within a form). For your |
| @@ -1375,16 +1053,7 @@ public define HTML_Header_Cell($T) | @@ -1375,16 +1053,7 @@ public define HTML_Header_Cell($T) | ||
| 1375 | header_cell([],content). | 1053 | header_cell([],content). |
| 1376 | 1054 | ||
| 1377 | 1055 | ||
| 1378 | -public type HTML_Row($T): | ||
| 1379 | - row(List(Cell_Option) options, List(HTML_Cell($T)) cells). | ||
| 1380 | - | ||
| 1381 | -public type HTML_Header_Row($T): | ||
| 1382 | - empty, | ||
| 1383 | - header_row(List(Cell_Option) options, List(HTML_Header_Cell($T)) cells). | ||
| 1384 | 1056 | ||
| 1385 | -public type HTML_Footer_Row($T): | ||
| 1386 | - empty, | ||
| 1387 | - footer_row(List(Cell_Option) options, List(HTML_Cell($T)) cells). | ||
| 1388 | 1057 | ||
| 1389 | Same remark as for 'HTML_Cell($T)'. We define several convenience functions: | 1058 | Same remark as for 'HTML_Cell($T)'. We define several convenience functions: |
| 1390 | 1059 | ||
| @@ -1432,31 +1101,7 @@ public define HTML_Header_Row($T) | @@ -1432,31 +1101,7 @@ public define HTML_Header_Row($T) | ||
| 1432 | ) = | 1101 | ) = |
| 1433 | header_row([],[cell]). | 1102 | header_row([],[cell]). |
| 1434 | 1103 | ||
| 1435 | -public type Actioner_Connection: | ||
| 1436 | - same, // use same type of connection as current page | ||
| 1437 | - http, // use non secured connection | ||
| 1438 | - https. // use secured connection | ||
| 1439 | - | ||
| 1440 | -public type Other_Window_Option: | ||
| 1441 | - resizable, // the new window may be resized by the client | ||
| 1442 | - scrollbars, // the new window has scrollbars | ||
| 1443 | - width(Int), // the new window has the specified width | ||
| 1444 | - height(Int). // the new window has the specified height | ||
| 1445 | - | ||
| 1446 | -public type Actioner_Target: | ||
| 1447 | - same, | ||
| 1448 | - same (String label), | ||
| 1449 | - other(String window_name, List(Other_Window_Option)). | ||
| 1450 | - | ||
| 1451 | -public type Actioner_Aspect: | ||
| 1452 | - link (List(Text_Option), String text, Maybe(String) name),// hypertext link | ||
| 1453 | - img_link (List(CoreAttrs),String img_url, String alt_text), | ||
| 1454 | - push_button (List(CoreAttrs),String text), | ||
| 1455 | - button (String url_off, String url_on), // rollover button | ||
| 1456 | - button (String url_off, String url_on, Int w, Int h), // idem with size | ||
| 1457 | - submit (List(CoreAttrs),String text), | ||
| 1458 | - immediate_selector (List(CoreAttrs),WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, Maybe(InitialValue) selected, String onchange_fn), | ||
| 1459 | - html (List(CoreAttrs), HTML_Off_Form). | 1104 | + |
| 1460 | 1105 | ||
| 1461 | public define Actioner_Aspect | 1106 | public define Actioner_Aspect |
| 1462 | immediate_selector | 1107 | immediate_selector |
| @@ -1482,10 +1127,6 @@ public define Actioner_Aspect | @@ -1482,10 +1127,6 @@ public define Actioner_Aspect | ||
| 1482 | . | 1127 | . |
| 1483 | 1128 | ||
| 1484 | 1129 | ||
| 1485 | -public type Actioner_Local_Action: | ||
| 1486 | - close_window. | ||
| 1487 | - | ||
| 1488 | - | ||
| 1489 | public define Actioner_Aspect | 1130 | public define Actioner_Aspect |
| 1490 | link | 1131 | link |
| 1491 | ( | 1132 | ( |
| @@ -1527,25 +1168,8 @@ public define Actioner_Aspect | @@ -1527,25 +1168,8 @@ public define Actioner_Aspect | ||
| 1527 | Actioners are explained in details below. | 1168 | Actioners are explained in details below. |
| 1528 | 1169 | ||
| 1529 | 1170 | ||
| 1530 | -public type TextAreaOption: | ||
| 1531 | - input_attrs(List(InputAttrs)), | ||
| 1532 | - disabled, | ||
| 1533 | - read_only, | ||
| 1534 | - wrap_lines. | ||
| 1535 | 1171 | ||
| 1536 | -public type CSS_Style: | ||
| 1537 | - text_options(List(Text_Option)). | ||
| 1538 | 1172 | ||
| 1539 | -public type CSS_File_Media: | ||
| 1540 | - screen, //Intended for non-paged computer screens. | ||
| 1541 | - tty, //Intended for media using a fixed-pitch character grid, such as teletypes, terminals, or portable devices with limited display capabilities. | ||
| 1542 | - tv, //Intended for television-type devices (low resolution, color, limited scrollability). | ||
| 1543 | - projection, //Intended for projectors. | ||
| 1544 | - handheld, //Intended for handheld devices (small screen, monochrome, bitmapped graphics, limited bandwidth). | ||
| 1545 | - print, //Intended for paged, opaque material and for documents viewed on screen in print preview mode. | ||
| 1546 | - braille, //Intended for braille tactile feedback devices. | ||
| 1547 | - aural, //Intended for speech synthesizers. | ||
| 1548 | - all. //Suitable for all devices. | ||
| 1549 | 1173 | ||
| 1550 | public define String | 1174 | public define String |
| 1551 | to_String | 1175 | to_String |
| @@ -1567,8 +1191,7 @@ public define String | @@ -1567,8 +1191,7 @@ public define String | ||
| 1567 | 1191 | ||
| 1568 | 1192 | ||
| 1569 | . | 1193 | . |
| 1570 | -public type CSS_File: | ||
| 1571 | - css_file(String file_name, CSS_File_Media). | 1194 | + |
| 1572 | 1195 | ||
| 1573 | public define CSS_File | 1196 | public define CSS_File |
| 1574 | css_file | 1197 | css_file |
| @@ -1577,16 +1200,7 @@ public define CSS_File | @@ -1577,16 +1200,7 @@ public define CSS_File | ||
| 1577 | )= | 1200 | )= |
| 1578 | css_file(file_name, all). | 1201 | css_file(file_name, all). |
| 1579 | 1202 | ||
| 1580 | -public type JS_Attribute: | ||
| 1581 | - attr (String, String). | ||
| 1582 | - | ||
| 1583 | -public type JS_File: | ||
| 1584 | - js_file(String file_name, | ||
| 1585 | - List(JS_Attribute) attributes). | ||
| 1586 | 1203 | ||
| 1587 | -public type Script: | ||
| 1588 | - script( String script_type, | ||
| 1589 | - String content). | ||
| 1590 | 1204 | ||
| 1591 | public define JS_File | 1205 | public define JS_File |
| 1592 | js_file | 1206 | js_file |
| @@ -1595,19 +1209,10 @@ public define JS_File | @@ -1595,19 +1209,10 @@ public define JS_File | ||
| 1595 | ) = | 1209 | ) = |
| 1596 | js_file(file_name, []). | 1210 | js_file(file_name, []). |
| 1597 | 1211 | ||
| 1598 | -public type HTML_Meta:... | 1212 | +//public type HTML_Meta:... |
| 1599 | 1213 | ||
| 1600 | 1214 | ||
| 1601 | 1215 | ||
| 1602 | -public type HTML_Head_Tag: | ||
| 1603 | - meta(HTML_Meta), | ||
| 1604 | - title(String), | ||
| 1605 | - js(JS_File), | ||
| 1606 | - js_inline(Script), | ||
| 1607 | - css(CSS_File), | ||
| 1608 | - css_inline(String css_styles) /* Note: <style> and </style> tags are not necessaries */ | ||
| 1609 | - . | ||
| 1610 | - | ||
| 1611 | public define HTML_Head_Tag | 1216 | public define HTML_Head_Tag |
| 1612 | js_script | 1217 | js_script |
| 1613 | ( | 1218 | ( |
| @@ -1634,14 +1239,7 @@ public define HTML_tooltip | @@ -1634,14 +1239,7 @@ public define HTML_tooltip | ||
| 1634 | )= | 1239 | )= |
| 1635 | html_tooltip(title, keyword, 0). | 1240 | html_tooltip(title, keyword, 0). |
| 1636 | 1241 | ||
| 1637 | -public type HTML_Help_Position: | ||
| 1638 | - left, | ||
| 1639 | - right. | ||
| 1640 | - | ||
| 1641 | -public type HTML_Help: | ||
| 1642 | - no_help, //no help text available | ||
| 1643 | - tooltip(HTML_tooltip, | ||
| 1644 | - HTML_Help_Position). | 1242 | + |
| 1645 | 1243 | ||
| 1646 | public define HTML_Help | 1244 | public define HTML_Help |
| 1647 | tooltip | 1245 | tooltip |
| @@ -1651,25 +1249,15 @@ public define HTML_Help | @@ -1651,25 +1249,15 @@ public define HTML_Help | ||
| 1651 | tooltip(h_tooltip, left) | 1249 | tooltip(h_tooltip, left) |
| 1652 | . | 1250 | . |
| 1653 | 1251 | ||
| 1654 | -public type HTML_Label: | ||
| 1655 | - no_label, | ||
| 1656 | - label( | ||
| 1657 | - String text, //label to show | ||
| 1658 | - HTML_Help help //HTML help (tooltip with ajax call or not) | ||
| 1659 | - | ||
| 1660 | - ). | 1252 | + |
| 1253 | + | ||
| 1661 | /* It contains | 1254 | /* It contains |
| 1662 | * - a List of HTML_Head_Tag representing necessaries head tags for the content. ex: jquery js files, js script, css specific styles, ... | 1255 | * - a List of HTML_Head_Tag representing necessaries head tags for the content. ex: jquery js files, js script, css specific styles, ... |
| 1663 | * - a HTML_Off_Form representing the HTML code for the part of the page we want to display | 1256 | * - a HTML_Off_Form representing the HTML code for the part of the page we want to display |
| 1664 | */ | 1257 | */ |
| 1665 | -public type HTML_In_Form:... | 1258 | +//public type HTML_In_Form:... |
| 1259 | + | ||
| 1666 | 1260 | ||
| 1667 | -public type HTML_Partial_Content: | ||
| 1668 | - partial_content | ||
| 1669 | - ( | ||
| 1670 | - List(HTML_Head_Tag), | ||
| 1671 | - HTML_Off_Form | ||
| 1672 | - ). | ||
| 1673 | 1261 | ||
| 1674 | public define List(HTML_Head_Tag) | 1262 | public define List(HTML_Head_Tag) |
| 1675 | to_HTML_Head_Tag | 1263 | to_HTML_Head_Tag |
| @@ -1685,60 +1273,6 @@ public define List(HTML_Head_Tag) | @@ -1685,60 +1273,6 @@ public define List(HTML_Head_Tag) | ||
| 1685 | )= | 1273 | )= |
| 1686 | map((JS_File js_f) |-> js(js_f), js_file_list). | 1274 | map((JS_File js_f) |-> js(js_f), js_file_list). |
| 1687 | 1275 | ||
| 1688 | -public type HTML_In_Form: | ||
| 1689 | - empty, | ||
| 1690 | - literal_pt (Printable_tree), | ||
| 1691 | - literal (String), | ||
| 1692 | - sequence (List(HTML_In_Form) items), | ||
| 1693 | - text (List(CoreAttrs), String the_text), | ||
| 1694 | - preformated (List(Text_Option), String), | ||
| 1695 | - paragraph (List(Text_Option), List(HTML_In_Form) content), | ||
| 1696 | - image (List(CoreAttrs), String url, String alternate), | ||
| 1697 | - image (List(CoreAttrs), String url, String alternate, Int width, Int height), | ||
| 1698 | - table (List(Table_Option), HTML_Header_Row(HTML_In_Form), List(HTML_Row(HTML_In_Form)), HTML_Footer_Row(HTML_In_Form)), | ||
| 1699 | - center (HTML_In_Form), | ||
| 1700 | - mail_to (String email, HTML_In_Form element), | ||
| 1701 | - scroller (Int width, Int height, | ||
| 1702 | - Int content_width, Int content_height, | ||
| 1703 | - HTML_In_Form content), | ||
| 1704 | - actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, | ||
| 1705 | - WEB_Action_Name action_name, List((String,String)) extra_ops, | ||
| 1706 | - List(Actioner_Local_Action)), | ||
| 1707 | - foreign_link_new (Actioner_Target, Actioner_Aspect, String url), | ||
| 1708 | - foreign_link (List(Text_Option), String url), | ||
| 1709 | - foreign_link (List(Text_Option), String url, String name), | ||
| 1710 | - private_download (String abs_path, String name, String extra_ext, | ||
| 1711 | - Maybe((String,List((String,String)))) action), | ||
| 1712 | - text_input (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), | ||
| 1713 | - text_input_ro (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), | ||
| 1714 | - password_input (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), | ||
| 1715 | - text_area (List(TextAreaOption), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width, Int height), | ||
| 1716 | - file_upload (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int width), | ||
| 1717 | - selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices), | ||
| 1718 | - selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices, InitialValue selected), | ||
| 1719 | - // List((String,String)) = List((code,name)) where : | ||
| 1720 | - // code is the web-arg value | ||
| 1721 | - // name appears in selector | ||
| 1722 | - selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices), | ||
| 1723 | - selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, InitialValue selected), | ||
| 1724 | - radio_button (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, WebArgValue value, Bool checked), | ||
| 1725 | - radio_button_r (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, WebArgValue value, Bool checked), | ||
| 1726 | - check_box (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Bool checked), | ||
| 1727 | - check_box_r (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Bool checked), | ||
| 1728 | - div (List(CoreAttrs), List(HTML_In_Form) content), | ||
| 1729 | - div_empty (List(CoreAttrs)), | ||
| 1730 | - hidden (HTML_Id id, WebArgName name, WebArgValue value), | ||
| 1731 | - partial (HTML_Partial_Content), | ||
| 1732 | - br, | ||
| 1733 | - progress (List(CoreAttrs), Int value, Int max), | ||
| 1734 | - ol (List(CoreAttrs), List(HTML_In_Form) content), | ||
| 1735 | - ul (List(CoreAttrs), List(HTML_In_Form) content), | ||
| 1736 | - li (List(CoreAttrs), List(HTML_In_Form) content), | ||
| 1737 | - button (List(CoreAttrs), List(HTML_In_Form) content), | ||
| 1738 | - i (List(CoreAttrs), String text), | ||
| 1739 | - span (List(CoreAttrs), String text), | ||
| 1740 | - hr (List(CoreAttrs)) | ||
| 1741 | -. | ||
| 1742 | 1276 | ||
| 1743 | 1277 | ||
| 1744 | 'HTML_In_Form' defines all the elements you may put within a form. We define a | 1278 | 'HTML_In_Form' defines all the elements you may put within a form. We define a |
| @@ -1999,66 +1533,10 @@ url, | @@ -1999,66 +1533,10 @@ url, | ||
| 1999 | week | 1533 | week |
| 2000 | . | 1534 | . |
| 2001 | 1535 | ||
| 2002 | -public type A_href: | ||
| 2003 | - href(String href), | ||
| 2004 | - href(WEB_Action_Name action, List((String,String)) extra_ops) | ||
| 2005 | -. | ||
| 2006 | 1536 | ||
| 2007 | -public type A_target: | ||
| 2008 | - _blank, | ||
| 2009 | - _self, | ||
| 2010 | - _parent, | ||
| 2011 | - _top, | ||
| 2012 | - framename(String name) | ||
| 2013 | -. | 1537 | +//public type HTML_Body:... |
| 1538 | + | ||
| 2014 | 1539 | ||
| 2015 | -public type HTML_Body:... | ||
| 2016 | - | ||
| 2017 | -public type HTML_Off_Form: | ||
| 2018 | - a (List(CoreAttrs), A_href, A_target, List(HTML_Off_Form) content), | ||
| 2019 | - empty, | ||
| 2020 | - literal_pt (Printable_tree), | ||
| 2021 | - literal (String), | ||
| 2022 | - sequence (List(HTML_Off_Form) items), | ||
| 2023 | - text (List(CoreAttrs), String the_text), | ||
| 2024 | - preformated (List(Text_Option), String), | ||
| 2025 | - table (List(Table_Option), HTML_Header_Row(HTML_Off_Form), List(HTML_Row(HTML_Off_Form)), HTML_Footer_Row(HTML_Off_Form)), | ||
| 2026 | - center (HTML_Off_Form), | ||
| 2027 | - mail_to (String email, HTML_Off_Form element), | ||
| 2028 | - scroller (Int width, Int height, | ||
| 2029 | - Int content_width, Int content_height, | ||
| 2030 | - HTML_Off_Form content), | ||
| 2031 | - fixed_size (HTML_Size width, HTML_Size height, HTML_Off_Form content), | ||
| 2032 | - fixed_size_2 (HTML_Size width, HTML_Size height, String name_of_HTML_file), | ||
| 2033 | - actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, | ||
| 2034 | - WEB_Action_Name action_name, List((String,String)) extra_ops, | ||
| 2035 | - List(Actioner_Local_Action)), | ||
| 2036 | - actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, | ||
| 2037 | - WEB_Action_Name action_name, List((String,String)) extra_ops, | ||
| 2038 | - List(Actioner_Local_Action), String form_name), | ||
| 2039 | - foreign_link_new (Actioner_Target, Actioner_Aspect, String url), | ||
| 2040 | - foreign_link (List(Text_Option), String url), | ||
| 2041 | - foreign_link (List(Text_Option), String url, String name), | ||
| 2042 | - private_download (String abs_path, String name, String extra_ext, | ||
| 2043 | - Maybe((String,List((String,String)))) action), | ||
| 2044 | - label (String name), | ||
| 2045 | - form (HTML_Id form_id, List(CoreAttrs), List(HTML_In_Form) content), | ||
| 2046 | - form (HTML_Id form_id, List(CoreAttrs), | ||
| 2047 | - WEB_Action_Name action, List((String,String)) extra_ops, | ||
| 2048 | - List(HTML_In_Form) content), | ||
| 2049 | - in_form (HTML_Id form_id, HTML_In_Form content), | ||
| 2050 | - div (List(CoreAttrs), List(HTML_Partial_Content) p_content), | ||
| 2051 | - iframe (List(CoreAttrs), | ||
| 2052 | - List(CSS_Style) /*styles*/, | ||
| 2053 | - List(CSS_File) /*css_files*/, | ||
| 2054 | - List(JS_File) /*js_files*/, | ||
| 2055 | - HTML_Body /*body*/), | ||
| 2056 | - partial (HTML_Partial_Content), | ||
| 2057 | - progress (List(CoreAttrs), Int value, Int max), | ||
| 2058 | - i (List(CoreAttrs), String text), | ||
| 2059 | - html_tag (String tag_name, List(CoreAttrs), List(HTML_Off_Form) content), | ||
| 2060 | - html_void_tag (String tag_name, List(CoreAttrs)) | ||
| 2061 | -. | ||
| 2062 | 1540 | ||
| 2063 | 'HTML_Off_Form' defines all the elements you may put outside any form. | 1541 | 'HTML_Off_Form' defines all the elements you may put outside any form. |
| 2064 | 1542 | ||
| @@ -2688,17 +2166,7 @@ define Printable_tree | @@ -2688,17 +2166,7 @@ define Printable_tree | ||
| 2688 | 2166 | ||
| 2689 | 2167 | ||
| 2690 | 2168 | ||
| 2691 | -public type HTML_Meta: | ||
| 2692 | - keywords (List(String)), | ||
| 2693 | - refresh (Actioner_Connection connection, | ||
| 2694 | - Actioner_Target target, | ||
| 2695 | - WEB_Action_Name action, | ||
| 2696 | - Int delay), // in seconds | ||
| 2697 | - refresh (String url, Int delay), // in seconds | ||
| 2698 | - meta (String name, String content), | ||
| 2699 | - http_equiv (String name, String content), | ||
| 2700 | - generic_meta (List((String,String))), | ||
| 2701 | - literal (String). | 2169 | + |
| 2702 | 2170 | ||
| 2703 | Meta tags are put in the 'head' of the HTML page. | 2171 | Meta tags are put in the 'head' of the HTML page. |
| 2704 | 2172 | ||
| @@ -2715,49 +2183,9 @@ public define HTML_Meta | @@ -2715,49 +2183,9 @@ public define HTML_Meta | ||
| 2715 | 2183 | ||
| 2716 | 2184 | ||
| 2717 | 2185 | ||
| 2718 | -public type Body_Option: | ||
| 2719 | - core_attrs(List(CoreAttrs)), | ||
| 2720 | - background_color (RGB), | ||
| 2721 | - background_image (String url), | ||
| 2722 | - background_image (String url, List(BackgroundOption)). | ||
| 2723 | - | ||
| 2724 | -public type HTML_Body: | ||
| 2725 | - body(List(Body_Option) options, HTML_Off_Form content). | ||
| 2726 | - | ||
| 2727 | - | ||
| 2728 | -public type HTTP_Answer: | ||
| 2729 | - html_page (HTTP_Status /*http_status*/, | ||
| 2730 | - List(HTML_Head_Tag) /*html <head> tags*/, | ||
| 2731 | - HTML_Body /*body*/), | ||
| 2732 | - html_page (HTTP_Status /*http_status*/, | ||
| 2733 | - String /*title*/, | ||
| 2734 | - List(HTML_Meta) /*meta_tags*/, | ||
| 2735 | - List(CSS_Style) /*styles*/, | ||
| 2736 | - List(CSS_File) /*css_files*/, | ||
| 2737 | - List(JS_File) /*js_files*/, | ||
| 2738 | - List(Script) /*script*/, | ||
| 2739 | - HTML_Body /*body*/), | ||
| 2740 | - plain_text (HTTP_Status /*http_status*/, | ||
| 2741 | - String /*text*/), | ||
| 2742 | - custom_text (HTTP_Status /*http_status*/, | ||
| 2743 | - MIME /*mime_type*/, | ||
| 2744 | - String /*content*/), | ||
| 2745 | - custom_binary(HTTP_Status /*http_status*/, | ||
| 2746 | - MIME /*mime_type*/, | ||
| 2747 | - ByteArray /*content*/, | ||
| 2748 | - List(HTTP_header)/*other headers*/), | ||
| 2749 | - custom_tree (HTTP_Status /*http_status*/, | ||
| 2750 | - MIME /*mime_type*/, | ||
| 2751 | - Printable_tree /*content*/), | ||
| 2752 | - json (HTTP_Status, /*http_status*/ | ||
| 2753 | - JsonValue), /*json value*/ | ||
| 2754 | - send_file ( String file_path, //file to send to client. //TODO add call back for before, during, after send | ||
| 2755 | - Content_Disposition c_disposition), | ||
| 2756 | - http_raw (Printable_tree), | ||
| 2757 | - html_content (HTTP_Status /*http_status*/, | ||
| 2758 | - HTML_Off_Form), | ||
| 2759 | - html_partial_content (HTTP_Status /*http_status*/, | ||
| 2760 | - HTML_Partial_Content). | 2186 | + |
| 2187 | + | ||
| 2188 | + | ||
| 2761 | 2189 | ||
| 2762 | 2190 | ||
| 2763 | public define HTTP_Answer | 2191 | public define HTTP_Answer |
| @@ -3737,13 +3165,22 @@ define HTTP_Answer | @@ -3737,13 +3165,22 @@ define HTTP_Answer | ||
| 3737 | ) | 3165 | ) |
| 3738 | . | 3166 | . |
| 3739 | 3167 | ||
| 3168 | +public type WEB_Page_Renderer: | ||
| 3169 | + web_page_renderer( | ||
| 3170 | + String app, //application | ||
| 3171 | + String name, //renderer name | ||
| 3172 | + (WEB_Session _session, List(WEB_Plugin), HTML_Partial_Content _content) -> HTTP_Answer page_layout //call back for rendering page | ||
| 3173 | + ) | ||
| 3174 | +. | ||
| 3175 | + | ||
| 3740 | define WEB_Page_Renderer | 3176 | define WEB_Page_Renderer |
| 3741 | default_page_renderer = | 3177 | default_page_renderer = |
| 3742 | - web_page_renderer("AWS_DEFAULT_PAGE", | 3178 | + web_page_renderer("AWS", "AWS_DEFAULT_PAGE", |
| 3743 | ( WEB_Session _session, | 3179 | ( WEB_Session _session, |
| 3744 | - String _title, | 3180 | + List(WEB_Plugin) _plugins, |
| 3745 | HTML_Partial_Content _content | 3181 | HTML_Partial_Content _content |
| 3746 | ) |-> | 3182 | ) |-> |
| 3183 | + with _title = get_page_title(_session), | ||
| 3747 | html_page | 3184 | html_page |
| 3748 | ( | 3185 | ( |
| 3749 | http_ok, | 3186 | http_ok, |
| @@ -3856,9 +3293,10 @@ define WEB_Page_Renderer | @@ -3856,9 +3293,10 @@ define WEB_Page_Renderer | ||
| 3856 | default_page_renderer, | 3293 | default_page_renderer, |
| 3857 | [h . t] then | 3294 | [h . t] then |
| 3858 | if h.name = renderer_name then | 3295 | if h.name = renderer_name then |
| 3859 | - //println("Controller ["+controller_name+"] found"); | 3296 | + println("renderer_name ["+renderer_name+"] found"); |
| 3860 | h | 3297 | h |
| 3861 | else | 3298 | else |
| 3299 | + println("renderer_name "+renderer_name+" not matching"); | ||
| 3862 | get_page_renderer(renderer_name, t, logger) | 3300 | get_page_renderer(renderer_name, t, logger) |
| 3863 | } | 3301 | } |
| 3864 | . | 3302 | . |
| @@ -3872,7 +3310,7 @@ define WEB_Page_Renderer | @@ -3872,7 +3310,7 @@ define WEB_Page_Renderer | ||
| 3872 | (LogLevel, String) -> One logger //logger | 3310 | (LogLevel, String) -> One logger //logger |
| 3873 | )= | 3311 | )= |
| 3874 | //get the renderer page name to use from the session "AWS_PAGE_RENDERER" | 3312 | //get the renderer page name to use from the session "AWS_PAGE_RENDERER" |
| 3875 | - if get_String(_session.fields, "AWS_PAGE_RENDERER") is | 3313 | + if get_String(_session.fields, "AWS_CURRENT_PAGE_RENDERER") is |
| 3876 | { | 3314 | { |
| 3877 | failure then logger(logWarning, "No renderer defined, use the default"); default_page_renderer, | 3315 | failure then logger(logWarning, "No renderer defined, use the default"); default_page_renderer, |
| 3878 | success(renderer_name) then | 3316 | success(renderer_name) then |
| @@ -3892,6 +3330,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3892,6 +3330,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3892 | apply_controller_action | 3330 | apply_controller_action |
| 3893 | ( | 3331 | ( |
| 3894 | WEB_Controller controller, | 3332 | WEB_Controller controller, |
| 3333 | + List(WEB_Plugin) plugins, | ||
| 3895 | List(WEB_Controller) controllers, | 3334 | List(WEB_Controller) controllers, |
| 3896 | WEB_Page_Renderer _current_page_renderer, | 3335 | WEB_Page_Renderer _current_page_renderer, |
| 3897 | List(WEB_Page_Renderer) page_renderers, | 3336 | List(WEB_Page_Renderer) page_renderers, |
| @@ -3919,7 +3358,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3919,7 +3358,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3919 | if get_controller(get_String(*new_session.web_request.lwa, "aws_controller", "root"), controllers, logger) is | 3358 | if get_controller(get_String(*new_session.web_request.lwa, "aws_controller", "root"), controllers, logger) is |
| 3920 | { | 3359 | { |
| 3921 | failure then (failure, error_page(http_not_found, "Initial Session Controller not found", new_session)), | 3360 | failure then (failure, error_page(http_not_found, "Initial Session Controller not found", new_session)), |
| 3922 | - success(new_controller) then apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, new_session, failure, initial_session, logger), | 3361 | + success(new_controller) then apply_controller_action(new_controller, plugins, controllers, _current_page_renderer, page_renderers, cinfo, new_session, failure, initial_session, logger), |
| 3923 | }, | 3362 | }, |
| 3924 | success(action_name) then | 3363 | success(action_name) then |
| 3925 | logger(logInfo, "ACTION_NAME ["+action_name+"]"); | 3364 | logger(logInfo, "ACTION_NAME ["+action_name+"]"); |
| @@ -3931,7 +3370,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3931,7 +3370,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3931 | if get_controller(get_String(*new_session.web_request.lwa, "aws_controller", "root"), controllers, logger) is | 3370 | if get_controller(get_String(*new_session.web_request.lwa, "aws_controller", "root"), controllers, logger) is |
| 3932 | { | 3371 | { |
| 3933 | failure then (failure, error_page(http_not_found, "Redirect Controller not found", new_session)), | 3372 | failure then (failure, error_page(http_not_found, "Redirect Controller not found", new_session)), |
| 3934 | - success(new_controller) then apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, new_session, failure, initial_session, logger), | 3373 | + success(new_controller) then apply_controller_action(new_controller, plugins, controllers, _current_page_renderer, page_renderers, cinfo, new_session, failure, initial_session, logger), |
| 3935 | }, | 3374 | }, |
| 3936 | 3375 | ||
| 3937 | redirect(new_session, r_controller_name, r_action_name) then | 3376 | redirect(new_session, r_controller_name, r_action_name) then |
| @@ -3939,7 +3378,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3939,7 +3378,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3939 | { | 3378 | { |
| 3940 | failure then (failure, error_page(http_not_found, "Redirect Controller "+r_controller_name+" not found", new_session)), | 3379 | failure then (failure, error_page(http_not_found, "Redirect Controller "+r_controller_name+" not found", new_session)), |
| 3941 | success(new_controller) then | 3380 | success(new_controller) then |
| 3942 | - apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, new_session, success(r_action_name), initial_session, logger), | 3381 | + apply_controller_action(new_controller, plugins, controllers, _current_page_renderer, page_renderers, cinfo, new_session, success(r_action_name), initial_session, logger), |
| 3943 | }, | 3382 | }, |
| 3944 | 3383 | ||
| 3945 | redirect_to_previous then | 3384 | redirect_to_previous then |
| @@ -3948,7 +3387,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3948,7 +3387,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3948 | failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), | 3387 | failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), |
| 3949 | success(new_controller) then | 3388 | success(new_controller) then |
| 3950 | since _session is web_session(id, lang, entries, _, previous), | 3389 | since _session is web_session(id, lang, entries, _, previous), |
| 3951 | - apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, web_session(id, lang, entries, previous, previous), failure, initial_session, logger), | 3390 | + apply_controller_action(new_controller, plugins, controllers, _current_page_renderer, page_renderers, cinfo, web_session(id, lang, entries, previous, previous), failure, initial_session, logger), |
| 3952 | }, | 3391 | }, |
| 3953 | redirect_to_previous(entries) then | 3392 | redirect_to_previous(entries) then |
| 3954 | if get_controller(get_String(*_session.previous_web_request.lwa, "aws_controller", "root"), controllers, logger) is | 3393 | if get_controller(get_String(*_session.previous_web_request.lwa, "aws_controller", "root"), controllers, logger) is |
| @@ -3956,7 +3395,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3956,7 +3395,7 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3956 | failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), | 3395 | failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), |
| 3957 | success(new_controller) then | 3396 | success(new_controller) then |
| 3958 | since _session is web_session(id, lang, _, _, previous), | 3397 | since _session is web_session(id, lang, _, _, previous), |
| 3959 | - apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, web_session(id, lang, entries, previous, previous), failure, initial_session, logger), | 3398 | + apply_controller_action(new_controller, plugins, controllers, _current_page_renderer, page_renderers, cinfo, web_session(id, lang, entries, previous, previous), failure, initial_session, logger), |
| 3960 | }, | 3399 | }, |
| 3961 | //ajax(answer) then (failure, answer), | 3400 | //ajax(answer) then (failure, answer), |
| 3962 | //ajax with modified session that must be saved | 3401 | //ajax with modified session that must be saved |
| @@ -3967,10 +3406,10 @@ define (Maybe(WEB_Session), HTTP_Answer) | @@ -3967,10 +3406,10 @@ define (Maybe(WEB_Session), HTTP_Answer) | ||
| 3967 | //ajax(content, additional_script) then (failure, json(http_ok, to_html_ajax_content(content, additional_script))), | 3406 | //ajax(content, additional_script) then (failure, json(http_ok, to_html_ajax_content(content, additional_script))), |
| 3968 | ajax(session, content, additional_script) then (session, json(http_ok, to_html_ajax_content(content, additional_script))), | 3407 | ajax(session, content, additional_script) then (session, json(http_ok, to_html_ajax_content(content, additional_script))), |
| 3969 | send_file(file_path, c_disposition) then (failure, send_file(file_path, c_disposition)), | 3408 | send_file(file_path, c_disposition) then (failure, send_file(file_path, c_disposition)), |
| 3970 | - renderer_content(session, title, content) then | 3409 | + renderer_content(session, content) then |
| 3971 | with the_session = if session is {failure then _session, success(__session) then __session}, | 3410 | with the_session = if session is {failure then _session, success(__session) then __session}, |
| 3972 | with page_renderer = get_page_renderer(the_session, _current_page_renderer, page_renderers, logger), | 3411 | with page_renderer = get_page_renderer(the_session, _current_page_renderer, page_renderers, logger), |
| 3973 | - (session, page_renderer.page_layout(the_session, title, content)) | 3412 | + (session, page_renderer.page_layout(the_session, plugins, content)) |
| 3974 | } | 3413 | } |
| 3975 | } | 3414 | } |
| 3976 | . | 3415 | . |
| @@ -3993,7 +3432,8 @@ public define Web_Site | @@ -3993,7 +3432,8 @@ public define Web_Site | ||
| 3993 | Var(List(Web_arg)), | 3432 | Var(List(Web_arg)), |
| 3994 | Bool is_https) -> WEB_Session expired_session, | 3433 | Bool is_https) -> WEB_Session expired_session, |
| 3995 | Var(List(WEB_Controller)) web_controllers, | 3434 | Var(List(WEB_Controller)) web_controllers, |
| 3996 | - Var(List(WEB_Page_Renderer)) web_page_renderers, | 3435 | + Var(List(WEB_Page_Renderer)) web_page_renderers, |
| 3436 | + Var(List(WEB_Plugin)) web_plugins, | ||
| 3997 | Maybe(WEB_Session) -> List(HTTP_header) additional_headers, | 3437 | Maybe(WEB_Session) -> List(HTTP_header) additional_headers, |
| 3998 | List(HTTP_header) constant_additional_headers, | 3438 | List(HTTP_header) constant_additional_headers, |
| 3999 | Int timeout, | 3439 | Int timeout, |
| @@ -4024,6 +3464,7 @@ public define Web_Site | @@ -4024,6 +3464,7 @@ public define Web_Site | ||
| 4024 | // TODO 'make_separate_web_args_function' must retrieve state_cookies before parsing web_args if using_state_cookies is true | 3464 | // TODO 'make_separate_web_args_function' must retrieve state_cookies before parsing web_args if using_state_cookies is true |
| 4025 | with save_session = make_save_session_function(timeout, state_directory, logger), | 3465 | with save_session = make_save_session_function(timeout, state_directory, logger), |
| 4026 | with current_page_renderer = var((WEB_Page_Renderer)default_page_renderer), | 3466 | with current_page_renderer = var((WEB_Page_Renderer)default_page_renderer), |
| 3467 | + // with left_menu_list = get_left_menu_from_plugins(*web_plugins), | ||
| 4027 | // retrieve_session = make_retrieve_session_function(state_directory, website_name), | 3468 | // retrieve_session = make_retrieve_session_function(state_directory, website_name), |
| 4028 | //separate_web_args = make_separate_web_args_function(state_directory, retrieve_state), | 3469 | //separate_web_args = make_separate_web_args_function(state_directory, retrieve_state), |
| 4029 | //apply_action = make_apply_action_function(actions), | 3470 | //apply_action = make_apply_action_function(actions), |
| @@ -4069,7 +3510,7 @@ public define Web_Site | @@ -4069,7 +3510,7 @@ public define Web_Site | ||
| 4069 | (failure, error_page(http_not_found, "Controller not found", current_session)), | 3510 | (failure, error_page(http_not_found, "Controller not found", current_session)), |
| 4070 | 3511 | ||
| 4071 | success(new_controller) then | 3512 | success(new_controller) then |
| 4072 | - apply_controller_action(new_controller, *web_controllers, *current_page_renderer, *web_page_renderers, cinfo, current_session, failure, initial_session, logger), | 3513 | + apply_controller_action(new_controller, *web_plugins, *web_controllers, *current_page_renderer, *web_page_renderers, cinfo, current_session, failure, initial_session, logger), |
| 4073 | } | 3514 | } |
| 4074 | is (mb_new_session, http_answer), | 3515 | is (mb_new_session, http_answer), |
| 4075 | 3516 |
web/CXM_web_session.anubis
| @@ -12,6 +12,16 @@ read calexium_lib/database/db_types.anubis | @@ -12,6 +12,16 @@ read calexium_lib/database/db_types.anubis | ||
| 12 | read CXM_common.anubis | 12 | read CXM_common.anubis |
| 13 | read CXM_web_dump.anubis | 13 | read CXM_web_dump.anubis |
| 14 | 14 | ||
| 15 | + reserved fields keywords | ||
| 16 | + | ||
| 17 | + "AWS" String | ||
| 18 | + "AWS_CURRENT_PAGE_TITLE" String current web page title | ||
| 19 | + "AWS_CURRENT_APP" String current web application | ||
| 20 | + "AWS_CURRENT_SPACE" String current web space in application | ||
| 21 | + "AWS_PAGE_RENDERER" String current | ||
| 22 | + | ||
| 23 | + //"AWS_CURRENT_LEFT_MENU" Left_Menu current left menu on the page | ||
| 24 | + //"AWS_CURRENT_MENU" Menu current menu, on the top of the page | ||
| 15 | 25 | ||
| 16 | public type WEB_Session_Field_Datum: | 26 | public type WEB_Session_Field_Datum: |
| 17 | string(String), //fully implented | 27 | string(String), //fully implented |
| @@ -1075,6 +1085,32 @@ public define One | @@ -1075,6 +1085,32 @@ public define One | ||
| 1075 | remove_any(fields, word4_t, _field_name) | 1085 | remove_any(fields, word4_t, _field_name) |
| 1076 | . | 1086 | . |
| 1077 | 1087 | ||
| 1088 | + | ||
| 1089 | + /************************************************/ | ||
| 1090 | + "AWS_CURRENT_PAGE_TITLE" String current web page title | ||
| 1091 | + "AWS_CURRENT_APP" String current web application | ||
| 1092 | + "AWS_CURRENT_SPACE" String current web space in application | ||
| 1093 | + "AWS_CURRENT_CONTENT" String current in the web space | ||
| 1094 | + "AWS_CURRENT_PAGE_RENDERER" String current page renderer | ||
| 1095 | + | ||
| 1096 | +public define One set_web_app(WEB_Session s, String n) = replace_String(s.fields, "AWS_CURRENT_APP", n). | ||
| 1097 | +public define String get_web_app(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_APP", ""). | ||
| 1098 | + | ||
| 1099 | +public define One set_web_space(WEB_Session s, String n)= replace_String(s.fields, "AWS_CURRENT_SPACE", n). | ||
| 1100 | +public define String get_web_space(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_SPACE", ""). | ||
| 1101 | + | ||
| 1102 | +public define One set_web_content(WEB_Session s, String n)= replace_String(s.fields, "AWS_CURRENT_CONTENT", n). | ||
| 1103 | +public define String get_web_content(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_CONTENT", ""). | ||
| 1104 | + | ||
| 1105 | +public define One set_page_title(WEB_Session s, String n)= replace_String(s.fields, "AWS_CURRENT_PAGE_TITLE", n). | ||
| 1106 | +public define String get_page_title(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_PAGE_TITLE", ""). | ||
| 1107 | + | ||
| 1108 | +public define One set_renderer(WEB_Session s, String n) = replace_String(s.fields, "AWS_CURRENT_PAGE_RENDERER", n). | ||
| 1109 | +public define String get_renderer(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_PAGE_RENDERER", ""). | ||
| 1110 | + | ||
| 1111 | + | ||
| 1112 | + /************************************************/ | ||
| 1113 | + | ||
| 1078 | public define String | 1114 | public define String |
| 1079 | dump_WEB_Session_Field | 1115 | dump_WEB_Session_Field |
| 1080 | ( | 1116 | ( |
web/load_content.anubis
| @@ -7,7 +7,8 @@ | @@ -7,7 +7,8 @@ | ||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | read system/convert.anubis | 9 | read system/convert.anubis |
| 10 | -read calexium_lib/web/CXM_making_a_web_site.anubis | 10 | + read calexium_lib/web/CXM_making_a_web_site.anubis |
| 11 | +read calexium_lib/web/CXM_web_action.anubis | ||
| 11 | 12 | ||
| 12 | public define String | 13 | public define String |
| 13 | load_content | 14 | load_content |
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: フランスのトトロ aka (David RENÉ) | ||
| 4 | + * Date: 30/07/2017 | ||
| 5 | + * Time: 01:33 | ||
| 6 | + * © David RENÉ | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +read system/logger.anubis | ||
| 10 | +read app/app_constants.anubis | ||
| 11 | +read calexium_lib/web/widgets/left_menu.anubis | ||
| 12 | +transmit calexium_lib/web/types/making_a_web_site.anubis | ||
| 13 | + read calexium_lib/web/widgets/menu.anubis | ||
| 14 | +read hayamiki_lib/model/database.anubis | ||
| 15 | +read hayamiki_lib/view/view_table_manager_types.anubis | ||
| 16 | + | ||
| 17 | +public type WEB_Plugin: | ||
| 18 | + web_plugin( | ||
| 19 | + String app_name, //application name | ||
| 20 | + String space_name, //space name | ||
| 21 | + //version | ||
| 22 | + (SQLite3DataBase db, HK_Database hk_db, VTM _vtm, (LogLevel, String) -> One logger) -> WEB_Controller get_controller, | ||
| 23 | + (WEB_Session, String type) -> Maybe(HTML_Partial_Content) get_typed_content | ||
| 24 | +// (One dummy) -> Plugin_Left_Menu get_plugin_left_menu | ||
| 25 | +// (One dummy) -> | ||
| 26 | +// (One dummy) -> Message get_API, | ||
| 27 | +// (Message message) -> Message call_API | ||
| 28 | +// (One dummy) -> Menu get_menu, | ||
| 29 | + | ||
| 30 | + ) | ||
| 31 | +. | ||
| 32 | + | ||
| 33 | + | ||
| 34 | +public define Maybe(WEB_Plugin) | ||
| 35 | + load_plugin | ||
| 36 | + ( | ||
| 37 | + String file_name | ||
| 38 | + ) | ||
| 39 | + = | ||
| 40 | + if (LoadAdm(WEB_Plugin))load_adm(file_name) is | ||
| 41 | + { | ||
| 42 | + file_not_found then print("File '"+file_name+"' not found.\n\n");failure, | ||
| 43 | + read_error then print("Error reading file '"+file_name+"'.\n\n");failure, | ||
| 44 | + timeout then print("Timeout when loading '"+file_name+"'.\n\n");failure, | ||
| 45 | + file_damaged then print("File '"+file_name+"' is damaged.\n\n");failure, | ||
| 46 | + bad_version(expected,found) then print("Secondary module '"+file_name+"' doesn't have the same\n"+ | ||
| 47 | + " version ("+found+") as primary module ("+expected+").\n\n");failure, | ||
| 48 | + wrong_type(expected,found) then print("Secondary module '"+file_name+"' has type:\n"+ | ||
| 49 | + found+" while primary module expected:\n"+ | ||
| 50 | + expected+"\n\n");failure, | ||
| 51 | + ok(ptah_plugin) then println("ptah plugin: APP ["+ptah_plugin.app_name+"] SPACE ["+ptah_plugin.space_name+"] loaded ");success(ptah_plugin) | ||
| 52 | + }. | ||
| 53 | + | ||
| 54 | +public define List(WEB_Plugin) | ||
| 55 | + all_plugins | ||
| 56 | + ( | ||
| 57 | + String directory, //directory where search the plugin file below | ||
| 58 | + String plugin_file_mask //mask for loading plugin like "my_app_plugin_*.adm" | ||
| 59 | + ) | ||
| 60 | + = | ||
| 61 | + with files = directory_list(modules_directory, plugin_file_mask), | ||
| 62 | + map_select((String file_name) |-> load_plugin(modules_directory+file_name), files) | ||
| 63 | + //merge_sort(all_list, migration_less) | ||
| 64 | +. | ||
| 65 | + | ||
| 66 | +public define Maybe(WEB_Plugin) | ||
| 67 | + get_WEB_Plugin | ||
| 68 | + ( | ||
| 69 | + List(WEB_Plugin) plugins, | ||
| 70 | + String _app, | ||
| 71 | + String _space | ||
| 72 | + )= | ||
| 73 | + if plugins is | ||
| 74 | + { | ||
| 75 | + [] then failure, | ||
| 76 | + [h . t] then | ||
| 77 | + if h.app_name = _app & h.space_name = _space then | ||
| 78 | + success(h) | ||
| 79 | + else | ||
| 80 | + get_WEB_Plugin(t, _app, _space) | ||
| 81 | + } | ||
| 82 | +. | ||
| 83 | + | ||
| 84 | + | ||
| 85 | + | ||
| 86 | + | ||
| 87 | + public define World_Left_Menu | ||
| 88 | + get_left_menu_from_plugins | ||
| 89 | + ( | ||
| 90 | + List(WEB_Plugin) plugins, | ||
| 91 | + World_Left_Menu current_world | ||
| 92 | + )= | ||
| 93 | + if plugins is | ||
| 94 | + { | ||
| 95 | + [] then current_world, | ||
| 96 | + [h . t] then get_left_menu_from_plugins(t, add_to_World_Left_Menu(current_world, h.get_plugin_left_menu(unique))) | ||
| 97 | + } | ||
| 98 | +. | ||
| 99 | + | ||
| 100 | + public define World_Left_Menu | ||
| 101 | + get_left_menu_from_plugins | ||
| 102 | + ( | ||
| 103 | + List(WEB_Plugin) plugins | ||
| 104 | + )= | ||
| 105 | + get_left_menu_from_plugins(plugins, world_menu([])) | ||
| 106 | +. |
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: フランスのトトロ aka (David RENÉ) | ||
| 4 | + * Date: 29/05/2019 | ||
| 5 | + * Time: 18:41 | ||
| 6 | + * © David RENÉ | ||
| 7 | + */ | ||
| 8 | +transmit calexium_lib/web/types/web_action_name.anubis | ||
| 9 | +transmit calexium_lib/web/CXM_common.anubis | ||
| 10 | +transmit calexium_lib/web/CXM_web_session.anubis | ||
| 11 | +transmit calexium_lib/web/CXM_multihost_http_server.anubis | ||
| 12 | +transmit calexium_lib/web/CXM_json.anubis | ||
| 13 | +transmit calexium_lib/web/widgets/left_menu.anubis | ||
| 14 | +read web/mime.anubis | ||
| 15 | +read tools/printable_tree.anubis | ||
| 16 | + | ||
| 17 | +public type WEB_Action_Allowed_Protocol: | ||
| 18 | + http, | ||
| 19 | + https, | ||
| 20 | + http_https | ||
| 21 | +. | ||
| 22 | + | ||
| 23 | +public type Web_Action($State): | ||
| 24 | + http_action (String name, // name of action | ||
| 25 | + ($State) -> Bool allow, // true if action allowed | ||
| 26 | + (HTTP_Info http_info, | ||
| 27 | + List(Web_arg) web_args, // actually only 'operands' web arguments | ||
| 28 | + $State state) -> $State do_it), | ||
| 29 | + https_action (String name, // name of action | ||
| 30 | + ($State) -> Bool allow, // true if action allowed | ||
| 31 | + (HTTP_Info http_info, | ||
| 32 | + List(Web_arg) web_args, // actually only 'operands' web arguments | ||
| 33 | + $State state) -> $State do_it), | ||
| 34 | + http_https_action (String name, | ||
| 35 | + ($State) -> Bool allow, | ||
| 36 | + (HTTP_Info http_info, | ||
| 37 | + List(Web_arg) web_args, | ||
| 38 | + $State state) -> $State do_it) | ||
| 39 | +. | ||
| 40 | + | ||
| 41 | + This indicate the way of reading text. | ||
| 42 | +public type Reading_Way: | ||
| 43 | + ltr, //the text is readable from "Left To Right" like english | ||
| 44 | + rtl //the text is readable from "Right To Left" like arabic | ||
| 45 | +. | ||
| 46 | + | ||
| 47 | +public type CSS_File_Media: | ||
| 48 | + screen, //Intended for non-paged computer screens. | ||
| 49 | + tty, //Intended for media using a fixed-pitch character grid, such as teletypes, terminals, or portable devices with limited display capabilities. | ||
| 50 | + tv, //Intended for television-type devices (low resolution, color, limited scrollability). | ||
| 51 | + projection, //Intended for projectors. | ||
| 52 | + handheld, //Intended for handheld devices (small screen, monochrome, bitmapped graphics, limited bandwidth). | ||
| 53 | + print, //Intended for paged, opaque material and for documents viewed on screen in print preview mode. | ||
| 54 | + braille, //Intended for braille tactile feedback devices. | ||
| 55 | + aural, //Intended for speech synthesizers. | ||
| 56 | + all. //Suitable for all devices. | ||
| 57 | + | ||
| 58 | +public type HtmlEvents: | ||
| 59 | + // Window Event Attributes | ||
| 60 | + onafterprint, //HTML5 Script to be run after the document is printed | ||
| 61 | + onbeforeprint, //HTML5 Script to be run before the document is printed | ||
| 62 | + onbeforeunload, //HTML5 Script to be run when the document is about to be unloaded | ||
| 63 | + onerror, //HTML5 Script to be run when an error occurs | ||
| 64 | + onhashchange, //HTML5 Script to be run when there has been changes to the anchor part of the a URL | ||
| 65 | + onload, // Fires after the page is finished loading | ||
| 66 | + onmessage, //HTML5 Script to be run when the message is triggered | ||
| 67 | + onoffline, //HTML5 Script to be run when the browser starts to work offline | ||
| 68 | + ononline, //HTML5 Script to be run when the browser starts to work online | ||
| 69 | + onpagehide, //HTML5 Script to be run when a user navigates away from a page | ||
| 70 | + onpageshow, //HTML5 Script to be run when a user navigates to a page | ||
| 71 | + onpopstate, //HTML5 Script to be run when the window's history changes | ||
| 72 | + onresize, //HTML5 Fires when the browser window is resized | ||
| 73 | + onstorage, //HTML5 Script to be run when a Web Storage area is updated | ||
| 74 | + onunload, // Fires once a page has unloaded (or the browser window has been closed) | ||
| 75 | + // Form element events | ||
| 76 | + onblur, // Fires the moment that the element loses focus | ||
| 77 | + onchange, // Fires the moment when the value of the element is changed | ||
| 78 | + oncontextmenu, //HTML5 Script to be run when a context menu is triggered | ||
| 79 | + onfocus, // Fires the moment when the element gets focus | ||
| 80 | + oninput, //HTML5 Script to be run when an element gets user input | ||
| 81 | + oninvalid, //HTML5 Script to be run when an element is invalid | ||
| 82 | + onreset, // Fires when the Reset button in a form is clicked | ||
| 83 | + onsearch, // Fires when the user writes something in a search field (for <input="search">) | ||
| 84 | + onselect, // Fires after some text has been selected in an element | ||
| 85 | + onsubmit, // Fires when a form is submitted | ||
| 86 | + // Keyboard events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) | ||
| 87 | + onkeydown, // Fires when a user is pressing a key | ||
| 88 | + onkeypress, // Fires when a user presses a key | ||
| 89 | + onkeyup, // Fires when a user releases a key | ||
| 90 | + // Mouse events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) | ||
| 91 | + onclick, // Fires on a mouse click on the element | ||
| 92 | + ondblclick, // Fires on a mouse double-click on the element | ||
| 93 | + onmousedown, // Fires when a mouse button is pressed down on an element | ||
| 94 | + onmousemove, // Fires when the mouse pointer is moving while it is over an element | ||
| 95 | + onmouseout, // Fires when the mouse pointer moves out of an element | ||
| 96 | + onmouseover, // Fires when the mouse pointer moves over an element | ||
| 97 | + onmouseup, // Fires when a mouse button is released over an element | ||
| 98 | + onwheel, //HTML5 Fires when the mouse wheel rolls up or down over an element | ||
| 99 | + //Drag Events | ||
| 100 | + ondrag, //HMTL5 Script to be run when an element is dragged | ||
| 101 | + ondragend, //HTML5 Script to be run at the end of a drag operation | ||
| 102 | + ondragenter, //HTML5 Script to be run when an element has been dragged to a valid drop target | ||
| 103 | + ondragleave, //HTML5 Script to be run when an element leaves a valid drop target | ||
| 104 | + ondragover, //HTML5 Script to be run when an element is being dragged over a valid drop target | ||
| 105 | + ondragstart, //HTML5 Script to be run at the start of a drag operation | ||
| 106 | + ondrop, //HTML5 Script to be run when dragged element is being dropped | ||
| 107 | + onscroll, //HTML5 Script to be run when an element's scrollbar is being scrolled | ||
| 108 | + //Clipboard Events | ||
| 109 | + oncopy, //HTML5 Fires when the user copies the content of an element | ||
| 110 | + oncut, //HTML5 Fires when the user cuts the content of an element | ||
| 111 | + onpaste, //HTML5 Fires when the user pastes some content in an element | ||
| 112 | + //Media Events | ||
| 113 | + onabort, //HTML5 Script to be run on abort | ||
| 114 | + oncanplay, //HTML5 Script to be run when a file is ready to start playing (when it has buffered enough to begin) | ||
| 115 | + oncanplaythrough, //HTML5 Script to be run when a file can be played all the way to the end without pausing for buffering | ||
| 116 | + oncuechange, //HTML5 Script to be run when the cue changes in a <track> element | ||
| 117 | + ondurationchange, //HTML5 Script to be run when the length of the media changes | ||
| 118 | + onemptied, //HTML5 Script to be run when something bad happens and the file is suddenly unavailable (like unexpectedly disconnects) | ||
| 119 | + onended, //HTML5 Script to be run when the media has reach the end (a useful event for messages like "thanks for listening") | ||
| 120 | + onerror, //HTML5 Script to be run when an error occurs when the file is being loaded | ||
| 121 | + onloadeddata, //HTML5 Script to be run when media data is loaded | ||
| 122 | + onloadedmetadata, //HTML5 Script to be run when meta data (like dimensions and duration) are loaded | ||
| 123 | + onloadstart, //HTML5 Script to be run just as the file begins to load before anything is actually loaded | ||
| 124 | + onpause, //HTML5 Script to be run when the media is paused either by the user or programmatically | ||
| 125 | + onplay, //HTML5 Script to be run when the media is ready to start playing | ||
| 126 | + onplaying, //HTML5 Script to be run when the media actually has started playing | ||
| 127 | + onprogress, //HTML5 Script to be run when the browser is in the process of getting the media data | ||
| 128 | + onratechange, //HTML5 Script to be run each time the playback rate changes (like when a user switches to a slow motion or fast forward mode) | ||
| 129 | + onseeked, //HTML5 Script to be run when the seeking attribute is set to false indicating that seeking has ended | ||
| 130 | + onseeking, //HTML5 Script to be run when the seeking attribute is set to true indicating that seeking is active | ||
| 131 | + onstalled, //HTML5 Script to be run when the browser is unable to fetch the media data for whatever reason | ||
| 132 | + onsuspend, //HTML5 Script to be run when fetching the media data is stopped before it is completely loaded for whatever reason | ||
| 133 | + ontimeupdate, //HTML5 Script to be run when the playing position has changed (like when the user fast forwards to a different point in the media) | ||
| 134 | + onvolumechange, //HTML5 Script to be run each time the volume is changed which (includes setting the volume to "mute") | ||
| 135 | + onwaiting, //HTML5 Script to be run when the media has paused but is expected to resume (like when the media pauses to buffer more data) | ||
| 136 | + //Misc Events | ||
| 137 | + onshow, //HTML5 Fires when a <menu> element is shown as a context menu | ||
| 138 | + ontoggle. //HTML5 Fires when the user opens or closes the <details> element | ||
| 139 | + | ||
| 140 | + | ||
| 141 | +public type CSS_File: | ||
| 142 | + css_file(String file_name, CSS_File_Media). | ||
| 143 | + | ||
| 144 | +public type JS_Attribute: | ||
| 145 | + attr (String, String). | ||
| 146 | + | ||
| 147 | +public type JS_File: | ||
| 148 | + js_file(String file_name, | ||
| 149 | + List(JS_Attribute) attributes). | ||
| 150 | + | ||
| 151 | +public type Script: | ||
| 152 | + script( String script_type, | ||
| 153 | + String content). | ||
| 154 | + | ||
| 155 | +public type CoreAttrs:... | ||
| 156 | +public type HTML_Partial_Content:... | ||
| 157 | +public type HTML_Body:... | ||
| 158 | +public type HTML_Off_Form:... | ||
| 159 | +public type HTML_tooltip:... | ||
| 160 | +public type HTTP_Answer:... | ||
| 161 | + | ||
| 162 | + | ||
| 163 | +public type Text_Option: | ||
| 164 | + core_attrs(List(CoreAttrs)), | ||
| 165 | + size(Int), // size of character font to use | ||
| 166 | + font(String), // name of character font to use (such as "helvetica",...) | ||
| 167 | + color(RGB), // color to be used for characters | ||
| 168 | + italic, | ||
| 169 | + oblique, | ||
| 170 | + small_capitals, | ||
| 171 | + bold, | ||
| 172 | + underlined, | ||
| 173 | + left_justified, | ||
| 174 | + right_justified, | ||
| 175 | + justified, // justified on both sides | ||
| 176 | + line_through, | ||
| 177 | + nowrap, | ||
| 178 | + class(String), //CSS class | ||
| 179 | + id(String), | ||
| 180 | + style(String), | ||
| 181 | + title(String), | ||
| 182 | + attr(String, String). | ||
| 183 | + | ||
| 184 | +public type CSS_Style: | ||
| 185 | + text_options(List(Text_Option)). | ||
| 186 | + | ||
| 187 | +// Following types are define to prohib any arguments order error | ||
| 188 | + | ||
| 189 | +/** | ||
| 190 | + * String value for 'id' attribut | ||
| 191 | + */ | ||
| 192 | +public type HTML_Id: | ||
| 193 | + html_Id(String id). | ||
| 194 | + | ||
| 195 | +/** | ||
| 196 | + * String value for 'class' attribut | ||
| 197 | + */ | ||
| 198 | +public type HtmlClass: | ||
| 199 | + htmlClass(String class). | ||
| 200 | + | ||
| 201 | +/** | ||
| 202 | + * Name used in arguments list when form is submitted. | ||
| 203 | + */ | ||
| 204 | +public type WebArgName: | ||
| 205 | + wan(String name). | ||
| 206 | + | ||
| 207 | +/** | ||
| 208 | + * Value passed to arguments list when form is submitted (for RadioButton and CheckBox). | ||
| 209 | + */ | ||
| 210 | +public type WebArgValue: | ||
| 211 | + wav(String value). | ||
| 212 | + | ||
| 213 | +/** | ||
| 214 | + * Initial value of an input field. | ||
| 215 | + */ | ||
| 216 | +public type InitialValue: | ||
| 217 | + init(String value). | ||
| 218 | + | ||
| 219 | +public type HTML_Help_Position: | ||
| 220 | + left, | ||
| 221 | + right | ||
| 222 | +. | ||
| 223 | + | ||
| 224 | +public type HTML_Help: | ||
| 225 | + no_help, //no help text available | ||
| 226 | + tooltip(HTML_tooltip, | ||
| 227 | + HTML_Help_Position) | ||
| 228 | +. | ||
| 229 | + | ||
| 230 | +public type HTML_Label: | ||
| 231 | + no_label, | ||
| 232 | + label( | ||
| 233 | + String text, //label to show | ||
| 234 | + HTML_Help help //HTML help (tooltip with ajax call or not) | ||
| 235 | + ) | ||
| 236 | +. | ||
| 237 | + | ||
| 238 | +public type InputAttrs: | ||
| 239 | + id (String), | ||
| 240 | + class (String), | ||
| 241 | + style (String), | ||
| 242 | + title (String), | ||
| 243 | + lang (String), | ||
| 244 | + dir (Reading_Way), | ||
| 245 | + accesskey (Word8), | ||
| 246 | + tabindex (Int), | ||
| 247 | + attr (String, String), | ||
| 248 | + event (HtmlEvents, String), | ||
| 249 | + //HTML5 | ||
| 250 | + data (String name, String value). | ||
| 251 | + | ||
| 252 | +public type TextAreaOption: | ||
| 253 | + input_attrs(List(InputAttrs)), | ||
| 254 | + disabled, | ||
| 255 | + read_only, | ||
| 256 | + wrap_lines | ||
| 257 | +. | ||
| 258 | + | ||
| 259 | +public type Actioner_Local_Action: | ||
| 260 | + close_window. | ||
| 261 | + | ||
| 262 | +public type Actioner_Connection: | ||
| 263 | + same, // use same type of connection as current page | ||
| 264 | + http, // use non secured connection | ||
| 265 | + https. // use secured connection | ||
| 266 | + | ||
| 267 | +public type Other_Window_Option: | ||
| 268 | + resizable, // the new window may be resized by the client | ||
| 269 | + scrollbars, // the new window has scrollbars | ||
| 270 | + width(Int), // the new window has the specified width | ||
| 271 | + height(Int). // the new window has the specified height | ||
| 272 | + | ||
| 273 | +public type Actioner_Target: | ||
| 274 | + same, | ||
| 275 | + same (String label), | ||
| 276 | + other(String window_name, List(Other_Window_Option)). | ||
| 277 | + | ||
| 278 | +public type Actioner_Aspect: | ||
| 279 | + link (List(Text_Option), String text, Maybe(String) name),// hypertext link | ||
| 280 | + img_link (List(CoreAttrs),String img_url, String alt_text), | ||
| 281 | + push_button (List(CoreAttrs),String text), | ||
| 282 | + button (String url_off, String url_on), // rollover button | ||
| 283 | + button (String url_off, String url_on, Int w, Int h), // idem with size | ||
| 284 | + submit (List(CoreAttrs),String text), | ||
| 285 | + immediate_selector (List(CoreAttrs),WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, Maybe(InitialValue) selected, String onchange_fn), | ||
| 286 | + html (List(CoreAttrs), HTML_Off_Form). | ||
| 287 | + | ||
| 288 | +public type BackgroundOption: | ||
| 289 | + repeat, // repeat the background in both directions | ||
| 290 | + repeat_horizontal, // repeat the background only horizontally | ||
| 291 | + repeat_vertical, // repeat the background only verticall | ||
| 292 | + no_repeat, // don't repeat the background | ||
| 293 | + center. | ||
| 294 | + | ||
| 295 | +public type Cell_Option: | ||
| 296 | + core_attrs(List(CoreAttrs)), | ||
| 297 | + left, // put the content of the cell on the left | ||
| 298 | + h_center, // center the content of the cell horizontally | ||
| 299 | + right, // put the content of the cell on the right | ||
| 300 | + top, // put the content of the cell upwards | ||
| 301 | + v_center, // center the content of tye cell vertically, | ||
| 302 | + bottom, // put the content of the cell downwards | ||
| 303 | + base_line, // align the content vertically according to base lines | ||
| 304 | + background_color(RGB), | ||
| 305 | + background_image(String url, BackgroundOption), | ||
| 306 | + width(Int), // sets a minimal width for the cell | ||
| 307 | + percentage_width(Int), | ||
| 308 | + height(Int), // sets a minimal height for the cell | ||
| 309 | + columns(Int), // lets the cell span over several columns | ||
| 310 | + rows(Int), // lets the cell span over several rows | ||
| 311 | + nowrap, // do not allow text wrapping within the cell | ||
| 312 | + style(String), // in case nothing above is suitable | ||
| 313 | + class(String class_name). | ||
| 314 | + | ||
| 315 | +public type HTML_Cell($T): | ||
| 316 | + cell(List(Cell_Option) options, $T content). | ||
| 317 | + | ||
| 318 | +public type HTML_Footer_Row($T): | ||
| 319 | + empty, | ||
| 320 | + footer_row(List(Cell_Option) options, List(HTML_Cell($T)) cells). | ||
| 321 | + | ||
| 322 | +public type HTML_Row($T): | ||
| 323 | + row(List(Cell_Option) options, List(HTML_Cell($T)) cells). | ||
| 324 | + | ||
| 325 | +public type HTML_Header_Cell($T): | ||
| 326 | + header_cell(List(Cell_Option) options, $T content). | ||
| 327 | + | ||
| 328 | +public type HTML_Header_Row($T): | ||
| 329 | + empty, | ||
| 330 | + header_row(List(Cell_Option) options, List(HTML_Header_Cell($T)) cells). | ||
| 331 | + | ||
| 332 | + | ||
| 333 | +public type Table_Option: | ||
| 334 | + core_attrs(List(CoreAttrs)), | ||
| 335 | + background_color(RGB), // applied to all cells in the table | ||
| 336 | + background_image(String url), | ||
| 337 | + border(Int width_of_outer_edge, // if not present, all values are 0 | ||
| 338 | + Int width_of_top_of_relief, | ||
| 339 | + Int width_of_inner_edge, | ||
| 340 | + RGB border_color), | ||
| 341 | + width(Int), // sets a minimal width for the table | ||
| 342 | + percentage_width(Int), | ||
| 343 | + attr(String name, String value), | ||
| 344 | + class(String class_name). | ||
| 345 | + | ||
| 346 | + | ||
| 347 | +public type HTML_In_Form: | ||
| 348 | + empty, | ||
| 349 | + literal_pt (Printable_tree), | ||
| 350 | + literal (String), | ||
| 351 | + sequence (List(HTML_In_Form) items), | ||
| 352 | + text (List(CoreAttrs), String the_text), | ||
| 353 | + preformated (List(Text_Option), String), | ||
| 354 | + paragraph (List(Text_Option), List(HTML_In_Form) content), | ||
| 355 | + image (List(CoreAttrs), String url, String alternate), | ||
| 356 | + image (List(CoreAttrs), String url, String alternate, Int width, Int height), | ||
| 357 | + table (List(Table_Option), HTML_Header_Row(HTML_In_Form), List(HTML_Row(HTML_In_Form)), HTML_Footer_Row(HTML_In_Form)), | ||
| 358 | + center (HTML_In_Form), | ||
| 359 | + mail_to (String email, HTML_In_Form element), | ||
| 360 | + scroller (Int width, Int height, | ||
| 361 | + Int content_width, Int content_height, | ||
| 362 | + HTML_In_Form content), | ||
| 363 | + actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, | ||
| 364 | + WEB_Action_Name action_name, List((String,String)) extra_ops, | ||
| 365 | + List(Actioner_Local_Action)), | ||
| 366 | + foreign_link_new (Actioner_Target, Actioner_Aspect, String url), | ||
| 367 | + foreign_link (List(Text_Option), String url), | ||
| 368 | + foreign_link (List(Text_Option), String url, String name), | ||
| 369 | + private_download (String abs_path, String name, String extra_ext, | ||
| 370 | + Maybe((String,List((String,String)))) action), | ||
| 371 | + text_input (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), | ||
| 372 | + text_input_ro (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), | ||
| 373 | + password_input (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), | ||
| 374 | + text_area (List(TextAreaOption), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width, Int height), | ||
| 375 | + file_upload (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int width), | ||
| 376 | + selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices), | ||
| 377 | + selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices, InitialValue selected), | ||
| 378 | + // List((String,String)) = List((code,name)) where : | ||
| 379 | + // code is the web-arg value | ||
| 380 | + // name appears in selector | ||
| 381 | + selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices), | ||
| 382 | + selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, InitialValue selected), | ||
| 383 | + radio_button (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, WebArgValue value, Bool checked), | ||
| 384 | + radio_button_r (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, WebArgValue value, Bool checked), | ||
| 385 | + check_box (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Bool checked), | ||
| 386 | + check_box_r (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Bool checked), | ||
| 387 | + div (List(CoreAttrs), List(HTML_In_Form) content), | ||
| 388 | + div_empty (List(CoreAttrs)), | ||
| 389 | + hidden (HTML_Id id, WebArgName name, WebArgValue value), | ||
| 390 | + partial (HTML_Partial_Content), | ||
| 391 | + br, | ||
| 392 | + progress (List(CoreAttrs), Int value, Int max), | ||
| 393 | + ol (List(CoreAttrs), List(HTML_In_Form) content), | ||
| 394 | + ul (List(CoreAttrs), List(HTML_In_Form) content), | ||
| 395 | + li (List(CoreAttrs), List(HTML_In_Form) content), | ||
| 396 | + button (List(CoreAttrs), List(HTML_In_Form) content), | ||
| 397 | + i (List(CoreAttrs), String text), | ||
| 398 | + span (List(CoreAttrs), String text), | ||
| 399 | + hr (List(CoreAttrs)) | ||
| 400 | +. | ||
| 401 | + | ||
| 402 | +public type HTML_Size: | ||
| 403 | + absolute(Int), // in pixels | ||
| 404 | + percentage(Int). | ||
| 405 | + | ||
| 406 | +public type A_href: | ||
| 407 | + href(String href), | ||
| 408 | + href(WEB_Action_Name action, List((String,String)) extra_ops) | ||
| 409 | +. | ||
| 410 | + | ||
| 411 | +public type A_target: | ||
| 412 | + _blank, | ||
| 413 | + _self, | ||
| 414 | + _parent, | ||
| 415 | + _top, | ||
| 416 | + framename(String name) | ||
| 417 | +. | ||
| 418 | + | ||
| 419 | + | ||
| 420 | +public type HTML_Off_Form: | ||
| 421 | + a (List(CoreAttrs), A_href, A_target, List(HTML_Off_Form) content), | ||
| 422 | + empty, | ||
| 423 | + literal_pt (Printable_tree), | ||
| 424 | + literal (String), | ||
| 425 | + sequence (List(HTML_Off_Form) items), | ||
| 426 | + text (List(CoreAttrs), String the_text), | ||
| 427 | + preformated (List(Text_Option), String), | ||
| 428 | + table (List(Table_Option), HTML_Header_Row(HTML_Off_Form), List(HTML_Row(HTML_Off_Form)), HTML_Footer_Row(HTML_Off_Form)), | ||
| 429 | + center (HTML_Off_Form), | ||
| 430 | + mail_to (String email, HTML_Off_Form element), | ||
| 431 | + scroller (Int width, Int height, | ||
| 432 | + Int content_width, Int content_height, | ||
| 433 | + HTML_Off_Form content), | ||
| 434 | + fixed_size (HTML_Size width, HTML_Size height, HTML_Off_Form content), | ||
| 435 | + fixed_size_2 (HTML_Size width, HTML_Size height, String name_of_HTML_file), | ||
| 436 | + actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, | ||
| 437 | + WEB_Action_Name action_name, List((String,String)) extra_ops, | ||
| 438 | + List(Actioner_Local_Action)), | ||
| 439 | + actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, | ||
| 440 | + WEB_Action_Name action_name, List((String,String)) extra_ops, | ||
| 441 | + List(Actioner_Local_Action), String form_name), | ||
| 442 | + foreign_link_new (Actioner_Target, Actioner_Aspect, String url), | ||
| 443 | + foreign_link (List(Text_Option), String url), | ||
| 444 | + foreign_link (List(Text_Option), String url, String name), | ||
| 445 | + private_download (String abs_path, String name, String extra_ext, | ||
| 446 | + Maybe((String,List((String,String)))) action), | ||
| 447 | + label (String name), | ||
| 448 | + form (HTML_Id form_id, List(CoreAttrs), List(HTML_In_Form) content), | ||
| 449 | + form (HTML_Id form_id, List(CoreAttrs), | ||
| 450 | + WEB_Action_Name action, List((String,String)) extra_ops, | ||
| 451 | + List(HTML_In_Form) content), | ||
| 452 | + in_form (HTML_Id form_id, HTML_In_Form content), | ||
| 453 | + div (List(CoreAttrs), List(HTML_Partial_Content) p_content), | ||
| 454 | + iframe (List(CoreAttrs), | ||
| 455 | + List(CSS_Style) /*styles*/, | ||
| 456 | + List(CSS_File) /*css_files*/, | ||
| 457 | + List(JS_File) /*js_files*/, | ||
| 458 | + HTML_Body /*body*/), | ||
| 459 | + partial (HTML_Partial_Content), | ||
| 460 | + progress (List(CoreAttrs), Int value, Int max), | ||
| 461 | + i (List(CoreAttrs), String text), | ||
| 462 | + html_tag (String tag_name, List(CoreAttrs), List(HTML_Off_Form) content), | ||
| 463 | + html_void_tag (String tag_name, List(CoreAttrs)) | ||
| 464 | +. | ||
| 465 | + | ||
| 466 | +public type HTML_Meta: | ||
| 467 | + keywords (List(String)), | ||
| 468 | + refresh (Actioner_Connection connection, | ||
| 469 | + Actioner_Target target, | ||
| 470 | + WEB_Action_Name action, | ||
| 471 | + Int delay), // in seconds | ||
| 472 | + refresh (String url, Int delay), // in seconds | ||
| 473 | + meta (String name, String content), | ||
| 474 | + http_equiv (String name, String content), | ||
| 475 | + generic_meta (List((String,String))), | ||
| 476 | + literal (String). | ||
| 477 | + | ||
| 478 | +public type HTML_Head_Tag: | ||
| 479 | + meta(HTML_Meta), | ||
| 480 | + title(String), | ||
| 481 | + js(JS_File), | ||
| 482 | + js_inline(Script), | ||
| 483 | + css(CSS_File), | ||
| 484 | + css_inline(String css_styles) /* Note: <style> and </style> tags are not necessaries */ | ||
| 485 | + . | ||
| 486 | + | ||
| 487 | + | ||
| 488 | + | ||
| 489 | +public type HTML_Partial_Content: | ||
| 490 | + partial_content | ||
| 491 | + ( | ||
| 492 | + List(HTML_Head_Tag), | ||
| 493 | + HTML_Off_Form | ||
| 494 | + ) | ||
| 495 | +. | ||
| 496 | + | ||
| 497 | +public type Body_Option: | ||
| 498 | + core_attrs(List(CoreAttrs)), | ||
| 499 | + background_color (RGB), | ||
| 500 | + background_image (String url), | ||
| 501 | + background_image (String url, List(BackgroundOption)). | ||
| 502 | + | ||
| 503 | +public type HTML_Body: | ||
| 504 | + body(List(Body_Option) options, HTML_Off_Form content). | ||
| 505 | + | ||
| 506 | +public type WEB_Controller_Result: | ||
| 507 | + http_answer( | ||
| 508 | + WEB_Session session, //modified session | ||
| 509 | + HTTP_Answer http_answer //http answer | ||
| 510 | + ), | ||
| 511 | + http_answer( | ||
| 512 | + HTTP_Answer http_answer //http answer | ||
| 513 | + ), | ||
| 514 | + redirect( //internal redirection, session is modified to call the right controller and action | ||
| 515 | + WEB_Session session | ||
| 516 | + ), | ||
| 517 | + redirect( //internal redirection, session is modified to call the right controller and action | ||
| 518 | + WEB_Session session, | ||
| 519 | + String controller, | ||
| 520 | + String action_name | ||
| 521 | + ), | ||
| 522 | + redirect_to_previous, | ||
| 523 | + redirect_to_previous( | ||
| 524 | + Var(List(WEB_Session_Field)) fields | ||
| 525 | + ), | ||
| 526 | + ajax( | ||
| 527 | + Maybe(WEB_Session) mb_session, //modified session if success else failure | ||
| 528 | + HTTP_Answer http_answer //http answer | ||
| 529 | + ), | ||
| 530 | + ajax( | ||
| 531 | + Maybe(WEB_Session) mb_session, //modified session if success else failure | ||
| 532 | + HTML_Partial_Content content, | ||
| 533 | + String additional_script | ||
| 534 | + ), | ||
| 535 | + ajax( | ||
| 536 | + Maybe(WEB_Session) mb_session, //modified session if success else failure | ||
| 537 | + Printable_tree content, | ||
| 538 | + String additional_script | ||
| 539 | + ), | ||
| 540 | + send_file( | ||
| 541 | + String full_path, //full path with file name of the file to send | ||
| 542 | + Content_Disposition content_disposition //in which form the file must consider by the client (inline: try to display to user, attachment: save as file) | ||
| 543 | + ), | ||
| 544 | + renderer_content( | ||
| 545 | + Maybe(WEB_Session) mb_session, //modified session if success else failure | ||
| 546 | + //String title, | ||
| 547 | + //Left_Menu left_menu, | ||
| 548 | + HTML_Partial_Content content | ||
| 549 | + ) | ||
| 550 | + //redraw with the current renderer, the given content | ||
| 551 | +// redraw( | ||
| 552 | +// Maybe(WEB_Session) mb_session, //modified session if success else failure | ||
| 553 | +// HTML_Partial_Content content | ||
| 554 | +// ) | ||
| 555 | +. | ||
| 556 | + | ||
| 557 | +public type WEB_Action: | ||
| 558 | + web_action( | ||
| 559 | + WEB_Action_Name name, // name of action | ||
| 560 | + WEB_Action_Allowed_Protocol allowed_proto, | ||
| 561 | + (WEB_Session) -> Bool allow, // true if action allowed | ||
| 562 | + (WEB_Session) -> WEB_Controller_Result do_it | ||
| 563 | + ) | ||
| 564 | +. | ||
| 565 | + | ||
| 566 | + | ||
| 567 | +public type HTML_tooltip: | ||
| 568 | + html_tooltip | ||
| 569 | + ( | ||
| 570 | + String title, | ||
| 571 | + String keyword, | ||
| 572 | + Int width, | ||
| 573 | + ), | ||
| 574 | + html_tooltip_ext | ||
| 575 | + ( | ||
| 576 | + String title, | ||
| 577 | + String extend_type, | ||
| 578 | + String class_suffix, | ||
| 579 | + List((String, String)) ext_args | ||
| 580 | + ), | ||
| 581 | + html_tooltip_ext //same without class suffix. This means we use awesome font | ||
| 582 | + ( | ||
| 583 | + String title, | ||
| 584 | + String extend_type, | ||
| 585 | + List((String, String)) ext_args | ||
| 586 | + ), | ||
| 587 | + html_tooltip | ||
| 588 | + ( | ||
| 589 | + String title, | ||
| 590 | + WEB_Action_Name wan, | ||
| 591 | + List((String, String)) ext_args | ||
| 592 | + ). | ||
| 593 | + | ||
| 594 | + | ||
| 595 | +public type CoreAttrs: | ||
| 596 | + empty, | ||
| 597 | + id (String), //A unique identifier for the element. | ||
| 598 | + //There must not be multiple elements in a document that have the same id value. | ||
| 599 | + class (String), //A name of a classification, or list of names of classifications, to which the element belongs | ||
| 600 | + style (String), //Specifies zero or more CSS declarations that apply to the element [CSS]. | ||
| 601 | + title (String), //Advisory information associated with the element. | ||
| 602 | + lang (String), //Specifies the primary language for the contents of the element and for any of the element’s attributes that contain text. | ||
| 603 | + dir (Reading_Way), //Specifies the element’s text directionality. | ||
| 604 | + accesskey (Word8), //A key label or list of key labels with which to associate the element; each key label represents | ||
| 605 | + //a keyboard shortcut which UAs can use to activate the element or give focus to the element. | ||
| 606 | + tabindex (Int), //Specifies whether the element represents an element that is is focusable (that is, an element which is part of the | ||
| 607 | + //sequence of focusable elements in the document), and the relative order of the element in the sequence of focusable | ||
| 608 | + //elements in the document. | ||
| 609 | + //Anubis specific | ||
| 610 | + attr (String, String), //intended to provide unknown attritute | ||
| 611 | + event (HtmlEvents, String), | ||
| 612 | + tooltip (HTML_tooltip), | ||
| 613 | + | ||
| 614 | + //HTML5 | ||
| 615 | + data (String name, String value), | ||
| 616 | + contenteditable(Bool), //Specifies whether the contents of the element are editable | ||
| 617 | + contextmenu(String), //Identifies a menu with which to associate the element as a context menu. | ||
| 618 | + draggable(Bool), //Specifies whether the element is draggable. | ||
| 619 | + hidden(Bool), //Specifies that the element represents an element that is not yet, or is no longer, relevant. | ||
| 620 | + spellcheck(Bool) //Specifies whether the element represents an element whose contents are subject to spell checking and grammar checking. | ||
| 621 | +. | ||
| 622 | + | ||
| 623 | +public type HTTP_Answer: | ||
| 624 | + html_page (HTTP_Status /*http_status*/, | ||
| 625 | + List(HTML_Head_Tag) /*html <head> tags*/, | ||
| 626 | + HTML_Body /*body*/), | ||
| 627 | + html_page (HTTP_Status /*http_status*/, | ||
| 628 | + String /*title*/, | ||
| 629 | + List(HTML_Meta) /*meta_tags*/, | ||
| 630 | + List(CSS_Style) /*styles*/, | ||
| 631 | + List(CSS_File) /*css_files*/, | ||
| 632 | + List(JS_File) /*js_files*/, | ||
| 633 | + List(Script) /*script*/, | ||
| 634 | + HTML_Body /*body*/), | ||
| 635 | + plain_text (HTTP_Status /*http_status*/, | ||
| 636 | + String /*text*/), | ||
| 637 | + custom_text (HTTP_Status /*http_status*/, | ||
| 638 | + MIME /*mime_type*/, | ||
| 639 | + String /*content*/), | ||
| 640 | + custom_binary(HTTP_Status /*http_status*/, | ||
| 641 | + MIME /*mime_type*/, | ||
| 642 | + ByteArray /*content*/, | ||
| 643 | + List(HTTP_header)/*other headers*/), | ||
| 644 | + custom_tree (HTTP_Status /*http_status*/, | ||
| 645 | + MIME /*mime_type*/, | ||
| 646 | + Printable_tree /*content*/), | ||
| 647 | + json (HTTP_Status, /*http_status*/ | ||
| 648 | + JsonValue), /*json value*/ | ||
| 649 | + send_file ( String file_path, //file to send to client. //TODO add call back for before, during, after send | ||
| 650 | + Content_Disposition c_disposition), | ||
| 651 | + http_raw (Printable_tree), | ||
| 652 | + html_content (HTTP_Status /*http_status*/, | ||
| 653 | + HTML_Off_Form), | ||
| 654 | + html_partial_content (HTTP_Status /*http_status*/, | ||
| 655 | + HTML_Partial_Content) | ||
| 656 | +. | ||
| 657 | + | ||
| 658 | +public type WEB_Controller: | ||
| 659 | + web_controller( | ||
| 660 | + String name, //controller name | ||
| 661 | + Var(List(WEB_Action)) controller_actions, //list of all actions of that controller | ||
| 662 | + (WEB_Session)-> WEB_Controller_Result error //Error renderer | ||
| 663 | + ) | ||
| 664 | +. | ||
| 665 | + |
web/widgets/left_menu.anubis
| @@ -7,7 +7,8 @@ | @@ -7,7 +7,8 @@ | ||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | transmit tools/basis.anubis | 9 | transmit tools/basis.anubis |
| 10 | -read calexium_lib/web/CXM_making_a_web_site.anubis | 10 | + read calexium_lib/web/CXM_web_action.anubis |
| 11 | +read calexium_lib/web/CXM_web_action.anubis | ||
| 11 | read system/string.anubis | 12 | read system/string.anubis |
| 12 | 13 | ||
| 13 | public type Left_Menu_Entry: | 14 | public type Left_Menu_Entry: |
| @@ -36,11 +37,103 @@ public type Left_Menu: | @@ -36,11 +37,103 @@ public type Left_Menu: | ||
| 36 | 37 | ||
| 37 | public type Plugin_Left_Menu: | 38 | public type Plugin_Left_Menu: |
| 38 | plugin_left_menu( | 39 | plugin_left_menu( |
| 39 | - String name, //plug in name | 40 | + String app, //application name |
| 41 | + String space, //space name | ||
| 40 | Left_Menu left_menu | 42 | Left_Menu left_menu |
| 41 | ) | 43 | ) |
| 42 | . | 44 | . |
| 43 | 45 | ||
| 46 | +public type Space_Left_Menu: | ||
| 47 | + space_menu( | ||
| 48 | + String name, | ||
| 49 | + Left_Menu menu | ||
| 50 | + ) | ||
| 51 | +. | ||
| 52 | + | ||
| 53 | +public type App_Left_Menu: | ||
| 54 | + app_menu( | ||
| 55 | + String name, | ||
| 56 | + List(Space_Left_Menu) space_menu_list | ||
| 57 | + ) | ||
| 58 | +. | ||
| 59 | + | ||
| 60 | +public type World_Left_Menu: | ||
| 61 | + world_menu( | ||
| 62 | + List(App_Left_Menu) app_menu_list | ||
| 63 | + ) | ||
| 64 | +. | ||
| 65 | + | ||
| 66 | +public define List(Space_Left_Menu) | ||
| 67 | + add_to_space | ||
| 68 | + ( | ||
| 69 | + List(Space_Left_Menu) space_list, | ||
| 70 | + List(Space_Left_Menu) so_far, | ||
| 71 | + String space_name, | ||
| 72 | + Left_Menu left_menu | ||
| 73 | + )= | ||
| 74 | + if space_list is | ||
| 75 | + { | ||
| 76 | + [] then [space_menu(space_name, left_menu)], | ||
| 77 | + [h . t] then | ||
| 78 | + if h.name = space_name then // if we found the same name we replace it into the list | ||
| 79 | + [space_menu(space_name, left_menu) . so_far]+t | ||
| 80 | + else | ||
| 81 | + add_to_space(t, [h . so_far], space_name, left_menu) | ||
| 82 | + } | ||
| 83 | +. | ||
| 84 | + | ||
| 85 | +public define World_Left_Menu | ||
| 86 | + add_to_app | ||
| 87 | + ( | ||
| 88 | + List(App_Left_Menu) app_list, | ||
| 89 | + List(App_Left_Menu) so_far, | ||
| 90 | + String app_name, | ||
| 91 | + String space_name, | ||
| 92 | + Left_Menu left_menu | ||
| 93 | + )= | ||
| 94 | + if app_list is | ||
| 95 | + { | ||
| 96 | + [] then world_menu([app_menu(app_name, [space_menu(space_name, left_menu)]) . so_far]), | ||
| 97 | + [h . t] then | ||
| 98 | + if h.name = app_name then | ||
| 99 | + world_menu([app_menu(app_name, add_to_space(h.space_menu_list, [], space_name, left_menu)) . so_far]+t) | ||
| 100 | + else | ||
| 101 | + add_to_app(t, [h . so_far], app_name, space_name, left_menu) | ||
| 102 | + } | ||
| 103 | +. | ||
| 104 | + | ||
| 105 | +public define World_Left_Menu | ||
| 106 | + add_to_World_Left_Menu | ||
| 107 | + ( | ||
| 108 | + World_Left_Menu w_left_menu, | ||
| 109 | + Plugin_Left_Menu p_left_menu | ||
| 110 | + )= | ||
| 111 | + since p_left_menu is plugin_left_menu(app, space, l_menu), | ||
| 112 | + | ||
| 113 | + add_to_app(w_left_menu.app_menu_list, [], app, space, l_menu) | ||
| 114 | +. | ||
| 115 | + | ||
| 116 | +public define World_Left_Menu | ||
| 117 | + add_to_World_Left_Menu | ||
| 118 | + ( | ||
| 119 | + World_Left_Menu current_world, | ||
| 120 | + List(Plugin_Left_Menu) p_left_menu | ||
| 121 | + )= | ||
| 122 | + if p_left_menu is | ||
| 123 | + { | ||
| 124 | + [] then current_world, | ||
| 125 | + [h . t] then add_to_World_Left_Menu(add_to_World_Left_Menu(current_world, h), t) | ||
| 126 | + } | ||
| 127 | +. | ||
| 128 | + | ||
| 129 | +public define World_Left_Menu | ||
| 130 | + add_to_World_Left_Menu | ||
| 131 | + ( | ||
| 132 | + List(Plugin_Left_Menu) p_left_menu | ||
| 133 | + )= | ||
| 134 | + add_to_World_Left_Menu(world_menu([]), p_left_menu) | ||
| 135 | +. | ||
| 136 | + | ||
| 44 | public define Left_Menu_Entry | 137 | public define Left_Menu_Entry |
| 45 | left_menu_entry | 138 | left_menu_entry |
| 46 | ( | 139 | ( |
| @@ -122,48 +215,3 @@ public define Left_Menu_Entry | @@ -122,48 +215,3 @@ public define Left_Menu_Entry | ||
| 122 | )= | 215 | )= |
| 123 | title(title_id, [], text). | 216 | title(title_id, [], text). |
| 124 | 217 | ||
| 125 | -define List(HTML_Off_Form) | ||
| 126 | - make_left_menu | ||
| 127 | - ( | ||
| 128 | - (String) -> String _T, //translator function | ||
| 129 | - List(Left_Menu_Entry) entries, | ||
| 130 | - String selected, | ||
| 131 | - List(HTML_Off_Form) so_far | ||
| 132 | - )= | ||
| 133 | - if entries is | ||
| 134 | - { | ||
| 135 | - [] then reverse(so_far), //reverse to be in the right direction | ||
| 136 | - [h . t] then | ||
| 137 | - with entry = | ||
| 138 | - if h is | ||
| 139 | - { | ||
| 140 | - left_menu_entry(_menu_id, _classes, _action, _text, _extra, _target_id) then | ||
| 141 | - if _target_id is | ||
| 142 | - { | ||
| 143 | - failure then p([class("item "+_menu_id+"_icon"+if _menu_id=selected then " selected" else ""+ " "+join(" ", _classes))],actioner(same,same, link(_T(_text)),_action,_extra)), | ||
| 144 | - success(target_id) then | ||
| 145 | - p([class("item "+_menu_id+"_icon"+if _menu_id=selected then " selected" else ""+ " "+join(" ", _classes)), | ||
| 146 | - event(onclick, "CalexiumToolBox.ajax_load_content('"+target_id+"', "+format_web_action_name_to_js(_action, _extra)+")")],text(_T(_text))), | ||
| 147 | - } | ||
| 148 | - | ||
| 149 | - title(_title_id, _classes, _text) then | ||
| 150 | - p([class("menu_title"), class(if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) | ||
| 151 | -// p([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) | ||
| 152 | - }, | ||
| 153 | - make_left_menu(_T, t, selected, [ entry . so_far]) | ||
| 154 | - }. | ||
| 155 | - | ||
| 156 | -public define HTML_Partial_Content | ||
| 157 | - make_left_menu | ||
| 158 | - ( | ||
| 159 | - (String) -> String _T, //translator function | ||
| 160 | - Left_Menu l_menu | ||
| 161 | - )= | ||
| 162 | - if l_menu is | ||
| 163 | - { | ||
| 164 | - no_left_menu then partial_content(empty), | ||
| 165 | - left_menu(entries, selected) then | ||
| 166 | - partial_content([css(css_file("/css/left_menu.css"))], | ||
| 167 | - sequence(make_left_menu(_T, entries, selected, []))) | ||
| 168 | - }. | ||
| 169 | - |
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: フランスのトトロ aka (David RENÉ) | ||
| 4 | + * Date: 29/05/2019 | ||
| 5 | + * Time: 17:26 | ||
| 6 | + * © David RENÉ | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +transmit calexium_lib/web/widgets/left_menu.anubis | ||
| 10 | +read calexium_lib/web/CXM_making_a_web_site.anubis | ||
| 11 | +read calexium_lib/web/CXM_web_action.anubis | ||
| 12 | +read calexium_lib/web/load_content.anubis | ||
| 13 | + | ||
| 14 | +define List(HTML_Off_Form) | ||
| 15 | + make_left_menu | ||
| 16 | + ( | ||
| 17 | + (String) -> String _T, //translator function | ||
| 18 | + List(Left_Menu_Entry) entries, | ||
| 19 | + String selected, | ||
| 20 | + List(HTML_Off_Form) so_far | ||
| 21 | + )= | ||
| 22 | + if entries is | ||
| 23 | + { | ||
| 24 | + [] then reverse(so_far), //reverse to be in the right direction | ||
| 25 | + [h . t] then | ||
| 26 | + with entry = | ||
| 27 | + if h is | ||
| 28 | + { | ||
| 29 | + left_menu_entry(_menu_id, _classes, _action, _text, _extra, _target_id) then | ||
| 30 | + if _target_id is | ||
| 31 | + { | ||
| 32 | + failure then p([class("item "+_menu_id+"_icon"+if _menu_id=selected then " selected" else ""+ " "+join(" ", _classes))],actioner(same,same, link(_T(_text)),_action,_extra)), | ||
| 33 | + success(target_id) then | ||
| 34 | + p([class("item "+_menu_id+"_icon"+if _menu_id=selected then " selected" else ""+ " "+join(" ", _classes)), | ||
| 35 | +// event(onclick, "CalexiumToolBox.ajax_load_content('"+target_id+"', "+format_web_action_name_to_js(_action, _extra)+")")],text(_T(_text))), | ||
| 36 | + event(onclick, load_content(target_id, _action, _extra))],text(_T(_text))), | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + title(_title_id, _classes, _text) then | ||
| 40 | + p([class("menu_title"), class(if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) | ||
| 41 | +// p([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) | ||
| 42 | + }, | ||
| 43 | + make_left_menu(_T, t, selected, [ entry . so_far]) | ||
| 44 | + }. | ||
| 45 | + | ||
| 46 | +public define HTML_Partial_Content | ||
| 47 | + make_left_menu | ||
| 48 | + ( | ||
| 49 | + (String) -> String _T, //translator function | ||
| 50 | + Left_Menu l_menu | ||
| 51 | + )= | ||
| 52 | + if l_menu is | ||
| 53 | + { | ||
| 54 | + no_left_menu then partial_empty, | ||
| 55 | + left_menu(entries, selected) then | ||
| 56 | + partial_content([css(css_file("/css/left_menu.css"))], | ||
| 57 | + sequence(make_left_menu(_T, entries, selected, []))) | ||
| 58 | + }. | ||
| 59 | + |