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

Advancend & sync

This commit is contained in:
Adolfo Gómez García 2016-05-06 13:29:29 +02:00
parent 7a742c043b
commit 9365f5937b
18 changed files with 256 additions and 75 deletions

View File

@ -49,7 +49,7 @@ class Images(ModelHandler):
'''
Handles the gallery REST interface
'''
needs_admin = True
# needs_admin = True
path = 'gallery'
model = Image

View File

@ -51,7 +51,7 @@ class ServicesPoolGroups(ModelHandler):
'''
Handles the gallery REST interface
'''
needs_admin = True
# needs_admin = True
path = 'gallery'
model = ServicesPoolGroup

View File

@ -64,7 +64,7 @@ import logging
logger = logging.getLogger(__name__)
__updated__ = '2015-09-04'
__updated__ = '2016-05-04'
# several constants as Width height, margins, ..
WIDTH, HEIGHT = 1800, 1000
@ -98,8 +98,8 @@ class AccessReport(UDSGeraldoReport):
height=1 * cm,
auto_expand_height=True,
elements=(
Label(text=_('Users access by date'), top=0.2 * cm, left=0, width=BAND_WIDTH,
style={'fontName': 'Helvetica-Bold', 'fontSize': 12, 'alignment': TA_CENTER}),
# Label(text=_('Users access by date'), top=0.2 * cm, left=0, width=BAND_WIDTH,
# style={'fontName': 'Helvetica-Bold', 'fontSize': 12, 'alignment': TA_CENTER}),
Label(text=_('Pool'), top=1.0 * cm, left=1.2 * cm,
style={'fontName': 'Helvetica-Bold', 'fontSize': 9}),

View File

@ -4,8 +4,8 @@ gui.servicesPools = new GuiElement(api.servicesPools, "servicespools")
# To allow fast admin navigation
gui.servicesPools.fastLink = (event, obj) ->
gui.doLog 'FastLink clicked', obj
event.preventDefault();
event.stopPropagation();
event.preventDefault()
event.stopPropagation()
$obj = $(obj);
if $obj.hasClass('goServiceLink')
vals = $obj.attr('href').substr(1).split(',')

View File

@ -173,10 +173,13 @@ launchSafari = (el, url, alt) ->
), 2800
uds.launch = (el) ->
url = el.attr('data-href')
url = if url? then url else el.attr('href')
alt = el.attr('data-href-alt')
uds.launch = (el, url, alt) ->
if url is undefined
url = el.attr('data-href')
url = if url? then url else el.attr('href')
if alt is undefined
alt = el.attr('data-href-alt')
blockUI()
@ -187,7 +190,6 @@ uds.launch = (el) ->
type: "GET"
dataType: "json"
success: (data) ->
if data.error? and data.error isnt ''
unblockUI()
alert data.error

0
server/src/uds/static/semantic/css/semantic.min.css vendored Executable file → Normal file
View File

View File

