/* * Created by PyramIDE. * User: フランスのトトロ aka (David RENÉ) * Date: 03/02/2019 * Time: 19:32 * © David RENÉ */ read calexium_lib/web/CXM_making_a_web_site.anubis read calexium_lib/web/CXM_web_session.anubis public define HTML_Partial_Content control_panel_pager ( String pager_id, String previous, String next ) = partial_content([js(js_file("js/cxm/cxm_pager.js"))], div(id(pager_id), [ text(class("o_pager_current_page"),"0"), text("/"), text(class("o_pager_total_page"),"0"), text(" "), text(class("o_pager_total_items"),"0"), span(class("btn-group btn-group-sm"), [ button([class("fa fa-chevron-left btn btn-icon o_pager_previous"), attr("type","button"), accesskey('p'), event(onclick, previous)]), button([class("fa fa-chevron-right btn btn-icon o_pager_next"), attr("type","button"), accesskey('n'), event(onclick, next)]) ]) ])) . public define HTML_Head_Tag update_pager_script ( String pager_id, Int current_page, Int total_pages, Int total_items )= js_script("update_pager('"+pager_id+"', "+current_page+", "+total_pages+", "+total_items+");") . public define One get_current_page ( WEB_Session _session )= with lwa = *_session.web_request.lwa, //check if we clicked on next or previous pager next_page = get_Bool(lwa, "next_page", false), previous_page = get_Bool(lwa, "previous_page", false), //get the current page stored in session _page = get_Int(_session.fields, "pager_current_page", 1), //if clicked on pager change page number else set to 1 (means change on query or tag. In that case reset the page) current_page = if next_page then _page+1 else if previous_page then _page-1 else 1, //store current page in web session for the next call replace_Int(_session.fields, "pager_current_page", current_page) .