From 9960e7e37eccc216d983d15fbd75097d9dbbe0b2 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Thu, 17 Nov 2016 16:51:36 -0200 Subject: [PATCH 01/11] rebase kfet --- kfet/templates/kfet/transfers_create.html | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/kfet/templates/kfet/transfers_create.html b/kfet/templates/kfet/transfers_create.html index 294db1e5..83a09762 100644 --- a/kfet/templates/kfet/transfers_create.html +++ b/kfet/templates/kfet/transfers_create.html @@ -34,12 +34,12 @@ - + {{ form.from_acc }} {{ form.amount }} - + {{ form.to_acc }} @@ -71,18 +71,21 @@ $(document).ready(function () { var $next = $form.next('.transfer_form').find('.from_acc input'); } var $input_id = $input.next('input'); - getAccountData(trigramme, function(data) { - $input_id.val(data.id); - $data.text(data.name); - $next.focus(); - }); + if (isValidTrigramme(trigramme)) { + getAccountData(trigramme, function(data) { + $input_id.val(data.id); + $data.text(data.name); + $next.focus(); + }); + } else { + $input_id.val(''); + $data.text(''); + } } $('.input_from_acc, .input_to_acc').on('input', function() { var tri = $(this).val().toUpperCase(); - if (isValidTrigramme(tri)) { - updateAccountData(tri, $(this)); - } + updateAccountData(tri, $(this)); }); $('#transfers_form').on('submit', function(e) { From 92b422697b3075d01577c0dc1d973f854d888818 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Thu, 17 Nov 2016 17:44:44 -0200 Subject: [PATCH 02/11] rebase kfet --- kfet/templates/kfet/kpsul.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index 0eceebd2..babd4175 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -924,7 +924,7 @@ $(document).ready(function() { } }); }, - onClose: function() { this._lastFocused = articleSelect; } + onClose: function() { this._lastFocused = (articleSelect.val() ? articleNb : articleSelect) ; } }); } From e31dadad105295bf2dda588084014e9db62aead9 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Thu, 17 Nov 2016 22:35:33 -0200 Subject: [PATCH 03/11] =?UTF-8?q?d=C3=A9tection=20et=20affichage=20capsloc?= =?UTF-8?q?k?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cof/settings_dev.py | 37 +++++++++++++------------- kfet/static/kfet/css/jconfirm-kfet.css | 19 +++++++++++++ kfet/static/kfet/js/kfet.js | 27 ++++++++++++++++++- 3 files changed, 63 insertions(+), 20 deletions(-) diff --git a/cof/settings_dev.py b/cof/settings_dev.py index 17040c38..0ba8d72b 100644 --- a/cof/settings_dev.py +++ b/cof/settings_dev.py @@ -29,9 +29,6 @@ SECRET_KEY = 'q()(zn4m63i%5cp4)f+ww4-28_w+ly3q9=6imw2ciu&_(5_4ah' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = ['127.0.0.1'] - - # Application definition INSTALLED_APPS = ( 'gestioncof', @@ -101,6 +98,7 @@ DATABASES = { 'NAME': os.environ['DBNAME'], 'USER': os.environ['DBUSER'], 'PASSWORD': os.environ['DBPASSWD'], + 'HOST': os.environ.get('DBHOST', 'localhost'), } } @@ -126,7 +124,7 @@ STATIC_URL = '/static/' STATIC_ROOT = '/var/www/static/' STATICFILES_DIRS = ( - os.path.join(BASE_DIR, 'static/'), + os.path.join(BASE_DIR, 'static/'), ) # Media upload (through ImageField, SiteField) @@ -138,31 +136,32 @@ MEDIA_URL = '/media/' # Various additional settings SITE_ID = 1 -# URL prefix for admin static files -- CSS, JavaScript and images. -# Make sure to use a trailing slash. -# Examples: "http://foo.com/static/admin/", "/static/admin/". -ADMIN_MEDIA_PREFIX = '/static/grappelli/' GRAPPELLI_ADMIN_HEADLINE = "GestioCOF" GRAPPELLI_ADMIN_TITLE = "GestioCOF" -PETITS_COURS_FROM = "Le COF " -PETITS_COURS_BCC = "archivescof@gmail.com" -PETITS_COURS_REPLYTO = "cof@ens.fr" +MAIL_DATA = { + 'petits_cours': { + 'FROM': "Le COF ", + 'BCC': "archivescof@gmail.com", + 'REPLYTO': "cof@ens.fr"}, + 'rappels': { + 'FROM': 'Le BdA ', + 'REPLYTO': 'Le BdA '}, + 'revente': { + 'FROM': 'BdA-Revente ', + 'REPLYTO': 'BdA-Revente '}, +} -RAPPEL_FROM = 'Le BdA ' -RAPPEL_REPLY_TO = RAPPEL_FROM - -LOGIN_URL = "/gestion/login" -LOGIN_REDIRECT_URL = "/gestion/" +LOGIN_URL = "cof-login" +LOGIN_REDIRECT_URL = "home" CAS_SERVER_URL = 'https://cas.eleves.ens.fr/' CAS_IGNORE_REFERER = True -CAS_REDIRECT_URL = '/gestion/' +CAS_REDIRECT_URL = '/' CAS_EMAIL_FORMAT = "%s@clipper.ens.fr" AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'gestioncof.shared.COFCASBackend', - 'kfet.backends.GenericTeamBackend', ) # EMAIL_HOST="nef.ens.fr" @@ -177,7 +176,7 @@ CHANNEL_LAYERS = { "default": { "BACKEND": "asgi_redis.RedisChannelLayer", "CONFIG": { - "hosts": [("localhost", 6379)], + "hosts": [(os.environ.get("REDIS_HOST", "localhost"), 6379)], }, "ROUTING": "cof.routing.channel_routing", } diff --git a/kfet/static/kfet/css/jconfirm-kfet.css b/kfet/static/kfet/css/jconfirm-kfet.css index 86c7c42b..4269fbcc 100644 --- a/kfet/static/kfet/css/jconfirm-kfet.css +++ b/kfet/static/kfet/css/jconfirm-kfet.css @@ -64,3 +64,22 @@ color:#FFF !important; background:#C8102E !important; } + +.jconfirm .capslock { + position: relative ; +} + +.jconfirm .capslock .glyphicon { + position: absolute; + padding: 10px; + right: 0px; + top: 15px; + font-size: 30px; + display: none ; + margin-left: 60px !important; +} + +.jconfirm .capslock input { + padding-right: 50px; + padding-left: 50px; +} diff --git a/kfet/static/kfet/js/kfet.js b/kfet/static/kfet/js/kfet.js index dbfba0b2..e3e5a6d9 100644 --- a/kfet/static/kfet/js/kfet.js +++ b/kfet/static/kfet/js/kfet.js @@ -88,7 +88,7 @@ function getErrorsHtml(data) { function requestAuth(data, callback, focus_next = null) { var content = getErrorsHtml(data); - content += '', + content += '
', $.confirm({ title: 'Authentification requise', content: content, @@ -102,14 +102,39 @@ function requestAuth(data, callback, focus_next = null) { }, onOpen: function() { var that = this; + var capslock = -1 ; // 1 -> caps on ; 0 -> caps off ; -1 or 2 -> unknown this.$content.find('input').on('keypress', function(e) { if (e.keyCode == 13) that.$confirmButton.click(); + + var s = String.fromCharCode(e.which); + if ((s.toUpperCase() === s && s.toLowerCase() !== s && !e.shiftKey)|| //caps on, shift off + (s.toUpperCase() !== s && s.toLowerCase() === s && e.shiftKey)) { //caps on, shift on + capslock = 1 ; + } else if ((s.toLowerCase() === s && s.toUpperCase() !== s && !e.shiftKey)|| //caps off, shift off + (s.toLowerCase() !== s && s.toUpperCase() === s && e.shiftKey)) { //caps off, shift on + capslock = 0 ; + } + if (capslock == 1) + $('.capslock .glyphicon').show() ; + else if (capslock == 0) + $('.capslock .glyphicon').hide() ; + }); + // Capslock key is not detected by keypress + this.$content.find('input').on('keydown', function(e) { + if (e.which == 20) { + capslock = 1-capslock ; + } + if (capslock == 1) + $('.capslock .glyphicon').show() ; + else if (capslock == 0) + $('.capslock .glyphicon').hide() ; }); }, onClose: function() { if (focus_next) this._lastFocused = focus_next; } + }); } From f741c70c723e92e59b1be7a018c706df878ffa0c Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Thu, 17 Nov 2016 22:44:43 -0200 Subject: [PATCH 04/11] revert settings_dev changes --- cof/settings_dev.py | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/cof/settings_dev.py b/cof/settings_dev.py index 0ba8d72b..17040c38 100644 --- a/cof/settings_dev.py +++ b/cof/settings_dev.py @@ -29,6 +29,9 @@ SECRET_KEY = 'q()(zn4m63i%5cp4)f+ww4-28_w+ly3q9=6imw2ciu&_(5_4ah' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True +ALLOWED_HOSTS = ['127.0.0.1'] + + # Application definition INSTALLED_APPS = ( 'gestioncof', @@ -98,7 +101,6 @@ DATABASES = { 'NAME': os.environ['DBNAME'], 'USER': os.environ['DBUSER'], 'PASSWORD': os.environ['DBPASSWD'], - 'HOST': os.environ.get('DBHOST', 'localhost'), } } @@ -124,7 +126,7 @@ STATIC_URL = '/static/' STATIC_ROOT = '/var/www/static/' STATICFILES_DIRS = ( - os.path.join(BASE_DIR, 'static/'), + os.path.join(BASE_DIR, 'static/'), ) # Media upload (through ImageField, SiteField) @@ -136,32 +138,31 @@ MEDIA_URL = '/media/' # Various additional settings SITE_ID = 1 +# URL prefix for admin static files -- CSS, JavaScript and images. +# Make sure to use a trailing slash. +# Examples: "http://foo.com/static/admin/", "/static/admin/". +ADMIN_MEDIA_PREFIX = '/static/grappelli/' GRAPPELLI_ADMIN_HEADLINE = "GestioCOF" GRAPPELLI_ADMIN_TITLE = "GestioCOF" -MAIL_DATA = { - 'petits_cours': { - 'FROM': "Le COF ", - 'BCC': "archivescof@gmail.com", - 'REPLYTO': "cof@ens.fr"}, - 'rappels': { - 'FROM': 'Le BdA ', - 'REPLYTO': 'Le BdA '}, - 'revente': { - 'FROM': 'BdA-Revente ', - 'REPLYTO': 'BdA-Revente '}, -} +PETITS_COURS_FROM = "Le COF " +PETITS_COURS_BCC = "archivescof@gmail.com" +PETITS_COURS_REPLYTO = "cof@ens.fr" -LOGIN_URL = "cof-login" -LOGIN_REDIRECT_URL = "home" +RAPPEL_FROM = 'Le BdA ' +RAPPEL_REPLY_TO = RAPPEL_FROM + +LOGIN_URL = "/gestion/login" +LOGIN_REDIRECT_URL = "/gestion/" CAS_SERVER_URL = 'https://cas.eleves.ens.fr/' CAS_IGNORE_REFERER = True -CAS_REDIRECT_URL = '/' +CAS_REDIRECT_URL = '/gestion/' CAS_EMAIL_FORMAT = "%s@clipper.ens.fr" AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', 'gestioncof.shared.COFCASBackend', + 'kfet.backends.GenericTeamBackend', ) # EMAIL_HOST="nef.ens.fr" @@ -176,7 +177,7 @@ CHANNEL_LAYERS = { "default": { "BACKEND": "asgi_redis.RedisChannelLayer", "CONFIG": { - "hosts": [(os.environ.get("REDIS_HOST", "localhost"), 6379)], + "hosts": [("localhost", 6379)], }, "ROUTING": "cof.routing.channel_routing", } From ab0ed097cfda150d7c2598ee05d23dfc8ac3a521 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Wed, 30 Nov 2016 23:12:58 -0200 Subject: [PATCH 05/11] indication raccourcis --- kfet/templates/kfet/kpsul.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index 0eceebd2..0c5e89b3 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -114,10 +114,10 @@
- - - - + + + +
From 45cc7cfa33e3ccf0b1065429718118458f639767 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Thu, 1 Dec 2016 01:39:16 -0200 Subject: [PATCH 06/11] =?UTF-8?q?correction=20n=C3=A9gatif=20total?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kfet/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kfet/views.py b/kfet/views.py index f95fb2c6..daf84207 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -506,7 +506,7 @@ class AccountNegativeList(ListView): offset = Coalesce(Sum('balance_offset'),0), ) ) - context['negatives_sum'] = negs_sum['bal'] + negs_sum['offset'] + context['negatives_sum'] = negs_sum['bal'] - negs_sum['offset'] return context # ----- From a7f3b85b254104d7f3cce36018bdf2ddeb863416 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Thu, 1 Dec 2016 01:44:41 -0200 Subject: [PATCH 07/11] =?UTF-8?q?exclut=20#13=20du=20n=C3=A9gatif=20total?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kfet/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kfet/views.py b/kfet/views.py index daf84207..7083d489 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -490,7 +490,8 @@ class AccountGroupUpdate(UpdateView): class AccountNegativeList(ListView): queryset = (AccountNegative.objects - .select_related('account', 'account__cofprofile__user')) + .select_related('account', 'account__cofprofile__user') + .exclude(account__trigramme='#13')) template_name = 'kfet/account_negative.html' context_object_name = 'negatives' @@ -501,6 +502,7 @@ class AccountNegativeList(ListView): 'overdraft_duration': Settings.OVERDRAFT_DURATION(), } negs_sum = (AccountNegative.objects + .exclude(account__trigramme='#13') .aggregate( bal = Coalesce(Sum('account__balance'),0), offset = Coalesce(Sum('balance_offset'),0), From 65272450f834bbbf1a9fdd5e72210a7aabf5665c Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Fri, 2 Dec 2016 00:24:49 -0200 Subject: [PATCH 08/11] change to Shift after consultation --- kfet/templates/kfet/kpsul.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index 0c5e89b3..c35be283 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -115,7 +115,7 @@
- +
From e725a10026bf73ad04b4b234dd18058580e8595c Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Fri, 9 Dec 2016 00:32:44 -0200 Subject: [PATCH 09/11] invert F2 and Shift+F2 --- kfet/templates/kfet/kpsul.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index babd4175..334c5c90 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -1250,13 +1250,13 @@ $(document).ready(function() { return false; case 113: if (e.shiftKey) { - // Shift+F2 - Basket reset - resetBasket(); - articleSelect.focus(); - } else { - // F2 - Account reset + // Shift+F2 - Account reset resetAccount(); triInput.focus(); + } else { + // F2 - Basket reset + resetBasket(); + articleSelect.focus(); } return false; case 114: From d972af685465e4d8bdbef7a9dd8eb04c8d103c20 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Fri, 9 Dec 2016 00:33:18 -0200 Subject: [PATCH 10/11] update help --- kfet/templates/kfet/kpsul.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index 334c5c90..aefce229 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -48,11 +48,11 @@
F2
-
Reset compte
+
Reset panier
Shift + F2
-
Reset panier
+
Reset compte
F9
From 21cf783144df0a1a6f0c03d891775f9648a6dbbd Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Fri, 9 Dec 2016 01:05:30 -0200 Subject: [PATCH 11/11] add special character encoding --- kfet/templates/kfet/kpsul.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index 9d44a09d..0363483f 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -245,12 +245,14 @@ $(document).ready(function() { if (account_data['id'] != 0) { var url_base = '{% url 'kfet.account.read' 'LIQ' %}'; url_base = url_base.substr(0, url_base.length - 3); - buttons += ''; + trigramme = encodeURIComponent(account_data['trigramme']) ; + buttons += ''; } if (account_data['id'] == 0) { var trigramme = triInput.val().toUpperCase(); var url_base = '{% url 'kfet.account.create' %}' if (isValidTrigramme(trigramme)) { + trigramme = encodeURIComponent(trigramme); buttons += ''; } }