-
Notifications
You must be signed in to change notification settings - Fork 3
/
widget_calendar.html
executable file
·54 lines (48 loc) · 2.3 KB
/
widget_calendar.html
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
/**
* -----------------------------------------------------------------------------
* @package smartVISU
* @author Martin Gleiß
* @copyright 2012
* @license GPL <http://www.gnu.de>
* -----------------------------------------------------------------------------
*/
/**
* Displays the calendarlist
*
* @param unique id for this widget
* @param a title to display
* @param the number of displayed calendar-entries, default 25
* @param a color for this calendar, default grey
* @param URl of private calendar URL
*/
{% macro list(id, title, count, color, cal_url) %}
/** Design */
<div id="{{ page }}-{{ id }}-calendarlist" class="calendarlist">
{% if title %} <h2>{{ title }}</h2> {% endif %}
<ul data-role="listview">
</ul>
</div>
/** Events */
<script type="text/javascript">
$('#{{ page }}').live('pagecreate',function(event, ui){
$.getJSON('lib/calendar/service/{{ config_calendar_service }}.php?url={{ cal_url|url_encode() }}&count={{ count|default(25) }}', function(data) {
if (data instanceof Array) {
var line = '';
var sum = 1;
for (var i in data) {
ret = '<img style="background: ' + data[i].color + ';" class="icon" src="' + data[i].icon + '" />';
ret += '<div class="color" style="background: {{ color|default('#666666') }};"></div>';
ret += '<h3>' + data[i].title + '</h3>';
ret += '<p>' + data[i].weekday + ', ' + data[i].period + ' </p>';
if (data[i].where)
ret += '<span class="ui-li-count">' + data[i].where + '</span>';
ret = '<a href="' + (data[i].link ? data[i].link : '#') + '">' + ret + '</a>';
line += '<li data-icon="false">' + ret + '</li>';
}
} else
line = data;
$('#{{ page }}-{{ id }}-calendarlist ul').html(line).listview('refresh');
});
});
</script>
{% endmacro %}