]> git.parisson.com Git - teleforma.git/commitdiff
add new score form, reduce session number to 7
authorGuillaume Pellerin <yomguy@parisson.com>
Tue, 14 Jul 2015 14:21:20 +0000 (16:21 +0200)
committerGuillaume Pellerin <yomguy@parisson.com>
Tue, 14 Jul 2015 14:21:20 +0000 (16:21 +0200)
teleforma/exam/forms.py
teleforma/exam/templates/exam/score_form.html [new file with mode: 0644]
teleforma/exam/templates/exam/scores.html
teleforma/exam/urls.py
teleforma/exam/views.py
teleforma/locale/fr/LC_MESSAGES/django.mo
teleforma/locale/fr/LC_MESSAGES/django.po
teleforma/models/core.py

index 8096ac9f1b051e9d42d88f8e29592716ec50ed5c..2214e4157299156f3d7788ba3b8a6ea80893b615 100644 (file)
@@ -13,6 +13,18 @@ class ScriptForm(ModelForm):
         model = Script
         exclude = ['uuid', 'mime_type', 'sha1', 'url',
                     'date_submitted', 'date_rejected', 'date_marked',
-                    'box_uuid',
-                ]
+                    'box_uuid',]
         #hidden_fields = ['status']
+
+
+class ScoreForm(ModelForm):
+
+    def __init__(self, *args, **kwargs):
+        super(ScriptForm, self).__init__(*args, **kwargs)
+        self.fields['score'].localize = True
+
+    class Meta:
+        model = Script
+        exclude = ['uuid', 'mime_type', 'sha1', 'url',
+                    'date_submitted', 'date_rejected', 'date_marked',
+                    'box_uuid', file]
diff --git a/teleforma/exam/templates/exam/score_form.html b/teleforma/exam/templates/exam/score_form.html
new file mode 100644 (file)
index 0000000..417978c
--- /dev/null
@@ -0,0 +1,68 @@
+{% extends "exam/scores.html" %}
+{% load telemeta_utils %}
+{% load teleforma_tags %}
+{% load i18n %}
+{% load thumbnail %}
+
+{% block extra_javascript %}
+{% if upload %}
+  <script>
+    $(document).ready(function(){
+        $('#loading').hide();
+    });
+
+    $(function() {
+        $('#submit_button').unbind('click').click(function() {
+            $(window).unbind('beforeunload');
+            // b2.unbind('click');
+            $('#id_status').val("5");
+            $('#id_period').val("{{ period.id }}");
+            $(this).hide();
+            $('#loading').show();
+            $('#_ScriptForm').submit();
+        });
+    });
+    </script>
+{% endif %}
+{% endblock extra_javascript %}
+
+{% block answers %}
+
+<div class="course_title">
+{% trans "New score" %}
+</div>
+<br />
+
+<div>Ce formulaire vous permet d'enregistrer la note d'une copie papier <b>déjà corrigée</b> hors de la plateforme e-learning.</div>
+<div>Pour soumettre une copie scannée à à la correction en ligne, merci d'utiliser <a href="{% url teleforma-exam-script-create period.id %}">ce formulaire</a>.</div>
+<div>Veuillez bien sélectionner <b>tous</b> les champs dans le formulaire suivant :</div>
+
+<div class="course_content" id="media_infos" style="font-size: 115%;">
+    <form method="post" id="_ScriptForm" action="" enctype="multipart/form-data" data-ajax="false">{% csrf_token %}
+       <table>
+       <br />
+       <tr><td colspan="2">{% for error in form.non_field_errors %}<li class="error">{{ error }}</li>{% endfor %}</td></tr>
+       {% for field in form %}
+       <tr>
+        {% if not field.html_name in create_fields %}
+            <td>{{ field.label_tag.as_hidden }}</td><td>{{ field.as_hidden }}</td>
+        {% else %}
+            <td>{{ field.label_tag }}:</td><td> {{ field }}</td>
+        {% endif %}
+        </tr>
+       {% endfor %}
+       </table>
+    </form>
+    {% if upload %}
+    <br />
+    <center>
+    <a href="#" id="submit_button" class="component_icon button icon_next">{% trans "Submit" %}</a>
+    <img id="loading" src="{{STATIC_URL}}teleforma/images/loading.gif" style="vertical-align:middle" alt="loading" />
+    </center>
+    {% endif %}
+    <br /><br />
+
+</div>
+</div>
+
+{% endblock answers %}
index 8040a3b079b457743fe3970ae8fb73a00b674c02..d11a39d2acc80634b9e179bf5bab60c007efd7b8 100644 (file)
     </div>
 
 {% block module-action %}
