/* * Created by PyramIDE. * User: Jeremy * Date: 04/09/2012 * Time: 16:19 * * */ read xlib/web/CXM_making_a_web_site.anubis read xlib/web/CXM_jquery.anubis read xlib/web/CXM_common.anubis read tools/basis.anubis public type JQuery_tab: jQuery_tab(String title, HTML_Partial_Content content) . // Helper to be compatible with the first version of JQuery_tab which // take HTML_Off_Form as second argument instead of HTML_Partial_Content. public define JQuery_tab jQuery_tab ( String title, HTML_Off_Form content )= jQuery_tab(title, partial_content([], content)). define HTML_Partial_Content _jquery_tabs ( String tabs_container_id, List(JQuery_tab) tabs, String tabs_titles, List(HTML_Off_Form) tabs_contents, List(HTML_Head_Tag) tabs_heads, Int count ) = if tabs is { [ ] then partial_content( tabs_heads, sequence([ ul(text(tabs_titles)), sequence(reverse(tabs_contents)) ]) ), [ h . t ] then if h is jQuery_tab(title, p_content) then if p_content is partial_content(tags, content) then _jquery_tabs( tabs_container_id, t, tabs_titles + "
  • "+title+"
  • ", [ div([id(tabs_container_id+"-tab-"+count)], content) . tabs_contents ], tabs_heads + tags , count+1 ) } . public define HTML_Partial_Content jquery_tabs ( String tabs_container_id, List(JQuery_tab) tabs, List(Web_arg) lwa ) = with index_str = if web_arg_value(lwa, "jq_tabs_" + tabs_container_id) is { not_found then "0", found(ps) then ps }, if _jquery_tabs(tabs_container_id, tabs, "", [], [], 0) is partial_content(tags, html) then partial_content( [ js_inline(jquery_ready(" $('#"+tabs_container_id+"').tabs({ active: " + index_str + ", activate: function( event, ui ) { ui.newPanel.find('input[name=jq_tabs_" + tabs_container_id + "]').each(function () { $(this).attr('value', ui.newTab.index()); }); if (typeof CalexiumToolBox !== 'undefined' && typeof CalexiumToolBox.jq_tab_activate !== 'undefined') { CalexiumToolBox.jq_tab_activate(event, ui); } }, create: function( event, ui ) { $('#"+tabs_container_id+"').find('form').prepend(''); } }); ")) . tags ], div([id(tabs_container_id)], html) ). public define HTML_Partial_Content jquery_tabs ( String tabs_container_id, List(JQuery_tab) tabs ) = jquery_tabs(tabs_container_id, tabs, []).