Changeset - 60843237bd44
[Not reviewed]
default
1 5 0
Dennis Fink - 9 years ago 2016-05-20 17:05:28
dennis.fink@c3l.lu
Remove BPM
6 files changed with 15 insertions and 163 deletions:
0 comments (0 inline, 0 general)
ennstatus/donate/views.py
Show inline comments
 
# Ënnstatus
 
# Copyright (C) 2015  Dennis Fink
 
#
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
from flask import (Blueprint, render_template, request,
 
                   redirect, url_for, current_app)
 

	
 
from babel.numbers import parse_decimal, format_decimal
 

	
 
from ennstatus.donate.forms import DateForm
 
from ennstatus.donate.functions import load_csv, get_choices
 

	
 
from ennstatus.root.forms import BPMForm
 
from ennstatus.root.constants import BPM_ADDRESSES
 

	
 
donate_page = Blueprint('donate', __name__)
 

	
 

	
 
@donate_page.route('/', methods=('GET', 'POST'))
 
@donate_page.route('/')
 
def index():
 

	
 
    current_app.logger.info('Handling index')
 
    form = BPMForm()
 
    country_choices = [choice[0] for choice in form.country.choices]
 

	
 
    if request.method == 'POST':
 
        current_app.logger.debug('Validating form')
 
        if form.validate_on_submit():
 
            country = form.country.data
 
            return redirect(url_for('donate.index', country=country))
 
    else:
 
        if 'country' in request.args:
 
            country = request.args['country']
 
            if country in country_choices:
 
                current_app.logger.info('Showing country %s' % country)
 
            else:
 
                current_app.logger.warn('Country %s not found' % country)
 
                country = 'luxembourg'
 
        else:
 
            current_app.logger.info('Using default country')
 
            country = 'luxembourg'
 

	
 
    form.country.data = country
 
    address = BPM_ADDRESSES[country]
 

	
 
    return render_template('donate/index.html', form=form, address=address)
 
    return render_template('donate/index.html')
 

	
 

	
 
@donate_page.route('/received',
 
                   methods=('GET', 'POST'))
 
def received():
 

	
 
    current_app.logger.info('Handling received')
 
    form = DateForm()
 

	
 
    current_app.logger.debug('Creating choices')
 

	
 
    files = [name for name in get_choices()]
 
    files.sort()
 

	
 
    year_choices = list({name.split('-')[0] for name in files})
 
    year_choices.sort()
 
    form.year.choices = [(name, name) for name in year_choices]
 

	
 
    if not year_choices:
 
        current_app.logger.warn('No donations found!')
 
        return render_template('donate/received.html',
 
                               form=form, csv_file=None,
 
                               year=None, month=None, total=None)
 

	
ennstatus/root/constants.py
Show inline comments
 
deleted file
ennstatus/root/forms.py
Show inline comments
 
# Ënnstatus
 
# Copyright (C) 2015  Dennis Fink
 
#
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
from flask_wtf import Form
 
