]> git.parisson.com Git - teleforma.git/commitdiff
fix script messages
authorGuillaume Pellerin <yomguy@parisson.com>
Tue, 15 Jul 2014 20:44:56 +0000 (22:44 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Tue, 15 Jul 2014 20:44:56 +0000 (22:44 +0200)
teleforma/exam/models.py
teleforma/exam/templates/exam/messages/script_marked.txt
teleforma/exam/templates/exam/messages/script_rejected.txt
teleforma/exam/templates/exam/scripts.html
teleforma/exam/views.py
teleforma/static/teleforma/css/teleforma.css

index cf3e96838fc4a55af0d1106e03410e450ea8b162..7303ddd4e9a15582a724fde081d733e653eefff6 100644 (file)
@@ -41,7 +41,7 @@ from django.contrib.auth.models import User
 from django.db.models import Q, Max, Min
 from django.db.models.signals import post_save
 from django.conf import settings
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import ugettext, ugettext_lazy as _
 
 from teleforma.models import *
 from django.template.loader import render_to_string
@@ -282,7 +282,8 @@ class Script(BaseResource):
 
     def submit(self):
         self.date_submitted = datetime.datetime.now()
-        self.url = settings.MEDIA_URL + unicode(self.file)
+        self.url = 'http://teleforma.parisson.com/media/scripts/2014/06/24/Gstreamer_monitoring_Pipleline.pdf'
+        # self.url = settings.MEDIA_URL + unicode(self.file)
         self.box_uuid = crocodoc.document.upload(url=self.url)
         while True:
             statuses = crocodoc.document.status([self.box_uuid,])
@@ -301,33 +302,37 @@ class Script(BaseResource):
 
         if not self.corrector:
             self.auto_set_corrector()
+
         self.status = 3
         self.save()
 
     def mark(self):
         self.date_marked = datetime.datetime.now()
-        context = {}
+        context = {'script': self}
         text = render_to_string('exam/messages/script_marked.txt', context)
-        a = _('script')
-        v = _('marked')
-        subject = '%s : %s - %s %s' % (unicode(self), a, self.session, v)
+        a = ugettext('script')
+        v = ugettext('marked')
+        subject = '%s %s' % (a, v)
         mess = Message(sender=self.corrector, recipient=self.author, subject=subject[:119], body=text)
         mess.moderation_status = 'a'
         mess.save()
-        #notify_user(mess, 'acceptance')
+        site = Site.objects.all()[0]
+        notify_user(mess, 'acceptance', site)
 
     def reject(self):
         self.date_marked = datetime.datetime.now()
         self.date_rejected = datetime.datetime.now()
-        context = {}
+        context = {'script': self}
         text = render_to_string('exam/messages/script_rejected.txt', context)
-        a = _('script')
-        v = _('rejected')
-        subject = '%s : %s - %s %s' % (unicode(self), a, self.session, v)
+        a = ugettext('script')
+        v = ugettext('rejected')
+        subject = '%s %s' % (a, v)
         mess = Message(sender=self.corrector, recipient=self.author, subject=subject[:119], body=text)
         mess.moderation_status = 'a'
         mess.save()
-        #notify_user(mess, 'acceptance')
+        site = Site.objects.all()[0]
+        notify_user(mess, 'acceptance', site)
+
 
 def set_file_properties(sender, instance, **kwargs):
     if instance.file:
index 837fad49faf10514cc645582ff43df79447a683c..422fe15f3dcb652241c5fa8fb01a4c56b4c93acf 100644 (file)
@@ -1 +1,14 @@
-marked
\ No newline at end of file
+{% load i18n %}{% load telemeta_utils %}{% load teleforma_tags %}{% autoescape off %}Bonjour,
+
+Votre copie soumise le {{ script.date_created }} en {{ script.course }} pour la séance {{ script.session }} a été corrigée.
+
+La note, les commentaires et les annotations sont disponibles à cette adresse :
+
+{{ site.domain }}{% url teleforma-exam-script-detail script.period.id script.id %}
+
+{% 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 25ce34cf3c15c45ccaebd9068b59814e0d8a4838..d34e8d53516987544cc3997b677df5182eee6163 100644 (file)
@@ -1 +1,12 @@
-rejected
\ No newline at end of file
+{% load i18n %}{% load telemeta_utils %}{% load teleforma_tags %}{% autoescape off %}Bonjour,
+
+Votre copie soumise le {{ script.date_created }} en {{ script.course }} pour la séance {{ script.session }} a été rejetée pour le motif suivant : {{ script.reject_reason }}.
+
+Veuiller corriger cette erreur puis resoumettre votre copie.
+
+{% 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 f62357ad06a7dc5cca77ae814ff45356282b5853..9d4d3fa1411b7ddc1af470b3dc4a96191c9d077a 100644 (file)
 </div>
 {% endif %}
 
+     {% if messages %}
+         <div class="messages">
+            {% for message in messages %}
+            <div{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</div>
+            {% endfor %}
+         </div>
+    {% endif %}
+
 {% block answers %}
 <div class="course_title">{{ title }}</div>
 <br />
+
+
  {% if object_list %}
   {% include "exam/inc/script_list.html" %}
  {% else %}
index 486743eceb9a8a6d8332ed151fe8ffa35ca6d97a..7dd8bfb5528fd53bc0d7b0ec61d626c0f184a734 100644 (file)
@@ -6,6 +6,7 @@ from teleforma.views.core import *
 
 from django.views.generic.edit import CreateView, UpdateView, DeleteView
 from django.core.urlresolvers import reverse_lazy, reverse
+from django.utils.translation import ugettext_lazy as _
 
 
 class ScriptView(CourseAccessMixin, UpdateView):
@@ -123,9 +124,11 @@ class ScriptCreateView(CreateView):
 
     def form_valid(self, form):
         form.instance.author = self.request.user
+        messages.info(self.request, _("You have successfully submitted your script. It will be processed in the next hours."))
         return super(ScriptCreateView, self).form_valid(form)
 
     def form_invalid(self, form):
+        messages.info(self.request, _("There was a problem with your submission. Please try again, later if possible."))
         return super(ScriptCreateView, self).form_invalid(form)
 
     def get_context_data(self, **kwargs):
index 5608a382d62f87cb3678a57ed06665a56e441bbd..8ad5695cebd16d41e1a93b61f0bbb4b041b2fc93 100644 (file)
@@ -1665,3 +1665,51 @@ input,textarea{
 .conference_form textarea {
     font-size: 1.2em;
     }
+
+
+.info {
+    margin-top: 0.3em;
+    color: white;
+    padding: 0.3em 0.3em 0.5em 0.8em;
+    background-color: #008000;
+    -moz-border-radius: 8px 0px 8px 8px;
+    -webkit-border-radius: 8px 0px 8px 8px;
+    border-radius: 8px 0px 8px 8px;
+}
+
+.success {
+    margin-top: 1em;
+    color: white;
+    padding: 0.3em 0.3em 0.5em 0.8em;
+    background-color: #008000;
+    -moz-border-radius: 8px 0px 8px 8px;
+    -webkit-border-radius: 8px 0px 8px 8px;
+    border-radius: 8px 0px 8px 8px;
+}
+
+.warning {
+    margin-top: 0.3em;
+    color: white;
+    padding: 0.3em 0.3em 0.5em 0.8em;
+    background-color: #e65911;
+    -moz-border-radius: 8px 0px 8px 8px;
+    -webkit-border-radius: 8px 0px 8px 8px;
+    border-radius: 8px 0px 8px 8px;
+}
+
+.error {
+    color: white;
+    padding: 0.3em;
+    background-color: #db4b39;
+    -moz-border-radius: 8px 0px 8px 8px;
+    -webkit-border-radius: 8px 0px 8px 8px;
+    border-radius: 8px 0px 8px 8px;
+}
+
+.errorlist {
+    color: red;
+}
+
+.errorlist li {
+    font-size: 1.2em;
+}