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
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,])
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:
-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 %}
-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 %}
</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 %}
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):
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):
.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;
+}