<html metal:use-macro="here/main_template/macros/master" i18n:domain="plone">
   <div metal:fill-slot="main"
        tal:define="HistoryBatchSize python:request.get('HistoryBatchSize',20);
                    first_trx python:request.get('first_transaction',0);
                    last_trx python:20;
                    has_history python:getattr(here, 'manage_change_history',None) is not  None;
                    history python: has_history and here.manage_change_history() or [];">

  <form action="#"
        method="post"
        tal:attributes="action here_url"
        tal:condition="has_history" >

  <table summary="History" i18n:attributes="summary summary_history;" tal:define="history_length python:len(history)">
     <tr>
       <td>
         <div class="list-nav" tal:condition="first_trx" tal:define="next python:(first_trx*2-last_trx)">
           <a href="" tal:attributes="href string:${request/URL}?first_trx:int=$next&amp;last_trx:int=$first_trx&amp;HistoryBatchSize:int=$HistoryBatchSize"> &lt; <span tal:omit-tag="" i18n:translate="label_rev_later">Later Revisions</span></a>
         </div>

         <div tal:condition="python:test(history_length==HistoryBatchSize, 0, 1)"
              tal:define="last python:last_trx+HistoryBatchSize">
           <a href="" tal:attributes="href string:${request/URL}?first_trx:int=$last_trx&amp;last_transaction:int=$last&amp;HistoryBatchSize:int=$HistoryBatchSize"> <span tal:omit-tag="" i18n:translate="label_rev_earlier">Earlier Revisions</span> &gt; </a>
         </div>

         <div tal:condition="history" tal:repeat="version history">
             <input type="checkbox" value="" name="keys:list" tal:attributes="value version/key" />
             <a href="#" tal:attributes="href string:$here_url/HistoricalRevisions/${version/key}">
               <span tal:replace="version/time" />
               <span tal:condition="version/user_name" tal:replace="string:(${version/user_name})" />
             </a>
             <span tal:replace="version/description" />
             <br />
         </div>
       </td>
     </tr>

     <tr>
       <td>
         <input class="context"
                type="submit"
                name="manage_customHistoryCopy:method"
                value="Copy to present"
                i18n:attributes="value label_copy_to_present;" />
         <input class="context"
                type="submit"
                name="manage_historicalComparison:method"
                value="Compare"
                i18n:attributes="value label_compare;" />
       </td>
     </tr>
  </table>
  </form>

  <metal:block tal:condition="not: has_history">
  <h2 i18n:translate="label_historical_unavailable">Historical not available</h2>
  <span tal:omit-tag="" i18n:translate="description_historical_unavailable">
  This class does not support the historical interface.  The content must
  mix-in OFS.History.Historical
  </span>
  </metal:block>

 </div>
</html>

