summaryrefslogtreecommitdiffstats
path: root/hyperkitty/templates/recent_activities.html
blob: 84a8d5d1751d6a64811178255495b99194fd340d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
{% extends "base.html" %}
{% load hk_generic %}
{% load gravatar %}
{% load storm %}

{% block additional_stylesheets %}
<link rel="stylesheet" type="text/css" media="all" href="{{ STATIC_URL }}css/stats.css" />
{% endblock %}

{% block content %}

<section id="recent_activities">
	<section id="graph">
		<div id="fig">
			<script type="text/javascript+protovis" >

				var dates = ["{{dates_string|join:'","'}}"];

				var data = {{evolution}},
				w = 500,
				h = 300,
				x = pv.Scale.ordinal(pv.range(32)).splitBanded(0, w, 4/5),
				y = pv.Scale.linear(0, {{evolution|length}}).range(0, h);

				var vis = new pv.Panel()
				.width(w)
				.height(250)
				.bottom(60)
				.left(30)
				.right(5)
				.top(5);

				var bar = vis.add(pv.Bar)
				.data(data)
				.event("click", function(n) self.location = "{% url archives mlist_fqdn=list_address %}" + dates[this.index] + "/")
				.left(function() x(this.index))
				.width(x.range().band)
				.bottom(0)
				.height(y);

				bar.anchor("bottom").add(pv.Label)
				.textMargin(5)
				.textAlign("right")
				.textBaseline("middle")
				.textAngle(-Math.PI / 3)
				.text(function() xlabel(this.index));

				function xlabel(ind){
				if (!dates[ind -1]){
				return dates[ind];
				}
				prev = dates[ind - 1];
				cur = dates[ind];
				if (prev.substring(0,7) == cur.substring(0,7)){
				cur = cur.substring(8);
				}
				return cur;
				}

				var title = vis.add(pv.Label)
				.left(250)
				.top(16)
				.textAlign("center")
				.text("Activities on the list over the last 30 days");

				vis.add(pv.Rule)
				.data(y.ticks())
				.bottom(function(d) Math.round(y(d)) - .5)
				.strokeStyle(function(d) d ? "rgba(255,255,255,.3)" : "#000")
				.add(pv.Rule)
				.left(0)
				.width(5)
				.strokeStyle("#000")
				.anchor("left").add(pv.Label)
				.text(function(d) d.toFixed(1));

				vis.render();

			</script>
		</div>
	</section>
	<section id="most_active">
		<h2>Recently active discussions</h2>
		{% for thread in most_active_threads %}
		<!-- Start thread -->
		<div class="thread">
			<span class="thread_id">#{{forloop.counter}}</span>
			<span class="thread_title"><a name="{{thread.thread_id}}"
				href="{% url thread threadid=thread.thread_id, mlist_fqdn=list_address %}"
				>{{ thread.starting_email.subject|strip_subject:mlist }}</a></span>
			<div class="thread_stats">
				<ul class="inline-block">
					{% if thread.category_tag %}
					<li class="type type_{{thread.category_tag}}">
						<a href="{% url search_tag mlist_fqdn=list_address, tag=thread.category_tag %}"
							>{{thread.category}}</a>
					</li>
					{% endif %}
					{% if thread.category %}
					<li class="type type_{{thread.category|lower}}">
						<a href="{% url search_tag mlist_fqdn=list_address, tag=thread.category|lower %}"
							>{{thread.category}}</a>
					</li>
					{% endif %}
					{% if use_mockups %}
					<li class="likestatus neutral">
						+0/-0
					</li>
					{% endif %}
					<li class="participant">
						{{ thread.participants|length }}
					</li>
					<li class="discussion">
						{{ thread|length }}
					</li>
				</ul>
			</div>
		</div>
		<!-- End thread -->
		{% endfor %}
	</section>

	<section id="top_discussion">
		<h2>Top discussions the last 30 days</h2>
		{% for thread in top_threads %}
		<!-- Start thread -->
		<div class="thread">
			<span class="thread_id">#{{forloop.counter}}</span>
			<span class="thread_title"> <a name="{{thread.thread_id}}"
				href="{% url thread threadid=thread.thread_id, mlist_fqdn=list_address %}"
					>{{ thread.starting_email.subject|strip_subject:mlist }}</a> </span>
			<div class="thread_stats">
				<ul class="inline-block">
					{% if thread.category_tag %}
					<li class="type type_{{thread.category_tag}}">
						<a href="{% url search_tag mlist_fqdn=list_address, tag=thread.category_tag %}"
							>{{ thread.category }}</a>
					</li>
					{% endif %}
					{% if thread.category %}
					<li class="type type_{{thread.category|lower}}">
						<a href="{% url search_tag mlist_fqdn=list_address, tag=thread.category|lower %}"
							>{{ thread.category }}</a>
					</li>
					{% endif %}
					{% if use_mockups %}
					<li class="likestatus neutral">
						+0/-0
					</li>
					{% endif %}
					<li class="participant">
						{{ thread.participants|length }}
					</li>
					<li class="discussion">
						{{ thread|length }}
					</li>
				</ul>
			</div>
		</div>
		<!-- End thread -->
		{% endfor %}
	</section>

	{% if top_author %}
	<section id="discussion_marker">
		<h2>Prominent discussion maker</h2>
		{% for author in top_author %}
		<!-- Start discussion maker -->
		<div class="maker">
			<div class="inline-block maker_id">
				#{{forloop.counter}}
			</div>
			<div class="inline-block gravatar">
				{% if author.email %}
				{% gravatar_img_for_email author.email 40 %}
				<br />
				{% endif %}
			</div>
			<div class="inline-block">
				<span class="marker_name">{{author.name}}</span>
				<br />
				<span class="score">+{{author.kudos}}</span> kudos
			</div>
		</div>
		<!-- End discussion maker -->
		{% endfor %}

		<h2>Tag cloud</h2>
	</section>
	{% endif %}

	{% if threads_per_category %}
	<section id="discussion_by_topic">
		<h2>Discussion by topic the last 30 days</h2>
		{% for category, thread in threads_per_category.items %}
		<div>
			<h2 class="category type_{{category}}"> {{category}} </h2>
			<ul class="category_entry">
				{% for email in thread %}
				<li>
					{{email.title}}
				</li>
				{% endfor %}
			</ul>
		</div>
		{% endfor %}
	</section>
	{% endif %}

</section>

{% include 'threads/month_list.html' %}

{% endblock %}

{% block additionaljs %}
<script src="{{ STATIC_URL }}js/libs/protovis-d3.1.js"></script>
<script src="{{ STATIC_URL }}js/libs/jquery-ui-1.9.1.custom.min.js"></script>
<script>
    $(document).ready(function() {
        $("#archives").accordion({navigation: true});
    });
</script>
{% endblock %}