From 1842db42da86cb056856211b57e78577d6c8be0c Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 12 Feb 2016 14:54:57 +0530 Subject: [PATCH] dynamicdns: Use new setup mechanism --- plinth/modules/dynamicdns/__init__.py | 39 +++++++++++++++++-- plinth/modules/dynamicdns/dynamicdns.py | 16 ++------ .../dynamicdns/templates/dynamicdns.html | 29 +------------- 3 files changed, 41 insertions(+), 43 deletions(-) diff --git a/plinth/modules/dynamicdns/__init__.py b/plinth/modules/dynamicdns/__init__.py index 7b4bc398d..c47942f6e 100644 --- a/plinth/modules/dynamicdns/__init__.py +++ b/plinth/modules/dynamicdns/__init__.py @@ -19,9 +19,42 @@ Plinth module to configure ez-ipupdate client """ -from . import dynamicdns -from .dynamicdns import init +from django.utils.translation import ugettext_lazy as _ -__all__ = ['dynamicdns', 'init'] +from plinth import cfg +from plinth.utils import format_lazy + +version = 1 depends = ['apps'] + +title = _('Dynamic DNS Client') + +description = [ + format_lazy( + _('If your internet provider changes your IP address periodic ' + '(i.e. every 24h) it may be hard for others to find you in the ' + 'WEB. And for this reason nobody may find the services which are ' + 'provided by {box_name}, such as ownCloud.'), + box_name=_(cfg.box_name)), + + _('The solution is to assign a DNS name to your IP address and ' + 'update the DNS name every time your IP is changed by your ' + 'Internet provider. Dynamic DNS allows you to push your current ' + 'public IP address to an ' + ' ' + 'gnudip server. Afterwards the Server will assign your DNS name ' + 'with the new IP and if someone from the Internet asks for your DNS ' + 'name he will get your current IP answered.') +] + + +def init(): + """Initialize the module.""" + menu = cfg.main_menu.get('apps:index') + menu.add_urlname(title, 'glyphicon-refresh', 'dynamicdns:index', 500) + + +def setup(helper, old_version=None): + """Install and configure the module.""" + helper.install(['ez-ipupdate']) diff --git a/plinth/modules/dynamicdns/dynamicdns.py b/plinth/modules/dynamicdns/dynamicdns.py index 490ec98c6..b15e49b59 100644 --- a/plinth/modules/dynamicdns/dynamicdns.py +++ b/plinth/modules/dynamicdns/dynamicdns.py @@ -25,7 +25,7 @@ import logging from plinth import actions from plinth import cfg -from plinth import package +from plinth.modules import dynamicdns from plinth.utils import format_lazy logger = logging.getLogger(__name__) @@ -39,19 +39,11 @@ subsubmenu = [{'url': reverse_lazy('dynamicdns:index'), 'text': ugettext_lazy('Status')}] -def init(): - """Initialize the dynamicdns module""" - menu = cfg.main_menu.get('apps:index') - menu.add_urlname(ugettext_lazy('Dynamic DNS'), 'glyphicon-refresh', - 'dynamicdns:index', 500) - - -@package.required(['ez-ipupdate']) def index(request): """Serve Dynamic DNS page.""" - return TemplateResponse(request, 'dynamicdns.html', - {'title': _('Dynamic DNS'), + {'title': dynamicdns.title, + 'description': dynamicdns.description, 'subsubmenu': subsubmenu}) @@ -198,7 +190,6 @@ class ConfigureForm(forms.Form): raise forms.ValidationError(_('Please provide a password')) -@package.required(['ez-ipupdate']) def configure(request): """Serve the configuration form.""" status = get_status() @@ -219,7 +210,6 @@ def configure(request): 'subsubmenu': subsubmenu}) -@package.required(['ez-ipupdate']) def statuspage(request): """Serve the status page.""" check_nat = actions.run('dynamicdns', ['get-nat']) diff --git a/plinth/modules/dynamicdns/templates/dynamicdns.html b/plinth/modules/dynamicdns/templates/dynamicdns.html index 5ad1ec90b..1b3d1bfa7 100644 --- a/plinth/modules/dynamicdns/templates/dynamicdns.html +++ b/plinth/modules/dynamicdns/templates/dynamicdns.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "app.html" %} {% comment %} # # This file is part of Plinth. @@ -20,32 +20,7 @@ {% load i18n %} -{% block content %} - -

{% trans "Dynamic DNS Client" %}

- -

- {% blocktrans trimmed %} - If your internet provider changes your IP address periodic - (i.e. every 24h) it may be hard for others to find you in the - WEB. And for this reason nobody may find the services which are - provided by {{ box_name }}, such as ownCloud. - {% endblocktrans %} -

- -

- {% blocktrans trimmed %} - The solution is to assign a DNS name to your IP address and - update the DNS name every time your IP is changed by your - Internet provider. Dynamic DNS allows you to push your current - public IP address to an - gnudip - server. Afterwards the Server will assign your DNS name with the - new IP and if someone from the Internet asks for your DNS name - he will get your current IP answered. - {% endblocktrans %} -

- +{% block configuration %}

{% blocktrans trimmed %} If you are looking for a free dynamic DNS account, you may find