From bf0780969b9a7f2b83c5a4d65d0fad5ef5b4e427 Mon Sep 17 00:00:00 2001 From: RogerHowellDfE <96429508+RogerHowellDfE@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:31:35 +0000 Subject: [PATCH 01/13] Create codeql.yml using supplied template --- .github/workflows/codeql.yml | 94 ++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..0050d0422 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,94 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Advanced" + +on: + push: + branches: [ "master", "dev" ] + pull_request: + branches: [ "master", "dev" ] + schedule: + - cron: '33 9 * * 6' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: csharp + build-mode: none + - language: javascript-typescript + build-mode: none + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" From 535d89d65c1f4b6b9f3ff800fdf4849d7b752d1c Mon Sep 17 00:00:00 2001 From: RogerHowellDfE <96429508+RogerHowellDfE@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:34:43 +0000 Subject: [PATCH 02/13] enable autobuild for c# and javascript --- .github/workflows/codeql.yml | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0050d0422..daa626277 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -44,9 +44,9 @@ jobs: matrix: include: - language: csharp - build-mode: none + build-mode: autobuild - language: javascript-typescript - build-mode: none + build-mode: autobuild # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' # Use `c-cpp` to analyze code written in C, C++ or both # Use 'java-kotlin' to analyze code written in Java, Kotlin or both @@ -72,22 +72,6 @@ jobs: # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # queries: security-extended,security-and-quality - # If the analyze step fails for one of the languages you are analyzing with - # "We were unable to automatically build your code", modify the matrix above - # to set the build mode to "manual" for that language. Then modify this step - # to build your code. - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - if: matrix.build-mode == 'manual' - shell: bash - run: | - echo 'If you are using a "manual" build mode for one or more of the' \ - 'languages you are analyzing, replace this with the commands to build' \ - 'your code, for example:' - echo ' make bootstrap' - echo ' make release' - exit 1 - - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 with: From 665f83ac32a2bbe4fc342cedacb45b1ec7cd61c1 Mon Sep 17 00:00:00 2001 From: RogerHowellDfE <96429508+RogerHowellDfE@users.noreply.github.com> Date: Thu, 31 Oct 2024 16:42:56 +0000 Subject: [PATCH 03/13] disable javascript build (not supported by autobuild) --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index daa626277..946dc68c2 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -46,7 +46,7 @@ jobs: - language: csharp build-mode: autobuild - language: javascript-typescript - build-mode: autobuild + build-mode: none # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' # Use `c-cpp` to analyze code written in C, C++ or both # Use 'java-kotlin' to analyze code written in Java, Kotlin or both From 805444fda8c59c501373c3abecc2c03908354630 Mon Sep 17 00:00:00 2001 From: RogerHowellDfE <96429508+RogerHowellDfE@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:02:22 +0000 Subject: [PATCH 04/13] switch to manual build steps for c#/.net framework --- .github/workflows/codeql.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 946dc68c2..10b7a8bbd 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -44,7 +44,7 @@ jobs: matrix: include: - language: csharp - build-mode: autobuild + build-mode: manual - language: javascript-typescript build-mode: none # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' @@ -71,7 +71,33 @@ jobs: # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # queries: security-extended,security-and-quality + + + #### BEGIN CUSTOM BUILD STEPS FOR C#/.NET FRAMEWORK + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1 + - name: Setup NuGet + uses: NuGet/setup-nuget@v1.1.1 + + - name: Setup VSTest + uses: darenm/Setup-VSTest@v1 + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' && matrix.language == 'csharp' + shell: bash + working-directory: ./Web + run: | + nuget restore EdubaseWeb.sln + msbuild EdubaseWeb.sln /t:Rebuild /p:platform="Any CPU" /p:configuration="Release" + #### END CUSTOM BUILD STEPS FOR C#/.NET FRAMEWORK + + - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 with: From 03ed22affe7f8b1d88e17761badc301df40c8846 Mon Sep 17 00:00:00 2001 From: RogerHowellDfE <96429508+RogerHowellDfE@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:05:21 +0000 Subject: [PATCH 05/13] switch to windows runner due to .NET Framework --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 10b7a8bbd..9e931bfa7 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -27,7 +27,7 @@ jobs: # - https://gh.io/supported-runners-and-hardware-resources # - https://gh.io/using-larger-runners (GitHub.com only) # Consider using larger runners or machines with greater resources for possible analysis time improvements. - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + runs-on: windows-latest ## .NET Framework requires Windows runner permissions: # required for all workflows security-events: write From 403858ff647e9659d71bb86b63e5e8cbc134143e Mon Sep 17 00:00:00 2001 From: RogerHowellDfE <96429508+RogerHowellDfE@users.noreply.github.com> Date: Thu, 31 Oct 2024 17:11:28 +0000 Subject: [PATCH 06/13] try switching back to autobuild now we're on a windows runner --- .github/workflows/codeql.yml | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 9e931bfa7..8d50f330d 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -44,7 +44,7 @@ jobs: matrix: include: - language: csharp - build-mode: manual + build-mode: autobuild - language: javascript-typescript build-mode: none # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' @@ -71,32 +71,6 @@ jobs: # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # queries: security-extended,security-and-quality - - - #### BEGIN CUSTOM BUILD STEPS FOR C#/.NET FRAMEWORK - - name: Setup MSBuild - uses: microsoft/setup-msbuild@v1 - - - name: Setup NuGet - uses: NuGet/setup-nuget@v1.1.1 - - - name: Setup VSTest - uses: darenm/Setup-VSTest@v1 - - # If the analyze step fails for one of the languages you are analyzing with - # "We were unable to automatically build your code", modify the matrix above - # to set the build mode to "manual" for that language. Then modify this step - # to build your code. - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - if: matrix.build-mode == 'manual' && matrix.language == 'csharp' - shell: bash - working-directory: ./Web - run: | - nuget restore EdubaseWeb.sln - msbuild EdubaseWeb.sln /t:Rebuild /p:platform="Any CPU" /p:configuration="Release" - #### END CUSTOM BUILD STEPS FOR C#/.NET FRAMEWORK - - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 From e1f9a6fd0a9aba032de33fd7b784053ebf81d9c4 Mon Sep 17 00:00:00 2001 From: Roger Howell Date: Thu, 31 Oct 2024 17:23:27 +0000 Subject: [PATCH 07/13] Remove unused file --- .../Partials/AdditionalAddresses.cshtml | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 Web/Edubase.Web.UI/Areas/Establishments/Views/Establishment/Partials/AdditionalAddresses.cshtml diff --git a/Web/Edubase.Web.UI/Areas/Establishments/Views/Establishment/Partials/AdditionalAddresses.cshtml b/Web/Edubase.Web.UI/Areas/Establishments/Views/Establishment/Partials/AdditionalAddresses.cshtml deleted file mode 100644 index 381da7df6..000000000 --- a/Web/Edubase.Web.UI/Areas/Establishments/Views/Establishment/Partials/AdditionalAddresses.cshtml +++ /dev/null @@ -1,44 +0,0 @@ -@using Edubase.Web.UI.Models -@using ViewModel = Edubase.Web.UI.Models.CreateEditEstablishmentModel -@model ViewModel - -@* TODO correct field mappings*@ -
- -
- - -
- -
- - @Html.TextBoxFor(x => x.Address.Line1, new { maxlength = 120, id = "school-street", @class = "form-control" }) -
- -
- - @Html.TextBoxFor(x => x.Address.Locality, new { maxlength = 120, id = "school-locality", @class = "form-control" }) -
- -
- - @Html.TextBoxFor(x => x.Address.Line3, new { maxlength = 120, id = "school-addressline3", @class = "form-control" }) -
- -
- - @Html.TextBoxFor(x => x.Address.CityOrTown, new { maxlength = 120, id = "school-town", @class = "form-control" }) -
- -
- - @Html.TextBoxFor(x => x.Address.PostCode, new { maxlength = 120, id = "school-postcode", @class = "form-control" }) -
-
- -
- -
From ad3110d455b40763b601ffb16c16188f194a660e Mon Sep 17 00:00:00 2001 From: Roger Howell Date: Thu, 31 Oct 2024 17:34:19 +0000 Subject: [PATCH 08/13] remove unused template directory --- .../Views/GOVUK/Layouts/template.cshtml | 335 ------------------ .../Partials/footer-support-links.cshtml | 5 - .../Views/GOVUK/Partials/footer-top.cshtml | 39 -- .../Views/GOVUK/Partials/phase/alpha.cshtml | 6 - .../Views/GOVUK/Partials/phase/beta.cshtml | 14 - .../Views/GOVUK/Views/errors/404.cshtml | 13 - .../Views/GOVUK/Views/errors/500.cshtml | 12 - .../GOVUK/Views/ga/google-analytics.cshtml | 47 --- 8 files changed, 471 deletions(-) delete mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Layouts/template.cshtml delete mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-support-links.cshtml delete mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-top.cshtml delete mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/alpha.cshtml delete mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/beta.cshtml delete mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Views/errors/404.cshtml delete mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Views/errors/500.cshtml delete mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Views/ga/google-analytics.cshtml diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Layouts/template.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Layouts/template.cshtml deleted file mode 100644 index 712e40c6a..000000000 --- a/Web/Edubase.Web.UI/Views/GOVUK/Layouts/template.cshtml +++ /dev/null @@ -1,335 +0,0 @@ -@using Edubase.Web.UI.Controllers -@using Microsoft.AspNet.Identity -@{ - ViewBag.assetsPath = "/public/govuk-frontend"; - - var title = !string.IsNullOrEmpty(ViewBag.Title) ? ViewBag.Title : "Get Information about Schools"; - var documentTitle = string.Format("{0} - {1}", title, "GOV.UK"); - var gtmKey = System.Configuration.ConfigurationManager.AppSettings["GoogleTagManagerKey"]; - - var envHeader = System.Configuration.ConfigurationManager.AppSettings["Environment"] ?? string.Empty; - var version = typeof(HomeController).Assembly.GetName().Version; - var acceptsAnalytics = HttpContext.Current.Request.Cookies["analytics_preferences"]?.Value.ToString(); -} - - - - - - - @documentTitle - - - - - @if (acceptsAnalytics == "True") - { - - } - - - - - - - - - - - - - - - - - - - - - @RenderSection("Head", required: false) - - @functions { - public static IHtmlString GetCsrfTokenMeta() - { - string cookieToken, formToken; - System.Web.Helpers.AntiForgery.GetTokens(null, out cookieToken, out formToken); - return new HtmlString($""); - }} - @Html.AntiForgeryToken() - @GetCsrfTokenMeta() - - - - - @if (acceptsAnalytics == "True") - { - - } - - - @if (!Request.Browser.Browser.Contains("MSIE 8")) - { - - } - @{ - switch (envHeader.ToLower()) - { - case "localdev": -
ATTENTION! This is a Test version, running locally @ViewBag.AdditionalDevWarning
- break; - - case "dev": - case "exp": -
ATTENTION! This is a Test version shared with other developers @ViewBag.AdditionalDevWarning
- break; - - case "stage": -
ATTENTION! This is a Pre-production version used for testing purposes
- break; - - case "prodlcs": -
ATTENTION! This is a Prod LCS version
- break; - } - } - - @{ - // Not all uses of the URL on this page strictly require being forwarded header aware, - // but it's easier and safer to be consistent and just do it everywhere. - var urlHelper = new UrlHelper(Request.RequestContext); - var currentUrl = urlHelper.GetForwardedHeaderAwareUrl(); - } - -
- @RenderSection("bodyStart", required: false) - - Skip to main content - - @if (acceptsAnalytics == null) - { - - } - @if (TempData["CookiesPrefsSaved"] != null) - { - - } - - - - - - - @RenderSection("AfterHeader", required: false) - - - - -
- @(Html.Partial("../govuk/partials/phase/beta")) - @RenderSection("BackLink", false) - @RenderSection("BreadCrumbs", false) - @RenderBody() -
-
-
- -
-
- - - - - @RenderSection("BodyEnd", required: false) - - - @if (Request.IsAuthenticated) - { - - } -
- - diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-support-links.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-support-links.cshtml deleted file mode 100644 index 501e46fb0..000000000 --- a/Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-support-links.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -

Support links

- diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-top.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-top.cshtml deleted file mode 100644 index 506452261..000000000 --- a/Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-top.cshtml +++ /dev/null @@ -1,39 +0,0 @@ - \ No newline at end of file diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/alpha.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/alpha.cshtml deleted file mode 100644 index 975181565..000000000 --- a/Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/alpha.cshtml +++ /dev/null @@ -1,6 +0,0 @@ -
-

- ALPHA - This is a new service. Our feedback survey is currently closed. We plan to re-open it soon. -

-
diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/beta.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/beta.cshtml deleted file mode 100644 index 58adc8bc3..000000000 --- a/Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/beta.cshtml +++ /dev/null @@ -1,14 +0,0 @@ -
-

- - - How could we improve this service? Your - - feedback - - will help. - -

-
diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Views/errors/404.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Views/errors/404.cshtml deleted file mode 100644 index 997b00cda..000000000 --- a/Web/Edubase.Web.UI/Views/GOVUK/Views/errors/404.cshtml +++ /dev/null @@ -1,13 +0,0 @@ -@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase -@{ - Layout = "dfe/layouts/template"; - ViewBag.pageTitle = "Page not found"; - ViewBag.pageClass = "home-page"; -} -
-
-

@ViewBag.pageTitle

-

If you entered a web address please check it was correct.

-

You can also search for a school or college to find the information you need.

-
-
diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Views/errors/500.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Views/errors/500.cshtml deleted file mode 100644 index 8386d079f..000000000 --- a/Web/Edubase.Web.UI/Views/GOVUK/Views/errors/500.cshtml +++ /dev/null @@ -1,12 +0,0 @@ -@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase -@{ - Layout = "dfe/layouts/template"; - ViewBag.pageTitle = "Sorry we are experiencing technical problems."; - ViewBag.pageClass = "home-page"; -} -
-
-

@ViewBag.pageTitle

-

Please try again in a few moments.

-
-
\ No newline at end of file diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Views/ga/google-analytics.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Views/ga/google-analytics.cshtml deleted file mode 100644 index 73d53992e..000000000 --- a/Web/Edubase.Web.UI/Views/GOVUK/Views/ga/google-analytics.cshtml +++ /dev/null @@ -1,47 +0,0 @@ - - - -<%# Universal analytics %> - From eba772e480faa4cf32df9b62a17e6d8f3d606f47 Mon Sep 17 00:00:00 2001 From: Roger Howell Date: Thu, 31 Oct 2024 18:45:11 +0000 Subject: [PATCH 09/13] Revert some file removals, but leaving files which refer to `Nancy` as deleted. --- .../Views/GOVUK/Layouts/template.cshtml | 335 ++++++++++++++++++ .../Partials/footer-support-links.cshtml | 5 + .../Views/GOVUK/Partials/footer-top.cshtml | 39 ++ .../Views/GOVUK/Partials/phase/alpha.cshtml | 6 + .../Views/GOVUK/Partials/phase/beta.cshtml | 14 + .../GOVUK/Views/ga/google-analytics.cshtml | 47 +++ 6 files changed, 446 insertions(+) create mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Layouts/template.cshtml create mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-support-links.cshtml create mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-top.cshtml create mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/alpha.cshtml create mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/beta.cshtml create mode 100644 Web/Edubase.Web.UI/Views/GOVUK/Views/ga/google-analytics.cshtml diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Layouts/template.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Layouts/template.cshtml new file mode 100644 index 000000000..712e40c6a --- /dev/null +++ b/Web/Edubase.Web.UI/Views/GOVUK/Layouts/template.cshtml @@ -0,0 +1,335 @@ +@using Edubase.Web.UI.Controllers +@using Microsoft.AspNet.Identity +@{ + ViewBag.assetsPath = "/public/govuk-frontend"; + + var title = !string.IsNullOrEmpty(ViewBag.Title) ? ViewBag.Title : "Get Information about Schools"; + var documentTitle = string.Format("{0} - {1}", title, "GOV.UK"); + var gtmKey = System.Configuration.ConfigurationManager.AppSettings["GoogleTagManagerKey"]; + + var envHeader = System.Configuration.ConfigurationManager.AppSettings["Environment"] ?? string.Empty; + var version = typeof(HomeController).Assembly.GetName().Version; + var acceptsAnalytics = HttpContext.Current.Request.Cookies["analytics_preferences"]?.Value.ToString(); +} + + + + + + + @documentTitle + + + + + @if (acceptsAnalytics == "True") + { + + } + + + + + + + + + + + + + + + + + + + + + @RenderSection("Head", required: false) + + @functions { + public static IHtmlString GetCsrfTokenMeta() + { + string cookieToken, formToken; + System.Web.Helpers.AntiForgery.GetTokens(null, out cookieToken, out formToken); + return new HtmlString($""); + }} + @Html.AntiForgeryToken() + @GetCsrfTokenMeta() + + + + + @if (acceptsAnalytics == "True") + { + + } + + + @if (!Request.Browser.Browser.Contains("MSIE 8")) + { + + } + @{ + switch (envHeader.ToLower()) + { + case "localdev": +
ATTENTION! This is a Test version, running locally @ViewBag.AdditionalDevWarning
+ break; + + case "dev": + case "exp": +
ATTENTION! This is a Test version shared with other developers @ViewBag.AdditionalDevWarning
+ break; + + case "stage": +
ATTENTION! This is a Pre-production version used for testing purposes
+ break; + + case "prodlcs": +
ATTENTION! This is a Prod LCS version
+ break; + } + } + + @{ + // Not all uses of the URL on this page strictly require being forwarded header aware, + // but it's easier and safer to be consistent and just do it everywhere. + var urlHelper = new UrlHelper(Request.RequestContext); + var currentUrl = urlHelper.GetForwardedHeaderAwareUrl(); + } + +
+ @RenderSection("bodyStart", required: false) + + Skip to main content + + @if (acceptsAnalytics == null) + { + + } + @if (TempData["CookiesPrefsSaved"] != null) + { + + } + + + + + + + @RenderSection("AfterHeader", required: false) + + + + +
+ @(Html.Partial("../govuk/partials/phase/beta")) + @RenderSection("BackLink", false) + @RenderSection("BreadCrumbs", false) + @RenderBody() +
+
+
+ +
+
+ + + + + @RenderSection("BodyEnd", required: false) + + + @if (Request.IsAuthenticated) + { + + } +
+ + diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-support-links.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-support-links.cshtml new file mode 100644 index 000000000..501e46fb0 --- /dev/null +++ b/Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-support-links.cshtml @@ -0,0 +1,5 @@ +

Support links

+
    +
  • @Html.ActionLink("Cookies", "Cookies", "Home", new {area = ""}, null)
  • +
  • Contact
  • +
diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-top.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-top.cshtml new file mode 100644 index 000000000..4588b9f72 --- /dev/null +++ b/Web/Edubase.Web.UI/Views/GOVUK/Partials/footer-top.cshtml @@ -0,0 +1,39 @@ + diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/alpha.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/alpha.cshtml new file mode 100644 index 000000000..975181565 --- /dev/null +++ b/Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/alpha.cshtml @@ -0,0 +1,6 @@ +
+

+ ALPHA + This is a new service. Our feedback survey is currently closed. We plan to re-open it soon. +

+
diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/beta.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/beta.cshtml new file mode 100644 index 000000000..58adc8bc3 --- /dev/null +++ b/Web/Edubase.Web.UI/Views/GOVUK/Partials/phase/beta.cshtml @@ -0,0 +1,14 @@ +
+

+ + + How could we improve this service? Your + + feedback + + will help. + +

+
diff --git a/Web/Edubase.Web.UI/Views/GOVUK/Views/ga/google-analytics.cshtml b/Web/Edubase.Web.UI/Views/GOVUK/Views/ga/google-analytics.cshtml new file mode 100644 index 000000000..73d53992e --- /dev/null +++ b/Web/Edubase.Web.UI/Views/GOVUK/Views/ga/google-analytics.cshtml @@ -0,0 +1,47 @@ + + + +<%# Universal analytics %> + From 7ff8cf7b9d0a72a28b6c8a611b6089f5c2a3e969 Mon Sep 17 00:00:00 2001 From: Roger Howell Date: Thu, 7 Nov 2024 19:34:58 +0000 Subject: [PATCH 10/13] Change the Ofsted link logic, displaying the link if the matching Ofsted web page is detected to exist. This uses the same/similar underlying logic as for our links to SFB and CSCP. Display of the ratings and last inspection date continue to be driven by permissions. #234530 --- .../Domain/OfstedRatingUrl.cs | 20 ----- Web/Edubase.Services/Edubase.Services.csproj | 3 +- .../ExternalLookup/ExternalLookupService.cs | 16 +++- .../ExternalLookup/IExternalLookupService.cs | 2 + .../ExternalLookup/IOfstedService.cs | 10 +++ .../ExternalLookup/OfstedService.cs | 74 +++++++++++++++++++ Web/Edubase.Web.UI/App_Start/IocConfig.cs | 34 +++++++++ .../Controllers/EstablishmentController.cs | 5 +- .../Establishment/Partials/Header.cshtml | 45 +++++++---- .../Models/EstablishmentDetailViewModel.cs | 25 ++++++- Web/Edubase.Web.UI/Web.config | 23 ++++++ .../EstablishmentControllerTests.cs | 6 ++ 12 files changed, 221 insertions(+), 42 deletions(-) delete mode 100644 Web/Edubase.Services/Domain/OfstedRatingUrl.cs create mode 100644 Web/Edubase.Services/ExternalLookup/IOfstedService.cs create mode 100644 Web/Edubase.Services/ExternalLookup/OfstedService.cs diff --git a/Web/Edubase.Services/Domain/OfstedRatingUrl.cs b/Web/Edubase.Services/Domain/OfstedRatingUrl.cs deleted file mode 100644 index 09797217c..000000000 --- a/Web/Edubase.Services/Domain/OfstedRatingUrl.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Edubase.Common; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Edubase.Services.Domain -{ - public class OfstedRatingUrl - { - private int? _urn; - - public OfstedRatingUrl(int? urn) - { - _urn = urn; - } - public override string ToString() => _urn != null ? $"http://www.ofsted.gov.uk/oxedu_providers/full/(urn)/{_urn}" : string.Empty; - } -} diff --git a/Web/Edubase.Services/Edubase.Services.csproj b/Web/Edubase.Services/Edubase.Services.csproj index 06e42b137..b76070d0e 100644 --- a/Web/Edubase.Services/Edubase.Services.csproj +++ b/Web/Edubase.Services/Edubase.Services.csproj @@ -245,6 +245,8 @@ + + @@ -258,7 +260,6 @@ - diff --git a/Web/Edubase.Services/ExternalLookup/ExternalLookupService.cs b/Web/Edubase.Services/ExternalLookup/ExternalLookupService.cs index 50e8e1d68..9b3380638 100644 --- a/Web/Edubase.Services/ExternalLookup/ExternalLookupService.cs +++ b/Web/Edubase.Services/ExternalLookup/ExternalLookupService.cs @@ -6,11 +6,13 @@ public class ExternalLookupService : IExternalLookupService { private readonly IFSCPDService _fscpdService; private readonly IFBService _fbService; + private readonly IOfstedService _ofstedService; - public ExternalLookupService(IFSCPDService fscpdService, IFBService fbService) + public ExternalLookupService(IFSCPDService fscpdService, IFBService fbService, IOfstedService ofstedService) { _fscpdService = fscpdService; _fbService = fbService; + _ofstedService = ofstedService; } public async Task FscpdCheckExists(int? urn, string name, bool mat = false) @@ -32,5 +34,17 @@ public string SfbURL(int? lookupId, FbType lookupType) { return _fbService.PublicURL(lookupId, lookupType); } + + public async Task OfstedReportPageCheckExists(int? urn) + { + return await _ofstedService.CheckExists(urn); + } + + public string OfstedReportUrl(int? urn) + { + return _ofstedService.PublicURL(urn); + } + + } } diff --git a/Web/Edubase.Services/ExternalLookup/IExternalLookupService.cs b/Web/Edubase.Services/ExternalLookup/IExternalLookupService.cs index 38dab3e76..06973b7a3 100644 --- a/Web/Edubase.Services/ExternalLookup/IExternalLookupService.cs +++ b/Web/Edubase.Services/ExternalLookup/IExternalLookupService.cs @@ -8,5 +8,7 @@ public interface IExternalLookupService string FscpdURL(int? urn, string name, bool mat = false); Task SfbCheckExists(int? lookupId, FbType lookupType); string SfbURL(int? lookupId, FbType lookupType); + Task OfstedReportPageCheckExists(int? urn); + string OfstedReportUrl(int? urn); } } diff --git a/Web/Edubase.Services/ExternalLookup/IOfstedService.cs b/Web/Edubase.Services/ExternalLookup/IOfstedService.cs new file mode 100644 index 000000000..6a6834c45 --- /dev/null +++ b/Web/Edubase.Services/ExternalLookup/IOfstedService.cs @@ -0,0 +1,10 @@ +using System.Threading.Tasks; + +namespace Edubase.Services.ExternalLookup +{ + public interface IOfstedService + { + Task CheckExists(int? urn); + string PublicURL(int? urn); + } +} diff --git a/Web/Edubase.Services/ExternalLookup/OfstedService.cs b/Web/Edubase.Services/ExternalLookup/OfstedService.cs new file mode 100644 index 000000000..be3a0b955 --- /dev/null +++ b/Web/Edubase.Services/ExternalLookup/OfstedService.cs @@ -0,0 +1,74 @@ +using System; +using System.Configuration; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Runtime.Caching; +using System.Threading.Tasks; +using Edubase.Common; +using Edubase.Services.IntegrationEndPoints; +using Polly; + +namespace Edubase.Services.ExternalLookup +{ + public class OfstedService : IOfstedService + { + private readonly HttpClient _client; + + private const string OfstedServiceTimeoutKey = "OfstedService_TimeoutSeconds"; + + private IAsyncPolicy RetryPolicy => PollyUtil.CreateRetryPolicy(RetryIntervals, OfstedServiceTimeoutKey); + + private TimeSpan[] RetryIntervals => PollyUtil.CsvSecondsToTimeSpans(ConfigurationManager.AppSettings["OfstedService_RetryIntervals"]); + + private int CacheHours => ConfigurationManager.AppSettings["OfstedService_CacheHours"].ToInteger() ?? 8; + + private string BaseUrl => ConfigurationManager.AppSettings["OfstedService_BaseAddress"]; + + + public OfstedService(HttpClient client) + { + _client = client; + } + + private HttpRequestMessage HeadRestRequest(int? urn) + { + return new HttpRequestMessage(HttpMethod.Head, PublicURL(urn)); + } + + + public async Task CheckExists(int? urn) + { + var key = $"ofsted-report-{urn}"; + var cachedPageStatus = MemoryCache.Default.Get(key); + if (cachedPageStatus != null) + { + return (bool) cachedPageStatus; + } + + var request = HeadRestRequest(urn); + try + { + using (var response = await RetryPolicy.ExecuteAsync(async () => + await _client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead))) + { + var isOk = response.StatusCode == HttpStatusCode.OK; + MemoryCache.Default.Set( + new CacheItem(key, isOk), + new CacheItemPolicy {AbsoluteExpiration = DateTimeOffset.Now.AddHours(CacheHours)} + ); + return isOk; + } + } + catch + { + return false; + } + } + + public string PublicURL(int? urn) + { + return BaseUrl + urn; + } + } +} diff --git a/Web/Edubase.Web.UI/App_Start/IocConfig.cs b/Web/Edubase.Web.UI/App_Start/IocConfig.cs index 74498124e..014eafcea 100644 --- a/Web/Edubase.Web.UI/App_Start/IocConfig.cs +++ b/Web/Edubase.Web.UI/App_Start/IocConfig.cs @@ -137,6 +137,9 @@ private static void RegisterTypes(ContainerBuilder builder) builder.RegisterInstance(CreateSfbClient()).SingleInstance().Named("SfbClient"); builder.Register(c => new FBService(c.ResolveNamed("SfbClient"))).As(); + builder.RegisterInstance(CreateOfstedClient()).SingleInstance().Named("OfstedClient"); + builder.Register(c => new OfstedService(c.ResolveNamed("OfstedClient"))).As(); + builder.RegisterType().As().SingleInstance().AutoActivate(); builder.RegisterInstance(AutoMapperWebConfiguration.CreateMapper()).As(); @@ -319,6 +322,37 @@ private static HttpClient CreateSfbClient() return client; } + private static HttpClient CreateOfstedClient() + { + if (!int.TryParse(ConfigurationManager.AppSettings["OfstedService_TimeoutSeconds"], out var timeoutsettings)) + { + timeoutsettings = 10; + } + + var client = new HttpClient(new HttpClientHandler { UseCookies = false }) + { + BaseAddress = new Uri(ConfigurationManager.AppSettings["OfstedService_BaseAddress"]), + Timeout = TimeSpan.FromSeconds(timeoutsettings) + }; + + var apiUsername = ConfigurationManager.AppSettings["OfstedService_Username"]; + var apiPassword = ConfigurationManager.AppSettings["OfstedService_Password"]; + + if (!apiUsername.IsNullOrEmpty() && !apiPassword.IsNullOrEmpty()) + { + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(Basic, + new BasicAuthCredentials(apiUsername, apiPassword).ToString()); + } + + var productValue = new ProductInfoHeaderValue("GIAS", Assembly.GetExecutingAssembly().GetName().Version.ToString()); + var commentValue = new ProductInfoHeaderValue("(Chrome; Edge; Mozilla; +https://www.get-information-schools.service.gov.uk)"); + + client.DefaultRequestHeaders.UserAgent.Add(productValue); + client.DefaultRequestHeaders.UserAgent.Add(commentValue); + + return client; + } + public static HttpClient CreateLookupClient(string lookupApiAddress, string lookupApiUsername, string lookupApiPassword) { // If the given values are empty, default to using the generic/standard API address and credentials diff --git a/Web/Edubase.Web.UI/Areas/Establishments/Controllers/EstablishmentController.cs b/Web/Edubase.Web.UI/Areas/Establishments/Controllers/EstablishmentController.cs index e31218c5f..8422a3212 100644 --- a/Web/Edubase.Web.UI/Areas/Establishments/Controllers/EstablishmentController.cs +++ b/Web/Edubase.Web.UI/Areas/Establishments/Controllers/EstablishmentController.cs @@ -357,6 +357,7 @@ public async Task Details(int id, string searchQueryString = "", e await viewModel.SetFscpdAsync(); await viewModel.SetShowFinancialBenchmarkingAsync(); + await viewModel.SetShowOfstedReportLinkAsync(); viewModel.TabWarnings = new TabWarningsModel(viewModel.Establishment.TypeId); @@ -382,7 +383,7 @@ await Task.WhenAll( viewModel.SchoolCapacityToolTipLink = viewModel.Establishment.TypeId.Equals((int)ET.AcademySecure16to19) ? string.Empty : _resourcesHelper.GetResourceStringForEstablishment("SchoolCapacityLink", (eLookupEstablishmentTypeGroup?) viewModel.Establishment.EstablishmentTypeGroupId, User); - + return View(viewModel); } @@ -405,6 +406,8 @@ public async Task GovernanceChangeHistoryAsync(int id, int skip = }; await viewModel.SetFscpdAsync(); + await viewModel.SetShowFinancialBenchmarkingAsync(); + await viewModel.SetShowOfstedReportLinkAsync(); await Task.WhenAll( PopulateDisplayPolicies(viewModel) diff --git a/Web/Edubase.Web.UI/Areas/Establishments/Views/Establishment/Partials/Header.cshtml b/Web/Edubase.Web.UI/Areas/Establishments/Views/Establishment/Partials/Header.cshtml index 2c5f69dfa..efb59ac6b 100644 --- a/Web/Edubase.Web.UI/Areas/Establishments/Views/Establishment/Partials/Header.cshtml +++ b/Web/Edubase.Web.UI/Areas/Establishments/Views/Establishment/Partials/Header.cshtml @@ -194,31 +194,44 @@ @OtherServicesLinks() } -@if (Model.DisplayPolicy.OfstedRatingId) +@* + * #232199: If there is a valid Ofsted report page on the Ofsted website for this establishment's URN, always link to it. + * Where we _also_ hold a cached copy of the latest Ofsted rating and inspection date, follow the usual display-policy rules. + *@ +@if (Model.ShowOfstedReportLink) {
-
Ofsted rating
+
Ofsted rating and reports
- @if (Model.Establishment.OfstedRatingId.HasValue) - { - @Model.OfstedRatingName - } - else - { - Not recorded + @{ + var newlineRequired = false; } - @if (Model.Establishment.OfstedInspectionDate.HasValue) + @if (Model.DisplayPolicy.OfstedRatingId) { - (Last inspection: @(Model.Establishment.OfstedInspectionDate?.ToString("d MMMM yyyy"))) + if (Model.Establishment.OfstedRatingId.HasValue) + { + newlineRequired = true; + @Model.OfstedRatingName + if (Model.Establishment.OfstedInspectionDate.HasValue) + { + (Last inspection: @(Model.Establishment.OfstedInspectionDate?.ToString("d MMMM yyyy"))) + } + } + else + { + newlineRequired = true; + Latest inspection results not recorded on GIAS + } } - @if (Model.OfstedRatingReportUrl != null) + + @if (newlineRequired) { -
- - Ofsted report (opens in new tab) - +
} + + Ofsted report (opens in new tab) +
} diff --git a/Web/Edubase.Web.UI/Models/EstablishmentDetailViewModel.cs b/Web/Edubase.Web.UI/Models/EstablishmentDetailViewModel.cs index 8751c9f95..18075c480 100644 --- a/Web/Edubase.Web.UI/Models/EstablishmentDetailViewModel.cs +++ b/Web/Edubase.Web.UI/Models/EstablishmentDetailViewModel.cs @@ -82,9 +82,6 @@ public enum GovRole public eLookupSearchSource? SearchSource { get; set; } - public string OfstedRatingReportUrl => (Establishment.OfstedRatingId.HasValue - ? new OfstedRatingUrl(Establishment.Urn).ToString() : null as string); - public string GetGroupFieldLabel(GroupModel model) => _groupType2FieldLabelMappings[model.GroupTypeId.Value]; public string AgeRangeToolTip { get; set; } @@ -234,6 +231,28 @@ public async Task SetShowFinancialBenchmarkingAsync() } } + public string OfstedReportUrl => extService.OfstedReportUrl(Establishment.Urn); + + private bool? _showOfstedReportLink; + + public bool ShowOfstedReportLink + { + get => _showOfstedReportLink.GetValueOrDefault(); + private set => _showOfstedReportLink = value; + } + + public async Task SetShowOfstedReportLinkAsync() + { + if (Establishment == null) + { + return; + } + if (!_showOfstedReportLink.HasValue) + { + _showOfstedReportLink = extService != null && await extService.OfstedReportPageCheckExists(Establishment.Urn); + } + } + public TabWarningsModel TabWarnings { get; set; } public string ClosedStatusMessage { diff --git a/Web/Edubase.Web.UI/Web.config b/Web/Edubase.Web.UI/Web.config index 291135182..3ef57d95c 100644 --- a/Web/Edubase.Web.UI/Web.config +++ b/Web/Edubase.Web.UI/Web.config @@ -266,6 +266,29 @@ + + + + + + + + + + + diff --git a/Web/Edubase.Web.UIUnitTests/Areas/Establishments/Controllers/EstablishmentControllerTests.cs b/Web/Edubase.Web.UIUnitTests/Areas/Establishments/Controllers/EstablishmentControllerTests.cs index 42922ac41..d2e25277b 100644 --- a/Web/Edubase.Web.UIUnitTests/Areas/Establishments/Controllers/EstablishmentControllerTests.cs +++ b/Web/Edubase.Web.UIUnitTests/Areas/Establishments/Controllers/EstablishmentControllerTests.cs @@ -53,6 +53,7 @@ public class EstablishmentControllerTests: IDisposable private readonly Mock mockUrlHelper = new Mock(MockBehavior.Loose); private readonly Mock mockFscpdService = new Mock(MockBehavior.Strict); private readonly Mock mockFbService = new Mock(MockBehavior.Strict); + private readonly Mock mockOfstedService = new Mock(MockBehavior.Strict); private readonly Mock mockGovernorsGridViewModelFactory = new Mock(MockBehavior.Loose); private bool disposedValue; @@ -396,6 +397,9 @@ public async Task Estab_Details_TabDisplayPolicy(bool locationDataFieldViewable, .ReturnsAsync(() => true); mockExternalLookupService.Setup(x => x.SfbCheckExists(123456, FbType.School)) .ReturnsAsync(() => true); + mockExternalLookupService.Setup(x => x.OfstedReportPageCheckExists(123456)) + .ReturnsAsync(() => true); + var response = await controller.Details(urn); @@ -461,6 +465,8 @@ public async Task Estab_Details_TabEditPolicy(bool locationDataFieldEditable, bo .ReturnsAsync(() => true); mockExternalLookupService.Setup(x => x.SfbCheckExists(123456, FbType.School)) .ReturnsAsync(() => true); + mockExternalLookupService.Setup(x => x.OfstedReportPageCheckExists(123456)) + .ReturnsAsync(() => true); var response = await controller.Details(urn); From 6d236e54532cdb0ae979a64a5bd4f14ff520734f Mon Sep 17 00:00:00 2001 From: Roger Howell Date: Thu, 7 Nov 2024 20:10:22 +0000 Subject: [PATCH 11/13] Add a feature flag to toggle whether the Ofsted inspection ratings are displayed. Defaults to `true` (display) so that this can be safely deployed into production and turned on at a later date. #234530 --- .../Controllers/EstablishmentController.cs | 3 ++ .../Establishment/Partials/Header.cshtml | 31 ++++++++++++------- .../Models/EstablishmentDetailViewModel.cs | 2 ++ Web/Edubase.Web.UI/Web.config | 3 ++ 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Web/Edubase.Web.UI/Areas/Establishments/Controllers/EstablishmentController.cs b/Web/Edubase.Web.UI/Areas/Establishments/Controllers/EstablishmentController.cs index 8422a3212..31d9b53c4 100644 --- a/Web/Edubase.Web.UI/Areas/Establishments/Controllers/EstablishmentController.cs +++ b/Web/Edubase.Web.UI/Areas/Establishments/Controllers/EstablishmentController.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Configuration; using System.Linq; using System.Linq.Expressions; using System.Reflection; @@ -359,6 +360,8 @@ public async Task Details(int id, string searchQueryString = "", e await viewModel.SetShowFinancialBenchmarkingAsync(); await viewModel.SetShowOfstedReportLinkAsync(); + viewModel.ShowOfstedRatings = "true".Equals(ConfigurationManager.AppSettings["Feature_Ofsted_ShowRatings"]); + viewModel.TabWarnings = new TabWarningsModel(viewModel.Establishment.TypeId); await Task.WhenAll( diff --git a/Web/Edubase.Web.UI/Areas/Establishments/Views/Establishment/Partials/Header.cshtml b/Web/Edubase.Web.UI/Areas/Establishments/Views/Establishment/Partials/Header.cshtml index efb59ac6b..0c640160e 100644 --- a/Web/Edubase.Web.UI/Areas/Establishments/Views/Establishment/Partials/Header.cshtml +++ b/Web/Edubase.Web.UI/Areas/Establishments/Views/Establishment/Partials/Header.cshtml @@ -207,22 +207,31 @@ var newlineRequired = false; } - @if (Model.DisplayPolicy.OfstedRatingId) + @if (Model.ShowOfstedRatings) { - if (Model.Establishment.OfstedRatingId.HasValue) + if (Model.DisplayPolicy.OfstedRatingId) { - newlineRequired = true; - @Model.OfstedRatingName - if (Model.Establishment.OfstedInspectionDate.HasValue) + if (Model.Establishment.OfstedRatingId.HasValue) { - (Last inspection: @(Model.Establishment.OfstedInspectionDate?.ToString("d MMMM yyyy"))) + newlineRequired = true; + @Model.OfstedRatingName + if (Model.Establishment.OfstedInspectionDate.HasValue) + { + (Last inspection: @(Model.Establishment.OfstedInspectionDate?.ToString("d MMMM yyyy"))) + } + } + else + { + newlineRequired = true; + Latest inspection results not recorded on GIAS } } - else - { - newlineRequired = true; - Latest inspection results not recorded on GIAS - } + } + else + { + // TODO: Update this once the content is agreed in #232329. + newlineRequired = true; + GIAS no longer displays Ofsted inspection ratings } @if (newlineRequired) diff --git a/Web/Edubase.Web.UI/Models/EstablishmentDetailViewModel.cs b/Web/Edubase.Web.UI/Models/EstablishmentDetailViewModel.cs index 18075c480..879e4ce56 100644 --- a/Web/Edubase.Web.UI/Models/EstablishmentDetailViewModel.cs +++ b/Web/Edubase.Web.UI/Models/EstablishmentDetailViewModel.cs @@ -231,6 +231,8 @@ public async Task SetShowFinancialBenchmarkingAsync() } } + public bool ShowOfstedRatings { get; set; } = true; + public string OfstedReportUrl => extService.OfstedReportUrl(Establishment.Urn); private bool? _showOfstedReportLink; diff --git a/Web/Edubase.Web.UI/Web.config b/Web/Edubase.Web.UI/Web.config index 3ef57d95c..69f3e93c2 100644 --- a/Web/Edubase.Web.UI/Web.config +++ b/Web/Edubase.Web.UI/Web.config @@ -288,6 +288,9 @@ + + + From ddfbb234a76c0d8a387759e9456ac5858a50c606 Mon Sep 17 00:00:00 2001 From: Roger Howell Date: Thu, 7 Nov 2024 20:39:25 +0000 Subject: [PATCH 12/13] Add feature flag to optionally hide the Ofsted fields from the bulk update guidance. #232199 / #232608 --- .../Guidance/EstablishmentBulkUpdate.cshtml | 42 ++++++++++++------- Web/Edubase.Web.UI/Web.config | 10 +++++ 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/Web/Edubase.Web.UI/Views/Guidance/EstablishmentBulkUpdate.cshtml b/Web/Edubase.Web.UI/Views/Guidance/EstablishmentBulkUpdate.cshtml index 5b5727282..77718d024 100644 --- a/Web/Edubase.Web.UI/Views/Guidance/EstablishmentBulkUpdate.cshtml +++ b/Web/Edubase.Web.UI/Views/Guidance/EstablishmentBulkUpdate.cshtml @@ -1,3 +1,4 @@ +@using System.Configuration @{ ViewBag.Title = "Get Information about Schools"; ViewBag.imageMQ = "(max-width: 768px)"; @@ -277,18 +278,22 @@ TelephoneNum Telephone - - OfstedRating - Ofsted rating - - - OfstedLastInspection - Ofsted last inspection - - - Osted report link - Ofsted report link - + + @if("true".Equals(ConfigurationManager.AppSettings["Feature_Ofsted_ShowBulkUpdateGuidance"], StringComparison.OrdinalIgnoreCase)) { + + OfstedRating + Ofsted rating + + + OfstedLastInspection + Ofsted last inspection + + + Osted report link + Ofsted report link + + } + Inspectorate Inspectorate @@ -550,10 +555,15 @@ DateofLastFullBridgeInspection Date of the Last Bridge Visit - - DateofLastFullOfstedInspection - Date of the Last Ofsted Visit - + + @if("true".Equals(ConfigurationManager.AppSettings["Feature_Ofsted_ShowBulkUpdateGuidance"], StringComparison.OrdinalIgnoreCase)) + { + + DateofLastFullOfstedInspection + Date of the Last Ofsted Visit + + } + DateofLastFullISIInspection Date of the Last ISI Visit diff --git a/Web/Edubase.Web.UI/Web.config b/Web/Edubase.Web.UI/Web.config index 291135182..92683994d 100644 --- a/Web/Edubase.Web.UI/Web.config +++ b/Web/Edubase.Web.UI/Web.config @@ -266,6 +266,16 @@ + + + + + + From daa4fdc1a53a6f93f47c74dd52136e00c91e8742 Mon Sep 17 00:00:00 2001 From: RogerHowellDfE <96429508+RogerHowellDfE@users.noreply.github.com> Date: Fri, 22 Nov 2024 10:43:14 +0000 Subject: [PATCH 13/13] Default Ofsted feature flags to new behaviour (hide Ofsted ratings) --- Web/Edubase.Web.UI/Web.config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Web/Edubase.Web.UI/Web.config b/Web/Edubase.Web.UI/Web.config index cbeb07808..e9110302a 100644 --- a/Web/Edubase.Web.UI/Web.config +++ b/Web/Edubase.Web.UI/Web.config @@ -289,14 +289,14 @@ - + - +