Browse Source

Interface for simple em

prieto 8 years ago
parent
commit
c37d753a50

+ 13
- 0
lodel/plugins/webui/interface/controllers/listing.py View File

@@ -19,6 +19,19 @@ def list_classes(request):
19 19
         allclasses = 1
20 20
     return get_response('listing/list_classes.html', my_classes=dyncode.dynclasses, allclasses = allclasses)
21 21
 
22
+##@brief Controller's function to list all types (classes) of the editorial model
23
+# @param request : the request (get or post)
24
+# @note the response is given in a html page called in get_response_function
25
+def collections(request):
26
+    return get_response('listing/collections.html', my_classes=dyncode)
27
+
28
+##@brief Controller's function to list all types (classes) of the editorial model
29
+# @param request : the request (get or post)
30
+# @note the response is given in a html page called in get_response_function
31
+def issue(request):
32
+    lodel_id = request.GET['lodel_id']
33
+    return get_response('listing/issue.html', lodel_id=lodel_id[0], my_classes=dyncode )
34
+    
22 35
 ##@brief Controller's function to display a type (class) of the editorial model
23 36
 # @param request : the request (get or post)
24 37
 # @note the response is given in a html page called in get_response_function

+ 2
- 0
lodel/plugins/webui/interface/urls.py View File

