Source for templates/system/timebar.html

2011-02-18 21:50:22 / 2.5 Kt

 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
{% comment %}
TimeBar component that shows selectable time ranges.
Copyright (C) 2010  Jyrki Launonen

This file is part of slavemaster.

Slavemaster is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Slavemaster is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with Slavemaster.  If not, see <http://www.gnu.org/licenses/>.

---
   Needs:
      * timebar     Instance of TimeBar-form/class.
      * timeidlist  List of id's that can be selected like "id1","id2"
{% endcomment %}
<div class="timebar">
<table>
   {% for day in timebar.tbiter %}
   {% if day.needtimes %}
   {% if not forloop.first %}</tbody>{% endif %}
   <thead>
     <tr><th></th>{% for t in day.times %}<th colspan="2">{{ t.hour }}</th>{% endfor %}<th colspan="{{ day.coldiff }}" class="timetime">Kellonaika</th></tr>
     {% if day.showminutes %}
     <tr><th></th>{% for t in day.times %}<th colspan="2">{{ t.minute }}</th>{% endfor %}<th></th></tr>
     {% endif %}
   </thead>
   <tbody>
   {% endif %}

      <tr class="timeday"><td class="timedaynumber" colspan="2">{{ forloop.counter }}</td>
      {% for t in day.slices %}
      {% if not t.is_hidden %}
         <td class="timecheck" onclick="timebar_toggle('{{ t.auto_id }}');" title="{{ t.label }}" colspan="2">{{ t }}<span></span></td>
      {% else %}
         <td class="timecheck noselect" title="(Ei vuoroa {{ t.label }})" colspan="2"></td>
         {% endif %}
      {% endfor %}
      <td class="timedayname" colspan="{{ day.coldiff|add:"1" }}">{{ day.realdate|date:"d.m.Y D" }}</td>
      </tr>
   {% if forloop.last %}</tbody>{% endif %}
   {% endfor %}
</table>
   <div id="timecontrols"></div>
</div>
<script type="text/javascript">
<!--
   MEDIA_URL = "{{ MEDIA_URL }}";
   timebar_all = [{{ timeidlist|safe }}];
   var e = document.getElementById("timecontrols");
   e.innerHTML = '<button type="button" onclick="timebar_selectAll();" id="timebar_bAll">Valitse kaikki</button>'+
   '<button type="button" onclick="timebar_selectNone();" id="timebar_bNone">Poista valinnat</button>';
   timebar_setColors();
// -->
</script>