/* * Created by PyramIDE. * User: フランスのトトロ * Date: 10/01/2016 * Time: 12:24 * © Calexium */ transmit tools/basis.anubis read calexium_lib/web/CXM_making_a_web_site.anubis read system/string.anubis public type Left_Menu_Entry: left_menu_entry( //MENU entry hence no selectable String entry_id, //it's also use as icon prefix List(String) classes, //additional classes if need (for disabling entry, change background color, etc.) WEB_Action_Name action, //action (url to apply when click String text, //text to show List((String, String)) extra, //extra web arguments to send when click Maybe(String) target_id //target_id use during load_content ), title( //TITLE entry hence no selectable String title_id, //it's also use as icon prefix List(String) classes, //additional classes if need (change background color, font size, etc.) String text //text to show ) . public type Left_Menu: no_left_menu, left_menu( List(Left_Menu_Entry) entries, String selected ) . public type Plugin_Left_Menu: plugin_left_menu( String name, //plug in name Left_Menu left_menu ) . public define Left_Menu_Entry left_menu_entry ( String entry_id, WEB_Action_Name action, String text )= left_menu_entry(entry_id, [], action, text, [], failure) . public define Left_Menu_Entry left_menu_entry ( String entry_id, String action, String text )= left_menu_entry(entry_id, [], action_name(action), text, [], failure) . public define Left_Menu_Entry left_menu_entry ( String entry_id, //it's also use as icon prefix WEB_Action_Name action, //action (url to apply when click String text, //text to show List((String, String)) extra //extra web arguments to send when click )= left_menu_entry(entry_id, [], action, text, extra, failure) . public define Left_Menu_Entry left_menu_entry ( String entry_id, //it's also use as icon prefix WEB_Action_Name action, //action (url to apply when click String text, //text to show List((String, String)) extra, //extra web arguments to send when click String target_id )= left_menu_entry(entry_id, [], action, text, extra, success(target_id)) . public define Left_Menu_Entry left_menu_entry ( String entry_id, //it's also use as icon prefix String action, //action (url to apply when click String text, //text to show List((String, String)) extra //extra web arguments to send when click )= left_menu_entry(entry_id, [], action_name(action), text, extra, failure) . public define Left_Menu_Entry left_menu_entry ( String entry_id, //it's also use as icon prefix String action, //action (url to apply when click String text, //text to show List((String, String)) extra, //extra web arguments to send when click String target_id )= left_menu_entry(entry_id, [], action_name(action), text, extra, success(target_id)) . public define Left_Menu_Entry title ( String text )= title("", [], text). public define Left_Menu_Entry title ( String title_id, String text )= 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, []))) }.