diff --git a/main/forms.py b/main/forms.py new file mode 100644 index 000000000..589c1e04d --- /dev/null +++ b/main/forms.py @@ -0,0 +1,8 @@ +from django import forms +from mailng.main.models import ARmessage + +class ARmessageForm(forms.ModelForm): + class Meta: + model = ARmessage + fields = ('subject', 'content', 'enabled') + diff --git a/main/models.py b/main/models.py index 49c308d5a..40ded28a3 100644 --- a/main/models.py +++ b/main/models.py @@ -6,3 +6,4 @@ class ARmessage(models.Model): last_sent = models.DateField() subject = models.CharField(max_length=255) content = models.TextField() + enabled = models.BooleanField() diff --git a/main/templatetags/__init__.py b/main/templatetags/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/main/templatetags/main_extras.py b/main/templatetags/main_extras.py new file mode 100644 index 000000000..2c75830e1 --- /dev/null +++ b/main/templatetags/main_extras.py @@ -0,0 +1,10 @@ +from django import template +from django.template.loader import render_to_string +from django.utils.translation import ugettext as _ + +register = template.Library() + +@register.simple_tag +def menu(selection, perms): + return render_to_string('main/menu.html', + {"selection" : selection, "perms" : perms}) diff --git a/main/urls.py b/main/urls.py index c5b376b59..df66bc332 100644 --- a/main/urls.py +++ b/main/urls.py @@ -1,5 +1,6 @@ from django.conf.urls.defaults import * urlpatterns = patterns('mailng.main.views', - url(r'^$', 'index') + url(r'^$', 'index'), + url(r'^autoreply/$', 'autoreply') ) diff --git a/main/views.py b/main/views.py index 1877c10f6..1bfc7f2da 100644 --- a/main/views.py +++ b/main/views.py @@ -4,7 +4,15 @@ from django.template import RequestContext from django.contrib.auth.decorators \ import login_required from mailng.lib import _render +from forms import ARmessageForm @login_required def index(request): return _render(request, "main/index.html", {}) + +@login_required +def autoreply(request): + form = ARmessageForm() + return _render(request, "main/autoreply.html", { + "form" : form + }) diff --git a/settings_sample.py b/settings_sample.py index 7c2b2931d..3d92f3107 100644 --- a/settings_sample.py +++ b/settings_sample.py @@ -78,7 +78,8 @@ INSTALLED_APPS = ( 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', - 'mailng.admin' + 'mailng.admin', + 'mailng.main' ) AUTHENTICATION_BACKENDS = ( diff --git a/static/stylesheets/basic.css b/static/stylesheets/basic.css index 2b14c7c85..778c0b43d 100644 --- a/static/stylesheets/basic.css +++ b/static/stylesheets/basic.css @@ -254,6 +254,11 @@ body { width: 90%; } +#subcontent { + margin: 10px auto; + width: 90%; +} + #setcontent { margin: 0px auto; width: 90%; diff --git a/templates/admin/domain_header.html b/templates/admin/domain_header.html index 4e048c03f..f661698a9 100644 --- a/templates/admin/domain_header.html +++ b/templates/admin/domain_header.html @@ -1,8 +1,8 @@ -{% extends "admin/layout.html" %} +{% extends "layout.html" %} {% block html_head %} {% endblock %} -{% block mainframe %} +{% block content %} {% load i18n %}

{% trans "Domain" %} {{ domain.name }}

diff --git a/templates/admin/layout.html b/templates/admin/layout.html index ac2c338a3..2566b41b3 100644 --- a/templates/admin/layout.html +++ b/templates/admin/layout.html @@ -2,51 +2,6 @@ {% block content %} {% load i18n %}
-
-
- {% if user.first_name %} -

{{ user.first_name }} {{ user.last_name }}

- {% else %} -

{{ user.username }}

- {% endif %} - -
-
- {% if user.is_superuser %} - - {% endif %} -
{%block mainframe %}{% endblock %}
diff --git a/templates/admin/mailboxes.html b/templates/admin/mailboxes.html index be7bd900d..28d8c28ab 100644 --- a/templates/admin/mailboxes.html +++ b/templates/admin/mailboxes.html @@ -1,9 +1,10 @@ {% extends "admin/domain_header.html" %} +{% load i18n %} + {% block menu %} {% load admin_extras %} {% domain_menu domain.id "mailboxes" perms %} {% endblock %} - {% block domcontent %} {% load i18n %} {% if messages %} diff --git a/templates/genericform.html b/templates/genericform.html new file mode 100644 index 000000000..728f1c91a --- /dev/null +++ b/templates/genericform.html @@ -0,0 +1,5 @@ +{% for field in form %} +
+ {{ field.label_tag }} {{ field }} {% ifequal noerrors False %}{{ field.errors }}{% endifequal %} +
+{% endfor %} diff --git a/templates/layout.html b/templates/layout.html index 7013d423a..fc9752d24 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -22,7 +22,59 @@

Simple virtual domains

- {% block content %}{% endblock %} + +
+
+
+ {% if user.first_name %} +

{{ user.first_name }} {{ user.last_name }}

+ {% else %} +

{{ user.username }}

+ {% endif %} + +
+
+ {% if user.is_superuser %} + + {% endif %} + {% block leftmenu %}{% endblock %} +
+
+ {% block content %}{% endblock %} +
+
+