]> git.parisson.com Git - teleforma.git/commitdiff
fix doc double display, trans, init account script
authoryomguy <yomguy@parisson.com>
Mon, 9 Jul 2012 10:03:10 +0000 (12:03 +0200)
committeryomguy <yomguy@parisson.com>
Mon, 9 Jul 2012 10:03:10 +0000 (12:03 +0200)
example/settings.py
teleforma/locale/fr/LC_MESSAGES/django.mo
teleforma/locale/fr/LC_MESSAGES/django.po
teleforma/management/commands/teleforma-reset-all-passwords-with-mail.py
teleforma/templates/postman/email_user_init.txt
teleforma/templates/postman/email_user_subject_init.txt
teleforma/templates/teleforma/courses.html
teleforma/templates/teleforma/inc/document_list.html
teleforma/templates/telemeta/profile_detail.html

index a58db1faf990e126fa980289284a79808e22c629..c2a1d270f820a172b90949c9516c4aea8a1e43bf 100644 (file)
@@ -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
index 821c24d4bff62767e0a9fc4dd9fec29b1634a2f2..84e72829e7dbd5e146bbe5e55c1e801794e9b55c 100644 (file)
Binary files a/teleforma/locale/fr/LC_MESSAGES/django.mo and b/teleforma/locale/fr/LC_MESSAGES/django.mo differ
index ff6e769716bcf398b9875239b201c2f631072ca9..8cac44970e9c343cf3034cf41cb161f2e9a4c788 100644 (file)
@@ -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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\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
index 431d8273aed0d78ca462ee95d0366b8d49cb6dce..17f5cbbb047d2fa6767343ba2e938e8749d713b6 100644 (file)
@@ -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
 
index 6889e7a8e96b16488767ee91c0e1e0643f176f89..e73d5cd304771726f52d7c72df1ab106910f158f 100644 (file)
@@ -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 %}
index 928d5edebf7b4bea0335ee9ecf0915c98ca8a395..967e8aa70aba4c7da1546cde9b8c3308f90ed825 100644 (file)
@@ -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
index b0bc35f617a16e7eca5c75ca4e335de4caab3e5e..79864415c0c0a5f6dba0d0d28bd07fb6ab4c22ca 100644 (file)
@@ -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 %}
 
       </div>
index 52b920114b7b9436025fee3d12e5443941351e2b..65affcc4d7b8b032db24e776f20053e33d650617 100644 (file)
@@ -7,22 +7,28 @@
 <h3><img src="{{ STATIC_URL }}/telemeta/images/item_title.png" width="10px" alt="" /> {% trans "Documents"%}</h3>
 </div>
 
+{% 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 %}
 <span class="doc_type_title">{{ doc_type }}</span>
 <table class="listing" width="100%">
     <tbody>
-        {% 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 %}
         <tr>
-        <td {% if forloop.counter0 == 0 %}class="border-top"{% endif %} width="60%">{% if document.file %}<a href="{% url teleforma-document-view document.id %}" target="_blank" title="{% trans "View" %}"><img src="{{ STATIC_URL }}/teleforma/images/application-msword.png" style="vertical-align:middle" alt="" />{% endif %} {{ document.title }}{% if document.file %}</a>{% endif %}</td>
-        <td {% if forloop.counter0 == 0 %}class="border-top"{% endif %} width="35%">{{ document.date_modified }}</td>
-        <td {% if forloop.counter0 == 0 %}class="border-top"{% endif %} width="5%" align="center">{% if document.file %}<a href="{% url teleforma-document-download document.id %}"><img src="{{ STATIC_URL }}teleforma/images/download.png" style="vertical-align:middle" alt="" title="{% trans "Download" %}" /></a>{% endif %}</td>
+        <td {% if forloop.first %}class="border-top"{% endif %} width="60%">{% if doc.file %}<a href="{% url teleforma-document-view document.id %}" target="_blank" title="{% trans "View" %}"><img src="{{ STATIC_URL }}/teleforma/images/application-msword.png" style="vertical-align:middle" alt="" />{% endif %} {{ doc.title }}{% if doc.file %}</a>{% endif %}</td>
+        <td {% if forloop.first %}class="border-top"{% endif %} width="35%">{{ doc.date_modified }}</td>
+        <td {% if forloop.first %}class="border-top"{% endif %} width="5%" align="center">{% if doc.file %}<a href="{% url teleforma-document-download document.id %}"><img src="{{ STATIC_URL }}teleforma/images/download.png" style="vertical-align:middle" alt="" title="{% trans "Download" %}" /></a>{% endif %}</td>
         </tr>
+        {% endif %}
     {% endfor %}
     </tbody>
 </table>
 {% endif %}
 {% endfor %}
+{% endwith %}
+
 </div>
 
 {% else %}
index fb0d448491bf48332eb3ebc57896d0101466acb6..905d6986ef99cf9f1fffd7da89206a141630da27 100644 (file)
 <div class="buttons">
 {% if user.username != usr.username and user.is_staff %}
 <a href="{% url teleforma-user-login usr.id %}" class="component_icon button icon_login">{% trans "Login as" %}</a>
-<a href="{% url telemeta-password-change %}" class="component_icon button icon_login">{% trans "Password reinitialization" %}</a>
+<a href="{% url telemeta-password-change usr.id %}" class="component_icon button icon_login">{% trans "Password reset" %}</a>
 {% endif %}
 </div>