{# This template is used by other templates (show.html, etc.) to format the numerous links within the Item Views panel in the theme's header or sidebar. Some links may be suppressed because of item ACLs. Several links are suppressed if the item or revision is deleted. Comment and Transclusion links may be hidden by Javascript if item lacks content. #} {% set exists = fqname and storage.get_item(**fqname.query) %} {% set item = item %} {% set not_trash = not item_is_deleted if item_is_deleted is defined else True %} {% set icon_classes = theme_supp.get_endpoint_iconmap() %} {% set current_path = request.path %} {%- macro a_label(icon_class, label) %} {{ label }} {%- endmacro %}
{%- for endpoint, label, title, check_exists in cfg.item_views if not endpoint in cfg.endpoints_excluded %} {% set icon_class = icon_classes[endpoint] %} {%- if not check_exists or check_exists and exists %} {%- if may.write and not_trash %} {%- if current_path.startswith("/+") and endpoint == 'frontend.show_item' %}
{{ a_label(icon_class, label) }}
{%- elif not current_path.startswith("/+") and endpoint == 'frontend.modify_item' %}
{{ a_label(icon_class, label) }}
{%- endif %} {%- endif %} {%- endif %} {%- endfor %}
{%- for endpoint, label, title, check_exists in cfg.item_views if not endpoint in cfg.endpoints_excluded %} {% set icon_class = icon_classes[endpoint] %} {%- if not check_exists or check_exists and exists %} {%- if may.write and not_trash and endpoint == 'frontend.modify_item' and current_path.startswith("/+") and not current_path.startswith("/+modify/") %}
{{ a_label(icon_class, label) }}
{%- endif %} {%- if endpoint in [ 'frontend.show_item_meta', 'frontend.history', 'frontend.download_item', ] %}
{{ a_label(icon_class, label) }}
{%- endif %} {%- if not_trash and endpoint in [ 'frontend.index', 'frontend.refs', 'frontend.sitemap', 'frontend.similar_names', 'frontend.copy_item', ] %}
{{ a_label(icon_class, label) }}
{%- endif %} {%- if endpoint == 'frontend.highlight_item' and item and ('text' in item.contenttype or 'docbook' in item.contenttype) %}
{{ a_label(icon_class, label) }}
{%- endif %} {%- if endpoint in [ 'frontend.rename_item', 'frontend.delete_item', ] and may.write and not_trash %}
{{ a_label(icon_class, label) }}
{%- endif %} {%- if endpoint in [ 'frontend.convert_item', ] and may.write and item and theme_supp.is_markup_or_text(item.contenttype) and not_trash %}
{{ a_label(icon_class, label) }}
{%- endif %} {%- if endpoint == 'frontend.destroy_item' and user.may.destroy(fqname) %}
{{ a_label(icon_class, label) }}
{%- endif %} {%- if endpoint == 'frontend.quicklink_item' and user.valid and not_trash %}
{%- if user.is_quicklinked_to([fqname]) %} {{ a_label(icon_class, _('Remove Link')) }} {%- else %} {{ a_label(icon_class, _('Add Link')) }} {%- endif %}
{%- endif %} {%- if endpoint == 'frontend.subscribe_item' and user.valid and not_trash %}
{%- if user.is_subscribed_to(item) %} {{ a_label(icon_class, _('Unsubscribe')) }} {%- else %} {{ a_label(icon_class, _('Subscribe')) }} {%- endif %}
{%- endif %} {%- if endpoint == 'special.comments' and not_trash %} {%- endif %} {% if endpoint == 'special.transclusions' and not_trash -%} {%- endif %} {%- if endpoint == 'special.supplementation' and fqname %} {%- for sub_item_name in cfg.supplementation_item_names %} {%- set current_sub = item_name.rsplit('/', 1)[-1] %} {%- if not current_sub in cfg.supplementation_item_names %} {%- set supp_name = '%s/%s/%s' % (fqname.namespace, item_name, sub_item_name) %} {%- if not_trash and (storage.has_item(supp_name) or user.may.write(supp_name)) %} {% set title = _('Discuss contents of this item') %}
{{ a_label(icon_class, _(sub_item_name)) }}
{%- endif %} {%- endif %} {%- endfor %} {%- endif %} {%- endif %} {%- endfor %}