]> git.parisson.com Git - teleforma.git/commitdiff
add postman templates, fix training model
authoryomguy <yomguy@parisson.com>
Mon, 2 Apr 2012 15:04:42 +0000 (17:04 +0200)
committeryomguy <yomguy@parisson.com>
Mon, 2 Apr 2012 15:04:42 +0000 (17:04 +0200)
25 files changed:
example/settings.py
example/urls.py
teleforma/htdocs/css/teleforma_black.css
teleforma/models.py
teleforma/templates/postman/archives.html [new file with mode: 0644]
teleforma/templates/postman/base.html [new file with mode: 0644]
teleforma/templates/postman/base_folder.html [new file with mode: 0644]
teleforma/templates/postman/base_write.html [new file with mode: 0644]
teleforma/templates/postman/email_user.txt [new file with mode: 0644]
teleforma/templates/postman/email_user_subject.txt [new file with mode: 0644]
teleforma/templates/postman/email_visitor.txt [new file with mode: 0644]
teleforma/templates/postman/email_visitor_subject.txt [new file with mode: 0644]
teleforma/templates/postman/inbox.html [new file with mode: 0644]
teleforma/templates/postman/inc_subject_ex.html [new file with mode: 0644]
teleforma/templates/postman/reply.html [new file with mode: 0644]
teleforma/templates/postman/sent.html [new file with mode: 0644]
teleforma/templates/postman/trash.html [new file with mode: 0644]
teleforma/templates/postman/view.html [new file with mode: 0644]
teleforma/templates/postman/write.html [new file with mode: 0644]
teleforma/templates/teleforma/course_detail.html
teleforma/templates/teleforma/courses.html
teleforma/templates/teleforma/inc/media_list.html
teleforma/templates/telemeta/base.html
teleforma/urls.py
teleforma/views.py

index af77a8c8aeeda50a5c96637ea5242379d95b6f47..a94f047df8a81103631d651f1a964916a8b33a4a 100644 (file)
@@ -107,6 +107,7 @@ MIDDLEWARE_CLASSES = (
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
     'django.middleware.locale.LocaleMiddleware',
+    'pagination.middleware.PaginationMiddleware',
 )
 
 ROOT_URLCONF = 'example.urls'
@@ -132,6 +133,8 @@ INSTALLED_APPS = (
     'teleforma',
     'sorl.thumbnail',
     'django_extensions',
+    'pagination',
+    'postman',
 )
 
 TEMPLATE_CONTEXT_PROCESSORS = (
@@ -160,3 +163,4 @@ LOGIN_REDIRECT_URL = '/desk/courses'
 EMAIL_HOST = 'localhost'
 DEFAULT_FROM_EMAIL = 'webmaster@parisson.com'
 
+POSTMAN_AUTO_MODERATE_AS=True
index e177f89f40ac0c94754face7d42ae3230a4e4513..cd4c29c005e88c60459510d1e09052a9965ddf7e 100644 (file)
@@ -26,6 +26,9 @@ urlpatterns = patterns('',
     # TeleForma
     (r'^', include('teleforma.urls')),
 
+    # Postman
+    (r'^messages/', include('postman.urls')),
+
     # Languages
     (r'^i18n/', include('django.conf.urls.i18n')),
     (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
index 3e1c3848a5f5c287d28fcc209db312f81b90b551..a352994332337c672eea953ea50f348de64642d2 100644 (file)
@@ -10,6 +10,9 @@ body {
     color: #333;
     background: #FFF;
     margin: 0em;
+    background:no-repeat url(../images/bg_yt.png) 0 0;
+    background-color:#ebebeb;
+    background-repeat:repeat
 }
 
 /*a:link, a:visited {
@@ -87,7 +90,7 @@ a img { border: none; }
     color: #000000;
     font-weight: bold;
     display:  inline;
-    font-size: 120%; 
+    font-size: 120%;
 }
 #content h3 {
     color: #000000;
@@ -167,12 +170,12 @@ a img { border: none; }
 }
 
 #collection_player {
-    background: transparent; 
+    background: transparent;
     /*     background-image: url(../images/grid_bg_2.png); */
 }
 
 #collection_player .title {
-    padding: 2px 5px 7px 5px; 
+    padding: 2px 5px 7px 5px;
 }
 
 
@@ -207,7 +210,7 @@ a img { border: none; }
     overflow-y: scroll;
     width: 100%;
 }
-    
+
 
 .analyzer-title {
     background-color: #f2f2f2;
@@ -397,7 +400,7 @@ form.login .submit {
     border-radius: 8px 8px 8px 8px;
 }
 #searchform p {
-    background-color: #fff;
+    background-color: transparent;
     padding: .5em 0;
 }
 #searchform label {
@@ -476,24 +479,24 @@ form.login .submit {
 
 
 /* Drop Down Menus */
-.clear {clear:both} 
+.clear {clear:both}
 
 #nav {
     margin:0;
     padding:0;
     list-style:none;
-}  
+}
 
 /* make the LI display inline */
 /* it's position relative so that position absolute */
 /* can be used in submenu */
 
 #nav li {
-display:inline-block; 
+display:inline-block;
 position:relative;
 z-index:500;
 }
-    
+
 /* this is the parent menu */
 #nav li a {
 display:block;
@@ -520,16 +523,16 @@ color:#FFF;
     color: #FFF;
     width:100%;
 }