+{% if upload %}
+<div class="module_action">
+<a href="{% url teleforma-exam-scores-create period.id %}" class="component_icon button" id="action_green">{% trans "New score" %}</a>
+</div>
+{% endif %}
 {% endblock module-action %}
 
 {% endblock modules %}
index f5525763461fe8855d4d311428aa8dbea573c7dd..fca38b1479dd4c767caff7e85f70f0095943f82e 100644 (file)
@@ -42,19 +42,16 @@ from jsonrpc import jsonrpc_site
 
 urlpatterns = patterns('',
 
-    url(r'^scripts/periods/(?P<period_id>.*)/(?P<pk>.*)/detail/$', ScriptView.as_view(),
-        name="teleforma-exam-script-detail"),
-    url(r'^scripts/periods/(?P<period_id>.*)/list/$', ScriptsView.as_view(),
-        name="teleforma-exam-script-list"),
-    url(r'^scripts/periods/(?P<period_id>.*)/create/$', ScriptCreateView.as_view(),
-        name="teleforma-exam-script-create"),
+    url(r'^scripts/periods/(?P<period_id>.*)/(?P<pk>.*)/detail/$', ScriptView.as_view(), name="teleforma-exam-script-detail"),
+    url(r'^scripts/periods/(?P<period_id>.*)/list/$', ScriptsView.as_view(), name="teleforma-exam-script-list"),
+    url(r'^scripts/periods/(?P<period_id>.*)/create/$', ScriptCreateView.as_view(), name="teleforma-exam-script-create"),
     url(r'^scripts/periods/(?P<period_id>.*)/pending/$', ScriptsPendingView.as_view(), name="teleforma-exam-scripts-pending"),
     url(r'^scripts/periods/(?P<period_id>.*)/treated/$', ScriptsTreatedView.as_view(), name="teleforma-exam-scripts-treated"),
     url(r'^scripts/periods/(?P<period_id>.*)/rejected/$', ScriptsRejectedView.as_view(), name="teleforma-exam-scripts-rejected"),
 
     url(r'^scores/periods/(?P<period_id>.*)/all/$', ScriptsScoreAllView.as_view(), name="teleforma-exam-scripts-scores-all"),
     url(r'^scores/periods/(?P<period_id>.*)/courses/(?P<course_id>.*)/$', ScriptsScoreCourseView.as_view(), name="teleforma-exam-scripts-scores-course"),
-
+    url(r'^scores/periods/(?P<period_id>.*)/create/$', ScoreCreateView.as_view(), name="teleforma-exam-scores-create"),
     # url(r'^exam/periods/(?P<period_id>.*)/quotas/$', QuotasView.as_view(), name="teleforma-exam-quotas"),
 
 )
index 8622fa6a954e75385f910255344a154c2379e165..2eaed9395e8bc804889b18bc53a120a2d6a9c1aa 100644 (file)
@@ -309,3 +309,25 @@ class ScriptsScoreCourseView(ScriptsScoreAllView):
         context['course'] = course.title
         return context
 
