1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

* Added support for Android OS

* Updated HTML5 part a bit
* Added printing support for guacamole
This commit is contained in:
Adolfo Gómez 2013-11-05 22:00:12 +00:00
parent 66d56dc6e5
commit aba57d8400
8 changed files with 69 additions and 48 deletions

View File

@ -38,9 +38,10 @@ logger = logging.getLogger(__name__)
Linux = 'Linux'
Windows = 'Windows'
Macintosh = 'Macintosh'
Android = 'Android'
knownOss = { 'Linux' : Linux, 'Windows' : Windows, 'Macintosh' : Macintosh }
knownOss = { 'Linux' : Linux, 'Windows' : Windows, 'Macintosh' : Macintosh, 'Android': Android }
def getOsFromUA(ua):
'''
@ -54,6 +55,7 @@ def getOsFromUA(ua):
break
except Exception:
pass
logger.debug(res)
logger.debug('User-Agent: {0}'.format(ua))
logger.debug('Detected OS: {0}'.format(res))
return res

View File

@ -1,9 +1,12 @@
@CHARSET "UTF-8";
html, body {
height: 100%;
}
body {
padding-top: 60px;
padding-bottom: 40px;
background-color: #ffffff;
}
@media (max-width: 979px) {
@ -14,6 +17,7 @@ body {
footer {
display: none;
padding:1.6% 2%;
margin-top:4em;
text-align:right;
@ -85,13 +89,9 @@ footer {
}
.profile-img
{
font-size: 96px;
width: 96px;
height: 96px;
margin: 0 auto 10px;
display: block;
-moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -1,33 +1,35 @@
{% extends "uds/html5/internal_page.html" %}
{% load i18n static html5 %}
{% block css %}
<style>
.testing {
width: 95px;
height: 95px;
margin-bottom: 16px;
margin-left: 16px;
background: rgb(255,255,255); /* Old browsers */
background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(229,229,229,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(229,229,229,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5e5e5',GradientType=0 ); /* IE6-9 */
overflow: hidden;
}
</style>
{% endblock %}
{% block js %}
<script>
function squarifyMe(element) {
squareItUp();
window.onresize = function(element) {
squareItUp();
}
function squareItUp() {
$(element).height($(element).width());
}
}
$(function() {
squarifyMe('.square');
{% if not java %}
$('#jmessage').dialog({
autoOpen: false,
width: 500,
buttons: {
"Ok": function() {
$(this).dialog("close");
}
}
});
$("a.nojava").click( function() {
$('#jmessage').dialog('open');
$('#no-java-dialog').modal({
keyboard: false
})
return false;
});
@ -38,16 +40,14 @@
{% block body %}
<h2>{% trans "Services" %}</h2>
<ul>
<div class="row">
{% for ser in services %}
{% if forloop.counter0|divisibleby:2 == 1 %}
</div><div class="row">
{% endif %}
<div class="clearfix">
{% for ser in services %}
{% if ser.transports %}
{% with trans=ser.transports|first %}
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
{% if forloop.counter0 > 0 %}
{% endif %}
<div class="pull-left">
<div class="thumbnail testing">
<a class="{% if not java and trans.needsJava %} nojava{% endif %}" href="{% url "uds.web.views.service" idService=ser.id idTransport=trans.id %}">
<img src="{% url "uds.web.views.transportIcon" idTrans=trans.id %}" class="" alt="{{ ser.name }}" />
<div class="caption">{{ ser.name }}</div>
@ -64,10 +64,23 @@
</div>
{% if not java %}
<div id="jmessage" title="{% trans "Java not found" %}">
<p>{% trans "Java is not available on your browser, and the selected transport needs it." %}</p>
<p>{% trans "Please, install latest version from" %} <a href="http://www.java.com">{% trans "Java website" %}</a> {% trans "and restart browser" %}</p>
</div>
<div class="modal fade" id="no-java-dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">{% trans "Java not found" %}</h4>
</div>
<div class="modal-body">
<p>{% trans "Java is not available on your browser, and the selected transport needs it." %}</p>
<p>{% trans "Please, install latest version from" %} <a href="http://www.java.com" target="_blank">{% trans "Java website" %}</a> {% trans "and restart browser" %}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
{% endif %}
{% if user.isStaff %}

View File

@ -69,10 +69,10 @@
{% block body %}
<div class="container">
<div class="row" id="login">
<div class="col-sm-6 col-md-4 col-md-offset-4">
<div class="col-md-4 col-md-offset-4">
<h1 class="text-center login-title">{% trans 'Welcome to UDS' %}</h1>
<div class="account-wall">
<span class="fa fa-user profile-img text-info"></span>
<img class="profile-img" src="{% get_static_prefix %}img/login-img.png" alt="">
<form id="loginform" class="form-signin" name="loginform" method="post">
{% if form.errors %}
<div class="alert alert-dismissable alert-danger">

View File

@ -39,6 +39,7 @@ from uds.core.util.Cache import Cache
from uds.core.util import net
from uds.core.transports.BaseTransport import Transport
from uds.core.util import connection
from uds.core.util import OsDetector
import logging
@ -56,6 +57,7 @@ class HTML5RDPTransport(Transport):
typeDescription = _('RDP Transport using HTML5 client')
iconFile = 'rdp.png'
needsJava = False # If this transport needs java for rendering
supportedOss = [OsDetector.Linux, OsDetector.Windows, OsDetector.Macintosh, OsDetector.Android]
guacamoleServer = gui.TextField(label=_('Tunnel Server'), order = 1, tooltip = _('Host of the tunnel server (use http/https & port if needed) as accesible from users'), defvalue = 'https://', length = 64)
useEmptyCreds = gui.CheckBoxField(label = _('Empty creds'), order = 2, tooltip = _('If checked, the credentials used to connect will be emtpy'))
@ -122,7 +124,7 @@ class HTML5RDPTransport(Transport):
# Build params dict
params = { 'protocol':'rdp',
'hostname':ip, 'username': username, 'password': password,
'ignore-cert': 'true',
'ignore-cert': 'true', 'enable-printing': 'true'
}
if self.enableAudio.isTrue() is False:

View File

@ -47,11 +47,11 @@ class CustomSelect(forms.Select):
visible = 'style="display: none;"'
else:
visible = '';
res = '<select id="id_{0}" name="{0}" class="form-control"{1}>'.format(name, visible)
res = '<select id="id_{0}" name="{0}" class="form-control">'.format(name)
for choice in self.choices:
res += '<option value="{0}">{1}</option>'.format(choice[0], choice[1])
res += '</select>'
return mark_safe('<div class="form-group"><label>' + unicode(_('authenticator')) + '</label>' + res + '</div>')
return mark_safe('<div class="form-group"{0}><label>'.format(visible) + unicode(_('authenticator')) + '</label>' + res + '</div>')
class BaseForm(forms.Form):

View File

@ -161,6 +161,8 @@ def index(request):
# Information for administrators
nets = ''
validTrans = ''
logger.debug('OS: {0}'.format(os['OS']))
if request.user.isStaff():
nets = ','.join( [ n.name for n in Network.networksFor(request.ip) ])
@ -205,10 +207,12 @@ def index(request):
)
return render_to_response(theme.template('index.html'),
response = render_to_response(theme.template('index.html'),
{'services' : services, 'java' : java, 'ip' : request.ip, 'nets' : nets,
'transports' : validTrans },
context_instance=RequestContext(request))
return response
@webLoginRequired
def prefs(request):