#from urllib import quote
#from Plugins.Extensions.OpenWebif.local import tstrings
<body> 
	<div data-role="page">
		<div id="header">
		<div class="button" onClick="history.back()">$tstrings['back']</div>
		<h1><a style="color:#FFF;text-decoration:none;" href='/mobile'>OpenWebif</a></h1>
		#set $sref=quote($event.sref, safe=' ~@#$&()*!+=:;,.?/\'')
		<div class="button" style="right:5px;left:auto;" onclick="addTimerEvent('$sref',$event.id);return false;">$tstrings['add_timer']</div>
	</div>
		<div id="mainContent" class="ui-corner-all">
			<table width="100%" border="0" cellspacing="1" cellpadding="5">
							<tr>
								<th colspan="3" class="ui-btn-up-b" style="text-align: left;">$tstrings['service']</th>
							</tr>
							<tr style="background-color:  #f0f7fc;">
								<td width="200"><img src="$event['picon']" border="0" alt=""></td>
								<td width="100%" valign="top">
								<strong>$event['channel']</strong><br />
									$event['title']<br />
									$tstrings[("day_" + (time.strftime("%w", time.localtime($event['start']))))], $time.strftime("%d.%m.%Y", time.localtime($event['start'])) / $event['begin'] - $event['end'] ( $event['duration'] min )<br />
								</td>
							</tr>
							<tr>
								<th colspan="2" class="ui-btn-up-b" style="text-align: left;">$tstrings['description']</th>
							</tr>
							<tr style="background-color:  #f0f7fc;">
								<td colspan="2">$event['shortdesc']</td>
							</tr>
							<tr style="background-color:  #f0f7fc;">
								<td colspan="2">$event['longdesc']</td>
							</tr>
				</table>
				<button onClick="location='/mobile/timerlist'">$tstrings['timer_list']</button>
		</div>
		<div id="footer">
		<p>OpenWebif Mobile</p>
		<a onclick="document.location.href='/index?mode=fullpage';return false;" href="#">$tstrings['show_full_openwebif']</a>
		</div>
<script type="text/javascript">
function addTimerEvent(sRef, eventId) {
	var url = "/api/timeraddbyeventid?sRef=" + sRef + "&eventid=" + eventId;
	\$.ajax({
		async: false,
		url: url,
		cache : false,
		dataType: 'json',
		success: function(result) {
			if(result) {
				if(!result.result && result.conflicts)
					alert( "Error Timer Confict" );
				else
					alert( result.result ? "$tstrings['tstr_timer_added']" : result.message );
			} else
				alert( "Error Creating Timer" );
		}
	});
}
</script>
</body>
</html>
