<!-- Navigation -->
<div class="listingBar"
     metal:define-macro="navigation"
     tal:define="batch view/batch"
     tal:condition="batch/multiple_pages">
    <span class="previous"
      tal:condition="batch/has_previous">
        <a href=""
           tal:attributes="href string:${view/url}?pagenumber=${batch/previouspage}&sort_on=${request/sort_on|string:getObjPositionInParent}">
           &laquo;
           <span i18n:translate="batch_previous_x_items" tal:omit-tag="">
               Previous
               <span i18n:name="number" tal:omit-tag="" tal:content="batch/pagesize">n</span>
               items
           </span>
        </a>
    </span>

    <span class="next"
          tal:condition="batch/has_next">
        <a href=""
           tal:attributes="href string:${view/url}?pagenumber=${batch/nextpage}&sort_on=${request/sort_on|string:getObjPositionInParent}">
           <span i18n:translate="batch_next_x_items" tal:omit-tag="">
               Next
               <span i18n:name="number" tal:omit-tag="" tal:content="batch/next_item_count">n</span>
               items
           </span>
           &raquo;
        </a>
    </span>

    <!-- Link to first -->
    <span tal:condition="batch/show_link_to_first">
        <a href=""
           tal:attributes="href string:${view/url}?pagenumber=1&sort_on=${request/sort_on|string:getObjPositionInParent}">1</a>
        <span tal:condition="batch/second_page_not_in_navlist"
              tal:omit-tag="">
           ...
        </span>
    </span>

    <!-- Pagelist with quantum leap links to previous pages for quick navigation -->
    <!--
    <span tal:repeat="linklist python:batch.navurls(request.form, batch.leapback)"
          tal:condition="batch/leapback"
          tal:omit-tag="" >
        <a href=""
           tal:define="page python:linklist[0];
                       query python:linklist[1];"
           tal:content="page"
           tal:attributes="href python: '%s?%s' % (url,query)" >
        </a>
        ...
    </span>
    -->

    <!-- Pagelist with links to previous pages for quick navigation -->
    <span tal:repeat="pagenumber batch/previous_pages"
          tal:omit-tag="" >
      <a href="" tal:content="pagenumber" 
         tal:attributes="href string:${view/url}?pagenumber=$pagenumber&sort_on=${request/sort_on|string:getObjPositionInParent}"/>
    </span>

    <!-- Current page -->
    <span tal:condition="batch/navlist"
          tal:omit-tag="">
        [<span tal:content="batch/pagenumber">Current page number</span>]
    </span>

    <!-- Pagelist with links to next pages for quick navigation -->
    <span tal:repeat="pagenumber batch/next_pages"
          tal:omit-tag="" >
      <a href="" tal:content="pagenumber" 
         tal:attributes="href string:${view/url}?pagenumber=$pagenumber&sort_on=${request/sort_on|string:getObjPositionInParent}"/>
    </span>

    <!-- Pagelist with quantum leap links to next pages for quick navigation -->
    <!--
    <span tal:repeat="linklist python:batch.navurls(request.form, batch.leapforward)"
          tal:condition="batch/leapforward"
          tal:omit-tag="" >
        ...
        <a href=""
           tal:define="page python:linklist[0];
                       query python:linklist[1];"
           tal:content="page"
           tal:attributes="href python: '%s?%s' % (url,query)" >
        </a>
    </span>
    -->

    <!-- Link to last -->
    <span tal:condition="batch/show_link_to_last">
        <span tal:condition="batch/before_last_page_not_in_navlist"
              tal:omit-tag="">
           ...
        </span>
        <a href=""
           tal:attributes="href string:${view/url}?pagenumber=${batch/lastpage}&sort_on=${request/sort_on|string:getObjPositionInParent}"
           tal:content="batch/lastpage">3457</a>
    </span>
</div>
