<!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="content-type" content="text/html;<%! charset=ISO-8859-1 !%>" />
	<title>VDRAdmin - <%! Timer !%></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>
	<script type="text/javascript" language="JavaScript1.2" src="infobox.js"></script>
	<style type="text/css">
		#prgtable { border-left-width:1px; border-left-style:solid; border-right-width:1px; border-right-style:solid; }
	</style>
</head>

<body id="timer_list">
<div id="infodiv" style="position:absolute; visibility:hidden; z-index:20; top:0px; left:0px;"></div>
<script language="JavaScript" type="text/javascript">
<?%
	FOREACH timer = timers2;
%?>
	maketip("VDR-<?% timer.id %?>", "<?% timer.title %?>", "<%! Priority: !%> <?% timer.prio %?><br /><%! Lifetime: !%> <?% timer.lft %?><br /><%! Duration: !%> <?% timer.start %?> - <?% timer.stop %?> (<?% timer.duration %?><%! min !%>)" );
<?%
  END;
%?>
</script>

<?%
	datumold="";
	senderold="";
	faktor=2.2;
%?>

	<form action="<tmpl_var url>" method="get" name="FormName0">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="heading">
			<tr>
				<td class="col_left"></td>
				<td class="col_title"><h1><%! Timer !%></h1></td>
				<td class="col_other">
					<input type="submit" class="submit" value="<%! New Timer !%>" name="new_timer"/>
					<input type="hidden" name="aktion" value="timer_new_form"/>
				</td>
<tmpl_if help_url> 
				<td class="col_help">
					<a href="javascript:open_help('<tmpl_var help_url>');"><img src="bilder/help.gif" border="0" alt="help" title="<%! Help !%>" /></a>
				</td>
</tmpl_if>
				<td class="col_right"></td>
			</tr>
		</table>
	</form>

	<div id="content">
		<form action="<tmpl_var url>" method="get" name="FormName1">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" class="list">
				<tr class="heading">
					<td class="col_left"></td>
					<td><h2><tmpl_var title></h2></td>
					<td align="right">
						<select name="vdr_id" class="submit" onchange="window.open('<tmpl_var url>?aktion=timer_list&amp;timer=' + this.options[this.selectedIndex].value,'main')">
<tmpl_loop day_loop>
							<option value="<tmpl_var sortfield>" <tmpl_if current>selected</tmpl_if>><tmpl_var day></option>
</tmpl_loop>
						</select>
					</td>
					<td class="col_right"></td>
				</tr>
				<tr class="row_spacer">
					<td class="col_left"></td>
					<td colspan="2"></td>
					<td class="col_right"></td>
				</tr>
				<tr class="row_even">
					<td class="col_left"></td>
					<td colspan="2" align="center">
						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td class="color1" height="20" width="100"><img src="bilder/spacer.gif" width="100" height="1" border="0" /><br />&nbsp;</td>
<?%
	stunde=0;
	pos=0;
	WHILE stunde<24;
		stunde=stunde+1;
		ende=((stunde * 60 / faktor) +0.5 ) | format('%i');
%?>

								<td class="<?% (stunde % 2) == 1 ? 'color2' : 'color1' %?>" align="center"><img src="bilder/spacer.gif" width="<?% ende-pos %?>" height="1" border="0" /><br /><?% stunde - 1 %?></td>
<?%
		pos=ende;
	END;
%?>
							</tr>
						</table>

<?%
	programm=0;
	sender="";
	tablaenge=((1440 / faktor) + 0.5 ) | format('%i');
	FOREACH timer = timers;
		IF timer.cdesc != sender && timer.starttime <= current && timer.stoptime >= current;
			sender=timer.cdesc;
%?>
						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td bgcolor="#000000" height="1"><img src="bilder/spacer.gif" width="<?% tablaenge + 100 %?>" height="1" border="0" /></td>
							</tr>
						</table>

						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td class="<?% (programm % 2) == 0 ? 'color2' : 'color1' %?>" height="20" width="100"><img src="bilder/spacer.gif" width="100" height="1" border="0" /><br /><b><?% sender | truncate(11) %?></b></td>

