Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
1d072fb7
Commit
1d072fb7
authored
Jun 10, 2011
by
Georgios Gousios
Browse files
Methods to retrieve list of active synnefo users
parent
272dca5e
Changes
7
Hide whitespace changes
Inline
Side-by-side
helpdesk/helpdesk.py
View file @
1d072fb7
# vim: set fileencoding=utf-8 :
# Copyright 2011 GRNET S.A. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are
# those of the authors and should not be interpreted as representing official
# policies, either expressed or implied, of GRNET S.A.
from
django.views.decorators.csrf
import
csrf_protect
from
django.template.loader
import
render_to_string
from
django.template.context
import
RequestContext
from
django.http
import
HttpResponse
from
synnefo.db.models
import
SynnefoUser
,
Invitations
from
synnefo.api.common
import
method_not_allowed
@
csrf_protect
def
index
(
request
):
if
request
.
method
==
'GET'
:
data
=
render_to_string
(
'helpdesk.html'
,
{
'users'
:
get_users
(
request
)},
context_instance
=
RequestContext
(
request
))
return
HttpResponse
(
data
)
else
:
method_not_allowed
(
request
)
def
get_users
(
request
):
#XXX: The following filter should change when the invitations app is removed
invitations
=
Invitations
.
objects
.
filter
(
accepted
=
False
)
ids
=
map
(
lambda
x
:
x
.
target
.
id
,
invitations
)
users
=
SynnefoUser
.
objects
.
exclude
(
id__in
=
ids
).
order_by
(
'realname'
)
result
=
[]
for
user
in
users
:
resultentry
=
{}
resultentry
[
'id'
]
=
user
.
id
resultentry
[
'name'
]
=
user
.
realname
result
.
append
(
resultentry
)
return
result
def
get_tmp_token
(
request
):
pass
\ No newline at end of file
helpdesk/templates/helpdesk.html
0 → 100644
View file @
1d072fb7
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>
Σύννεφο -- Εφαρμογή HelpDesk
</title>
<script
src=
"/static/jquery.tools.min.js"
></script>
<style>
.center
{
text-align
:
center
;}
.header
{
height
:
10%
;}
.frame
{
width
:
100%
;
height
:
90%
}
</style>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
(
"
#go
"
).
$
.
ajax
({
url
:
'
/helpdesk/token
'
,
type
:
'
POST
'
,
success
:
function
(
data
)
{
},
error
:
function
()
{
}
});
});
</script>
</head>
<body>
<div
id=
"header"
class=
"center"
>
Επιλέξτε το όνομα του χρήστη:
<select
id=
"username"
>
<option
value=
""
>
--Επιλογή--
</option>
{% for user in users %}
<option
value=
"{{ user.id }}"
>
{{ user.name }}
</option>
{% endfor %}
</select>
<input
id=
"go"
type=
"button"
value=
"Go"
/>
</div>
<iframe
id=
"content"
src=
"/"
class=
"center frame"
>
<p>
Your browser does not support iframes.
Use a current millenium browser.
</p>
</iframe>
</body>
</html>
\ No newline at end of file
helpdesk/templates/index.html
deleted
100644 → 0
View file @
272dca5e
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>
Σύννεφο -- Εφαρμογή HelpDesk
</title>
</head>
<body>
<div
id=
"header"
>
Επιλέξτε το όνομα του χρήστη:
<select
id=
"username"
>
<option
value=
""
>
--Επιλέξτε χρήστη--
</option>
{% for user in users %}
<option
value=
"{{ user.id }}"
>
{{ user.name }}
</option>
{% endfor %}
</select>
<input
type=
"button"
value=
"Go"
/>
</div>
<iframe
id=
"content"
src=
""
>
<p>
Your browser does not support iframes. Use a current millenium browser.
</p>
</iframe>
</body>
</html>
\ No newline at end of file
helpdesk/urls.py
View file @
1d072fb7
...
...
@@ -2,5 +2,6 @@ from django.conf.urls.defaults import *
import
os
urlpatterns
=
patterns
(
''
,
(
r
'^$'
,
'synnefo.helpdesk.helpdesk.index'
),
(
r
'^/token$'
,
'synnefo.helpdesk.helpdesk.get_tmp_token'
),
)
invitations/invitations.py
View file @
1d072fb7
...
...
@@ -28,6 +28,8 @@ def process_form(request):
for
inv
in
valid_inv
:
(
name
,
inv_id
)
=
inv
.
split
(
'_'
)
email
=
""
name
=
""
try
:
email
=
request
.
POST
[
'email_'
+
inv_id
]
name
=
request
.
POST
[
inv
]
...
...
settings.py.dist
View file @
1d072fb7
...
...
@@ -133,6 +133,7 @@ INSTALLED_APPS = (
'synnefo.ganeti',
'synnefo.logic',
'synnefo.invitations',
'synnefo.helpdesk',
'south'
)
...
...
urls.py
View file @
1d072fb7
...
...
@@ -15,4 +15,5 @@ urlpatterns = patterns('',
(
r
'^'
,
include
(
'synnefo.ui.urls'
)),
(
r
'^admin/'
,
include
(
admin
.
site
.
urls
)),
(
r
'^invitations/?'
,
include
(
'synnefo.invitations.urls'
)),
(
r
'^helpdesk/?'
,
include
(
'synnefo.helpdesk.urls'
)),
)
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