ikiwiki: Use new setup mechanism

This commit is contained in:
Sunil Mohan Adapa 2016-02-12 15:29:47 +05:30
parent 38bf4d4549
commit cceddf5c0a
No known key found for this signature in database
GPG Key ID: 36C361440C9BC971
3 changed files with 30 additions and 30 deletions

View File

@ -21,26 +21,48 @@ Plinth module to configure ikiwiki
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 = _('Wiki and Blog (ikiwiki)')
description = [
_('When enabled, the blogs and wikis will be available '
'from <a href="/ikiwiki">/ikiwiki</a>.')
]
service = None
def init():
"""Initialize the ikiwiki module."""
menu = cfg.main_menu.get('apps:index')
menu.add_urlname(_('Wiki and Blog (ikiwiki)'), 'glyphicon-edit',
'ikiwiki:index', 1100)
menu.add_urlname(title, 'glyphicon-edit', 'ikiwiki:index', 1100)
global service
service = service_module.Service(
'ikiwiki', _('ikiwiki wikis and blogs'), ['http', 'https'],
is_external=True, enabled=is_enabled())
'ikiwiki', title, ['http', 'https'], is_external=True,
enabled=is_enabled())
def setup(helper, old_version=None):
"""Install and configure the module."""
helper.install(['ikiwiki',
'gcc',
'libc6-dev',
'libtimedate-perl',
'libcgi-formbuilder-perl',
'libcgi-session-perl',
'libxml-writer-perl'])
helper.call('post', actions.superuser_run, 'ikiwiki', ['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,14 +21,7 @@
{% load bootstrap %}
{% load i18n %}
{% block content %}
<p>
{% blocktrans trimmed %}
When enabled, the blogs and wikis will be available
from <a href="/ikiwiki">/ikiwiki</a>.
{% endblocktrans %}
</p>
{% block configuration %}
{% include "diagnostics_button.html" with module="ikiwiki" %}

View File

@ -27,8 +27,6 @@ from django.utils.translation import ugettext as _, ugettext_lazy
from .forms import IkiwikiForm, IkiwikiCreateForm
from plinth import actions
from plinth import action_utils
from plinth import package
from plinth.modules import ikiwiki
@ -40,20 +38,6 @@ subsubmenu = [{'url': reverse_lazy('ikiwiki:index'),
'text': ugettext_lazy('Create')}]
def on_install():
"""Enable ikiwiki on install."""
actions.superuser_run('ikiwiki', ['setup'])
ikiwiki.service.notify_enabled(None, True)
@package.required(['ikiwiki',
'gcc',
'libc6-dev',
'libtimedate-perl',
'libcgi-formbuilder-perl',
'libcgi-session-perl',
'libxml-writer-perl'],
on_install=on_install)
def index(request):
"""Serve configuration page."""
status = get_status()
@ -70,7 +54,8 @@ def index(request):
form = IkiwikiForm(initial=status, prefix='ikiwiki')
return TemplateResponse(request, 'ikiwiki.html',
{'title': _('Wiki and Blog'),
{'title': ikiwiki.title,
'description': ikiwiki.description,
'status': status,
'form': form,
'subsubmenu': subsubmenu})