diff --git a/plinth/modules/radicale/__init__.py b/plinth/modules/radicale/__init__.py index 0b221ef9d..026aa18ee 100644 --- a/plinth/modules/radicale/__init__.py +++ b/plinth/modules/radicale/__init__.py @@ -21,11 +21,28 @@ Plinth module for radicale. from django.utils.translation import ugettext_lazy as _ +from plinth import actions from plinth import action_utils from plinth import cfg from plinth import service as service_module +from plinth.utils import format_lazy -depends = ['plinth.modules.apps'] + +version = 1 + +depends = ['apps'] + +title = _('Calendar and Addressbook (Radicale)') + +description = [ + format_lazy( + _('Radicale is a CalDAV and CardDAV server. It allows synchronization ' + 'and sharing of scheduling and contact data. To use Radicale, a ' + ' supported client application ' + 'is needed. Radicale can be accessed by any user with a {box_name} ' + 'login.'), box_name=_(cfg.box_name)), +] service = None @@ -33,13 +50,19 @@ service = None def init(): """Initialize the radicale module.""" menu = cfg.main_menu.get('apps:index') - menu.add_urlname(_('Calendar and Addressbook (Radicale)'), - 'glyphicon-calendar', 'radicale:index', 375) + menu.add_urlname(title, 'glyphicon-calendar', 'radicale:index', 375) global service service = service_module.Service( - 'radicale-plinth', _('Radicale CalDAV and CardDAV Server'), - is_external=True, enabled=is_enabled()) + 'radicale', title, ['http', 'https'], is_external=True, + enabled=is_enabled()) + + +def setup(helper, old_version=None): + """Install and configure the module.""" + helper.install(['radicale']) + helper.call('post', actions.superuser_run, 'radicale', ['setup']) + helper.call('post', service.notify_enabled, None, True) def is_enabled(): @@ -56,6 +79,8 @@ def diagnose(): """Run diagnostics and return the results.""" results = [] + results.append(action_utils.diagnose_port_listening(5232, 'tcp4')) + results.append(action_utils.diagnose_port_listening(5232, 'tcp6')) results.extend(action_utils.diagnose_url_on_all( 'https://{host}/radicale', extra_options=['--no-check-certificate'])) diff --git a/plinth/modules/radicale/templates/radicale.html b/plinth/modules/radicale/templates/radicale.html index 07f12fc74..088981c63 100644 --- a/plinth/modules/radicale/templates/radicale.html +++ b/plinth/modules/radicale/templates/radicale.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "app.html" %} {% comment %} # # This file is part of Plinth. @@ -21,20 +21,7 @@ {% load bootstrap %} {% load i18n %} -{% block content %} - -

{% trans "Calendar and Addressbook (Radicale)" %}

- -

- {% blocktrans trimmed %} - Radicale is a CalDAV and CardDAV server. It allows synchronization and - sharing of scheduling and contact data. To use Radicale, a - - supported client application is needed. Radicale can be accessed by - any user with a {{ box_name }} login. - {% endblocktrans %} -

+{% block configuration %}

{% trans "Status" %}

diff --git a/plinth/modules/radicale/views.py b/plinth/modules/radicale/views.py index 3bfb8fdd7..f0d37cc6d 100644 --- a/plinth/modules/radicale/views.py +++ b/plinth/modules/radicale/views.py @@ -25,17 +25,9 @@ from django.utils.translation import ugettext as _ from .forms import RadicaleForm from plinth import actions -from plinth import package from plinth.modules import radicale -def on_install(): - """Notify that the service is now enabled.""" - actions.superuser_run('radicale', ['setup']) - radicale.service.notify_enabled(None, True) - - -@package.required(['radicale'], on_install=on_install) def index(request): """Serve configuration page.""" status = get_status() @@ -52,7 +44,8 @@ def index(request): form = RadicaleForm(initial=status, prefix='radicale') return TemplateResponse(request, 'radicale.html', - {'title': _('Calendar and Addressbook (Radicale)'), + {'title': radicale.title, + 'description': radicale.description, 'status': status, 'form': form})