Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5a638abf
authored
Jan 31, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'store-ajax'
parents
37bc0615
e46644ad
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
108 additions
and
129 deletions
+108
-129
cloud/urls.py
+1
-0
one/static/box.less
+1
-0
one/static/cloud.js
+66
-0
one/static/knockout.min.js
+0
-0
one/templates/base.html
+2
-59
one/templates/box-vmlist.html
+2
-1
one/templates/home.html
+7
-68
store/views.py
+29
-1
No files found.
cloud/urls.py
View file @
5a638abf
...
@@ -27,4 +27,5 @@ urlpatterns = patterns('',
...
@@ -27,4 +27,5 @@ urlpatterns = patterns('',
url
(
r'^store/$'
,
'store.views.index'
,
name
=
'store_index'
),
url
(
r'^store/$'
,
'store.views.index'
,
name
=
'store_index'
),
url
(
r'^store/top/$'
,
'store.views.toplist'
,
name
=
'store_top'
),
url
(
r'^store/top/$'
,
'store.views.toplist'
,
name
=
'store_top'
),
url
(
r'^ajax/templateWizard$'
,
'one.views.ajax_template_wizard'
,
name
=
'ajax_template_wizard'
),
url
(
r'^ajax/templateWizard$'
,
'one.views.ajax_template_wizard'
,
name
=
'ajax_template_wizard'
),
url
(
r'^ajax/store/list$'
,
'store.views.ajax_listfolder'
,
name
=
'store_ajax_listfolder'
),
)
)
one/static/box.less
View file @
5a638abf
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#new-wm-tooltip{
#new-wm-tooltip{
position: relative;
position: relative;
z-index: 1;
}
}
#new-wm-tooltip-container{
#new-wm-tooltip-container{
margin: 10px 10px 5px 150px;
margin: 10px 10px 5px 150px;
...
...
one/static/cloud.js
0 → 100644
View file @
5a638abf
var
toggleDetails
;
$
(
function
(){
toggleDetails
=
function
(){
if
(
$
(
this
).
next
(
'.details'
).
is
(
':hidden'
)){
$
(
this
).
next
(
'.details'
).
slideDown
(
700
);
$
(
this
).
parent
(
'.wm'
).
addClass
(
'opened'
);
}
else
{
var
that
=
this
;
$
(
this
).
next
(
'.details'
).
slideUp
(
700
,
function
(){
$
(
that
).
parent
(
'.wm'
).
removeClass
(
'opened'
);
});
}
}
$
(
'.wm .summary'
).
unbind
(
'click'
).
click
(
toggleDetails
);
$
(
'#load-more-files'
).
click
(
function
(){
$
(
'.actions'
,
this
).
show
();
var
that
=
this
;
setTimeout
(
function
(){
$
(
that
).
prev
(
'li'
).
slideDown
(
500
,
function
(){
$
(
'.actions'
,
that
).
hide
();
});
},
2000
);
})
$
(
'#new-wm-button'
).
click
(
function
(){
$
(
'#modal'
).
show
();
$
(
'#modal-container'
).
html
(
$
(
'#new-wm'
).
html
());
$
(
'#modal-container .wm .summary'
).
each
(
function
(){
this
.
originalHeight
=
parseInt
(
$
(
this
).
next
(
'.details'
).
css
(
'height'
));
})
$
(
'#modal-container .wm .summary'
).
click
(
toggleDetails
);
});
$
(
'#new-template-button'
).
click
(
function
(){
$
(
'#modal'
).
show
();
$
(
'#modal-container'
).
html
(
$
(
'#new-template'
).
html
());
});
$
(
'#shadow'
).
click
(
function
(){
$
(
'#modal'
).
hide
();
})
$
(
'#new-template-button'
).
click
(
function
(){
$
.
get
(
'/ajax/templateWizard'
,
function
(
data
){
$
(
'#modal-container'
).
html
(
data
);
})
$
(
'#modal'
).
show
();
});
var
Model
=
function
(){
var
self
=
this
;
self
.
files
=
ko
.
observableArray
();
$
.
ajax
({
type
:
'POST'
,
url
:
'/ajax/store/list'
,
dataType
:
'json'
,
}).
done
(
function
(
data
){
for
(
var
i
in
data
){
data
[
i
].
getTypeClass
=
function
(
t
){
return
'name filetype-'
+
(
t
==
'D'
?
'folder'
:
'text'
);
}(
data
[
i
].
TYPE
);
data
[
i
].
SIZE
=
data
[
i
].
TYPE
==
'D'
?
'katalógus'
:(
data
[
i
].
SIZE
+
'K'
);
data
[
i
].
TYPE
=
data
[
i
].
TYPE
==
'D'
?
'katalógus'
:
'fájl'
;
}
self
.
files
(
data
);
$
(
'.wm .summary'
).
unbind
(
'click'
).
click
(
toggleDetails
);
})
}
var
model
=
new
Model
();
ko
.
applyBindings
(
model
);
})
one/static/knockout.min.js
0 → 100644
View file @
5a638abf
This diff is collapsed.
Click to expand it.
one/templates/base.html
View file @
5a638abf
...
@@ -11,65 +11,8 @@
...
@@ -11,65 +11,8 @@
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<script
src=
"/static/jquery.min.js"
></script>
<script
src=
"/static/jquery.min.js"
></script>
<script
src=
"/static/less.min.js"
></script>
<script
src=
"/static/less.min.js"
></script>
<script
type=
"text/javascript"
>
<script
src=
"/static/knockout.min.js"
></script>
var
toggleDetails
;
<script
type=
"text/javascript"
src=
"/static/cloud.js"
></script>
$
(
function
(){
$
(
'.wm .summary'
).
each
(
function
(){
this
.
originalHeight
=
parseInt
(
$
(
this
).
next
(
'.details'
).
css
(
'height'
));
})
toggleDetails
=
function
(){
if
(
$
(
this
).
next
(
'.details'
).
is
(
':hidden'
)){
$
(
this
).
next
(
'.details'
)
.
show
()
.
css
(
'height'
,
0
)
.
css
(
'padding'
,
'0px 5px'
)
.
animate
({
height
:
this
.
originalHeight
,
paddingTop
:
15
,
paddingBottom
:
15
},
700
);
$
(
this
).
parent
(
'.wm'
).
addClass
(
'opened'
);
}
else
{
var
that
=
this
;
$
(
this
).
next
(
'.details'
)
//2*15px paddingot le kell vonni, a jQuery szar
.
css
(
'height'
,
this
.
originalHeight
-
30
)
.
css
(
'padding'
,
'15px 5px'
)
.
animate
({
height
:
0
,
paddingTop
:
0
,
paddingBottom
:
0
},
700
,
function
(){
$
(
that
).
parent
(
'.wm'
).
removeClass
(
'opened'
);
$
(
that
).
next
(
'.details'
).
hide
();
});
}
}
$
(
'.wm .summary'
).
click
(
toggleDetails
);
$
(
'#load-more-files'
).
click
(
function
(){
$
(
'.actions'
,
this
).
show
();
var
that
=
this
;
setTimeout
(
function
(){
$
(
that
).
prev
(
'li'
).
slideDown
(
500
,
function
(){
$
(
'.actions'
,
that
).
hide
();
});
},
2000
);
})
$
(
'#new-wm-button'
).
click
(
function
(){
$
(
'#modal'
).
show
();
$
(
'#modal-container'
).
html
(
$
(
'#new-wm'
).
html
());
$
(
'#modal-container .wm .summary'
).
each
(
function
(){
this
.
originalHeight
=
parseInt
(
$
(
this
).
next
(
'.details'
).
css
(
'height'
));
})
$
(
'#modal-container .wm .summary'
).
click
(
toggleDetails
);
});
$
(
'#new-template-button'
).
click
(
function
(){
$
(
'#modal'
).
show
();
$
(
'#modal-container'
).
html
(
$
(
'#new-template'
).
html
());
});
$
(
'#shadow'
).
click
(
function
(){
$
(
'#modal'
).
hide
();
})
$
(
'#new-template-button'
).
click
(
function
(){
$
.
get
(
'/ajax/templateWizard'
,
function
(
data
){
$
(
'#modal-container'
).
html
(
data
);
})
$
(
'#modal'
).
show
();
});
})
</script>
{{ form.media }}
{{ form.media }}
{% block js %}{% endblock %}
{% block js %}{% endblock %}
...
...
one/templates/box-vmlist.html
View file @
5a638abf
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
</div>
</div>
<div
class=
"details"
>
<div
class=
"details"
>
<h3>
Részletek
</h3>
<
div
class=
"details-container"
><
h3>
Részletek
</h3>
<ul>
<ul>
<li
class=
"name"
>
Gép neve:
<span
class=
"value"
>
{{i.name}}
</span></li>
<li
class=
"name"
>
Gép neve:
<span
class=
"value"
>
{{i.name}}
</span></li>
<li
class=
"os-linux"
>
Operációs rendszer:
<span
class=
"value"
>
{{i.template.disk.name}}
</span></li>
<li
class=
"os-linux"
>
Operációs rendszer:
<span
class=
"value"
>
{{i.template.disk.name}}
</span></li>
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
<li>
<span
class=
"value"
><a
href=
"/vm/show/{{i.id}}/"
title=
"{{i.name}}"
>
További részletek
</a></span></li>
<li>
<span
class=
"value"
><a
href=
"/vm/show/{{i.id}}/"
title=
"{{i.name}}"
>
További részletek
</a></span></li>
</ul>
</ul>
</div>
</div>
</div>
</li>
</li>
{% endfor %}
{% endfor %}
{% else %}
{% else %}
...
...
one/templates/home.html
View file @
5a638abf
...
@@ -184,10 +184,11 @@
...
@@ -184,10 +184,11 @@
</h2>
</h2>
<div
class=
"content"
>
<div
class=
"content"
>
<ul
class=
"file-list"
>
<ul
class=
"file-list"
>
<!-- ko foreach: files -->
<li
class=
"wm"
>
<li
class=
"wm"
>
<div
class=
"summary"
>
<div
class=
"summary"
>
<div
class=
"name
filetype-c"
>
hello.c
</div>
<div
class=
"name
"
data-bind=
"text: NAME, attr: {class: getTypeClass}"
>
</div>
<div
class=
"info"
>
1 Kb
</div>
<div
class=
"info"
data-bind=
"text: SIZE"
>
</div>
<div
class=
"actions"
>
<div
class=
"actions"
>
<a
href=
"#"
><img
src=
"/static/icons/pencil.png"
alt=
"rename"
/></a>
<a
href=
"#"
><img
src=
"/static/icons/pencil.png"
alt=
"rename"
/></a>
<a
href=
"#"
><img
src=
"/static/icons/minus-circle.png"
alt=
"delete"
/></a>
<a
href=
"#"
><img
src=
"/static/icons/minus-circle.png"
alt=
"delete"
/></a>
...
@@ -196,77 +197,15 @@
...
@@ -196,77 +197,15 @@
<div
class=
"clear"
></div>
<div
class=
"clear"
></div>
</div>
</div>
<div
class=
"details"
>
<div
class=
"details"
>
<h3>
Részletek
</h3>
<div
class=
"details-container"
>
<ul>
<li>
Létrehozva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Módosítva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Hozzáférés:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Típus:
<span
class=
"value"
>
text/plain
</span></li>
</ul>
</div>
</li>
<li
class=
"wm"
>
<div
class=
"summary"
>
<div
class=
"name filetype-image"
>
suna.jpg
</div>
<div
class=
"info"
>
1 Kb
</div>
<div
class=
"actions"
>
<a
href=
"#"
><img
src=
"/static/icons/pencil.png"
alt=
"rename"
/></a>
<a
href=
"#"
><img
src=
"/static/icons/minus-circle.png"
alt=
"delete"
/></a>
<a
href=
"#"
><img
src=
"/static/icons/download-cloud.png"
alt=
"download"
/></a>
</div>
<div
class=
"clear"
></div>
</div>
<div
class=
"details"
>
<h3>
Részletek
</h3>
<ul>
<ul>
<li>
Létrehozva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Módosítva:
<span
class=
"value"
data-bind=
"text: MTIME"
></span></li>
<li>
Módosítva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Típus:
<span
class=
"value"
data-bind=
"text: TYPE"
></span></li>
<li>
Hozzáférés:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Típus:
<span
class=
"value"
>
image/jpg
</span></li>
</ul>
</ul>
</div>
</div>
</li>
<li
class=
"wm"
>
<div
class=
"summary"
>
<div
class=
"name filetype-folder"
>
poresz
</div>
<div
class=
"info"
>
katalógus
</div>
<div
class=
"actions"
>
<a
href=
"#"
><img
src=
"/static/icons/pencil.png"
alt=
"rename"
/></a>
<a
href=
"#"
><img
src=
"/static/icons/minus-circle.png"
alt=
"delete"
/></a>
</div>
<div
class=
"clear"
></div>
</div>
<div
class=
"details"
>
<h3>
Részletek
</h3>
<ul>
<li>
Létrehozva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Módosítva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Hozzáférés:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Fájlok:
<span
class=
"value"
>
666 db
</span></li>
</ul>
</div>
</li>
<li
class=
"wm"
style=
"display: none"
>
<div
class=
"summary"
>
<div
class=
"name filetype-text"
>
matlab_serial.txt
</div>
<div
class=
"info"
>
358 Kb
</div>
<div
class=
"actions"
>
<a
href=
"#"
><img
src=
"/static/icons/pencil.png"
alt=
"rename"
/></a>
<a
href=
"#"
><img
src=
"/static/icons/minus-circle.png"
alt=
"delete"
/></a>
<a
href=
"#"
><img
src=
"/static/icons/download-cloud.png"
alt=
"download"
/></a>
</div>
<div
class=
"clear"
></div>
</div>
<div
class=
"details"
>
<h3>
Részletek
</h3>
<ul>
<li>
Létrehozva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Módosítva:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Hozzáférés:
<span
class=
"value"
>
2012.12.29. 23:12
</span></li>
<li>
Típus:
<span
class=
"value"
>
text/plain
</span></li>
</ul>
</div>
</div>
</li>
</li>
<!-- /ko -->
<li
class=
"file-details wm"
id=
"load-more-files"
>
<li
class=
"file-details wm"
id=
"load-more-files"
>
<div
class=
"summary"
>
<div
class=
"summary"
>
<div
class=
"name filetype-more"
>
<div
class=
"name filetype-more"
>
...
...
store/views.py
View file @
5a638abf
...
@@ -5,7 +5,9 @@ from django.template import RequestContext
...
@@ -5,7 +5,9 @@ from django.template import RequestContext
from
store.api
import
StoreApi
from
store.api
import
StoreApi
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
django.views.decorators.csrf
import
csrf_exempt
import
os
import
os
import
json
@login_required
@login_required
def
index
(
request
):
def
index
(
request
):
...
@@ -17,7 +19,7 @@ def index(request):
...
@@ -17,7 +19,7 @@ def index(request):
for
key
in
request
.
user
.
sshkey_set
.
all
():
for
key
in
request
.
user
.
sshkey_set
.
all
():
key_list
.
append
(
key
.
key
)
key_list
.
append
(
key
.
key
)
except
:
except
:
return
HttpResponse
(
'Can not acces to django database!'
)
return
HttpResponse
(
'Can not acces to django database!'
,
status_code
=
404
)
if
StoreApi
.
userexist
(
user
)
!=
True
:
if
StoreApi
.
userexist
(
user
)
!=
True
:
#Create user
#Create user
if
not
StoreApi
.
createuser
(
user
,
password
,
key_list
):
if
not
StoreApi
.
createuser
(
user
,
password
,
key_list
):
...
@@ -66,6 +68,32 @@ def index(request):
...
@@ -66,6 +68,32 @@ def index(request):
file_list
=
StoreApi
.
listfolder
(
user
,
path
)
file_list
=
StoreApi
.
listfolder
(
user
,
path
)
return
render_to_response
(
'store/list.html'
,
RequestContext
(
request
,
{
'file_list'
:
file_list
,
'path'
:
path
,
'backpath'
:
backpath
,
'username'
:
user
}))
return
render_to_response
(
'store/list.html'
,
RequestContext
(
request
,
{
'file_list'
:
file_list
,
'path'
:
path
,
'backpath'
:
backpath
,
'username'
:
user
}))
@csrf_exempt
@login_required
def
ajax_listfolder
(
request
):
user
=
request
.
user
.
username
try
:
details
=
request
.
user
.
userclouddetails_set
.
all
()[
0
]
password
=
details
.
smb_password
key_list
=
[]
for
key
in
request
.
user
.
sshkey_set
.
all
():
key_list
.
append
(
key
.
key
)
except
:
return
HttpResponse
(
'Can not acces to django database!'
,
status_code
=
404
)
if
StoreApi
.
userexist
(
user
)
!=
True
:
#Create user
if
not
StoreApi
.
createuser
(
user
,
password
,
key_list
):
return
HttpResponse
(
'User does not exist on store! And could not create!'
,
status_code
=
404
)
path
=
'/'
try
:
path
=
request
.
POST
[
'path'
]
except
:
pass
#Normalize path (Need double dirname /folder/ -> /folder -> /
backpath
=
os
.
path
.
normpath
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
path
)))
file_list
=
StoreApi
.
listfolder
(
user
,
path
)
return
HttpResponse
(
json
.
dumps
(
file_list
))
@login_required
@login_required
def
toplist
(
request
):
def
toplist
(
request
):
user
=
request
.
user
.
username
user
=
request
.
user
.
username
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment