From: yomguy Date: Mon, 9 Jul 2012 10:03:10 +0000 (+0200) Subject: fix doc double display, trans, init account script X-Git-Tag: 0.6^2~2 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=9da8bc855fe5b1aaa69835a56d9d51b67f7e61bd;p=teleforma.git fix doc double display, trans, init account script --- diff --git a/example/settings.py b/example/settings.py index a58db1fa..c2a1d270 100644 --- a/example/settings.py +++ b/example/settings.py @@ -176,7 +176,7 @@ LOGIN_URL = '/login/' LOGIN_REDIRECT_URL = reverse_lazy('teleforma-desk') SESSION_EXPIRE_AT_BROWSER_CLOSE = False -EMAIL_HOST = 'smtp.numericable.fr' +EMAIL_HOST = 'smtp.free.fr' DEFAULT_FROM_EMAIL = 'webmaster@parisson.com' SERVER_EMAIL = 'webmaster@parisson.com' EMAIL_SUBJECT_PREFIX = '[' + TELEMETA_ORGANIZATION.decode('utf8') + '] ' @@ -184,3 +184,5 @@ EMAIL_SUBJECT_PREFIX = '[' + TELEMETA_ORGANIZATION.decode('utf8') + '] ' POSTMAN_AUTO_MODERATE_AS = True #FILE_PROTECTION_METHOD = 'xsendfile' + +GOOGLE_ANALYTICS_MODEL = True diff --git a/teleforma/locale/fr/LC_MESSAGES/django.mo b/teleforma/locale/fr/LC_MESSAGES/django.mo index 821c24d4..84e72829 100644 Binary files a/teleforma/locale/fr/LC_MESSAGES/django.mo and b/teleforma/locale/fr/LC_MESSAGES/django.mo differ diff --git a/teleforma/locale/fr/LC_MESSAGES/django.po b/teleforma/locale/fr/LC_MESSAGES/django.po index ff6e7697..8cac4497 100644 --- a/teleforma/locale/fr/LC_MESSAGES/django.po +++ b/teleforma/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-07-08 15:43+0200\n" +"POT-Creation-Date: 2012-07-09 11:47+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -266,7 +266,7 @@ msgstr "Date d'expiration" #: models.py:526 msgid "Password initialized" -msgstr "" +msgstr "Mot de passe initialisé" #: models.py:530 msgid "profile" @@ -445,7 +445,7 @@ msgid "Thank you again for your interest in our services." msgstr "" #: templates/postman/email_user.txt:20 -#: templates/postman/email_user_init.txt:16 +#: templates/postman/email_user_init.txt:25 #: templates/postman/email_visitor.txt:16 msgid "The site administrator" msgstr "" @@ -455,18 +455,18 @@ msgid "of" msgstr "de" #: templates/postman/email_user.txt:22 -#: templates/postman/email_user_init.txt:18 +#: templates/postman/email_user_init.txt:28 #: templates/postman/email_visitor.txt:18 msgid "" "Note: This message is issued by an automated system.\n" "Do not reply, this would not be taken into account." msgstr "" -#: templates/postman/email_user_init.txt:15 +#: templates/postman/email_user_init.txt:24 msgid "Best regards" -msgstr "" +msgstr "Cordialement" -#: templates/postman/email_user_init.txt:16 +#: templates/postman/email_user_init.txt:25 msgid "of the" msgstr "du" @@ -478,8 +478,8 @@ msgstr "" #: templates/postman/email_user_subject_init.txt:1 #, python-format -msgid "Initialization of your e-learning account at %(organization)s" -msgstr "Initialisation de votre compte e-learning du %(organization)s" +msgid "%(organization)s : initialization of your e-learning account" +msgstr "%(organization)s : initialisation de votre compte e-learning" #: templates/postman/email_visitor.txt:1 msgid "Dear visitor," @@ -640,17 +640,17 @@ msgid "Live conferences" msgstr "Conférences en direct" #: templates/teleforma/inc/conference_list.html:15 -#: templates/teleforma/inc/document_list.html:17 +#: templates/teleforma/inc/document_list.html:20 #: templates/teleforma/inc/media_list.html:14 msgid "View" msgstr "" -#: templates/teleforma/inc/document_list.html:19 +#: templates/teleforma/inc/document_list.html:22 #: templates/teleforma/inc/media_list.html:17 msgid "Download" msgstr "Télécharger" -#: templates/teleforma/inc/document_list.html:30 +#: templates/teleforma/inc/document_list.html:36 msgid "No document" msgstr "Aucun document" @@ -867,8 +867,8 @@ msgid "Login as" msgstr "Se connecter en tant que" #: templates/telemeta/profile_detail.html:107 -msgid "Password reinitialization" -msgstr "" +msgid "Password reset" +msgstr "Réinitialisation du mot de passe" #: templates/telemeta/search_criteria.html:5 #: templates/telemeta/search_criteria.html:76 diff --git a/teleforma/management/commands/teleforma-reset-all-passwords-with-mail.py b/teleforma/management/commands/teleforma-reset-all-passwords-with-mail.py index 431d8273..17f5cbbb 100644 --- a/teleforma/management/commands/teleforma-reset-all-passwords-with-mail.py +++ b/teleforma/management/commands/teleforma-reset-all-passwords-with-mail.py @@ -6,6 +6,8 @@ from django.contrib.auth.forms import PasswordResetForm from django.contrib.auth.tokens import default_token_generator from django.template.defaultfilters import slugify from django.template.loader import render_to_string +from django.core.mail import send_mail, mail_admins +from django.utils import translation from telemeta.models import * from telemeta.util.unaccent import unaccent from teleforma.models import * @@ -15,26 +17,29 @@ from postman import * class Command(BaseCommand): help = "Reset the password for all (active) users " - message_template = 'postman/email_user_init.html' - subject_template = 'postman/email_user_subject_init.html' + message_template = 'postman/email_user_init.txt' + subject_template = 'postman/email_user_subject_init.txt' + language_code = 'fr_FR' - def init_password_email(self, user): + def init_password_email(self, user, profile): site = Site.objects.get_current() ctx_dict = {'site': site, 'organization': settings.TELEMETA_ORGANIZATION, 'usr': user} - subject = render_to_string(subject_template, ctx_dict) + subject = render_to_string(self.subject_template, ctx_dict) subject = ''.join(subject.splitlines()) - message = render_to_string(message_template, ctx_dict) + message = render_to_string(self.message_template, ctx_dict) send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [user.email], fail_silently=False) - profile = user.get_profile() profile.init_password = True profile.save() - mail_admins(subject, message) def handle(self, *args, **options): # users = User.objects.all() + translation.activate(self.language_code) users = User.objects.filter(is_staff=True) for user in users: - profile = user.get_profile() - if not profile.init_password and user.is_active: - self.init_password_email(user) + profile = Profile.objects.get(user=user) + if profile: + profile.init_password = False + if not profile.init_password and user.is_active: + self.init_password_email(user, profile) + print user.username diff --git a/teleforma/templates/postman/email_user_init.txt b/teleforma/templates/postman/email_user_init.txt index 6889e7a8..e73d5cd3 100644 --- a/teleforma/templates/postman/email_user_init.txt +++ b/teleforma/templates/postman/email_user_init.txt @@ -1,10 +1,18 @@ {% load i18n %}{% load telemeta_utils %}{% load teleforma_tags %}{% autoescape off %}{% trans "Hello" %} {{ usr.first_name }} {{ usr.last_name }}, -Suite à votre inscription à la formation estivale 2012 du Pré-Barreau, vous trouverez ci-dessous un lien vous invitant à choisir votre mot de passe à la plateforme e-learning. +Suite à votre inscription à la formation estivale 2012 du Pré-Barreau, nous vous invitons à initialiser votre compte sur notre plateforme e-learning interactive et multi-média. Pour cela, merci de cliquer sur le lien suivant puis d'indiquez votre adresse e-mail : -http://{{ site.name }}/account/reset_password +http://{{ site.name }}/accounts/password_reset/ + +Vous recevrez alors un second e-mail vous invitant à initialiser votre mot de passe personnel. +Une fois la procédure accomplie, vous pourrez vous connecter à l'adresse suivante : + +http://{{ site.name }} + +à l'aide de votre nom d'utilisateur : {{ usr.username }} + +Cette plateforme vous permet d’accéder tout au long de votre formation aux différents documents - fascicules de cours (selon la formule choisie), fascicules d’actualisation, sujets et corrigés - ainsi qu’à l’ensemble de vos enseignements à la demande ou en direct. La messagerie intégrée vous donne aussi la possibilité de communiquer avec les administrateurs et les professeurs. Une page d'aide sera bientôt disponible pour vous assister lors de la découverte de ces nouveaux services. -Cette plateforme vous permettra d’accéder tout au long de votre formation aux différents documents - fascicules de cours (selon la formule choisie), fascicules d’actualisation, sujets et corrigés - ainsi qu’à l’ensemble de vos enseignements. La messagerie intégrée vous permet de communiquer avec les administrateurs, les utilisateurs et le corps enseignant. Une page d'aide est également disponible pour vous assister lors de la découverte de ces nouveaux services. Nous vous rappelons que votre formation commencera le vendredi 20 juillet 2012 par une séance de méthodologie à la note de synthèse (2h) et aux épreuves juridiques (2h). @@ -12,8 +20,10 @@ Ainsi, vous composerez sur la première note de synthèse dès le samedi 21 juil Votre emploi du temps vous sera communiqué vers le 16 juillet. + {% trans "Best regards" %}, {% trans "The site administrator" %} {% trans "of the" %} {% organization %} + {% blocktrans %}Note: This message is issued by an automated system. Do not reply, this would not be taken into account.{% endblocktrans %}{% endautoescape %} diff --git a/teleforma/templates/postman/email_user_subject_init.txt b/teleforma/templates/postman/email_user_subject_init.txt index 928d5ede..967e8aa7 100644 --- a/teleforma/templates/postman/email_user_subject_init.txt +++ b/teleforma/templates/postman/email_user_subject_init.txt @@ -1 +1 @@ -{% load i18n %}{% autoescape off %}{% blocktrans %}Initialization of your e-learning account at {{ organization }}{% endblocktrans %}{% endautoescape %} \ No newline at end of file +{% load i18n %}{% autoescape off %}{% blocktrans %}{{ organization }} : initialization of your e-learning account{% endblocktrans %}{% endautoescape %} \ No newline at end of file diff --git a/teleforma/templates/teleforma/courses.html b/teleforma/templates/teleforma/courses.html index b0bc35f6..79864415 100644 --- a/teleforma/templates/teleforma/courses.html +++ b/teleforma/templates/teleforma/courses.html @@ -71,7 +71,9 @@ $(document).ready(function(){ {% endblock %} {% block document %} - {% include "teleforma/inc/document_list.html" %} + {% with forloop.counter as type_counter %} + {% include "teleforma/inc/document_list.html" %} + {% endwith %} {% endblock %} diff --git a/teleforma/templates/teleforma/inc/document_list.html b/teleforma/templates/teleforma/inc/document_list.html index 52b92011..65affcc4 100644 --- a/teleforma/templates/teleforma/inc/document_list.html +++ b/teleforma/templates/teleforma/inc/document_list.html @@ -7,22 +7,28 @@

