{% 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>
        {% if dirent.permission = 'r' %}
        <td class="dirent-icon"><img src="{{ MEDIA_URL }}img/folder-read-only-24.png" alt="{% trans "Directory icon"%}" /></td>
        {% else %}
        <td class="dirent-icon"><img src="{{ MEDIA_URL }}img/folder-24.png" alt="{% trans "Directory icon"%}" /></td>
        {% endif %}
        <td>
            <span class="dirent-name"><a href="{{dirent.view_link}}" class="dir-link">{{ dirent.obj_name }}</a></span>
        </td>

        <td class="dirent-size"></td>
        <td class="dirent-update">
            {{ dirent.last_modified|translate_seahub_time }}
        </td>
        <td class="dirent-op">
            <div class="repo-file-op vh">
                <div class="displayed-op">
                    <a class="op dir-download" href="{{dirent.dl_link}}" title="{% trans "Download" %}">
                        <img src="{{MEDIA_URL}}img/download.png" alt="" />
                    </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 }}" title="{% trans "Share" %}">
                        <img src="{{MEDIA_URL}}img/share_20.png" alt="" />
                    </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 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="{{dirent.view_link}}" target="_blank">{{ dirent.obj_name }}</a></span>
            {% endif %}
        </td>
        <td class="dirent-size">{{ dirent.file_size|filesizeformat }}</td>
        <td class="dirent-update">
            {{ dirent.last_modified|translate_seahub_time }}
        </td>
        <td class="dirent-op">
            <div class="repo-file-op vh">
                <div class="displayed-op">
                    <a class="op file-download" href="{{dirent.dl_link}}" data-fileid="{{ dirent.props.obj_id }}" title="{% trans "Download"%}">
                        <img src="{{MEDIA_URL}}img/download.png" alt="" />
                    </a>
                    {% if not repo.encrypted %}
                    <a class="op file-share" href="#" data-link="{{ dirent.sharelink }}" data-token="{{ dirent.sharetoken }}" title="{% trans "Share" %}">
                        <img src="{{MEDIA_URL}}img/share_20.png" alt="" />
                    </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-update" href="#">{% trans "Update"%}</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="{{dirent.history_link}}" target="_blank">{% trans "History" %}</a></li>
                </ul>
                {% endif %}
            </div>
        </td>
    </tr>
    {% endfor %}
