file.html 5.4 KB
{% extends 'base.html'%}
{% load staticfiles %}
{% block content %}
    <div>
        <div class="right_bar">

            <div class="add_folder_form">
                <form id='add_folder' action="{% url 'add_folder' %}" method="post"
                      enctype="multipart/form-data">{% csrf_token %}

                    <input type="IMAGE" name="add_button" src="{% static 'resources/add_folder.png' %}" width="200" height="50"
                           align="center" value="폴더 추가하기">
                    <input type="dir_name" name="dir_name" id="dir_name" required="required"
                           placeholder="New Folder Name">
                </form>
            </div>
        </div>
    </div>
    <div class="frame">
        <!-- //header -->
        <div class="container">
            <!-- //nav -->
            <div class="content">
                <table id="hor-minimalist-b" width = 100%>
                    <thead>
                    <tr>
                        <th scope="col", >제목</th>
                        <th scope="col", >등록 시간</th>
                        <th scope="col", >최근 열람 시간</th>
                        <th scope="col", >즐겨찾기</th>
                        <th scope="col", >파일 크기</th>
                        <th scope="col", >파일 삭제</th>
                        <!--
                        <td width=300><p align=center>제목</p></td>
                        <td width=350><p align=center>등록 시간</p></td>
                        <td width=350><p align=center>최근 열람 시간</p></td>
                        <td width=200><p align=center>즐겨찾기</p></td>
                        <td width=200><p align=center>파일 크기</p></td>
                        <td width=200><p align=center>파일 삭제</p></td>
                        -->
                    </tr>
                    </thead>

                    {% if folderList %}
                        <tbody>
                        {% for folderRow in folderList %}
                            <tr>
                                <td><a href="/{{ folderRow.dir_name }}", align=center>{{ folderRow.dir_name }}</a></td>
                                <td><p  href="", >{{ folderRow.uploaded_TM }}</p></td>
                                <td><p  href="", >{{ folderRow.last_view_TM }}</p></td>
                                <td ><p  href="",>{{ folderRow.isFavor }}</p></td>
                                <td ><p  href="",>{{ folderRow.fileSize }}</p></td>
                                <td ><p  href="",></p></td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    {% endif %}
                    {% if fileList %}
                        <tbody>
                        {% for fileRow in fileList %}
                            <tr>
                                <td><a href="/download/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>{{ fileRow.title }}</a></td>
                                <td><p href="", >{{ fileRow.uploaded_TM }}</p></td>
                                <td><p  href="", >{{ fileRow.last_view_TM }}</p></td>
                                {% if fileRow.isFavor%}
                                    <td width=100><a  href="/changeFavor/{{ fileRow.bucketPath }}/{{ fileRow.title }}" align=center><img class = 'star_icon' src= "{% static 'resources/color_star.png' %}" width="50" height="50"/></a></td>
                                {% else %}
                                    <td width=100><a  href="/changeFavor/{{ fileRow.bucketPath }}/{{ fileRow.title }}" align=center><img class = 'star_icon' src= "{% static 'resources/gray_star.png' %}" width="50" height="50"/></a></td>
                                {% endif %}
                                <td><p  href="", >{{ fileRow.fileSize }}</p></td>
                                <td><a  href="/delete/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center><img class = 'trash_icon' src= "{% static 'resources/trashcan.png' %}" width="50" height="50"/></a></td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    {% endif %}
                </table>
                <form action="{% url 'upload' %}" id="dropzone" class="dropzone" method="post" enctype="multipart/form-data"  multi>{% csrf_token %}
                    <div class="fallback">
                        <input class="fall_back" name="source-file" type="file"/>
                    </div>
                </form>
            </div>
        </div>
        <!-- //container -->
    </div>
    <!-- //frame -->

    <script src="{% static 'js/dropzone.js' %}"></script>
    <script type="text/javascript">
        Dropzone.options.dropzone = {
            maxFilesize: 100000000, // Mb
            init: function() {
                this.on('success', function(){
                    if (this.getQueuedFiles().length == 0 && this.getUploadingFiles().length == 0) {
                        location.reload();
                    }
                });
                this.on('completemulti', function(){
                    if (this.getQueuedFiles().length == 0 && this.getUploadingFiles().length == 0) {
                        location.reload();
                    }
                });
            }
        };
    </script>

{% endblock %}