+
+class ScoreCreateView(ScriptCreateView):
+
+    template_name='exam/score_form.html'
+    form_class = ScriptForm
+
+    def get_success_url(self):
+        period = Period.objects.get(id=self.kwargs['period_id'])
+        return reverse_lazy('teleforma-exam-scripts-scores-all', kwargs={'period_id':period.id})
+
+    def get_context_data(self, **kwargs):
+        context = super(ScriptCreateView, self).get_context_data(**kwargs)
+        context['upload'] = getattr(settings, 'TELEFORMA_EXAM_SCRIPT_UPLOAD', True)
+        context['period'] = Period.objects.get(id=self.kwargs['period_id'])
+        context['create_fields'] = ['course', 'session', 'type', 'score' ]
+        course_pk_list = [c['course'].id for c in get_courses(self.request.user)]
+        context['form'].fields['course'].queryset = Course.objects.filter(pk__in=course_pk_list)
+        return context
+
+    @method_decorator(login_required)
+    def dispatch(self, *args, **kwargs):
+        return super(ScoreCreateView, self).dispatch(*args, **kwargs)
index 336e69331a8f0e07de325ac8345bda236da1f7cb..a4fc8d5e63d4db254c586c71e570bef266bcf0a0 100644 (file)
Binary files a/teleforma/locale/fr/LC_MESSAGES/django.mo and b/teleforma/locale/fr/LC_MESSAGES/django.mo differ
index 75372d857b2caadfa20dfe925099d09ff435fb08..327d5b1de24eb4bc459148db504ba2791f93b077 100644 (file)
@@ -6,7 +6,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-07-13 17:21+0200\n"
+"POT-Creation-Date: 2015-07-14 16:21+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: Guillaume Pellerin <yomguy@parisson.com>\n"
 "Language-Team: LANGUAGE <lists@parisson.com>\n"
@@ -17,13 +17,13 @@ msgstr ""
 "Plural-Forms: nplurals=2; plural=(n > 1)\n"
 
 #: admin.py:16 exam/models.py:123 exam/models.py:226 models/ae.py:47
-#: models/core.py:111 models/core.py:136 models/core.py:252 models/core.py:503
-#: models/core.py:549 models/core.py:591 models/crfpa.py:64
+#: models/core.py:111 models/core.py:136 models/core.py:255 models/core.py:506
+#: models/core.py:552 models/core.py:594 models/crfpa.py:64
 #: models/crfpa.py:129
 msgid "period"
 msgstr "période"
 
-#: exam/models.py:62 exam/models.py:429
+#: exam/models.py:62 exam/models.py:436
 msgid "rejected"
 msgstr "rejetée"
 
@@ -39,7 +39,7 @@ msgstr "soumise"
 msgid "pending"
 msgstr "en attente"
 
-#: exam/models.py:63 exam/models.py:414
+#: exam/models.py:63 exam/models.py:421
 msgid "marked"
 msgstr "corrigée"
 
@@ -47,6 +47,10 @@ msgstr "corrigée"
 msgid "read"
 msgstr "lu"
 
+#: exam/models.py:63
+msgid "backup"
+msgstr ""
+
 #: exam/models.py:65
 msgid "unreadable"
 msgstr "illisible"
@@ -91,8 +95,8 @@ msgstr "pas de fichier"
 msgid "file too large"
 msgstr "fichier trop gros"
 
-#: exam/models.py:121 exam/models.py:225 models/core.py:197 models/core.py:254
-#: models/core.py:498 models/core.py:587 models/pro.py:45
+#: exam/models.py:121 exam/models.py:225 models/core.py:197 models/core.py:257
+#: models/core.py:501 models/core.py:590 models/pro.py:45
 msgid "course"
 msgstr "matière"
 
@@ -112,8 +116,8 @@ msgstr "date de début"
 msgid "date end"
 msgstr "date de fin"
 
-#: exam/models.py:128 exam/models.py:230 models/core.py:396 models/core.py:505
-#: models/core.py:595
+#: exam/models.py:128 exam/models.py:230 models/core.py:399 models/core.py:508
+#: models/core.py:598
 msgid "type"
 msgstr "type"
 
@@ -125,11 +129,11 @@ msgstr ""
 msgid "Quotas"
 msgstr ""
 
-#: exam/models.py:181 models/core.py:465 models/pro.py:67
+#: exam/models.py:181 models/core.py:468 models/pro.py:67
 msgid "date added"
 msgstr "date d'ajout"
 
-#: exam/models.py:182 models/core.py:160 models/core.py:466
+#: exam/models.py:182 models/core.py:160 models/core.py:469
 #: models/crfpa.py:212 models/pro.py:68
 msgid "date modified"
 msgstr "date de modification"
@@ -171,7 +175,7 @@ msgid "Pages"
 msgstr "Pages"
 
 #: exam/models.py:213 models/core.py:93 models/core.py:106 models/core.py:128
