diff --git a/net_services_protocols/logger_service.anubis b/net_services_protocols/logger_service.anubis index fda301a..8faa12c 100644 --- a/net_services_protocols/logger_service.anubis +++ b/net_services_protocols/logger_service.anubis @@ -267,7 +267,9 @@ define Message String log_string, Int level )= - with string = if length(log_string) > 1024 then (if sub_string(log_string, 0, 1024) is success(s) then s else "?") + "..." + with len = length(log_string), + //println("len log string "+len); + 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 else log_string, with log_msg = message(_CXM_LOGGER_LOG), forget(add_string(log_msg, "LogName", logger_name)); diff --git a/web/CXM_making_a_web_site.anubis b/web/CXM_making_a_web_site.anubis index 5e4a7d6..cf91800 100644 --- a/web/CXM_making_a_web_site.anubis +++ b/web/CXM_making_a_web_site.anubis @@ -58,7 +58,8 @@ read system/string.anubis read system/logger.anubis transmit CXM_common.anubis transmit CXM_multihost_http_server.anubis -read web/mime.anubis +read web/mime.anubis +read calexium_lib/web/plugin/plugin.anubis read CXM_cookies.anubis read CXM_json.anubis transmit CXM_web_dump.anubis @@ -67,6 +68,7 @@ transmit CXM_web_session.anubis transmit CXM_web_action.anubis transmit calexium_lib/web/types/web_action_name.anubis +transmit calexium_lib/web/types/making_a_web_site.anubis //TODO move anywhere @@ -303,22 +305,7 @@ public define String sub-boxes as there are actions. For this reason, we define the following type for representing actions (where '$State' is the type representing session informations): -public type Web_Action($State): - http_action (String name, // name of action - ($State) -> Bool allow, // true if action allowed - (HTTP_Info http_info, - List(Web_arg) web_args, // actually only 'operands' web arguments - $State state) -> $State do_it), - https_action (String name, // name of action - ($State) -> Bool allow, // true if action allowed - (HTTP_Info http_info, - List(Web_arg) web_args, // actually only 'operands' web arguments - $State state) -> $State do_it), - http_https_action (String name, - ($State) -> Bool allow, - (HTTP_Info http_info, - List(Web_arg) web_args, - $State state) -> $State do_it). + 'http_action's are executed only under HTTP, and 'https_action's are executed only under HTTPS. 'http_https_action's may be executed under both types of connections. @@ -352,7 +339,7 @@ public type Web_Action($State): where the type 'HTTP_Answer' (defined below in this file) abstractly represents HTML pages. -public type HTTP_Answer:... +//public type HTTP_Answer:... It should be clear that states and pages are deeply linked together. Indeed, we really understand the page shown to the client as a representation of the current state of the @@ -360,54 +347,11 @@ public type HTTP_Answer:... taken from the data bases. -public type HTML_Partial_Content:... +//public type HTML_Partial_Content:... -public type WEB_Controller_Result: - http_answer( - WEB_Session session, //modified session - HTTP_Answer http_answer //http answer - ), - http_answer( - HTTP_Answer http_answer //http answer - ), - redirect( //internal redirection, session is modified to call the right controller and action - WEB_Session session - ), - redirect( //internal redirection, session is modified to call the right controller and action - WEB_Session session, - String controller, - String action_name - ), - redirect_to_previous, - redirect_to_previous( - Var(List(WEB_Session_Field)) fields - ), - ajax( - Maybe(WEB_Session) mb_session, //modified session if success else failure - HTTP_Answer http_answer //http answer - ), - ajax( - Maybe(WEB_Session) mb_session, //modified session if success else failure - HTML_Partial_Content content, - String additional_script - ), - ajax( - Maybe(WEB_Session) mb_session, //modified session if success else failure - Printable_tree content, - String additional_script - ), - send_file( - String full_path, //full path with file name of the file to send - Content_Disposition content_disposition //in which form the file must consider by the client (inline: try to display to user, attachment: save as file) - ), - renderer_content( - Maybe(WEB_Session) mb_session, //modified session if success else failure - String title, - HTML_Partial_Content content, - ) -. + public define WEB_Controller_Result ajax @@ -492,50 +436,26 @@ public define WEB_Controller_Result public define WEB_Controller_Result renderer_content( - String title, HTML_Partial_Content content, )= - renderer_content(failure, title, content) + renderer_content(failure, content) . public define WEB_Controller_Result renderer_content( WEB_Session session, //modified session if success else failure - String title, HTML_Partial_Content content, )= - renderer_content(success(session), title, content) + renderer_content(success(session), content) . - -public type WEB_Action_Allowed_Protocol: - http, - https, - http_https. - -public type WEB_Action: - web_action( - WEB_Action_Name name, // name of action - WEB_Action_Allowed_Protocol allowed_proto, - (WEB_Session) -> Bool allow, // true if action allowed - (WEB_Session) -> WEB_Controller_Result do_it - ) -. - -public type WEB_Controller: - web_controller( - String name, //controller name - Var(List(WEB_Action)) controller_actions, //list of all actions of that controller - (WEB_Session)-> WEB_Controller_Result error //Error renderer - ) + public define WEB_Controller_Result + redraw( + HTML_Partial_Content content, + )= + redraw(failure, content) . -public type WEB_Page_Renderer: - web_page_renderer( - String name, //renderer name - (WEB_Session _session, String title, HTML_Partial_Content _content) -> HTTP_Answer page_layout //call back for rendering page - ) -. define List(HTTP_header) @@ -951,52 +871,16 @@ public define Start_Web_Sites_Result For easy reference, we gather below the definitions of all the types used by the HTML interface, and we comment them immediately. -public type HTML_Off_Form:... + //public type HTML_Off_Form:... -public type HTML_Size: - absolute(Int), // in pixels - percentage(Int). + - This indicate the way of reading text. -public type Reading_Way: - ltr, //the text is readable from "Left To Right" like english - rtl. //the text is readable from "Right To Left" like arabic - - -// Following types are define to prohib any arguments order error -/** - * String value for 'id' attribut - */ -public type HTML_Id: - html_Id(String id). - -/** - * String value for 'class' attribut - */ -public type HtmlClass: - htmlClass(String class). - -/** - * Name used in arguments list when form is submitted. - */ -public type WebArgName: - wan(String name). -/** - * Value passed to arguments list when form is submitted (for RadioButton and CheckBox). - */ -public type WebArgValue: - wav(String value). -/** - * Initial value of an input field. - */ -public type InitialValue: - init(String value). public define Printable_tree [HTML_Id x . Printable_tree y] = str_pt(x.id, y). 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 public define Printable_tree [WebArgValue x . Printable_tree y] = str_pt(x.value, y). public define Printable_tree [InitialValue x . Printable_tree y] = str_pt(x.value, y). -public type HTML_tooltip: - html_tooltip - ( - String title, - String keyword, - Int width, - ), - html_tooltip_ext - ( - String title, - String extend_type, - String class_suffix, - List((String, String)) ext_args - ), - html_tooltip_ext //same without class suffix. This means we use awesome font - ( - String title, - String extend_type, - List((String, String)) ext_args - ), - html_tooltip - ( - String title, - WEB_Action_Name wan, - List((String, String)) ext_args - ). -public type HtmlEvents: - // Window Event Attributes - onafterprint, //HTML5 Script to be run after the document is printed - onbeforeprint, //HTML5 Script to be run before the document is printed - onbeforeunload, //HTML5 Script to be run when the document is about to be unloaded - onerror, //HTML5 Script to be run when an error occurs - onhashchange, //HTML5 Script to be run when there has been changes to the anchor part of the a URL - onload, // Fires after the page is finished loading - onmessage, //HTML5 Script to be run when the message is triggered - onoffline, //HTML5 Script to be run when the browser starts to work offline - ononline, //HTML5 Script to be run when the browser starts to work online - onpagehide, //HTML5 Script to be run when a user navigates away from a page - onpageshow, //HTML5 Script to be run when a user navigates to a page - onpopstate, //HTML5 Script to be run when the window's history changes - onresize, //HTML5 Fires when the browser window is resized - onstorage, //HTML5 Script to be run when a Web Storage area is updated - onunload, // Fires once a page has unloaded (or the browser window has been closed) - // Form element events - onblur, // Fires the moment that the element loses focus - onchange, // Fires the moment when the value of the element is changed - oncontextmenu, //HTML5 Script to be run when a context menu is triggered - onfocus, // Fires the moment when the element gets focus - oninput, //HTML5 Script to be run when an element gets user input - oninvalid, //HTML5 Script to be run when an element is invalid - onreset, // Fires when the Reset button in a form is clicked - onsearch, // Fires when the user writes something in a search field (for ) - onselect, // Fires after some text has been selected in an element - onsubmit, // Fires when a form is submitted - // Keyboard events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) - onkeydown, // Fires when a user is pressing a key - onkeypress, // Fires when a user presses a key - onkeyup, // Fires when a user releases a key - // Mouse events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) - onclick, // Fires on a mouse click on the element - ondblclick, // Fires on a mouse double-click on the element - onmousedown, // Fires when a mouse button is pressed down on an element - onmousemove, // Fires when the mouse pointer is moving while it is over an element - onmouseout, // Fires when the mouse pointer moves out of an element - onmouseover, // Fires when the mouse pointer moves over an element - onmouseup, // Fires when a mouse button is released over an element - onwheel, //HTML5 Fires when the mouse wheel rolls up or down over an element - //Drag Events - ondrag, //HMTL5 Script to be run when an element is dragged - ondragend, //HTML5 Script to be run at the end of a drag operation - ondragenter, //HTML5 Script to be run when an element has been dragged to a valid drop target - ondragleave, //HTML5 Script to be run when an element leaves a valid drop target - ondragover, //HTML5 Script to be run when an element is being dragged over a valid drop target - ondragstart, //HTML5 Script to be run at the start of a drag operation - ondrop, //HTML5 Script to be run when dragged element is being dropped - onscroll, //HTML5 Script to be run when an element's scrollbar is being scrolled - //Clipboard Events - oncopy, //HTML5 Fires when the user copies the content of an element - oncut, //HTML5 Fires when the user cuts the content of an element - onpaste, //HTML5 Fires when the user pastes some content in an element - //Media Events - onabort, //HTML5 Script to be run on abort - oncanplay, //HTML5 Script to be run when a file is ready to start playing (when it has buffered enough to begin) - oncanplaythrough, //HTML5 Script to be run when a file can be played all the way to the end without pausing for buffering - oncuechange, //HTML5 Script to be run when the cue changes in a element - ondurationchange, //HTML5 Script to be run when the length of the media changes - onemptied, //HTML5 Script to be run when something bad happens and the file is suddenly unavailable (like unexpectedly disconnects) - onended, //HTML5 Script to be run when the media has reach the end (a useful event for messages like "thanks for listening") - onerror, //HTML5 Script to be run when an error occurs when the file is being loaded - onloadeddata, //HTML5 Script to be run when media data is loaded - onloadedmetadata, //HTML5 Script to be run when meta data (like dimensions and duration) are loaded - onloadstart, //HTML5 Script to be run just as the file begins to load before anything is actually loaded - onpause, //HTML5 Script to be run when the media is paused either by the user or programmatically - onplay, //HTML5 Script to be run when the media is ready to start playing - onplaying, //HTML5 Script to be run when the media actually has started playing - onprogress, //HTML5 Script to be run when the browser is in the process of getting the media data - 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) - onseeked, //HTML5 Script to be run when the seeking attribute is set to false indicating that seeking has ended - onseeking, //HTML5 Script to be run when the seeking attribute is set to true indicating that seeking is active - onstalled, //HTML5 Script to be run when the browser is unable to fetch the media data for whatever reason - onsuspend, //HTML5 Script to be run when fetching the media data is stopped before it is completely loaded for whatever reason - 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) - onvolumechange, //HTML5 Script to be run each time the volume is changed which (includes setting the volume to "mute") - 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) - //Misc Events - onshow, //HTML5 Fires when a element is shown as a context menu - ontoggle. //HTML5 Fires when the user opens or closes the
element - -public type CoreAttrs: - empty, - id (String), //A unique identifier for the element. - //There must not be multiple elements in a document that have the same id value. - class (String), //A name of a classification, or list of names of classifications, to which the element belongs - style (String), //Specifies zero or more CSS declarations that apply to the element [CSS]. - title (String), //Advisory information associated with the element. - lang (String), //Specifies the primary language for the contents of the element and for any of the element’s attributes that contain text. - dir (Reading_Way), //Specifies the element’s text directionality. - accesskey (Word8), //A key label or list of key labels with which to associate the element; each key label represents - //a keyboard shortcut which UAs can use to activate the element or give focus to the element. - tabindex (Int), //Specifies whether the element represents an element that is is focusable (that is, an element which is part of the - //sequence of focusable elements in the document), and the relative order of the element in the sequence of focusable - //elements in the document. - //Anubis specific - attr (String, String), //intended to provide unknown attritute - event (HtmlEvents, String), - tooltip (HTML_tooltip), - - //HTML5 - data (String name, String value), - contenteditable(Bool), //Specifies whether the contents of the element are editable - contextmenu(String), //Identifies a menu with which to associate the element as a context menu. - draggable(Bool), //Specifies whether the element is draggable. - hidden(Bool), //Specifies that the element represents an element that is not yet, or is no longer, relevant. - spellcheck(Bool) //Specifies whether the element represents an element whose contents are subject to spell checking and grammar checking. -. + public define CoreAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). -public type InputAttrs: - id (String), - class (String), - style (String), - title (String), - lang (String), - dir (Reading_Way), - accesskey (Word8), - tabindex (Int), - attr (String, String), - event (HtmlEvents, String), - //HTML5 - data (String name, String value). public define InputAttrs attr(String name, Bool value) = attr(name, if value then "true" else "false"). -public type Text_Option: - core_attrs(List(CoreAttrs)), - size(Int), // size of character font to use - font(String), // name of character font to use (such as "helvetica",...) - color(RGB), // color to be used for characters - italic, - oblique, - small_capitals, - bold, - underlined, - left_justified, - right_justified, - justified, // justified on both sides - line_through, - nowrap, - class(String), //CSS class - id(String), - style(String), - title(String), - attr(String, String). + public define Text_Option tooltip(String s) = title(s). @@ -1286,20 +1004,7 @@ public define String onshow then "onshow", //HTML5 Fires when a element is shown as a context menu ontoggle then "ontoggle" }. - -public type Table_Option: - core_attrs(List(CoreAttrs)), - background_color(RGB), // applied to all cells in the table - background_image(String url), - border(Int width_of_outer_edge, // if not present, all values are 0 - Int width_of_top_of_relief, - Int width_of_inner_edge, - RGB border_color), - width(Int), // sets a minimal width for the table - percentage_width(Int), - attr(String name, String value), - class(String class_name). - + 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)). A list of 'Table_Option' must be given with each table. -public type BackgroundOption: - repeat, // repeat the background in both directions - repeat_horizontal, // repeat the background only horizontally - repeat_vertical, // repeat the background only verticall - no_repeat, // don't repeat the background - center. + -public type Cell_Option: - core_attrs(List(CoreAttrs)), - left, // put the content of the cell on the left - h_center, // center the content of the cell horizontally - right, // put the content of the cell on the right - top, // put the content of the cell upwards - v_center, // center the content of tye cell vertically, - bottom, // put the content of the cell downwards - base_line, // align the content vertically according to base lines - background_color(RGB), - background_image(String url, BackgroundOption), - width(Int), // sets a minimal width for the cell - percentage_width(Int), - height(Int), // sets a minimal height for the cell - columns(Int), // lets the cell span over several columns - rows(Int), // lets the cell span over several rows - nowrap, // do not allow text wrapping within the cell - style(String), // in case nothing above is suitable - class(String class_name). A list of 'Cell_Option' must be given with each cell and each row in a table. Options given with a row apply to all the cells in the row, but are superseded by options given with cells, which apply only to the cell they are given with. -public type HTML_Cell($T): - cell(List(Cell_Option) options, $T content). -public type HTML_Header_Cell($T): - header_cell(List(Cell_Option) options, $T content). + The parameter $T is later instantiated either to 'HTML_In_Form' or to 'HTML_Off_Form', depending on where you put your table (within a form or not within a form). For your @@ -1375,16 +1053,7 @@ public define HTML_Header_Cell($T) header_cell([],content). -public type HTML_Row($T): - row(List(Cell_Option) options, List(HTML_Cell($T)) cells). - -public type HTML_Header_Row($T): - empty, - header_row(List(Cell_Option) options, List(HTML_Header_Cell($T)) cells). -public type HTML_Footer_Row($T): - empty, - footer_row(List(Cell_Option) options, List(HTML_Cell($T)) cells). Same remark as for 'HTML_Cell($T)'. We define several convenience functions: @@ -1432,31 +1101,7 @@ public define HTML_Header_Row($T) ) = header_row([],[cell]). -public type Actioner_Connection: - same, // use same type of connection as current page - http, // use non secured connection - https. // use secured connection - -public type Other_Window_Option: - resizable, // the new window may be resized by the client - scrollbars, // the new window has scrollbars - width(Int), // the new window has the specified width - height(Int). // the new window has the specified height - -public type Actioner_Target: - same, - same (String label), - other(String window_name, List(Other_Window_Option)). - -public type Actioner_Aspect: - link (List(Text_Option), String text, Maybe(String) name),// hypertext link - img_link (List(CoreAttrs),String img_url, String alt_text), - push_button (List(CoreAttrs),String text), - button (String url_off, String url_on), // rollover button - button (String url_off, String url_on, Int w, Int h), // idem with size - submit (List(CoreAttrs),String text), - immediate_selector (List(CoreAttrs),WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, Maybe(InitialValue) selected, String onchange_fn), - html (List(CoreAttrs), HTML_Off_Form). + public define Actioner_Aspect immediate_selector @@ -1482,10 +1127,6 @@ public define Actioner_Aspect . -public type Actioner_Local_Action: - close_window. - - public define Actioner_Aspect link ( @@ -1527,25 +1168,8 @@ public define Actioner_Aspect Actioners are explained in details below. -public type TextAreaOption: - input_attrs(List(InputAttrs)), - disabled, - read_only, - wrap_lines. -public type CSS_Style: - text_options(List(Text_Option)). -public type CSS_File_Media: - screen, //Intended for non-paged computer screens. - tty, //Intended for media using a fixed-pitch character grid, such as teletypes, terminals, or portable devices with limited display capabilities. - tv, //Intended for television-type devices (low resolution, color, limited scrollability). - projection, //Intended for projectors. - handheld, //Intended for handheld devices (small screen, monochrome, bitmapped graphics, limited bandwidth). - print, //Intended for paged, opaque material and for documents viewed on screen in print preview mode. - braille, //Intended for braille tactile feedback devices. - aural, //Intended for speech synthesizers. - all. //Suitable for all devices. public define String to_String @@ -1567,8 +1191,7 @@ public define String . -public type CSS_File: - css_file(String file_name, CSS_File_Media). + public define CSS_File css_file @@ -1577,16 +1200,7 @@ public define CSS_File )= css_file(file_name, all). -public type JS_Attribute: - attr (String, String). - -public type JS_File: - js_file(String file_name, - List(JS_Attribute) attributes). -public type Script: - script( String script_type, - String content). public define JS_File js_file @@ -1595,19 +1209,10 @@ public define JS_File ) = js_file(file_name, []). -public type HTML_Meta:... +//public type HTML_Meta:... -public type HTML_Head_Tag: - meta(HTML_Meta), - title(String), - js(JS_File), - js_inline(Script), - css(CSS_File), - css_inline(String css_styles) /* Note: tags are not necessaries */ - . - public define HTML_Head_Tag js_script ( @@ -1634,14 +1239,7 @@ public define HTML_tooltip )= html_tooltip(title, keyword, 0). -public type HTML_Help_Position: - left, - right. - -public type HTML_Help: - no_help, //no help text available - tooltip(HTML_tooltip, - HTML_Help_Position). + public define HTML_Help tooltip @@ -1651,25 +1249,15 @@ public define HTML_Help tooltip(h_tooltip, left) . -public type HTML_Label: - no_label, - label( - String text, //label to show - HTML_Help help //HTML help (tooltip with ajax call or not) - - ). + + /* It contains * - a List of HTML_Head_Tag representing necessaries head tags for the content. ex: jquery js files, js script, css specific styles, ... * - a HTML_Off_Form representing the HTML code for the part of the page we want to display */ -public type HTML_In_Form:... +//public type HTML_In_Form:... + -public type HTML_Partial_Content: - partial_content - ( - List(HTML_Head_Tag), - HTML_Off_Form - ). public define List(HTML_Head_Tag) to_HTML_Head_Tag @@ -1685,60 +1273,6 @@ public define List(HTML_Head_Tag) )= map((JS_File js_f) |-> js(js_f), js_file_list). -public type HTML_In_Form: - empty, - literal_pt (Printable_tree), - literal (String), - sequence (List(HTML_In_Form) items), - text (List(CoreAttrs), String the_text), - preformated (List(Text_Option), String), - paragraph (List(Text_Option), List(HTML_In_Form) content), - image (List(CoreAttrs), String url, String alternate), - image (List(CoreAttrs), String url, String alternate, Int width, Int height), - table (List(Table_Option), HTML_Header_Row(HTML_In_Form), List(HTML_Row(HTML_In_Form)), HTML_Footer_Row(HTML_In_Form)), - center (HTML_In_Form), - mail_to (String email, HTML_In_Form element), - scroller (Int width, Int height, - Int content_width, Int content_height, - HTML_In_Form content), - actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, - WEB_Action_Name action_name, List((String,String)) extra_ops, - List(Actioner_Local_Action)), - foreign_link_new (Actioner_Target, Actioner_Aspect, String url), - foreign_link (List(Text_Option), String url), - foreign_link (List(Text_Option), String url, String name), - private_download (String abs_path, String name, String extra_ext, - Maybe((String,List((String,String)))) action), - text_input (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), - text_input_ro (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), - password_input (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), - text_area (List(TextAreaOption), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width, Int height), - file_upload (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int width), - selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices), - selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices, InitialValue selected), - // List((String,String)) = List((code,name)) where : - // code is the web-arg value - // name appears in selector - selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices), - selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, InitialValue selected), - radio_button (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, WebArgValue value, Bool checked), - radio_button_r (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, WebArgValue value, Bool checked), - check_box (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Bool checked), - check_box_r (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Bool checked), - div (List(CoreAttrs), List(HTML_In_Form) content), - div_empty (List(CoreAttrs)), - hidden (HTML_Id id, WebArgName name, WebArgValue value), - partial (HTML_Partial_Content), - br, - progress (List(CoreAttrs), Int value, Int max), - ol (List(CoreAttrs), List(HTML_In_Form) content), - ul (List(CoreAttrs), List(HTML_In_Form) content), - li (List(CoreAttrs), List(HTML_In_Form) content), - button (List(CoreAttrs), List(HTML_In_Form) content), - i (List(CoreAttrs), String text), - span (List(CoreAttrs), String text), - hr (List(CoreAttrs)) -. 'HTML_In_Form' defines all the elements you may put within a form. We define a @@ -1999,66 +1533,10 @@ url, week . -public type A_href: - href(String href), - href(WEB_Action_Name action, List((String,String)) extra_ops) -. -public type A_target: - _blank, - _self, - _parent, - _top, - framename(String name) -. +//public type HTML_Body:... + -public type HTML_Body:... - -public type HTML_Off_Form: - a (List(CoreAttrs), A_href, A_target, List(HTML_Off_Form) content), - empty, - literal_pt (Printable_tree), - literal (String), - sequence (List(HTML_Off_Form) items), - text (List(CoreAttrs), String the_text), - preformated (List(Text_Option), String), - table (List(Table_Option), HTML_Header_Row(HTML_Off_Form), List(HTML_Row(HTML_Off_Form)), HTML_Footer_Row(HTML_Off_Form)), - center (HTML_Off_Form), - mail_to (String email, HTML_Off_Form element), - scroller (Int width, Int height, - Int content_width, Int content_height, - HTML_Off_Form content), - fixed_size (HTML_Size width, HTML_Size height, HTML_Off_Form content), - fixed_size_2 (HTML_Size width, HTML_Size height, String name_of_HTML_file), - actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, - WEB_Action_Name action_name, List((String,String)) extra_ops, - List(Actioner_Local_Action)), - actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, - WEB_Action_Name action_name, List((String,String)) extra_ops, - List(Actioner_Local_Action), String form_name), - foreign_link_new (Actioner_Target, Actioner_Aspect, String url), - foreign_link (List(Text_Option), String url), - foreign_link (List(Text_Option), String url, String name), - private_download (String abs_path, String name, String extra_ext, - Maybe((String,List((String,String)))) action), - label (String name), - form (HTML_Id form_id, List(CoreAttrs), List(HTML_In_Form) content), - form (HTML_Id form_id, List(CoreAttrs), - WEB_Action_Name action, List((String,String)) extra_ops, - List(HTML_In_Form) content), - in_form (HTML_Id form_id, HTML_In_Form content), - div (List(CoreAttrs), List(HTML_Partial_Content) p_content), - iframe (List(CoreAttrs), - List(CSS_Style) /*styles*/, - List(CSS_File) /*css_files*/, - List(JS_File) /*js_files*/, - HTML_Body /*body*/), - partial (HTML_Partial_Content), - progress (List(CoreAttrs), Int value, Int max), - i (List(CoreAttrs), String text), - html_tag (String tag_name, List(CoreAttrs), List(HTML_Off_Form) content), - html_void_tag (String tag_name, List(CoreAttrs)) -. 'HTML_Off_Form' defines all the elements you may put outside any form. @@ -2688,17 +2166,7 @@ define Printable_tree -public type HTML_Meta: - keywords (List(String)), - refresh (Actioner_Connection connection, - Actioner_Target target, - WEB_Action_Name action, - Int delay), // in seconds - refresh (String url, Int delay), // in seconds - meta (String name, String content), - http_equiv (String name, String content), - generic_meta (List((String,String))), - literal (String). + Meta tags are put in the 'head' of the HTML page. @@ -2715,49 +2183,9 @@ public define HTML_Meta -public type Body_Option: - core_attrs(List(CoreAttrs)), - background_color (RGB), - background_image (String url), - background_image (String url, List(BackgroundOption)). - -public type HTML_Body: - body(List(Body_Option) options, HTML_Off_Form content). - - -public type HTTP_Answer: - html_page (HTTP_Status /*http_status*/, - List(HTML_Head_Tag) /*html tags*/, - HTML_Body /*body*/), - html_page (HTTP_Status /*http_status*/, - String /*title*/, - List(HTML_Meta) /*meta_tags*/, - List(CSS_Style) /*styles*/, - List(CSS_File) /*css_files*/, - List(JS_File) /*js_files*/, - List(Script) /*script*/, - HTML_Body /*body*/), - plain_text (HTTP_Status /*http_status*/, - String /*text*/), - custom_text (HTTP_Status /*http_status*/, - MIME /*mime_type*/, - String /*content*/), - custom_binary(HTTP_Status /*http_status*/, - MIME /*mime_type*/, - ByteArray /*content*/, - List(HTTP_header)/*other headers*/), - custom_tree (HTTP_Status /*http_status*/, - MIME /*mime_type*/, - Printable_tree /*content*/), - json (HTTP_Status, /*http_status*/ - JsonValue), /*json value*/ - send_file ( String file_path, //file to send to client. //TODO add call back for before, during, after send - Content_Disposition c_disposition), - http_raw (Printable_tree), - html_content (HTTP_Status /*http_status*/, - HTML_Off_Form), - html_partial_content (HTTP_Status /*http_status*/, - HTML_Partial_Content). + + + public define HTTP_Answer @@ -3737,13 +3165,22 @@ define HTTP_Answer ) . +public type WEB_Page_Renderer: + web_page_renderer( + String app, //application + String name, //renderer name + (WEB_Session _session, List(WEB_Plugin), HTML_Partial_Content _content) -> HTTP_Answer page_layout //call back for rendering page + ) +. + define WEB_Page_Renderer default_page_renderer = - web_page_renderer("AWS_DEFAULT_PAGE", + web_page_renderer("AWS", "AWS_DEFAULT_PAGE", ( WEB_Session _session, - String _title, + List(WEB_Plugin) _plugins, HTML_Partial_Content _content ) |-> + with _title = get_page_title(_session), html_page ( http_ok, @@ -3856,9 +3293,10 @@ define WEB_Page_Renderer default_page_renderer, [h . t] then if h.name = renderer_name then - //println("Controller ["+controller_name+"] found"); + println("renderer_name ["+renderer_name+"] found"); h else + println("renderer_name "+renderer_name+" not matching"); get_page_renderer(renderer_name, t, logger) } . @@ -3872,7 +3310,7 @@ define WEB_Page_Renderer (LogLevel, String) -> One logger //logger )= //get the renderer page name to use from the session "AWS_PAGE_RENDERER" - if get_String(_session.fields, "AWS_PAGE_RENDERER") is + if get_String(_session.fields, "AWS_CURRENT_PAGE_RENDERER") is { failure then logger(logWarning, "No renderer defined, use the default"); default_page_renderer, success(renderer_name) then @@ -3892,6 +3330,7 @@ define (Maybe(WEB_Session), HTTP_Answer) apply_controller_action ( WEB_Controller controller, + List(WEB_Plugin) plugins, List(WEB_Controller) controllers, WEB_Page_Renderer _current_page_renderer, List(WEB_Page_Renderer) page_renderers, @@ -3919,7 +3358,7 @@ define (Maybe(WEB_Session), HTTP_Answer) if get_controller(get_String(*new_session.web_request.lwa, "aws_controller", "root"), controllers, logger) is { failure then (failure, error_page(http_not_found, "Initial Session Controller not found", new_session)), - success(new_controller) then apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, new_session, failure, initial_session, logger), + success(new_controller) then apply_controller_action(new_controller, plugins, controllers, _current_page_renderer, page_renderers, cinfo, new_session, failure, initial_session, logger), }, success(action_name) then logger(logInfo, "ACTION_NAME ["+action_name+"]"); @@ -3931,7 +3370,7 @@ define (Maybe(WEB_Session), HTTP_Answer) if get_controller(get_String(*new_session.web_request.lwa, "aws_controller", "root"), controllers, logger) is { failure then (failure, error_page(http_not_found, "Redirect Controller not found", new_session)), - success(new_controller) then apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, new_session, failure, initial_session, logger), + success(new_controller) then apply_controller_action(new_controller, plugins, controllers, _current_page_renderer, page_renderers, cinfo, new_session, failure, initial_session, logger), }, redirect(new_session, r_controller_name, r_action_name) then @@ -3939,7 +3378,7 @@ define (Maybe(WEB_Session), HTTP_Answer) { failure then (failure, error_page(http_not_found, "Redirect Controller "+r_controller_name+" not found", new_session)), success(new_controller) then - apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, new_session, success(r_action_name), initial_session, logger), + apply_controller_action(new_controller, plugins, controllers, _current_page_renderer, page_renderers, cinfo, new_session, success(r_action_name), initial_session, logger), }, redirect_to_previous then @@ -3948,7 +3387,7 @@ define (Maybe(WEB_Session), HTTP_Answer) failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), success(new_controller) then since _session is web_session(id, lang, entries, _, previous), - apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, web_session(id, lang, entries, previous, previous), failure, initial_session, logger), + apply_controller_action(new_controller, plugins, controllers, _current_page_renderer, page_renderers, cinfo, web_session(id, lang, entries, previous, previous), failure, initial_session, logger), }, redirect_to_previous(entries) then 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) failure then (failure, error_page(http_not_found, "Redirect to previous Controller not found", _session)), success(new_controller) then since _session is web_session(id, lang, _, _, previous), - apply_controller_action(new_controller, controllers, _current_page_renderer, page_renderers, cinfo, web_session(id, lang, entries, previous, previous), failure, initial_session, logger), + apply_controller_action(new_controller, plugins, controllers, _current_page_renderer, page_renderers, cinfo, web_session(id, lang, entries, previous, previous), failure, initial_session, logger), }, //ajax(answer) then (failure, answer), //ajax with modified session that must be saved @@ -3967,10 +3406,10 @@ define (Maybe(WEB_Session), HTTP_Answer) //ajax(content, additional_script) then (failure, json(http_ok, to_html_ajax_content(content, additional_script))), ajax(session, content, additional_script) then (session, json(http_ok, to_html_ajax_content(content, additional_script))), send_file(file_path, c_disposition) then (failure, send_file(file_path, c_disposition)), - renderer_content(session, title, content) then + renderer_content(session, content) then with the_session = if session is {failure then _session, success(__session) then __session}, with page_renderer = get_page_renderer(the_session, _current_page_renderer, page_renderers, logger), - (session, page_renderer.page_layout(the_session, title, content)) + (session, page_renderer.page_layout(the_session, plugins, content)) } } . @@ -3993,7 +3432,8 @@ public define Web_Site Var(List(Web_arg)), Bool is_https) -> WEB_Session expired_session, Var(List(WEB_Controller)) web_controllers, - Var(List(WEB_Page_Renderer)) web_page_renderers, + Var(List(WEB_Page_Renderer)) web_page_renderers, + Var(List(WEB_Plugin)) web_plugins, Maybe(WEB_Session) -> List(HTTP_header) additional_headers, List(HTTP_header) constant_additional_headers, Int timeout, @@ -4024,6 +3464,7 @@ public define Web_Site // TODO 'make_separate_web_args_function' must retrieve state_cookies before parsing web_args if using_state_cookies is true with save_session = make_save_session_function(timeout, state_directory, logger), with current_page_renderer = var((WEB_Page_Renderer)default_page_renderer), + // with left_menu_list = get_left_menu_from_plugins(*web_plugins), // retrieve_session = make_retrieve_session_function(state_directory, website_name), //separate_web_args = make_separate_web_args_function(state_directory, retrieve_state), //apply_action = make_apply_action_function(actions), @@ -4069,7 +3510,7 @@ public define Web_Site (failure, error_page(http_not_found, "Controller not found", current_session)), success(new_controller) then - apply_controller_action(new_controller, *web_controllers, *current_page_renderer, *web_page_renderers, cinfo, current_session, failure, initial_session, logger), + apply_controller_action(new_controller, *web_plugins, *web_controllers, *current_page_renderer, *web_page_renderers, cinfo, current_session, failure, initial_session, logger), } is (mb_new_session, http_answer), diff --git a/web/CXM_web_session.anubis b/web/CXM_web_session.anubis index 3076e52..abf8cab 100644 --- a/web/CXM_web_session.anubis +++ b/web/CXM_web_session.anubis @@ -12,6 +12,16 @@ read calexium_lib/database/db_types.anubis read CXM_common.anubis read CXM_web_dump.anubis + reserved fields keywords + + "AWS" String + "AWS_CURRENT_PAGE_TITLE" String current web page title + "AWS_CURRENT_APP" String current web application + "AWS_CURRENT_SPACE" String current web space in application + "AWS_PAGE_RENDERER" String current + + //"AWS_CURRENT_LEFT_MENU" Left_Menu current left menu on the page + //"AWS_CURRENT_MENU" Menu current menu, on the top of the page public type WEB_Session_Field_Datum: string(String), //fully implented @@ -1075,6 +1085,32 @@ public define One remove_any(fields, word4_t, _field_name) . + + /************************************************/ + "AWS_CURRENT_PAGE_TITLE" String current web page title + "AWS_CURRENT_APP" String current web application + "AWS_CURRENT_SPACE" String current web space in application + "AWS_CURRENT_CONTENT" String current in the web space + "AWS_CURRENT_PAGE_RENDERER" String current page renderer + +public define One set_web_app(WEB_Session s, String n) = replace_String(s.fields, "AWS_CURRENT_APP", n). +public define String get_web_app(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_APP", ""). + +public define One set_web_space(WEB_Session s, String n)= replace_String(s.fields, "AWS_CURRENT_SPACE", n). +public define String get_web_space(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_SPACE", ""). + +public define One set_web_content(WEB_Session s, String n)= replace_String(s.fields, "AWS_CURRENT_CONTENT", n). +public define String get_web_content(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_CONTENT", ""). + +public define One set_page_title(WEB_Session s, String n)= replace_String(s.fields, "AWS_CURRENT_PAGE_TITLE", n). +public define String get_page_title(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_PAGE_TITLE", ""). + +public define One set_renderer(WEB_Session s, String n) = replace_String(s.fields, "AWS_CURRENT_PAGE_RENDERER", n). +public define String get_renderer(WEB_Session s) = get_String (s.fields, "AWS_CURRENT_PAGE_RENDERER", ""). + + + /************************************************/ + public define String dump_WEB_Session_Field ( diff --git a/web/load_content.anubis b/web/load_content.anubis index 4a930c8..67158a0 100644 --- a/web/load_content.anubis +++ b/web/load_content.anubis @@ -7,7 +7,8 @@ */ read system/convert.anubis -read calexium_lib/web/CXM_making_a_web_site.anubis + read calexium_lib/web/CXM_making_a_web_site.anubis +read calexium_lib/web/CXM_web_action.anubis public define String load_content diff --git a/web/plugin/plugin.anubis b/web/plugin/plugin.anubis new file mode 100644 index 0000000..381234c --- /dev/null +++ b/web/plugin/plugin.anubis @@ -0,0 +1,106 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ aka (David RENÉ) + * Date: 30/07/2017 + * Time: 01:33 + * © David RENÉ + */ + +read system/logger.anubis +read app/app_constants.anubis +read calexium_lib/web/widgets/left_menu.anubis +transmit calexium_lib/web/types/making_a_web_site.anubis + read calexium_lib/web/widgets/menu.anubis +read hayamiki_lib/model/database.anubis +read hayamiki_lib/view/view_table_manager_types.anubis + +public type WEB_Plugin: + web_plugin( + String app_name, //application name + String space_name, //space name + //version + (SQLite3DataBase db, HK_Database hk_db, VTM _vtm, (LogLevel, String) -> One logger) -> WEB_Controller get_controller, + (WEB_Session, String type) -> Maybe(HTML_Partial_Content) get_typed_content +// (One dummy) -> Plugin_Left_Menu get_plugin_left_menu +// (One dummy) -> +// (One dummy) -> Message get_API, +// (Message message) -> Message call_API +// (One dummy) -> Menu get_menu, + + ) +. + + +public define Maybe(WEB_Plugin) + load_plugin + ( + String file_name + ) + = + if (LoadAdm(WEB_Plugin))load_adm(file_name) is + { + file_not_found then print("File '"+file_name+"' not found.\n\n");failure, + read_error then print("Error reading file '"+file_name+"'.\n\n");failure, + timeout then print("Timeout when loading '"+file_name+"'.\n\n");failure, + file_damaged then print("File '"+file_name+"' is damaged.\n\n");failure, + bad_version(expected,found) then print("Secondary module '"+file_name+"' doesn't have the same\n"+ + " version ("+found+") as primary module ("+expected+").\n\n");failure, + wrong_type(expected,found) then print("Secondary module '"+file_name+"' has type:\n"+ + found+" while primary module expected:\n"+ + expected+"\n\n");failure, + ok(ptah_plugin) then println("ptah plugin: APP ["+ptah_plugin.app_name+"] SPACE ["+ptah_plugin.space_name+"] loaded ");success(ptah_plugin) + }. + +public define List(WEB_Plugin) + all_plugins + ( + String directory, //directory where search the plugin file below + String plugin_file_mask //mask for loading plugin like "my_app_plugin_*.adm" + ) + = + with files = directory_list(modules_directory, plugin_file_mask), + map_select((String file_name) |-> load_plugin(modules_directory+file_name), files) + //merge_sort(all_list, migration_less) +. + +public define Maybe(WEB_Plugin) + get_WEB_Plugin + ( + List(WEB_Plugin) plugins, + String _app, + String _space + )= + if plugins is + { + [] then failure, + [h . t] then + if h.app_name = _app & h.space_name = _space then + success(h) + else + get_WEB_Plugin(t, _app, _space) + } +. + + + + + public define World_Left_Menu + get_left_menu_from_plugins + ( + List(WEB_Plugin) plugins, + World_Left_Menu current_world + )= + if plugins is + { + [] then current_world, + [h . t] then get_left_menu_from_plugins(t, add_to_World_Left_Menu(current_world, h.get_plugin_left_menu(unique))) + } +. + + public define World_Left_Menu + get_left_menu_from_plugins + ( + List(WEB_Plugin) plugins + )= + get_left_menu_from_plugins(plugins, world_menu([])) +. diff --git a/web/types/making_a_web_site.anubis b/web/types/making_a_web_site.anubis new file mode 100644 index 0000000..49ef7bb --- /dev/null +++ b/web/types/making_a_web_site.anubis @@ -0,0 +1,665 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ aka (David RENÉ) + * Date: 29/05/2019 + * Time: 18:41 + * © David RENÉ + */ +transmit calexium_lib/web/types/web_action_name.anubis +transmit calexium_lib/web/CXM_common.anubis +transmit calexium_lib/web/CXM_web_session.anubis +transmit calexium_lib/web/CXM_multihost_http_server.anubis +transmit calexium_lib/web/CXM_json.anubis +transmit calexium_lib/web/widgets/left_menu.anubis +read web/mime.anubis +read tools/printable_tree.anubis + +public type WEB_Action_Allowed_Protocol: + http, + https, + http_https +. + +public type Web_Action($State): + http_action (String name, // name of action + ($State) -> Bool allow, // true if action allowed + (HTTP_Info http_info, + List(Web_arg) web_args, // actually only 'operands' web arguments + $State state) -> $State do_it), + https_action (String name, // name of action + ($State) -> Bool allow, // true if action allowed + (HTTP_Info http_info, + List(Web_arg) web_args, // actually only 'operands' web arguments + $State state) -> $State do_it), + http_https_action (String name, + ($State) -> Bool allow, + (HTTP_Info http_info, + List(Web_arg) web_args, + $State state) -> $State do_it) +. + + This indicate the way of reading text. +public type Reading_Way: + ltr, //the text is readable from "Left To Right" like english + rtl //the text is readable from "Right To Left" like arabic +. + +public type CSS_File_Media: + screen, //Intended for non-paged computer screens. + tty, //Intended for media using a fixed-pitch character grid, such as teletypes, terminals, or portable devices with limited display capabilities. + tv, //Intended for television-type devices (low resolution, color, limited scrollability). + projection, //Intended for projectors. + handheld, //Intended for handheld devices (small screen, monochrome, bitmapped graphics, limited bandwidth). + print, //Intended for paged, opaque material and for documents viewed on screen in print preview mode. + braille, //Intended for braille tactile feedback devices. + aural, //Intended for speech synthesizers. + all. //Suitable for all devices. + +public type HtmlEvents: + // Window Event Attributes + onafterprint, //HTML5 Script to be run after the document is printed + onbeforeprint, //HTML5 Script to be run before the document is printed + onbeforeunload, //HTML5 Script to be run when the document is about to be unloaded + onerror, //HTML5 Script to be run when an error occurs + onhashchange, //HTML5 Script to be run when there has been changes to the anchor part of the a URL + onload, // Fires after the page is finished loading + onmessage, //HTML5 Script to be run when the message is triggered + onoffline, //HTML5 Script to be run when the browser starts to work offline + ononline, //HTML5 Script to be run when the browser starts to work online + onpagehide, //HTML5 Script to be run when a user navigates away from a page + onpageshow, //HTML5 Script to be run when a user navigates to a page + onpopstate, //HTML5 Script to be run when the window's history changes + onresize, //HTML5 Fires when the browser window is resized + onstorage, //HTML5 Script to be run when a Web Storage area is updated + onunload, // Fires once a page has unloaded (or the browser window has been closed) + // Form element events + onblur, // Fires the moment that the element loses focus + onchange, // Fires the moment when the value of the element is changed + oncontextmenu, //HTML5 Script to be run when a context menu is triggered + onfocus, // Fires the moment when the element gets focus + oninput, //HTML5 Script to be run when an element gets user input + oninvalid, //HTML5 Script to be run when an element is invalid + onreset, // Fires when the Reset button in a form is clicked + onsearch, // Fires when the user writes something in a search field (for ) + onselect, // Fires after some text has been selected in an element + onsubmit, // Fires when a form is submitted + // Keyboard events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) + onkeydown, // Fires when a user is pressing a key + onkeypress, // Fires when a user presses a key + onkeyup, // Fires when a user releases a key + // Mouse events (Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.) + onclick, // Fires on a mouse click on the element + ondblclick, // Fires on a mouse double-click on the element + onmousedown, // Fires when a mouse button is pressed down on an element + onmousemove, // Fires when the mouse pointer is moving while it is over an element + onmouseout, // Fires when the mouse pointer moves out of an element + onmouseover, // Fires when the mouse pointer moves over an element + onmouseup, // Fires when a mouse button is released over an element + onwheel, //HTML5 Fires when the mouse wheel rolls up or down over an element + //Drag Events + ondrag, //HMTL5 Script to be run when an element is dragged + ondragend, //HTML5 Script to be run at the end of a drag operation + ondragenter, //HTML5 Script to be run when an element has been dragged to a valid drop target + ondragleave, //HTML5 Script to be run when an element leaves a valid drop target + ondragover, //HTML5 Script to be run when an element is being dragged over a valid drop target + ondragstart, //HTML5 Script to be run at the start of a drag operation + ondrop, //HTML5 Script to be run when dragged element is being dropped + onscroll, //HTML5 Script to be run when an element's scrollbar is being scrolled + //Clipboard Events + oncopy, //HTML5 Fires when the user copies the content of an element + oncut, //HTML5 Fires when the user cuts the content of an element + onpaste, //HTML5 Fires when the user pastes some content in an element + //Media Events + onabort, //HTML5 Script to be run on abort + oncanplay, //HTML5 Script to be run when a file is ready to start playing (when it has buffered enough to begin) + oncanplaythrough, //HTML5 Script to be run when a file can be played all the way to the end without pausing for buffering + oncuechange, //HTML5 Script to be run when the cue changes in a element + ondurationchange, //HTML5 Script to be run when the length of the media changes + onemptied, //HTML5 Script to be run when something bad happens and the file is suddenly unavailable (like unexpectedly disconnects) + onended, //HTML5 Script to be run when the media has reach the end (a useful event for messages like "thanks for listening") + onerror, //HTML5 Script to be run when an error occurs when the file is being loaded + onloadeddata, //HTML5 Script to be run when media data is loaded + onloadedmetadata, //HTML5 Script to be run when meta data (like dimensions and duration) are loaded + onloadstart, //HTML5 Script to be run just as the file begins to load before anything is actually loaded + onpause, //HTML5 Script to be run when the media is paused either by the user or programmatically + onplay, //HTML5 Script to be run when the media is ready to start playing + onplaying, //HTML5 Script to be run when the media actually has started playing + onprogress, //HTML5 Script to be run when the browser is in the process of getting the media data + 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) + onseeked, //HTML5 Script to be run when the seeking attribute is set to false indicating that seeking has ended + onseeking, //HTML5 Script to be run when the seeking attribute is set to true indicating that seeking is active + onstalled, //HTML5 Script to be run when the browser is unable to fetch the media data for whatever reason + onsuspend, //HTML5 Script to be run when fetching the media data is stopped before it is completely loaded for whatever reason + 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) + onvolumechange, //HTML5 Script to be run each time the volume is changed which (includes setting the volume to "mute") + 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) + //Misc Events + onshow, //HTML5 Fires when a element is shown as a context menu + ontoggle. //HTML5 Fires when the user opens or closes the
element + + +public type CSS_File: + css_file(String file_name, CSS_File_Media). + +public type JS_Attribute: + attr (String, String). + +public type JS_File: + js_file(String file_name, + List(JS_Attribute) attributes). + +public type Script: + script( String script_type, + String content). + +public type CoreAttrs:... +public type HTML_Partial_Content:... +public type HTML_Body:... +public type HTML_Off_Form:... +public type HTML_tooltip:... +public type HTTP_Answer:... + + +public type Text_Option: + core_attrs(List(CoreAttrs)), + size(Int), // size of character font to use + font(String), // name of character font to use (such as "helvetica",...) + color(RGB), // color to be used for characters + italic, + oblique, + small_capitals, + bold, + underlined, + left_justified, + right_justified, + justified, // justified on both sides + line_through, + nowrap, + class(String), //CSS class + id(String), + style(String), + title(String), + attr(String, String). + +public type CSS_Style: + text_options(List(Text_Option)). + +// Following types are define to prohib any arguments order error + +/** + * String value for 'id' attribut + */ +public type HTML_Id: + html_Id(String id). + +/** + * String value for 'class' attribut + */ +public type HtmlClass: + htmlClass(String class). + +/** + * Name used in arguments list when form is submitted. + */ +public type WebArgName: + wan(String name). + +/** + * Value passed to arguments list when form is submitted (for RadioButton and CheckBox). + */ +public type WebArgValue: + wav(String value). + +/** + * Initial value of an input field. + */ +public type InitialValue: + init(String value). + +public type HTML_Help_Position: + left, + right +. + +public type HTML_Help: + no_help, //no help text available + tooltip(HTML_tooltip, + HTML_Help_Position) +. + +public type HTML_Label: + no_label, + label( + String text, //label to show + HTML_Help help //HTML help (tooltip with ajax call or not) + ) +. + +public type InputAttrs: + id (String), + class (String), + style (String), + title (String), + lang (String), + dir (Reading_Way), + accesskey (Word8), + tabindex (Int), + attr (String, String), + event (HtmlEvents, String), + //HTML5 + data (String name, String value). + +public type TextAreaOption: + input_attrs(List(InputAttrs)), + disabled, + read_only, + wrap_lines +. + +public type Actioner_Local_Action: + close_window. + +public type Actioner_Connection: + same, // use same type of connection as current page + http, // use non secured connection + https. // use secured connection + +public type Other_Window_Option: + resizable, // the new window may be resized by the client + scrollbars, // the new window has scrollbars + width(Int), // the new window has the specified width + height(Int). // the new window has the specified height + +public type Actioner_Target: + same, + same (String label), + other(String window_name, List(Other_Window_Option)). + +public type Actioner_Aspect: + link (List(Text_Option), String text, Maybe(String) name),// hypertext link + img_link (List(CoreAttrs),String img_url, String alt_text), + push_button (List(CoreAttrs),String text), + button (String url_off, String url_on), // rollover button + button (String url_off, String url_on, Int w, Int h), // idem with size + submit (List(CoreAttrs),String text), + immediate_selector (List(CoreAttrs),WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, Maybe(InitialValue) selected, String onchange_fn), + html (List(CoreAttrs), HTML_Off_Form). + +public type BackgroundOption: + repeat, // repeat the background in both directions + repeat_horizontal, // repeat the background only horizontally + repeat_vertical, // repeat the background only verticall + no_repeat, // don't repeat the background + center. + +public type Cell_Option: + core_attrs(List(CoreAttrs)), + left, // put the content of the cell on the left + h_center, // center the content of the cell horizontally + right, // put the content of the cell on the right + top, // put the content of the cell upwards + v_center, // center the content of tye cell vertically, + bottom, // put the content of the cell downwards + base_line, // align the content vertically according to base lines + background_color(RGB), + background_image(String url, BackgroundOption), + width(Int), // sets a minimal width for the cell + percentage_width(Int), + height(Int), // sets a minimal height for the cell + columns(Int), // lets the cell span over several columns + rows(Int), // lets the cell span over several rows + nowrap, // do not allow text wrapping within the cell + style(String), // in case nothing above is suitable + class(String class_name). + +public type HTML_Cell($T): + cell(List(Cell_Option) options, $T content). + +public type HTML_Footer_Row($T): + empty, + footer_row(List(Cell_Option) options, List(HTML_Cell($T)) cells). + +public type HTML_Row($T): + row(List(Cell_Option) options, List(HTML_Cell($T)) cells). + +public type HTML_Header_Cell($T): + header_cell(List(Cell_Option) options, $T content). + +public type HTML_Header_Row($T): + empty, + header_row(List(Cell_Option) options, List(HTML_Header_Cell($T)) cells). + + +public type Table_Option: + core_attrs(List(CoreAttrs)), + background_color(RGB), // applied to all cells in the table + background_image(String url), + border(Int width_of_outer_edge, // if not present, all values are 0 + Int width_of_top_of_relief, + Int width_of_inner_edge, + RGB border_color), + width(Int), // sets a minimal width for the table + percentage_width(Int), + attr(String name, String value), + class(String class_name). + + +public type HTML_In_Form: + empty, + literal_pt (Printable_tree), + literal (String), + sequence (List(HTML_In_Form) items), + text (List(CoreAttrs), String the_text), + preformated (List(Text_Option), String), + paragraph (List(Text_Option), List(HTML_In_Form) content), + image (List(CoreAttrs), String url, String alternate), + image (List(CoreAttrs), String url, String alternate, Int width, Int height), + table (List(Table_Option), HTML_Header_Row(HTML_In_Form), List(HTML_Row(HTML_In_Form)), HTML_Footer_Row(HTML_In_Form)), + center (HTML_In_Form), + mail_to (String email, HTML_In_Form element), + scroller (Int width, Int height, + Int content_width, Int content_height, + HTML_In_Form content), + actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, + WEB_Action_Name action_name, List((String,String)) extra_ops, + List(Actioner_Local_Action)), + foreign_link_new (Actioner_Target, Actioner_Aspect, String url), + foreign_link (List(Text_Option), String url), + foreign_link (List(Text_Option), String url, String name), + private_download (String abs_path, String name, String extra_ext, + Maybe((String,List((String,String)))) action), + text_input (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), + text_input_ro (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), + password_input (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width), + text_area (List(TextAreaOption), HTML_Label label, HTML_Id id, WebArgName name, InitialValue init, Int width, Int height), + file_upload (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int width), + selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices), + selector (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List(String) choices, InitialValue selected), + // List((String,String)) = List((code,name)) where : + // code is the web-arg value + // name appears in selector + selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices), + selector_c (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Int size, List((List(CoreAttrs),WebArgValue,String)) choices, InitialValue selected), + radio_button (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, WebArgValue value, Bool checked), + radio_button_r (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, WebArgValue value, Bool checked), + check_box (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Bool checked), + check_box_r (List(CoreAttrs), HTML_Label label, HTML_Id id, WebArgName name, Bool checked), + div (List(CoreAttrs), List(HTML_In_Form) content), + div_empty (List(CoreAttrs)), + hidden (HTML_Id id, WebArgName name, WebArgValue value), + partial (HTML_Partial_Content), + br, + progress (List(CoreAttrs), Int value, Int max), + ol (List(CoreAttrs), List(HTML_In_Form) content), + ul (List(CoreAttrs), List(HTML_In_Form) content), + li (List(CoreAttrs), List(HTML_In_Form) content), + button (List(CoreAttrs), List(HTML_In_Form) content), + i (List(CoreAttrs), String text), + span (List(CoreAttrs), String text), + hr (List(CoreAttrs)) +. + +public type HTML_Size: + absolute(Int), // in pixels + percentage(Int). + +public type A_href: + href(String href), + href(WEB_Action_Name action, List((String,String)) extra_ops) +. + +public type A_target: + _blank, + _self, + _parent, + _top, + framename(String name) +. + + +public type HTML_Off_Form: + a (List(CoreAttrs), A_href, A_target, List(HTML_Off_Form) content), + empty, + literal_pt (Printable_tree), + literal (String), + sequence (List(HTML_Off_Form) items), + text (List(CoreAttrs), String the_text), + preformated (List(Text_Option), String), + table (List(Table_Option), HTML_Header_Row(HTML_Off_Form), List(HTML_Row(HTML_Off_Form)), HTML_Footer_Row(HTML_Off_Form)), + center (HTML_Off_Form), + mail_to (String email, HTML_Off_Form element), + scroller (Int width, Int height, + Int content_width, Int content_height, + HTML_Off_Form content), + fixed_size (HTML_Size width, HTML_Size height, HTML_Off_Form content), + fixed_size_2 (HTML_Size width, HTML_Size height, String name_of_HTML_file), + actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, + WEB_Action_Name action_name, List((String,String)) extra_ops, + List(Actioner_Local_Action)), + actioner (Actioner_Connection, Actioner_Target, Actioner_Aspect, + WEB_Action_Name action_name, List((String,String)) extra_ops, + List(Actioner_Local_Action), String form_name), + foreign_link_new (Actioner_Target, Actioner_Aspect, String url), + foreign_link (List(Text_Option), String url), + foreign_link (List(Text_Option), String url, String name), + private_download (String abs_path, String name, String extra_ext, + Maybe((String,List((String,String)))) action), + label (String name), + form (HTML_Id form_id, List(CoreAttrs), List(HTML_In_Form) content), + form (HTML_Id form_id, List(CoreAttrs), + WEB_Action_Name action, List((String,String)) extra_ops, + List(HTML_In_Form) content), + in_form (HTML_Id form_id, HTML_In_Form content), + div (List(CoreAttrs), List(HTML_Partial_Content) p_content), + iframe (List(CoreAttrs), + List(CSS_Style) /*styles*/, + List(CSS_File) /*css_files*/, + List(JS_File) /*js_files*/, + HTML_Body /*body*/), + partial (HTML_Partial_Content), + progress (List(CoreAttrs), Int value, Int max), + i (List(CoreAttrs), String text), + html_tag (String tag_name, List(CoreAttrs), List(HTML_Off_Form) content), + html_void_tag (String tag_name, List(CoreAttrs)) +. + +public type HTML_Meta: + keywords (List(String)), + refresh (Actioner_Connection connection, + Actioner_Target target, + WEB_Action_Name action, + Int delay), // in seconds + refresh (String url, Int delay), // in seconds + meta (String name, String content), + http_equiv (String name, String content), + generic_meta (List((String,String))), + literal (String). + +public type HTML_Head_Tag: + meta(HTML_Meta), + title(String), + js(JS_File), + js_inline(Script), + css(CSS_File), + css_inline(String css_styles) /* Note: tags are not necessaries */ + . + + + +public type HTML_Partial_Content: + partial_content + ( + List(HTML_Head_Tag), + HTML_Off_Form + ) +. + +public type Body_Option: + core_attrs(List(CoreAttrs)), + background_color (RGB), + background_image (String url), + background_image (String url, List(BackgroundOption)). + +public type HTML_Body: + body(List(Body_Option) options, HTML_Off_Form content). + +public type WEB_Controller_Result: + http_answer( + WEB_Session session, //modified session + HTTP_Answer http_answer //http answer + ), + http_answer( + HTTP_Answer http_answer //http answer + ), + redirect( //internal redirection, session is modified to call the right controller and action + WEB_Session session + ), + redirect( //internal redirection, session is modified to call the right controller and action + WEB_Session session, + String controller, + String action_name + ), + redirect_to_previous, + redirect_to_previous( + Var(List(WEB_Session_Field)) fields + ), + ajax( + Maybe(WEB_Session) mb_session, //modified session if success else failure + HTTP_Answer http_answer //http answer + ), + ajax( + Maybe(WEB_Session) mb_session, //modified session if success else failure + HTML_Partial_Content content, + String additional_script + ), + ajax( + Maybe(WEB_Session) mb_session, //modified session if success else failure + Printable_tree content, + String additional_script + ), + send_file( + String full_path, //full path with file name of the file to send + Content_Disposition content_disposition //in which form the file must consider by the client (inline: try to display to user, attachment: save as file) + ), + renderer_content( + Maybe(WEB_Session) mb_session, //modified session if success else failure + //String title, + //Left_Menu left_menu, + HTML_Partial_Content content + ) + //redraw with the current renderer, the given content +// redraw( +// Maybe(WEB_Session) mb_session, //modified session if success else failure +// HTML_Partial_Content content +// ) +. + +public type WEB_Action: + web_action( + WEB_Action_Name name, // name of action + WEB_Action_Allowed_Protocol allowed_proto, + (WEB_Session) -> Bool allow, // true if action allowed + (WEB_Session) -> WEB_Controller_Result do_it + ) +. + + +public type HTML_tooltip: + html_tooltip + ( + String title, + String keyword, + Int width, + ), + html_tooltip_ext + ( + String title, + String extend_type, + String class_suffix, + List((String, String)) ext_args + ), + html_tooltip_ext //same without class suffix. This means we use awesome font + ( + String title, + String extend_type, + List((String, String)) ext_args + ), + html_tooltip + ( + String title, + WEB_Action_Name wan, + List((String, String)) ext_args + ). + + +public type CoreAttrs: + empty, + id (String), //A unique identifier for the element. + //There must not be multiple elements in a document that have the same id value. + class (String), //A name of a classification, or list of names of classifications, to which the element belongs + style (String), //Specifies zero or more CSS declarations that apply to the element [CSS]. + title (String), //Advisory information associated with the element. + lang (String), //Specifies the primary language for the contents of the element and for any of the element’s attributes that contain text. + dir (Reading_Way), //Specifies the element’s text directionality. + accesskey (Word8), //A key label or list of key labels with which to associate the element; each key label represents + //a keyboard shortcut which UAs can use to activate the element or give focus to the element. + tabindex (Int), //Specifies whether the element represents an element that is is focusable (that is, an element which is part of the + //sequence of focusable elements in the document), and the relative order of the element in the sequence of focusable + //elements in the document. + //Anubis specific + attr (String, String), //intended to provide unknown attritute + event (HtmlEvents, String), + tooltip (HTML_tooltip), + + //HTML5 + data (String name, String value), + contenteditable(Bool), //Specifies whether the contents of the element are editable + contextmenu(String), //Identifies a menu with which to associate the element as a context menu. + draggable(Bool), //Specifies whether the element is draggable. + hidden(Bool), //Specifies that the element represents an element that is not yet, or is no longer, relevant. + spellcheck(Bool) //Specifies whether the element represents an element whose contents are subject to spell checking and grammar checking. +. + +public type HTTP_Answer: + html_page (HTTP_Status /*http_status*/, + List(HTML_Head_Tag) /*html tags*/, + HTML_Body /*body*/), + html_page (HTTP_Status /*http_status*/, + String /*title*/, + List(HTML_Meta) /*meta_tags*/, + List(CSS_Style) /*styles*/, + List(CSS_File) /*css_files*/, + List(JS_File) /*js_files*/, + List(Script) /*script*/, + HTML_Body /*body*/), + plain_text (HTTP_Status /*http_status*/, + String /*text*/), + custom_text (HTTP_Status /*http_status*/, + MIME /*mime_type*/, + String /*content*/), + custom_binary(HTTP_Status /*http_status*/, + MIME /*mime_type*/, + ByteArray /*content*/, + List(HTTP_header)/*other headers*/), + custom_tree (HTTP_Status /*http_status*/, + MIME /*mime_type*/, + Printable_tree /*content*/), + json (HTTP_Status, /*http_status*/ + JsonValue), /*json value*/ + send_file ( String file_path, //file to send to client. //TODO add call back for before, during, after send + Content_Disposition c_disposition), + http_raw (Printable_tree), + html_content (HTTP_Status /*http_status*/, + HTML_Off_Form), + html_partial_content (HTTP_Status /*http_status*/, + HTML_Partial_Content) +. + +public type WEB_Controller: + web_controller( + String name, //controller name + Var(List(WEB_Action)) controller_actions, //list of all actions of that controller + (WEB_Session)-> WEB_Controller_Result error //Error renderer + ) +. + diff --git a/web/widgets/left_menu.anubis b/web/widgets/left_menu.anubis index d241c87..ba6f2bd 100644 --- a/web/widgets/left_menu.anubis +++ b/web/widgets/left_menu.anubis @@ -7,7 +7,8 @@ */ transmit tools/basis.anubis -read calexium_lib/web/CXM_making_a_web_site.anubis + read calexium_lib/web/CXM_web_action.anubis +read calexium_lib/web/CXM_web_action.anubis read system/string.anubis public type Left_Menu_Entry: @@ -36,11 +37,103 @@ public type Left_Menu: public type Plugin_Left_Menu: plugin_left_menu( - String name, //plug in name + String app, //application name + String space, //space name Left_Menu left_menu ) . +public type Space_Left_Menu: + space_menu( + String name, + Left_Menu menu + ) +. + +public type App_Left_Menu: + app_menu( + String name, + List(Space_Left_Menu) space_menu_list + ) +. + +public type World_Left_Menu: + world_menu( + List(App_Left_Menu) app_menu_list + ) +. + +public define List(Space_Left_Menu) + add_to_space + ( + List(Space_Left_Menu) space_list, + List(Space_Left_Menu) so_far, + String space_name, + Left_Menu left_menu + )= + if space_list is + { + [] then [space_menu(space_name, left_menu)], + [h . t] then + if h.name = space_name then // if we found the same name we replace it into the list + [space_menu(space_name, left_menu) . so_far]+t + else + add_to_space(t, [h . so_far], space_name, left_menu) + } +. + +public define World_Left_Menu + add_to_app + ( + List(App_Left_Menu) app_list, + List(App_Left_Menu) so_far, + String app_name, + String space_name, + Left_Menu left_menu + )= + if app_list is + { + [] then world_menu([app_menu(app_name, [space_menu(space_name, left_menu)]) . so_far]), + [h . t] then + if h.name = app_name then + world_menu([app_menu(app_name, add_to_space(h.space_menu_list, [], space_name, left_menu)) . so_far]+t) + else + add_to_app(t, [h . so_far], app_name, space_name, left_menu) + } +. + +public define World_Left_Menu + add_to_World_Left_Menu + ( + World_Left_Menu w_left_menu, + Plugin_Left_Menu p_left_menu + )= + since p_left_menu is plugin_left_menu(app, space, l_menu), + + add_to_app(w_left_menu.app_menu_list, [], app, space, l_menu) +. + +public define World_Left_Menu + add_to_World_Left_Menu + ( + World_Left_Menu current_world, + List(Plugin_Left_Menu) p_left_menu + )= + if p_left_menu is + { + [] then current_world, + [h . t] then add_to_World_Left_Menu(add_to_World_Left_Menu(current_world, h), t) + } +. + +public define World_Left_Menu + add_to_World_Left_Menu + ( + List(Plugin_Left_Menu) p_left_menu + )= + add_to_World_Left_Menu(world_menu([]), p_left_menu) +. + public define Left_Menu_Entry left_menu_entry ( @@ -122,48 +215,3 @@ public define Left_Menu_Entry )= title(title_id, [], text). -define List(HTML_Off_Form) - make_left_menu - ( - (String) -> String _T, //translator function - List(Left_Menu_Entry) entries, - String selected, - List(HTML_Off_Form) so_far - )= - if entries is - { - [] then reverse(so_far), //reverse to be in the right direction - [h . t] then - with entry = - if h is - { - left_menu_entry(_menu_id, _classes, _action, _text, _extra, _target_id) then - if _target_id is - { - 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)), - success(target_id) then - p([class("item "+_menu_id+"_icon"+if _menu_id=selected then " selected" else ""+ " "+join(" ", _classes)), - event(onclick, "CalexiumToolBox.ajax_load_content('"+target_id+"', "+format_web_action_name_to_js(_action, _extra)+")")],text(_T(_text))), - } - - title(_title_id, _classes, _text) then - p([class("menu_title"), class(if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) -// p([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) - }, - make_left_menu(_T, t, selected, [ entry . so_far]) - }. - -public define HTML_Partial_Content - make_left_menu - ( - (String) -> String _T, //translator function - Left_Menu l_menu - )= - if l_menu is - { - no_left_menu then partial_content(empty), - left_menu(entries, selected) then - partial_content([css(css_file("/css/left_menu.css"))], - sequence(make_left_menu(_T, entries, selected, []))) - }. - diff --git a/web/widgets/left_menu_html.anubis b/web/widgets/left_menu_html.anubis new file mode 100644 index 0000000..71bf919 --- /dev/null +++ b/web/widgets/left_menu_html.anubis @@ -0,0 +1,59 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ aka (David RENÉ) + * Date: 29/05/2019 + * Time: 17:26 + * © David RENÉ + */ + +transmit calexium_lib/web/widgets/left_menu.anubis +read calexium_lib/web/CXM_making_a_web_site.anubis +read calexium_lib/web/CXM_web_action.anubis +read calexium_lib/web/load_content.anubis + +define List(HTML_Off_Form) + make_left_menu + ( + (String) -> String _T, //translator function + List(Left_Menu_Entry) entries, + String selected, + List(HTML_Off_Form) so_far + )= + if entries is + { + [] then reverse(so_far), //reverse to be in the right direction + [h . t] then + with entry = + if h is + { + left_menu_entry(_menu_id, _classes, _action, _text, _extra, _target_id) then + if _target_id is + { + 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)), + success(target_id) then + p([class("item "+_menu_id+"_icon"+if _menu_id=selected then " selected" else ""+ " "+join(" ", _classes)), +// event(onclick, "CalexiumToolBox.ajax_load_content('"+target_id+"', "+format_web_action_name_to_js(_action, _extra)+")")],text(_T(_text))), + event(onclick, load_content(target_id, _action, _extra))],text(_T(_text))), + } + + title(_title_id, _classes, _text) then + p([class("menu_title"), class(if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) +// p([class("menu_title"), class("item "+_title_id+"_icon"+if _title_id=selected then " selected" else ""+ " "+join(" ", _classes))], text([],_T(_text))) + }, + make_left_menu(_T, t, selected, [ entry . so_far]) + }. + +public define HTML_Partial_Content + make_left_menu + ( + (String) -> String _T, //translator function + Left_Menu l_menu + )= + if l_menu is + { + no_left_menu then partial_empty, + left_menu(entries, selected) then + partial_content([css(css_file("/css/left_menu.css"))], + sequence(make_left_menu(_T, entries, selected, []))) + }. + -- libgit2 0.21.4