{# This template creates the Global Index, a view that displays all the items within the current namespace or, based on user selection, a filtered list based on content type or first letter of item name or a list of subitems for an item. There is a lot of javascript support (index_action.js and jfu.js) for downloading, deleting, destroying, filtering, selecting, creating, and uploading items. As noted below, there are several nodes that are initially hidden by CSS, and displayed when the user clicks a button. #} {% extends theme("layout.html") %} {% import "forms.html" as forms with context %} {% import theme("itemviews.html") as itemviews with context %} {# used by basic theme to show itemviews links on Item Index view #} {% block views %} {{ itemviews }} {% endblock %} {# Each item entry is formatted by the following macro. The entry includes a checkbox, an invisible link used by js for download, a link to the item (CSS places a content type icon before the link), a link to display subitems (if the item has subitems), size, number revisions, editor and modified time. #} {% macro render_file_entry(e) %} {% set mimetype = "application/x.moin.download" %} {# invisible link below is used by js to download item #} {# invisible span below has css before attribute to show mimetype icon #} {%- if e.meta.namespace %} {#- we use a leading / to indicate item is not in default namespace #} {%- set name = "/" + str(e.fullname) %} {%- else %} {%- set name = e.fullname %} {%- endif %} {#- hack to make items in default namespace sort first #} {{ name }} {%- if e.fullname in dirs_fullname %} {%- endif %} {{ e.meta.size }} {{ e.meta.rev_number }} {%- if e.meta.userid %} {%- set editor_name, editor_email = editors[e.meta.userid] %} {%- if editor_email %} {{ editor_name }} {%- else %} {{ editor_name }} {%- endif %} {%- else %} {{ e.meta.address }} {%- endif %} {{ e.meta.mtime|time_datetime }} {% endmacro %} {% block content %}

{{ title }}

{% if missing_dirs %} {# Display a list of missing parents with a link to show orphaned items. #}

{{ _("These items have orphan sub-items. Click name to create or arrow to view sub-items.") }}

{% for dir in missing_dirs %}

{{ dir }}

{% endfor %}
{% endif %}
{% if not (dirs or files) %}

{{ _("There are no items or read permission is denied for all.") }}

{% else %} {# display the row of action buttons: Select All, Download, Delete, Destroy, Filter, Namespace, New Item #} {{ _("Download") }} {{ _("Delete") }} {{ _("Destroy") }} {% endif %} {% if dirs or files or form.contenttype %} {# prior filter action on contenttype may have resulted in no dirs or files #} {{ _("Filter") }} {% endif %} {# these action buttons have a purpose even when there are no items. #} {{ _("Namespace") }} {{ _("New Item") }}
{% if selected_groups %}

{{ _("Filter is on for these selected groups:") }}

{% endif %} {# Hidden namespace selection content that is revealed if user clicks namespace button above. #} {# Hidden filter content that is revealed if user clicks filter button above. #} {# Hidden New Item content that is revealed if user clicks New Item button above. #} {# If this is an index of subitems, display links to Global Index and all parent subitems. #}
{% if item_name: %}
{{ ("/") }} {% for i in range(0, item_names|count) %} {% set fullname = item_names[:i+1]|join('/') %} {% set relname = item_names[i] %} {% if loop.last %} {{ relname }} {% else %} {{ relname }} {{ ("/") }} {% endif %} {% endfor %}
{% endif %}
{% if files or dirs %} {# display row of buttons, Show All, followed by first letter of items. #}
{# one button will be highlighted via the selected class, either Show All or some letter. #} {% if not startswith %} {{ _("Show All") }} {% else %} {{ _("Show All") }} {% endif %} {% for initial in initials %} {% if startswith == initial %} {{ initial }} {% else %} {{ initial }} {% endif %} {% endfor %}
{% endif %} {# Finally! this is what user wants to see - the list of items. jfu.js needs moin-index class. #} {% for e in files %} {{ render_file_entry(e) }} {% endfor %}
Name Size Revisions Editor Modified
{# initially hidden by CSS, index_action.js displays this as a popup if user clicks on Delete or Destroy button #} {# lightbox is used by jquery and css to dim and disable underlying page when above popup is triggered #} {% endblock %} {% block body_scripts %} {{ super() }} {{ forms.file_uploader_scripts() }} {% endblock %}