Permalink
Browse files

renaming

  • Loading branch information...
1 parent 8f66239 commit 584b059a6f828f4c479fcdeceaf1d8a01b45e693 @maccesch committed Sep 2, 2010
View
@@ -1,2 +1,2 @@
-recursive-include cmsplugin-contact/locale *.mo
-graft cmsplugin-contact/templates
+recursive-include cmsplugin_contact/locale *.mo
+graft cmsplugin_contact/templates
View
@@ -40,5 +40,5 @@ Manual Download
Unzip the file you downloaded. Then go in your terminal and ``cd`` into the unpacked folder. Then type ``python setup.py install`` in your terminal.
-Put "cmsplugin-contact" in your ``INSTALLED_APPS`` section in settings.py. Don't forget to syncdb your database.
+Put "cmsplugin_contact" in your ``INSTALLED_APPS`` section in settings.py. Don't forget to syncdb your database.
No changes.
View
@@ -1,80 +0,0 @@
-from django.forms import ModelForm, Field, CharField
-from django.forms.util import ErrorList
-from django.core.exceptions import ValidationError
-from django.contrib.sites.models import Site
-from django.conf import settings
-from django.utils.translation import ugettext_lazy as _
-
-from models import Contact
-
-class KeyField(CharField):
- def validate(self, value):
- # valdates always. validation is done in the form (see below)
- pass
-
-class ContactAdminForm(ModelForm):
- akismet_api_key = KeyField(max_length=255, label=_("Akismet API Key"), help_text=_('Get a Wordpress Key from http://akismet.com/'))
-
- recaptcha_public_key = KeyField(max_length=255, label=_("ReCAPTCHA Public Key"), help_text=_('Get this from http://www.google.com/recaptcha'))
- recaptcha_private_key = KeyField(max_length=255, label=_("ReCAPTCHA Private Key"), help_text=_('Get this from http://www.google.com/recaptcha'))
-
- class Meta:
- model = Contact
-
-
- def _add_error(self, field_name, error):
- if not field_name in self._errors:
- self._errors[field_name] = ErrorList()
- self._errors[field_name].append(error)
-
- def _check_akismet(self):
- def add_error(error):
- self._add_error('akismet_api_key', error)
-
- try:
- from akismet import Akismet
- except ImportError:
- self._add_error('spam_protection_method', _('Akismet library is not installed. Use "easy_install akismet" or "pip install akismet".'))
-
- api_key = self.cleaned_data['akismet_api_key']
- if not api_key:
- add_error(Field.default_error_messages['required'])
- else:
- ak = Akismet(
- key = api_key,
- blog_url = 'http://%s/' % Site.objects.get(pk=settings.SITE_ID).domain
- )
- if not ak.verify_key():
- add_error(_('The API Key is not valid.'))
-
-
- def _check_recaptcha(self):
-
- try:
- from recaptcha.client import captcha as recaptcha
- except ImportError:
- self._add_error('spam_protection_method', _('ReCAPTCHA library is not installed. Use "easy_install recaptcha-client" or "pip install recaptcha-client".'))
-
- public_key = self.cleaned_data['recaptcha_public_key']
- private_key = self.cleaned_data['recaptcha_private_key']
-
- if not public_key:
- self._add_error('recaptcha_public_key', Field.default_error_messages['required'])
- if not private_key:
- self._add_error('recaptcha_private_key', Field.default_error_messages['required'])
-
-
- def clean(self):
-
- method = self.cleaned_data['spam_protection_method']
- print "huhu"
- if method == 1:
- # user chose aksimet => akismet api key is required
- self._check_akismet()
- elif method == 2:
- # user chose recaptcha => recaptcha keys are required
- self._check_recaptcha()
-
- return self.cleaned_data
-
-
@@ -1,87 +0,0 @@
-from django.utils.translation import ugettext_lazy as _
-from cms.plugin_base import CMSPluginBase
-from cms.plugin_pool import plugin_pool
-from django.template.loader import render_to_string
-from models import Contact
-from forms import AkismetContactForm, RecaptchaContactForm, HoneyPotContactForm
-from django.core.mail import EmailMessage
-from admin import ContactAdminForm
-
-class ContactPlugin(CMSPluginBase):
- model = Contact
- name = _("Contact Form")
- render_template = "cmsplugin_contact/contact.html"
- form = ContactAdminForm
-
- fieldsets = (
- (None, {
- 'fields': ('site_email', 'email_label', 'subject_label', 'content_label', 'thanks', 'submit'),
- }),
- (_('Spam Protection'), {
- 'fields': ('spam_protection_method', 'akismet_api_key', 'recaptcha_public_key', 'recaptcha_private_key', 'recaptcha_theme')
- })
- )
-
- change_form_template = "cmsplugin_contact/admin/plugin_change_form.html"
-
- def create_form(self, instance, request):
- if instance.get_spam_protection_method_display() == 'Akismet':
- AkismetContactForm.aksimet_api_key = instance.aksimet_api_key
- FormClass = AkismetContactForm
- elif instance.get_spam_protection_method_display() == 'ReCAPTCHA':
- RecaptchaContactForm.recaptcha_public_key = instance.recaptcha_public_key
- RecaptchaContactForm.recaptcha_private_key = instance.recaptcha_private_key
- RecaptchaContactForm.recaptcha_theme = instance.recaptcha_theme
- FormClass = RecaptchaContactForm
- else:
- FormClass = HoneyPotContactForm
-
- if request.method == "POST":
- return FormClass(request, data=request.POST)
- else:
- return FormClass(request)
-
-
- def send(self, form, site_email):
- subject = form.cleaned_data['subject']
- if not subject:
- subject = _('No subject')
- email_message = EmailMessage(
- subject,
- render_to_string("cmsplugin_contact/email.txt", {
- 'data': form.cleaned_data,
- }),
- site_email,
- [site_email],
- headers = {
- 'Reply-To': form.cleaned_data['email']
- },)
- email_message.send(fail_silently=True)
-
- def render(self, context, instance, placeholder):
- request = context['request']
-
- form = self.create_form(instance, request)
-
- if request.method == "POST" and form.is_valid():
- self.send(form, instance.site_email)
- context.update( {
- 'contact': instance,
- })
- else:
- context.update({
- 'contact': instance,
- 'form': form,
- })
-
- return context
-
- def render_change_form(self, request, context, add=False, change=False, form_url='', obj=None):
- context.update({
- 'spam_protection_method': obj.spam_protection_method if obj else 0
- })
-
- return super(ContactPlugin, self).render_change_form(request, context, add, change, form_url, obj)
-
-
-plugin_pool.register_plugin(ContactPlugin)
View
@@ -1,30 +0,0 @@
-from django import forms
-#import settings
-from stopspam.forms import HoneyPotForm, RecaptchaForm, AkismetForm
-
-class HoneyPotContactForm(HoneyPotForm):
- email = forms.EmailField()
- subject = forms.CharField(required=False)
- content = forms.CharField(widget=forms.Textarea())
-
-
-class AkismetContactForm(AkismetForm):
- akismet_fields = {
- 'comment_author_email': 'email',
- 'comment_content': 'content'
- }
- email = forms.EmailField()
- subject = forms.CharField(required=False)
- content = forms.CharField(widget=forms.Textarea())
-
- akismet_api_key = None
-
-
-class RecaptchaContactForm(RecaptchaForm):
- email = forms.EmailField()
- subject = forms.CharField(required=False)
- content = forms.CharField(widget=forms.Textarea())
-
- recaptcha_public_key = None
- recaptcha_private_key = None
- recaptcha_theme = None
Binary file not shown.
@@ -1,154 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-09-01 18:46+0200\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=(n != 1)\n"
-
-#: admin.py:16
-msgid "Akismet API Key"
-msgstr ""
-
-#: admin.py:16
-msgid "Get a Wordpress Key from http://akismet.com/"
-msgstr "Wordpress Key von http://akismet.com/"
-
-#: admin.py:18
-msgid "ReCAPTCHA Public Key"
-msgstr ""
-
-#: admin.py:18 admin.py:19
-msgid "Get this from http://www.google.com/recaptcha"
-msgstr "Erhältlich von http://www.google.com/recaptcha"
-
-#: admin.py:19
-msgid "ReCAPTCHA Private Key"
-msgstr ""
-
-#: admin.py:37
-msgid ""
-"Akismet library is not installed. Use \"easy_install akismet\" or \"pip "
-"install akismet\"."
-msgstr ""
-"Die Akismet Bibliothek ist nicht installiert. Zum installieren: "
-"\"easy_install akismet\" oder \"pip install akismet\""
-
-#: admin.py:48
-msgid "The API Key is not valid."
-msgstr "Der API Key ist ungültig."
-
-#: admin.py:56
-msgid ""
-"ReCAPTCHA library is not installed. Use \"easy_install recaptcha-client\" or "
-"\"pip install recaptcha-client\"."
-msgstr ""
-"Die ReCAPTCHA Bibliothek ist nicht installiert. Zum installieren: "
-"\"easy_install recaptcha-client\" oder \"pip install recaptcha-client\""
-
-#: cms_plugins.py:12
-msgid "Contact Form"
-msgstr "Kontaktformular"
-
-#: cms_plugins.py:20
-msgid "Spam Protection"
-msgstr "Spamschutz"
-
-#: cms_plugins.py:48
-msgid "No subject"
-msgstr "Kein Betreff"
-
-#: models.py:20
-msgid "Email recipient"
-msgstr "E-Mail Empfänger"
-
-#: models.py:21
-msgid "Email sender label"
-msgstr "E-Mail Absender Beschriftung"
-
-#: models.py:21
-msgid "Your email address"
-msgstr "Ihre E-Mail Adresse"
-
-#: models.py:22
-msgid "Subject label"
-msgstr "Betreff Beschriftung"
-
-#: models.py:22
-msgid "Subject"
-msgstr "Betreff"
-
-#: models.py:23
-msgid "Message content label"
-msgstr "Nachrichteninhalt Beschriftung"
-
-#: models.py:23
-msgid "Message"
-msgstr "Nachricht"
-
-#: models.py:24
-msgid "Thanks message"
-msgstr "Dankesnachricht"
-
-#: models.py:24
-msgid "Message displayed on successful submit"
-msgstr "Nachricht nach erfolgreichem Absenden"
-
-#: models.py:24
-msgid "Thank you for your message."
-msgstr "Vielen Dank für Ihre Nachricht."
-
-#: models.py:25
-msgid "Submit button value"
-msgstr "Senden Button Beschriftung"
-
-#: models.py:25
-msgid "Submit"
-msgstr "Senden"
-
-#: models.py:27
-msgid "Spam protection method"
-msgstr "Spamschutzmethode"
-
-#: models.py:33
-msgid "ReCAPTCHA theme"
-msgstr "ReCAPTCHA Theme"
-
-#: templates/cmsplugin_contact/contact.html:40
-msgid "Incorrect please try again"
-msgstr "Eingabe nicht korrekt, bitte erneut versuchen"
-
-#: templates/cmsplugin_contact/contact.html:43
-msgid "Enter the words above:"
-msgstr "Obige Wörter eingeben:"
-
-#: templates/cmsplugin_contact/contact.html:44
-msgid "Enter the numbers you hear:"
-msgstr "Die gehörten Zahlen eingeben:"
-
-#: templates/cmsplugin_contact/contact.html:49
-msgid "Get another CAPTCHA"
-msgstr "Anderes CAPTCHA"
-
-#: templates/cmsplugin_contact/contact.html:50
-msgid "Get an audio CAPTCHA"
-msgstr "Audio CAPTCHA"
-
-#: templates/cmsplugin_contact/contact.html:51
-msgid "Get an image CAPTCHA"
-msgstr "Bild CAPTCHA"
-
-#: templates/cmsplugin_contact/contact.html:53
-msgid "Help"
-msgstr "Hilfe"
Oops, something went wrong.

0 comments on commit 584b059

Please sign in to comment.