{# Display a table showing an item's edit history, one row per revision. In first column, show ticket's summary, active item's name, or deleted item's ID. #} {% extends theme("show.html") %} {% import "utils.html" as utils with context %} {% set summary = history[0].get('summary', None) if history else None %} {% set heading = _("History of {fqname}").format(fqname=utils.item_moniker(item.meta, [fqname])) %} {% set first_itemid = history[0].itemid %} {% block content %} {%- if history %}

# {{ heading }}

{%- if not trash %} {#- add button to switch between history by name or history by item id #} {%- if '/@itemid/' in request.url or '/%40itemid/' in request.url %}

{{ _("Item Name") }} {{ _("Click to show history spanning item delete and recreate.") }}

{%- else %} {%- if fqname.namespace %} {%- set namespace = fqname.namespace + "/" %} {%- else %} {%- set namespace = "" %} {%- endif %}

{{ _("Item Id") }} {{ _("Click to show history spanning item renames.") }}

{%- endif %} {%- endif %} {#- if history is long and displayed as several pages, create links to show next and/or prior pages #} {{ utils.page_links(page_num, pages, url) }}

{{ _("Name or ID ~(Old Name)") }} | {{ _("Rev.") }} | {{ _("Timestamp") }} | {{ _("Size") }} {%- if history[0].trash %} | Diff {%- else %} | {%- endif %} | {{ _("Editor") }} | {{ _("Content Type") }} | {{ _("Comment and/or `Summary`") }} | {{ _("Actions") }}
--- | --- | --- | --- | --- | --- | --- | --- | --- | ---
{#- we use jinja2 dict trick to modify variables within a loop #} {%- set checker = {'check1': '', 'check2': 'checked'} %} {%- for doc in history %}
{{ utils.item_moniker(doc, doc.fqnames) }} | {{ doc.rev_number or doc.revid|shorten_id }} | {{ doc.mtime|time_datetime }} | {{ doc.size }} | {#- do not create radio buttons if item was deleted and recreated with same name, different itemid #} {%- if doc.itemid == first_itemid %} {%- if len(history) > 1 and not history[0].trash and not doc.trash %} {%- if checker['check1'] %} {%- if checker.update({'check1': ''}) %}{% endif %} {%- elif checker['check2'] %} {%- if checker.update({'check1': 'checked'}) %}{% endif %} {%- if checker.update({'check2': ''}) %}{% endif %} {%- endif %} {%- endif %} {%- else %} {#- a diff not possible #} {{ _("Item Id Changed") }} {%- endif %} {%- set uid = doc.get('userid') or doc.get('address') %} {%- set editor_info = editor_infos.get(uid) %} | {{ utils.show_editor_info(editor_info) }} | {{ doc.contenttype|shorten_ctype }} {%- set comment = doc.comment %} {%- if doc.summary %} {%- set comment = comment + '`' + doc.summary + '`' %} {%- endif %} | {{ comment }} {%- if loop.first %} {%- set revid = None %} {%- else %} {%- set revid = doc.revid %} {%- endif %} |  |  |  | {%- if may.write and not doc.trash -%} {%- if loop.first %} | {%- else %} | {#- do not create invalid revert link if item was deleted and recreated with same name, different itemid #} {%- if doc.itemid == first_itemid %} {%- endif %} {%- endif %} {%- else %} | {%- endif %} {%- if may.destroy -%} {%- if loop.first %} | {%- else %} | {%- endif %} {%- else %} | {%- endif %}
{%- endfor %}
{%- if bookmark_time %}
{{ _("Bookmark is set to") }} | {{ bookmark_time|time_datetime }} |
{%- endif %}

{{ utils.page_links(page_num, pages, url) }} {%- endif %} {%- endblock %}