@ -1,4 +1,4 @@
.uds-body {
/*.uds-body {
display: flex;
min-height: 100vh;
flex-direction: column;
@ -6,7 +6,7 @@
.uds-content {
flex: 1;
}
}*/
footer {
text-align: right;

View File

@ -3,6 +3,7 @@
{% block title %}{% trans 'Available services list' %}{% endblock %}
{% block body %}
{% if groups|length > 1 %}
<ul class="nav nav-tabs nav-justified" id="services-tabs">
{% for grp in groups %}
<li{% if forloop.first %} class="active"{% endif %} data-name='tab-services-{{ forloop.counter }}'>
@ -13,6 +14,7 @@
{% comment %}<a href="#tab-services-{{ forloop.counter }}" data-toggle="tab" style="background: url('{% url 'galleryImage' grp.imageUuid %}') no-repeat left; display: block; background-size: 32px; min-width: 128px; padding-left: 32px; height: 40px;">{{ grp.name }}</a>{% endcomment %}
</li>
{% endfor %}
{% endif %}
</ul>
<div class="tab-content">
{% for grp in groups %}

View File

@ -24,11 +24,7 @@
<ul class="nav navbar-nav navbar-right">
<li><a href="{% url 'uds.web.views.about' %}">{% trans 'About' %}</a></li>
<li class="dropdown">
{% for lang in LANGUAGES %}
{% if lang.0 == LANGUAGE_CODE %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-comments-o"></i> {% trans lang.1|capfirst %}<b class="caret"></b></a>
{% endif %}
{% endfor %}
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-comments-o"></i> {% trans LANGUAGE_INFO.name|capfirst %}<b class="caret"></b></a>
<ul class="dropdown-menu">
{% for lang in LANGUAGES %}
{% if lang.0 != LANGUAGE_CODE %}

View File

@ -1,6 +1,7 @@
{% load l10n i18n static html5 compress %}{% spaceless %}
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info for LANGUAGE_CODE as LANGUAGE_INFO %}
<!DOCTYPE html>{% endspaceless %}
<html lang='{{LANGUAGE_CODE}}'>
<head>

View File

@ -4,6 +4,7 @@
{% block body %}
<div class="ui container">
{% if groups|length > 1 %}
<div class="ui top attached tabular menu">
{% for grp in groups %}
<a class="tab {% if forloop.first %}active{% endif %} item" data-group="{{ grp.name }}">
@ -12,6 +13,7 @@
</a>
{% endfor %}
</div>
{% endif %}
<div class="ui bottom attached segment">
<p></p>
</div>
@ -21,11 +23,28 @@
<i class="tag icon"></i> {% trans "Administrator info" %}
</h4>
<div class="ui segment">
<p>{% trans "Ip" %}: {{ ip }}</p>
{% with request.ip_proxy|add:",No Proxy" as proxy %}
<p>{% trans "Ip" %}: {{ request.ip }}, {{ request.is_proxy|yesno:proxy }}</p>
{% endwith %}
<p>{% trans "Networks" %}: {{ nets }}</p>
<p>{% trans "Transports" %}: {{ transports }}</p>
<p>{% trans "User Agent" %}: {{ request.META.HTTP_USER_AGENT }}</p>
<p>{% trans "OS" %}: {{ request.session.OS.OS }}</p>
<p>{% trans "Browser Info" %}: {{ request.os }}</p>
</div>
<div class="trans-placeholder">
<p></p>
</div>
<div class="ui basic modal info">
<i class="close icon"></i>
<div class="header info">
<p></p>
</div>
<div class="image content">
<div class="description info">
<p></p>
</div>
</div>
</div>
{% endif %}
@ -37,14 +56,17 @@
<!-- preloading of templates -->
{% js_template_path 'uds/semantic/tmpl' %}
{% js_template 'items' %}
{% js_template 'trans' %}
{% endblock %}
{% block js %}
<script>
var itemsTemplate = null;
var transTemplate = null;
var groups = {
{% for grp in groups %}
"{{ grp.name }}": {
"{{ grp.name|escape }}": {
"items": [
{% for ser in services %}
{% if ser.group.name == grp.name and ser.transports %}
@ -69,16 +91,111 @@ var groups = {
{% endfor %}
};
function getUrlVars() {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
function launch(el, url, alt) {
if ( url.substring(0, 7) == 'udsa://' ) {
uds.launch(el, url, alt);
} else {
window.location = url;
}
}
function showInfo(title, message) {
$('.header.info').html(title);
$('.description.info').html(message);
$('.modal.info').modal('show');
}
function canLaunch(item) {
if( item.not_accesible == true ) {
alert("Inaccesible");
} else if( item.maintenance == true ) {
showInfo('{% trans "In maintenance" %}', '{% trans "The service is currently in maintenance and cannot be accessed." %}');
} else {
return true;
}
return false;
}
function showSelectedTabItems() {
{% if groups|length > 1 %}
var gName = $(".tab.active").attr('data-group');
{% else %}
var gName = "{{ groups.0.name }}";
{% endif %}
$('.attached.segment').html(itemsTemplate({
'data': groups[gName].items
}));
// $(".card").off();
$(".card").on('click', function(){
var gName = $('.tab.item.active').attr('data-group');
var index = $(this).attr('data-item');
var item = groups[gName].items[index];
if( canLaunch(item) == false ) {
return;
}
launch($(this), item.transports[0].link, "{% url 'uds.web.views.client_downloads' %}");
});
$('.show-transports').on('click', function(event){
var card = $(this).parent().parent();
event.preventDefault();
event.stopPropagation();
var gName = $('.tab.item.active').attr('data-group');
var index = $(this).closest('.card').attr('data-item');
var item = groups[gName].items[index];
if( canLaunch(item) == false ) {
return;
}
// alert(groups[gName].items[index].transports[0]);
// Remove all previous modals
$('.ui.small.basic.modal').remove();
$('.trans-placeholder').html(transTemplate({
'data': item.transports
}));
$('.modal.transport')
.modal({
closable: true,
transition: "fly left",
offset: "",
onVisible: function() {
var $modal = $(this);
$('.transport-link').on('click', function(ev){
ev.preventDefault();
ev.stopPropagation();
$modal.modal('hide');
launch(card, $(this).attr('data-link'), "{% url 'uds.web.views.client_downloads' %}");
});
}
})
.modal('show')
;
});
}
// Ready function
$(function(){
itemsTemplate = Handlebars.compile($("#tmpl_items").html());
transTemplate = Handlebars.compile($("#tmpl_trans").html());
$('.modal.info').modal({
closable: true,
transition: "horizontal flip",
offset: "",
});
showSelectedTabItems();
$(".tab.item").on('click', function(){

View File

@ -9,7 +9,7 @@
console.log(val, nonStandard);
if( $.inArray(val.toString(), nonStandard) >= 0) {
var vv = val;
$("#login").hide(300, function() {
$("#loginform").hide(300, function() {
$.get('{%url "uds.web.views.customAuth" idAuth=''%}' + vv, function(data) {
$('#nonStandardLogin').html(data);
$('#nonStandard').show(300);
@ -62,7 +62,7 @@
{% block body %}
<div class="ui three column grid">
<div class="row">
<div class="six wide column centered" id="login">
<div class="six wide column centered doubling stackable" id="login">
{% if form.errors %}
<div class="alert alert-dismissable alert-danger">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>

View File

@ -1,42 +1,62 @@
{% load i18n html5 static %}
{% preferences_allowed as show_prefs %}
{% root_id as rootid %}
<div class="ui menu doubling grid">
<form id="form_language" action="{% url "django.views.i18n.set_language" %}" method="post">
{% csrf_token %}
<input type="hidden" name="language" id="id_language" value=""/>
</form>
<div class="computer tablet only ui menu grid">
<a class="header item" href="/">
<img class="ui mini spaced image" src="{% get_static_prefix %}img/udsicon.png">Universal Desktop Services
</a>
<div class="right menu">
<div class="item">
<form id="form_language" action="{% url "django.views.i18n.set_language" %}" method="post">
{% csrf_token %}
<select class="ui search selection dropdown" id="id_language" type="hidden" name="language">
{% for lang in LANGUAGES %}
<option value="{{ lang.0 }}"{% if lang.0 == LANGUAGE_CODE %} selected{%endif %}>{% trans lang.1|capfirst %}</option>
{% endfor %}
</select>
</form>
<div class="ui dropdown item">
{{ LANGUAGE_INFO.name }} <i class="dropdown icon"></i>
<div class="menu">
{% for lang in LANGUAGES %}
<a class="item" onclick='$("#id_language").val("{{ lang.0 }}"); $("#form_language").submit()'>{% trans lang.1|capfirst %}</a>
{% endfor %}
</div>
</div>
<a class="item" href="{% url 'uds.web.views.about' %}">
{% trans 'About' %}
</a>
{% if user and user.pk != None %}
<div class="item">
<div class="ui dropdown selection item">
<i class="user icon"></i> {{ user.real_name }}
<i class="dropdown icon"></i>
<div class="menu">
{% if show_prefs and user.id != rootid %}
<a class="item" href="{% url "uds.web.views.prefs" %}"><i class="edit icon"></i> {% trans 'Preferences' %}</a>
{% endif %}
<a class="item" href="{% url "ClientDownload" %}"><i class="disk download icon"></i> {% trans 'UDS Plugin' %}</a>
{% if user.staff_member or user.is_admin %}
<a class="item" href="{% url "uds.web.views.download" idDownload='' %}"><i class="cloud download icon"></i> {% trans 'Downloads' %}</a>
<a class="item" href="{% url "uds.admin.views.index" %}"><i class="dashboard icon"></i> {% trans 'Dashboard' %}</a>
{% endif %}
<a class="item" href="{% url "uds.web.views.logout" %}"><i class="toggle off icon"></i> {% trans 'Logout' %}</a>
{% include 'uds/semantic/snippets/user-menu.html' %}
</div>
</div>
<div class="mobile only ui stackable menu grid">
<div class="ui styled fluid accordion">
<div class="title">
<img class="ui mini spaced image" src="{% get_static_prefix %}img/udsicon.png">
Universal Desktop Services
</div>
<div class="content">
<div class="ui styled fluid accordion">
<div class="active title">
<i class="dropdown icon"></i>
What is a dog?
</div>
<div class="active content">
<p>A dog is a type of domesticated animal. Known for its loyalty and faithfulness, it can be found as a welcome guest in many households across the world.</p>
</div>
<div class="title">
<i class="dropdown icon"></i>
What kinds of dogs are there?
</div>
<div class="content">
<p>There are many breeds of dogs. Each breed varies in size and temperament. Owners often select a breed of dog that they find to be compatible with their own lifestyle and desires from a companion.</p>
</div>
<div class="title">
<i class="dropdown icon"></i>
How do you acquire a dog?
</div>
<div class="content">
<p>Three common ways for a prospective owner to acquire a dog is from pet shops, private owners, or shelters.</p>
<p>A pet shop may be the most convenient way to buy a dog. Buying a dog from a private owner allows you to assess the pedigree and upbringing of your dog before choosing to take it home. Lastly, finding your dog from a shelter, helps give a good home to a dog who may not find one so readily.</p>
</div>
</div>
</div>
{% endif %}
</div>
</div>

View File

@ -0,0 +1,18 @@
{% load i18n html5 static %}
{% if user and user.pk != None %}
<div class="ui dropdown item">
<i class="user icon"></i> {{ user.real_name }}
<i class="dropdown icon"></i>
<div class="menu">
{% if show_prefs and user.id != rootid %}
<a class="item" href="{% url "uds.web.views.prefs" %}"><i class="edit icon"></i> {% trans 'Preferences' %}</a>
{% endif %}
<a class="item" href="{% url "ClientDownload" %}"><i class="disk download icon"></i> {% trans 'UDS Plugin' %}</a>
{% if user.staff_member or user.is_admin %}
<a class="item" href="{% url "uds.web.views.download" idDownload='' %}"><i class="cloud download icon"></i> {% trans 'Downloads' %}</a>
<a class="item" href="{% url "uds.admin.views.index" %}"><i class="dashboard icon"></i> {% trans 'Dashboard' %}</a>
{% endif %}
<a class="item" href="{% url "uds.web.views.logout" %}"><i class="toggle off icon"></i> {% trans 'Logout' %}</a>
</div>
</div>
{% endif %}

View File

@ -1,6 +1,7 @@
{% load l10n i18n static html5 compress %}{% spaceless %}
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info for LANGUAGE_CODE as LANGUAGE_INFO %}
<!DOCTYPE html>{% endspaceless %}
<html class="no-js" lang='{{LANGUAGE_CODE}}'>
<head>
@ -23,7 +24,7 @@
{% endcompress %}
</head>
<body class="uds-body">
<body>
<!-- Navigation bar -->
{% block menu %}{% include 'uds/semantic/snippets/navbar.html' %}{% endblock %}
{% ifbrowser ie<10 %}
@ -68,9 +69,9 @@
$('.ui.dropdown')
.dropdown()
;
$('#id_language').on('change', function() {
$('#form_language').submit();
});
$('.ui.accordion')
.accordion()
;
})
</script>
<script type="text/coffeescript" charset="utf-8" src="{% get_static_prefix %}js/uds-client.coffee"></script>

View File

@ -1,8 +1,8 @@
{% load i18n %}
{% verbatim %}
<div class="ui five doubling link cards">
<div class="ui four doubling stackable link cards">
{{#each data}}
<div class="card">
<div class="card" data-item="{{ @index }}">
<div class="content">
<div class="right floated mini ui image">
<img src="{{ image }}">
@ -19,9 +19,9 @@
{{# if show_transports }}
{{# compare transports.length 1 operator=">" }}
<div class="extra content">
<a>
<a class="show-transports">
<i class="open folder icon"></i>
{% endverbatim %}{% trans 'Transports' %}{% verbatim %}{{ transports.length }}
{% endverbatim %}{% trans 'Connections' %}{% verbatim %}
</a>
</div>
{{/ compare }}

View File

@ -0,0 +1,24 @@
{% load i18n %}
{% verbatim %}
<div class="ui small basic modal transport">
<i class="close icon"></i>
<div class="ui header grid">
<div class="three column row">
<div class="column"></div>
<div class="column">{% endverbatim %}{% trans "Connections" %}{% verbatim %}</div>
<div class="column"></div>
</div>
</div>
<div class="ui grid">
<div class="three column row">
{{# each data }}
<div class="column"></div>
<div class="column">
<a href="#" data-link="{{ link }}" class="transport-link"><img class="ui middle aligned avatar image" src="{{ image }}"> {{ name }}</a>
</div>
<div class="column"></div>
{{/ each }}
</div>
</div>
</div>
{% endverbatim %}

View File

@ -226,10 +226,10 @@ def pluginDownloadUrl(os):
return tmpl.format(url=static('clients/UDSClientSetup-{version}.exe'.format(version=CLIENT_VERSION)), os='Windows')
elif os == 'linux':
linux_packages = (
('udsclient_{version}_all.deb'.format(version=CLIENT_VERSION), _('Debian based Linux')),
('udsclient-{version}-1.noarch.rpm'.format(version=CLIENT_VERSION), _('Red Hat based Linux (RH, Fedora, Centos, ...)')),
('udsclient-opensuse-{version}-1.noarch.rpm'.format(version=CLIENT_VERSION), _('Suse based Linux')),
('udsclient-{version}.tar.gz'.format(version=CLIENT_VERSION), _('Generic .tar.gz Linux'))
('udsclient_{version}_all.deb'.format(version=CLIENT_VERSION), _('Debian based Linux') + ' ' + _('(requires Python-2.7)')),
('udsclient-{version}-1.noarch.rpm'.format(version=CLIENT_VERSION), _('Red Hat based Linux (RH, Fedora, Centos, ...)') + ' ' + _('(requires Python-2.7)')),
('udsclient-opensuse-{version}-1.noarch.rpm'.format(version=CLIENT_VERSION), _('Suse based Linux') + ' ' + _('(requires Python-2.7)')),
('udsclient-{version}.tar.gz'.format(version=CLIENT_VERSION), _('Generic .tar.gz Linux') + ' ' + _('(requires Python-2.7)'))
)
res = ''
for v in linux_packages: