Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<PackageReference Include="HtmlSanitizer" Version="6.0.453" />
<PackageReference Include="IdentityModel" Version="4.4.0" />
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.2" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.25" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.29" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.0" />
Expand Down
13 changes: 12 additions & 1 deletion LearningHub.Nhs.WebUI/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace LearningHub.Nhs.WebUI.Controllers
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
Expand Down Expand Up @@ -1236,7 +1237,17 @@ private async Task<AccountCreationConfirmation> GetAccountConfirmationDetails(Ac
var employer = await this.locationService.GetByIdAsync(int.TryParse(accountCreationViewModel.LocationId, out int primaryEmploymentId) ? primaryEmploymentId : 0);
var region = await this.regionService.GetAllAsync();
var specialty = await this.specialtyService.GetSpecialtiesAsync();
var role = await this.jobRoleService.GetPagedFilteredAsync(accountCreationViewModel.CurrentRoleName, accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize);
var role = new Tuple<int, List<JobRoleBasicViewModel>>(0, null);
if (!string.IsNullOrEmpty(accountCreationViewModel.CurrentRoleName) && accountCreationViewModel.CurrentRoleName.Contains('/'))
{
string jobrole = accountCreationViewModel.CurrentRoleName.Replace("/", " ");
role = await this.jobRoleService.GetPagedFilteredAsync(jobrole, accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize);
}
else
{
role = await this.jobRoleService.GetPagedFilteredAsync(accountCreationViewModel.CurrentRoleName, accountCreationViewModel.CurrentPageIndex, UserRegistrationContentPageSize);
}

if (role.Item1 > 0)
{
accountCreationViewModel.CurrentRoleName = role.Item2.FirstOrDefault(x => x.Id == int.Parse(accountCreationViewModel.CurrentRole)).NameWithStaffGroup;
Expand Down
51 changes: 26 additions & 25 deletions LearningHub.Nhs.WebUI/Controllers/ResourceController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ namespace LearningHub.Nhs.WebUI.Controllers
using System.Threading.Tasks;
using LearningHub.Nhs.Caching;
using LearningHub.Nhs.Models.Common;
using LearningHub.Nhs.Models.Entities.Hierarchy;
using LearningHub.Nhs.Models.Entities.Resource;
using LearningHub.Nhs.Models.Enums;
using LearningHub.Nhs.Models.Extensions;
using LearningHub.Nhs.Models.Resource;
Expand Down Expand Up @@ -353,15 +351,13 @@ public async Task<IActionResult> RateResource(ResourceRatingViewModel model)
/// <summary>
/// Ask user to confirm that they wish to edit a published resource.
/// </summary>
/// <param name="resourceId">The resourceId.</param>
/// <param name="resourceReferenceId">The resourceReferenceId.</param>
/// <param name="resourceTitle">The resourceTitle.</param>
/// <param name="viewModel">The ResourceIndexViewModel.</param>
/// <returns>The <see cref="IActionResult"/>.</returns>
[Authorize]
[Route("Resource/EditConfirm/{resourceId}/{resourceReferenceId}/{resourceTitle}")]
public IActionResult EditConfirm(int resourceId, int resourceReferenceId, string resourceTitle)
[Route("Resource/EditConfirm")]
public IActionResult EditConfirm(ResourceIndexViewModel viewModel)
{
return this.View("EditConfirm", new ResourceEditConfirmViewModel { ResourceId = resourceId, ResourceReferenceId = resourceReferenceId, ResourceTitle = resourceTitle });
return this.View("EditConfirm", new ResourceEditConfirmViewModel { ResourceId = viewModel.ResourceItem.ResourceId, ResourceReferenceId = viewModel.ResourceReferenceId, ResourceTitle = viewModel.ResourceItem.Title });
}

/// <summary>
Expand All @@ -380,24 +376,20 @@ public IActionResult EditConfirm(ResourceEditConfirmViewModel viewModel)
/// <summary>
/// Ask user to confirm that they wish to unpublish a published resource.
/// </summary>
/// <param name="resourceVersionId">The resourceVersionId.</param>
/// <param name="resourceReferenceId">The resourceReferenceId.</param>
/// <param name="resourceType">The resourceType.</param>
/// <param name="catalogueNodeVersionId"> The catalogueNodeVersionId.</param>
/// <param name="resourceTitle">The resourceTitle.</param>
/// <param name="scormEsrLinkType">The SCORM ESR link type.</param>
/// <param name="viewModel">The ResourceIndexViewModel.</param>
/// <returns>The <see cref="IActionResult"/>.</returns>
[Authorize]
[Route("Resource/UnpublishConfirm/{resourceVersionId}/{resourceReferenceId}/{resourceType}/{catalogueNodeVersionId}/{resourceTitle}/{scormEsrLinkType?}")]
public IActionResult UnpublishConfirm(int resourceVersionId, int resourceReferenceId, int resourceType, int catalogueNodeVersionId, string resourceTitle, int scormEsrLinkType)
[Route("Resource/UnpublishConfirm")]
public IActionResult UnpublishConfirm(ResourceIndexViewModel viewModel)
{
int scormEsrLinkType = viewModel.ResourceItem.ResourceTypeEnum == ResourceTypeEnum.Scorm || viewModel.ResourceItem.ResourceTypeEnum == ResourceTypeEnum.GenericFile ? (int)viewModel.ExternalContentDetails.EsrLinkType : 0;
return this.View("UnpublishConfirm", new ResourceUnpublishConfirmViewModel
{
ResourceVersionId = resourceVersionId,
ResourceReferenceId = resourceReferenceId,
ResourceType = (ResourceTypeEnum)resourceType,
CatalogueNodeVersionId = catalogueNodeVersionId,
ResourceTitle = resourceTitle,
ResourceVersionId = viewModel.ResourceItem.ResourceVersionId,
ResourceReferenceId = viewModel.ResourceReferenceId,
ResourceType = (ResourceTypeEnum)(int)viewModel.ResourceItem.ResourceTypeEnum,
CatalogueNodeVersionId = viewModel.ResourceItem.Catalogue.CatalogueNodeVersionId,
ResourceTitle = viewModel.ResourceItem.Title,
ScormEsrLinkType = (EsrLinkType)scormEsrLinkType,
});
}
Expand Down Expand Up @@ -494,15 +486,24 @@ public async Task<IActionResult> HtmlResourceContent(int resourceReferenceId, st
contentType = "text/html";
}

var file = await this.fileService.DownloadFileAsync(contentFilePath, path);
if (file != null)
if (contentType.Contains("video") || contentType.Contains("audio"))
{
return this.File(file.Content, contentType);
var stream = await this.fileService.StreamFileAsync(contentFilePath, path);
if (stream != null)
{
return this.File(stream, contentType, enableRangeProcessing: true);
}
}
else
{
return this.Ok(this.Content("No file found"));
var file = await this.fileService.DownloadFileAsync(contentFilePath, path);
if (file != null)
{
return this.File(file.Content, contentType);
}
}

return this.Ok(this.Content("No file found"));
}
}
}
21 changes: 12 additions & 9 deletions LearningHub.Nhs.WebUI/Filters/OfflineCheckFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,21 @@ public override async Task OnActionExecutionAsync(ActionExecutingContext context

var internalSystem = await this.internalSystemService.GetByIdAsync((int)InternalSystemType.LearningHub);

if (controller != "Offline"
&& !(controller == "Home" && action == "Logout")
&& internalSystem.IsOffline
&& (!user.Identity.IsAuthenticated || !(await this.userGroupService.UserHasPermissionAsync("System_Offline_Bypass"))))
if (internalSystem != null)
{
context.Result = new RedirectToRouteResult(
new RouteValueDictionary
{
if (controller != "Offline"
&& !(controller == "Home" && action == "Logout")
&& internalSystem.IsOffline
&& (!user.Identity.IsAuthenticated || !(await this.userGroupService.UserHasPermissionAsync("System_Offline_Bypass"))))
{
context.Result = new RedirectToRouteResult(
new RouteValueDictionary
{
{ "Controller", "Offline" },
{ "Action", "Index" },
});
executeNextAction = false;
});
executeNextAction = false;
}
}

if (executeNextAction)
Expand Down
8 changes: 8 additions & 0 deletions LearningHub.Nhs.WebUI/Interfaces/IFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ public interface IFileService
/// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
Task<ShareFileDownloadInfo> DownloadFileAsync(string filePath, string fileName);

/// <summary>
/// The StreamFileAsync.
/// </summary>
/// <param name="filePath">The filePath.</param>
/// <param name="fileName">The fileName.</param>
/// <returns>The <see cref="Task{Stream}"/>.</returns>
Task<Stream> StreamFileAsync(string filePath, string fileName);

/// <summary>
/// The ProcessFile.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion LearningHub.Nhs.WebUI/LearningHub.Nhs.WebUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
<PackageReference Include="HtmlAgilityPack" Version="1.11.38" />
<PackageReference Include="IdentityModel" Version="4.3.0" />
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.0" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.25" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.29" />
<PackageReference Include="linqtotwitter" Version="6.9.0" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0" />
<PackageReference Include="Microsoft.ApplicationInsights.EventCounterCollector" Version="2.21.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@
<file-panel :file-id="localGenericFileDetail.file.fileId" :file-description="localGenericFileDetail.file.fileName" :file-size="localGenericFileDetail.file.fileSizeKb" @changefile="changeFile"></file-panel>
</div>
<div v-if="scormOption" class="row mt-5">
<div class="col-12">
<div class="col-12 text-danger">
<div>
<label class="checkContainer">
This is a SCORM/AICC elearning resource
<input type="checkbox" v-model="localGenericFileDetail.scormAiccContent" @click="setProperty('scormAiccContent', $event.target.checked)">
<span class="checkmark"></span>
</label>
Please choose the resource type as Elearning/HTML for the SCORM/AICC elearning or HTML resources.
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export class AttachedFileModel {
export class GenericFileResourceModel {
resourceVersionId: number = 0;
file: ResourceFileModel = new ResourceFileModel();
scormAiccContent: boolean = false;
authoredYear: number = 0;
authoredMonth: number = 0;
authoredDayOfMonth: number = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,11 @@
window.location.pathname = './Home/Error';
});
}