-#: models/core.py:141 models/core.py:236 models/core.py:481 models/crfpa.py:47
+#: models/core.py:141 models/core.py:239 models/core.py:484 models/crfpa.py:47
 #: models/crfpa.py:63
 msgid "name"
 msgstr "nom"
@@ -184,7 +188,7 @@ msgstr "Type de copie"
 msgid "ScriptTypes"
 msgstr "Types de copies"
 
-#: exam/models.py:228 models/core.py:258 models/core.py:507
+#: exam/models.py:228 models/core.py:261 models/core.py:510
 msgid "session"
 msgstr "séance"
 
@@ -208,7 +212,7 @@ msgstr "note"
 msgid "comments"
 msgstr "commentaires"
 
-#: exam/models.py:237 models/core.py:267 models/pro.py:48 models/pro.py:88
+#: exam/models.py:237 models/core.py:270 models/pro.py:48 models/pro.py:88
 #: models/pro.py:104
 msgid "status"
 msgstr "status"
@@ -246,12 +250,12 @@ msgstr ""
 msgid "Session"
 msgstr "Séance"
 
-#: exam/models.py:254 exam/models.py:413 exam/models.py:428
+#: exam/models.py:258 exam/models.py:420 exam/models.py:435
 msgid "Script"
 msgstr "Copie"
 
-#: exam/models.py:255 exam/templates/exam/scripts.html:21
-#: templates/telemeta/base.html:117 templates/telemeta/base.html.py:122
+#: exam/models.py:259 exam/templates/exam/scripts.html:21
+#: templates/telemeta/base.html:116 templates/telemeta/base.html.py:121
 msgid "Scripts"
 msgstr "Copies"
 
@@ -351,12 +355,23 @@ msgstr "Valeur"
 msgid "Level"
 msgstr "Niveau"
 
+#: exam/templates/exam/score_form.html:32 exam/templates/exam/scores.html:35
+msgid "New score"
+msgstr "Nouvelle note"
+
+#: exam/templates/exam/score_form.html:59
+#: exam/templates/exam/script_form.html:66
+#: templates/registration/registration_form.html:21
+msgid "Submit"
+msgstr "Soumettre"
+
 #: exam/templates/exam/scores.html:18 templates/teleforma/annals.html:15
 #: templates/telemeta/profile_detail.html:16
 msgid "My courses"
 msgstr "Mes matières"
 
-#: exam/templates/exam/scores.html:37 exam/templates/exam/scripts.html:28
+#: exam/templates/exam/scores.html:46 exam/templates/exam/scripts.html:28
+#: templates/telemeta/base.html:133 templates/telemeta/base.html.py:135
 msgid "Scores"
 msgstr "Notes"
 
@@ -406,11 +421,6 @@ msgstr "Nouvelle copie"
 msgid "Blank script"
 msgstr "Copie vierge"
 
-#: exam/templates/exam/script_form.html:66
-#: templates/registration/registration_form.html:21
-msgid "Submit"
-msgstr "Soumettre"
-
 #: exam/templates/exam/scripts.html:6
 msgid "Answers"
 msgstr "Réponses"
@@ -419,19 +429,19 @@ msgstr "Réponses"
 msgid "No scripts"
 msgstr "Aucune copie"
 
-#: exam/views.py:89
+#: exam/views.py:94
 msgid "Pending scripts"
 msgstr "Copies en attente"
 
-#: exam/views.py:106
+#: exam/views.py:126
 msgid "Treated scripts"
 msgstr "Copie traitées"
 
-#: exam/views.py:121
+#: exam/views.py:146
 msgid "Rejected scripts"
 msgstr "Copies rejetées"
 
-#: exam/views.py:137
+#: exam/views.py:162
 msgid ""
 "You have successfully submitted your script. It will be processed in the "
 "next hours."
@@ -439,7 +449,7 @@ msgstr ""
 "Vous avez correctement soumis votre copie. Elle sera traitée dans les "
 "prochaines heures puis corrigée."
 
-#: exam/views.py:141
+#: exam/views.py:166
 msgid ""
 "There was a problem with your submission. Please try again, later if "
 "possible."
