annotate MoinMoin/templates/global_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 a716e61ae9c7
children e5b51d4304c8
rev   line source
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 {% extends theme("layout.html") %}
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 {% import "utils.html" as utils %}
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4 {% block head %}
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
5 {{ super() }}
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
6 <link rel="alternate" title="Global changes" href="{{ url_for('feed.atom') }}" type="application/atom+xml" />
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7 {% endblock %}
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9 {% block content %}
468
511a2a2e9950 paging of history results, currently without the option of setting count per page
Akash Sinha <akash2607@gmail.com>
parents: 465
diff changeset
10 <div class='moin-offset-links'>
511a2a2e9950 paging of history results, currently without the option of setting count per page
Akash Sinha <akash2607@gmail.com>
parents: 465
diff changeset
11 {% if previous_offset >= 0 %}
511a2a2e9950 paging of history results, currently without the option of setting count per page
Akash Sinha <akash2607@gmail.com>
parents: 465
diff changeset
12 <a href="{{ url_for('frontend.global_history', offset=previous_offset) }}" title="{{ _("Previous") }}">&laquo;</a>
511a2a2e9950 paging of history results, currently without the option of setting count per page
Akash Sinha <akash2607@gmail.com>
parents: 465
diff changeset
13 {% endif %}
511a2a2e9950 paging of history results, currently without the option of setting count per page
Akash Sinha <akash2607@gmail.com>
parents: 465
diff changeset
14 {% if offset %}
511a2a2e9950 paging of history results, currently without the option of setting count per page
Akash Sinha <akash2607@gmail.com>
parents: 465
diff changeset
15 <a href="{{ url_for('frontend.global_history', offset=offset) }}" title="{{ _("Next") }}">&raquo;</a>
511a2a2e9950 paging of history results, currently without the option of setting count per page
Akash Sinha <akash2607@gmail.com>
parents: 465
diff changeset
16 {% endif %}
511a2a2e9950 paging of history results, currently without the option of setting count per page
Akash Sinha <akash2607@gmail.com>
parents: 465
diff changeset
17 </div>
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 <h1>{{ _("Global History") }}</h1>
468
511a2a2e9950 paging of history results, currently without the option of setting count per page
Akash Sinha <akash2607@gmail.com>
parents: 465
diff changeset
19 <div class='moin-clr'></div>
465
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
20 {% if user.valid %}
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
21 <div id="moin-set-bookmark">
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
22 {% if bookmark_time %}
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
23 {{ _("Bookmark (currently set to %(bookmark)s). ", bookmark=bookmark_time|datetimeformat) }}
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
24 <a href="{{ url_for('frontend.bookmark', time='del') }}">{{ _("Delete bookmark") }}</a>
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
25 {% else %}
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
26 {{ _("Bookmark (not set). ") }}<a href="{{ url_for('frontend.bookmark', time=current_timestamp) }}">{{ _("Set bookmark") }}</a>
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
27 {% endif %}
470
bba40d458d9e minor change, a closing div tag corrected
Akash Sinha <akash2607@gmail.com>
parents: 468
diff changeset
28 </div>
465
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
29 {% endif %}
454
b07dfe4ceb8d Grouping of global history done on the date basis.
Akash Sinha <akash2607@gmail.com>
parents: 216
diff changeset
30 <div id="moin-global-history">
464
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
31 {% for rev_date, revs in history %}
465
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
32 {% set latest_rev = revs[0] %}
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
33 {% set latest_timestamp = latest_rev.timestamp %}
454
b07dfe4ceb8d Grouping of global history done on the date basis.
Akash Sinha <akash2607@gmail.com>
parents: 216
diff changeset
34 <div class="moin-history-container">
465
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
35 <div class="moin-history-container-header">
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
36 <span>
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
37 <h2>{{ rev_date }}</h2>
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
38 {% if user.valid %}
770
a4ec2c6f0bb7 history: do not yield Revision objects, but directly result documents from whoosh
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 476
diff changeset
39 <a class="bookmark-link" href="{{ url_for('frontend.bookmark', time=utctimestamp(latest_timestamp)) }}">{{ _("Set bookmark") }}</a>
465
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
40 {% endif %}
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
41 </span>
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
42 </div>
454
b07dfe4ceb8d Grouping of global history done on the date basis.
Akash Sinha <akash2607@gmail.com>
parents: 216
diff changeset
43 <div class="moin-history-container-body">
b07dfe4ceb8d Grouping of global history done on the date basis.
Akash Sinha <akash2607@gmail.com>
parents: 216
diff changeset
44 <table>
457
f1f88b7b17fa some variable names modified.
Akash Sinha <akash2607@gmail.com>
parents: 454
diff changeset
45 {% for rev in revs %}
464
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
46 <tr>
473
b33a2dca5e8f diff link added on global history page, to view diff between latest revision and first revision
Akash Sinha <akash2607@gmail.com>
parents: 470
diff changeset
47 {% set item_latest_revno = rev.revnos[0] %}
b33a2dca5e8f diff link added on global history page, to view diff between latest revision and first revision
Akash Sinha <akash2607@gmail.com>
parents: 470
diff changeset
48 <td class="moin-action" title="{{ _("DIFF") }}">
b33a2dca5e8f diff link added on global history page, to view diff between latest revision and first revision
Akash Sinha <akash2607@gmail.com>
parents: 470
diff changeset
49 <a href="{{ url_for('frontend.diff', item_name=rev.item_name, rev1=item_latest_revno, rev2=0) }}" class="moin-history-{{ rev.action|lower }}"></a>
b33a2dca5e8f diff link added on global history page, to view diff between latest revision and first revision
Akash Sinha <akash2607@gmail.com>
parents: 470
diff changeset
50 </td>
476
a716e61ae9c7 contenttype texts are replaced by icons in global history page, all icons are GPL licensed (picked from tango icons library).
Akash Sinha <akash2607@gmail.com>
parents: 473
diff changeset
51 <td class="moin-history-item"><a class="{{ rev.contenttype|contenttype_to_class }}" href="{{ url_for('frontend.show_item', item_name=rev.item_name) }}" title="{{ rev.contenttype }}">{{ rev.item_name }}</a></td>
464
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
52 <td class="moin-history-time">{{ rev.timestamp|timeformat }}</td>
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
53 <td class="moin-history-links">
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
54 {% for revno in rev.revnos %}
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
55 {% if revno %}
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
56 <a href="{{ url_for('frontend.diff', item_name=rev.item_name, rev1=revno, rev2=revno-1) }}">[{{ revno }}]</a>
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
57 {% else %}
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
58 <span>[0]</span>
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
59 {% endif %}
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
60 {% endfor %}
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
61 </td>
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
62 <td class="moin-wordbreak moin-history-editorinfo">
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
63 {% for info, position in rev.editors %}
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
64 <span class="moin-history-editortext">
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
65 {{ utils.show_editor_info(info) }}
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
66 {{ position }}
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
67 </span>
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
68 {% endfor %}
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
69 </td>
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
70 <td class="moin-wordbreak moin-history-comment">
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
71 {% for comment in rev.comments %}
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
72 <span>{{ comment }}</span>
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
73 {% endfor %}
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
74 </td>
58a29a7fd016 grouping of the global history results on item name and date basis (code cleaned)
Akash Sinha <akash2607@gmail.com>
parents: 460
diff changeset
75 </tr>
454
b07dfe4ceb8d Grouping of global history done on the date basis.
Akash Sinha <akash2607@gmail.com>
parents: 216
diff changeset
76 {% endfor %}
b07dfe4ceb8d Grouping of global history done on the date basis.
Akash Sinha <akash2607@gmail.com>
parents: 216
diff changeset
77 </table>
b07dfe4ceb8d Grouping of global history done on the date basis.
Akash Sinha <akash2607@gmail.com>
parents: 216
diff changeset
78 </div>
b07dfe4ceb8d Grouping of global history done on the date basis.
Akash Sinha <akash2607@gmail.com>
parents: 216
diff changeset
79 </div>
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
80 {% endfor %}
454
b07dfe4ceb8d Grouping of global history done on the date basis.
Akash Sinha <akash2607@gmail.com>
parents: 216
diff changeset
81 </div>
468
511a2a2e9950 paging of history results, currently without the option of setting count per page
Akash Sinha <akash2607@gmail.com>
parents: 465
diff changeset
82 {% if bookmark_time and not offset %}
465
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
83 <div id="moin-bookmark-reached">{{ _("Bookmark reached") }}</div>
3076415fdaba Bookmark functionality added for the global history results
Akash Sinha <akash2607@gmail.com>
parents: 464
diff changeset
84 {% endif %}
0
5568cf133caf create moin/2.0 repo, drop all history (see notes below)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
85 {% endblock %}