<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      lang="en"
      metal:use-macro="here/main_template/macros/master"
      i18n:domain="cmf_default">

<head>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
</head>
<body>

<div metal:fill-slot="main_no_tabs"
     tal:define="transactions python:container.portal_undo.listUndoableTransactionsFor(here);
                 Batch python:modules['Products.Plinn'].Batch;
                 DateTime python:modules['DateTime'].DateTime;
                 b_start python:request.get('b_start',0)">

    <form name="undo_form"
          action="undo"
          method="post"
          tal:condition="transactions"
          tal:define="batch python:Batch(transactions, 15, int(b_start), orphan=1)">

        <input type="hidden" name="came_from" value="" tal:attributes="value request/HTTP_REFERER" />

        <h1 i18n:translate="">Undo Transactions</h1>

        <p i18n:translate="">
       This application's transactional feature allows you to
       easily undo changes made to the application's settings or data. You can
       revert the application to a &quot;snapshot&quot; of its state
       at a previous point in time. 
        </p>

        <p i18n:translate="">
        Select one or more transactions below and then click on the &quot;Undo&quot;
        button to undo the transactions.  Note that even though a transaction
        is shown below, you will not be able to undo it if later transactions
        modified objects that were modified by the transaction.
        </p>

        <!-- Navigation -->
        <div metal:use-macro="here/batch_macros/macros/navigation" />

        <table class="listing"
               summary="Undo history"
               cellpadding="0"
               cellspacing="0">

            <thead>
                <tr>
                    <th i18n:translate="">Undo</th>
                    <th i18n:translate="">Action performed</th>
                    <th i18n:translate="">Affected Item</th>
                    <th i18n:translate="">By</th>
                    <th i18n:translate="">Date</th>
                </tr>
            </thead>

            <tbody>
                <metal:block tal:repeat="trx batch">
                    <tr class="even"
                        tal:define="oddrow repeat/trx/odd;
			            descriptions python:trx.get('description').split('\n');"
                        tal:attributes="class python:test(oddrow, 'even', 'odd')" >

                        <td>
                            <input type="checkbox"
                                   class="noborder"
                                   name="transaction_info:list" value=""
                                   tabindex=""
                                   tal:attributes="value python:trx['id'];
                                                   tabindex tabindex/next;" />
                        </td>

                        <td tal:define="has_description python:len(descriptions)>1">

                            <span tal:condition="has_description"
                                  tal:replace="python:' '.join(descriptions[1:])">Title</span>
                            <span tal:condition="not:has_description">&nbsp;</span>

                        </td>

                        <td tal:content="python:descriptions[0]">
                        Action performed
                        </td>

                        <td tal:content="python:mtool.getMemberFullNameById(trx['user_name'].split(' ', 1)[1], nameBefore=0)">
                        username
                        </td>

                        <td tal:content="python:trx['time'].strftime(locale_date_fmt)">
                        date/time
                        </td>
                    </tr>
                </metal:block>
            </tbody>
        </table>

        <input class="context"
               type="submit"
               name="undo:method"
               value="Undo"
               tabindex=""
               i18n:attributes="value"
               tal:attributes="tabindex tabindex/next;"
               />

        <!-- Navigation -->
        <div metal:use-macro="here/batch_macros/macros/navigation" />

</form>

</div>

</body>
</html>