setup template structure for hosting package

- add panels for hosting package options, domains, mailboxes and databases
- list existing objects assigned to the hosting package
This commit is contained in:
Jan Dittberner 2015-01-24 22:33:09 +01:00
parent 0def7e3a7b
commit 7991d2bf4f

View file

@ -13,22 +13,31 @@
{% block content %}
<div class="row">
<div class="col-lg-6 col-md-6 col-xs-12">
<div class="col-lg-4 col-md-6 col-xs-12">
<div class="panel panel-default">
<div class="panel-heading">
{% trans "Hosting Package Information" %}<div class="pull-right"><a class="panel-title" href="#" title="{% trans "Edit Hosting Package Information" %}"><i class="glyphicon glyphicon-cog"></i></a></div>
</div>
<div class="panel-heading">{% spaceless %}
{% trans "Hosting Package Information" %}
{% if user.is_staff %}
<div class="pull-right">
<a class="panel-title" href="#" title="{% trans "Edit Hosting Package Information" %}"><i class="glyphicon glyphicon-cog"></i></a>
</div>
{% endif %}
{% endspaceless %}</div>
<dl class="panel-body dl-horizontal">
<dt>{% trans "Name" %}</dt>
<dd>{{ hostingpackage.name }}</dd>
<dt>{% trans "Description" %}</dt>
<dd>{{ hostingpackage.description|default:"-" }}</dd>
<dt>{% trans "Disk space" %}</dt>
{% with diskspace=hostingpackage.get_disk_space %}
<dd title="{% blocktrans %}The reserved disk space for your hosting package is {{ diskspace }} bytes.{% endblocktrans %}">{{ diskspace|filesizeformat }}</dd>
{% with diskspace=hostingpackage.get_disk_space packagespace=hostingpackage.get_package_space %}
<dd>
<span title="{% blocktrans %}The reserved disk space for your hosting package is {{ diskspace }} bytes{% endblocktrans %}">{{ diskspace|filesizeformat }}</span>
<span class="glyphicon glyphicon-info-sign" title="{% blocktrans with humanbytes=packagespace|filesizeformat %}The package contributes {{ humanbytes }} ({{ packagespace }} bytes) the difference comes from disk space options{% endblocktrans %}"></span>
</dd>
{% endwith %}
<dt>{% trans "Mailboxes" %}</dt>
<dd>{% blocktrans with num=hostingpackage.get_used_mailboxes total=hostingpackage.get_mailboxes %}{{ num }} of {{ total }} in use{% endblocktrans %}</dd>
<dd>{% blocktrans with num=hostingpackage.used_mailbox_count total=hostingpackage.mailbox_count %}{{ num }} of {{ total }} in use{% endblocktrans %} <span class="glyphicon
glyphicon-info-sign" title="{% blocktrans with mailboxes=hostingpackage.mailboxcount %}The package provides {{ mailboxcount }} mailboxes the difference comes from mailbox options.{% endblocktrans %}"></span></dd>
<dt>{% if hostingpackage.osuser.is_sftp_user %}{% trans "SFTP username" %}{% else %}{% trans "SSH/SFTP username" %}{% endif %}</dt>
<dd>{{ hostingpackage.osuser.username }}</dd>
<dt>{% trans "Upload server" %}</dt>
@ -36,13 +45,138 @@
</dl>
</div>
</div>
<div class="col-lg-6 col-md-6 col-xs-12">
<div class="col-lg-4 col-md-6 col-xs-12">
<div class="panel panel-default">
<div class="panel-heading">{% trans "Hosting Package Options" %}</div>
{% if hostingpackage.customerhostingpackageoption_set.exists %}
<ul class="list-group">
{% for opt in hostingpackage.get_hostingoptions %}
<li class="list-group-item">{{ opt }}</li>
{% endfor %}
</ul>
{% else %}
<p class="panel-body text-info">{% trans "No options booked" %}</p>
{% endif %}
{% if user.is_staff %}
<p class="panel-body"><a class="btn btn-primary" href="#" title="{% trans "Add another hosting option" %}">{% trans "Add option" %}</a></p>
{% endif %}
</div>
</div>
<div class="col-lg-4 col-md-6 col-xs-12">
<div class="panel panel-default">
<div class="panel-heading">{% trans "Hosting Package Actions" %}</div>
<ul class="list-group">
<li class="list-group-item"><a href="#" title="{% trans "Edit Hosting Package Description" %}">{% trans "Edit description" %}</a></li>
<li class="list-group-item"><a href="{% url "set_osuser_password" slug=hostingpackage.osuser.username %}">{% if hostingpackage.osuser.is_sftp %}{% trans "Set SFTP password" %}{% else %}{% trans "Set SSH/SFTP password" %}{% endif %}</a></li>
</ul>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-xs-12">
<div class="panel panel-default">
<div class="panel-heading">{% trans "Domains" %}</div>
{% if hostingpackage.domains %}
<table class="table table-condensed">
<thead>
<tr>
<th>{% trans "Domain name" %}</th>
<th>{% trans "Mail addresses" %}</th>
<th>{% trans "Websites" %}</th>
<th title="{% trans "Domain actions" %}"><span class="sr-only">{% trans "Actions" %}</span></th>
</tr>
</thead>
<tbody>
{% for domain in hostingpackage.domains.all %}
<tr>
<td>{{ domain.domain }}</td>
{% if domain.domain.maildomain %}
<td>{{ domain.domain.maildomain.mailaddresses|join:", " }}</td>
{% else %}
<td class="text-info">{% trans "None" %}</td>
{% endif %}
<td></td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="panel-body text-info">{% trans "There are no domains assigned to this hosting package yet." %}</p>
{% endif %}
{% if user.is_staff %}
<p class="panel-body"><a href="#" class="btn btn-primary">{% trans "Add domain" %}</a></p>
{% endif %}
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-xs-12">
<div class="panel panel-default">
<div class="panel-heading">{% trans "E-Mail-Accounts" %}</div>
{% if hostingpackage.mailboxes %}
<table class="table table-condensed">
<thead>
<tr>
<th>{% trans "Mailbox" %}</th>
<th>{% trans "Mail addresses" %}</th>
<th>{% trans "Active" %}</th>
<th title="{% trans "Mailbox actions" %}"><span class="sr-only">{% trans "Actions" %}</span></th>
</tr>
</thead>
<tbody>
{% for mailbox in hostingpackage.mailboxes %}
<tr>
<td>{{ mailbox.username }}</td>
<td>{{ mailbox.mailaddresses|join:", " }}</td>
<td><i class="glyphicon glyphicon-{% if mailbox.active %}ok-circle{% else %}minus-sign{% endif %}"></i><span class="sr-only"> {% if mailbox.active %}{% trans "Active" %}{% else %}{% trans "inactive" %}{% endif %}</span></td>
<td>
<a href="#"><i class="fa fa-user-secret" title="{% trans "Set mailbox password" %}"></i><span class="sr-only"> {% trans "Set mailbox password" %}</span></a>
</td>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="panel-body text-info">{% trans "There are no mailboxes assigned to this hosting package yet." %}</p>
{% endif %}
{% if hostingpackage.may_add_mailbox %}
<p class="panel-body"><a href="#" class="btn btn-primary">{% trans "Add mailbox" %}</a></p>
{% endif %}
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-xs-12">
<div class="panel panel-default">
<div class="panel-heading">{% trans "Databases" %}</div>
{% if hostingpackage.databases %}
<table class="table table-condensed">
<thead>
<tr>
<th title="{% trans "Database type" %}"><span class="sr-only">{% trans "Type" %}</span></th>
<th>{% trans "Database name" %}</th>
<th>{% trans "Database user" %}</th>
<th title="{% trans "Database actions" %}"><span class="sr-only">{% trans "Actions" %}</span></th>
</tr>
</thead>
<tbody>
{% for database in hostingpackage.databases %}
<tr>
<td>{% include "userdbs/snippets/db_type.html" with db_type=database.db_user.db_type %}</td>
<td>{{ database.db_name }}</td>
<td>{{ database.db_user.username }}</td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="panel-body text-info">{% trans "There are no databases assigned to this hosting package yet." %}</p>
{% endif %}
{% if hostingpackage.may_add_database %}
<p class="panel-body"><a href="#" class="btn btn-primary">{% trans "Add database" %}</a></p>
{% endif %}
</div>
</div>
</div>
{% endblock content %}