{% load seahub_tags i18n %}
    {% for dirent in dir_list %}
    <tr class="dir-item" data-name="{{dirent.obj_name}}" data-time="{% if dirent.last_modified %}{{ dirent.last_modified }}{%else %}0{% endif %}">
        <td class="select">
            <span class="checkbox"><input type="checkbox" class="checkbox-orig" /></span>
        </td>
        <td class="star"></td>
        <td class="dirent-icon"><img src="{{ MEDIA_URL }}img/folder-icon-24.png" alt="{% trans "Directory icon"%}" /></td>
        <td>
            <span class="dirent-name"><a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}" class="dir-link">{{ dirent.obj_name }}</a></span>
        </td>

        <td class="dirent-size"></td>
        <td class="dirent-update">
            {% if dirent.last_modified %}
            {{ dirent.last_modified|translate_seahub_time }}
            {% else %}
            {% trans "Fetch failed" %}
            {% endif %}
        </td>
        <td class="dirent-op">
            <div class="repo-file-op vh">
                <div class="displayed-op">
                    <a class="op dir-download" href="{% url 'repo_download_dir' repo.id %}?p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}">{% trans 'Download' %}</a>
                    {% if not repo.encrypted %}
                    <a class="op dir-share" href="#" data-link="{{ dirent.sharelink }}" data-token="{{ dirent.sharetoken }}" data-upload-link="{{ dirent.uploadlink }}" data-upload-token="{{ dirent.uploadtoken }}">{% trans "Share" %}</a>
                    {% if ENABLE_SUB_LIBRARY and sub_lib_enabled and not repo.is_virtual %}
                    <a class="op dir-sync" href="#">{% trans "Sync" %}</a>
                    {% endif %}
                    {% endif %}
                </div>
                {% if user_perm == 'rw' %}
                <img src="{{ MEDIA_URL }}img/dropdown-arrow.png" title="{% trans 'More operations'%}" alt="{% trans 'More operations'%}" class="more-op-icon cspt" data="no-popup" />
                <ul class="hidden-op hide">
                    <li><a class="op dir-del" href="#">{% trans "Delete"%}</a></li>
                    <li><a class="op dir-rename" href="#">{% trans "Rename"%}</a></li>
                    <li><a class="op dir-mv" href="#">{% trans "Move"%}</a></li>
                    <li><a class="op dir-cp" href="#">{% trans "Copy"%}</a></li>
                </ul>
                {% endif %}
            </div>
        </td>
    </tr>
    {% endfor %}
    {% for dirent in file_list %}
    <tr class="file-item" data-name="{{dirent.obj_name}}" data-time="{% if dirent.last_modified %}{{ dirent.last_modified }} {%else %}0{% endif %}">
        <td class="select">
            <span class="checkbox"><input type="checkbox" class="checkbox-orig" /></span>
        </td>
        <td class="star alc">
            {% if dirent.starred %}
            <span title="{% trans 'starred' %}" class="icon-star file-star" data-status="starred"></span>
            {% else %}
            <span title="{% trans 'unstarred' %}" class="icon-star-empty file-star" data-status="unstarred"></span>
            {% endif %}
        </td>
        <td class="dirent-icon"><img src="{{ MEDIA_URL }}img/file/{{ dirent.obj_name|file_icon_filter }}" alt="{% trans "File"%}" /></td>
        <td>
            {% if repo.encrypted and repo.enc_version == 2 and not server_crypto %}
            <span class="dirent-name">{{ dirent.obj_name }}</span>
            {% else %}
            <span class="dirent-name"><a class="normal" href="{% url 'repo_view_file' repo.id %}?p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}">{{ dirent.obj_name }}</a></span>
            {% endif %}
        </td>

        <td class="dirent-size">{{ dirent.file_size|filesizeformat }}</td>
        <td class="dirent-update">
            {% if dirent.last_modified %}
            {{ dirent.last_modified|translate_seahub_time }}
            {% else %}
            {% trans "Fetch failed" %}
            {% endif %}
        </td>
        <td class="dirent-op">
            <div class="repo-file-op vh">
                <div class="displayed-op">
                    <a class="op file-download" href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/{{ dirent.props.obj_id }}/?file_name={{ dirent.props.obj_name|urlencode }}&op=download" data-fileid="{{ dirent.props.obj_id }}">{% trans "Download"%}</a>
                    {% if user_perm == 'rw' %}
                    <a class="op file-update" href="#">{% trans "Update"%}</a>
                    {% endif %}
                    
                    {% if not repo.encrypted %}
                    <a class="op file-share" href="#" data-link="{{ dirent.sharelink }}" data-token="{{ dirent.sharetoken }}">{% trans "Share" %}</a>
                    {% endif %}
                </div>
                {% if user_perm == 'rw' %}
                <img src="{{ MEDIA_URL }}img/dropdown-arrow.png" title="{% trans "More Operations"%}" alt="{% trans "More Operations"%}" class="more-op-icon cspt" data="no-popup" />
                <ul class="hidden-op hide">
                    <li><a class="op file-del" href="#">{% trans "Delete"%}</a></li>
                    <li><a class="op file-rename" href="#">{% trans "Rename" %}</a></li>
                    <li><a class="op file-mv" href="#">{% trans "Move" %}</a></li>
                    <li><a class="op file-cp" href="#">{% trans "Copy" %}</a></li>
                    <li><a class="op file-history" href="{% url 'file_revisions' repo.props.id %}?p={{ path|urlencode }}{{ dirent.obj_name|urlencode }}">{% trans "History" %}</a></li>
                </ul>
                {% endif %}
            </div>
        </td>
    </tr>
    {% endfor %}
