[291] | 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>
|
---|
[298] | 7 | <script type="text/javascript" src="{{ STATIC_PREFIX }}week-total.js"></script>
|
---|
| 8 | <script type="text/javascript" src="{{ STATIC_PREFIX }}year-total.js"></script>
|
---|
[291] | 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 | <a href="{% url running.views.index %}">User Overview</a><p />
|
---|
| 23 | <h1>Welcome {{ user }}</h1>
|
---|
| 24 | <div id="center">
|
---|
[298] | 25 | <h3>Week totals</h3>
|
---|
[291] | 26 | <div id="fig2">
|
---|
| 27 | <div id="week-statistics"> </div>
|
---|
| 28 | </div>
|
---|
| 29 | <h3>Accumulated Totals</h3>
|
---|
| 30 | <div id="fig">
|
---|
| 31 | <div style="text-align:right;padding-right:20;">
|
---|
| 32 | <input checked id="scale" type="checkbox" onchange="vis.render()"
|
---|
| 33 | ><label for="scale">Scale to fit</label>
|
---|
| 34 | </div>
|
---|
| 35 | <div id="total-statistics"> </div>
|
---|
| 36 | </div>
|
---|
| 37 | </div>
|
---|
[298] | 38 | <form method="post" action="">
|
---|
| 39 | {% csrf_token %}
|
---|
| 40 | {{ formset.management_form }}
|
---|
| 41 | <table>
|
---|
| 42 | {% for form in formset %}
|
---|
| 43 | {% if forloop.first %}
|
---|
| 44 | <tr>
|
---|
| 45 | {% for field in form.visible_fields %}
|
---|
| 46 | <th>{{ field.label_tag }}</th>
|
---|
| 47 | {% endfor %}
|
---|
| 48 | </tr>
|
---|
| 49 | {% endif %}
|
---|
| 50 | <tr>
|
---|
| 51 | {% for field in form.visible_fields %}
|
---|
| 52 | {% if forloop.first %}
|
---|
| 53 | {% for hidden in form.hidden_fields %}
|
---|
| 54 | {{ hidden }}
|
---|
| 55 | {% endfor %}
|
---|
| 56 | {% endif %}
|
---|
| 57 |
|
---|
| 58 | <td>{{ field.errors }}{{ field }}</td>
|
---|
| 59 | {% endfor %}
|
---|
| 60 | </tr>
|
---|
| 61 | {% endfor %}
|
---|
| 62 | </table>
|
---|
| 63 | <input type="submit" value="Submit Values"/>
|
---|
| 64 | </form>
|
---|
[291] | 65 | Beheer al je gegevens <a href="{% url admin:running_user_change user.id %}">hier</a>.
|
---|
| 66 |
|
---|
[298] | 67 |
|
---|
[291] | 68 | <script type="text/javascript+protovis">
|
---|
[298] | 69 | // Graph Week totals
|
---|
| 70 | var xhr = new XMLHttpRequest();
|
---|
| 71 | xhr.open('GET', '{% url running.views.json_user_column user.id %}', false);
|
---|
| 72 | xhr.send(null);
|
---|
| 73 | var myData = JSON.parse(xhr.responseText, function (key, value) {
|
---|
| 74 | return value;
|
---|
| 75 | });
|
---|
| 76 | weekTotalGraph(myData, 'week-statistics');
|
---|
[291] | 77 | </script>
|
---|
| 78 |
|
---|
| 79 |
|
---|
| 80 | <script type="text/javascript+protovis">
|
---|
[298] | 81 | // Graph Year totals
|
---|
| 82 | var xhr = new XMLHttpRequest();
|
---|
| 83 | xhr.open('GET', '{% url running.views.json_user_total user.id %}', false);
|
---|
| 84 | xhr.send(null);
|
---|
| 85 |
|
---|
| 86 | var data = JSON.parse(xhr.responseText, function (key, value) {
|
---|
| 87 | var type;
|
---|
| 88 | if ( value != null) {
|
---|
| 89 | if ( key === 'x') {
|
---|
| 90 | return new Date(value);
|
---|
| 91 | }
|
---|
[291] | 92 | }
|
---|
[298] | 93 | return value;
|
---|
| 94 | });
|
---|
| 95 | yearTotalGraph(data, 'total-statistics');
|
---|
| 96 | </script>
|
---|
[291] | 97 | </body>
|
---|
| 98 | </html>
|
---|