widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #04302
[Merge] lp:~franku/widelands-website/new_legal_notice_page into lp:widelands-website
kaputtnik has proposed merging lp:~franku/widelands-website/new_legal_notice_page into lp:widelands-website.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1484845 in Widelands Website: "Add an Immpressum (legal) site"
https://bugs.launchpad.net/widelands-website/+bug/1484845
For more details, see:
https://code.launchpad.net/~franku/widelands-website/new_legal_notice_page/+merge/268973
This branch contains changes for an additional legal notice page for the website.
Added two pages:
1. legal notice page with possibility to send an inquiry to some recipients without an account on widelands.org
2. A "thanks for inquiry" page, which is seen if an inquiry has been send
- Link to legal notice page is available over the footer (so it is available on all pages)
- The recipients where the inquiry of the form is send to is defined in settings.py with "INQUIRY_RECIPIENTS =". Currently i have my Email in there, but this should be completed/replaced with an address of a mailing list. Currently you could leave my address and complete it with your email if you want. In future it should only be the email address of a mailing list. This setting could also be in "local_settings.py".
- Changed the colour of errormessages to a more comfortable red.
Because my english is a german english, the text may have to be adjusted :-D
--
Your team Widelands Developers is requested to review the proposed merge of lp:~franku/widelands-website/new_legal_notice_page into lp:widelands-website.
=== modified file 'mainpage/forms.py'
--- mainpage/forms.py 2010-01-02 22:28:51 +0000
+++ mainpage/forms.py 2015-08-24 20:28:01 +0000
@@ -4,9 +4,14 @@
from registration.forms import RegistrationForm
from wlrecaptcha.forms import RecaptchaForm, \
RecaptchaFieldPlaceholder, RecaptchaWidget
+from django import forms
class RegistrationWithCaptchaForm(RegistrationForm,RecaptchaForm):
captcha = RecaptchaFieldPlaceholder(widget=RecaptchaWidget(theme="white"),
label="Are you human?")
-
+class ContactForm(forms.Form):
+ surname = forms.CharField(max_length=80)
+ forename = forms.CharField(max_length=80)
+ email = forms.EmailField()
+ inquiry = forms.CharField(widget=forms.Textarea)
=== modified file 'mainpage/views.py'
--- mainpage/views.py 2015-07-29 16:43:51 +0000
+++ mainpage/views.py 2015-08-24 20:28:01 +0000
@@ -1,8 +1,13 @@
from django.shortcuts import render_to_response
from django.template import RequestContext
-from settings import WIDELANDS_SVN_DIR
+from settings import WIDELANDS_SVN_DIR, EMAIL_BACKEND, INQUIRY_RECIPIENTS
from templatetags.wl_markdown import do_wl_markdown
from operator import itemgetter
+from django.core.mail import send_mail
+from mainpage.forms import ContactForm
+from django.shortcuts import render
+from django.http import HttpResponseRedirect
+from django.core.urlresolvers import reverse
import sys
import json
import os
@@ -13,11 +18,35 @@
return render_to_response('mainpage.html',
context_instance=RequestContext(request))
+def legal_notice(request):
+ """The legal notice page to fullfill law"""
+ if request.method == 'POST':
+ form = ContactForm(request.POST)
+ if form.is_valid():
+ name = form.cleaned_data['forename'] + ' ' + form.cleaned_data['surname']
+ subject = 'An inquiry over the webpage'
+ message = 'From: ' + name + '\n'
+ message = message + 'EMail: ' + form.cleaned_data['email'] + '\n'
+ message = message + 'Inquiry:\n'
+ message += form.cleaned_data['inquiry']
+ sender = 'legal_note@xxxxxxxxxxxxx'
+
+ send_mail(subject, message, sender,
+ INQUIRY_RECIPIENTS, fail_silently=False)
+ return HttpResponseRedirect('/legal_notice_thanks/') # Redirect after POST
+ else:
+ form = ContactForm() # An unbound form
+
+ return render(request, 'mainpage/legal_notice.html', {
+ 'form': form,
+ })
+
+def legal_notice_thanks(request):
+ return render(request, 'mainpage/legal_notice_thanks.html')
+
+
from forms import RegistrationWithCaptchaForm
-from django.http import HttpResponseRedirect
-from django.core.urlresolvers import reverse
-
from registration.backends.default import DefaultBackend
=== modified file 'media/css/base.css'
--- media/css/base.css 2015-01-08 21:40:25 +0000
+++ media/css/base.css 2015-08-24 20:28:01 +0000
@@ -194,7 +194,7 @@
}
.errormessage {
- color: #ff0000;
+ color: #ff6b3c;
}
.errormessage ul {
@@ -227,7 +227,7 @@
div#footer {
background-color: #695536;
background-image: url("../img/wood.png");
- padding: 15px;
+ padding: 10px;
margin-top: 20px;
text-align: center;
box-shadow: 4px 4px 4px 0px rgba(0, 0, 0, 0.7);
=== modified file 'settings.py'
--- settings.py 2015-01-08 21:40:25 +0000
+++ settings.py 2015-08-24 20:28:01 +0000
@@ -264,6 +264,12 @@
USE_GOOGLE_ANALYTICS=False
+###############################
+## Recipient(s) for the form ##
+## on legal notice page ##
+###############################
+INQUIRY_RECIPIENTS = ('somal@xxxxxxxx',)
+
try:
from local_settings import *
except ImportError:
=== modified file 'templates/footer.html'
--- templates/footer.html 2015-02-24 20:24:59 +0000
+++ templates/footer.html 2015-08-24 20:28:01 +0000
@@ -7,5 +7,6 @@
{% endcomment %}
<div id="footer">
- Copyright © 2009 - 2015 By the Widelands Development Team
+ Copyright © 2009 - 2015 By the Widelands Development Team</br>
+ <a class="small" href="{% url legal_notice %}">Legal notice (contact)</a>
</div>
=== added file 'templates/mainpage/legal_notice.html'
--- templates/mainpage/legal_notice.html 1970-01-01 00:00:00 +0000
+++ templates/mainpage/legal_notice.html 2015-08-24 20:28:01 +0000
@@ -0,0 +1,56 @@
+{% extends "base.html" %}
+{% load wl_markdown %}
+
+{% block title %}Legal notice {{ block.super }}{% endblock %}
+
+{% block content %}
+
+<h1>Legal notice</h1>
+
+<div class="blogEntry">
+ <p>The webpage <a href="https://wl.widelands.org">widelands.org</a> is a private page to exchange knowledge and experience about the game widelands. There is no financial goal or interest.</p>
+
+ <h2>Project leader</h2>
+ <ul>
+ <li>Holger Rapp</li>
+ </ul>
+
+ <h2>Contact</h2>
+ <p>There are several possibilities to get in contact. For questions about the game or the contents of the website please take a look at our <a href=/wiki/ContactPage>Contact page</a>. Because most methods described over there needs an account, the following methods for contacting could be used without an account:</p>
+
+ <ul>
+ <li>E-Mail to project leader: sirver(at)gmx.de</li>
+ <li>Contact form (all fields has to be filled out)!
+
+ <form action="/legal_notice/" method="post">{% csrf_token %}
+ {% if form.errors %}
+ <p class="errormessage" style="text-align: left;">Please fill out all fields!</p>
+ {% endif %}
+ <table>
+ <tr>
+ <td><label for="id_forename">Your first name: </label></td>
+ <td><input id="id_forename" type="text" name="forename" maxlength="80" required></td>
+ </tr>
+ <tr>
+ <td><label for="id_surname">Your last name: </label></td>
+ <td><input id="id_surname" type="text" name="surname" maxlength="80" required></td>
+ </tr>
+ <tr>
+ <td><label for="id_email">Your Email:</label></td>
+ <td><input type="text" name="email" id="id_email" required></td>
+ </tr>
+ <tr>
+ <td><label for="id_inquiry">Your Inquiry: </label></td>
+ <td><textarea id="id_inquiry" rows="10" cols="40" name="inquiry" required></textarea></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td><input type="submit" value="Submit"></td>
+ </tr>
+ </table>
+ </form>
+ </li>
+ </ul>
+</div>
+{% endblock %}
+
=== added file 'templates/mainpage/legal_notice_thanks.html'
--- templates/mainpage/legal_notice_thanks.html 1970-01-01 00:00:00 +0000
+++ templates/mainpage/legal_notice_thanks.html 2015-08-24 20:28:01 +0000
@@ -0,0 +1,16 @@
+{% extends "base.html" %}
+{% load wl_markdown %}
+
+{% block title %}Impressum (Legal note) {{ block.super }}{% endblock %}
+
+{% block content %}
+
+<h1>Legal notice</h1>
+
+<div class="blogEntry">
+ <h2>Thanks</h2>
+
+ <p>Thanks for your inquiry. An Email has been send to several recipients. We will answer as quickly as possible.</p>
+ </div>
+{% endblock %}
+
=== modified file 'urls.py'
--- urls.py 2012-05-17 19:28:39 +0000
+++ urls.py 2015-08-24 20:28:01 +0000
@@ -42,6 +42,8 @@
url(r'^$', mainpage, name="mainpage"),
url(r'^changelog/$', "mainpage.views.changelog", name="changelog"),
url(r'^developers/$', "mainpage.views.developers", name="developers"),
+ url(r'^legal_notice/$', "mainpage.views.legal_notice", name="legal_notice"),
+ url(r'^legal_notice_thanks/$', "mainpage.views.legal_notice_thanks", name="legal_notice_thanks"),
url(r'^help/(?P<path>.*)', redirect_to, { "url": "/encyclopedia/%(path)s", "permanent": True }), # to not break old links
url(r'^encyclopedia/', include("wlhelp.urls")),
url(r'^webchat/', include("wlwebchat.urls")),
Follow ups