<?%
			pos=0;
			FOREACH sendung = timers;
				IF sendung.cdesc == sender && sendung.starttime <= current && sendung.stoptime >= current;
					IF sendung.active == 0 || sendung.active == 32768;
						td_class="color_inactive";
					ELSE;
						IF sendung.critical == 1;
							td_class="color_conflict";
						ELSE;
							IF sendung.collision == 1;
								td_class="color_collision";
							ELSE;
								td_class="color_ok";
							END;
						END;
					END;
					IF sendung.starttime < current;
						start=0;
					ELSE;
						start=((sendung.startlong / faktor) + 0.5 ) | format('%i');
					END;
					IF sendung.stoptime > current;
						ende=tablaenge;
					ELSE;
						ende=(((sendung.stoplong + 1) / faktor) + 0.5 ) | format('%i');
					END;
					NEXT IF ende <= start;

					IF start>pos;
%?>
								<td class="<?% (programm % 2) == 0 ? 'color2' : 'color1' %?>"><img src="bilder/spacer.gif" width="<?% start-pos %?>" height="1" border="0" /><br /></td>

<?%
						pos=start;
					END;
					IF ende - pos < 2;
%?>
								<td class="<?% td_class %?>"><span onMouseOver="tip('VDR-<?% sendung.id %?>'); return true;" onMouseOut="untip(); return true;"><img src="bilder/spacer.gif" width="<?% ende - pos %?>" height="20" border="0" /></span></td>

<?%
					ELSE;
%?>
								<td class="<?% td_class %?>" id="prgtable"><span onMouseOver="tip('VDR-<?% sendung.id %?>'); return true;" onMouseOut="untip(); return true;"><img src="bilder/spacer.gif" width="<?% ende - pos - 2 %?>" height="20" border="0" /></span></td>

<?%
					END;
					pos=ende;
				END;
			END;
			IF pos<tablaenge;
%?>
								<td class="<?% (programm % 2) == 0 ? 'color2' : 'color1' %?>"><img src="bilder/spacer.gif" width="<?% tablaenge - pos %?>" height="1" border="0" /><br /></td>

<?%
			END;
%?>
							</tr>
						</table>
<?%
			programm=programm+1;
		END;
  END;
