repro: Use new setup mechanism

This commit is contained in:
Sunil Mohan Adapa 2016-02-12 17:08:41 +05:30
parent 528fe47c16
commit f78a558357
No known key found for this signature in database
GPG Key ID: 36C361440C9BC971
3 changed files with 40 additions and 47 deletions

View File

@ -21,25 +21,57 @@ Plinth module for repro.
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
version = 1
depends = ['apps']
title = _('SIP Server (repro)')
description = [
_('repro provides various SIP services that a SIP softphone can utilize '
'to provide audio and video calls as well as presence and instant '
'messaging. repro provides a server and SIP user accounts that clients '
'can use to let their presence known. It also acts as a proxy to '
'federate SIP communications to other servers on the Internet similar '
'to email.'),
_('To make SIP calls, a client application is needed. Available clients '
'include <a href="https://jitsi.org/">Jitsi</a> (for computers) and '
'<a href="https://f-droid.org/repository/browse/?fdid=com.csipsimple"> '
'CSipSimple</a> (for Android phones).'),
_('<strong>Note:</strong> Before using repro, domains and users will '
'need to be configured using the <a href="/repro/domains.html">'
'web-based configuration panel</a>. Users in the <em>admin</em> group '
'will be able to log in to the repro configuration panel. After setting '
'the domain, it is required to restart the repro service. Disable the '
'service and re-enable it.'),
]
service = None
def init():
"""Initialize the repro module."""
menu = cfg.main_menu.get('apps:index')
menu.add_urlname(_('SIP Server (repro)'), 'glyphicon-phone-alt',
'repro:index', 825)
menu.add_urlname(title, 'glyphicon-phone-alt', 'repro:index', 825)
global service
service = service_module.Service(
'repro', _('repro SIP Server'), ['sip-plinth', 'sip-tls-plinth'],
is_external=True, enabled=is_enabled())
'repro', title, ['sip-plinth', 'sip-tls-plinth'], is_external=True,
enabled=is_enabled())
def setup(helper, old_version=None):
"""Install and configure the module."""
helper.install(['repro'])
helper.call('post', actions.superuser_run, 'repro', ['setup'])
helper.call('post', service.notify_enabled, None, True)
def is_enabled():

View File

@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "app.html" %}
{% comment %}
#
# This file is part of Plinth.
@ -21,39 +21,7 @@
{% load bootstrap %}
{% load i18n %}
{% block content %}
<h2>{% trans "SIP Server (repro)" %}</h2>
<p>
{% blocktrans trimmed %}
repro provides various SIP services that a SIP softphone can utilize to
provide audio and video calls as well as presence and instant messaging.
repro provides a server and SIP user accounts that clients can use to let
their presence known. It also acts as a proxy to federate SIP
communications to other servers on the Internet similar to email.
{% endblocktrans %}
</p>
<p>
{% blocktrans trimmed %}
To make SIP calls, a client application is needed. Available clients
include <a href="https://jitsi.org/">Jitsi</a> (for computers) and
<a href="https://f-droid.org/repository/browse/?fdid=com.csipsimple">
CSipSimple</a> (for Android phones).
{% endblocktrans %}
</p>
<p>
{% blocktrans trimmed %}
<strong>Note:</strong> Before using repro, domains and users will need
to be configured using the <a href="/repro/domains.html">web-based
configuration panel</a>. Users in the <em>admin</em> group will be able
to log in to the repro configuration panel. After setting the domain, it
is required to restart the repro service. Disable the service and
re-enable it.
{% endblocktrans %}
</p>
{% block configuration %}
<h3>{% trans "Status" %}</h3>

View File

@ -25,17 +25,9 @@ from django.utils.translation import ugettext as _
from .forms import ReproForm
from plinth import actions
from plinth import package
from plinth.modules import repro
def on_install():
"""Notify that the service is now enabled."""
actions.superuser_run('repro', ['setup'])
repro.service.notify_enabled(None, True)
@package.required(['repro'], on_install=on_install)
def index(request):
"""Serve configuration page."""
status = get_status()
@ -52,7 +44,8 @@ def index(request):
form = ReproForm(initial=status, prefix='repro')
return TemplateResponse(request, 'repro.html',
{'title': _('SIP Server (repro)'),
{'title': repro.title,
'description': repro.description,
'status': status,
'form': form})