diff --git a/web_controllers/language/language_management.anubis b/web_controllers/language/language_management.anubis index 1c6d36d..c6a1342 100644 --- a/web_controllers/language/language_management.anubis +++ b/web_controllers/language/language_management.anubis @@ -170,9 +170,9 @@ define HTML_Off_Form String language, String -> String action )= - div([class("clickable"), event(onclick, action(language_code))],[ - img("/xlib/flags/24x24/"+language_code+".png"), - text(language) + div(id(generate_random_string(15)+"_"+language_code), [ + img([class("clickable"), event(onclick, action(language_code))],"/xlib/flags/24x24/"+language_code+".png"), + text([class("clickable"), event(onclick, action(language_code))],language) ]) . @@ -228,17 +228,23 @@ public define HTML_Partial_Content flags_menu(app_dictionnary, lang, show_symbolic) . + public define HTML_Partial_Content choose_lang_dialog ( - String dictionary_collection_name, - String -> String action, - Bool show_symbolic, + String dictionary_collection_name, + String -> String action, + Bool show_symbolic, + List(String) exclude_lang )= with make_line = (L3LangDicProperty dico_prop) |-> if dico_prop is l3LangDicProperty( _, sha1, lang_code, user_def, creat, update) then with lang_info = l3_get_language_info(lang_code), - language_line(lang_code, self_name(lang_info), action), + //if language belong to exclude list, return an empty line + if lang_code:exclude_lang then + empty + else + language_line(lang_code, self_name(lang_info), action), partial_content([ css(css_file("/xlib/css/flags_menu.css")), @@ -266,10 +272,135 @@ public define HTML_Partial_Content choose_lang_dialog ( WEB_Session _session, + String -> String action, + Bool show_symbolic + ) = + with lang = _session.language, + app_dictionnary = get_dictionary(_session), + + choose_lang_dialog(app_dictionnary, action, show_symbolic, []) +. + +public define HTML_Partial_Content + choose_lang_dialog + ( + WEB_Session _session, + String -> String action, + List(String) exclude_lang + ) = + with lang = _session.language, + app_dictionnary = get_dictionary(_session), + + choose_lang_dialog(app_dictionnary, action, false, exclude_lang) +. + +public define HTML_Partial_Content + choose_lang_dialog + ( + WEB_Session _session, String -> String action ) = with lang = _session.language, app_dictionnary = get_dictionary(_session), - choose_lang_dialog(app_dictionnary, action, false) + choose_lang_dialog(app_dictionnary, action, false, []) +. + + /* DROPDOWN part */ + +define HTML_Off_Form + dd_language_line + ( + String language_code, + String language, + String -> String action + )= + li(event(onclick, action(language_code)), [ + img("/xlib/flags/24x24/"+language_code+".png"), + text(language) + ]) +. + +public define HTML_Partial_Content + choose_lang_dropdown + ( + String dictionary_collection_name, + String -> String action, + String image, //Web element on which is sticked the dropdown + Bool on_click, + Bool show_symbolic, + List(String) exclude_lang + )= + with rand_id = generate_random_string(15)+"_flag", + with make_line = (L3LangDicProperty dico_prop) |-> + if dico_prop is l3LangDicProperty( _, sha1, lang_code, user_def, creat, update) then + with lang_info = l3_get_language_info(lang_code), + //if language belong to exclude list, return an empty line + if lang_code:exclude_lang then + empty + else + dd_language_line(lang_code, self_name(lang_info), action), + + partial_content([ + css(css_file("/xlib/css/flags_menu.css")), + js(js_file("/xlib/js/xlib.js")) + ], + [ + img([class("icon_in_text clickable"), event(if on_click then onclick else onmouseover, "showObject('"+rand_id+"');"), event(onmouseout, "hideObject('"+rand_id+"');")], image ), + ul([id(rand_id), class("drop-flag-body"), event(onmouseover, "showObject('"+rand_id+"');"), event(onmouseout, "hideObject('"+rand_id+"');"), style("display: none"), ], + map(make_line, l3_get_all_dicos(dictionary_collection_name))+ + [ + if show_symbolic then + dd_language_line("symb", "symbolic", action) + else + empty + ] + ) + ] + ) +. + +public define HTML_Partial_Content + choose_lang_dropdown + ( + WEB_Session _session, + String -> String action, + String image, //Web element on which is sticked the dropdown + Bool on_click, + Bool show_symbolic + ) = + with lang = _session.language, + app_dictionnary = get_dictionary(_session), + + choose_lang_dropdown(app_dictionnary, action, image, on_click, show_symbolic, []) +. + +public define HTML_Partial_Content + choose_lang_dropdown + ( + WEB_Session _session, + String -> String action, + String image, //Web element on which is sticked the dropdown + Bool on_click, + List(String) exclude_lang + ) = + with lang = _session.language, + app_dictionnary = get_dictionary(_session), + + choose_lang_dropdown(app_dictionnary, action, image, on_click, false, exclude_lang) +. + +public define HTML_Partial_Content + choose_lang_dropdown + ( + WEB_Session _session, // + String -> String action, //web action function to call when language is choosen + String image, //Web element on which is sticked the dropdown + Bool on_click //true if the dropdown shown on click event else it's on mouseover + + ) = + with lang = _session.language, + app_dictionnary = get_dictionary(_session), + + choose_lang_dropdown(app_dictionnary, action, image, on_click, false, []) . -- libgit2 0.21.4