From 99a88cd1ad87d4d1b9369d1a4aaaa2af19ebb97a Mon Sep 17 00:00:00 2001 From: yomguy Date: Tue, 10 Apr 2012 23:13:38 +0200 Subject: [PATCH] fix many content styles, add XLS user list export --- teleforma/htdocs/css/teleforma_black.css | 36 +++++++++--- .../commands/teleforma-export-users.py | 58 +++++++++++++++++++ teleforma/models.py | 4 +- teleforma/templates/postman/base.html | 2 - teleforma/templates/postman/base_folder.html | 2 +- teleforma/templates/postman/base_write.html | 2 +- teleforma/templates/postman/view.html | 2 +- .../templates/teleforma/course_detail.html | 3 +- .../templates/teleforma/course_media.html | 3 +- teleforma/templates/teleforma/courses.html | 25 ++++---- .../teleforma/inc/conference_list.html | 4 +- .../teleforma/inc/document_list.html | 4 +- .../templates/teleforma/inc/media_list.html | 4 +- .../templates/telemeta/inc/user_list.html | 6 -- teleforma/templates/telemeta/users.html | 2 +- 15 files changed, 121 insertions(+), 36 deletions(-) create mode 100644 teleforma/management/commands/teleforma-export-users.py diff --git a/teleforma/htdocs/css/teleforma_black.css b/teleforma/htdocs/css/teleforma_black.css index 51584688..5abbab57 100644 --- a/teleforma/htdocs/css/teleforma_black.css +++ b/teleforma/htdocs/css/teleforma_black.css @@ -1323,12 +1323,20 @@ input,textarea{ font-weight: bold; } + +#module-set-left .module h3 a { + color: #FFF; + } + #module-set-left .module ul { margin: 0em 0em 0em 0.5em; font-size: 0.8125em; background-color: #FFF; color: #0000 ; font-weight: bold; + max-height: 250px; + overflow-y: scroll; + } #module-set-left .module a { @@ -1340,14 +1348,29 @@ input,textarea{ float: left; width:55%; padding: 0em 0em 0em 1em; + max-height: 600px; + overflow-y: scroll; } .desk_large { + float: left; + width:75%; + padding: 0em 0.8em 0em 1em; + max-height: 600px; + overflow-y: scroll; + } + +.desk_course { float: left; width:75%; padding: 0em 0em 0em 1em; } +.desk_media { + float: left; + width: 640px; + padding: 0em 0em 0em 1em; + } .course { margin: 0em 0em 2em 0em; @@ -1372,26 +1395,26 @@ input,textarea{ } .course_content { - /*max-height: 200px; - overflow-y: scroll;*/ background-color: #FFF; -moz-border-radius: 8px 0px 8px 8px; -webkit-border-radius: 8px 0px 8px 8px; border-radius: 8px 0px 8px 8px; - padding: 0em 0em 0em 0.3em; + padding: 0em 0em 0em 0em; } .course_content h2 { - padding: 0.5em 0em 0em 0.3em; + padding: 0.5em 0.8em 0em 0.8em; } .course_media { + float: left; background-color: transparent; - margin: 0em 0em 2em 0em; + margin: 0em 0em 2em 1em; -moz-border-radius: 8px 0px 8px 8px; -webkit-border-radius: 8px 0px 8px 8px; border-radius: 8px 0px 8px 8px; + width: 640px; /* border: 2px solid #CCC; */ } @@ -1427,7 +1450,7 @@ input,textarea{ -moz-border-radius: 8px 0px 8px 8px; -webkit-border-radius: 8px 0px 8px 8px; border-radius: 8px 0px 8px 8px; - + padding: 0.5em 0.8em 0.8em 0.8em; } #pm_messages { @@ -1457,7 +1480,6 @@ input,textarea{ #chatwindow { height: 340px; - width: 187px; border-bottom: 1px solid; padding: 0.8em 2em 0em 0em; overflow: auto; diff --git a/teleforma/management/commands/teleforma-export-users.py b/teleforma/management/commands/teleforma-export-users.py new file mode 100644 index 00000000..efd285dd --- /dev/null +++ b/teleforma/management/commands/teleforma-export-users.py @@ -0,0 +1,58 @@ +from optparse import make_option +from django.conf import settings +from django.core.management.base import BaseCommand, CommandError +from django.contrib.auth.models import User +from django.template.defaultfilters import slugify +from telemeta.models import * +from telemeta.util.unaccent import unaccent +from teleforma.models import * +import logging +import codecs +import xlrd +from xlwt import Workbook + +class Command(BaseCommand): + help = "Export users to a XLS file (see an example in example/data/" + args = "path" + first_row = 2 + admin_email = 'webmaster@parisson.com' + + def export_user(self, count, user): + student = Student.objects.filter(user=user) + if student: + student = Student.objects.get(user=user) + row = self.sheet.row(count) + row.write(0, user.last_name) + row.write(1, user.first_name) + row.write(9, user.email) + + row.write(2, unicode(student.iej)) + row.write(3, unicode(student.training)) + row.write(4, unicode(student.procedure)) + row.write(5, unicode(student.written_speciality)) + row.write(6, unicode(student.oral_speciality)) + row.write(7, unicode(student.oral_1)) + row.write(8, unicode(student.oral_2)) + row.write(15, unicode(student.category)) +# address = row[10].value +# p_code = row[11].value +# city = row[12].value +# tel = row[13].value +# date = row[14].value + + print 'exported: ' + user.first_name + ' ' + user.last_name + ' ' + user.username + + + + def handle(self, *args, **options): + file = args[0] + self.book = Workbook() + self.sheet = self.book.add_sheet('Etudiants') + users = User.objects.all() + count = 0 + for user in users: + self.export_user(count, user) + count += 1 + self.book.save(file) + + diff --git a/teleforma/models.py b/teleforma/models.py index 608fdf2e..90bf1ead 100755 --- a/teleforma/models.py +++ b/teleforma/models.py @@ -128,6 +128,7 @@ class Course(Model): class Meta: db_table = app_label + '_' + 'course' verbose_name = _('course') + ordering = ['title'] class Professor(Model): @@ -182,6 +183,7 @@ class Conference(Model): class Meta: db_table = app_label + '_' + 'conference' verbose_name = _('conference') + ordering = ['-date_begin'] class MediaBase(Model): @@ -199,7 +201,7 @@ class MediaBase(Model): class Meta: abstract = True - ordering = ['date_added'] + ordering = ['-date_added'] class Document(MediaBase): diff --git a/teleforma/templates/postman/base.html b/teleforma/templates/postman/base.html index 54e88b80..aea8d356 100644 --- a/teleforma/templates/postman/base.html +++ b/teleforma/templates/postman/base.html @@ -24,6 +24,4 @@ - - {% endblock postman_menu %} \ No newline at end of file diff --git a/teleforma/templates/postman/base_folder.html b/teleforma/templates/postman/base_folder.html index f4bbfcb9..aca852d1 100644 --- a/teleforma/templates/postman/base_folder.html +++ b/teleforma/templates/postman/base_folder.html @@ -3,7 +3,7 @@ {% block content %} -
+

