diff --git a/SharepointToolbox/Services/Export/DuplicatesHtmlExportService.cs b/SharepointToolbox/Services/Export/DuplicatesHtmlExportService.cs index 3055346..b0a3da6 100644 --- a/SharepointToolbox/Services/Export/DuplicatesHtmlExportService.cs +++ b/SharepointToolbox/Services/Export/DuplicatesHtmlExportService.cs @@ -10,7 +10,7 @@ namespace SharepointToolbox.Services.Export; /// public class DuplicatesHtmlExportService { - public string BuildHtml(IReadOnlyList groups) + public string BuildHtml(IReadOnlyList groups, ReportBranding? branding = null) { var sb = new StringBuilder(); @@ -52,6 +52,9 @@ public class DuplicatesHtmlExportService + """); + sb.Append(BrandingHtmlHelper.BuildBrandingHeader(branding)); + sb.AppendLine("""

Duplicate Detection Report

"""); @@ -117,9 +120,9 @@ public class DuplicatesHtmlExportService return sb.ToString(); } - public async Task WriteAsync(IReadOnlyList groups, string filePath, CancellationToken ct) + public async Task WriteAsync(IReadOnlyList groups, string filePath, CancellationToken ct, ReportBranding? branding = null) { - var html = BuildHtml(groups); + var html = BuildHtml(groups, branding); await System.IO.File.WriteAllTextAsync(filePath, html, Encoding.UTF8, ct); } diff --git a/SharepointToolbox/Services/Export/HtmlExportService.cs b/SharepointToolbox/Services/Export/HtmlExportService.cs index 9553c96..3846977 100644 --- a/SharepointToolbox/Services/Export/HtmlExportService.cs +++ b/SharepointToolbox/Services/Export/HtmlExportService.cs @@ -15,7 +15,7 @@ public class HtmlExportService /// Builds a self-contained HTML string from the supplied permission entries. /// Includes inline CSS, inline JS filter, stats cards, type badges, unique/inherited badges, and user pills. /// - public string BuildHtml(IReadOnlyList entries) + public string BuildHtml(IReadOnlyList entries, ReportBranding? branding = null) { // Compute stats var totalEntries = entries.Count; @@ -73,6 +73,7 @@ a:hover { text-decoration: underline; } // ── BODY ─────────────────────────────────────────────────────────────── sb.AppendLine(""); + sb.Append(BrandingHtmlHelper.BuildBrandingHeader(branding)); sb.AppendLine("

SharePoint Permissions Report

"); // Stats cards @@ -148,9 +149,9 @@ a:hover { text-decoration: underline; } /// /// Writes the HTML report to the specified file path using UTF-8 without BOM. /// - public async Task WriteAsync(IReadOnlyList entries, string filePath, CancellationToken ct) + public async Task WriteAsync(IReadOnlyList entries, string filePath, CancellationToken ct, ReportBranding? branding = null) { - var html = BuildHtml(entries); + var html = BuildHtml(entries, branding); await File.WriteAllTextAsync(filePath, html, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), ct); } @@ -168,7 +169,7 @@ a:hover { text-decoration: underline; } /// Builds a self-contained HTML string from simplified permission entries. /// Includes risk-level summary cards, color-coded rows, and simplified labels column. /// - public string BuildHtml(IReadOnlyList entries) + public string BuildHtml(IReadOnlyList entries, ReportBranding? branding = null) { var summaries = PermissionSummaryBuilder.Build(entries); @@ -228,6 +229,7 @@ a:hover { text-decoration: underline; } sb.AppendLine(""); sb.AppendLine(""); + sb.Append(BrandingHtmlHelper.BuildBrandingHeader(branding)); sb.AppendLine("

SharePoint Permissions Report (Simplified)

"); // Stats cards @@ -317,9 +319,9 @@ a:hover { text-decoration: underline; } /// /// Writes the simplified HTML report to the specified file path. /// - public async Task WriteAsync(IReadOnlyList entries, string filePath, CancellationToken ct) + public async Task WriteAsync(IReadOnlyList entries, string filePath, CancellationToken ct, ReportBranding? branding = null) { - var html = BuildHtml(entries); + var html = BuildHtml(entries, branding); await File.WriteAllTextAsync(filePath, html, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), ct); } diff --git a/SharepointToolbox/Services/Export/SearchHtmlExportService.cs b/SharepointToolbox/Services/Export/SearchHtmlExportService.cs index 9617d97..97cc59c 100644 --- a/SharepointToolbox/Services/Export/SearchHtmlExportService.cs +++ b/SharepointToolbox/Services/Export/SearchHtmlExportService.cs @@ -11,7 +11,7 @@ namespace SharepointToolbox.Services.Export; /// public class SearchHtmlExportService { - public string BuildHtml(IReadOnlyList results) + public string BuildHtml(IReadOnlyList results, ReportBranding? branding = null) { var sb = new StringBuilder(); @@ -43,6 +43,9 @@ public class SearchHtmlExportService + """); + sb.Append(BrandingHtmlHelper.BuildBrandingHeader(branding)); + sb.AppendLine("""

File Search Results

@@ -135,9 +138,9 @@ public class SearchHtmlExportService return sb.ToString(); } - public async Task WriteAsync(IReadOnlyList results, string filePath, CancellationToken ct) + public async Task WriteAsync(IReadOnlyList results, string filePath, CancellationToken ct, ReportBranding? branding = null) { - var html = BuildHtml(results); + var html = BuildHtml(results, branding); await System.IO.File.WriteAllTextAsync(filePath, html, Encoding.UTF8, ct); } diff --git a/SharepointToolbox/Services/Export/StorageHtmlExportService.cs b/SharepointToolbox/Services/Export/StorageHtmlExportService.cs index fb1235f..158e697 100644 --- a/SharepointToolbox/Services/Export/StorageHtmlExportService.cs +++ b/SharepointToolbox/Services/Export/StorageHtmlExportService.cs @@ -13,7 +13,7 @@ public class StorageHtmlExportService { private int _togIdx; - public string BuildHtml(IReadOnlyList nodes) + public string BuildHtml(IReadOnlyList nodes, ReportBranding? branding = null) { _togIdx = 0; var sb = new StringBuilder(); @@ -48,6 +48,9 @@ public class StorageHtmlExportService + """); + sb.Append(BrandingHtmlHelper.BuildBrandingHeader(branding)); + sb.AppendLine("""

SharePoint Storage Metrics

"""); @@ -99,7 +102,7 @@ public class StorageHtmlExportService /// /// Builds an HTML report including a file-type breakdown chart section. /// - public string BuildHtml(IReadOnlyList nodes, IReadOnlyList fileTypeMetrics) + public string BuildHtml(IReadOnlyList nodes, IReadOnlyList fileTypeMetrics, ReportBranding? branding = null) { _togIdx = 0; var sb = new StringBuilder(); @@ -145,6 +148,9 @@ public class StorageHtmlExportService + """); + sb.Append(BrandingHtmlHelper.BuildBrandingHeader(branding)); + sb.AppendLine("""