@@ -447,7 +457,7 @@ msgstr ""
 "Il y a une une erreur lors de votre soumission de copie. Merci de vérifier "
 "votre fichier ou de réessayer plus tard."
 
-#: exam/views.py:224
+#: exam/views.py:266
 msgid "all courses"
 msgstr "toutes les matières"
 
@@ -485,13 +495,13 @@ msgid "Public"
 msgstr "Publié"
 
 #: models/core.py:94 models/core.py:107 models/core.py:129 models/core.py:142
-#: models/core.py:157 models/core.py:237 models/core.py:397 models/core.py:463
-#: models/core.py:482 models/crfpa.py:48 models/crfpa.py:226
+#: models/core.py:157 models/core.py:240 models/core.py:400 models/core.py:466
+#: models/core.py:485 models/crfpa.py:48 models/crfpa.py:226
 #: models/crfpa.py:239 models/pro.py:124
 msgid "description"
 msgstr "description"
 
-#: models/core.py:101 models/core.py:109 models/core.py:235 models/pro.py:123
+#: models/core.py:101 models/core.py:109 models/core.py:238 models/pro.py:123
 msgid "organization"
 msgstr "organisation"
 
@@ -499,19 +509,19 @@ msgstr "organisation"
 msgid "Master domain"
 msgstr ""
 
-#: models/core.py:123 models/core.py:155 models/core.py:209 models/core.py:250
+#: models/core.py:123 models/core.py:155 models/core.py:209 models/core.py:253
 msgid "department"
 msgstr "département"
 
-#: models/core.py:149 models/core.py:255 models/core.py:500 models/core.py:589
+#: models/core.py:149 models/core.py:258 models/core.py:503 models/core.py:592
 msgid "course type"
 msgstr "type de matière"
 
-#: models/core.py:156 models/core.py:462 models/pro.py:46 models/pro.py:83
+#: models/core.py:156 models/core.py:465 models/pro.py:46 models/pro.py:83
 msgid "title"
 msgstr "titre"
 
-#: models/core.py:158 models/core.py:467 models/crfpa.py:62
+#: models/core.py:158 models/core.py:470 models/crfpa.py:62
 msgid "code"
 msgstr "cote"
 
@@ -519,7 +529,7 @@ msgstr "cote"
 msgid "tweeter title"
 msgstr "titre tweeter"
 
-#: models/core.py:161 models/core.py:483
+#: models/core.py:161 models/core.py:486
 msgid "number"
 msgstr "nombre"
 
@@ -535,103 +545,103 @@ msgstr "obligations"
 msgid "magistral"
 msgstr "magistral"
 
-#: models/core.py:229 models/core.py:256
+#: models/core.py:232 models/core.py:259
 msgid "professor"
 msgstr "professeur"
 
-#: models/core.py:244 models/core.py:260
+#: models/core.py:247 models/core.py:263
 msgid "room"
 msgstr "salle"
 
-#: models/core.py:249
+#: models/core.py:252
 msgid "public_id"
 msgstr "public id"
 
-#: models/core.py:262
+#: models/core.py:265
 msgid "comment"
 msgstr "commentaire"
 
-#: models/core.py:263
+#: models/core.py:266
 msgid "begin date"
 msgstr "date de début"
 
-#: models/core.py:264
+#: models/core.py:267
 msgid "end date"
 msgstr "date de fin"
 
-#: models/core.py:265 models/core.py:515 models/core.py:553 models/core.py:596
+#: models/core.py:268 models/core.py:518 models/core.py:556 models/core.py:599
 msgid "readers"
 msgstr ""
 
-#: models/core.py:386 models/core.py:414 models/core.py:501 models/core.py:585
+#: models/core.py:389 models/core.py:417 models/core.py:504 models/core.py:588
 msgid "conference"
 msgstr "conférence"
 
-#: models/core.py:394
+#: models/core.py:397
 msgid "host"
 msgstr "hôte"
 
-#: models/core.py:395
+#: models/core.py:398
 msgid "port"
 msgstr "port"
 
-#: models/core.py:398
+#: models/core.py:401
 msgid "source password"
 msgstr ""
 
