add links to webmail, phpmyadmin and phppgadmin

- add new links dropdown to top navigation in template base.html
- add new settings GVA_LINK_WEBMAIL, GVA_LINK_PHPMYADMIN and
  GVA_LINK_PHPPGADMIN to gnuviechadmin.settings.base
- implement gnuviechadmin.context_processors.navigation to add links to
  request context of non-AJAX requests
- add generated documentation for gnuviechadmin.context_processors
- add changelog entry
This commit is contained in:
Jan Dittberner 2015-02-01 13:16:45 +01:00
parent 551fd0eeab
commit 210d1e122c
5 changed files with 50 additions and 0 deletions

View file

@ -1,6 +1,8 @@
Changelog Changelog
========= =========
* :feature:`-` add links to webmail, phpmyadmin and phppgadmin
* :release:`0.10.0 <2015-02-01>` * :release:`0.10.0 <2015-02-01>`
* :support:`-` move taskresults tests to tasksresults.tests and fix them * :support:`-` move taskresults tests to tasksresults.tests and fix them
* :support:`-` cache result of get_hosting_package method of * :support:`-` cache result of get_hosting_package method of

View file

@ -11,6 +11,13 @@ The project module :py:mod:`gnuviechadmin`
:members: :members:
:py:mod:`context_processors <gnuviechadmin.context_processors>`
---------------------------------------------------------------
.. automodule:: gnuviechadmin.context_processors
:members:
:py:mod:`urls <gnuviechadmin.urls>` :py:mod:`urls <gnuviechadmin.urls>`
----------------------------------- -----------------------------------

View file

@ -0,0 +1,27 @@
"""
This module provides context processor implementations for gnuviechadmin.
"""
from __future__ import absolute_import, unicode_literals
from django.conf import settings
def navigation(request):
"""
Add navigation items to the request context.
:param request: Django :py:class:`HttpRequest <django.http.HttpRequest>`
:return: new context items
:rtype: dict
"""
if request.is_ajax():
return {}
context = {
'webmail_url': settings.GVA_LINK_WEBMAIL,
'phpmyadmin_url': settings.GVA_LINK_PHPMYADMIN,
'phppgadmin_url': settings.GVA_LINK_PHPPGADMIN,
'active_item': 'dashboard',
}
return context

View file

@ -171,6 +171,8 @@ TEMPLATE_CONTEXT_PROCESSORS = (
# allauth specific context processors # allauth specific context processors
'allauth.account.context_processors.account', 'allauth.account.context_processors.account',
'allauth.socialaccount.context_processors.socialaccount', 'allauth.socialaccount.context_processors.socialaccount',
# custom context processors
'gnuviechadmin.context_processors.navigation',
) )
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders # See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
@ -359,4 +361,8 @@ OSUSER_SFTP_GROUP = 'sftponly'
OSUSER_SSH_GROUP = 'sshusers' OSUSER_SSH_GROUP = 'sshusers'
OSUSER_DEFAULT_GROUPS = [OSUSER_SFTP_GROUP] OSUSER_DEFAULT_GROUPS = [OSUSER_SFTP_GROUP]
OSUSER_UPLOAD_SERVER = get_env_variable('GVA_OSUSER_UPLOADSERVER') OSUSER_UPLOAD_SERVER = get_env_variable('GVA_OSUSER_UPLOADSERVER')
GVA_LINK_WEBMAIL = get_env_variable('GVA_WEBMAIL_URL')
GVA_LINK_PHPMYADMIN = get_env_variable('GVA_PHPMYADMIN_URL')
GVA_LINK_PHPPGADMIN = get_env_variable('GVA_PHPPGADMIN_URL')
########## END CUSTOM APP CONFIGURATION ########## END CUSTOM APP CONFIGURATION

View file

@ -49,6 +49,14 @@
{% if user.is_staff %} {% if user.is_staff %}
<li><a href="{% url 'all_hosting_packages' %}">{% trans "All hosting packages" %}</a></li> <li><a href="{% url 'all_hosting_packages' %}">{% trans "All hosting packages" %}</a></li>
{% endif %} {% endif %}
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="glyphicon glyphicon-link"></i> {% trans "Links" %} <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="{{ webmail_url }}" title="{% trans "Web based mail system" %}"><i class="fa fa-envelope"></i> {% trans "Webmail" %}</a></li>
<li><a href="{{ phpmyadmin_url }}" title="{% trans "phpMyAdmin - MySQL datbase administration frontend" %}"><i class="icon-mysql"></i> {% trans "phpMyAdmin" %}</a></li>
<li><a href="{{ phppgadmin_url }}" title="{% trans "phpPgAdmin - PostgreSQL database administration frontend" %}"><i class="icon-postgres"></i> {% trans "phpPgAdmin" %}</a></li>
</ul>
</li>
<li><a href="#about">About</a></li> <li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li> <li><a href="#contact">Contact</a></li>
</ul> </ul>