summaryrefslogtreecommitdiff
path: root/template/default/prog_timeline.html
blob: c04091803859367dbde131b4cc72f8800abf5c97 (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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
	<meta http-equiv="refresh" content="600; URL=vdradmin.pl?aktion=prog_timeline" />
	<meta http-equiv="content-type" content="text/html;charset=<%! ISO-8859-1 !%>" />
	<title>VDRAdmin-AM - <%! Timeline !%></title>
	<link href="style.css" rel="stylesheet" media="screen" type="text/css" />
	<tmpl_if usercss>
		<link href="user.css" rel="stylesheet" media="screen" type="text/css" />
	</tmpl_if>
	<script type="text/javascript" language="JavaScript1.2" src="library.js"></script>

<?%- 
	USE date;
	show_hours = config.ZEITRAHMEN || 1; # Zeitrahmen der angezeigt werden soll in Stunden
	times      = config.TIMES.split(',\s*');
	
	# first_sec is the start time of the 24 hours interval in seconds since 1970
	# last_sec  is the end   time of the 24 hours interval in seconds since 1970
	first_sec = date.now + 1799 - show_hours * 3600
	first_sec = first_sec - first_sec % 1800;
	last_sec  = first_sec + 86400; 

	# now_sec   is the requested browser time  in seconds since 1970
	# start_sec is the start time of the table in seconds since 1970
	# end_sec   is the end   time of the table in seconds since 1970
	# end_min   is the end   time of the table in minutes since start of the table
	# diff_sec  is the offset from start_sec to now_sec
	diff_sec = now_sec % 1800; # time since last 30 minutes interval
	start_sec = now_sec - diff_sec;
	end_min = 60 * show_hours;
	end_sec = start_sec + (end_min * 60);

	name_w = 100;
	min5_h = 10;

	# Calculate suitable width for events dependent on the time interval
	# 1 hour = 60min: 300px -> 5px/min
	# 2 hours=120min: 600px -> 5px/min
	# 3 hours=180min: 720px -> 4px/min
	# 4 hours=240min: 720px -> 3px/min
	# 5 hours=300min: 600px -> 2px/min
	# 6 hours=360min: 720px -> 2px/min
	event_w = show_hours * 300; 
	IF event_w > 720; event_w = 720; END;
	px_per_min = (event_w / end_min) | format('%i');
	event_w = end_min * px_per_min;
-%?>

<!-- TimeLine: start_sec="<?% date.format(start_sec, '%H:%M:%S') %?>" now="<?% date.format(date.now, '%H:%M:%S') %?>" end_sec="<?% date.format(end_sec, '%H:%M:%S') %?>" -->
	<style type="text/css">
		table.prgname {
			border-width:1px;
			border-style:none;
			border-spacing:0px;
			padding:0px;
			margin:0px;
			text-align:left;
			table-layout:fixed;
		}
		td.prgname {
			margin: 0 2px;
			overflow:hidden;
		}

		.prgtable, .timertable {
			border-width: 1px 1px 0px 1px;
			border-style: solid none none solid;
			border-spacing:0px;
			padding:0px;
			margin:0px;
			text-align:left;
			table-layout:fixed;
			overflow:hidden;
		}
		td.prgtable,
		td.timertable {
			padding: 0 2px;
			overflow:hidden;
		}

		#bigtable { position:absolute; top:0; left: 0; z-index: 1; }
	</style>

	<script type="text/javascript" language="JavaScript">
		function Go(x) {
			if(x =="nothing") {
				document.forms[0].reset();
				document.forms[0].elements[0].blur();
				return;
			} else {
				parent.frames[1].location.href = x;
				document.forms[0].elements[0].blur();
			}
		}
	</script>
<?% IF config.TL_TOOLTIP %?>
	<script type="text/javascript" language="JavaScript1.2" src="infobox.js"></script>
<?% END %?>
</head>

<body id="prog_timeline">
<?% IF config.TL_TOOLTIP %?>
	<div id="infodiv" style="position:absolute; visibility:hidden; z-index:20; top:0px; left:0px;"></div>
	<script language="JavaScript" type="text/javascript">
	<?%
		FOREACH name = shows2.keys.nsort;
			counter = 0;
			FOREACH show = shows2.${name};
	%?>
				maketip("VDR-<?% show.vdr_id %?>-<?% counter %?>", "<?% show.title %?>", "<%! Duration: !%> <?% date.format(show.start, '%H:%M') %?> - <?% date.format(show.stop, '%H:%M') %?> (<?% (show.stop - show.start) / 60 %?> <%! min !%>)" );
	<?%
				counter = counter + 1;
			END;
		END;
	%?>
	</script>
<?% END %?>

	<form action="<?% nowurl %?>" method="get" name="FormName">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="heading">
			<tr>
				<td class="col_title">
					<h1><?% now %?>&nbsp;<%! o'clock !%></h1>
				</td>
				<td class="col_other">
					<%! What's on: !%>&nbsp;
					<select name="Auswahl" class="submit" onChange="Go(this.form.Auswahl.options[this.form.Auswahl.options.selectedIndex].value)" width="100">
						<option value="<?% nowurl %?>"></option>
<?% select_now = (now == date.format(date.now, '%H:%M')) %?>
						<option value="<?% nowurl %?>" <?% "selected" IF select_now %?>><%! now !%></option>
<?% FOREACH timer = times %?>
	<?% timer_o_dopp = timer | replace('\:', '') %?>
						<option value="<?% nowurl %?>&amp;time=<?% timer_o_dopp %?>" <?% "selected" IF !select_now && (now == timer) %?>><?% timer %?></option>
<?% END %?>
					</select>
					&nbsp;|&nbsp;<%! at: !%>&nbsp;
					<input type="text" name="time" size="5" value="<?% now %?>" />
					&nbsp;<%! o'clock !%>
					<input type="hidden" name="aktion" value="prog_timeline" />
				</td>
			</tr>
		</table>


		<div id="content">
<!-- TimeLine Table TOP -->
 			<table width="<?% event_w + name_w %?>" border="0" cellspacing="0" cellpadding="0" class="bigtable list">
				<tr class="heading">
					<td colspan="3">
						<h2><?% date.format(start_sec, '%A, %H:%M') %?>&nbsp;<%! o'clock !%>&nbsp;<%! to !%>&nbsp;<?% date.format(end_sec, '%H:%M') %?>&nbsp;<%! o'clock !%></h2>
						<br/>
					</td>
					<td class="col_navi">
<?% IF start_sec < first_sec + 1800 %?>
							<img src="bilder/pfeile_nachlinks_soft.png" border="0" />
<?% 
	ELSE;
		diff_sec = start_sec - end_min * 60;
		IF (diff_sec < first_sec);
			diff_sec = first_sec;
		END;
%?>
							<a href="<?% nowurl %?>&amp;time=<?% date.format(diff_sec, '%H:%M') %?>">
								<img src="bilder/pfeile_nachlinks.png" border="0" />
							</a>
<?% END %?>
<?% IF end_sec > last_sec - 1800 %?>
							<img src="bilder/pfeile_nachrechts_soft.png" border="0" />
<?% 
	ELSE;
		diff_sec = end_sec;
		IF (diff_sec > last_sec - end_min * 60 - 1800);
			diff_sec = last_sec - end_min * 60;
		END;
%?>
						<a href="<?% nowurl %?>&amp;time=<?% date.format(diff_sec, '%H:%M') %?>">
							<img src="bilder/pfeile_nachrechts.png" border="0" />
						</a>
<?% END %?>
					</td>
				</tr>
				<tr id="row_timeline" class="row_even">
					<td colspan="4">
						<table border="0" cellpadding="0" cellspacing="0" width="<?% name_w + event_w %?>" class="timestable">
							<tr>
								<td><img src="bilder/spacer.gif" width="<?% name_w %?>" height="1" border="0" /></td>
<?% minute = 0 %?>
<?% WHILE minute < end_min %?>
								<td colspan="6" class="<?% minute % 60 ? 'color1' : 'color2' %?>">
									<img src="bilder/spacer.gif" width="<?% px_per_min * 30 %?>" height="1" border="0" /><br />
	<?% zeit = start_sec + (minute * 60) %?>
									<span class="date_time"><?% date.format(zeit, '%H:%M') %?></span>
								</td>
	<?% minute = minute + 30 %?> 
<?% END %?>
							</tr>
							<tr>
								<td><img src="bilder/spacer.gif" width="<?% name_w %?>" height="1" border="0" /></td>
<?% minute = 0 %?>
<?% WHILE minute < end_min %?>
								<td width="<?% px_per_min * 5 %?>" height="<?% min5_h %?>" class="<?% minute % 10 ? 'color1' : 'color2' %?>">
 									<img src="bilder/spacer.gif" width="<?% px_per_min * 5 %?>" height="1" border="0" /><br />
								</td>
	<?% minute = minute + 5 %?> 
<?% END %?>
							</tr>
						</table>

						<table border="0" cellpadding="0" cellspacing="0" width="<?% name_w + event_w %?>" class="prgname">
<?% b = 0;
	FOREACH name = shows.keys.nsort; 
		b = b + 1 %?>
							<tr>
<!-- Channel: "<?% shows.${name}.first.progname %?>" -->
								<td width="<?% name_w %?>" class="prgname <?% b % 2 ? 'color2' : 'color1' %?>">
									<img src="bilder/spacer.gif" width="<?% name_w %?>" height="1" border="0" /><br />
									<nobr><a href="<?% shows.${name}.first.proglink %?>" class="channel_name"><?% shows.${name}.first.progname %?></a></nobr>
								</td>
<!-- Events -->
								<td class="<?% b % 2 ? 'color2' : 'color1' %?>">
									<nobr>
<?%
		counter = 0;
		old_stop_minute = 0;
		FOREACH show = shows.${name}; 
			start_minute = (show.start - start_sec) / 60 | format('%i');
			stop_minute = (show.stop - start_sec) / 60 | format('%i');
			IF (start_minute >= end_min); BREAK; END;
%?>
	<!-- <?% show.vdr_id %?>-<?% counter %?>: <?% date.format(show.start, '%H:%M:%S') %?>..<?% date.format(show.stop, '%H:%M:%S') %?> "<?% show.title %?>" -->
	<!-- ---- old_stop	=<?% old_stop_minute %?>	end_min	=<?% end_min %?> -->
	<!-- ---- start		=<?% start_minute %?>	stop	=<?% stop_minute %?>  -->
<?%
			IF start_minute < 0; start_minute = 0; END;
			IF stop_minute  > end_min; stop_minute  = end_min; END;

			px_w = (stop_minute - start_minute) * px_per_min;

			IF show.timer; 
				td_class = "color_timer";
			ELSE;
				td_class = date.now >= show.start && date.now < show.stop ? "color_current" : "color_broadcast";
			END;
%?>	<!-- ---- start		=<?% start_minute %?>	stop	=<?% stop_minute %?> -->
<?%
			IF (start_minute >= old_stop_minute);
				IF (start_minute  > old_stop_minute + 1);
					diff = (start_minute - old_stop_minute) * px_per_min;
%?>	<!-- ---- Time gap detected: fill in space -->
									<table border="0" align="left" cellpadding="0" cellspacing="0" width="<?% diff %?>" class="prgtable">
										<tr>
											<td width="1" class="color_spacer">
												<img src="bilder/spacer.gif" width="1" height="1" border="0" /><br/>
												<nobr>
													<img src="bilder/spacer.gif" width="1" height="8" border="0" />
												</nobr>
											</td>
										</tr>
									</table>
<?% 			END 
%?>	<!-- ---- Show event title: "<?% show.title %?>" -->
									<table border="0" align="left" cellpadding="0" cellspacing="0" width="<?% px_w %?>" class="<?% show.timer ? "timertable" : "prgtable" %?>">
										<tr>
											<td width="1" class="<?% td_class %?>" <?% IF config.TL_TOOLTIP %?>onMouseOver="tip('VDR-<?% show.vdr_id %?>-<?% counter %?>'); return true;" onMouseOut="untip(); return true;"<?% END %?>>
												<img src="bilder/spacer.gif" width="1" height="1" border="0" /><br />
												<nobr>
													<?% IF show.summary %?>
														<a href="javascript:popup('./vdradmin.pl?aktion=prog_detail&amp;epg_id=<?% show.anchor %?>&amp;vdr_id=<?% show.vdr_id %?>');">
															<?% show.title %?>
														</a>
													<?% ELSE %?>
														<?% show.title %?>
													<?% END %?>
												</nobr>
											</td>
										</tr>
									</table>
<?% 
				old_stop_minute = stop_minute;
			ELSE
%?>	<!-- ---- Overlapped by previous event: ignored -->
<?% 
			END;
			counter = counter + 1;
		END %?>
									</nobr>
								</td>
							</tr>
<?% END %?>
						</table>
					</td>

				</tr>
			</table>
<!-- TimeLine Table BOTTOM -->

<?% IF (date.now >= start_sec) && (date.now < end_sec) %?>
	<?% diff = ((date.now - start_sec) / 60) | format('%i') %?> 
			<script type="text/javascript" language="JavaScript">
				var tab = document.getElementById("row_timeline");
				if (tab)
				{
					var y = tab.offsetTop;
					var h = tab.offsetHeight;
					var style = "position:absolute; "
								 + "top:" + y + "px; "
								 + "left:<?% name_w + (px_per_min * diff) + 1 %?>px; "
								 + "width:1px; "
								 + "height:" + h + "px; "
								 + "z-index:2; ";
					if (document.all)
					{
						style = style + "filter:Alpha(opacity=50); ";
					}

					document.write('<span id="timeline" style="' + style + '">');
					document.write('   <img src="bilder/spacer.gif" width="1" height="1" border="0" />');
					document.write('</span>');
				}
			</script>
<?% END %?>
		</div>
	</form>
</body>
</html>