1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-03-21 10:50:26 +03:00

Added custom message text for calendar limitation

This commit is contained in:
Adolfo Gómez García 2017-03-14 13:45:38 +01:00
parent 544b8b7b25
commit 8054f088b9
3 changed files with 16 additions and 3 deletions

View File

@ -254,7 +254,7 @@ class GlobalConfig(object):
# Time betwen checks of unused services by os managers
# Unused services will be invoked for every machine assigned but not in use AND that has been assigned at least this time
# (only if os manager asks for this characteristic)
CHECK_UNUSED_TIME = Config.section(GLOBAL_SECTION).value('checkUnusedTime', '631', type=Config.TEXT_FIELD) # Defaults to 10 minutes
CHECK_UNUSED_TIME = Config.section(GLOBAL_SECTION).value('checkUnusedTime', '631', type=Config.NUMERIC_FIELD) # Defaults to 10 minutes
# Default CSS Used
CSS = Config.section(GLOBAL_SECTION).value('css', settings.STATIC_URL + 'css/uds.css', type=Config.TEXT_FIELD)
# Max logins before blocking an account
@ -318,6 +318,9 @@ class GlobalConfig(object):
# This is used so templates can change "styles" from admin interface
UDS_THEME_VISUAL = Config.section(GLOBAL_SECTION).value('UDS Theme Enhaced', '1', type=Config.BOOLEAN_FIELD)
# Custom message for error when limiting by calendar
LIMITED_BY_CALENDAR_TEXT = Config.section(GLOBAL_SECTION).value('Calendar access denied text', '', type=Config.TEXT_FIELD) # Defaults to Nothing
initDone = False
@staticmethod

View File

@ -3,6 +3,7 @@
{% block title %}{% trans 'Available services list' %}{% endblock %}
{% block body %}
{% calendar_denied_msg as calendarCustomMessage %}
{% if groups|length > 1 %}
<ul class="nav nav-tabs nav-justified" id="services-tabs">
{% for grp in groups %}
@ -29,7 +30,7 @@
{% if ser.maintenance %}
data-content="{% trans "Under maintenance" %}"
{% elif ser.not_accesible %}
data-content="{% trans "Access limited by calendar" %}"
data-content="{{ calendarCustomMessage }}"
{% elif ser.to_be_replaced %}
data-content="{{ ser.to_be_replaced_text }}"
{% elif ser.in_use %}
@ -102,7 +103,8 @@
<h4 class="modal-title">{% trans "Service access not allowed" %}</h4>
</div>
<div class="modal-body text-center">
<p>{% trans "This service is currently not accesible due to schedule restrictions" %}</p>
<p>{% trans "This service is currently not accesible due to schedule restrictions." %}</p>
<p><b>{{ calendarCustomMessage }}</b></p>
<p>{% trans "Please, retry access in a while." %}</p>
</div>
<div class="modal-footer">

View File

@ -35,6 +35,7 @@ from __future__ import unicode_literals
from django import template
from django.utils.translation import ugettext as _
from django.templatetags.static import static
from django.utils.html import mark_safe
from uds.core.util import html
from uds.core.auths.auth import ROOT_ID
@ -165,6 +166,13 @@ def root_id():
def image_size():
return Image.MAX_IMAGE_SIZE
@register.assignment_tag
def calendar_denied_msg():
text = GlobalConfig.LIMITED_BY_CALENDAR_TEXT.get().strip()
if text == '':
text = _("Access limited by calendar")
return text
# Browser related
class IfBrowser(template.Node):