if (interactionType == "ended") {
setTimeout(() => { this.checkUserCertificateAvailability() }, 10000);
await this.recordActivityComplete();
}
},
async recordMediaPlayingEvent(): Promise<void> {
let currentMediaTime = this.getMediaPlayerDisplayTime();
Expand Down
23 changes: 23 additions & 0 deletions LearningHub.Nhs.WebUI/Services/FileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,29 @@ public async Task<ShareFileDownloadInfo> DownloadFileAsync(string filePath, stri
return null;
}

/// <summary>
/// The StreamFileAsync.
/// </summary>
/// <param name="filePath">The filePath.</param>
/// <param name="fileName">The fileName.</param>
/// <returns>The <see cref="Task{Stream}"/>.</returns>
public async Task<Stream> StreamFileAsync(string filePath, string fileName)
{
var directory = this.ShareClient.GetDirectoryClient(filePath);

if (await directory.ExistsAsync())
{
var file = directory.GetFileClient(fileName);

if (await file.ExistsAsync())
{
return await file.OpenReadAsync();
}
}

return null;
}

/// <summary>
/// The ProcessFile.
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions LearningHub.Nhs.WebUI/Styles/nhsuk/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@
padding-right: px2rem(68);
}

#maincontent .search-width-container {
#maincontent {

