source: django_apps/running/templates/user_index.html@ 312

Last change on this file since 312 was 301, checked in by Rick van der Zwet, 14 years ago
  • Login/logout
  • Revised admin form admin form
  • Property svn:mime-type set to text/html
File size: 4.3 KB
Line 
1{% load static %}
2{% get_static_prefix as STATIC_PREFIX %}
3
4<html>
5 <head>
6 <script type="text/javascript" src="{{ STATIC_PREFIX }}protovis-r3.2.js"></script>
7 <script type="text/javascript" src="{{ STATIC_PREFIX }}week-total.js"></script>
8 <script type="text/javascript" src="{{ STATIC_PREFIX }}year-total.js"></script>
9 <style type="text/css">
10 #fig2 {
11 width: 860px;
12 height: 150px;
13 }
14 #fig {
15 width: 860px;
16 height: 390px;
17 }
18 </style>
19
20 </head>
21 <body>
22 <table>
23 <tr>
24 <td>
25 <a href="{% url running.views.index %}">User Overview</a>
26 </td>
27 <td>-</td>
28 <td>
29 {% if user.is_authenticated %}
30<form method="post" action="{% url logout %}">
31 <input type="submit" value="logout" />
32 {% csrf_token %}
33 <input type="hidden" name="next" value="{{ request.path }}" />
34</form>
35 {% else %}
36<form method="post" action="{% url login %}">
37 {% csrf_token %}
38 <table>
39 <tr>
40 <td><input type="text" name="username" /></td>
41 <td><input type="password" name="password" /></td>
42 <td><input type="submit" value="login" /></td>
43 </tr>
44 </table>
45 <input type="hidden" name="next" value="{{ request.path }}" />
46</form>
47{% endif %}
48</td>
49</tr>
50</table>
51 <h1>Welcome {{ user.username|default:"New User" }}</h1>
52 <a href="#results">Add new results</a>
53
54 <div id="center">
55 <h3>Week totals in KM</h3>
56 <div id="fig2">
57 <div id="week-statistics"> </div>
58 </div>
59 <h3>Accumulated Totals in KM</h3>
60 <div id="fig">
61 <div style="text-align:right;padding-right:20;">
62 <input checked id="scale" type="checkbox" onchange="vis.render()"
63 ><label for="scale">Scale to fit</label>
64 </div>
65 <div id="total-statistics"> </div>
66 </div>
67 <h3>Avergage Speed in KM</h3>
68 <div id="fig">
69 <div style="text-align:right;padding-right:20;">
70 <input checked id="scale" type="checkbox" onchange="vis.render()"
71 ><label for="scale">Scale to fit</label>
72 </div>
73 <div id="speed-statistics"> </div>
74 </div>
75 </div>
76 {% if user.is_authenticated %}
77 {% if user.id == runninguser.id %}
78 <form method="post" action="">
79 {% csrf_token %}
80 {{ formset.management_form }}
81 <table>
82 {% for form in formset %}
83 {% if forloop.first %}
84 <tr>
85 {% for field in form.visible_fields %}
86 <th>{{ field.label_tag }}</th>
87 {% endfor %}
88 </tr>
89 {% endif %}
90 <tr>
91 {% for field in form.visible_fields %}
92 {% if forloop.first %}
93 {% for hidden in form.hidden_fields %}
94 {{ hidden }}
95 {% endfor %}
96 {% endif %}
97
98 <td>{{ field.errors }}{{ field }}</td>
99 {% endfor %}
100 </tr>
101 {% endfor %}
102 </table>
103 <input type="submit" value="Submit Values"/>
104 </form>
105 {% else %}
106 Bewerk je eigen gegevens <a href="{% url running.views.user_index user.username %}">hier</a>.
107 {% endif %}
108 {% else %}
109 Login om je gegevens toe te voegen.
110 {% endif %}
111 <a name="results" />
112
113
114<script type="text/javascript+protovis">
115 // Graph Week totals
116 var xhr = new XMLHttpRequest();
117 xhr.open('GET', '{% url running.views.json_user_column runninguser.id %}', false);
118 xhr.send(null);
119 var myData = JSON.parse(xhr.responseText, function (key, value) {
120 return value;
121 });
122 weekTotalGraph(myData, 'week-statistics');
123</script>
124
125
126<script type="text/javascript+protovis">
127 // Graph Year totals
128 var xhr = new XMLHttpRequest();
129 xhr.open('GET', '{% url running.views.json_user_total runninguser.id %}', false);
130 xhr.send(null);
131
132 var data = JSON.parse(xhr.responseText, function (key, value) {
133 var type;
134 if ( value != null) {
135 if ( key === 'x') {
136 return new Date(value);
137 }
138 }
139 return value;
140 });
141 yearTotalGraph(data, 'total-statistics');
142</script>
143
144
145<script type="text/javascript+protovis">
146 // Graph Average Speed
147 var xhr = new XMLHttpRequest();
148 xhr.open('GET', '{% url running.views.json_user_speed runninguser.id %}', false);
149 xhr.send(null);
150
151 var data = JSON.parse(xhr.responseText, function (key, value) {
152 var type;
153 if ( value != null) {
154 if ( key === 'x') {
155 return new Date(value);
156 }
157 }
158 return value;
159 });
160 yearTotalGraph(data, 'speed-statistics');
161</script>
162 </body>
163</html>
Note: See TracBrowser for help on using the repository browser.