mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
ejabberd, jsxc: Fix few remaining issues from module split
This commit is contained in:
9 files changed
+28
-27
No files matched your search
@@ -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():
|
||||
|
||||
@@ -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 %}
|
||||
@@ -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():
|
||||
|
||||
@@ -32,3 +32,6 @@
|
||||
{% trans "Launch web client" %}</a>
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block configuration %}
|
||||
{% endblock %}
|
||||
@@ -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')
|
||||
]
|
||||
@@ -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):
|
||||
|
||||
Reference in new issue
Block a user