{% block pm_folder_title %}{% endblock %}

{% autopaginate pm_messages %} {% if invalid_page %} diff --git a/teleforma/templates/postman/base_write.html b/teleforma/templates/postman/base_write.html index b8ca60de..a6331bc2 100644 --- a/teleforma/templates/postman/base_write.html +++ b/teleforma/templates/postman/base_write.html @@ -10,7 +10,7 @@ {% endif %} {% endblock %} {% block content %} -
+

{% block pm_write_title %}{% endblock %}

{% csrf_token %} diff --git a/teleforma/templates/postman/view.html b/teleforma/templates/postman/view.html index 4e4899c1..d726be28 100644 --- a/teleforma/templates/postman/view.html +++ b/teleforma/templates/postman/view.html @@ -4,7 +4,7 @@ {% load postman_tags %} {% block content %} -
+

{% if pm_messages|length > 1 %}{% trans "Conversation" %}{% else %}{% trans "Message" %}{% endif %}



{% for message in pm_messages %} diff --git a/teleforma/templates/teleforma/course_detail.html b/teleforma/templates/teleforma/course_detail.html index c07814d7..312f780d 100644 --- a/teleforma/templates/teleforma/course_detail.html +++ b/teleforma/templates/teleforma/course_detail.html @@ -8,7 +8,7 @@ {% endblock courses %} {% block course %} - +
{{ course.title }}{% if course.description %} - {{ course.description }}{% endif %} @@ -32,5 +32,6 @@ {% endwith %} {% endblock %} +
{% endblock course %} diff --git a/teleforma/templates/teleforma/course_media.html b/teleforma/templates/teleforma/course_media.html index ce4d8987..94a434cd 100644 --- a/teleforma/templates/teleforma/course_media.html +++ b/teleforma/templates/teleforma/course_media.html @@ -20,7 +20,6 @@ $(document).ready(function(){ {% endblock extra_javascript %} {% block course %} -
{{ course.title }}{% if course.description %} - {{ course.description }}{% endif %} @@ -62,7 +61,7 @@ $(document).ready(function(){ {% block chat %} {% if room %} -
+

rss{% trans "Questions" %}

diff --git a/teleforma/templates/teleforma/courses.html b/teleforma/templates/teleforma/courses.html index 1fc6c6c0..9ddfe7f6 100644 --- a/teleforma/templates/teleforma/courses.html +++ b/teleforma/templates/teleforma/courses.html @@ -10,7 +10,7 @@
-

playlists{% trans "My courses" %}

+

playlists{% trans "My courses" %}

    {% block courses %} @@ -41,36 +41,41 @@
- -
- {% block course %} +{% block course %} +
{% for course in object_list %}
{{ course.title }}{% if course.description %} - {{ course.description }}{% endif %}
+ {% if course.conference.all or course.document.all or course.media.all %} {% block document %} - {% with course as course and %} + {% with course as course %} {% include "teleforma/inc/document_list.html" %} {% endwith %} {% endblock %} {% block media %} - {% with course as course and %} + {% with course as course %} {% include "teleforma/inc/media_list.html" %} {% endwith %} {% endblock %} {% block conference %} - {% with course as course and %} + {% with course as course %} {% include "teleforma/inc/conference_list.html" %} {% endwith %} {% endblock %} - + {% else %} +
+

{% trans "No document" %}

+
+ {% endif %}
{% endfor %} - {% endblock course %} -
+ +
+{% endblock course %}
{% block chat %} diff --git a/teleforma/templates/teleforma/inc/conference_list.html b/teleforma/templates/teleforma/inc/conference_list.html index 5af6bbe1..f3f840c1 100644 --- a/teleforma/templates/teleforma/inc/conference_list.html +++ b/teleforma/templates/teleforma/inc/conference_list.html @@ -1,5 +1,6 @@ {% load i18n %} +{% if course.conference.all %}

{% trans "Conferences"%}

@@ -20,4 +21,5 @@ {% endfor %}
-
\ No newline at end of file +
+{% endif %} \ No newline at end of file diff --git a/teleforma/templates/teleforma/inc/document_list.html b/teleforma/templates/teleforma/inc/document_list.html index 79ccc43c..971667d3 100644 --- a/teleforma/templates/teleforma/inc/document_list.html +++ b/teleforma/templates/teleforma/inc/document_list.html @@ -1,5 +1,6 @@ {% load i18n %} +{% if course.document.all %}

{% trans "Documents"%}

@@ -20,4 +21,5 @@ {% endfor %}
-
\ No newline at end of file +
+{% endif %} \ No newline at end of file diff --git a/teleforma/templates/teleforma/inc/media_list.html b/teleforma/templates/teleforma/inc/media_list.html index 7c55cd78..35cd4cc7 100644 --- a/teleforma/templates/teleforma/inc/media_list.html +++ b/teleforma/templates/teleforma/inc/media_list.html @@ -1,5 +1,6 @@ {% load i18n %} +{% if course.media.all %}

{% trans "Medias"%}

@@ -20,4 +21,5 @@ {% endfor %}
-
\ No newline at end of file +
+{% endif %} \ No newline at end of file diff --git a/teleforma/templates/telemeta/inc/user_list.html b/teleforma/templates/telemeta/inc/user_list.html index e3f4c420..7e14b44d 100644 --- a/teleforma/templates/telemeta/inc/user_list.html +++ b/teleforma/templates/telemeta/inc/user_list.html @@ -21,14 +21,12 @@ {% trans "Last Name"%} {% trans "First Name"%} {% trans "User"%} - {% trans "Training"%} {% trans "IEJ"%} {% trans "Procedure"%} {% trans "Oral spe"%} {% trans "Written spe"%} {% trans "Oral 1"%} {% trans "Oral 2"%} - {% trans "Synthesis"%} {% trans "Messages"%} @@ -41,14 +39,12 @@ {% if user.student.get %} {% with user.student.get as student %} - {{ student.training.code }} {{ student.iej.name }} {{ student.procedure.code }} {{ student.oral_speciality.code }} {{ student.written_speciality.code }} {{ student.oral_1.code }} {{ student.oral_2.code }} - {% endwith %} {% elif user.professor.get %} {% trans "Professor" %} @@ -57,8 +53,6 @@ - - {% endif %} {% trans "Write" %} diff --git a/teleforma/templates/telemeta/users.html b/teleforma/templates/telemeta/users.html index 4b174782..0de0536b 100644 --- a/teleforma/templates/telemeta/users.html +++ b/teleforma/templates/telemeta/users.html @@ -25,7 +25,7 @@ -
+
{% trans "Users" %}
{% if users %} {% include "telemeta/inc/user_list.html" %} -- 2.39.5