|
7 | 7 | var pageBreak = Settings.Sections.UsePageBreaks ? "page-break-after: always;" : ""; |
8 | 8 | var utcOffset = ReportExtensions.GetUtcOffset(System.DateTime.Now, "Pacific Standard Time"); |
9 | 9 | var hasImages = Sections.Any(section => section.Value.SectionType == TNO.Entities.ReportSectionType.Image); |
| 10 | + var subscriberAppUrl = @SubscriberAppUrl?.ToString(); |
10 | 11 | } |
11 | 12 |
|
12 | 13 | <style> |
|
18 | 19 |
|
19 | 20 | </style> |
20 | 21 |
|
21 | | -<center><div style="margin-bottom: 25px; color:#FFFFF6;"><img src="@($"{SubscriberAppUrl}assets/reports/MMI_logo_white.png")" width="600"></div></center> |
| 22 | +<center><div style="margin-bottom: 25px; color:#FFFFF6;"><img src="@($"{subscriberAppUrl}assets/reports/MMI_logo_white.png")" width="600"></div></center> |
22 | 23 |
|
23 | 24 | @* This is the Do Not Forward disclaimer *@ |
24 | 25 | <div><p style="background-color: #FFF7E1; color: #876503; text-align: center; font-size: 1em; font-weight: 700; line-height: 1.1em; letter-spacing: 0.08px; padding: 10px 0px; margin: 6px 0px 20px 0px;">DO NOT FORWARD THIS REPORT IN FULL — OR IN PART — TO ANYONE</p></div> |
|
190 | 191 | } |
191 | 192 |
|
192 | 193 | var containImage = body.Contains("<img"); |
193 | | - var hasImageToDisplay = (!string.IsNullOrEmpty(content.ImageContent) && section.Value.Settings.ShowImage) || containImage; |
| 194 | + var filePath = content.FileReferences.FirstOrDefault()?.Path; |
| 195 | + var hasImageToDisplay = ((!string.IsNullOrEmpty(content.ImageContent) || !string.IsNullOrEmpty(filePath)) && section.Value.Settings.ShowImage) || containImage; |
194 | 196 |
|
195 | 197 | /** |
196 | 198 | * Checks if there is no image to display and the section settings do not allow showing the full story. |
|
254 | 256 | } |
255 | 257 | @if (hasImageToDisplay) |
256 | 258 | { |
257 | | - var src = $"data:{content.ContentType};base64," + content.ImageContent; |
258 | | - <div><img src="@src" alt="@content.FileReferences.FirstOrDefault()?.FileName" /></div> |
| 259 | + if (!string.IsNullOrEmpty(content.ImageContent) && section.Value.Settings.ShowImage) |
| 260 | + { |
| 261 | + var src = $"data:{content.ContentType};base64," + content.ImageContent; |
| 262 | + <div><img src="@src" alt="@content.FileReferences.FirstOrDefault()?.FileName" /></div> |
| 263 | + } |
| 264 | + else if (!string.IsNullOrEmpty(filePath) && section.Value.Settings.ShowImage) |
| 265 | + { |
| 266 | + var apiFileUrl = subscriberAppUrl + "api/subscriber/contents/download?path=" + filePath; |
| 267 | + <div><img src="@(apiFileUrl)" alt="@content.Headline" /></div> |
| 268 | + } |
259 | 269 | } |
260 | 270 | @if (Settings.Content.ShowLinkToStory && !isPrivate) |
261 | 271 | { |
262 | 272 | @* LINK TO STORY ON WEBSITE *@ |
263 | 273 | <div> |
264 | 274 | <span style="font-size: .85em; text-transform:uppercase; vertical-align: middle; background-color:#FFF; border:#ccc 1px solid; margin:20 auto; padding:6px 10px;"> |
265 | | - <a href="@($"{ViewContentUrl}{content.Id}")" target="_blank" style="color: #6750a4; text-decoration: none;">View Article <img height="14" style="max-width: 14px; height: 14px;" valign="absmiddle" src="@($"{SubscriberAppUrl}assets/reports/follow_link.png")"></a> |
| 275 | + <a href="@($"{ViewContentUrl}{content.Id}")" target="_blank" style="color: #6750a4; text-decoration: none;">View Article <img height="14" style="max-width: 14px; height: 14px;" valign="absmiddle" src="@($"{subscriberAppUrl}assets/reports/follow_link.png")"></a> |
266 | 276 | </span> |
267 | 277 | </div> |
268 | 278 | } |
269 | 279 | else if (Settings.Content.ShowLinkToStory) |
270 | 280 | { |
271 | 281 | <div> |
272 | 282 | <span style="font-size: .85em; text-transform:uppercase; vertical-align: middle; background-color:#FFF; border:#ccc 1px solid; margin:20 auto; padding:6px 10px;"> |
273 | | - <a rel="noreferrer" href="@($"{sourceUrl}")" target="_blank" style="color: #6750a4; text-decoration: none;">View Article (external site)<img height="14" style="max-width: 14px; height: 14px;" valign="absmiddle" src="@($"{SubscriberAppUrl}assets/reports/follow_link.png")"></a> |
| 283 | + <a rel="noreferrer" href="@($"{sourceUrl}")" target="_blank" style="color: #6750a4; text-decoration: none;">View Article (external site)<img height="14" style="max-width: 14px; height: 14px;" valign="absmiddle" src="@($"{subscriberAppUrl}assets/reports/follow_link.png")"></a> |
274 | 284 | </span> |
275 | 285 | </div> |
276 | 286 | } |
|
298 | 308 | @for (var i = 0; i < sectionContent.Length; i++) |
299 | 309 | { |
300 | 310 | var content = sectionContent[i]; |
301 | | - var fileName = content.FileReferences.FirstOrDefault()?.FileName ?? content.Id.ToString(); |
302 | | - var src = $"data:{content.ContentType};base64," + content.ImageContent; |
| 311 | + var filePath = content.FileReferences.FirstOrDefault()?.Path; |
303 | 312 |
|
304 | | - <img style="height:min-content" src="@src" alt="@fileName" /> |
| 313 | + if (!string.IsNullOrEmpty(content.ImageContent)) |
| 314 | + { |
| 315 | + var src = $"data:{content.ContentType};base64," + content.ImageContent; |
| 316 | + var fileName = content.FileReferences.FirstOrDefault()?.FileName ?? content.Id.ToString(); |
| 317 | + <img style="height:min-content" src="@src" alt="@fileName" /> |
| 318 | + } |
| 319 | + else if (!string.IsNullOrEmpty(filePath)) |
| 320 | + { |
| 321 | + var apiFileUrl = subscriberAppUrl + "api/subscriber/contents/download?path=" + filePath; |
| 322 | + <img style="height:min-content" src="@(apiFileUrl)" alt="@content.Headline" /> |
| 323 | + } |
305 | 324 | } |
306 | 325 | </div> |
307 | 326 | } |
|
310 | 329 | for (var i = 0; i < sectionContent.Length; i++) |
311 | 330 | { |
312 | 331 | var content = sectionContent[i]; |
313 | | - var fileName = content.FileReferences.FirstOrDefault()?.FileName ?? content.Id.ToString(); |
314 | | - var src = $"data:{content.ContentType};base64," + content.ImageContent; |
| 332 | + var filePath = content.FileReferences.FirstOrDefault()?.Path; |
| 333 | + |
315 | 334 | if (!string.IsNullOrEmpty(content.ImageContent)) |
316 | 335 | { |
317 | | - <div> |
318 | | - <img style="height:min-content" src="@src" alt="@fileName" /> |
319 | | - </div> |
| 336 | + var src = $"data:{content.ContentType};base64," + content.ImageContent; |
| 337 | + var fileName = content.FileReferences.FirstOrDefault()?.FileName ?? content.Id.ToString(); |
| 338 | + <div><img style="height:min-content" src="@src" alt="@fileName" /></div> |
| 339 | + } |
| 340 | + else if (!string.IsNullOrEmpty(filePath)) |
| 341 | + { |
| 342 | + var apiFileUrl = subscriberAppUrl + "api/subscriber/contents/download?path=" + filePath; |
| 343 | + <div><img style="height:min-content" src="@(apiFileUrl)" alt="@content.Headline" /></div> |
320 | 344 | } |
321 | 345 | } |
322 | 346 | } |
|
357 | 381 | @* FOOTER *@ |
358 | 382 | <div style="width:100%"> |
359 | 383 | <hr style="background-color:#646293; border-width:0;height:1px;line-height:0;width:100%; margin-top:20px; margin-bottom:10px;"/> |
360 | | - <a style="text-transform:uppercase; color:#fff;" href="@($"{SubscriberAppUrl}{(ReportInstanceId.HasValue ? $"report/instances/{ReportInstanceId }" : $"reports/{ReportId}")}/view")" target="_blank"> |
| 384 | + <a style="text-transform:uppercase; color:#fff;" href="@($"{subscriberAppUrl}{(ReportInstanceId.HasValue ? $"report/instances/{ReportInstanceId }" : $"reports/{ReportId}")}/view")" target="_blank"> |
361 | 385 | <div style="vertical-align:middle; text-align: center; background-color:#6750A4; border:#ccc 1px solid; margin:20px 20px; padding:6px 10px;"> |
362 | 386 | View this report as a web page |
363 | 387 | </div> |
|
0 commit comments