2020-01-03 23:54:46 +01:00
|
|
|
@page
|
|
|
|
@model InfoModel
|
|
|
|
@{
|
|
|
|
ViewData["Title"] = "Info";
|
|
|
|
}
|
|
|
|
@{
|
2020-01-04 14:23:52 +01:00
|
|
|
if (string.IsNullOrWhiteSpace(Request.Query["guid"]) || c3stream.GetEventByGuid(Request.Query["guid"]) == null) {
|
2020-01-03 23:54:46 +01:00
|
|
|
Response.Redirect("/");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-01-04 02:31:35 +01:00
|
|
|
c3stream.UpdateCookie(Request, Response, $"/Info?guid={Request.Query["guid"]}&");
|
2020-01-03 23:54:46 +01:00
|
|
|
|
2020-01-04 14:23:52 +01:00
|
|
|
ConferenceModel.ReadUserData();
|
|
|
|
var talk = c3stream.GetEventByGuid(Request.Query["guid"]);
|
|
|
|
var state = ConferenceModel.UserData.FirstOrDefault(p => p.TalkId == Request.Query["guid"] && p.UserId == Request.Cookies["bookmark"])?.State;
|
2020-01-03 23:54:46 +01:00
|
|
|
if (talk == null) {
|
|
|
|
Response.Redirect("/");
|
|
|
|
return;
|
|
|
|
}
|
2020-01-04 14:23:52 +01:00
|
|
|
if (state == null) {
|
|
|
|
state = "unwatched";
|
|
|
|
}
|
2020-01-03 23:54:46 +01:00
|
|
|
|
2020-01-04 14:23:52 +01:00
|
|
|
var title = talk.Title;
|
2020-01-05 11:24:50 +01:00
|
|
|
var speakers = talk.Persons.Any() ? talk.Persons.Aggregate((s, s1) => $"{s}, {s1}") : "<no speakers>";
|
2020-01-04 14:23:52 +01:00
|
|
|
var description = talk.Description;
|
2020-01-03 23:54:46 +01:00
|
|
|
if (string.IsNullOrEmpty(description)) {
|
|
|
|
description = "<missing description>";
|
|
|
|
}
|
|
|
|
|
2020-01-04 14:23:52 +01:00
|
|
|
var isWatched = state == "watched";
|
|
|
|
var isMarked = state == "marked";
|
|
|
|
var file = $"{talk.Slug}.mp4";
|
|
|
|
var conference = c3stream.GetConferenceByEventGuid(talk.Guid);
|
2020-01-03 23:54:46 +01:00
|
|
|
|
2020-01-05 11:24:50 +01:00
|
|
|
var eventName = talk.Tags.Count <= 1 ? conference.Acronym : talk.Tags[0];
|
|
|
|
var logoPath = System.IO.Path.Combine(c3stream.CachePath, conference.Acronym, "logo.png");
|
2020-01-04 15:10:32 +01:00
|
|
|
|
|
|
|
var category = talk.Tags.Count switch {
|
|
|
|
0 => "<no category>",
|
|
|
|
1 => talk.Tags[0],
|
|
|
|
2 => "<no category>",
|
|
|
|
3 => talk.Tags[2],
|
|
|
|
4 => talk.Tags[3],
|
|
|
|
5 => talk.Tags[3],
|
|
|
|
_ => "<unknown tag format>"
|
2020-01-03 23:54:46 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-01-05 11:24:50 +01:00
|
|
|
@if (System.IO.File.Exists(logoPath)) {
|
2020-01-06 13:33:37 +01:00
|
|
|
<img src="@(c3stream.CacheUrl + $"{conference.Acronym}/logo.png")" alt="Conference logo" style="max-height: 110px; float: right;"/>
|
2020-01-05 11:24:50 +01:00
|
|
|
}
|
|
|
|
else {
|
2020-01-06 13:33:37 +01:00
|
|
|
<img src="@conference.LogoUri" alt="Conference logo" style="max-height: 110px; float: right;"/>
|
2020-01-05 11:24:50 +01:00
|
|
|
}
|
|
|
|
|
2020-01-03 23:54:46 +01:00
|
|
|
@if (isWatched) {
|
2020-01-04 16:43:34 +01:00
|
|
|
<h3 style="color: #95cb7a">@title - <i>@speakers</i></h3>
|
2020-01-03 23:54:46 +01:00
|
|
|
}
|
|
|
|
else if (isMarked) {
|
2020-01-04 16:43:34 +01:00
|
|
|
<h3 style="color: #da7d4f">@title - <i>@speakers</i></h3>
|
2020-01-03 23:54:46 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
<h3>@title - <i>@speakers</i></h3>
|
|
|
|
}
|
|
|
|
|
2020-01-05 11:24:50 +01:00
|
|
|
<h5>@eventName - @category - @talk.Date?.Date.ToShortDateString()</h5>
|
2020-01-03 23:54:46 +01:00
|
|
|
<div class="btn-group" role="group" style="margin-bottom: 10px">
|
2020-01-06 13:33:37 +01:00
|
|
|
<a href="@talk.FrontendLink.AbsoluteUri" type="button" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="right" title="Play">
|
2020-01-03 23:54:46 +01:00
|
|
|
<i class="fas fa-play-circle"></i>
|
|
|
|
</a>
|
2020-01-04 14:23:52 +01:00
|
|
|
@if (System.IO.File.Exists(System.IO.Path.Combine(c3stream.CachePath, conference.Acronym, file))) {
|
2020-01-06 13:33:37 +01:00
|
|
|
<a href="@(c3stream.CacheUrl + $"{conference.Acronym}/{file}")" type="button" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="right" title="Mirror">
|
2020-01-03 23:54:46 +01:00
|
|
|
<i class="fas fa-cloud-download"></i>
|
|
|
|
</a>
|
|
|
|
}
|
|
|
|
else {
|
2020-01-06 13:33:37 +01:00
|
|
|
<a href="/" type="button" class="btn btn-primary disabled">
|
2020-01-03 23:54:46 +01:00
|
|
|
<i class="fas fa-cloud-download"></i>
|
|
|
|
</a>
|
|
|
|
}
|
|
|
|
@if (isWatched) {
|
|
|
|
<button onclick="SetState('@talk.Guid', 'unwatched')" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="left" title="Mark unwatched">
|
|
|
|
<i class="fas fa-times"></i>
|
|
|
|
</button>
|
|
|
|
<button class="btn btn-primary disabled">
|
|
|
|
<i class="fas fa-clock"></i>
|
|
|
|
</button>
|
|
|
|
}
|
|
|
|
else if (isMarked) {
|
|
|
|
<button onclick="SetState('@talk.Guid', 'watched')" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="left" title="Mark watched">
|
|
|
|
<i class="fas fa-check"></i>
|
|
|
|
</button>
|
|
|
|
<button onclick="SetState('@talk.Guid', 'unwatched')" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="left" title="Remove from watch later">
|
|
|
|
<i class="fas fa-undo-alt"></i>
|
|
|
|
</button>
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
<button onclick="SetState('@talk.Guid', 'watched')" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="left" title="Mark watched">
|
|
|
|
<i class="fas fa-check"></i>
|
|
|
|
</button>
|
|
|
|
<button onclick="SetState('@talk.Guid', 'marked')" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="left" title="Add to watch later">
|
|
|
|
<i class="fas fa-clock"></i>
|
|
|
|
</button>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<p style="text-align: justify">
|
|
|
|
@Html.Raw(description.Replace("\n", "<br/>").Replace("<p>", "").Replace("</p>", ""))
|
|
|
|
</p>
|
|
|
|
|
|
|
|
Share this talk:<br/>
|
|
|
|
<code onclick="copyToClipboard(this)">https://@Request.Host.Value/Info?guid=@Request.Query["guid"]</code>
|