Skip to content
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3343656
TD-5700-fix
AnjuJose011 Jul 3, 2025
20ca42e
TD-5727
AnjuJose011 Jul 10, 2025
19d6cfc
TD-5727
AnjuJose011 Jul 10, 2025
f013da6
Fixes
AnjuJose011 Jul 23, 2025
4003a42
Merge pull request #1278 from TechnologyEnhancedLearning/Added-Commin…
AnjuJose011 Jul 23, 2025
8983d3f
Move .nhsuk overrides to new scss file and update layout
frank-hee Jul 23, 2025
9610db9
conflicts resolved
AnjuJose011 Jul 24, 2025
ef8a807
Merge pull request #1279 from TechnologyEnhancedLearning/Develop/Feat…
AnjuJose011 Jul 25, 2025
04d9db2
fixed banner image and checkbox scss bug
frank-hee Jul 28, 2025
69fe7e3
Merge pull request #1282 from TechnologyEnhancedLearning/Develop/Feat…
AnjuJose011 Jul 28, 2025
2db7358
Merge pull request #1283 from TechnologyEnhancedLearning/TD-5727-Cont…
AnjuJose011 Jul 30, 2025
a8c26db
Merge pull request #1286 from TechnologyEnhancedLearning/TD-5700-Reso…
AnjuJose011 Jul 30, 2025
bcd5659
bit of moodle refactoring and reload the moodle user
Jul 30, 2025
60f1317
Rolling back Models to 48 to fix the build
Jul 30, 2025
81c4c2c
upadtes-TD-5868
AnjuJose011 Jul 31, 2025
e379b72
Merge pull request #1292 from TechnologyEnhancedLearning/TD-5868-Keyw…
AnjuJose011 Jul 31, 2025
6242cfd
Merge pull request #1289 from TechnologyEnhancedLearning/Develop/Fixe…
binon Jul 31, 2025
3ff0fc7
Removed moodle models in WebUI
Jul 31, 2025
c60e165
Removed the Moodle models in WebUI
Jul 31, 2025
5dab833
Merge remote-tracking branch 'origin/release-v2.6.1-Ivory' into Devel…
Jul 31, 2025
22a4ece
Merge branch 'Develop/Feature-Revised-My-Learning-implementation' int…
swapnamol-abraham Jul 31, 2025
d73ad90
Merge pull request #1293 from TechnologyEnhancedLearning/Merge-Unfiie…
swapnamol-abraham Jul 31, 2025
5eedd65
Moved entrolled courses function to openAPI
Jul 31, 2025
70f9491
Update ContentCommon.vue
AnjuJose011 Jul 31, 2025
58da868
tidied up some code
Aug 1, 2025
02c6b66
Merge pull request #1296 from TechnologyEnhancedLearning/RC
AnjuJose011 Aug 1, 2025
a7d528e
Merge branch 'release-v2.6.1-Ivory' into Develop/Features/TD-5693_ref…
Aug 1, 2025
081fa3d
Merge branch 'Develop/Feature-Revised-My-Learning-implementation' int…
swapnamol-abraham Aug 1, 2025
0adc989
Merge pull request #1297 from TechnologyEnhancedLearning/Merge-into-M…
swapnamol-abraham Aug 1, 2025
2efc343
Merge pull request #1295 from TechnologyEnhancedLearning/Develop/Feat…
binon Aug 1, 2025
be06cf3
Merge pull request #1311 from TechnologyEnhancedLearning/Merge-into-m…
swapnamol-abraham Aug 7, 2025
8efff64
TD-5893 & TD-5835: Recent Learning page implementation
swapnamol-abraham Aug 11, 2025
b5741b2
Removed the secret from appsettings
swapnamol-abraham Aug 11, 2025
63d6771
Reverted the changes
swapnamol-abraham Aug 11, 2025
7a9a616
DB changes included and corrected the typo in the class
swapnamol-abraham Aug 11, 2025
e43d930
Merge branch 'Develop/Features/TD-3132-Unified-platform-interface' in…
swapnamol-abraham Aug 12, 2025
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.6.0" />
<PackageReference Include="LearningHub.Nhs.Caching" Version="2.0.2" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.48" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.52" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.19.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.36" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.36" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="LearningHub.Nhs.Models" Version="3.0.52" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.13" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="Selenium.Axe" Version="4.0.19" />
Expand Down
33 changes: 33 additions & 0 deletions LearningHub.Nhs.WebUI/Configuration/MoodleApiConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace LearningHub.Nhs.WebUI.Configuration
{
/// <summary>
/// The Moodle Settings.
/// </summary>
public class MoodleApiConfig
{
/// <summary>
/// Gets or sets the base url for the Moodle service.
/// </summary>
public string BaseUrl { get; set; } = null!;

/// <summary>
/// Gets or sets the Web service Rest Format.
/// </summary>
public string MoodleWSRestFormat { get; set; } = null!;

/// <summary>
/// Gets or sets the token.
/// </summary>
public string WSToken { get; set; } = null!;

/// <summary>
/// Gets or sets the token.
/// </summary>
public string ApiPath { get; set; } = "webservice/rest/server.php";

/// <summary>
/// Gets or sets the token.
/// </summary>
public string CoursePath { get; set; } = "course/view.php";
}
}
28 changes: 28 additions & 0 deletions LearningHub.Nhs.WebUI/Controllers/Api/MyLearningController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,34 @@ public async Task<ActionResult> GetActivityDetailed([FromBody] MyLearningRequest
return this.Ok(activity);
}