from wtforms import (SelectField,
 
                     StringField,
 
from wtforms import (StringField,
 
                     RadioField,
 
                     BooleanField,
 
                     SubmitField
 
                     )
 
from wtforms.validators import InputRequired, Email, Length, DataRequired
 

	
 

	
 
COUNTRIES = [
 
    ('luxembourg', 'Luxembourg'),
 
    ('belgium', 'Belgium'),
 
    ('france', 'France'),
 
    ('germany', 'Germany'),
 
]
 

	
 

	
 
class BPMForm(Form):
 
    country = SelectField('Country',
 
                          validators=[DataRequired()],
 
                          choices=COUNTRIES)
 
    submit = SubmitField('Submit')
 
from wtforms.validators import InputRequired, Email, Length
 

	
 

	
 
class MembershipForm(Form):
 

	
 
    username = StringField('Username*',
 
                           validators=[
 
                               InputRequired('This field is required!'),
 
                               Length(max=255)
 
                           ]
 
                           )
 
    email = StringField('E-Mail*',
 
                        validators=[
 
                            InputRequired('This field is required!'),
 
                            Email()
 
                        ]
 
                        )
 
    fullname = StringField('Full name',
 
                           validators=[Length(max=65536)],
 
                           )
 
    street = StringField('Nr., Street',
 
                         validators=[Length(max=4000)],
 
                         )
 
    zip = StringField('ZIP-Code',
 
                      validators=[Length(max=30)],
ennstatus/root/views.py
Show inline comments
 
# Ënnstatus
 
# Copyright (C) 2015  Dennis Fink
 
#
 
# This program is free software: you can redistribute it and/or modify
 
# it under the terms of the GNU General Public License as published by
 
# the Free Software Foundation, either version 3 of the License, or
 
# (at your option) any later version.
 
#
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
#
 
# You should have received a copy of the GNU General Public License
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 

	
 
from flask import (Blueprint, render_template, current_app,
 
                   request, redirect, url_for, flash)
 

	
 
from ennstatus.root.forms import BPMForm, MembershipForm, BridgeprogramForm
 
from ennstatus.root.constants import BPM_ADDRESSES
 
from ennstatus.root.forms import MembershipForm, BridgeprogramForm
 
from ennstatus.root.functions import (send_membership_mail,
 
                                      send_bridgeprogram_mail)
 

	
 
root_page = Blueprint('root', __name__)
 

	
 

	
 
@root_page.route('/')
 
def index():
 
    return render_template('root/index.html')
 

	
 

	
 
@root_page.route('/about')
 
def about():
 
    return render_template('root/about.html')
 

	
 

	
 
@root_page.route('/partners')
 
def partners():
 
    return render_template('root/partners.html')
 

	
 

	
 
@root_page.route('/bridgeprogram', methods=('GET', 'POST'))
 
def bridgeprogram():
 

	
 
@@ -59,63 +58,37 @@ def bridgeprogram():
 
def member():
 
    return render_template('root/member.html')
 

	
 

	
 
@root_page.route('/membership', methods=('GET', 'POST'))
 
def membership():
 

	
 
    current_app.logger.info('Handling membership')
 
    form = MembershipForm()
 

	
 
    if request.method == 'POST':
 
        current_app.logger.debug('Validating form')
 
        if form.validate_on_submit():
 
            send_membership_mail(form)
 
            return redirect(url_for('root.member'))
 

	
 
    return render_template('root/membership.html', form=form)
 

	
 

	
 
@root_page.route('/mirrors')
 
def mirrors():
 
    return render_template('root/mirrors.html')
 

	
 

	
 
@root_page.route('/contact', methods=('GET', 'POST'))
 
@root_page.route('/contact')
 
def contact():
 

	
 
    current_app.logger.info('Handling contact')
 
    form = BPMForm()
 
    country_choices = [choice[0] for choice in form.country.choices]
 

	
 
    if request.method == 'POST':
 
        current_app.logger.debug('Validating form')
 
        if form.validate_on_submit():
 
            country = form.country.data
 
            return redirect(url_for('root.contact', country=country))
 
    else:
 
        if 'country' in request.args:
 
            country = request.args['country']
 
            if country in country_choices:
 
                current_app.logger.info('Showing country %s' % country)
 
            else:
 
                current_app.logger.warn('Country %s not found' % country)
 
                country = 'luxembourg'
 
        else:
 
            current_app.logger.info('Using default country')
 
            country = 'luxembourg'
 

	
 
    form.country.data = country
 

	
 
    address = BPM_ADDRESSES[country]
 

	
 
    return render_template('root/contact.html', form=form, address=address)
 
    return render_template('root/contact.html')
 

	
 

	
 
@root_page.route('/abuse')
 
def abuse():
 
    return render_template('root/abuse.html')
 

	
 

	
 
@root_page.route('/ennstatus')
 
def ennstatus():
 
    return render_template('root/ennstatus.html')
ennstatus/templates/donate/index.html
Show inline comments
 
@@ -62,63 +62,53 @@
 
        </center>
 
        <div class="well well-sm">
 
          <p>
 
            <strong>Account holder:</strong> Frënn vun der Ënn A.S.B.L.<br>
 
            <strong>BIC/SWIFT:</strong> BCEELULL<br>
 
            <strong>IBAN:</strong> LU65 0019 4055 6782 7000<br>
 
          </p>
 
       </div>
 
       <div class="well well-sm">
 
       <p>
 
         <strong>Account holder:</strong> Chaos Computer Club Lëtzebuerg A.S.B.L.<br>
 
         <strong>BIC/SWIFT:</strong> BCEELULL<br>
 
         <strong>IBAN:</strong> LU29 0019 2855 3890 4000<br>
 
         <strong>Subject:</strong> * to FVDE<br>
 
       </p>
 
       </div>
 
      </div>
 
    </div>
 
    <div class="col-md-4 clearfix">
 
      <div class="thumbnail">
 
        <center>
 
          <h3>SnailMail</h3>
 
        </center>
 
        <div class="well well-sm">
 
          <div class="pull-right">
 
            <form class="form-inline" role="form" method="POST" action"{{ url_for('donate.index') }}">
 
              {{ form.hidden_tag() }}
 
              <div class="form-group">
 
                {{ form.country(class_='form-control input-sm', onchange='this.form.submit()') }}
 
                <noscript>{{ form.submit(class_='btn btn-enn btn-sm') }}</noscript>
 
              </div>
 
            </form>
 
          </div>
 
          <address>
 
           <address>
 
            <strong>Frënn vun der Ënn, ASBL</strong><br>
 
                    BPM 381892<br>
 
                    {{ address['address'] }}<br>
 
                    {{ address['postal_code'] }}, {{ address['city'] }}<br>
 
                    {{ address['country'] }}
 
                    {{ config['ENNSTATUS_ADDRESS'] }}<br>
 
                    {{ config['ENNSTATUS_POSTAL_CODE'] }}, {{ config['ENNSTATUS_CITY'] }}<br>
 
                    {{ config['ENNSTATUS_COUNTRY'] }}
 
          </address>
 
        </div>
 
      </div>
 
    </div>
 
    <div class="col-md-4">
 
      <div class="thumbnail">
 
        <center>
 
          <h3>Bitcoin</h3>
 
        </center>
 
        <div class="well well-sm">
 
          <p>
 
            <strong>Bitcoin Address:</strong> 1EYZCq2ZL6chWXYYkJoDo7fz39UC7do5cC
 
          </p>
 
          <form class="bitpay-donate form-horizontal" action="https://bitpay.com/checkout" method="POST" onsubmit="return checkRequiredFields(this);">
 
            <input name="action" type="hidden" value="checkout">
 
            <div class="form-group">
 
              <label class="col-sm-2 control-label">Email:</label>
 
              <div class="col-sm-10">
 
                <input class="bitpay-donate-field-email form-control" name="orderID" type="email" placeholder="Email address (optional)" maxlenght=50 autocapitalize=off autocorrect=off />
 
              </div>
 
            </div>
 
            <div class="form-group">
 
              <label class="col-sm-2 control-label">Amount:</label>
 
              <div class="col-sm-10">
 
@@ -181,39 +171,27 @@
 
            <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
 
      		    <input type="hidden" name="cmd" value="_s-xclick">
 
    	  	    <input type="hidden" name="hosted_button_id" value="JKNKAGHS65QN4">
 
    		      <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
 
    		      <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
 
            </form>
 
          </div>
 
        </center>
 
      </div>
 
    </div>
 
    <div class="col-md-4">
 
      <div class="thumbnail">
 
        <center>
 
          <h3>Flattr</h3>
 
          <div class="well well-sm">
 
            <p>Flattr us!</p>
 
            <a href="https://flattr.com/submit/auto?user_id=FVDE&url=https%3A%2F%2Fenn.lu/donate/flattr" target="_blank">
 
              <img src="https://button.flattr.com/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0"></img>
 
            </a>
 
          </div>
 
        </center>
 
      </div>
 
    </div>
 
    <div class="col-md-4">
 
      <div class="thumbnail">
 
        <center>
 
          <h3>BPM Points</h3>
 
          <div class="well well-sm">
 
            <p>For our parcel station and international mail boxes.</p>
 
            <p>
 
              Send your BPM voucher code to: <br>
 
              <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:info@enn.lu">info@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?search=info@enn.lu&op=vindex" target="_blank">0x02225522</a>
 
            </p>
 
          </div>
 
        </center>
 
      </div>
 
    </div>
 
  </div>
 
{% endblock %}
ennstatus/templates/root/contact.html
Show inline comments
 
@@ -5,66 +5,54 @@
 
   it under the terms of the GNU General Public License as published by
 
   the Free Software Foundation, either version 3 of the License, or
 
   (at your option) any later version.
 

	
 
   This program is distributed in the hope that it will be useful,
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
   GNU General Public License for more details.
 

	
 
   You should have received a copy of the GNU General Public License
 
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
#}
 

	
 
{% extends "base.html" %}
 

	
 
{% set title = "Contact" %}
 

	
 
{% block content %}
 
  <div class="col-md-4">
 
    <img src="{{ url_for('static', filename='images/Contact.png') }}" class="img-responsive img-rounded center-block" alt="WhoIs" width="160"></img>
 
    <div class="text-center">
 
      <h2>Contact</h2>
 
    </div>
 
  </div>
 
  <div class="col-md-8 clearfix">
 
    <h2 class="pull-left">General</h2>
 
    <div class="pull-right">
 
      <form class="form-inline" role="form" method="POST" action="{{ url_for('root.contact') }}">
 
        {{ form.hidden_tag()}}
 
        <div class="form-group">
 
          {{ form.country(class_='form-control input-sm', onchange='this.form.submit()') }}
 
          <noscript>{{ form.submit(class_='btn btn-enn btn-sm') }}</noscript>
 
        </div>
 
      </form>
 
    </div>
 
  </div>
 
  <div class="col-md-8">
 
    <h2>General</h2>
 
    <p>Please mail all general inquiries to:</p>
 
    <address>
 
      <strong>Frënn vun der Ënn, ASBL</strong><br>
 
        BPM 381892<br>
 
        {{ address['address'] }}<br>
 
        {{ address['postal_code'] }}, {{ address['city'] }}<br>
 
        {{ address['country'] }}<br>
 
        {{ config['ENNSTATUS_ADDRESS'] }}<br>
 
        {{ config['ENNSTATUS_POSTAL_CODE'] }}, {{ config['ENNSTATUS_CITY'] }}<br>
 
        {{ config['ENNSTATUS_COUNTRY'] }}<br>
 
        <br>
 
      <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:info@enn.lu">info@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?search=info@enn.lu&op=vindex" target="_blank">0x02225522</a><br>
 
      <abbr title="Website"><span class="glyphicon glyphicon-cloud"></span></abbr> : <a href="//enn.lu/">enn.lu/</a> <strong>or</strong> <a href="//{{ config['ENNSTATUS_ONION_ADDRESS'] }}/" target="_blank">{{ config['ENNSTATUS_ONION_ADDRESS'] }}</a><br>
 
      <abbr title="Phone"><span class="glyphicon glyphicon-earphone"></span></abbr> : {{ config['ENNSTATUS_PHONE_NUMBER'] }}<br>
 
    </address>
 

	
 
    <h2>Abuse</h2>
 
    <p>For further details about abuse handling, have a look over <a href="{{ url_for('root.abuse') }}">here</a>.</p>
 
    <address>
 
      <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:abuse@enn.lu">abuse@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?search=info@enn.lu&op=vindex" target="_blank">0x02225522</a><br>
 
      <abbr title="Phone"><span class="glyphicon glyphicon-earphone"></span></abbr> : </strong>{{ config['ENNSTATUS_PHONE_NUMBER'] }}<br>
 
    </address>
 

	
 
    <h2>Press</h2>
 
    <p>Press related inqueries should go to:</p>
 
    <address>
 
      <abbr title="E-Mail"><span class="glyphicon glyphicon-envelope"></span></abbr> : <a href="mailto:press@enn.lu">press@enn.lu</a> <span class="glyphicon glyphicon-lock"></span> GPG: <a href="http://keyserver.cypherpunk.lu:11371/pks/lookup?search=info@enn.lu&op=vindex" target="_blank">0x02225522</a><br>
 
      <abbr title="Phone"><span class="glyphicon glyphicon-earphone"></span></abbr> : </strong>{{ config['ENNSTATUS_PHONE_NUMBER'] }}<br>
 
    </address>
 

	
 
  </div>
 
{% endblock %}
0 comments (0 inline, 0 general)