readers = ManyToManyField(User, related_name="document_simple", verbose_name=_('readers'),
blank=True, null=True)
rank = models.IntegerField(_('rank'), blank=True, null=True)
-
+
def is_image(self):
is_url_image = False
if self.url:
class Meta(MetaCore):
db_table = app_label + '_' + 'document_simple'
- ordering = ['-date_added']
+ ordering = ['rank']
def __unicode__(self):
return ' - '.join([self.course.title, str(self.rank), self.title])
+ @property
+ def scenario(self):
+ self.steps = []
+ self.steps.append(self.doc_1)
+ self.steps.append(self.media)
+ self.steps.append(self.doc_2)
+ self.steps.append(self.question)
+ self.steps.append(self.doc_correct)
+ self.steps.append(self.testimonial)
+ return self.steps
+
class Meta(MetaCore):
db_table = app_label + '_' + 'seminar'
verbose_name = _('Seminar')
+ ordering = ['rank']
class Question(models.Model):
element_type = 'question'
-
+
seminar = models.ForeignKey(Seminar, related_name="question", verbose_name=_('seminar'))
title = models.CharField(_('title'), max_length=255, blank=True)
description = models.CharField(_('description'), max_length=1024, blank=True)
verbose_name = _('Evaluation')
-class SeminarScenario1():
-
- def __init__(self, seminar):
- self.seminar = seminar
- self.steps = []
-
- self.append(self.seminar.doc_1)
- self.append(self.seminar.media)
- self.append(self.seminar.doc_2)
- self.append(self.seminar.question)
- self.append(self.seminar.doc_correct)
- self.steps.append(self.seminar.evaluation.all()[0])
- self.append(self.seminar.testimonial)
-
- def append(self, models):
- for mod in models.all().order_by('rank'):
- self.steps.append(mod)
-
class Auditor(models.Model):
--- /dev/null
+{% load teleforma_tags %}
+{% load i18n %}
+
+<div class="course_content">
+
+<div class="course_subtitle">
+<h3><img src="{{ STATIC_URL }}/telemeta/images/item_title.png" width="10px" alt="" /> {% trans "Documents"%}</h3>
+</div>
+
+
+<span class="doc_type_title">{{ doc_type }}</span>
+<table class="listing" width="100%">
+ <tbody>
+ {% for doc in docs %}
+ <tr>
+ <td {% if forloop.first %}class="border-top"{% endif %} width="60%">{% if doc.file %}<a href="{% url teleforma-document-view doc.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 doc.id %}"><img src="{{ STATIC_URL }}teleforma/images/download.png" style="vertical-align:middle" alt="" title="{% trans "Download" %}" /></a>{% endif %}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
+
+</div>
+
--- /dev/null
+{% load teleforma_tags %}
+{% load i18n %}
+
+{% with course.conference.all|from_course_type:type as conferences %}
+{% if conferences %}
+<div class="course_content">
+<div class="course_subtitle">
+ <h3><img src="{{ STATIC_URL }}telemeta/images/item_title.png" width="10px" alt="" /> {% trans "Live conferences"%}</h3>
+</div>
+ <table class="listing" width="100%">
+ <tbody>
+ {% for conference in conferences|from_periods:periods %}
+ {% for stream in conference.livestream.all %}
+ {% if stream.stream_type == 'webm' %}
+ <tr>
+ {% if stream.streaming %}
+ <td {% if forloop.first %}class="border-top"{% endif %} width="230px">
+ <a href="{% url teleforma-conference-detail stream.conference.id %}" title="{% trans "View" %}">
+ <img id="snapshot-{{ stream.course.code }}-{{ stream.course_type }}" src="{{ stream.snapshot_url }}" width="100%" alt="{% trans 'Click here' %}" />
+ </a>
+ </td>
+ <td {% if forloop.first %}class="border-top"{% endif %} width="60%" style="padding-left: 1em;">
+ <div>
+ <dl class="listing" style="font-size: 1.2em;">
+ <dt>{% trans "Title" %}</dt><dd>{{ stream.conference.course.title }}</dd>
+ <dt>{% trans "Session" %}</dt><dd>{{ stream.conference.session }}</dd>
+ <dt>{% trans "Professor" %}</dt><dd><a href="{% url telemeta-profile-detail stream.conference.professor.user.username %}" target="_blank">{{ stream.conference.professor }}</a></dd>
+ <dt>{% trans "Begin" %}</dt><dd>{{ stream.conference.date_begin }}</dd>
+ </dl>
+ </div>
+ </td>
+ <td {% if forloop.first %}class="border-top"{% endif %} width="10%" align="center">
+ {% if stream.streaming %}
+ <img src="{{ STATIC_URL }}teleforma/images/network-wireless.png" style="vertical-align:middle" title="streaming" />
+ <img src="{{ STATIC_URL }}telemeta/images/media-record.png" style="vertical-align:middle" title="recording" />
+ {% endif %}
+ </td>
+ {% else %}
+ <div style="padding-left: 1em;">
+
+ </div>
+ {% endif %}
+ </tr>
+ {% endif %}
+ {% endfor %}
+ {% endfor %}
+ </tbody>
+ </table>
+</div>
+{% endif %}
+{% endwith %}
\ No newline at end of file
--- /dev/null
+{% load teleforma_tags %}
+{% load i18n %}
+
+{% with course.conference.all|from_course_type:type as conferences %}
+{% if conferences %}
+<div class="course_content">
+<div class="course_subtitle">
+ <h3><img src="{{ STATIC_URL }}telemeta/images/item_title.png" width="10px" alt="" /> {% trans "Live conferences"%}</h3>
+</div>
+ <table class="listing" width="100%">
+ <tbody>
+ {% for conference in conferences|from_periods:periods %}
+ {% for stream in conference.livestream.all %}
+ {% if stream.stream_type == 'webm' %}
+ <tr>
+ {% if stream.streaming %}
+ <td {% if forloop.first %}class="border-top"{% endif %} width="230px">
+ <a href="{% url teleforma-conference-detail stream.conference.id %}" title="{% trans "View" %}">
+ <img id="snapshot-{{ stream.course.code }}-{{ stream.course_type }}" src="{{ stream.snapshot_url }}" width="100%" alt="{% trans 'Click here' %}" />
+ </a>
+ </td>
+ <td {% if forloop.first %}class="border-top"{% endif %} width="60%" style="padding-left: 1em;">
+ <div>
+ <dl class="listing" style="font-size: 1.2em;">
+ <dt>{% trans "Title" %}</dt><dd>{{ stream.conference.course.title }}</dd>
+ <dt>{% trans "Session" %}</dt><dd>{{ stream.conference.session }}</dd>
+ <dt>{% trans "Professor" %}</dt><dd><a href="{% url telemeta-profile-detail stream.conference.professor.user.username %}" target="_blank">{{ stream.conference.professor }}</a></dd>
+ <dt>{% trans "Begin" %}</dt><dd>{{ stream.conference.date_begin }}</dd>
+ </dl>
+ </div>
+ </td>
+ <td {% if forloop.first %}class="border-top"{% endif %} width="10%" align="center">
+ {% if stream.streaming %}
+ <img src="{{ STATIC_URL }}teleforma/images/network-wireless.png" style="vertical-align:middle" title="streaming" />
+ <img src="{{ STATIC_URL }}telemeta/images/media-record.png" style="vertical-align:middle" title="recording" />
+ {% endif %}
+ </td>
+ {% else %}
+ <div style="padding-left: 1em;">
+
+ </div>
+ {% endif %}
+ </tr>
+ {% endif %}
+ {% endfor %}
+ {% endfor %}
+ </tbody>
+ </table>
+</div>
+{% endif %}
+{% endwith %}
\ No newline at end of file
-{% extends "teleforma/courses.html" %}
+{% extends "teleforma/seminars.html" %}
{% load i18n %}
-{% block extra_javascript %}
-<script type="text/javascript">
-$(document).ready(function(){
- InitChatWindow("{% url jqchat_ajax room.id %}", null);
- });
-</script>
-{% endblock extra_javascript %}
-{% block courses %}
-{% for c in all_courses %}
- {% with c.course as course %}
- <li><a href="{% url teleforma-course-detail course.id %}">{{ course.title }}</a></li>
- {% endwith %}
- {% endfor %}
-{% endblock courses %}
{% block course %}
<div class="desk_center">
- {% for c in courses %}
- {% with c.course as course %}
- {% for type in c.types %}
<div class="course">
- <div class="course_title">{{ course.title }}{% if type.name != "None" %} - {{ type }}{% endif %}{% if course.description %} - {{ course.description }}{% endif %}
+ <div class="course_title">
+ <a href="{% url teleforma-seminar-detail seminar.id %}" style="color: #000;">{{ seminar.title }}{% if seminar.description %} - {{ seminar.description }}{% endif %}</a>
</div>
- {% block conference %}
- {% include "teleforma/inc/conference_list.html" %}
- {% endblock %}
-
- {% block media %}
- {% include "teleforma/inc/media_list.html" %}
- {% endblock %}
-
- {% block document %}
- {% with forloop.counter as type_counter %}
- {% include "teleforma/inc/document_list.html" %}
- {% endwith %}
- {% endblock %}
-
- </div>
- {% endfor %}
- {% endwith %}
- {% endfor %}
+ {% for step in seminar.steps %}
+
+ {% if step.element_type == 'document_simple' %}
+ {% include "teleforma/inc/document_simple_list.html" %}
+
+ {% elif step.element_type == 'media_package' %}
+ {% include "teleforma/inc/media_package_list.html" %
+
+ {% elif step.element_type == 'question' %}
+ {% include "teleforma/inc/question_list.html" %}
+
+ {% endif %}
+ {% endfor %}
+
+ </div>
</div>
{% endblock course %}
-{% block chat %}
-{% if room %}
-{% with "General tweeter" as title %}
-{% include "teleforma/inc/chat_room.html" %}
-{% endwith %}
-{% endif %}
-{% endblock chat %}
\ No newline at end of file
<div style="background: white;">
<ul>
{% block courses %}
-{% for s in all_seminars %}
+{% for seminar in all_seminars %}
<li><a href="{% url teleforma-seminar-detail seminar.id %}">{{ seminar.title }}</a></li>
{% endfor %}
{% endblock courses %}
{% for seminar in object_list %}
<div class="course">
<div class="course_title">
- <a href="{% url teleforma-seminar-detail seminar.id %}" style="color: #000;">{{ seminar.title }} - {{ type }}{% if seminar.description %} - {{ seminar.description }}{% endif %}</a>
+ <a href="{% url teleforma-seminar-detail seminar.id %}" style="color: #000;">{{ seminar.title }}</a>
</div>
+ {% if seminar.description %}{{ seminar.description }}{% endif %}
- {% for step in seminar.steps %}
+ {% for step in seminar.scenario %}
+
+ {% if step.all.0.element_type == 'document_simple' %}
+ {% with step.all as docs %}
+ {% include "teleforma/inc/document_simple_list.html" %}
+ {% endwith %}
- {% if step.element_type == 'document_simple' %}
- {% include "teleforma/inc/document_simple_list.html" %}
-
{% elif step.element_type == 'media_package' %}
{% include "teleforma/inc/media_package_list.html" %
url(r'^help/$', HelpView.as_view(), name="teleforma-help"),
# Desk
- url(r'^desk/$', CoursesView.as_view(), name="teleforma-desk"),
+ url(r'^desk/$', SeminarsView.as_view(), name="teleforma-desk"),
url(r'^desk/courses/(?P<pk>.*)/$', CourseView.as_view(), name="teleforma-course-detail"),
+ url(r'^desk/seminars/(?P<pk>.*)/$', SeminarView.as_view(), name="teleforma-seminar-detail"),
url(r'^desk/medias/(?P<pk>.*)/detail/$', MediaView.as_view(), name="teleforma-media-detail"),
url(r'^desk/medias/(?P<pk>.*)/download/$', media.download, name="teleforma-media-download"),
from teleforma.views.core import *
-scenario = SeminarScenario1
-
-
def get_seminars(user):
seminars = []
n = 0
for revision in revisions:
- total += revision.progress
+ progress += revision.progress
n += 1
- return int(total/n)
+ if n:
+ return int(progress/n)
+ else:
+ return 0
class SeminarView(DetailView):
context['all_seminars'] = get_seminars(user)
context['progress'] = seminar_progress(user, seminar)
context['total_progress'] = total_progress(user)
- context['scenario'] = scenario(seminar)
return context
template_name='teleforma/seminars.html'
def get_queryset(self):
- self.all_courses = get_courses(self.request.user, date_order=True)
- return self.all_courses[:10]
+ return get_seminars(self.request.user)
def get_context_data(self, **kwargs):
- context = super(SeminarView, self).get_context_data(**kwargs)
+ context = super(SeminarsView, self).get_context_data(**kwargs)
+ user = self.request.user
context['all_seminars'] = get_seminars(user)
context['total_progress'] = total_progress(user)
return context
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
- return super(SeminarView, self).dispatch(*args, **kwargs)
+ return super(SeminarsView, self).dispatch(*args, **kwargs)