{% trans "Documents"%}

+{% with course.document.all as docs %} {% for doc_type in doc_types %} -{% if course.document.all|from_course_type:type|from_doc_type:doc_type %} +{% if docs|from_course_type:type|from_doc_type:doc_type and not type_counter > 1 %} {{ doc_type }} - {% for document in course.document.all|from_course_type:type|from_doc_type:doc_type %} + {% for doc in docs|from_course_type:type|from_doc_type:doc_type %} + {% if doc.course_type.all|length > 1 and type_counter > 1 %} + {% else %} - - - + + + + {% endif %} {% endfor %}
{% if document.file %}{% endif %} {{ document.title }}{% if document.file %}{% endif %}{{ document.date_modified }}{% if document.file %}{% endif %}{% if doc.file %}{% endif %} {{ doc.title }}{% if doc.file %}{% endif %}{{ doc.date_modified }}{% if doc.file %}{% endif %}
{% endif %} {% endfor %} +{% endwith %} + {% else %} diff --git a/teleforma/templates/telemeta/profile_detail.html b/teleforma/templates/telemeta/profile_detail.html index fb0d4484..905d6986 100644 --- a/teleforma/templates/telemeta/profile_detail.html +++ b/teleforma/templates/telemeta/profile_detail.html @@ -104,7 +104,7 @@
{% if user.username != usr.username and user.is_staff %} - + {% endif %}