From e31dadad105295bf2dda588084014e9db62aead9 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Thu, 17 Nov 2016 22:35:33 -0200 Subject: [PATCH 1/6] =?UTF-8?q?d=C3=A9tection=20et=20affichage=20capslock?= 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 2/6] 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 3/6] 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 4/6] =?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 5/6] =?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 6/6] 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 @@
- +