From 15d7ca7a4b84be383011f0d97279036c6d0dfec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez?= Date: Fri, 18 Oct 2013 08:20:48 +0000 Subject: [PATCH] Updated sample settings to include new django var (for wsgi) Updated NX Transport to show new url for downloading Updated NX Tunneled Transport to show new url for downloading Added a new configruation TAB, NX, that allows to change the download urls for MAC and Windows/Linux. --- server/src/server/settings.py.sample | 3 +++ server/src/uds/transports/NX/__init__.py | 5 +++++ server/src/uds/transports/NX/web.py | 5 +++-- server/src/uds/transports/TSNX/TSNXTransport.py | 2 +- server/src/uds/transports/TSNX/__init__.py | 4 ++++ server/src/uds/transports/TSNX/web.py | 16 +++++++++++++--- 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/server/src/server/settings.py.sample b/server/src/server/settings.py.sample index 17bcc016..5727cfc9 100644 --- a/server/src/server/settings.py.sample +++ b/server/src/server/settings.py.sample @@ -154,6 +154,9 @@ SESSION_COOKIE_HTTPONLY = False ROOT_URLCONF = 'server.urls' +# Python dotted path to the WSGI application used by Django's runserver. +WSGI_APPLICATION = 'server.wsgi.application' + TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. diff --git a/server/src/uds/transports/NX/__init__.py b/server/src/uds/transports/NX/__init__.py index 5bdc91e8..888d5cc3 100644 --- a/server/src/uds/transports/NX/__init__.py +++ b/server/src/uds/transports/NX/__init__.py @@ -33,10 +33,15 @@ from uds.core.managers.UserPrefsManager import UserPrefsManager, CommonPrefs from uds.core.managers.DownloadsManager import DownloadsManager +from uds.core.util.Config import Config from NXTransport import NXTransport from django.utils.translation import ugettext_noop as _ import os.path, sys +Config.section('NX').value('downloadUrl', 'http://www.nomachine.com/download-3').get() +Config.section('NX').value('downloadUrlMACOS', 'http://opennx.net/download.html').get() + + UserPrefsManager.manager().registerPrefs('nx', _('NX Protocol'), [ CommonPrefs.screenSizePref diff --git a/server/src/uds/transports/NX/web.py b/server/src/uds/transports/NX/web.py index 3bf0931c..ee33d9ff 100644 --- a/server/src/uds/transports/NX/web.py +++ b/server/src/uds/transports/NX/web.py @@ -34,6 +34,7 @@ from django.utils.translation import ugettext as _ from django.core.urlresolvers import reverse from uds.core.util import OsDetector +from uds.core.util.Config import Config import logging, os, sys logger = logging.getLogger(__name__) @@ -75,10 +76,10 @@ def generateHtmlForNX(transport, idUserService, idTransport, ip, os, user, passw ])) if isMac is True: msg = '

' + _('In order to use this transport, you need to install first OpenNX Client for mac') + '

' - msg += '

' + _('You can oibtain it from ') + '' + _('OpenNx Website') + '

' + msg += '

' + _('You can oibtain it from ') + ''.format(Config.section('NX').value('downloadUrlMACOS').get()) + _('OpenNx Website') + '

' else: msg = '

' + _('In order to use this transport, you need to install first Nomachine Nx Client version 3.5.x') + '

' - msg +='

' + _('you can obtain it for your platform from') + '' + _('nochamine web site') + '

' + msg +='

' + _('you can obtain it for your platform from') + ''.format(Config.section('NX').value('downloadUrl').get()) + _('nochamine web site') + '

' res = '
' % (codebase, '1', data ) res += '
' + msg + '
' return res diff --git a/server/src/uds/transports/TSNX/TSNXTransport.py b/server/src/uds/transports/TSNX/TSNXTransport.py index 571cd697..bb21ff02 100644 --- a/server/src/uds/transports/TSNX/TSNXTransport.py +++ b/server/src/uds/transports/TSNX/TSNXTransport.py @@ -196,7 +196,7 @@ class TSNXTransport(Transport): # Fix username/password acording to os manager username, password = userService.processUserPassword(username, password) - return generateHtmlForNX(self, idUserService, idTransport, username, password, extra) + return generateHtmlForNX(self, idUserService, idTransport, os, username, password, extra) def getHtmlComponent(self, theId, os, componentId): # We use helper to keep this clean diff --git a/server/src/uds/transports/TSNX/__init__.py b/server/src/uds/transports/TSNX/__init__.py index 5380e279..4d411a42 100644 --- a/server/src/uds/transports/TSNX/__init__.py +++ b/server/src/uds/transports/TSNX/__init__.py @@ -33,10 +33,14 @@ from uds.core.managers.UserPrefsManager import UserPrefsManager, CommonPrefs from uds.core.managers.DownloadsManager import DownloadsManager +from uds.core.util.Config import Config from TSNXTransport import TSNXTransport from django.utils.translation import ugettext_noop as _ import os.path, sys +Config.section('NX').value('downloadUrl', 'http://www.nomachine.com/download-3').get() +Config.section('NX').value('downloadUrlMACOS', 'http://opennx.net/download.html').get() + UserPrefsManager.manager().registerPrefs('nx', _('NX Protocol'), [ CommonPrefs.screenSizePref diff --git a/server/src/uds/transports/TSNX/web.py b/server/src/uds/transports/TSNX/web.py index 076b184b..59853361 100644 --- a/server/src/uds/transports/TSNX/web.py +++ b/server/src/uds/transports/TSNX/web.py @@ -32,6 +32,9 @@ ''' from django.core.urlresolvers import reverse +from uds.core.util.Config import Config +from uds.core.util import OsDetector + import logging, os, sys logger = logging.getLogger(__name__) @@ -52,7 +55,8 @@ def simpleScrambler(data): -def generateHtmlForNX(transport, idUserService, idTransport, user, password, extra): +def generateHtmlForNX(transport, idUserService, idTransport, os, user, password, extra): + isMac = os['OS'] == OsDetector.Macintosh applet = reverse('uds.web.views.transcomp', kwargs = { 'idTransport' : idTransport, 'componentId' : '1' }) # Gets the codebase, simply remove last char from applet codebase = applet[:-1] @@ -71,9 +75,15 @@ def generateHtmlForNX(transport, idUserService, idTransport, user, password, ext 'is:' + idUserService ] data = simpleScrambler( '\t'.join(data)) + if isMac is True: + msg = '

' + _('In order to use this transport, you need to install first OpenNX Client for mac') + '

' + msg += '

' + _('You can oibtain it from ') + ''.format(Config.section('NX').value('downloadUrlMACOS').get()) + _('OpenNx Website') + '

' + else: + msg = '

' + _('In order to use this transport, you need to install first Nomachine Nx Client version 3.5.x') + '

' + msg +='

' + _('you can obtain it for your platform from') + ''.format(Config.section('NX').value('downloadUrl').get()) + _('nochamine web site') + '

' + res = '
' % (codebase, '1', data ) - res += '

In order to use this transport, you need to install first nomachine nx client version 3.5.x

' - res += '

you can obtain it for your platform from nochamine web site

' + res += '
' + msg + '
' return res