%?>

						<table cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td bgcolor="#000000" height="1"><img src="bilder/spacer.gif" width="<?% tablaenge + 100 %?>" height="1" border="0" /></td>
							</tr>
						</table>
					</td>
					<td class="col_right"></td>
				</tr>
				<tr class="footer">
					<td class="col_left"></td>
					<td colspan="2"></td>
					<td class="col_right"></td>
				</tr>
			</table>
			<input type="hidden" name="aktion" value="timer_list" />
		</form>

		<form action="<tmpl_var url>" method="get" name="FormName">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" class="list">
				<colgroup>
					<col class="col_left"/>
					<col class="col_active"/>
					<col class="col_channel"/>
					<col class="col_date"/>
					<col class="col_start"/>
					<col class="col_stop"/>
					<col class="col_name"/>
					<col class="col_edit"/>
					<col class="col_delete"/>
					<col class="col_checkbox"/>
					<col class="col_right"/>
				</colgroup>
				<tr class="heading">
					<td class="col_left"></td>
					<td class="col_active <tmpl_if sortbyactive>selected</tmpl_if>">
						<h2>
							<a href="<tmpl_var sortbyactiveurl>"><%! Active !%>
								<tmpl_if sortbyactive>
									<img src="bilder/sortiert_<tmpl_if desc>desc<tmpl_else>asc</tmpl_if>.gif" alt="" width="9" height="11" border="0" />
								<tmpl_else>
									<img src="bilder/spacer.gif" alt="" width="9" height="11" border="0" />
								</tmpl_if>
							</a>
						</h2>
					</td>
					<td class="col_channel <tmpl_if sortbychannel>selected</tmpl_if>">
						<h2>
							<a href="<tmpl_var sortbychannelurl>"><%! Channel !%>
								<tmpl_if sortbychannel>
									<img src="bilder/sortiert_<tmpl_if desc>desc<tmpl_else>asc</tmpl_if>.gif" alt="" width="9" height="11" border="0" />
								<tmpl_else>
									<img src="bilder/spacer.gif" alt="" width="9" height="11" border="0" />
								</tmpl_if>
							</a>
						</h2>
					</td>
					<td class="col_date <tmpl_if sortbyday>selected</tmpl_if>">
						<h2>
							<a href="<tmpl_var sortbydayurl>"><%! Date !%>
								<tmpl_if sortbyday>
									<img src="bilder/sortiert_<tmpl_if desc>desc<tmpl_else>asc</tmpl_if>.gif" alt="" width="9" height="11" border="0" />
								<tmpl_else>
									<img src="bilder/spacer.gif" alt="" width="9" height="11" border="0" />
								</tmpl_if>
							</a>
						</h2>
					</td>
					<td class="col_start <tmpl_if sortbystart>selected</tmpl_if>">
						<h2>
							<a href="<tmpl_var sortbystarturl>"><%! Start !%>
								<tmpl_if sortbystart>
									<img src="bilder/sortiert_<tmpl_if desc>desc<tmpl_else>asc</tmpl_if>.gif" alt="" width="9" height="11" border="0" />
								<tmpl_else>
									<img src="bilder/spacer.gif" alt="" width="9" height="11" border="0" />
								</tmpl_if>
							</a>
						</h2>
					</td>
					<td class="col_stop <tmpl_if sortbystop>selected</tmpl_if>">
						<h2>
							<a href="<tmpl_var sortbystopurl>"><%! Stop !%>
								<tmpl_if sortbystop>
									<img src="bilder/sortiert_<tmpl_if desc>desc<tmpl_else>asc</tmpl_if>.gif" alt="" width="9" height="11" border="0" />
								<tmpl_else>
									<img src="bilder/spacer.gif" alt="" width="9" height="11" border="0" />
								</tmpl_if>
							</a>
						</h2>
					</td>
					<td class="col_name <tmpl_if sortbyname>selected</tmpl_if>">
						<h2>
							<a href="<tmpl_var sortbynameurl>"><%! Name !%>
								<tmpl_if sortbyname>
									<img src="bilder/sortiert_<tmpl_if desc>desc<tmpl_else>asc</tmpl_if>.gif" alt="" width="9" height="11" border="0" />
								<tmpl_else>
									<img src="bilder/spacer.gif" alt="" width="9" height="11" border="0" />
								</tmpl_if>
							</a>
						</h2>
					</td>
					<td class="col_edit"></td>
					<td class="col_delete"></td>
					<td class="col_checkbox"><input type="checkbox" name="SELALL" value="SELALL" onclick="AllMessages(this.form);" title="<%! Select all/none !%>" /></td>
					<td class="col_right"></td>
				</tr>
				<tr class="row_spacer">
					<td class="col_left"></td>
					<td class="col_active <tmpl_if sortbyactive>selected</tmpl_if>"></td>
					<td class="col_channel <tmpl_if sortbychannel>selected</tmpl_if>"></td>
					<td class="col_date <tmpl_if sortbyday>selected</tmpl_if>"></td>
					<td class="col_start <tmpl_if sortbystart>selected</tmpl_if>"></td>
					<td class="col_stop <tmpl_if sortbystop>selected</tmpl_if>"></td>
					<td class="col_name <tmpl_if sortbyname>selected</tmpl_if>"></td>
					<td colspan="3"></td>
					<td class="col_right"></td>
				</tr>