/// <summary>
/// Gets the detailed activity data.
/// </summary>
/// <param name="requestModel">The request model - filter settings.</param>
/// <returns>The <see cref="Task"/>.</returns>
[HttpPost]
[Route("GetUserRecentMyLearningActivities")]
public async Task<ActionResult> GetUserRecentMyLearningActivities([FromBody] MyLearningRequestModel requestModel)
{
var activity = await this.myLearningService.GetUserRecentMyLearningActivities(requestModel);

return this.Ok(activity);
}

/// <summary>
/// Gets the detailed activity data.
/// </summary>
/// <param name="requestModel">The request model - filter settings.</param>
/// <returns>The <see cref="Task"/>.</returns>
[HttpPost]
[Route("GetUserLearningHistory")]
public async Task<ActionResult> GetUserLearningHistory([FromBody] MyLearningRequestModel requestModel)
{
var activity = await this.myLearningService.GetUserLearningHistory(requestModel);

return this.Ok(activity);
}

/// <summary>
/// Gets the played segment data for the progress modal in My Learning screen.
/// </summary>
Expand Down
7 changes: 6 additions & 1 deletion LearningHub.Nhs.WebUI/Controllers/ContributeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class ContributeController : BaseController
private readonly IFileService fileService;
private readonly IResourceService resourceService;
private readonly IUserService userService;
private readonly IUserGroupService userGroupService;

