허진호

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 {
font-size: 30px;
color:#ffffff;
margin: 10px;
margin-top: 30px;
}
.nav-item1 {
font-size: 30px;
......@@ -104,7 +105,7 @@ body {
.nav-link:hover {
}
.frame {
width: 2000px;
width: 100%;
}
.header {
......@@ -134,13 +135,12 @@ body {
padding: 0 8px;
}
.container {
overflow: hidden;
}
.content {
float: left;
width: 1600px;
width: 100%;
}
.right_bar {
......
......@@ -16,15 +16,15 @@ class MediaStorage(S3Boto3Storage):
def upload_file(file, user, dir):
client = boto3.client('s3')
data = file
f = open('tempfile', 'wb')
f = open(file.name, 'wb')
for chunk in data.chunks():
f.write(chunk)
f.close()
nf = open('tempfile', 'rb')
nf = open(file.name, 'rb')
# client.Bucket(AWS_STORAGE_BUCKET_NAME).put_object(Key=file_name, body= nf)
client.upload_fileobj(nf, AWS_STORAGE_BUCKET_NAME, user.username + '/' + dir + file.name)
os.remove('tempfile')
os.remove(file.name)
# putResponse = client.put_object(Bucket=AWS_STORAGE_BUCKET_NAME, Key= file_name)
def down(filename, bucketPath):
......
......@@ -22,9 +22,6 @@
</div>
<div class="header">
<a href="{% url 'logout' %}"> <img class = 'logout_icon' src= "{% static 'resources/logout.png' %}" width="50" height="50" align="right"/></a>
<!--
<a href="{% url 'profile' %}"> <img class = 'profile_icon' src= "{% static 'resources/profile.png' %}" width="50" height="50" align="right"/></a>
-->
<div class="search_form">
<form id='search' action="" onsubmit="yourFunction()" method="post" enctype="multipart/form-data" >{% csrf_token %}
<input type="dir_name" name="dir_name" id="dir_name" required="required" placeholder="검색할 파일이나 폴더 이름">
......
......@@ -21,7 +21,7 @@
<div class="container">
<!-- //nav -->
<div class="content">
<table id="hor-minimalist-b" width = 1000px>
<table id="hor-minimalist-b" width = 100%>
<thead>
<tr>
<th scope="col", >제목</th>
......@@ -54,8 +54,6 @@
</tr>
{% endfor %}
</tbody>
{% else %}
<p>No Folder.</p>
{% endif %}
{% if fileList %}
<tbody>
......@@ -64,18 +62,19 @@
<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>
<td><a href="/changeFavor/{{ fileRow.bucketPath }}/{{ fileRow.title }}" style="text-align:center;">{{ fileRow.isFavor }}</a></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>파일 삭제</a></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>
{% else %}
<p>No File.</p>
{% endif %}
</table>
<form action="{% url 'upload' %}" id="dropzone" class="dropzone" method="post" enctype="multipart/form-data" >{% csrf_token %}
<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>
......@@ -96,6 +95,11 @@
location.reload();
}
});
this.on('completemulti', function(){
if (this.getQueuedFiles().length == 0 && this.getUploadingFiles().length == 0) {
location.reload();
}
});
}
};
</script>
......
......@@ -20,21 +20,23 @@
<td width=100><p>파일 삭제</p></td>
</tr>
</thead>
{% if favorList %} <tbody>
{% if favorList %}
<tbody>
{% for fileRow in favorList %}
<tr>
<td width=50><a href="/download/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" valign=center>{{ fileRow.title }}</a></td>
<td width=100><p href="", >{{ fileRow.uploaded_TM }}</p></td>
<td width=100><p href="",>{{ fileRow.last_view_TM }}</p></td>
<td width=100><a href="/changeFavor/{{ fileRow.bucketPath }}/{{ fileRow.title }}" align=center>{{ fileRow.isFavor }}</a></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 width=100><p href="", >{{ fileRow.fileSize }}</p></td>
<td width=100><a href="/delete/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>파일 삭제</a></td>
<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>
</tr>
{% endfor %}
</tbody>
{% else %}
<p>No File.</p>
{% endif %}
</table>
<div class = "shiftleft">
......@@ -57,21 +59,36 @@
<tr>
<td width=50><a href="/download/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>{{ fileRow.title }}</a></td>
<td width=100><p href="", >{{ fileRow.uploaded_TM }}</p></td>
<td width=100><p href="", >{{ fileRow.last_view_TM }}</p></td>
<td width=100><a href="/changeFavor/{{ fileRow.bucketPath }}/{{ fileRow.title }}" align=center>{{ fileRow.isFavor }}</a></td>
<td width=100><p href="",>{{ fileRow.fileSize }}</p></td>
<td width=100><a href="/delete/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>파일 삭제</a></td>
<td width=100><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 width=100><p href="">{{ fileRow.fileSize }}</p></td>
<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>
</tr>
{% endfor %}
</tbody>
{% else %}
<p>No File.</p>
{% endif %}
</table>
</div>
</div>
<!-- //container -->
</div>
<script src="{% static 'js/dropzone.js' %}"></script>
<script type="text/javascript">
Dropzone.options.dropzone = {
maxFilesize: 10, // Mb
init: function() {
this.on('success', function(){
if (this.getQueuedFiles().length == 0 && this.getUploadingFiles().length == 0) {
location.reload();
}
});
}
};
</script>
<!-- //frame -->
{% endblock %}
......
......@@ -39,9 +39,13 @@
<td width=50><a href="/download/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>{{ fileRow.title }}</a></td>
<td width=100><p href="", >{{ fileRow.uploaded_TM }}</p></td>
<td width=100><p href="", >{{ fileRow.last_view_TM }}</p></td>
<td width=100><a href="/changeFavor/{{ fileRow.bucketPath }}/{{ fileRow.title }}" align=center>{{ fileRow.isFavor }}</a></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 width=100><p href="", >{{ fileRow.fileSize }}</p></td>
<td width=100><a href="/delete/{{ fileRow.bucketPath }}{{ fileRow.title }}//{{ fileRow.title }}//{{ fileRow.bucketPath }}" align=center>파일 삭제</a></td>
<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>
</tr>
{% endfor %}
</tbody>
......