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.
- Firstboot, KVStore: merge old firstboot state fields.
- tor: Use Plinth-specific instance instead of default.
- xmpp: Split into ejabberd and jsxc modules.
## [0.12.0] - 2016-12-08
### 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
version = 2
version = 1
depends = ['apps']
@ -106,7 +106,7 @@ def add_shortcut():
def 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():

View File

@ -42,7 +42,7 @@
</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>
</p>
{% endblock %}

View File

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

View File

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

View File

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

View File

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