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.
This commit is contained in:
Adolfo Gómez 2013-10-18 08:20:48 +00:00
parent ea784bfeef
commit 15d7ca7a4b
6 changed files with 29 additions and 6 deletions

View File

@ -154,6 +154,9 @@ SESSION_COOKIE_HTTPONLY = False
ROOT_URLCONF = 'server.urls' ROOT_URLCONF = 'server.urls'
# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'server.wsgi.application'
TEMPLATE_DIRS = ( TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows. # Always use forward slashes, even on Windows.

View File

@ -33,10 +33,15 @@
from uds.core.managers.UserPrefsManager import UserPrefsManager, CommonPrefs from uds.core.managers.UserPrefsManager import UserPrefsManager, CommonPrefs
from uds.core.managers.DownloadsManager import DownloadsManager from uds.core.managers.DownloadsManager import DownloadsManager
from uds.core.util.Config import Config
from NXTransport import NXTransport from NXTransport import NXTransport
from django.utils.translation import ugettext_noop as _ from django.utils.translation import ugettext_noop as _
import os.path, sys 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'), UserPrefsManager.manager().registerPrefs('nx', _('NX Protocol'),
[ [
CommonPrefs.screenSizePref CommonPrefs.screenSizePref

View File

@ -34,6 +34,7 @@
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from uds.core.util import OsDetector from uds.core.util import OsDetector
from uds.core.util.Config import Config
import logging, os, sys import logging, os, sys
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -75,10 +76,10 @@ def generateHtmlForNX(transport, idUserService, idTransport, ip, os, user, passw
])) ]))
if isMac is True: if isMac is True:
msg = '<p>' + _('In order to use this transport, you need to install first OpenNX Client for mac') + '</p>' msg = '<p>' + _('In order to use this transport, you need to install first OpenNX Client for mac') + '</p>'
msg += '<p>' + _('You can oibtain it from ') + '<a href="http://opennx.net/download.html">' + _('OpenNx Website') + '</a></p>' msg += '<p>' + _('You can oibtain it from ') + '<a href="{0}">'.format(Config.section('NX').value('downloadUrlMACOS').get()) + _('OpenNx Website') + '</a></p>'
else: else:
msg = '<p>' + _('In order to use this transport, you need to install first Nomachine Nx Client version 3.5.x') + '</p>' msg = '<p>' + _('In order to use this transport, you need to install first Nomachine Nx Client version 3.5.x') + '</p>'
msg +='<p>' + _('you can obtain it for your platform from') + '<a href="http://www.nomachine.com/download.php">' + _('nochamine web site') + '</a></p>' msg +='<p>' + _('you can obtain it for your platform from') + '<a href="{0}">'.format(Config.section('NX').value('downloadUrl').get()) + _('nochamine web site') + '</a></p>'
res = '<div idTransport="applet"><applet code="NxTransportApplet.class" codebase="%s" archive="%s" width="140" height="22"><param name="data" value="%s"/><param name="permissions" value="all-permissions"/></applet></div>' % (codebase, '1', data ) res = '<div idTransport="applet"><applet code="NxTransportApplet.class" codebase="%s" archive="%s" width="140" height="22"><param name="data" value="%s"/><param name="permissions" value="all-permissions"/></applet></div>' % (codebase, '1', data )
res += '<div>' + msg + '</div>' res += '<div>' + msg + '</div>'
return res return res

View File

@ -196,7 +196,7 @@ class TSNXTransport(Transport):
# Fix username/password acording to os manager # Fix username/password acording to os manager
username, password = userService.processUserPassword(username, password) 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): def getHtmlComponent(self, theId, os, componentId):
# We use helper to keep this clean # We use helper to keep this clean

View File

@ -33,10 +33,14 @@
from uds.core.managers.UserPrefsManager import UserPrefsManager, CommonPrefs from uds.core.managers.UserPrefsManager import UserPrefsManager, CommonPrefs
from uds.core.managers.DownloadsManager import DownloadsManager from uds.core.managers.DownloadsManager import DownloadsManager
from uds.core.util.Config import Config
from TSNXTransport import TSNXTransport from TSNXTransport import TSNXTransport
from django.utils.translation import ugettext_noop as _ from django.utils.translation import ugettext_noop as _
import os.path, sys 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'), UserPrefsManager.manager().registerPrefs('nx', _('NX Protocol'),
[ [
CommonPrefs.screenSizePref CommonPrefs.screenSizePref

View File

@ -32,6 +32,9 @@
''' '''
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from uds.core.util.Config import Config
from uds.core.util import OsDetector
import logging, os, sys import logging, os, sys
logger = logging.getLogger(__name__) 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' }) applet = reverse('uds.web.views.transcomp', kwargs = { 'idTransport' : idTransport, 'componentId' : '1' })
# Gets the codebase, simply remove last char from applet # Gets the codebase, simply remove last char from applet
codebase = applet[:-1] codebase = applet[:-1]
@ -71,9 +75,15 @@ def generateHtmlForNX(transport, idUserService, idTransport, user, password, ext
'is:' + idUserService 'is:' + idUserService
] ]
data = simpleScrambler( '\t'.join(data)) data = simpleScrambler( '\t'.join(data))
if isMac is True:
msg = '<p>' + _('In order to use this transport, you need to install first OpenNX Client for mac') + '</p>'
msg += '<p>' + _('You can oibtain it from ') + '<a href="{0}">'.format(Config.section('NX').value('downloadUrlMACOS').get()) + _('OpenNx Website') + '</a></p>'
else:
msg = '<p>' + _('In order to use this transport, you need to install first Nomachine Nx Client version 3.5.x') + '</p>'
msg +='<p>' + _('you can obtain it for your platform from') + '<a href="{0}">'.format(Config.section('NX').value('downloadUrl').get()) + _('nochamine web site') + '</a></p>'
res = '<div idTransport="applet"><applet code="NxTunTransportApplet.class" codebase="%s" archive="%s" width="165" height="22"><param name="data" value="%s"/><param name="permissions" value="all-permissions"/></applet></div>' % (codebase, '1', data ) res = '<div idTransport="applet"><applet code="NxTunTransportApplet.class" codebase="%s" archive="%s" width="165" height="22"><param name="data" value="%s"/><param name="permissions" value="all-permissions"/></applet></div>' % (codebase, '1', data )
res += '<div><p>In order to use this transport, you need to install first nomachine nx client version 3.5.x</p>' res += '<div>' + msg + '</div>'
res += '<p>you can obtain it for your platform from <a href="http://www.nomachine.com/download.php">nochamine web site </a></p></div>'
return res return res