view MoinMoin/templates/history.html @ 770:a4ec2c6f0bb7 pytest2

history: do not yield Revision objects, but directly result documents from whoosh we have all that global and local history view (and also the atom feed) needs in the whoosh index. the whoosh documents yielded are dicts with all stored fields. by just using that, we do not need to access the backend storage any more for displaying history (which was one of the reasons for the slow global history for wikis with many revisions). one small difference is rev.timestamp (UNIX timestamp) vs. doc[MTIME] (datetime object). added size, action, comment fields to whoosh indexes (needed for history display and also useful for other reasons). adjusted the tests (pytest 2) TODO: ACL checks for history? (this is a general thing we need to be careful with: not to expose index data that should not be exposed). removed unused "mountpoint" history() param. add utctimestamp() == inverse of datetime.utcfromtimestamp()
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 25 Aug 2011 23:09:06 +0200
parents b9f0ba2ba779
children 03efad0ebc90
line wrap: on
line source
{% extends theme("show.html") %}
{% import "utils.html" as utils %}
{% block content %}
    {% set (history, next_offset, previous_offset) = history_page %}
    {% if history %}
    <div class='moin-offset-links'>
        {% if previous_offset >= 0 %}
            <a href="{{ url_for('frontend.history', item_name=item_name, offset=previous_offset) }}" title="{{ _("Previous") }}">&laquo;</a>
        {% endif %}
        {% if next_offset %}
            <a href="{{ url_for('frontend.history', item_name=item_name, offset=next_offset) }}" title="{{ _("Next") }}">&raquo;</a>
        {% endif %}
    </div>
    <h1>{{ _("History of '%(item_name)s'", item_name=item_name) }}</h1>
    <div class="moin-clr"></div>
    <form action="{{ url_for('frontend.diff', item_name=item_name) }}" method="GET">
        <div id="moin-page-history">
        <table>
            <tr>
                <th>{{ _("Name") }}</th>
                <th>{{ _("Rev.") }}</th>
                <th>{{ _("Timestamp") }}</th>
                <th>{{ _("Size") }}</th>
                <th><input type="submit" value="Diff" /></th>
                <th>{{ _("Editor") }}</th>
                <th>{{ _("Content-Type") }}</th>
                <th>{{ _("Comment") }}</th>
                <th colspan="6">{{ _("Actions") }}</th>
            </tr>
            {% for doc in history %}
            <tr>
                <td class="moin-wordbreak">{{ doc.name }}</td>
                <td class="moin-integer">{{ doc.rev_no }}</td>
                <td>{{ doc.mtime|datetimeformat }}</td>
                <td class="moin-integer">{{ doc.size }}</td>
                <td>
                    <div class="moin-hist-rev">
                        <input type="radio" name="rev1" value="{{ doc.rev_no }}" />
                        <input type="radio" name="rev2" value="{{ doc.rev_no }}" />
                    </div>
                </td>
                <td class="moin-wordbreak">{{ utils.editor_info(doc) }}</td>
                <td class="moin-wordbreak">{{ doc.contenttype }}</td>
                <td class="moin-wordbreak">{{ doc.comment }}</td>
                <td><a href="{{ url_for('frontend.show_item', item_name=doc.name, rev=doc.rev_no) }}">{{ _('show') }}</a></td>
                <td><a href="{{ url_for('frontend.show_item_meta', item_name=doc.name, rev=doc.rev_no) }}">{{ _('meta') }}</a></td>
                <td><a href="{{ url_for('frontend.download_item', item_name=doc.name, rev=doc.rev_no) }}">{{ _('download') }}</a></td>
                <td><a href="{{ url_for('frontend.highlight_item', item_name=doc.name, rev=doc.rev_no) }}">{{ _('highlight') }}</a></td>
                <td><a href="{{ url_for('frontend.revert_item', item_name=doc.name, rev=doc.rev_no) }}">{{ _('revert') }}</a></td>
                <td><a href="{{ url_for('frontend.destroy_item', item_name=doc.name, rev=doc.rev_no) }}">{{ _('destroy') }}</a></td>
            </tr>
            {% endfor %}
        </table>
        </div>
        </form>
    {% endif %}
{% endblock %}