+ }
+ else
+ {
+ @:
+ }
+
+ @if (!String.IsNullOrEmpty(section.Value.Settings.Label))
+ {
+
+ }
+
+ @if (!String.IsNullOrEmpty(section.Value.Description))
+ {
+ @section.Value.Description
+ }
+
+ @if (section.Value.SectionType == ReportSectionType.TableOfContents)
+ {
+ @* TABLE OF CONTENTS SECTION *@
+ var tocCount = 0;
+ @foreach (var tableSection in Sections.Where(s => new [] {ReportSectionType.Content, ReportSectionType.Gallery, ReportSectionType.Text, ReportSectionType.Image}.Contains(s.Value.SectionType)))
+ {
+ if ((!tableSection.Value.Settings.InTableOfContents.HasValue || tableSection.Value.Settings.InTableOfContents.Value)
+ && (!tableSection.Value.Settings.HideEmpty || tableSection.Value.Content.Any()) && tableSection.Value.IsEnabled)
+ {
+
+
+
+ @if (section.Value.Settings.ShowHeadlines && tableSection.Value.Content.Any() && tableSection.Value.SectionType != ReportSectionType.Gallery)
+ {
+
+ @foreach (var content in tableSection.Value.Content)
+ {
+ var summary = ReportExtensions.GetSummaryWithExternalStory(content, Model);
+
+
+
+ @ReportExtensions.GetFullHeadline(content, Model, utcOffset, true, $"#item-{tocCount}", "", true) @summary
+
+ tocCount++;
+ }
+
+ }
+
+ }
+ }
+ }
+ else if (section.Value.SectionType == ReportSectionType.Text)
+ {
+ @* TEXT SECTION *@
+ }
+ else if (section.Value.SectionType == ReportSectionType.Content)
+ {
+ @* STORY CONTENT SECTION *@
+ var positionInTOC = 0;
+ if (section.Value.Settings.ShowHeadlines)
+ {
+ if (section.Value.Settings.GroupBy != "")
+ {
+ var contentGroupings = sectionContent.GetContentGroupings(section.Value.Settings.GroupBy);
+
+ @foreach(KeyValuePair> contentGroup in contentGroupings)
+ {
+ - @section.Value.Settings.GroupBy = @contentGroup.Key
+
+ @foreach(long contentId in contentGroup.Value)
+ {
+ var content = sectionContent.FirstOrDefault(c => c.Id == contentId);
+ var headlineLink = contentCount + positionInTOC;
+ positionInTOC++;
+ if (section.Value.Settings.ShowFullStory)
+ {
+ - @ReportExtensions.GetFullHeadline(content, Model, utcOffset, true, $"#item-{headlineLink}", "", true)
+ }
+ else
+ {
+ - @ReportExtensions.GetFullHeadline(content, Model, utcOffset, true, "", "_blank", true)
+ }
+ }
+
+ }
+
+ }
+ else
+ {
+
+ @foreach (var content in sectionContent)
+ {
+ var headlineLink= contentCount + positionInTOC;
+ positionInTOC++;
+ @if (section.Value.Settings.ShowFullStory)
+ {
+ - @ReportExtensions.GetFullHeadline(content, Model, utcOffset, true, $"#item-{headlineLink}", "", true)
+ }
+ else
+ {
+ - @ReportExtensions.GetFullHeadline(content, Model, utcOffset, true, "", "_blank", true)
+ }
+ }
+
+ }
+ }
+
+ @* FULL STORIES *@
+ @if (section.Value.Settings.ShowFullStory || section.Value.Settings.ShowImage)
+ {
+ for (var i = 0; i < sectionContent.Length; i++)
+ {
+ var content = sectionContent[i];
+ if (Settings.Content.HighlightKeywords) ReportExtensions.MarkKeywords(section.Value, content);
+ var sentiment = ReportExtensions.GetSentiment(content, Model, true);
+ var headline = ReportExtensions.GetHeadline(content, Model);
+ var body = ReportExtensions.GetBody(content, Model);
+ var byline= ReportExtensions.GetByline(content, Model);
+ var hasPrev = contentCount > 0;
+ var prev = hasPrev ? contentCount - 1 : 0;
+ var hasNext = (contentCount + 1) < allContent.Length;
+ var next = hasNext ? contentCount + 1 : 0;
+ var itemPosition = contentCount;
+ var sourceUrl = ReportExtensions.GetSourceUrl(content, Model);
+ var isPrivate = ReportExtensions.IsPrivate(content, Model);
+ if (!section.Value.Settings.ShowImage) {
+ body = ReportExtensions.StripHtmlImages(body);
+ }
+
+ var containImage = body.Contains("
+
+
+
+
+
+
+ @* SECTION & NAVIGATION LINKS *@
+
+
+ @(String.IsNullOrEmpty(sentiment) ? "" : $"{sentiment} ")@headline
+
+
+ @(String.IsNullOrEmpty(content.Source?.Name) ? content.OtherSource : content.Source?.Name)
+ @content.PublishedOn?.AddHours(utcOffset).ToString("dddd, MMMM d yyyy")
+ @if (!string.IsNullOrWhiteSpace(content.Page))
+ {
+ Page @content.Page
+ }
+ @if (!string.IsNullOrWhiteSpace(byline) && Settings.Headline.ShowByline)
+ {
+ By @byline
+ }
+
+
+ @if (!String.IsNullOrEmpty(body))
+ {
+ @body
+ }
+ @if (hasImageToDisplay)
+ {
+ if (!string.IsNullOrEmpty(content.ImageContent) && section.Value.Settings.ShowImage)
+ {
+ var src = $"data:{content.ContentType};base64," + content.ImageContent;
+
+ }
+ else if (!string.IsNullOrEmpty(filePath) && section.Value.Settings.ShowImage)
+ {
+ var apiFileUrl = subscriberAppUrl + "api/subscriber/contents/download?path=" + filePath;
+
+ }
+ }
+ @if (Settings.Content.ShowLinkToStory && !isPrivate)
+ {
+ @* LINK TO STORY ON WEBSITE *@
+
+ }
+ else if (Settings.Content.ShowLinkToStory)
+ {
+
+ }
+
+
+ }
+ }
+ }
+ else if (section.Value.SectionType == ReportSectionType.MediaAnalytics)
+ {
+ @* Media Analytics Section *@
+ foreach (var chart in section.Value.ChartTemplates)
+ {
+
+ }
+ }
+ else if (section.Value.SectionType == ReportSectionType.Gallery)
+ {
+ @* Gallery Section *@
+ if (section.Value.Settings.Direction == "row" && section.Value.Settings.ShowImage)
+ {
+
+ @for (var i = 0; i < sectionContent.Length; i++)
+ {
+ var content = sectionContent[i];
+ var filePath = content.FileReferences.FirstOrDefault()?.Path;
+
+ if (!string.IsNullOrEmpty(content.ImageContent))
+ {
+ var src = $"data:{content.ContentType};base64," + content.ImageContent;
+ var fileName = content.FileReferences.FirstOrDefault()?.FileName ?? content.Id.ToString();
+ 
+ }
+ else if (!string.IsNullOrEmpty(filePath))
+ {
+ var apiFileUrl = subscriberAppUrl + "api/subscriber/contents/download?path=" + filePath;
+ )
+ }
+ }
+
+ }
+ else if (section.Value.Settings.ShowImage)
+ {
+ for (var i = 0; i < sectionContent.Length; i++)
+ {
+ var content = sectionContent[i];
+ var filePath = content.FileReferences.FirstOrDefault()?.Path;
+
+ if (!string.IsNullOrEmpty(content.ImageContent))
+ {
+ var src = $"data:{content.ContentType};base64," + content.ImageContent;
+ var fileName = content.FileReferences.FirstOrDefault()?.FileName ?? content.Id.ToString();
+
+ }
+ else if (!string.IsNullOrEmpty(filePath))
+ {
+ var apiFileUrl = subscriberAppUrl + "api/subscriber/contents/download?path=" + filePath;
+
+ }
+ }
+ }
+ }
+ else if (section.Value.SectionType == ReportSectionType.Image)
+ {
+ @* IMAGE SECTION *@
+ var src = !System.String.IsNullOrWhiteSpace(section.Value.Settings.UrlCache) ? section.Value.Settings.UrlCache : section.Value.Settings.Url;
+ var alt = section.Value.Settings.Label;
+
+ 
+
+ }
+ else if (section.Value.SectionType == ReportSectionType.Data)
+ {
+ @* DATA SECTION *@
+ var alt = section.Value.Settings.Label;
+
+ @(section.Value.Data)
+
+ }
+ else if (section.Value.SectionType == ReportSectionType.AI)
+ {
+ @* AI SECTION *@
+ var alt = section.Value.Settings.Label;
+
+ @(section.Value.Data)
+
+ }
+
+ @if (!horizontalCharts && !endChartGroup)
+ {
+ @:
+ }
+ else
+ {
+ @: |
+ }
+ @if (endChartGroup)
+ {
+ @: