summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerghei MIHAI <smihai@entrouvert.com>2014-10-24 16:29:35 (GMT)
committerSerghei MIHAI <smihai@entrouvert.com>2014-10-24 16:29:35 (GMT)
commit43985d1f9295b854b50ca954b9241a0b8a009783 (patch)
tree4af81f89c860eae4608e34b64b69e17900559c8f
parentec271c563772d9c6a8e5d22d503ac57c94daaa46 (diff)
downloadcompte-agglo-montpellier-43985d1f9295b854b50ca954b9241a0b8a009783.zip
compte-agglo-montpellier-43985d1f9295b854b50ca954b9241a0b8a009783.tar.gz
compte-agglo-montpellier-43985d1f9295b854b50ca954b9241a0b8a009783.tar.bz2
tipi plugin replaced by a blurp
Closes #5613
-rw-r--r--compte_agglo_montpellier/migrations/0003_remove_text_plugin_wrapper.py20
-rw-r--r--compte_agglo_montpellier/settings.py20
-rw-r--r--compte_agglo_montpellier/templates/blurps/tipi.html225
-rw-r--r--compte_agglo_montpellier/urls.py6
-rw-r--r--requirements.txt2
-rwxr-xr-xsetup.py1
6 files changed, 270 insertions, 4 deletions
diff --git a/compte_agglo_montpellier/migrations/0003_remove_text_plugin_wrapper.py b/compte_agglo_montpellier/migrations/0003_remove_text_plugin_wrapper.py
new file mode 100644
index 0000000..dbdedb1
--- /dev/null
+++ b/compte_agglo_montpellier/migrations/0003_remove_text_plugin_wrapper.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from south.utils import datetime_utils as datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ db.delete_column('djangocms_text_ckeditor_text', 'wrapper')
+
+ def backwards(self, orm):
+ pass
+
+ models = {
+
+ }
+
+ complete_apps = ['compte_agglo_montpellier']
diff --git a/compte_agglo_montpellier/settings.py b/compte_agglo_montpellier/settings.py
index 872aa87..192cbd9 100644
--- a/compte_agglo_montpellier/settings.py
+++ b/compte_agglo_montpellier/settings.py
@@ -188,7 +188,6 @@ INSTALLED_APPS = (
'portail_citoyen.apps.auquotidien_plugin',
'portail_citoyen.apps.passerelle_register_plugin',
'compte_agglo_montpellier',
- 'tipi_payment_plugin',
)
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
@@ -562,3 +561,22 @@ if USE_DEBUG_TOOLBAR:
INSTALLED_APPS += ('debug_toolbar',)
except ImportError:
print "Debug toolbar missing, not loaded"
+
+try:
+ import cmsplugin_blurp
+ INSTALLED_APPS += (
+ 'cmsplugin_blurp',
+ )
+except ImportError:
+ pass
+
+CMS_PLUGIN_BLURP_RENDERERS = {
+ 'tipi': {
+ 'name': 'Formulaire de paiement TIPI',
+ 'class': 'cmsplugin_blurp.renderers.template.TemplateRenderer',
+ 'refresh': 3600,
+ 'template': 'tipi',
+ 'template_name': 'blurps/tipi.html',
+ 'ajax': False,
+ },
+}
diff --git a/compte_agglo_montpellier/templates/blurps/tipi.html b/compte_agglo_montpellier/templates/blurps/tipi.html
new file mode 100644
index 0000000..5cb8c7e
--- /dev/null
+++ b/compte_agglo_montpellier/templates/blurps/tipi.html
@@ -0,0 +1,225 @@
+{% load sekizai_tags %}
+{% load i18n %}
+
+{% addtoblock "js" %}
+<script type="text/javascript">
+ var popup;
+var timer;
+var log = true;
+// for logging purposes
+if (window.XMLHttpRequest) {
+ xmlhttp = new XMLHttpRequest();
+} else {
+ xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
+}
+
+function reinit() {
+ document.getElementById('refdet_error').style.display='none';
+ document.getElementById('montant_error').style.display='none';
+ document.getElementById('mel_error').style.display='none';
+}
+
+function checkLen(element,y) {
+ if (y.length==element.maxLength) {
+ var next=element.tabIndex;
+ if (next<document.forms["tipi"].length) {
+ document.forms["tipi"].elements[next].focus();
+ }
+ }
+}
+
+function checkpopup() {
+ if(popup.closed) {
+ document.getElementById('wip').style.display='none';
+ document.forms['tipi'].reset();
+ clearInterval(timer);
+ }
+}
+
+function call_tipi() {
+ var params = {'refdet': function(id) {
+ var idpiece = document.getElementById('idpiece').value.trim();
+ var idligne = document.getElementById('idligne').value.trim();
+ var idpiece_padding = '';
+ var idligne_padding = '';
+ var exer = params.exer('exer');
+ if (!idpiece || isNaN(idpiece)) {
+ document.getElementById('refdet_error').style.display='inline';
+ return false;
+ }
+
+ if (!idligne || isNaN(idligne)) {
+ document.getElementById('refdet_error').style.display='inline';
+ return false;
+ }
+
+ for (var i=0;i<8-idpiece.length;i)
+ idpiece_padding = '0';
+ idpiece = idpiece_padding idpiece;
+
+ for (var i=0;i<6-idligne.length;i)
+ idligne_padding = '0';
+ idligne = idligne_padding idligne;
+
+ {% if instance.saisie == 'T' %}
+ return "999900000000999999";
+ {% else %}
+ return exer idpiece idligne;
+ {% endif %}
+ }, 'montant': function(id) {
+ var euros = document.getElementById(id '_euros').value.trim();
+ var cents = document.getElementById(id '_cents').value.trim();
+ if (euros && cents) {
+ if (isNaN(euros) && isNaN(cents)) {
+ document.getElementById(value '_error').style.display='inline';
+ return false;
+ }
+ return parseInt(euros) * 100 parseInt(cents);
+ }
+ document.getElementById(id '_error').style.display='inline';
+ return false;
+ }
+ return parseInt(euros) * 100 parseInt(cents);
+ }
+ document.getElementById(id '_error').style.display='inline';
+ return false;
+ }, 'mel': function(id) {
+ var mel = document.getElementById(id).value.trim();
+ var re = /^(([^<>()[\]\\.,;:\s@\"](\.[^<>()[\]\\.,;:\s@\"])*)|(\".\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]\.)[a-zA-Z]{2,}))$/;
+ if(re.test(mel))
+ return mel;
+ document.getElementById(id '_error').style.display='inline';
+ return false;
+ }, 'exer': function(id) {
+ var exer = document.getElementById(id).value.trim();
+ if (isNaN(exer)) {
+ document.getElementById('refdet_error').style.display='inline';
+ return false;
+ }
+ {% if instance.saisie == 'T' %}
+ return "9999";
+ {% else %}
+ return exer;
+ {% endif %}
+ }};
+ var tipi_url = '{{ instance.url }}?saisie={{ instance.saisie }}&numcli=' document.getElementById('numcli').value;
+ var log_url = '/?saisie={{ instance.saisie }}&numcli=' document.getElementById('numcli').value;
+ var url_params = '&';
+ reinit();
+
+ for (var field in params) {
+ var valid = params[field](field);
+ if(!valid) {
+ return false;
+ } else {
+ if (document.getElementById(field '_error'))
+ document.getElementById(field '_error').style.display='none';
+ url_params = field '=' valid '&';
+ }
+ }
+
+ var url = tipi_url;
+ url = tipi_url url_params;
+ log_url = log_url url_params;
+ if (log) {
+ xmlhttp.open('GET', log_url, true);
+ xmlhttp.send();
+ }
+ popup = window.open(url, 'tipi', 'height=800, width=900, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
+ document.getElementById('wip').style.display='block';
+ timer = setInterval(checkpopup, 400);
+ return false;
+}
+</script>
+{% endaddtoblock %}
+{% addtoblock "css" %}
+<style>
+#tipi_block {
+ position: relative;
+}
+#tipi_block ul {
+ padding-left: 1em;
+}
+#tipi_block li {
+ list-style-type: none;
+ margin-bottom: .3em;
+ padding: .2em 0;
+}
+#tipi_block li label {
+ float: left;
+ width: 11.5em;
+}
+#tipi_block li label:after {
+ content: ':';
+ margin-left: .5em;
+}
+#tipi_block li input[type=text], #tipi_block li input[type=email] {
+ border: 1px solid #bbb;
+}
+#tipi_block .error {
+ color: #f00;
+ font-size:.8em;
+ display: none;
+}
+#tipi_block #wip {
+ position: absolute;
+ background: #fff;
+ opacity: .8;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ display: none;
+ text-align: center;
+}
+</style>
+{% endaddtoblock %}
+
+
+<div class="block">
+ <h2 style="">Paiement en ligne</h2>
+
+ <p style=""><em>Vous pouvez payer ici les factures &eacute;mises par Montpellier Agglom&eacute;ration (service T&eacute;l&eacute;alarme, d&eacute;chets verts,...)</em></p>
+
+ <p style="">Apr&egrave;s avoir rempli les champs du formulaire ci-dessous et cliqu&eacute; sur le bouton &quot;Payer&quot;, vous serez redirig&eacute; vers le serveur de paiement s&eacute;curis&eacute; de la direction g&eacute;n&eacute;rale des finances publiques sur lequel vous pourrez finaliser votre paiement gr&acirc;ce &agrave; votre carte bancaire. Vous recevrez ensuite un courriel de confirmation de la transaction.</p>
+ <div id="tipi_block">
+ <div id="wip">
+ <h3>{% trans "Paiement en cours..." %}</h3>
+ </div>
+ <form name='tipi'>
+ <ul>
+ <li>
+ <label>{% trans "Identifiant collectivité" %}</label>
+ <select id="numcli">
+ <option value="005955">005955</option>
+ <option value="005956">005956</option>
+ <option value="005957">005957</option>
+ <option value="006483">006483</option>
+ <option value="006484">006484</option>
+ <option value="006485">006485</option>
+ </select>
+ </li>
+ <li>
+ <label>{% trans "Réference titre" %}</label>
+ <input type='text' id='exer' maxlength=4 size=4 tabindex="2" onkeyup="checkLen(this, this.value)" /> -
+ <input type='text' id='idpiece' maxlength=8 size=7 tabindex="3" onkeyup="checkLen(this, this.value)" /> -
+ <input type='text' id='idligne' maxlength=5 size=4 tabindex="4" onkeyup="checkLen(this, this.value)" />
+ <span class="error" id="refdet_error">{% trans "numéro invalide" %}</span>
+ </li>
+ <li>
+ <label>{% trans "Montant" %}</label>
+ <input type='text' id='montant_euros' size="4" maxlength="4" placeholder="0000" tabindex="5" onkeyup="checkLen(this, this.value)" /> ,
+ <input type='text' id='montant_cents' size="2" maxlength="2" placeholder="00" tabindex="6" onkeyup="checkLen(this, this.value)" value="00" /> €
+ <span class="error" id="montant_error">{% trans "montant invalide" %}</span>
+ </li>
+ <li>
+ <label>{% trans "Votre courriel" %}</label>
+ <input type='email' id='mel' {% if request.user.email %}value="{{ request.user.email }}" {% else %}placeholder="{% trans "nom@domaine.com" %}"{% endif %} />
+ <span class="error" id="mel_error">{% trans "courriel invalide" %}</span></li>
+ <li>
+ <input type='button' value='{% trans "Payer" %}' onclick='call_tipi()'/>
+ </li>
+ </ul>
+ </form>
+ </div>
+</div>
diff --git a/compte_agglo_montpellier/urls.py b/compte_agglo_montpellier/urls.py
index 61636e5..3ecc23c 100644
--- a/compte_agglo_montpellier/urls.py
+++ b/compte_agglo_montpellier/urls.py
@@ -1,5 +1,6 @@
from django.conf.urls import include, patterns, url
from django.shortcuts import redirect
+from django.conf import settings
from portail_citoyen.urls import urlpatterns as pc_urls
@@ -17,6 +18,11 @@ urlpatterns = patterns('',
url('^announces/', include('portail_citoyen_announces.urls')),
)
+if 'cmsplugin_blurp' in settings.INSTALLED_APPS:
+ urlpatterns += patterns('',
+ url('^blurps/', include('cmsplugin_blurp.urls')),
+ )
+
urlpatterns += patterns('',
url(r'^captcha/', include('captcha.urls')),
url(r'^cms-ajax-text-plugin/', include('cms_ajax_text_plugin.urls')),
diff --git a/requirements.txt b/requirements.txt
index 02eb55a..dc8f851 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,12 +1,10 @@
--allow-all-external
--allow-unverified django-admin-tools
-f https://repos.entrouvert.org/python-entrouvert.git/
--f http://repos.entrouvert.org/tipi-payment-plugin.git/
python-entrouvert
git+git://repos.entrouvert.org/wcsinst#egg=wcsinst-0.9999999999<1.0
git+git://repos.entrouvert.org/portail-citoyen
git+git://repos.entrouvert.org/portail-citoyen-announces#egg=portail-citoyen-announces-0.1.99999>=0.1,<0.2
-tipi-payment-plugin
cmsplugin-embedded-menu==0.0.7
gunicorn
demjson
diff --git a/setup.py b/setup.py
index a70b0ab..590fcda 100755
--- a/setup.py
+++ b/setup.py
@@ -137,7 +137,6 @@ setup(name="compte-agglo-montpellier",
'django-cms-ajax-text-plugin>=2.1.0'
'djangocms-link',
'djangocms-video',
- 'tipi-payment-plugin',
],
dependency_links = [
'git+git://repos.entrouvert.org/portail-citoyen#egg=portail-citoyen-0.1.99999',