mirror of
https://github.com/dkmstr/openuds.git
synced 2024-12-22 13:34:04 +03:00
Added download page for new uds plugin
This commit is contained in:
parent
bb8931e7d4
commit
c71d86825c
@ -37,7 +37,7 @@ logger = logging.getLogger(__name__)
|
||||
Linux = 'Linux'
|
||||
WindowsPhone = 'Windows Phone'
|
||||
Windows = 'Windows'
|
||||
Macintosh = 'Macintosh'
|
||||
Macintosh = 'Mac'
|
||||
Android = 'Android'
|
||||
iPad = 'iPad'
|
||||
iPhone = 'iPhone'
|
||||
@ -59,6 +59,7 @@ def getOsFromUA(ua):
|
||||
os = DEFAULT_OS
|
||||
else:
|
||||
os = 'Unknown'
|
||||
|
||||
res = {'OS': os, 'Version': 'unused'}
|
||||
for os in knownOss:
|
||||
try:
|
||||
@ -74,8 +75,8 @@ def getOsFromUA(ua):
|
||||
|
||||
def getOsFromRequest(request):
|
||||
try:
|
||||
return request.session['OS']
|
||||
except:
|
||||
request.session['OS'] = getOsFromUA(request.META['HTTP_USER_AGENT'])
|
||||
return request.os
|
||||
except Exception:
|
||||
request.os = getOsFromUA(request.META['HTTP_USER_AGENT'])
|
||||
|
||||
return request.session['OS']
|
||||
return request.os
|
||||
|
@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#
|
||||
# Copyright (c) 2012 Virtual Cable S.L.
|
||||
# All rights reserved.
|
||||
@ -32,10 +31,12 @@
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from uds.core.util import OsDetector
|
||||
|
||||
import threading
|
||||
import logging
|
||||
|
||||
__updated__ = '2015-03-17'
|
||||
__updated__ = '2015-03-18'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -57,6 +58,8 @@ class GlobalRequestMiddleware(object):
|
||||
def process_request(self, request):
|
||||
# Add IP to request
|
||||
GlobalRequestMiddleware.fillIps(request)
|
||||
# Ensures request contains os
|
||||
OsDetector.getOsFromRequest(request)
|
||||
# Add a counter var, reseted on every request
|
||||
_requests[getIdent()] = request
|
||||
return None
|
||||
@ -94,3 +97,4 @@ class GlobalRequestMiddleware(object):
|
||||
except:
|
||||
request.ip_proxy = request.ip
|
||||
request.is_proxy = False
|
||||
|
||||
|
@ -127,3 +127,9 @@ footer {
|
||||
.form-preferences .btn {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.navbar-img {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin-top: -8px;
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
{% extends "uds/html5/templates/base.html" %}
|
||||
{% load i18n html5 static %}
|
||||
|
||||
{% block title %}
|
||||
{% trans 'Download UDS plugin for' %} {{ os|osName }}
|
||||
{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2 bg-primary">
|
||||
<h3 class="text-center">{% trans 'Download UDS Plugin for' %} {{ os|osName }}</h3>
|
||||
<p>{% trans 'In order to be able to execute UDS services, you need to have uds plugin installed.' %}</p>
|
||||
<p>{% trans 'If for any reason, you have uds plugin already installed but this message persist to appear, you can force the execution by pressing <kbd>ctrl</kbd> when launching the service.' %}</p>
|
||||
|
||||
<p class="text-center"><a href="{{ os|pluginDownloadUrl }}" class="btn btn-success">{% trans 'Download UDS Plugin for' %} {{ os|osName }}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-offset-2 bg-success">
|
||||
<h3>{% trans 'or select another version' %}</h3>
|
||||
{% if os != 'linux' %}
|
||||
<div>
|
||||
<a href="#">{% trans 'Linux UDS plugin' %}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if os != 'windows' %}
|
||||
<div>
|
||||
<a href="#">{% trans 'Windows UDS plugin' %}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if os != 'mac' %}
|
||||
<div>
|
||||
<a href="#">{% trans 'Mac OSX (>10.5) UDS plugin' %}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="text-center">
|
||||
<a href="{% url 'uds.web.views.index' %}" class="btn btn-info"><i class="fa fa-home"></i> {% trans "Return" %}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
@ -10,7 +10,10 @@
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a href="{% url 'uds.web.views.index' %}"><span class="navbar-brand">Universal Desktop Services</span></a>
|
||||
<a class ="navbar-brand" href="{% url 'uds.web.views.index' %}">
|
||||
<img alt="Universal Desktop Services" src="{% get_static_prefix %}img/udsicon.png" class="navbar-img pull-left">
|
||||
<span>Universal Desktop Services</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navbar-ex1-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
|
@ -1,3 +1,3 @@
|
||||
{% load i18n static html5 %}
|
||||
|
||||
<a class="uds-service-link" data-href-alt="http://www.google.com" href="{{ uri }}" tabindex="{% tabindex uds-service-link %}">Link to {{ uri }}</a>
|
||||
<a class="uds-service-link" data-href-alt="{% url 'uds.web.views.client_downloads' %}" href="x{{ uri }}" tabindex="{% tabindex uds-service-link %}">Link to {{ uri }}</a>
|
||||
|
@ -170,3 +170,24 @@ def ifbrowser(parser, token):
|
||||
token = parser.next_token()
|
||||
|
||||
return IfBrowser(states['ifbrowser'], states.get('else', None), browsers)
|
||||
|
||||
|
||||
# Os Related
|
||||
@register.filter(name='osName')
|
||||
def osName(os):
|
||||
if os == 'windows':
|
||||
return 'Windows platform'
|
||||
elif os == 'linux':
|
||||
return 'Linux platform'
|
||||
else:
|
||||
return 'Mac OSX platform'
|
||||
|
||||
|
||||
@register.filter(name='pluginDownloadUrl')
|
||||
def pluginDownloadUrl(os):
|
||||
if os == 'windows':
|
||||
return '1'
|
||||
elif os == 'linux':
|
||||
return '2'
|
||||
else:
|
||||
return '3'
|
||||
|
@ -64,7 +64,11 @@ urlpatterns = patterns(
|
||||
# Change Language
|
||||
(r'^i18n/', include('django.conf.urls.i18n')),
|
||||
# Downloadables
|
||||
(r'^download/(?P<idDownload>[a-zA-Z0-9-]*)$', 'web.views.download'),
|
||||
(r'^idown/(?P<idDownload>[a-zA-Z0-9-]*)$', 'web.views.download'),
|
||||
# for client
|
||||
(r'^down$', 'web.views.client_downloads'),
|
||||
(r'^down/(?P<os>[a-zA-Z0-9-]*)$', 'web.views.client_downloads'),
|
||||
|
||||
# Custom authentication callback
|
||||
(r'^auth/(?P<authName>.+)', 'web.views.authCallback'),
|
||||
(r'^authJava/(?P<idAuth>.+)/(?P<hasJava>.*)$', 'web.views.authJava'),
|
||||
|
@ -30,7 +30,7 @@
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
__updated__ = '2015-02-28'
|
||||
__updated__ = '2015-03-18'
|
||||
|
||||
import logging
|
||||
|
||||
@ -42,5 +42,6 @@ from .prefs import prefs
|
||||
from .service import service, transcomp, sernotify, transportIcon, serviceImage
|
||||
from .auth import authCallback, authInfo, authJava, ticketAuth
|
||||
from .download import download
|
||||
from .client_download import client_downloads
|
||||
from .js import jsCatalog
|
||||
from ..errors import error
|
||||
|
58
server/src/uds/web/views/client_download.py
Normal file
58
server/src/uds/web/views/client_download.py
Normal file
@ -0,0 +1,58 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2012 Virtual Cable S.L.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * 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.
|
||||
# * Neither the name of Virtual Cable S.L. nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.
|
||||
'''
|
||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
__updated__ = '2015-03-20'
|
||||
|
||||
from django.shortcuts import render_to_response
|
||||
from django.template import RequestContext
|
||||
|
||||
from uds.core.auths.auth import webLoginRequired
|
||||
from uds.core.ui import theme
|
||||
from uds.core.util.OsDetector import desktopOss
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@webLoginRequired(admin=False)
|
||||
def client_downloads(request, os=None):
|
||||
'''
|
||||
Downloadables management
|
||||
'''
|
||||
if os not in desktopOss:
|
||||
os = request.os['OS']
|
||||
logger.debug('User: {}'.format(request.user))
|
||||
os = os.lower()
|
||||
return render_to_response(theme.template('client/download_client.html'),
|
||||
{'os': os, 'user': request.user},
|
||||
context_instance=RequestContext(request))
|
Loading…
Reference in New Issue
Block a user