@@ -17,6 +17,8 @@ urls = (
17 17
     (r'^/test/?$', test),
18 18
     (r'^/list_classes', list_classes),
19 19
     (r'^/list_classes?$', list_classes),
20
+    (r'^/collections', collections),
21
+    (r'^/collections?$', collections),
20 22
     (r'^/show_object?$', show_object),
21 23
     (r'^/show_object_detailled?$', show_object_detailled),
22 24
     (r'^/show_class?$', show_class),

+ 31
- 0
lodel/plugins/webui/templates/listing/collections.html View File

@@ -0,0 +1,31 @@
1
+{% extends "base.html" %}
2
+{% block title %}Lodel 2 - Collections {% endblock %}
3
+{% block content %} 
4
+{% set collections = my_classes.Collection.get(None) %}
5
+
6
+<ol class="breadcrumb">
7
+  <li><a href="/{{ root_url }}/">Home</a></li>
8
+  <li class="active">Collections</li>
9
+</ol>
10
+<h1 class="h1_lodel">Collections </h1>
11
+    <ul>
12
+        {% for collection in collections %}
13
+        <h2>{{ collection.data('title') }}</h2>
14
+        {% set filter = ("%s = %s") % ('collection', collection.uid()) %}
15
+        {% set issues = my_classes.Issue.get((filter)) %}
16
+        <ul>
17
+        {% if issues is not none: %}
18
+            {% for issue in issues %}
19
+                <li>
20
+                    <h3><a href="/{{ root_url }}/issue?lodel_id={{ issue.uid() }}"> {{ issue.data('title') }}</a></h3>
21
+                    <h3>{{ issue.data('subtitle') }}</h3>
22
+                    {% set author_ids = my_classes.get_authors(issue) %}
23
+                    {% set authors = my_classes.Person.get(("%s in (%s)") % ("lodel_id", author_ids|join(','))) %}
24
+                    <p>Authors : {% for author in authors %} {{ author.data('firstname')}} {{ author.data('lastname')}} ; {% endfor %} </p>
25
+                </li>
26
+            {% endfor %}
27
+        {% endif %}
28
+        </ul>
29
+        {% endfor %}
30
+     <ul>
31
+{% endblock %} 

+ 87
- 0
lodel/plugins/webui/templates/listing/issue.html View File

@@ -0,0 +1,87 @@
1
+{% extends "base.html" %}
2
+{% block title %}Lodel 2 - Issue {{ lodel_id }} {% endblock %}
3
+{% set uidfield = my_classes.Issue.uid_fieldname()[0] %}
4
+{% set objects = my_classes.Issue.get(('%s = %s') % (uidfield, lodel_id)) %}
5
+{% set person_class = leapi.name2class('Person') %}
6
+{% set obj = objects.pop() %}
7
+{% block content %} 
8
+<ol class="breadcrumb">
9
+  <li><a href="/{{ root_url }}/">Home</a></li>
10
+  <li><a href="/{{ root_url }}/collection">Collections</a></li>
11
+  <li class="active"><a href="/{{ root_url }}/issue?lodel_id={{ lodel_id}}">Collection {{ obj.data('collection') }} - Issue {{lodel_id}}</a></li>
12
+</ol>
13
+<h1 class="h1_lodel">Issue {{ obj.data('title') }} </h1>
14
+<h2>{{ obj.data('subtitle') }}</h2>
15
+{% set directors=person_class.get(("%s in (%s)") % (person_class.uid_fieldname()[0], obj.data('linked_directors')|join(','))) %}
16
+<p><strong>Directors : </strong>{% for director in directors %} <a href="/{{ root_url }}/show_object?classname=Person&lodel_id={{ director.uid() }} " target="_blank" >{{ director.data('firstname')}} {{ director.data('lastname')}}</a> ; {% endfor %}</p>
17
+{% set texts=my_classes.Text.get(("%s in (%s)") % (my_classes.Text.uid_fieldname()[0], obj.data('linked_texts')|join(','))) %}
18
+{% set parts=my_classes.Part.get(("%s in (%s)") % (my_classes.Part.uid_fieldname()[0], obj.data('linked_parts')|join(','))) %}
19
+{% if texts is not none: %}
20
+    <ul>
21
+     {% for text in texts %}
22
+          <li>
23
+              <h3><a href="/{{ root_url }}/show_object?classname={{ text.data('classname') }}&lodel_id={{ text.uid() }}" target="_blank" > {{ text.data('title') }}</a></h3>
24
+              <h4>{{ text.data('subtitle') }}</h4>
25
+              {% set authors = my_classes.Person.get(("%s in (%s)") % (person_class.uid_fieldname()[0], text.data('linked_persons')|join(','))) %}
26
+              <p>Authors : {% for author in authors %} {{ author.data('firstname')}} {{ author.data('lastname')}} ; {% endfor %} </p>
27
+            </li>
28
+    {% endfor %}
29
+</ul>
30
+{% endif %}
31
+<h2>Parties</h2>
32
+<div style="margin-left:20px;">
33
+{% if parts is not none: %}
34
+<ul>
35
+     {% for part in parts %}
36
+          <li>
37
+              <h3><a href="/{{ root_url }}/show_object?classname={{ part.data('classname') }}&lodel_id={{ part.uid() }}" target="_blank"> {{ part.data('title') }}</a></h3>
38
+              <h4>{{ part.data('subtitle') }}</h4>
39
+              {% set directors = my_classes.Person.get(("%s in (%s)") % (person_class.uid_fieldname()[0], part.data('linked_directors')|join(','))) %}
40
+              <p>Directors : {% for director in directors %} {{ director.data('firstname')}} {{ director.data('lastname')}} ; {% endfor %} </p>
41
+              {% set p_texts=my_classes.Text.get(("%s in (%s)") % (my_classes.Text.uid_fieldname()[0], part.data('linked_texts')|join(','))) %}
42
+              {% if texts is not none: %}
43
+              <ul style="margin-left:20px">
44
+                 {% for text in p_texts %}
45
+                      <li>
46
+                          <h3><a href="/{{ root_url }}/show_object?classname={{ text.data('classname') }}&lodel_id={{ text.uid() }}"  target="_blank"> {{ text.data('title') }}</a></h3>
47
+                          <h4>{{ text.data('subtitle') }}</h4>
48
+                          {% set authors = my_classes.Person.get(("%s in (%s)") % (person_class.uid_fieldname()[0], text.data('linked_persons')|join(','))) %}
49
+                          <p>Authors : {% for author in authors %} {{ author.data('firstname')}} {{ author.data('lastname')}} ; {% endfor %} </p>
50
+                        </li>
51
+                {% endfor %}
52
+              </ul>
53
+              {% endif %}
54
+              <h4>Sous-parties</h4>
55
+              {% set ss_parts=my_classes.Part.get(("%s in (%s)") % (my_classes.Part.uid_fieldname()[0], part.data('linked_parts')|join(','))) %}
56
+               {% if parts is not none: %}
57
+                <ul>
58
+                     {% for part in ss_parts %}
59
+                          <li>
60
+                              <h3><a href="/{{ root_url }}/show_object?classname={{ part.data('classname') }}&lodel_id={{ part.uid() }}" target="_blank"> {{ part.data('title') }}</a></h3>
61
+                              <h4>{{ part.data('subtitle') }}</h4>
62
+                              {% set directors = my_classes.Person.get(("%s in (%s)") % (person_class.uid_fieldname()[0], part.data('linked_directors')|join(','))) %}
63
+                              <p>Directors : {% for director in directors %} {{ director.data('firstname')}} {{ director.data('lastname')}} ; {% endfor %} </p>
64
+                              {% set sp_texts=my_classes.Text.get(("%s in (%s)") % (my_classes.Text.uid_fieldname()[0], part.data('linked_texts')|join(','))) %}
65
+                              {% if texts is not none: %}
66
+                              <ul style="margin-left:20px">
67
+                                 {% for text in sp_texts %}
68
+                                      <li>
69
+                                          <h3><a href="/{{ root_url }}/show_object?classname={{ text.data('classname') }}&lodel_id={{ text.uid() }}"  target="_blank"> {{ text.data('title') }}</a></h3>
70
+                                          <h4>{{ text.data('subtitle') }}</h4>
71
+                                          {% set authors = my_classes.Person.get(("%s in (%s)") % (person_class.uid_fieldname()[0], text.data('linked_persons')|join(','))) %}
72
+                                          <p>Authors : {% for author in authors %} {{ author.data('firstname')}} {{ author.data('lastname')}} ; {% endfor %} </p>
73
+                                        </li>
74
+                                {% endfor %}
75
+                              </ul>
76
+                              {% endif %}
77
+                    </li>
78
+                    {% endfor %}
79
+              </ul>
80
+              {% endif %}
81
+          </li>
82
+    {% endfor %}
83
+</ul>
84
+{% endif %}
85
+</div>
86
+
87
+{% endblock %} 

Loading…
Cancel
Save