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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ obj
/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Staging.Database/LearningHub.Nhs.Migration.Staging.Database.dbmdl
/WebAPI/MigrationTool/LearningHub.Nhs.Migration.Staging.Database/LearningHub.Nhs.Migration.Staging.Database.jfm
/LearningHub.Nhs.WebUI.AutomatedUiTests/appsettings.Development.json
/OpenAPI/LearningHub.Nhs.OpenApi/appsettings.Development.json
/OpenAPI/LearningHub.Nhs.OpenApi/web.config
/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj.user
/WebAPI/LearningHub.Nhs.API/LearningHub.Nhs.Api.csproj.user
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.38" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.39" />
<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
16 changes: 16 additions & 0 deletions AdminUI/LearningHub.Nhs.AdminUI/Views/Catalogue/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@
<span class="input-validation-error keyword-maxlength" style="display: none;">The maximum length is 50 characters.</span>
</div>
</div>
<div class="row">
<div class="col-12">
<span id="keyword-error-span" class="field-validation-error" style="display: none;"></span>
</div>
</div>

</div>
<div class="col-12">
Expand Down Expand Up @@ -341,6 +346,9 @@
} else {
$('#add-keyword').removeAttr('disabled');
}
$('#keyword-error-span').hide();
$('#keyword-error-span').html('');
});
$('#add-keyword').on('click', function () {
Expand All @@ -355,6 +363,8 @@
return item.trim();
});
var duplicateKeywords = [];
$('#keyword-error-span').hide();
values.forEach(function (value) {
if (value && keywords.indexOf(value) === -1) {
keywords.push(value);
Expand All @@ -368,6 +378,12 @@
$(x).attr('name', "Keywords[" + i + "]");
});
}
else
{
duplicateKeywords.push(value);
$('#keyword-error-span').show();
$('#keyword-error-span').html('The keyword(s) have already been added : ' + duplicateKeywords.join(', '))
}
});
$keywordInput.val("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public async Task<IActionResult> Scorm(int id)
/// <param name="filePath">filePath.</param>
/// <returns>bool.</returns>
//// [ResponseCache(VaryByQueryKeys = new[] { "*" }, Duration = 0, NoStore = true)] // disable caching
//// Removed Request.Headers["Referer"] Referer URL checking based on issue reported in TD-4283
[AllowAnonymous]
[Route("ScormContent/{*filePath}")]
public async Task<IActionResult> ScormContent(string filePath)
Expand All @@ -79,12 +80,6 @@ public async Task<IActionResult> ScormContent(string filePath)

try
{
var referringUrl = this.Request.Headers["Referer"].ToString();
if (string.IsNullOrEmpty(referringUrl))
{
throw new UnauthorizedAccessException("Referer URL is required.");
}

if (!this.User.Identity.IsAuthenticated)
{
throw new UnauthorizedAccessException("User is not authenticated.");
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 @@ -108,7 +108,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.38" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.39" />
<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 @@ -65,15 +65,14 @@

<div class="d-flex">
<div class="selection pr-50">
<div>Provide guidance for the learner at the end of this assessment.</div>
<EditSaveFieldWithCharacterCount
v-model="assessmentDetails.endGuidance.blocks[0].title"
addEditLabel="title"
v-bind:characterLimit="60"
v-bind:isH3="true" />
<ckeditorwithhint v-on:blur="setEndGuidance"
<div>Provide guidance for the learner at the end of this assessment. <i class="warningTriangle fas fa-exclamation-triangle warm-yellow"></i></div>
<EditSaveFieldWithCharacterCount v-model="assessmentDetails.endGuidance.blocks[0].title"
addEditLabel="title"
v-bind:characterLimit="60"
v-bind:isH3="true" />
<ckeditorwithhint v-on:blur="setEndGuidance"
v-on:inputValidity="setGuidanceValidity"
:maxLength="1000"
:maxLength="1000"
:initialValue="endGuidance" />
</div>
<div class="tip">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="row">
<div class="form-group" v-bind:class="{ 'input-validation-error': keywordError }">
<div class="col-12 mb-0 error-text" v-if="keywordError">
<span class="text-danger">This keyword has already been added.</span>
<span class="text-danger">The keyword(s) have already been added : {{formattedkeywordErrorMessage}}</span>
</div>
<div class="col-12 mb-0 error-text" v-if="keywordLengthExceeded">
<span class="text-danger">
Expand Down Expand Up @@ -60,6 +60,7 @@
newKeyword: '',
keywordError: false,
keywordLengthExceeded: false,
keywordErrorMessage: []
}
},
computed: {
Expand All @@ -69,17 +70,20 @@
newKeywordTrimmed(): string {
return this.newKeyword?.trim().replace(/ +(?= )/g, '').toLowerCase();
},
formattedkeywordErrorMessage(): string {
return this.keywordErrorMessage.join(', ');
},
},
methods: {
keywordChange() {
this.keywordError = false;
this.keywordLengthExceeded = false;
this.keywordErrorMessage = [];
},
async addKeyword() {
if (this.newKeyword && this.newKeywordTrimmed.length > 0) {
let allTrimmedKeyword = this.newKeywordTrimmed.toLowerCase().split(',');
allTrimmedKeyword = allTrimmedKeyword.filter(e => String(e).trim());
if (!this.resourceDetails.resourceKeywords.find(_keyword => allTrimmedKeyword.includes(_keyword.keyword.toLowerCase()))) {
for (var i = 0; i < allTrimmedKeyword.length; i++) {
let item = allTrimmedKeyword[i];
if (item.length > 0 && item.length <= 50) {
Expand All @@ -90,8 +94,10 @@
newKeywordObj = await resourceData.addKeyword(this.resourceVersionId, newKeywordObj);
if (newKeywordObj.id > 0) {
this.resourceDetails.resourceKeywords.push(newKeywordObj);
this.keywordError = false;
this.newKeyword = '';
} else if (newKeywordObj.id == 0) {
this.keywordError = true;
this.keywordErrorMessage.push(item);
}
else {
this.keywordError = true;
Expand All @@ -103,10 +109,6 @@
this.keywordLengthExceeded = true;
}
}
}
else {
this.keywordError = true;
}
}
},
async deleteKeyword(keywordId: number) {
Expand Down
21 changes: 12 additions & 9 deletions LearningHub.Nhs.WebUI/Scripts/vuesrc/contribute/ContentCommon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<div class="row">
<div class="form-group" v-bind:class="{ 'input-validation-error': keywordError }">
<div class="col-12 mb-0 error-text" v-if="keywordError">
<span class="text-danger">This keyword has already been added.</span>
<span class="text-danger">The keyword(s) have already been added : {{formattedkeywordErrorMessage}}</span>
</div>
<div class="col-12 mb-0 error-text" v-if="keywordLengthExceeded">
<span class="text-danger">
Expand Down Expand Up @@ -292,6 +292,7 @@
ResourceType,
resourceProviderId: null,
keywordLengthExceeded: false,
keywordErrorMessage:[]
};
},
computed: {
Expand Down Expand Up @@ -340,6 +341,9 @@
return this.$store.state.userProviders.length > 0;
}
},
formattedkeywordErrorMessage(): string {
return this.keywordErrorMessage.join(', ');
},
},
created() {
this.setInitialValues();
Expand Down Expand Up @@ -485,6 +489,7 @@
keywordChange() {
this.keywordError = false;
this.keywordLengthExceeded = false;
this.keywordErrorMessage = [];
},
resetSelectedLicence() {
this.resourceLicenceId = 0;
Expand Down Expand Up @@ -534,7 +539,6 @@
if (this.newKeyword && this.newKeywordTrimmed.length > 0) {
let allTrimmedKeyword = this.newKeywordTrimmed.toLowerCase().split(',');
allTrimmedKeyword = allTrimmedKeyword.filter(e => String(e).trim());
if (!this.keywords.find(_keyword => allTrimmedKeyword.includes(_keyword.keyword.toLowerCase()))) {
for (var i = 0; i < allTrimmedKeyword.length; i++) {
let item = allTrimmedKeyword[i];
if (item.length > 0 && item.length <= 50) {
Expand All @@ -548,22 +552,21 @@
if (this.resourceDetail.resourceVersionId == 0) {
this.$store.commit('setResourceVersionId', newkeywordObj.resourceVersionId)
}
this.keywordError = false;
this.newKeyword = '';
} else {
} else if (newkeywordObj.id == 0) {
this.keywordError = true;
break;
this.keywordErrorMessage.push(item);
}
else {
this.keywordError = true;
break;
}
}
else {
this.keywordLengthExceeded = true;
break;
}
}
}
else {
this.keywordError = true;
}
}
else {
this.newKeyword = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="LearningHub.Nhs.Models" Version="2.1.1" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.39" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
namespace LearningHub.Nhs.OpenApi.Models.ViewModels
{
using LearningHub.Nhs.Models.Entities.Activity;
using System.Collections.Generic;


/// <summary>
/// Class.
/// </summary>
Expand All @@ -23,20 +25,25 @@ public ResourceMetadataViewModel()
/// <param name="references"><see cref="References"/>.</param>
/// <param name="resourceType"><see cref="ResourceType"/>.</param>
/// <param name="rating"><see cref="Rating"/>.</param>
/// <param name="userSummaryActivityStatuses"><see cref="UserSummaryActivityStatuses"/>.</param>
public ResourceMetadataViewModel(
int resourceId,
string title,
string description,
List<ResourceReferenceViewModel> references,
string resourceType,
decimal rating)
int? majorVersion,
decimal rating,
List<MajorVersionIdActivityStatusDescription> userSummaryActivityStatuses)
{
this.ResourceId = resourceId;
this.Title = title;
this.Description = description;
this.References = references;
this.ResourceType = resourceType;
this.MajorVersion = majorVersion;
this.Rating = rating;
this.UserSummaryActivityStatuses = userSummaryActivityStatuses;
}

/// <summary>
Expand Down Expand Up @@ -64,9 +71,20 @@ public ResourceMetadataViewModel(
/// </summary>
public string ResourceType { get; set; }

/// <summary>
/// Gets or sets <see cref="MajorVersion"/>.
/// </summary>
public int? MajorVersion { get; set; }


/// <summary>
/// Gets or sets <see cref="Rating"/>.
/// </summary>
public decimal Rating { get; set; }

/// <summary>
/// Gets or sets <see cref="UserSummaryActivityStatuses"/>.
/// </summary>
public List<MajorVersionIdActivityStatusDescription> UserSummaryActivityStatuses { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using LearningHub.Nhs.Models.Entities.Activity;
using System.Collections.Generic;

namespace LearningHub.Nhs.OpenApi.Models.ViewModels
{
/// <summary>
Expand All @@ -14,26 +17,32 @@ public class ResourceReferenceWithResourceDetailsViewModel
/// <param name="description"><see cref="Description"/>.</param>
/// <param name="catalogueViewModel"><see cref="Catalogue"/>.</param>
/// <param name="resourceType"><see cref="ResourceType"/>.</param>
/// <param name="majorVersion"></param>
/// <param name="rating"><see cref="Rating"/>.</param>
/// <param name="link"><see cref="Link"/>.</param>
/// <param name="userSummaryActivityStatuses"></param>
public ResourceReferenceWithResourceDetailsViewModel(
int resourceId,
int refId,
string title,
string description,
CatalogueViewModel catalogueViewModel,
string resourceType,
int? majorVersion,
decimal rating,
string link)
string link,
List<MajorVersionIdActivityStatusDescription> userSummaryActivityStatuses)
{
this.ResourceId = resourceId;
this.RefId = refId;
this.Title = title;
this.Description = description;
this.Catalogue = catalogueViewModel;
this.MajorVersion = majorVersion;
this.ResourceType = resourceType;
this.Rating = rating;
this.Link = link;
this.UserSummaryActivityStatuses = userSummaryActivityStatuses;
}

/// <summary>
Expand Down Expand Up @@ -66,14 +75,27 @@ public ResourceReferenceWithResourceDetailsViewModel(
/// </summary>
public string ResourceType { get; }


/// <summary>
/// Gets <see cref="MajorVersion"/>.
/// </summary>
public int? MajorVersion { get; }

/// <summary>
/// Gets <see cref="Rating"/>.
/// </summary>
///

public decimal Rating { get; }

/// <summary>
/// Gets <see cref="Link"/>.
/// </summary>
public string Link { get; }

/// <summary>
/// Gets <see cref="UserSummaryActivityStatuses"/>.
/// </summary>
public List<MajorVersionIdActivityStatusDescription> UserSummaryActivityStatuses { get; }
}
}
Loading
Loading