/// <summary>
/// Initializes a new instance of the <see cref="ContributeController"/> class.
Expand All @@ -37,6 +38,7 @@ public class ContributeController : BaseController
/// <param name="logger">Logger.</param>
/// <param name="settings">Settings.</param>
/// <param name="userService">User service.</param>
/// <param name="userGroupService"> userGroupService.</param>
/// <param name="fileService">File service.</param>
/// <param name="resourceService">Resource service.</param>
/// <param name="azureMediaService">Azure media service.</param>
Expand All @@ -48,6 +50,7 @@ public ContributeController(
ILogger<ContributeController> logger,
IOptions<Settings> settings,
IUserService userService,
IUserGroupService userGroupService,
IFileService fileService,
IResourceService resourceService,
IAzureMediaService azureMediaService,
Expand All @@ -58,6 +61,7 @@ public ContributeController(
this.authConfig = authConfig;

this.userService = userService;
this.userGroupService = userGroupService;
this.fileService = fileService;
this.resourceService = resourceService;
this.azureMediaService = azureMediaService;
Expand Down Expand Up @@ -167,7 +171,8 @@ public async Task<IActionResult> CreateVersion(int resourceId)
[Route("my-contributions/{selectedTab}/{catalogueId}/{nodeId}")]
public async Task<IActionResult> MyContributions()
{
if ((this.User.IsInRole("ReadOnly") || this.User.IsInRole("BasicUser")) && !await this.resourceService.UserHasPublishedResourcesAsync())
bool catalogueContributionPermission = await this.userGroupService.UserHasCatalogueContributionPermission();
if ((this.User.IsInRole("ReadOnly") || this.User.IsInRole("BasicUser")) || (!catalogueContributionPermission && (!await this.resourceService.UserHasPublishedResourcesAsync())))
{
return this.RedirectToAction("AccessDenied", "Home");
}
Expand Down
37 changes: 29 additions & 8 deletions LearningHub.Nhs.WebUI/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace LearningHub.Nhs.WebUI.Controllers
using LearningHub.Nhs.Models.Content;
using LearningHub.Nhs.Models.Enums.Content;
using LearningHub.Nhs.Models.Extensions;
using LearningHub.Nhs.Models.Moodle.API;
using LearningHub.Nhs.WebUI.Configuration;
using LearningHub.Nhs.WebUI.Filters;
using LearningHub.Nhs.WebUI.Helpers;
Expand Down Expand Up @@ -218,13 +219,12 @@ public async Task<IActionResult> Index(string myLearningDashboard = "my-in-progr
var cataloguesTask = this.dashboardService.GetCataloguesAsync(catalogueDashboard, 1);
var userGroupsTask = this.userGroupService.UserHasCatalogueContributionPermission();

var enrolledCoursesTask = Task.FromResult(new List<MoodleCourseResponseViewModel>());
var enableMoodle = Task.Run(() => this.featureManager.IsEnabledAsync(FeatureFlags.EnableMoodle)).Result;
this.ViewBag.EnableMoodle = enableMoodle;
this.ViewBag.ValidMoodleUser = this.CurrentMoodleUserId > 0;
var enrolledCoursesTask = Task.FromResult(new List<MoodleCourseResponseModel>());
(bool enableMoodle, int currentMoodleUserId) = await this.GetMoodleFeatureStateAsync();

if (enableMoodle && myLearningDashboard == "my-enrolled-courses")
{
enrolledCoursesTask = this.dashboardService.GetEnrolledCoursesFromMoodleAsync(this.CurrentMoodleUserId, 1);
enrolledCoursesTask = this.dashboardService.GetEnrolledCoursesFromMoodleAsync(currentMoodleUserId, 1);
}

await Task.WhenAll(learningTask, resourcesTask, cataloguesTask, userGroupsTask);
Expand Down Expand Up @@ -280,9 +280,7 @@ public async Task<IActionResult> LoadPage(string dashBoardTray = "my-learning",
Catalogues = new Nhs.Models.Dashboard.DashboardCatalogueResponseViewModel { Type = catalogueDashBoard },
};

var enableMoodle = Task.Run(() => this.featureManager.IsEnabledAsync(FeatureFlags.EnableMoodle)).Result;
this.ViewBag.EnableMoodle = enableMoodle;
this.ViewBag.ValidMoodleUser = this.CurrentMoodleUserId > 0;
(bool enableMoodle, int currentMoodleUserId) = await this.GetMoodleFeatureStateAsync();

bool isAjax = this.HttpContext.Request.Headers["X-Requested-With"] == "XMLHttpRequest";

Expand Down Expand Up @@ -449,5 +447,28 @@ private async Task<LandingPageViewModel> GetLandingPageContent(bool preview = fa
return new LandingPageViewModel { PageSectionDetailViewModels = new List<PageSectionDetailViewModel>(), PageViewModel = new PageViewModel { PageSections = new List<PageSectionViewModel> { } } };
}
}

/// <summary>
/// Asynchronously retrieves the state of the Moodle feature and the current Moodle user ID.
/// </summary>
/// <remarks>The method checks if the Moodle feature is enabled and retrieves the current Moodle
/// user ID. If the user ID is not already set, it attempts to obtain it asynchronously from the dashboard
/// service.</remarks>
/// <returns>A tuple containing a boolean indicating whether the Moodle feature is enabled and an integer representing
/// the current Moodle user ID.</returns>
private async Task<(bool enableMoodle, int currentMoodleUserId)> GetMoodleFeatureStateAsync()
{
var enableMoodle = Task.Run(() => this.featureManager.IsEnabledAsync(FeatureFlags.EnableMoodle)).Result;
this.ViewBag.EnableMoodle = enableMoodle;
int currentMoodleUserId = this.CurrentMoodleUserId;

if (currentMoodleUserId == 0)
{
currentMoodleUserId = await this.dashboardService.GetMoodleUserIdAsync(this.CurrentUserId);
}

this.ViewBag.ValidMoodleUser = currentMoodleUserId > 0;
return (enableMoodle, currentMoodleUserId);
}
}
}
Loading
Loading