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

* Added support for Multiline Configurations (needs new administration client)

* Added custom html support on login page
* Fixed (c) downpage to allow the use of "content" css property correctly (see uds.css)
* Upgraded needed client version to 1.0.8
This commit is contained in:
Adolfo Gómez 2012-10-30 16:02:08 +00:00
parent 8a04db28e9
commit 159d85fb7a
7 changed files with 22 additions and 7 deletions

View File

@ -65,6 +65,7 @@ class Config:
readed = dbConfig.objects.filter(section=self._section.name(), key=self._key)[0] readed = dbConfig.objects.filter(section=self._section.name(), key=self._key)[0]
self._data = readed.value self._data = readed.value
self._crypt = [self._crypt, True][readed.crypt] # True has "higher" precedende than False self._crypt = [self._crypt, True][readed.crypt] # True has "higher" precedende than False
self._longText = readed.long
except Exception: except Exception:
# Not found # Not found
if self._default != '' and self._crypt: if self._default != '' and self._crypt:
@ -108,11 +109,11 @@ class Config:
''' '''
logger.debug('Saving config {0}.{1} as {2}'.format(self._section.name(), self._key, value)) logger.debug('Saving config {0}.{1} as {2}'.format(self._section.name(), self._key, value))
try: try:
if dbConfig.objects.filter(section=self._section.name(), key=self._key).update(value=value, crypt=self._crypt) == 0: if dbConfig.objects.filter(section=self._section.name(), key=self._key).update(value=value, crypt=self._crypt, long=self._longText) == 0:
raise Exception() # Do not exists, create a new one raise Exception() # Do not exists, create a new one
except Exception: except Exception:
try: try:
dbConfig.objects.create(section=self._section.name(), key=self._key, value=value, crypt=self._crypt) dbConfig.objects.create(section=self._section.name(), key=self._key, value=value, crypt=self._crypt, long=self._longText)
except Exception: except Exception:
# Probably a migration issue, just ignore it # Probably a migration issue, just ignore it
logger.info("Could not save configuration key {0}.{1}".format(self._section.name(), self._key)) logger.info("Could not save configuration key {0}.{1}".format(self._section.name(), self._key))
@ -217,7 +218,6 @@ class GlobalConfig:
# Custom HTML for login page # Custom HTML for login page
CUSTOM_HTML_LOGIN = Config.section(GLOBAL_SECTION).valueLong('customHtmlLogin', '') CUSTOM_HTML_LOGIN = Config.section(GLOBAL_SECTION).valueLong('customHtmlLogin', '')
initDone = False initDone = False
@staticmethod @staticmethod

View File

@ -200,6 +200,10 @@ input[type=submit]{
width: auto; width: auto;
} }
#customHtml {
margin-top: 4em;
};
#adminmsgs{ #adminmsgs{
text-align:left; text-align:left;
margin:auto; margin:auto;
@ -226,3 +230,8 @@ input[type=submit]{
#applet { #applet {
margin:20px 0; margin:20px 0;
} }
/* Sample "info" (footer) text, to be placed after (c) Virtualcable */
/*#vcable:after {
content: "Testing text";
}*/

View File

@ -41,7 +41,7 @@
<div id="footer"> <div id="footer">
{% block footer %} {% block footer %}
&copy; 2012 Virtual Cable S.L. <div id="vcable"><a href="http://www.virtualcable.es">&copy; 2012 Virtual Cable S.L.</a> </div>
{% endblock %} {% endblock %}
</div><!-- footer --> </div><!-- footer -->

View File

@ -95,4 +95,9 @@
</div> </div>
</form> </form>
</div> </div>
<div id="customHtml">
{% autoescape off %}
{{ customHtml }}
{% endautoescape %}
</div>
{% endblock %} {% endblock %}

View File

@ -103,7 +103,8 @@ def login(request):
else: else:
form = LoginForm() form = LoginForm()
response = render_to_response('uds/login.html', { 'form' : form, }, context_instance=RequestContext(request)) response = render_to_response('uds/login.html', { 'form' : form, 'customHtml' : GlobalConfig.CUSTOM_HTML_LOGIN.get(True) },
context_instance=RequestContext(request))
if request.COOKIES.has_key('uds') is False: if request.COOKIES.has_key('uds') is False:
response.set_cookie('uds', ''.join(random.choice(string.letters + string.digits) for _ in xrange(32))) response.set_cookie('uds', ''.join(random.choice(string.letters + string.digits) for _ in xrange(32)))
return response return response

View File

@ -45,7 +45,7 @@ logger = logging.getLogger(__name__)
ADMIN_AUTH = '#' ADMIN_AUTH = '#'
CLIENT_VERSION_REQUIRED = '1.0.7' CLIENT_VERSION_REQUIRED = '1.0.8'
class Credentials(object): class Credentials(object):
''' '''

View File

@ -45,7 +45,7 @@ def getConfiguration(credentials):
for cfg in Config.enumerate(): for cfg in Config.enumerate():
if cfg.isCrypted() is True and addCrypt is False: if cfg.isCrypted() is True and addCrypt is False:
continue continue
res.append( {'section': cfg.section(), 'key' : cfg.key(), 'value' : cfg.get(), 'crypt': cfg.isCrypted() } ) res.append( {'section': cfg.section(), 'key' : cfg.key(), 'value' : cfg.get(), 'crypt': cfg.isCrypted(), 'longText': cfg.isLongText() } )
logger.debug('Configuration: {0}'.format(res)) logger.debug('Configuration: {0}'.format(res))
return res return res