SharePoint Storage Metrics

"""); @@ -227,15 +233,15 @@ public class StorageHtmlExportService return sb.ToString(); } - public async Task WriteAsync(IReadOnlyList nodes, string filePath, CancellationToken ct) + public async Task WriteAsync(IReadOnlyList nodes, string filePath, CancellationToken ct, ReportBranding? branding = null) { - var html = BuildHtml(nodes); + var html = BuildHtml(nodes, branding); await File.WriteAllTextAsync(filePath, html, Encoding.UTF8, ct); } - public async Task WriteAsync(IReadOnlyList nodes, IReadOnlyList fileTypeMetrics, string filePath, CancellationToken ct) + public async Task WriteAsync(IReadOnlyList nodes, IReadOnlyList fileTypeMetrics, string filePath, CancellationToken ct, ReportBranding? branding = null) { - var html = BuildHtml(nodes, fileTypeMetrics); + var html = BuildHtml(nodes, fileTypeMetrics, branding); await File.WriteAllTextAsync(filePath, html, Encoding.UTF8, ct); } diff --git a/SharepointToolbox/Services/Export/UserAccessHtmlExportService.cs b/SharepointToolbox/Services/Export/UserAccessHtmlExportService.cs index de2a55f..bcb2e89 100644 --- a/SharepointToolbox/Services/Export/UserAccessHtmlExportService.cs +++ b/SharepointToolbox/Services/Export/UserAccessHtmlExportService.cs @@ -15,7 +15,7 @@ public class UserAccessHtmlExportService /// /// Builds a self-contained HTML string from the supplied user access entries. /// - public string BuildHtml(IReadOnlyList entries) + public string BuildHtml(IReadOnlyList entries, ReportBranding? branding = null) { // Compute stats var totalAccesses = entries.Count; @@ -88,6 +88,7 @@ a:hover { text-decoration: underline; } // ── BODY ─────────────────────────────────────────────────────────────── sb.AppendLine(""); + sb.Append(BrandingHtmlHelper.BuildBrandingHeader(branding)); sb.AppendLine("

User Access Audit Report

"); // Stats cards @@ -320,9 +321,9 @@ function sortTable(view, col) { /// /// Writes the HTML report to the specified file path using UTF-8 without BOM. /// - public async Task WriteAsync(IReadOnlyList entries, string filePath, CancellationToken ct) + public async Task WriteAsync(IReadOnlyList entries, string filePath, CancellationToken ct, ReportBranding? branding = null) { - var html = BuildHtml(entries); + var html = BuildHtml(entries, branding); await File.WriteAllTextAsync(filePath, html, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), ct); }