허진호

Merge branch 'dev' of https://github.com/jh8579/fileshell_cloudcomputing into dev

# Conflicts:
#	fileshell/models.py
#	fileshell/settings.py
#	fileshell/urls.py
#	fileshell/views.py
#	templates/base.html
...@@ -85,6 +85,7 @@ body { ...@@ -85,6 +85,7 @@ body {
85 font-size: 30px; 85 font-size: 30px;
86 color:#ffffff; 86 color:#ffffff;
87 margin: 10px; 87 margin: 10px;
88 + margin-top: 30px;
88 } 89 }
89 .nav-item1 { 90 .nav-item1 {
90 font-size: 30px; 91 font-size: 30px;
...@@ -104,7 +105,7 @@ body { ...@@ -104,7 +105,7 @@ body {
104 .nav-link:hover { 105 .nav-link:hover {
105 } 106 }
106 .frame { 107 .frame {
107 - width: 2000px; 108 + width: 100%;
108 109
109 } 110 }
110 .header { 111 .header {
...@@ -134,13 +135,12 @@ body { ...@@ -134,13 +135,12 @@ body {
134 padding: 0 8px; 135 padding: 0 8px;
135 } 136 }
136 .container { 137 .container {
137 -
138 overflow: hidden; 138 overflow: hidden;
139 } 139 }
140 140
141 .content { 141 .content {
142 float: left; 142 float: left;
143 - width: 1600px; 143 + width: 100%;
144 144
145 } 145 }
146 .right_bar { 146 .right_bar {
......
...@@ -16,15 +16,15 @@ class MediaStorage(S3Boto3Storage): ...@@ -16,15 +16,15 @@ class MediaStorage(S3Boto3Storage):
16 def upload_file(file, user, dir): 16 def upload_file(file, user, dir):
17 client = boto3.client('s3') 17 client = boto3.client('s3')
18 data = file 18 data = file
19 - f = open('tempfile', 'wb') 19 + f = open(file.name, 'wb')
20 for chunk in data.chunks(): 20 for chunk in data.chunks():
21 f.write(chunk) 21 f.write(chunk)
22 f.close() 22 f.close()
23 23
24 - nf = open('tempfile', 'rb') 24 + nf = open(file.name, 'rb')
25 # client.Bucket(AWS_STORAGE_BUCKET_NAME).put_object(Key=file_name, body= nf) 25 # client.Bucket(AWS_STORAGE_BUCKET_NAME).put_object(Key=file_name, body= nf)
26 client.upload_fileobj(nf, AWS_STORAGE_BUCKET_NAME, user.username + '/' + dir + file.name) 26 client.upload_fileobj(nf, AWS_STORAGE_BUCKET_NAME, user.username + '/' + dir + file.name)
27 - os.remove('tempfile') 27 + os.remove(file.name)
28 # putResponse = client.put_object(Bucket=AWS_STORAGE_BUCKET_NAME, Key= file_name) 28 # putResponse = client.put_object(Bucket=AWS_STORAGE_BUCKET_NAME, Key= file_name)
29 29
30 def down(filename, bucketPath): 30 def down(filename, bucketPath):
......
...@@ -22,9 +22,6 @@ ...@@ -22,9 +22,6 @@
22 </div> 22 </div>
23 <div class="header"> 23 <div class="header">
24 <a href="{% url 'logout' %}"> <img class = 'logout_icon' src= "{% static 'resources/logout.png' %}" width="50" height="50" align="right"/></a> 24 <a href="{% url 'logout' %}"> <img class = 'logout_icon' src= "{% static 'resources/logout.png' %}" width="50" height="50" align="right"/></a>
25 - <!--
26 - <a href="{% url 'profile' %}"> <img class = 'profile_icon' src= "{% static 'resources/profile.png' %}" width="50" height="50" align="right"/></a>
27 - -->
28 <div class="search_form"> 25 <div class="search_form">
29 <form id='search' action="" onsubmit="yourFunction()" method="post" enctype="multipart/form-data" >{% csrf_token %} 26 <form id='search' action="" onsubmit="yourFunction()" method="post" enctype="multipart/form-data" >{% csrf_token %}
30 <input type="dir_name" name="dir_name" id="dir_name" required="required" placeholder="검색할 파일이나 폴더 이름"> 27 <input type="dir_name" name="dir_name" id="dir_name" required="required" placeholder="검색할 파일이나 폴더 이름">
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
21 <div class="container"> 21 <div class="container">
22 <!-- //nav --> 22 <!-- //nav -->
23 <div class="content"> 23 <div class="content">
24 - <table id="hor-minimalist-b" width = 1000px> 24 + <table id="hor-minimalist-b" width = 100%>
25 <thead> 25 <thead>
26 <tr> 26 <tr>
27 <th scope="col", >제목</th> 27 <th scope="col", >제목</th>
...@@ -54,8 +54,6 @@ ...@@ -54,8 +54,6 @@
54 </tr> 54 </tr>
55 {% endfor %} 55 {% endfor %}
56 </tbody> 56 </tbody>
57 - {% else %}
58 - <p>No Folder.</p>
59 {% endif %} 57 {% endif %}
60 {% if fileList %} 58 {% if fileList %}
61 <tbody> 59 <tbody>
...@@ -64,18 +62,19 @@ ...@@ -64,18 +62,19 @@
64 <td><a href="/download/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>{{ fileRow.title }}</a></td> 62 <td><a href="/download/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>{{ fileRow.title }}</a></td>
65 <td><p href="", >{{ fileRow.uploaded_TM }}</p></td> 63 <td><p href="", >{{ fileRow.uploaded_TM }}</p></td>
66 <td><p href="", >{{ fileRow.last_view_TM }}</p></td> 64 <td><p href="", >{{ fileRow.last_view_TM }}</p></td>
67 - <td><a href="/changeFavor/{{ fileRow.bucketPath }}/{{ fileRow.title }}" style="text-align:center;">{{ fileRow.isFavor }}</a></td> 65 + {% if fileRow.isFavor%}
66 + <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>
67 + {% else %}
68 + <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>
69 + {% endif %}
68 <td><p href="", >{{ fileRow.fileSize }}</p></td> 70 <td><p href="", >{{ fileRow.fileSize }}</p></td>
69 - <td><a href="/delete/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>파일 삭제</a></td> 71 + <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>
70 -
71 </tr> 72 </tr>
72 {% endfor %} 73 {% endfor %}
73 </tbody> 74 </tbody>
74 - {% else %}
75 - <p>No File.</p>
76 {% endif %} 75 {% endif %}
77 </table> 76 </table>
78 - <form action="{% url 'upload' %}" id="dropzone" class="dropzone" method="post" enctype="multipart/form-data" >{% csrf_token %} 77 + <form action="{% url 'upload' %}" id="dropzone" class="dropzone" method="post" enctype="multipart/form-data" multi>{% csrf_token %}
79 <div class="fallback"> 78 <div class="fallback">
80 <input class="fall_back" name="source-file" type="file"/> 79 <input class="fall_back" name="source-file" type="file"/>
81 </div> 80 </div>
...@@ -96,6 +95,11 @@ ...@@ -96,6 +95,11 @@
96 location.reload(); 95 location.reload();
97 } 96 }
98 }); 97 });
98 + this.on('completemulti', function(){
99 + if (this.getQueuedFiles().length == 0 && this.getUploadingFiles().length == 0) {
100 + location.reload();
101 + }
102 + });
99 } 103 }
100 }; 104 };
101 </script> 105 </script>
......
...@@ -20,21 +20,23 @@ ...@@ -20,21 +20,23 @@
20 <td width=100><p>파일 삭제</p></td> 20 <td width=100><p>파일 삭제</p></td>
21 </tr> 21 </tr>
22 </thead> 22 </thead>
23 - {% if favorList %} <tbody> 23 + {% if favorList %}
24 + <tbody>
24 {% for fileRow in favorList %} 25 {% for fileRow in favorList %}
25 <tr> 26 <tr>
26 <td width=50><a href="/download/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" valign=center>{{ fileRow.title }}</a></td> 27 <td width=50><a href="/download/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" valign=center>{{ fileRow.title }}</a></td>
27 <td width=100><p href="", >{{ fileRow.uploaded_TM }}</p></td> 28 <td width=100><p href="", >{{ fileRow.uploaded_TM }}</p></td>
28 <td width=100><p href="",>{{ fileRow.last_view_TM }}</p></td> 29 <td width=100><p href="",>{{ fileRow.last_view_TM }}</p></td>
29 - <td width=100><a href="/changeFavor/{{ fileRow.bucketPath }}/{{ fileRow.title }}" align=center>{{ fileRow.isFavor }}</a></td> 30 + {% if fileRow.isFavor%}
31 + <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>
32 + {% else %}
33 + <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>
34 + {% endif %}
30 <td width=100><p href="", >{{ fileRow.fileSize }}</p></td> 35 <td width=100><p href="", >{{ fileRow.fileSize }}</p></td>
31 - <td width=100><a href="/delete/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>파일 삭제</a></td> 36 + <td width=100><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>
32 -
33 </tr> 37 </tr>
34 {% endfor %} 38 {% endfor %}
35 </tbody> 39 </tbody>
36 - {% else %}
37 - <p>No File.</p>
38 {% endif %} 40 {% endif %}
39 </table> 41 </table>
40 <div class = "shiftleft"> 42 <div class = "shiftleft">
...@@ -57,21 +59,36 @@ ...@@ -57,21 +59,36 @@
57 <tr> 59 <tr>
58 <td width=50><a href="/download/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>{{ fileRow.title }}</a></td> 60 <td width=50><a href="/download/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>{{ fileRow.title }}</a></td>
59 <td width=100><p href="", >{{ fileRow.uploaded_TM }}</p></td> 61 <td width=100><p href="", >{{ fileRow.uploaded_TM }}</p></td>
60 - <td width=100><p href="", >{{ fileRow.last_view_TM }}</p></td> 62 + <td width=100><p href="" >{{ fileRow.last_view_TM }}</p></td>
61 - <td width=100><a href="/changeFavor/{{ fileRow.bucketPath }}/{{ fileRow.title }}" align=center>{{ fileRow.isFavor }}</a></td> 63 + {% if fileRow.isFavor%}
62 - <td width=100><p href="",>{{ fileRow.fileSize }}</p></td> 64 + <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>
63 - <td width=100><a href="/delete/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>파일 삭제</a></td> 65 + {% else %}
64 - 66 + <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>
67 + {% endif %}
68 + <td width=100><p href="">{{ fileRow.fileSize }}</p></td>
69 + <td width=100><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>
65 </tr> 70 </tr>
66 {% endfor %} 71 {% endfor %}
67 </tbody> 72 </tbody>
68 - {% else %}
69 - <p>No File.</p>
70 {% endif %} 73 {% endif %}
71 </table> 74 </table>
72 </div> 75 </div>
73 </div> 76 </div>
74 <!-- //container --> 77 <!-- //container -->
75 </div> 78 </div>
79 +
80 + <script src="{% static 'js/dropzone.js' %}"></script>
81 + <script type="text/javascript">
82 + Dropzone.options.dropzone = {
83 + maxFilesize: 10, // Mb
84 + init: function() {
85 + this.on('success', function(){
86 + if (this.getQueuedFiles().length == 0 && this.getUploadingFiles().length == 0) {
87 + location.reload();
88 + }
89 + });
90 + }
91 + };
92 + </script>
76 <!-- //frame --> 93 <!-- //frame -->
77 {% endblock %} 94 {% endblock %}
......
...@@ -39,9 +39,13 @@ ...@@ -39,9 +39,13 @@
39 <td width=50><a href="/download/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>{{ fileRow.title }}</a></td> 39 <td width=50><a href="/download/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>{{ fileRow.title }}</a></td>
40 <td width=100><p href="", >{{ fileRow.uploaded_TM }}</p></td> 40 <td width=100><p href="", >{{ fileRow.uploaded_TM }}</p></td>
41 <td width=100><p href="", >{{ fileRow.last_view_TM }}</p></td> 41 <td width=100><p href="", >{{ fileRow.last_view_TM }}</p></td>
42 - <td width=100><a href="/changeFavor/{{ fileRow.bucketPath }}/{{ fileRow.title }}" align=center>{{ fileRow.isFavor }}</a></td> 42 + {% if fileRow.isFavor%}
43 + <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>
44 + {% else %}
45 + <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>
46 + {% endif %}
43 <td width=100><p href="", >{{ fileRow.fileSize }}</p></td> 47 <td width=100><p href="", >{{ fileRow.fileSize }}</p></td>
44 - <td width=100><a href="/delete/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>파일 삭제</a></td> 48 + <td width=100><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>
45 </tr> 49 </tr>
46 {% endfor %} 50 {% endfor %}
47 </tbody> 51 </tbody>
......