-#: models/core.py:399
+#: models/core.py:402
 msgid "admin password"
 msgstr ""
 
-#: models/core.py:406 models/core.py:417
+#: models/core.py:409 models/core.py:420
 msgid "streaming server"
 msgstr "serveur de diffusion"
 
-#: models/core.py:418
+#: models/core.py:421
 msgid "Streaming type"
 msgstr "Type de flux"
 
-#: models/core.py:420
+#: models/core.py:423
 msgid "streaming"
 msgstr "diffusion"
 
-#: models/core.py:456
+#: models/core.py:459
 msgid "live stream"
 msgstr "stream en direct"
 
-#: models/core.py:464
+#: models/core.py:467
 msgid "credits"
 msgstr "crédits"
 
-#: models/core.py:468
+#: models/core.py:471
 msgid "published"
 msgstr "publié"
 
-#: models/core.py:469
+#: models/core.py:472
 msgid "mime type"
 msgstr "Type mime"
 
-#: models/core.py:470 models/pro.py:86
+#: models/core.py:473 models/pro.py:86
 msgid "weight"
 msgstr "poids"
 
-#: models/core.py:490
+#: models/core.py:493
 msgid "document type"
 msgstr "type de document"
 
-#: models/core.py:509 models/crfpa.py:110
+#: models/core.py:512 models/crfpa.py:110
 msgid "iej"
 msgstr "iej"
 
-#: models/core.py:511
+#: models/core.py:514
 msgid "annal"
 msgstr "annale"
 
-#: models/core.py:512
+#: models/core.py:515
 msgid "year"
 msgstr "année"
 
-#: models/core.py:513 models/core.py:551
+#: models/core.py:516 models/core.py:554
 msgid "file"
 msgstr "fichier"
 
@@ -1502,8 +1512,8 @@ msgstr "Mes notes"
 msgid "New note"
 msgstr "Nouvelle note"
 
-#: templates/teleforma/help.html:11 templates/telemeta/base.html:138
-#: templates/telemeta/base.html.py:151
+#: templates/teleforma/help.html:11 templates/telemeta/base.html:148
+#: templates/telemeta/base.html.py:161
 msgid "Help"
 msgstr "Aide"
 
@@ -1551,27 +1561,27 @@ msgstr "Accueil"
 msgid "Messaging"
 msgstr "Messagerie"
 
-#: templates/telemeta/base.html:136
+#: templates/telemeta/base.html:146
 msgid "Admin"
 msgstr ""
 
-#: templates/telemeta/base.html:148
+#: templates/telemeta/base.html:158
 msgid "Profile"
 msgstr "Profil"
 
-#: templates/telemeta/base.html:150
+#: templates/telemeta/base.html:160
 msgid "Lists"
 msgstr ""
 
-#: templates/telemeta/base.html:153
+#: templates/telemeta/base.html:163
 msgid "Sign out"
 msgstr ""
 
-#: templates/telemeta/base.html:195
+#: templates/telemeta/base.html:205
 msgid "Powered by"
 msgstr ""
 
-#: templates/telemeta/base.html:205
+#: templates/telemeta/base.html:215
 msgid "Legal notices"
 msgstr ""
 
@@ -1797,7 +1807,7 @@ msgstr ""
 msgid "A new live conference has started : "
 msgstr "Une nouvelle conférence en direct a commencé : "
 
-#: views/crfpa.py:391
+#: views/crfpa.py:407
 msgid "You have successfully register your account."
 msgstr ""
 
index 3290d0f72a0093c6a2823ea87df7b60b93d5afbd..e94d1805c01f58feb6a371dbfc94dfe04dfb9e7e 100644 (file)
@@ -66,7 +66,7 @@ def get_n_choices(n):
 def get_nint_choices(n):
     return [(x, y) for x in range(1, n) for y in range(1, n) if x == y]
 
-session_choices = get_n_choices(21)
+session_choices = get_n_choices(8)
 server_choices = [('icecast', 'icecast'), ('stream-m', 'stream-m')]
 streaming_choices = [('mp3', 'mp3'), ('ogg', 'ogg'), ('webm', 'webm'), ('mp4', 'mp4')]
 mimetypes.add_type('video/webm','.webm')