.nhsuk-search__submit__green span.nhsuk-u-visually-hidden {
button[class^='nhsuk-search__submit'] span.nhsuk-u-visually-hidden {
color: #595959;
background-color: #fff;
}
Expand Down Expand Up @@ -222,4 +222,4 @@
white-space: nowrap;
margin-top: auto !important;
margin-bottom: auto !important;
}
}
14 changes: 14 additions & 0 deletions LearningHub.Nhs.WebUI/Styles/nhsuk/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@

}

.nhsuk-header__search {
.nhsuk-search__input {
width: px2rem(260);
}

#search > label.nhsuk-u-visually-hidden {
background-color: $nhsuk-white;
}
}

.nhsuk-account__login--link,
.nhsuk-account__login--link:visited,
.nhsuk-account__login--link:hover {
Expand Down Expand Up @@ -325,6 +335,10 @@
.nhsuk-back-link {
padding: 0.5rem 0;
}

.nhsuk-header__menu .nhsuk-header__not-mobile {
display: none;
}
}

/* mobile */
Expand Down
40 changes: 22 additions & 18 deletions LearningHub.Nhs.WebUI/Styles/nhsuk/pages/mylearning.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


.my-learning {


.downloadbuttonaslink {
background: none !important;
Expand Down Expand Up @@ -101,6 +101,8 @@


.search-filters {
position: relative;

.nhsuk-expander {
border-width: 0;

Expand All @@ -126,31 +128,33 @@
border-width: 12.124px 7px 0 7px;
border-top-color: inherit
}
}

.filter-summary {
color: $nhsuk-black;
.filter-summary {
color: $nhsuk-black;
display: flex;
line-height: 1.8;
position: absolute;
z-index: 1;
margin-top: 67px;
width: 100%;

.clear-filter {
justify-content: flex-end;
display: flex;
line-height: 1.8;

.clear-filter {
justify-content: flex-end;
display: flex;
flex: 1 1 auto !important;
}
flex: 1 1 auto !important;
}

@media(max-width: 48.0525em) {
display: initial;
@media(max-width: 48.0525em) {
display: initial;

.clear-filter {
display: block;
margin-top: 12px;
}
.clear-filter {
display: block;
margin-top: 12px;
}
}
}



.search-filter-items {
background-color: $nhsuk-grey-white;
}
Expand Down
Loading