Toggle navigation
Toggle navigation
This project
Loading...
Sign in
신은섭(Shin Eun Seop)
/
2018-1-d.cloud
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
10
Merge Requests
0
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Kangsubeen
2018-06-13 18:38:26 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d432d50e47daa9f319f17cecb137909d3c4c4da2
d432d50e
1 parent
02357f2c
make folder
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
12 deletions
dcloud/website/templates/website/file_list.html
dcloud/website/urls.py
dcloud/website/views.py
dcloud/website/templates/website/file_list.html
View file @
d432d50
...
...
@@ -15,8 +15,13 @@
</form>
</div>
</center>
<button
class=
"ui primary button"
style=
"margin-left: 28%"
type=
"submit"
onclick=
"make_folder()"
><i
class=
"plus icon"
></i>
폴더 만들기
</button>
<div>
<button
class=
"ui primary button"
style=
"margin-left: 28%"
onclick=
"make_folder()"
><i
class=
"plus icon"
></i>
폴더 만들기
</button>
<div
style=
"display: none;"
id=
"dir_make"
>
<input
type=
"text"
id=
"dir_name"
>
<button
class=
"ui primary button"
onclick=
"make_directory({{path}} )"
>
만들기
</button>
</div>
</div>
<br>
<center>
<table
style=
"margin-top: 7px"
class=
"ui celled striped collapsing table"
>
...
...
@@ -40,10 +45,19 @@
<i
class=
"file outline icon"
></i>
{{file.name}}
{% endif %}
</td>
<td
class=
"center aligned collapsing"
><i
onclick=
"make_folder()"
style=
"cursor: pointer;"
class=
"copy outline icon"
></i></td>
<td
class=
"center aligned collapsing"
>
{% with new_path=path|add:file.name|add:'/' %}
<a
href=
"#"
><i
class=
"copy outline icon"
></i></a>
{% endwith %}
</td>
<td
class=
"center aligned collapsing"
><i
onclick=
"make_folder()"
style=
"cursor: pointer;"
class=
"sign out alternate icon"
></i></td>
<td
class=
"center aligned collapsing"
><i
onclick=
"make_folder()"
style=
"cursor: pointer;"
class=
"trash alternate outline icon"
></i></td>
<td
class=
"center aligned collapsing"
><i
onclick=
"make_folder()"
style=
"cursor: pointer;"
class=
"download icon"
></i></td>
<td
class=
"center aligned collapsing"
>
{% with new_path=path|add:file.name|add:'/' %}
<a
href=
"{% url 'file_delete' path=new_path %}"
><i
class=
"trash alternate outline icon"
></i></a>
{% endwith %}
</td>
<td
class=
"center aligned collapsing"
><i
style=
"cursor: pointer;"
class=
"download icon"
></i></td>
</tr>
{% endfor %}
</tbody>
...
...
@@ -62,7 +76,14 @@
}
}
function
make_folder
(){
location
.
href
=
"/make_folder/"
;
document
.
getElementById
(
"dir_make"
).
style
.
display
=
"inline-block"
;
}
function
make_directory
(
dir_path
){
dir
=
document
.
getElementById
(
"dir_name"
).
value
;
var
dir_path
=
"{{ path }}"
;
new_path
=
dir_path
+
dir
+
'/'
;
location
.
href
=
"{% url 'make_folder' path='' %}"
+
new_path
;
}
function
copy
(){
...
...
@@ -71,7 +92,7 @@
function
move
(){
}
function
delete
(){
function
delete
_file
(){
}
function
download
(){
...
...
dcloud/website/urls.py
View file @
d432d50
...
...
@@ -12,6 +12,7 @@ urlpatterns = [
url
(
r'^$'
,
views
.
home
,
name
=
'home'
),
url
(
r'^list/(?P<path>([\w\s가-힣.\`\'\˜\=\+\#\ˆ\@\$\&\-\.\(\)\{\}\;\[\]]*/)*)$'
,
views
.
file_list
,
name
=
'file_list'
),
url
(
r'^upload/(?P<path>([\w\s가-힣.\`\'\˜\=\+\#\ˆ\@\$\&\-\.\(\)\{\}\;\[\]]*/)*)$'
,
views
.
file_upload
,
name
=
'file_upload'
),
url
(
r'^make_folder/'
,
views
.
make_folder
,
name
=
'make_folder'
),
url
(
r'^download/(?P<path>([\w\s가-힣.\`\'\˜\=\+\#\ˆ\@\$\&\-\.\(\)\{\}\;\[\]]*/)*)$'
,
views
.
file_download
,
name
=
'file_download'
),
url
(
r'^delete/(?P<path>([\w\s가-힣.\`\'\˜\=\+\#\ˆ\@\$\&\-\.\(\)\{\}\;\[\]]*/)*)$'
,
views
.
file_delete
,
name
=
'file_delete'
),
url
(
r'^make_folder/(?P<path>([\w\s가-힣.\`\'\˜\=\+\#\ˆ\@\$\&\-\.\(\)\{\}\;\[\]]*/)*)$'
,
views
.
make_folder
,
name
=
'make_folder'
),
]
\ No newline at end of file
...
...
dcloud/website/views.py
View file @
d432d50
...
...
@@ -28,11 +28,26 @@ def file_upload(request, path):
cookies
=
{
'sessionid'
:
request
.
session
.
session_key
}
cookies
[
'csrftoken'
]
=
csrf
.
get_token
(
request
)
headers
=
{
'X-CSRFToken'
:
cookies
[
'csrftoken'
]}
print
(
cookies
)
requests
.
post
(
'http://localhost:8000/restapi/list/'
,
files
=
{
'file'
:
file
},
headers
=
headers
,
cookies
=
cookies
)
requests
.
post
(
'http://localhost:8000/restapi/list/'
+
path
,
files
=
{
'file'
:
file
},
headers
=
headers
,
cookies
=
cookies
)
return
redirect
(
'file_list'
,
path
=
path
)
def
make_folder
(
request
,
path
):
dir_name
=
request
.
POST
.
get
(
'dir_name'
)
cookies
=
{
'sessionid'
:
request
.
session
.
session_key
}
files
=
requests
.
put
(
'http://localhost:8000/restapi/list/'
+
path
,
cookies
=
cookies
)
cookies
[
'csrftoken'
]
=
csrf
.
get_token
(
request
)
headers
=
{
'X-CSRFToken'
:
cookies
[
'csrftoken'
]}
print
(
path
)
files
=
requests
.
put
(
'http://localhost:8000/restapi/list/'
+
path
,
headers
=
headers
,
cookies
=
cookies
)
return
redirect
(
'file_list'
,
path
=
path
)
def
file_delete
(
request
,
path
):
cookies
=
{
'sessionid'
:
request
.
session
.
session_key
}
cookies
[
'csrftoken'
]
=
csrf
.
get_token
(
request
)
headers
=
{
'X-CSRFToken'
:
cookies
[
'csrftoken'
]}
requests
.
delete
(
'http://localhost:8000/restapi/file/'
+
path
,
headers
=
headers
,
cookies
=
cookies
)
return
redirect
(
'file_list'
,
path
=
"/"
.
join
(
path
.
split
(
"/"
)[:
-
2
]))
def
file_download
(
request
,
path
):
cookies
=
{
'sessionid'
:
request
.
session
.
session_key
}
requests
.
get
(
'http://localhost:8000/restapi/file/'
+
path
,
cookies
=
cookies
)
return
redirect
(
'file_list'
,
path
=
"/"
.
join
(
path
.
split
(
"/"
)[:
-
2
]))
\ No newline at end of file
...
...
Please
register
or
login
to post a comment