Commit cebdf6b741e45dcc0d60b51891690681cb4b09bb
1 parent
e782d548
[+] add dialog showing available language. The argument 'action' is a call back …
…for action when one of the flag is clicked. Generally it's javascript function call during onclick event. So this function action let add at the end the language argument into javascript calling function.
Showing
1 changed file
with
59 additions
and
0 deletions
Show diff stats
web_controllers/language/language_management.anubis
| ... | ... | @@ -163,6 +163,19 @@ define HTML_Off_Form |
| 163 | 163 | event(onclick, "language_changed('"+language_code+"');")], text(language)) |
| 164 | 164 | . |
| 165 | 165 | |
| 166 | +define HTML_Off_Form | |
| 167 | + language_line | |
| 168 | + ( | |
| 169 | + String language_code, | |
| 170 | + String language, | |
| 171 | + String -> String action | |
| 172 | + )= | |
| 173 | + div([class("clickable"), event(onclick, action(language_code))],[ | |
| 174 | + img("/xlib/flags/24x24/"+language_code+".png"), | |
| 175 | + text(language) | |
| 176 | + ]) | |
| 177 | +. | |
| 178 | + | |
| 166 | 179 | public define HTML_Partial_Content |
| 167 | 180 | flags_menu |
| 168 | 181 | ( |
| ... | ... | @@ -214,3 +227,49 @@ public define HTML_Partial_Content |
| 214 | 227 | |
| 215 | 228 | flags_menu(app_dictionnary, lang, show_symbolic) |
| 216 | 229 | . |
| 230 | + | |
| 231 | +public define HTML_Partial_Content | |
| 232 | + choose_lang_dialog | |
| 233 | + ( | |
| 234 | + String dictionary_collection_name, | |
| 235 | + String -> String action, | |
| 236 | + Bool show_symbolic, | |
| 237 | + )= | |
| 238 | + with make_line = (L3LangDicProperty dico_prop) |-> | |
| 239 | + if dico_prop is l3LangDicProperty( _, sha1, lang_code, user_def, creat, update) then | |
| 240 | + with lang_info = l3_get_language_info(lang_code), | |
| 241 | + language_line(lang_code, self_name(lang_info), action), | |
| 242 | + | |
| 243 | + partial_content([ | |
| 244 | + css(css_file("/xlib/css/flags_menu.css")), | |
| 245 | + js(js_file("/xlib/js/xlib.js")) | |
| 246 | + ], | |
| 247 | + [ | |
| 248 | + dl([ | |
| 249 | + //img([event(onmouseover, "showObject('l3-flag');"), event(onmouseout, "hideObject('l3-flag');")], "/xlib/flags/24x24/"+lang+".png" ), | |
| 250 | + dd([style("display: block"),id("l3-flag")], | |
| 251 | + ul( | |
| 252 | + map(make_line, l3_get_all_dicos(dictionary_collection_name))+ | |
| 253 | + [ | |
| 254 | + if show_symbolic then | |
| 255 | + language_line("symb", "symbolic", action) | |
| 256 | + else | |
| 257 | + empty | |
| 258 | + ] | |
| 259 | + )), | |
| 260 | + ]) //!dl | |
| 261 | + ] | |
| 262 | + ) | |
| 263 | +. | |
| 264 | + | |
| 265 | +public define HTML_Partial_Content | |
| 266 | + choose_lang_dialog | |
| 267 | + ( | |
| 268 | + WEB_Session _session, | |
| 269 | + String -> String action | |
| 270 | + ) = | |
| 271 | + with lang = _session.language, | |
| 272 | + app_dictionnary = get_dictionary(_session), | |
| 273 | + | |
| 274 | + choose_lang_dialog(app_dictionnary, action, false) | |
| 275 | +. | ... | ... |