From 158ac77727f903399633170834bb05c8e9399aa2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adolfo=20G=C3=B3mez?= <dkmaster@dkmon.com>
Date: Fri, 18 Oct 2013 08:07:15 +0000
Subject: [PATCH] * Updated URLS for NX (to 3.5 version ones) * Added urls to a
 new configuration pannel (NX)

---
 server/src/uds/transports/NX/__init__.py |  5 +++++
 server/src/uds/transports/NX/web.py      | 13 +++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/server/src/uds/transports/NX/__init__.py b/server/src/uds/transports/NX/__init__.py
index 5bdc91e84..888d5cc38 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 3bf0931c6..b1caa5ae1 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,24 +76,24 @@ def generateHtmlForNX(transport, idUserService, idTransport, ip, os, user, passw
         ]))
     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="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', 'http://opennx.net/download.html').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="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', 'http://www.nomachine.com/download-3').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>' + msg + '</div>'
     return res
     
 
 def getHtmlComponent(module, componentId):
-    dict = { '1' : ['nxtransport.jar', 'application/java-archive' ]}
+    dct = { '1' : ['nxtransport.jar', 'application/java-archive' ]}
     
-    if dict.has_key(componentId) == False:
+    if dct.has_key(componentId) == False:
         return ['text/plain', 'no component']
-    fname = os.path.dirname(sys.modules[module].__file__) + '/applet/' + dict[componentId][0]
+    fname = os.path.dirname(sys.modules[module].__file__) + '/applet/' + dct[componentId][0]
     logger.debug('Loading component {0} from {1}'.format(componentId, fname))
 
     f = open(fname, 'rb')
     data = f.read()
     f.close()
-    return [ dict[componentId][1], data ]
\ No newline at end of file
+    return [ dct[componentId][1], data ]
\ No newline at end of file