Commit 8b2211a6e0dc130bfa9c5edd8f80b9f00ea539f2
1 parent
5d5ed725
Move the fisheye code from internal MailFountain code to calexium_lib, to let share it with all.
This is also the start point of migration from dojo to jquery js dependency. Julien will perform this migration
Showing
1 changed file
with
76 additions
and
0 deletions
Show diff stats
| 1 | +/* | ||
| 2 | + * Created by PyramIDE. | ||
| 3 | + * User: フランスのトトロ | ||
| 4 | + * Date: 09/05/2015 | ||
| 5 | + * Time: 22:33 | ||
| 6 | + * © Calexium | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +transmit tools/basis.anubis | ||
| 10 | +transmit calexium_lib/web/CXM_making_a_web_site.anubis | ||
| 11 | + | ||
| 12 | +public type FisheyeEntry: | ||
| 13 | + fisheye_entry( | ||
| 14 | + String id, //html id | ||
| 15 | + String icon_path, //path of the icon to shown with this entry | ||
| 16 | + String action, //action to do when click on that icon | ||
| 17 | + String help_text //Help text to show | ||
| 18 | + ). | ||
| 19 | + | ||
| 20 | +define List(HTML_Off_Form) | ||
| 21 | + make_fisheye_menu | ||
| 22 | + ( | ||
| 23 | + (String) -> String _T, //translator function | ||
| 24 | + List(FisheyeEntry) entries, | ||
| 25 | + List(HTML_Off_Form) so_far, | ||
| 26 | + String selected_space //id of the selected space | ||
| 27 | + )= | ||
| 28 | + if entries is | ||
| 29 | + { | ||
| 30 | + [] then reverse(so_far), //reverse to be in the right direction | ||
| 31 | + [h . t] then | ||
| 32 | + with entry = (HTML_Off_Form)image( | ||
| 33 | + [ | ||
| 34 | + id(h.id), | ||
| 35 | + class("menu_item"+if h.id = selected_space then " menu_selected" else ""), | ||
| 36 | + event(onclick,"location.href='?a="+h.action+"';"), | ||
| 37 | + attr("widgetid",h.id), | ||
| 38 | + attr("title",_T(h.help_text)) | ||
| 39 | + ], | ||
| 40 | + h.icon_path, | ||
| 41 | + _T(h.help_text)), | ||
| 42 | + | ||
| 43 | + make_fisheye_menu(_T, t, [ entry . so_far], selected_space) | ||
| 44 | + }. | ||
| 45 | + | ||
| 46 | +public define HTML_Partial_Content | ||
| 47 | + make_fisheye_menu | ||
| 48 | + ( | ||
| 49 | + (String) -> String _T, //translator function | ||
| 50 | + List(FisheyeEntry) entries, //List of all eyes to show | ||
| 51 | + String selected_space //html id of the selected eye (means that it will be surrounded with square to indicate the selection) | ||
| 52 | + )= | ||
| 53 | + if entries is | ||
| 54 | + { | ||
| 55 | + [] then partial_content([], literal("")), | ||
| 56 | + [_ . _] then partial_content([], | ||
| 57 | + | ||
| 58 | + div([id("top_menu"), style("min-height:70px!important;vertical-align:top;display:table-row")], | ||
| 59 | + sequence([ | ||
| 60 | + | ||
| 61 | + //Liste des espaces | ||
| 62 | + sequence(make_fisheye_menu(_T, entries, [], selected_space)), | ||
| 63 | + | ||
| 64 | + literal("<script type=\"text/javascript\">\n"+ | ||
| 65 | + "dojo.require(\"dojox.widget.FisheyeLite\");\n"+ | ||
| 66 | + "dojo.query(\"#top_menu .menu_item\").instantiate(dojox.widget.FisheyeLite, {\n"+ | ||
| 67 | + "properties: {\n"+ | ||
| 68 | + "//top: {end:30, unit:\"px\"},\n"+ | ||
| 69 | + "height: {end:64, unit:\"px\"},\n"+ | ||
| 70 | + "width: {end:64, unit:\"px\"}\n"+ | ||
| 71 | + "}\n"+ | ||
| 72 | + "});\n"+ | ||
| 73 | + "</script>\n")]) | ||
| 74 | + )) | ||
| 75 | + | ||
| 76 | + }. |