-    
+
 #nav ul li {
     width: 100%;
     float:left;
     border-bottom:0px solid #fff;
 }
-    
+
 /* display block will make the link fill the whole area of LI */
 #nav ul a {
-    display:block; 
+    display:block;
     height:15px;
     padding: 5px 5px;
     font-size: 11px;
@@ -542,7 +545,7 @@ color:#FFF;
     border-top-right-radius: 0px 0px;
     border-bottom-width: 0px;
 }
-    
+
 #nav ul a:hover {
     background-color: #FFF ;
     color: #000000 ;
@@ -716,6 +719,7 @@ dl.dublincore dd.caption {
     line-height: 1.4em;
     border-bottom: 1px dotted #aaa;
     color: #000000;
+
 }
 .with-rightcol .extraInfos h4 {
     margin-right: 395px;
@@ -727,12 +731,13 @@ dl.dublincore dd.caption {
     color: #000000 !important;
     text-decoration: none;
     margin: 0;
-    background: #fff url(more.png) no-repeat left top;
+    background: #fff url(images/more.png) no-repeat left top;
     background-position: 0 -16px;
     padding-bottom: 2px;
     padding-left: 16px;
     border-bottom: none !important;
     outline: none;
+    background: transparent;
 }
 .extraInfos h4 a:hover {
     background-color: transparent;
@@ -753,7 +758,7 @@ dl.dublincore dd.caption {
     margin-bottom: .3em;
     padding: .3em 0;
     font-size: 1em;
-    background-color: #fff;
+    background-color: transparent;
     border-bottom: 1px solid #aaa;
     color: #333;
     font-weight: bold;
@@ -794,21 +799,25 @@ table.instruments tbody td {
 table.listing {
 
     border-spacing: 0;
+    padding: 0em 1em 1em 2em;
 }
 
 .fullpage table.listing {
     width: 100%;
-    font-size: 105%;
+    font-size: 100%;
 }
 
-table.listing th {
+table.listing th, table.listing thead {
     text-align: left;
     padding: 0 14em .1em 0;
-    font-size: 1em;
+    font-size: 0.8125em;
+    font-weight: normal;
 }
-table.listing th, table.listing td {
-    font-size: 0.8em;
+
+table.listing th, table.listing thead, table.listing td {
+    font-size: 0.8125em;
     border-bottom: 1px solid #dfdfdf;
+    font-weight: normal;
 }
 table.listing thead { background: #e8eaf0 }
 table.listing thead th {
@@ -852,12 +861,12 @@ table.listing tbody tr.odd { background-color: #f7f7f7 }
 table.listing tbody tr:hover { background: #f7f8fa !important }
 
 table td.error {
-    color: red; 
+    color: red;
     font-weight: bold;
 }
 
 .infos li.error{
-    color: red; 
+    color: red;
     font-weight: bold;
     font-size: 110%;
 }
@@ -909,7 +918,7 @@ img.align-left {
 #module-set .module {
     border: 1px solid #000;
     background-image: url(../images/grid_bg_2.png);
-    padding: 0.3em 0.8em 0.8em 0.8em;
+    padding: 0.3em 0.4em 0.4em 0.4em;
     margin: 3.5em 0em 1.5em 1.5em;
     -moz-border-radius: 8px 8px 8px 8px;
     -webkit-border-radius: 8px 8px 8px 8px;
@@ -919,7 +928,7 @@ img.align-left {
 #module-set .module h3 {
     color: #FFF;
     font-size: 1.1em;
-    font-weight: bold; 
+    font-weight: bold;
 }
 
 #module-set .module a:hover {
@@ -1077,7 +1086,7 @@ a.image-link {
     -moz-border-radius: 1ex;-webkit-border-radius: 1ex;border-radius: 1ex;
     background-image: url('../images/ok.png');
 }
-.markerdiv{ 
+.markerdiv{
     border: 1px solid #aaaaaa;
     margin-bottom: 1ex;
     -moz-border-radius: 1e;
@@ -1138,7 +1147,7 @@ a.image-link {
 }
 
 .icon_edit{
-    background-image: url('../images/edit_page.png'); 
+    background-image: url('../images/edit_page.png');
 }
 .icon_copy{
     background-image: url('../images/copy_page.png');
@@ -1266,42 +1275,34 @@ input,textarea{
     border-top: 1px dotted #000000;
 }
 
-.course_title {
-    border-bottom:1px solid #6A0307;
-    color:#FFFFFF;
-    background-image: url(../images/grid_bg_2.png);
-    -moz-border-radius: 8px 8px 8px 8px;
-    -webkit-border-radius: 8px 8px 8px 8px;
-    border-radius: 8px 8px 8px 8px;
-    }
-
 #module-set-left {
     float: left;
     clear: left;
     padding: 1.3em 0.8em 0.8em 0em;
     }
-    
+
 #module-set-left .module {
         border: 1px solid #000;
         background-image: url(../images/grid_bg_2.png);
-        padding: 0em 0.8em 0em 0.8em;
+        padding: 0.3em 0.4em 0.4em 0.4em;
         margin: 0em 0em 1.5em 0em;
         -moz-border-radius: 8px 8px 8px 8px;
         -webkit-border-radius: 8px 8px 8px 8px;
         border-radius: 8px 8px 8px 8px;
         }
-        
+
 #module-set-left .module h3 {
             color: #FFF;
             font-size: 1.1em;
             font-weight: bold;
             }
 
-#module-set-left .module ul {        
-        margin: 0em 0em 0.8em 0.5em;
-        font-size: 1em;
+#module-set-left .module ul {
+        margin: 0em 0em 0em 0.5em;
+        font-size: 0.8125em;
         background-color: #FFF;
         color: #0000 ;
+        font-weight: bold;
         }
 
 #module-set-left .module a {
@@ -1312,4 +1313,55 @@ input,textarea{
     float: right;
     width:68%;
     }
-            
\ No newline at end of file
+
+.course {
+    margin: 0em 0em 2em 0em;
+    background-color: #FFF;
+    -moz-border-radius: 8px 8px 8px 8px;
+    -webkit-border-radius: 8px 8px 8px 8px;
+    border-radius: 8px 8px 8px 8px;
+
+    }
+
+
+.course_title {
+    color:#FFFFFF;
+    background-image: url(../images/grid_bg_2.png);
+    -moz-border-radius: 8px 8px 0px 0px;
+    -webkit-border-radius: 8px 8px 0px 0px;
+    border-radius: 8px 8px 0px 0px;
+    padding: 0.3em 0.8em 0.3em 0.8em;
+    font-weight: bold;
+    font-size: 1.2em;
+    }
+
+.course_media {
+    background-color: transparent;
+    background-image: url(../images/grid_bg_2.png);
+    margin: 0em 0em 2em 0em;
+    -moz-border-radius: 8px 8px 8px 8px;
+    -webkit-border-radius: 8px 8px 8px 8px;
+    border-radius: 8px 8px 8px 8px;
+/*     border: 2px solid #CCC; */
+    }
+
+.media_infos {
+    background-color: #FFF;
+    padding: 0.3em 0.8em 0.3em 0.8em;
+    }
+
+.video {
+    background-color: transparent;
+    margin-left: auto;
+    margin-right: auto;
+    width: 360px;
+    padding: 1em 1em 1em 1em;
+    }
+
+.audio {
+    padding: 1em 1em 1em 1em;
+    background-color: transparent;
+    margin-left: auto;
+    margin-right: auto;
+    width: 550px;
+    }
index a6a6f4bd4b681458773e7069454c4e8b35edab88..1af2dc2db26c65b62b2f7110a711e85d9418cef4 100755 (executable)
@@ -102,7 +102,7 @@ class Course(Model):
     title           = CharField(_('title'), max_length=255)
     description     = CharField(_('description'), max_length=255, blank=True)
     category        = ForeignKey('Category', related_name='course', verbose_name=_('category'))
-    public_id       = CharField(_('public_id'), max_length=255, blank=True)
+    code            = CharField(_('code'), max_length=255)
 
     def __str__(self):
         return self.department.name + ' - '  + self.category.name + ' - ' + self.title
@@ -259,9 +259,13 @@ class IEJ(Model):
 
 class Training(Model):
 
+    code            = CharField(_('code'), max_length=255)
     name            = CharField(_('name'), max_length=255, blank=True)
     courses         = ManyToManyField('Course', related_name="training", verbose_name=_('courses'),
                                         blank=True, null=True)
+    synthesis_note  = BooleanField(_('synthesis note'))
+    obligation      = BooleanField(_('obligation'))
+
 
     def __str__(self):
         return self.name
@@ -274,6 +278,7 @@ class Training(Model):
 class Procedure(Model):
 
     name           = CharField(_('name'), max_length=255, blank=True)
+    code           = CharField(_('code'), max_length=255)
 
     def __str__(self):
         return self.name
@@ -286,6 +291,7 @@ class Procedure(Model):
 class Speciality(Model):
 
     name           = CharField(_('name'), max_length=255, blank=True)
+    code           = CharField(_('code'), max_length=255)
 
     def __str__(self):
         return self.name
@@ -295,6 +301,19 @@ class Speciality(Model):
         verbose_name = _('speciality')
 
 
+class Oral(Model):
+
+    name           = CharField(_('name'), max_length=255, blank=True)
+    code           = CharField(_('code'), max_length=255)
+
+    def __str__(self):
+        return self.name
+
+    class Meta:
+        db_table = app_label + '_' + 'oral'
+        verbose_name = _('oral')
+
+
 class Student(Model):
 
     user            = ForeignKey(User, related_name='student', verbose_name=_('user'), unique=True )
@@ -308,9 +327,10 @@ class Student(Model):
                                  verbose_name=_('oral speciality'), blank=True, null=True)
     written_speciality = ForeignKey('Speciality', related_name='student_written_spe',
                                 verbose_name=_('written speciality'), blank=True, null=True)
-    oral_1          = CharField(_('oral 1'), max_length=255, blank=True)
-    oral_2          = CharField(_('oral 2'), max_length=255, blank=True)
-
+    oral_1          = ForeignKey('Oral', related_name='student_oral_1',
+                                 verbose_name=_('oral 1'), blank=True, null=True)
+    oral_2          = ForeignKey('Oral', related_name='student_oral_2',
+                                 verbose_name=_('oral 1'), blank=True, null=True)
 
     def __str__(self):
         return self.user.username
diff --git a/teleforma/templates/postman/archives.html b/teleforma/templates/postman/archives.html
new file mode 100644 (file)
index 0000000..ab3d94a
--- /dev/null
@@ -0,0 +1,8 @@
+{% extends "postman/base_folder.html" %}
+{% load i18n %}
+{% block pm_folder_title %}{% trans "Archived Messages" %}{% endblock %}
+{% block pm_archive_button %}{% endblock %}
+{% block pm_undelete_button %}{% endblock %}
+{% block pm_footer_info %}
+<p>{% trans "Messages in this folder will never be removed. You can use this folder for long term storage." %}</p>
+{% endblock %}
\ No newline at end of file
diff --git a/teleforma/templates/postman/base.html b/teleforma/templates/postman/base.html
new file mode 100644 (file)
index 0000000..5213340
--- /dev/null
@@ -0,0 +1,20 @@
+{% extends "telemeta/base.html" %}
+{% load i18n %}{% load postman_tags %}
+
+{% block title %}
+<img src="{% url telemeta-images "item.png" %}" alt="item" style="vertical-align:middle" />
+{% trans "Messages"%}
+{% endblock %}
+
+
+
+{% block title_buttons %}
+<div id="postman_menu" style="padding-left: 20px;">
+{% postman_unread as unread_count %}
+<a href="{% url postman_inbox %}" class="component_icon button icon_edit">{% trans "Inbox" %}{% if unread_count %} <strong>({{ unread_count }})</strong>{% endif %}</a></li>
+<a href="{% url postman_sent %}" class="component_icon button icon_edit">{% trans "Sent Messages" %}</a>
+<a href="{% url postman_write %}" class="component_icon button icon_edit">{% trans "Write" %}</a>
+<a href="{% url postman_archives %}" class="component_icon button icon_edit">{% trans "Archives" %}</a>
+<a href="{% url postman_trash %}" class="component_icon button icon_edit">{% trans "Trash" %}</a>
+</div>
+{% endblock %}
\ No newline at end of file
diff --git a/teleforma/templates/postman/base_folder.html b/teleforma/templates/postman/base_folder.html
new file mode 100644 (file)
index 0000000..b481c1e
--- /dev/null
@@ -0,0 +1,65 @@
+{% extends "postman/base.html" %}
+{% load i18n postman_tags %}{% load pagination_tags %}
+
+{% block content %}
+
+<div id="postman">
+<h1>{% block pm_folder_title %}{% endblock %}</h1>
+{% autopaginate pm_messages %}
+{% if invalid_page %}
+<p>{% trans "Sorry, this page number is invalid." %}</p>
+{% else %}
+
+{% if pm_messages %}
+<br /><br />
+{% block pm_by_modes %}<div id="pm_by_modes">
+<a href="{{ by_conversation_url }}" class="component_icon button icon_filter">{% trans "by conversation" %}</a>
+<a href="{{ by_message_url }}" class="component_icon button icon_filter">{% trans "by message" %}</a>
+</div>{% endblock pm_by_modes %}
+<br />
+
+<form action="{% block pm_form_action %}{% endblock %}" method="post">{% csrf_token %}
+
+<table id="pm_messages" class="listing" >
+ <thead>
+  <tr>
+   <th>{% trans "Action" %}</th>
+{% block pm_sender_header %}   <th><a href="{% postman_order_by sender %}">{% trans "Sender" %}</a></th>{% endblock %}
+{% block pm_recipient_header %}   <th><a href="{% postman_order_by recipient %}">{% trans "Recipient" %}</a></th>{% endblock %}
+   <th><a href="{% postman_order_by subject %}">{% trans "Subject" %}</a></th>
+   <th><a href="{% postman_order_by date %}">{% block pm_date %}{% trans "Date" %}{% endblock %}</a></th>
+  </tr>
+ </thead>
+ <tbody>{% for message in pm_messages %}
+  <tr>
+   <td><input type="checkbox" {% if by_conversation and message.thread_id %}name="tpks" value="{{ message.thread_id }}"{% else %}name="pks" value="{{ message.pk }}"{% endif %} /></td>
+{% block pm_sender_cell %}   <td>{{ message.obfuscated_sender|or_me:user }}{% if message.count %} ({{ message.count }}){% endif %}</td>{% endblock %}
+{% block pm_recipient_cell %}   <td>{{ message.obfuscated_recipient|or_me:user }}{% if message.count %} ({{ message.count }}){% endif %}</td>{% endblock %}
+   <td>{% if message.is_new %}<strong>{% endif %}{% if message.is_replied %}<em>{% endif %}
+{% block pm_subject %}
+    <a href="{% if by_conversation and message.thread_id %}{% url postman_view_conversation message.thread_id %}{% else %}{{message.get_absolute_url }}{% endif %}?next={{ current_url|urlencode }}">
+    {% include "postman/inc_subject_ex.html" %}
+    </a>
+{% endblock %}
+   {% if message.is_replied %}</em>{% endif %}{% if message.is_new %}</strong>{% endif %}</td>
+   <td>{{ message.sent_at|compact_date:_("g:i A,M j,n/j/y") }}</td>
+  </tr>{% endfor %}
+ </tbody>
+</table>
+
+<br />
+{% block pm_form_buttons %}<span id="pm_buttons">
+{% block pm_delete_button %}<button type="submit" onclick="this.form.action='{% url postman_delete %}'">{% trans "Delete" %}</button>{% endblock %}
+{% block pm_archive_button %}<button type="submit" onclick="this.form.action='{% url postman_archive %}'">{% trans "Archive" %}</button>{% endblock %}
+{% block pm_undelete_button %}<button type="submit" onclick="this.form.action='{% url postman_undelete %}'">{% trans "Undelete" %}</button>{% endblock %}
+</span>{% endblock %}
+
+</form>
+{% paginate %}
+{% else %}
+<p>{% trans "No messages." %}</p>
+{% endif %}
+{% endif %}
+{% block pm_footer_info %}{% endblock %}
+</div>
+{% endblock content %}
\ No newline at end of file
diff --git a/teleforma/templates/postman/base_write.html b/teleforma/templates/postman/base_write.html
new file mode 100644 (file)
index 0000000..d454e9e
--- /dev/null
@@ -0,0 +1,23 @@
+{% extends "postman/base.html" %}
+{% load i18n %}
+{% block extrahead %}{{ block.super }}
+{% if is_autocompleted %}
+{# using the available admin jQuery is enough #}
+<script type="text/javascript" src="{% load adminmedia %}{% admin_media_prefix %}js/jquery.min.js"></script>
+{# <script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.min.js"></script> #}
+<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.autocomplete.min.js"></script>
+<link href="{{ MEDIA_URL }}css/jquery.autocomplete.css" type="text/css" media="all" rel="stylesheet" />
+{% endif %}
+{% endblock %}
+{% block content %}
+<div id="postman">
+<h1>{% block pm_write_title %}{% endblock %}</h1>
+<form action="{% if next_url %}?next={{ next_url|urlencode }}{% endif %}" method="post">{% csrf_token %}
+<table>
+{% block pm_write_recipient %}{% endblock %}
+{{ form.as_table }}
+</table>
+<button type="submit">{% trans "Send" %}</button>
+</form>
+</div>
+{% endblock %}
\ No newline at end of file
diff --git a/teleforma/templates/postman/email_user.txt b/teleforma/templates/postman/email_user.txt
new file mode 100644 (file)
index 0000000..c62111b
--- /dev/null
@@ -0,0 +1,20 @@
+{% load i18n %}{% autoescape off %}{% trans "Dear user," %}
+{% if action == 'rejection' %}
+{% blocktrans with object.sent_at|date:"DATETIME_FORMAT" as date and object.obfuscated_recipient as recipient %}On {{ date }}, you asked to send a message to the user '{{ recipient }}'.{% endblocktrans %}
+
+{% trans "Your message has been rejected by the moderator" %}{% if object.moderation_reason %}{% trans ", for the following reason:" %}
+    {{ object.moderation_reason }}{% else %}.{% endif %}
+
+{% else %}{# 'acceptance' #}
+{% if object.parent_id %}{% if object.parent.sender_id == object.recipient_id %}{% blocktrans with object.parent.sent_at|date:"DATETIME_FORMAT" as date and object.obfuscated_sender as sender %}On {{ date }}, you sent a message to the user '{{ sender }}'.{% endblocktrans %}
+{% trans "Your correspondent has given you an answer." %}
+{% else %}{% blocktrans with object.obfuscated_sender as sender %}You have received a copy of a response from the user '{{ sender }}'.{% endblocktrans %}
+{% endif %}
+{% else %}{% blocktrans with object.obfuscated_sender as sender %}You have received a message from the user '{{ sender }}'.{% endblocktrans %}
+{% endif %}
+{% endif %}{# 'acceptance' #}
+{% trans "Thank you again for your interest in our services." %}
+{% trans "The site administrator" %}
+
+{% blocktrans %}Note: This message is issued by an automated system.
+Do not reply, this would not be taken into account.{% endblocktrans %}{% endautoescape %}
\ No newline at end of file
diff --git a/teleforma/templates/postman/email_user_subject.txt b/teleforma/templates/postman/email_user_subject.txt
new file mode 100644 (file)
index 0000000..cace60c
--- /dev/null
@@ -0,0 +1 @@
+{% load i18n %}{% autoescape off %}{% blocktrans with object.subject as subject and site.name as sitename %}Message "{{ subject }}" on the site {{ sitename }}{% endblocktrans %}{% endautoescape %}
\ No newline at end of file
diff --git a/teleforma/templates/postman/email_visitor.txt b/teleforma/templates/postman/email_visitor.txt
new file mode 100644 (file)
index 0000000..23e18a9
--- /dev/null
@@ -0,0 +1,22 @@
+{% load i18n %}{% autoescape off %}{% trans "Dear visitor," %}
+{% if action == 'rejection' %}
+{% blocktrans with object.sent_at|date:"DATETIME_FORMAT" as date and object.recipient as recipient %}On {{ date }}, you asked to send a message to the user '{{ recipient }}'.{% endblocktrans %}
+
+{% trans "Your message has been rejected by the moderator" %}{% if object.moderation_reason %}{% trans ", for the following reason:" %}
+    {{ object.moderation_reason }}{% else %}.{% endif %}
+
+{% trans "As a reminder, please find below the content of your message." %}
+{% else %}{# 'acceptance' #}
+{% blocktrans with object.parent.sent_at|date:"DATETIME_FORMAT" as date and object.sender as sender %}On {{ date }}, you sent a message to the user '{{ sender }}'.{% endblocktrans %}
+{% trans "Please find below the answer from your correspondent." %}
+{% endif %}
+
+{% trans "Thank you again for your interest in our services." %}
+{% trans "For more comfort, we encourage you to open an account on the site." %}
+{% trans "The site administrator" %}
+
+{% blocktrans %}Note: This message is issued by an automated system.
+Do not reply, this would not be taken into account.{% endblocktrans %}
+-------------------------------------------------------
+{{ object.body }}
+-------------------------------------------------------{% endautoescape %}
\ No newline at end of file
diff --git a/teleforma/templates/postman/email_visitor_subject.txt b/teleforma/templates/postman/email_visitor_subject.txt
new file mode 100644 (file)
index 0000000..cace60c
--- /dev/null
@@ -0,0 +1 @@
+{% load i18n %}{% autoescape off %}{% blocktrans with object.subject as subject and site.name as sitename %}Message "{{ subject }}" on the site {{ sitename }}{% endblocktrans %}{% endautoescape %}
\ No newline at end of file
diff --git a/teleforma/templates/postman/inbox.html b/teleforma/templates/postman/inbox.html
new file mode 100644 (file)
index 0000000..6da9d25
--- /dev/null
@@ -0,0 +1,7 @@
+{% extends "postman/base_folder.html" %}
+{% load i18n %}
+{% block pm_folder_title %}{% trans "Received Messages" %}{% endblock %}
+{% block pm_undelete_button %}{% endblock %}
+{% block pm_recipient_header %}{% endblock %}
+{% block pm_date %}{% trans "Received" %}{% endblock %}
+{% block pm_recipient_cell %}{% endblock %}
diff --git a/teleforma/templates/postman/inc_subject_ex.html b/teleforma/templates/postman/inc_subject_ex.html
new file mode 100644 (file)
index 0000000..9ef1c3c
--- /dev/null
@@ -0,0 +1,22 @@
+{% comment %}
+This file is intended to be included, such as in postman/base_folder.html:
+    {% include "postman/inc_subject_ex.html" %}
+
+It provides an extended subject, as a replacement to a simple {{ message.subject }} tag.
+Enhancements are:
+* limit the subject length to a few words
+* if there is still room up to a maximum number of words, then add the very first words of the body,
+  in a grey style.
+
+Examples:
+With a total of at most 12 words, and 5 words of subject.
+With body: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod."
+
+With subject: "a subject of great interest for you":
+"a subject of great interest ... - Lorem ipsum dolor sit amet, consectetur ..."
+
+With subject: "a great interest":
+"a great interest - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed ..."
+
+{% endcomment %}{% load postman_tags %}{% with message.subject|truncatewords:5 as truncated_subject %}{{ truncated_subject }}
+{% with truncated_subject|wordcount as subject_wc %}{% with 12|sub:subject_wc as wc %}{% if message.body and wc > 0 %} - <span style="color: grey">{{ message.body|truncatewords:wc }}</span>{% endif %}{% endwith %}{% endwith %}{% endwith %}
\ No newline at end of file
diff --git a/teleforma/templates/postman/reply.html b/teleforma/templates/postman/reply.html
new file mode 100644 (file)
index 0000000..1c27076
--- /dev/null
@@ -0,0 +1,4 @@
+{% extends "postman/base_write.html" %}
+{% load i18n %}
+{% block pm_write_title %}{% trans "Reply"%}{% endblock %}
+{% block pm_write_recipient %}<tr><th><label>{% trans "Recipient" %}:</label></th><td>{{ recipient }}</td></tr>{% endblock %}
\ No newline at end of file
diff --git a/teleforma/templates/postman/sent.html b/teleforma/templates/postman/sent.html
new file mode 100644 (file)
index 0000000..0480f6a
--- /dev/null
@@ -0,0 +1,7 @@
+{% extends "postman/base_folder.html" %}
+{% load i18n %}
+{% block pm_folder_title %}{% trans "Sent Messages" %}{% endblock %}
+{% block pm_undelete_button %}{% endblock %}
+{% block pm_sender_header %}{% endblock %}
+{% block pm_date %}{% trans "Sent" %}{% endblock %}
+{% block pm_sender_cell %}{% endblock %}
diff --git a/teleforma/templates/postman/trash.html b/teleforma/templates/postman/trash.html
new file mode 100644 (file)
index 0000000..8982ea3
--- /dev/null
@@ -0,0 +1,11 @@
+{% extends "postman/base_folder.html" %}
+{% load i18n %}
+{% block pm_folder_title %}{% trans "Deleted Messages" %}{% endblock %}
+{% block pm_delete_button %}{% endblock %}
+{% block pm_archive_button %}{% endblock %}
+{% block pm_subject %}{# no link #}
+     {% include "postman/inc_subject_ex.html" %}
+{% endblock %}
+{% block pm_footer_info %}
+<p>{% trans "Messages in this folder can be removed from time to time. For long term storage, use instead the archive folder." %}</p>
+{% endblock %}
\ No newline at end of file
diff --git a/teleforma/templates/postman/view.html b/teleforma/templates/postman/view.html
new file mode 100644 (file)
index 0000000..23c7264
--- /dev/null
@@ -0,0 +1,39 @@
+{% extends "postman/base.html" %}
+{% load i18n %}{% load postman_tags %}
+{% block content %}
+<div id="postman">
+<h1>{% if pm_messages|length > 1 %}{% trans "Conversation" %}{% else %}{% trans "Message" %}{% endif %}</h1>
+<br /><br />
+{% for message in pm_messages %}
+<div class="pm_message{% if message.is_pending %} pm_pending{% endif %}{% if message.is_rejected %} pm_rejected{% endif %}{% if message.sender == user and message.sender_archived or message.recipient == user and message.recipient_archived %} pm_archived{% endif %}{% if message.sender == user and message.sender_deleted_at or message.recipient == user and message.recipient_deleted_at %} pm_deleted{% endif %}{% if message.recipient == user and not message.read_at %} pm_unread{% endif %}">
+ <div class="pm_header">
+  <span class="pm_sender">{{ message.obfuscated_sender|or_me:user }}</span> &raquo;
+  <span class="pm_recipient">{{ message.obfuscated_recipient|or_me:user }}</span> |
+  <span class="pm_date">{{ message.sent_at|date:"DATETIME_FORMAT"}}</span> |
+  <span class="pm_subject">{{ message.subject }}</span>
+{% if message.is_rejected %}  <div class="pm_status">{% trans "Rejected" %}{% if message.moderation_reason %}{% trans ":" %} {{ message.moderation_reason }}{% endif %}</div>{% endif %}
+ </div>
+ <hr />
+ <div class="pm_body">{{ message.body|linebreaksbr }}</div>
+</div>
+<br />
+{% if forloop.last %}
+<form action="" method="post">{% csrf_token %}
+<input type="hidden" {% if message.thread_id %}name="tpks" value="{{ message.thread_id }}"{% else %}name="pks" value="{{ message.pk }}"{% endif %} />
+<a href="{{ next_url }}">{% trans "Back" %}</a>
+<span id="pm_buttons">
+<button type="submit" onclick="this.form.action='{% url postman_delete %}?next={{ next_url|urlencode }}'">{% trans "Delete" %}</button>
+{% if not archived %}<button type="submit" onclick="this.form.action='{% url postman_archive %}?next={{ next_url|urlencode }}'">{% trans "Archive" %}</button>{% endif %}
+</span>
+{% if reply_to_pk %}<a href="{% url postman_reply reply_to_pk %}?next={{ next_url|urlencode }}">{% trans "Reply" %}</a>{% endif %}
+</form>
+{% if reply_to_pk %}<hr />
+<h2>{% trans 'Reply' %}</h2>
+<form action="{% url postman_reply reply_to_pk %}?next={{ next_url|urlencode }}" method="post">{% csrf_token %}
+<div id="pm_reply">{{ form.body }}</div>
+<button type="submit">{% trans 'Reply' %}</button>
+</form>{% endif %}
+{% endif %}
+{% endfor %}
+</div>
+{% endblock %}
\ No newline at end of file
diff --git a/teleforma/templates/postman/write.html b/teleforma/templates/postman/write.html
new file mode 100644 (file)
index 0000000..1d52b03
--- /dev/null
@@ -0,0 +1,3 @@
+{% extends "postman/base_write.html" %}
+{% load i18n %}
+{% block pm_write_title %}{% trans "Write"%}{% endblock %}
\ No newline at end of file
index 0113db0c49c5b39683232208a588afdb16fc539d..c07814d70ab94909cc09f6e5328abd441cb8f16e 100644 (file)
@@ -9,12 +9,10 @@
 
 {% block course %}
 
-<table class="listing" style="width:100%;margin-top: 1em">
-<tr>
-<td class="course_title" style="font-size: 120%;">{{ course.title }}{% if course.description %} - {{ course.description }}{% endif %}</td>
-</tr>
-</table>
+<div class="course">
 
+<div class="course_title">{{ course.title }}{% if course.description %} - {{ course.description }}{% endif %}
+</div>
 
 {% block document %}
 {% with course as course and %}
@@ -34,5 +32,5 @@
 {% endwith %}
 {% endblock %}
 
-
+</div>
 {% endblock course %}
index 12903412e615354908e2d0c9d19f3297f50022fa..521b91dbdd46e399cc2022822f24a73bf84e68dc 100644 (file)
     {% block course %}
 
     {% for course in object_list %}
-
-        <table class="listing" style="width:100%;margin-top: 1em">
-            <tr>
-            <td class="course_title" style="font-size: 120%;">{{ course.title }}{% if course.description %} - {{ course.description }}{% endif %}</td>
-            </tr>
-        </table>
+      <div class="course">
+        <div class="course_title">{{ course.title }}{% if course.description %} - {{ course.description }}{% endif %}
+        </div>
 
         {% block document %}
         {% with course as course and %}
@@ -69,7 +66,7 @@
         {% include "teleforma/inc/conference_list.html" %}
         {% endwith %}
         {% endblock %}
-
+      </div>
 
     {% endfor %}
     {% endblock course %}
index 94d2d666d6dfbac950ae7c69e8aefdbb045926ba..92c595826a36a7c189bfdb6c548f1046959ef729 100644 (file)
@@ -13,7 +13,7 @@
     <tbody>
         {% for media in course.media.all %}
             <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
-            <td><a href="{% url telemeta-item-detail media.item.public_id %}">{{ media.item.title }}</a></td>
+            <td><a href="{% url teleforma-media-detail media.id %}">{{ media.item.title }}</a></td>
             <td>{{ media.item.description }}</td>
             <td>{{ media.date_added }}</td>
             </tr>
index d58ce6bdc9b66cc0bd8613dfe24be5afc79dba8d..ccabd00b148dcc39a6db3e619f9343b0d1f51cf6 100644 (file)
@@ -67,14 +67,14 @@ alt="Telemeta Powered"/>-->
  {% endif %}
 
  {% if user.is_authenticated %}
- <li><a href="{% url teleforma-messages %}" class="green">{% trans "Messages" %}</a></li>
+ <li><a href="/messages" class="green">{% trans "Messages" %}</a></li>
 
  <li><a href="{% url telemeta-users %}" class="yellow">{% trans "Users" %}</a></li>
-  
+
  <li><a href="{% url telemeta-search-criteria %}" class="orange">{% trans "Advanced search" %}</a></li>
 
  {% if user.is_staff %}
+
  <li><a href="#archives#" class="red">{% trans "Archives" %}</a>
  <ul>
  <li><a href="{% url telemeta-fonds %}">{% trans "Fonds" %}</a></li>
@@ -83,7 +83,7 @@ alt="Telemeta Powered"/>-->
  <li><a href="{% url telemeta-items %}">{% trans "Items" %}</a></li>
  </ul>
  </li>
+
  <li><a href="{% url telemeta-admin-general %}" class="violet">{% trans "Admin" %}</a></li>
  {% endif %}
 
@@ -99,7 +99,7 @@ alt="Telemeta Powered"/>-->
     <li><a href="{% url telemeta-logout %}">{% trans "Sign out" %}</a></li>
     </ul>
  </li>
+
  {% endif %}
 
 {% endif %}
@@ -133,7 +133,7 @@ alt="Telemeta Powered"/>-->
  <table width="100%">
   <tr>
    <td>
-    <a id="telemeta_powered" href="{% telemeta_url %}" target="_blank"><img src="{% url telemeta-images "logo_mini_2.png" %}" 
+    <a id="telemeta_powered" href="{% telemeta_url %}" target="_blank"><img src="{% url telemeta-images "logo_mini_2.png" %}"
    alt="Telemeta Powered"/></a>
     <p class="left">
     {% trans "Powered by" %} <a href="{% telemeta_url %}" target="_blank"><strong>Telemeta {% telemeta_version %}</strong></a><br />
index 85e5e0e8ebbcf5931e10f6f251a18a24568fd2a8..4b5418df8f423674a8b1b33daf114e392b2bd044 100644 (file)
@@ -44,11 +44,9 @@ htdocs_forma = os.path.dirname(__file__) + '/htdocs'
 
 urlpatterns = patterns('',
 
-    url(r'^desk/courses/$', ListView.as_view(model=Course, template_name='teleforma/courses.html'), name="teleforma-courses"),
-
+    url(r'^desk/courses/$', CoursesView.as_view(), name="teleforma-courses"),
     url(r'^desk/courses/(?P<pk>.*)$', CourseView.as_view(), name="teleforma-course-detail"),
-
-    url(r'^messages/$', ListView.as_view(model=Course, template_name='teleforma/courses.html'), name="teleforma-messages"),
+    url(r'^desk/medias/(?P<pk>.*)$', MediaView.as_view(), name="teleforma-media-detail"),
 
 # CSS+Images (FIXME: for developement only)
     url(r'^teleforma/css/(?P<path>.*)$', 'django.views.static.serve',
index d75a9e6a176a8729f70e318b1417bdf9ffcbd8c0..1914d7b4fd82e44cd254643583ae71742eb4f9dc 100755 (executable)
@@ -9,8 +9,7 @@ from django import template
 from django.http import HttpResponse, HttpResponseRedirect
 from django.http import Http404
 from django.shortcuts import render_to_response, redirect, get_object_or_404
-from django.views.generic import list_detail
-from django.views.generic import DetailView
+from django.views.generic import *
 from django.views.generic.base import *
 from django.conf import settings
 from django.contrib import auth
@@ -26,6 +25,8 @@ from django.contrib.syndication.views import Feed
 
 from teleforma.models import *
 
+from telemeta.views.base import *
+
 
 def render(request, template, data = None, mimetype = None):
     return render_to_response(template, data, context_instance=RequestContext(request),
@@ -39,6 +40,32 @@ class CourseView(DetailView):
     def get_context_data(self, **kwargs):
         context = super(CourseView, self).get_context_data(**kwargs)
         context['courses'] = Course.objects.all()
+        context['searches'] = Search.objects.filter(username=self.request.user)
+        return context
+
+class CoursesView(ListView):
+
+    model = Course
+    template_name='teleforma/courses.html'
+
+    def get_context_data(self, **kwargs):
+        context = super(CoursesView, self).get_context_data(**kwargs)
+        context['courses'] = Course.objects.all()
+        context['searches'] = Search.objects.filter(username=self.request.user)
         return context
 
+class MediaView(DetailView):
+
+    model = Media
+    template_name='teleforma/course_media.html'
 
+    def get_context_data(self, **kwargs):
+        context = super(MediaView, self).get_context_data(**kwargs)
+        context['courses'] = Course.objects.all()
+        media = self.get_object()
+        view = ItemView()
+        context['mime_type'] = view.item_analyze(media.item)
+        context['course'] = media.course
+        context['item'] = media.item
+        context['searches'] = Search.objects.filter(username=self.request.user)
+        return context