ejabberd, jsxc: Fix few remaining issues from module split

This commit is contained in:
James Valleroy 2017-01-09 16:52:43 -05:00
parent bb70c43923
commit 2c37316648
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
9 changed files with 28 additions and 27 deletions

View File

@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
- Prevent anonymous users from accessing setup pages. - Prevent anonymous users from accessing setup pages.
- Firstboot, KVStore: merge old firstboot state fields. - Firstboot, KVStore: merge old firstboot state fields.
- tor: Use Plinth-specific instance instead of default. - tor: Use Plinth-specific instance instead of default.
- xmpp: Split into ejabberd and jsxc modules.
## [0.12.0] - 2016-12-08 ## [0.12.0] - 2016-12-08
### Added ### Added

View File

@ -1 +1 @@
plinth.modules.xmpp plinth.modules.ejabberd

View File

@ -1 +1 @@
plinth.modules.xmpp plinth.modules.jsxc

View File

@ -33,7 +33,7 @@ from plinth.signals import pre_hostname_change, post_hostname_change
from plinth.signals import domainname_change from plinth.signals import domainname_change
version = 2 version = 1
depends = ['apps'] depends = ['apps']
@ -106,7 +106,7 @@ def add_shortcut():
def is_enabled(): def is_enabled():
"""Return whether the module is enabled.""" """Return whether the module is enabled."""
return (action_utils.service_is_enabled('ejabberd')) return action_utils.service_is_enabled('ejabberd')
def get_domainname(): def get_domainname():

View File

@ -42,7 +42,7 @@
</p> </p>
<p> <p>
<a href='{% url "xmpp:jsxc" %}' target='_blank' class='btn btn-primary'> <a href='{% url "jsxc:jsxc" %}' target='_blank' class='btn btn-primary'>
{% trans "Launch web client" %}</a> {% trans "Launch web client" %}</a>
</p> </p>
{% endblock %} {% endblock %}

View File

@ -24,14 +24,12 @@ from django.utils.translation import ugettext_lazy as _
import logging import logging
import socket import socket
from plinth import actions
from plinth import action_utils
from plinth import cfg from plinth import cfg
from plinth import frontpage from plinth import frontpage
from plinth import service as service_module from plinth import service as service_module
version = 2 version = 1
depends = ['apps'] depends = ['apps']
@ -41,9 +39,8 @@ title = _('Chat Client \n (JSXC)')
description = [ description = [
_('JSXC is a web client for XMPP. Typically it is used with an XMPP server running locally ' _('JSXC is a web client for XMPP. Typically it is used with an XMPP '
'<a href=\'http://xmpp.org/xmpp-software/clients/\' target=\'_blank\'' 'server running locally.'),
'>XMPP client</a>.'),
] ]
service = None service = None
@ -59,32 +56,36 @@ def init():
global service global service
setup_helper = globals()['setup_helper'] setup_helper = globals()['setup_helper']
if setup_helper.get_state() != 'needs-setup': if setup_helper.get_state() != 'needs-setup':
service = service = service_module.Service( service = service_module.Service(
'jsxc', title, ports=['http', 'https'], is_external=True, 'jsxc', title, ports=['http', 'https'], is_external=True,
is_enabled=is_enabled, enable=enable, disable=disable) is_enabled=is_enabled, enable=enable, disable=disable)
if is_enabled(): if is_enabled():
add_shortcut() add_shortcut()
def setup(helper, old_version=None): def setup(helper, old_version=None):
"""Install and configure the module.""" """Install and configure the module."""
helper.install(managed_packages) helper.install(managed_packages)
if setup_helper.get_state() != 'needs-setup':
service = service = service_module.Service( global service
if not service:
service = service_module.Service(
'jsxc', title, ports=['http', 'https'], is_external=True, 'jsxc', title, ports=['http', 'https'], is_external=True,
is_enabled=is_enabled, enable=enable, disable=disable) is_enabled=is_enabled, enable=enable, disable=disable)
helper.call('post', add_shortcut) helper.call('post', add_shortcut)
def add_shortcut(): def add_shortcut():
frontpage.add_shortcut('jsxc', _('Chat Client \n (jsxc)'), frontpage.add_shortcut('jsxc', _('Chat Client \n (jsxc)'),
url=reverse_lazy('xmpp:jsxc'), url=reverse_lazy('jsxc:jsxc'),
login_required=True) login_required=True)
def is_enabled(): def is_enabled():
"""Return whether the module is enabled.""" """Return whether the module is enabled."""
if setup_helper.get_state() != 'needs-setup': setup_helper = globals()['setup_helper']
service = service = service_module.Service( return setup_helper.get_state() != 'needs-setup'
'jsxc', title, ports=['http', 'https'], is_external=True,
is_enabled=is_enabled, enable=enable, disable=disable)
def get_domainname(): def get_domainname():

View File

@ -32,3 +32,6 @@
{% trans "Launch web client" %}</a> {% trans "Launch web client" %}</a>
</p> </p>
{% endblock %} {% endblock %}
{% block configuration %}
{% endblock %}

View File

@ -25,6 +25,6 @@ from .views import JSXCServiceView, JsxcView
urlpatterns = [ urlpatterns = [
url(r'^apps/jsxc', JSXCServiceView(), name='index'), url(r'^apps/jsxc$', JSXCServiceView.as_view(), name='index'),
url(r'^apps/jsxc/jsxc', JsxcView(), name='jsxc') url(r'^apps/jsxc/jsxc$', JsxcView.as_view(), name='jsxc')
] ]

View File

@ -32,16 +32,12 @@ class JSXCServiceView(ServiceView):
service_id = 'jsxc' service_id = 'jsxc'
template_name = 'jsxc.html' template_name = 'jsxc.html'
description = jsxc.description description = jsxc.description
show_status_block = False
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(*args, **kwargs)
context['domainname'] = jsxc.get_domainname()
return context
class JsxcView(TemplateView): class JsxcView(TemplateView):
"""A simple page to embed Javascript XMPP Client library.""" """A simple page to embed Javascript XMPP Client library."""
template_name = 'jsxc.html' template_name = 'jsxc_launch.html'
@method_decorator(public) @method_decorator(public)
def dispatch(self, *args, **kwargs): def dispatch(self, *args, **kwargs):