<tmpl_loop timer_loop>
				<tr class="<tmpl_if __ODD__>row_odd<tmpl_else>row_even</tmpl_if>">
					<td class="col_left"></td>
					<td class="col_active <tmpl_if sortbyactive>selected</tmpl_if>">
						<div>
							<tmpl_if expr="(active%32768) == 0">
								<img src="bilder/poempl_grau.gif" alt="inactive" title="<%! This timer is inactive! !%>" width="19" height="19" align="middle" border="0" />
							<tmpl_else>
								<tmpl_if critical>
									<img src="bilder/poempl_rot.gif" alt="impossible" title="<%! This timer is impossible! !%>" width="19" height="19" align="middle" border="0" />
								<tmpl_else>
									<tmpl_if collision>
										<img src="bilder/poempl_gelb.gif" alt="nomore" title="<%! No more timers on other transponders possible! !%>" width="19" height="19" align="middle" border="0" />
									<tmpl_else>
										<tmpl_if active>
											<img src="bilder/poempl_gruen.gif" alt="possible" title="<%! Timer OK. !%>" width="19" height="19" align="middle" border="0" />
										</tmpl_if>
									</tmpl_if>
								</tmpl_if>
							</tmpl_if>
							<a href="javascript:change('<%! Edit timer status? !%>','<tmpl_var toggleurl>&amp;timer=<?% current %?>');">
								<tmpl_if expr="active == 1"><%! Yes !%></tmpl_if>
								<tmpl_if expr="(active%32768) == 0"><%! No !%></tmpl_if>
								<tmpl_if expr="active == 5"><%! VPS !%></tmpl_if>
								<tmpl_if expr="active == 32769"><%! Auto !%></tmpl_if>
							</a>
						</div>
					</td>
					<td class="col_channel <tmpl_if sortbychannel>selected</tmpl_if>">
						<div><a href="<tmpl_var proglink>"><tmpl_var cdesc></a></div>
					</td>
					<td class="col_date <tmpl_if sortbyday>selected</tmpl_if>">
						<div><tmpl_var dor></div>
					</td>
					<td class="col_start <tmpl_if sortbystart>selected</tmpl_if>">
						<div><tmpl_var start></div>
					</td>
					<td class="col_stop <tmpl_if sortbystop>selected</tmpl_if>">
						<div><tmpl_var stop></div>
					</td>
					<td class="col_name <tmpl_if sortbyname>selected</tmpl_if>">
						<div onMouseOver="tip('VDR-<tmpl_var id>'); return true;" onMouseOut="untip(); return true;">
							<tmpl_if recording><img align="middle" src="bilder/rec.gif" border="0" />&nbsp;</tmpl_if>
							<tmpl_if infurl>
								<a href="javascript:popup('<tmpl_var infurl>');"><tmpl_var title></a>
							<tmpl_else>
								<tmpl_var title>
							</tmpl_if>
						</div>
					</td>
					<td class="col_edit">
						<div><a href="<tmpl_var modurl>"><img src="bilder/edit.gif" alt="edit" title="<%! Edit !%>" height="17" width="17" border="0" /></a></div>
					</td>
					<td class="col_delete">
						<div><a href="javascript:del('<%! Delete timer? !%>\n\n&quot;<tmpl_var title>&quot;','<tmpl_var delurl>');"><img src="bilder/delete.gif" alt="delete" title="<%! Delete !%>" height="17" width="17" border="0" /></a></div>
					</td>
					<td class="col_checkbox">
						<div><input type="checkbox" name="xxxx_<tmpl_var id>" /></div>
					</td>
					<td class="col_right"></td>
				</tr>
</tmpl_loop>

				<tr class="footer">
					<td class="col_left"></td>
					<td class="col_active <tmpl_if sortbyactive>selected</tmpl_if>"></td>
					<td class="col_channel <tmpl_if sortbychannel>selected</tmpl_if>"></td>
					<td class="col_date <tmpl_if sortbyday>selected</tmpl_if>"></td>
					<td class="col_start <tmpl_if sortbystart>selected</tmpl_if>"></td>
					<td class="col_stop <tmpl_if sortbystop>selected</tmpl_if>"></td>
					<td class="col_name <tmpl_if sortbyname>selected</tmpl_if>"></td>
					<td colspan="3"></td>
					<td class="col_right"></td>
				</tr>
			</table>

			<div id="buttons">
				<input type="submit" class="submit" name="timer_delete" value="<%! Delete Selected Timers !%>" onclick="return mdel('<%! Delete all selected timers? !%>');" />
			</div>
			<input type="hidden" name="aktion" value="timer_delete" />
		</form>
	</div>
</body>
</html>
