Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(REPORT-327626): Bold reports V6.1 Release Changes #25

Merged
merged 3 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
34 changes: 15 additions & 19 deletions Controllers/demos/ExternalReportServer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#region Copyright Syncfusion Inc. 2001-2019.
// Copyright Syncfusion Inc. 2001-2019. All rights reserved.
#region Copyright Syncfusion Inc. 2001-{{copyright}}.
// Copyright Syncfusion Inc. 2001-{{copyright}}. All rights reserved.
Vishnu7101 marked this conversation as resolved.
Show resolved Hide resolved
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// licensing@syncfusion.com. Any infringement will be prosecuted under
Expand Down Expand Up @@ -36,14 +36,14 @@ public ExternalServer(IWebHostEnvironment hostingEnvironment)
_hostingEnvironment = hostingEnvironment;
basePath = _hostingEnvironment.WebRootPath;
}
public override List<CatalogItem> GetItems(string folderName, ItemTypeEnum type)
public override List<CatalogItem> GetItems(string folderName, ItemTypeEnum type, string permissionType)
{
List<CatalogItem> _items = new List<CatalogItem>();
string targetFolder = this.basePath + @"\Resources\demos\";
string targetFolder = Path.Combine(this.basePath, "resources", "demos");

if (type == ItemTypeEnum.Folder || type == ItemTypeEnum.Report)
{
targetFolder = targetFolder + @"Report\";
targetFolder = Path.Combine(targetFolder, "Report");
if (!(string.IsNullOrEmpty(folderName) || folderName.Trim() == "/"))
{
targetFolder = targetFolder + folderName;
Expand All @@ -52,7 +52,7 @@ public override List<CatalogItem> GetItems(string folderName, ItemTypeEnum type)

if (type == ItemTypeEnum.DataSet)
{
foreach (var file in Directory.GetFiles(targetFolder + "DataSet"))
foreach (var file in Directory.GetFiles(Path.Combine(targetFolder, "DataSet")))
{
CatalogItem catalogItem = new CatalogItem();
catalogItem.Name = Path.GetFileNameWithoutExtension(file);
Expand All @@ -63,7 +63,7 @@ public override List<CatalogItem> GetItems(string folderName, ItemTypeEnum type)
}
else if (type == ItemTypeEnum.DataSource)
{
foreach (var file in Directory.GetFiles(targetFolder + "DataSource"))
foreach (var file in Directory.GetFiles(Path.Combine(targetFolder, "DataSource")))
{
CatalogItem catalogItem = new CatalogItem();
catalogItem.Name = Path.GetFileNameWithoutExtension(file);
Expand Down Expand Up @@ -107,9 +107,8 @@ public override bool CreateReport(string reportName, string folderName, byte[] r

public override System.IO.Stream GetReport()
{
string reportBasePath = @"\Resources\demos\Report\";
string targetFolder = this.basePath + reportBasePath;
string reportPath = Path.HasExtension(this.ReportPath) ? targetFolder + this.ReportPath : targetFolder + this.ReportPath + "." + this.reportType.ToLower();
string targetFolder = Path.Combine(this.basePath, "resources", "demos", "Report");
string reportPath = Path.HasExtension(this.ReportPath) ? Path.Combine(targetFolder, this.ReportPath) : Path.Combine(targetFolder, $"{this.ReportPath}.{this.reportType.ToLower()}");

if (File.Exists(reportPath))
{
Expand Down Expand Up @@ -137,9 +136,8 @@ public override bool EditReport(byte[] reportdata)
string reportName = reportPath.Substring(reportPath.IndexOf('/') + 1).Trim();
string catagoryName = reportPath.Substring(0, reportPath.IndexOf('/') > 0 ? reportPath.IndexOf('/') : 0).Trim();

string targetFolder = this.basePath + @"\Resources\Demos\Report\";

string reportPat = targetFolder + catagoryName + @"\" + reportName;
string targetFolder = Path.Combine(this.basePath, "resources", "demos", "Report");
string reportPat = Path.Combine(targetFolder, catagoryName, reportName);
File.WriteAllBytes(reportPat, reportdata.ToArray());

return true;
Expand All @@ -152,10 +150,8 @@ public override DataSourceDefinition GetDataSourceDefinition(string dataSource)
string[] _dataSrcPathHierarchy = dataSource.Split('/');
dataSource = _dataSrcPathHierarchy.Last().TrimStart('/');
}

string targetFolder = this.basePath + @"\Resources\Demos\DataSource\";

string dataSourcePath = targetFolder + dataSource + ".rds";
string targetFolder = Path.Combine(this.basePath, "resources", "demos", "DataSource");
string dataSourcePath = Path.Combine(targetFolder, $"{dataSource}.rds");

if (File.Exists(dataSourcePath))
{
Expand All @@ -182,8 +178,8 @@ DataSourceDefinition GetDataSourceDefinition(byte[] dataSourceContent, string na

public override SharedDatasetinfo GetSharedDataDefinition(string dataSet)
{
string targetFolder = this.basePath + @"\Resources\Demos\DataSet\";
string dataSetPath = targetFolder + dataSet + ".rsd";
string targetFolder = Path.Combine(this.basePath, "resources", "demos", "DataSet");
string dataSetPath = Path.Combine(targetFolder, $"{dataSet}.rsd");

if (File.Exists(dataSetPath))
{
Expand Down
12 changes: 7 additions & 5 deletions Controllers/demos/LogExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ public static void RegisterLog4NetConfig(string configPath = "")
{
XmlConfigurator.Configure(repository, new System.IO.FileInfo(configPath));
}
else if (File.Exists(prjDir + "\\Log4Net.config"))
else if (File.Exists(Path.Combine(prjDir, "log4net.config")))
{
XmlConfigurator.Configure(repository, new System.IO.FileInfo(prjDir + "\\Log4Net.config"));
XmlConfigurator.Configure(repository, new System.IO.FileInfo(Path.Combine(prjDir, "log4net.config")));
}
else if (File.Exists(prjDir + "\\logs\\Log4Net.config"))
else if (File.Exists(Path.Combine(prjDir, "logs", "log4net.config")))
{
XmlConfigurator.Configure(repository, new System.IO.FileInfo(prjDir + "\\logs\\Log4Net.config"));
XmlConfigurator.Configure(repository, new System.IO.FileInfo(Path.Combine(prjDir, "logs", "log4net.config")));
}
else
{
Expand All @@ -107,7 +107,9 @@ public static void RegisterLog4NetConfig(FileInfo configInfo)

private static string GetExecutablePath()
{
string path = (string)(log4net.GlobalContext.Properties["LogPath"] + "\\");
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(path);
}
}
Expand Down
10 changes: 8 additions & 2 deletions Controllers/demos/ReportDesignerWebApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ public bool DisposeObjects()
{
try
{
string targetFolder = this._hostingEnvironment.WebRootPath + "\\";
targetFolder += "Cache";
string targetFolder = Path.Combine(this._hostingEnvironment.WebRootPath, "Cache");

if (Directory.Exists(targetFolder))
{
Expand Down Expand Up @@ -113,8 +112,15 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)
string reportName = reportOption.ReportModel.ReportPath;
reportOption.ReportModel.ReportingServer = this.Server;
reportOption.ReportModel.ReportServerUrl = this.ServerURL;
reportOption.ReportModel.EmbedImageData = true;
reportOption.ReportModel.ReportServerCredential = new NetworkCredential("Sample", "Passwprd");

if (reportOption.ReportModel.FontSettings == null)
{
reportOption.ReportModel.FontSettings = new BoldReports.RDL.Data.FontSettings();
}
reportOption.ReportModel.FontSettings.BasePath = Path.Combine(_hostingEnvironment.WebRootPath, "fonts");

}

public void OnReportLoaded(ReportViewerOptions reportOption)
Expand Down
9 changes: 7 additions & 2 deletions Controllers/demos/ReportViewerWebApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)
reportOption.ReportModel.EmbedImageData = true;
string reportName = reportOption.ReportModel.ReportPath;
string basePath = _hostingEnvironment.WebRootPath;
string reportBasePath = @"\Resources\Demos\Report\";
string reportPath = reportName.TrimStart('~');
if ((dynamic)reportOption.ReportModel.ReportPath.Split('.').Length <= 1 && reportOption.ReportModel.ProcessingMode.ToString() == "Remote")
{
Expand All @@ -64,8 +63,14 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)
{
reportPath += ".rdlc";
}
FileStream reportStream = new FileStream(basePath + reportBasePath + reportPath, FileMode.Open, FileAccess.Read);
FileStream reportStream = new FileStream(Path.Combine(basePath, "resources", "demos", "Report", reportPath), FileMode.Open, FileAccess.Read);
reportOption.ReportModel.Stream = reportStream;

if (reportOption.ReportModel.FontSettings == null)
{
reportOption.ReportModel.FontSettings = new BoldReports.RDL.Data.FontSettings();
}
reportOption.ReportModel.FontSettings.BasePath = Path.Combine(_hostingEnvironment.WebRootPath, "fonts");
}

// Method will be called when reported is loaded with internally to start to layout process with ReportHelper.
Expand Down
19 changes: 14 additions & 5 deletions Controllers/docs/report-designer/DesignerAPIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using BoldReports.Web.ReportViewer;
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using System.IO;
using Microsoft.AspNetCore.Cors;
Expand All @@ -14,6 +15,8 @@ namespace ReportServices.Controllers.docs
public class ReportingAPIController : Controller, IReportDesignerController
{
private Microsoft.Extensions.Caching.Memory.IMemoryCache _cache;

private IWebHostEnvironment _hostingEnvironment;
public ReportingAPIController(Microsoft.Extensions.Caching.Memory.IMemoryCache memoryCache)
{
_cache = memoryCache;
Expand Down Expand Up @@ -80,18 +83,24 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)

reportOption.ReportModel.ExportResources.Scripts = new List<string>
{
Path.Combine(resourcesPath, "bold-reports/common/bold.reports.common.min.js"),
Path.Combine(resourcesPath, "bold-reports/common/bold.reports.widgets.min.js"),
resourcesPath + "/scripts/bold-reports/common/bold.reports.common.min.js",
resourcesPath + "/scripts/bold-reports/common/bold.reports.widgets.min.js",
// Chart component script
Path.Combine(resourcesPath, "bold-reports/data-visualization/ej.chart.min.js"),
resourcesPath + "/scripts/bold-reports/data-visualization/ej.chart.min.js",
// Report Viewer Script
Path.Combine(resourcesPath, "bold-reports/bold.report-viewer.min.js")
resourcesPath + "/scripts/bold-reports/bold.report-viewer.min.js"
};

reportOption.ReportModel.ExportResources.DependentScripts = new List<string>
{
Path.Combine(resourcesPath, "dependent/jquery.min.js")
resourcesPath + "/scripts/dependent/jquery.min.js"
};

if (reportOption.ReportModel.FontSettings == null)
{
reportOption.ReportModel.FontSettings = new BoldReports.RDL.Data.FontSettings();
}
reportOption.ReportModel.FontSettings.BasePath = Path.Combine(_hostingEnvironment.WebRootPath, "fonts");
}

public bool SetData(string key, string itemId, ItemInfo itemData, out string errMsg)
Expand Down
14 changes: 7 additions & 7 deletions Controllers/docs/report-viewer/CSVOptionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)

reportOption.ReportModel.ExportResources.Scripts = new List<string>
{
resourcesPath + @"\scripts\bold-reports\common\bold.reports.common.min.js",
resourcesPath + @"\scripts\bold-reports\common\bold.reports.widgets.min.js",
//Chart component script
resourcesPath + @"\scripts\bold-reports\data-visualization\ej.chart.min.js",
//Report Viewer Script
resourcesPath + @"\scripts\bold-reports\bold.report-viewer.min.js"
resourcesPath + "/scripts/bold-reports/common/bold.reports.common.min.js",
resourcesPath + "/scripts/bold-reports/common/bold.reports.widgets.min.js",
// Chart component script
resourcesPath + "/scripts/bold-reports/data-visualization/ej.chart.min.js",
// Report Viewer Script
resourcesPath + "/scripts/bold-reports/bold.report-viewer.min.js"
};

reportOption.ReportModel.ExportResources.DependentScripts = new List<string>
{
resourcesPath + @"\scripts\dependent\jquery.min.js"
resourcesPath + "/scripts/dependent/jquery.min.js"
};

reportOption.ReportModel.CsvOptions = new BoldReports.Writer.CsvOptions()
Expand Down
14 changes: 7 additions & 7 deletions Controllers/docs/report-viewer/CustomAjaxHeadersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)

reportOption.ReportModel.ExportResources.Scripts = new List<string>
{
resourcesPath + @"\scripts\bold-reports\common\bold.reports.common.min.js",
resourcesPath + @"\scripts\bold-reports\common\bold.reports.widgets.min.js",
//Chart component script
resourcesPath + @"\scripts\bold-reports\data-visualization\ej.chart.min.js",
//Report Viewer Script
resourcesPath + @"\scripts\bold-reports\bold.report-viewer.min.js"
resourcesPath + "/scripts/bold-reports/common/bold.reports.common.min.js",
resourcesPath + "/scripts/bold-reports/common/bold.reports.widgets.min.js",
// Chart component script
resourcesPath + "/scripts/bold-reports/data-visualization/ej.chart.min.js",
// Report Viewer Script
resourcesPath + "/scripts/bold-reports/bold.report-viewer.min.js"
};

reportOption.ReportModel.ExportResources.DependentScripts = new List<string>
{
resourcesPath + @"\scripts\dependent\jquery.min.js"
resourcesPath + "/scripts/dependent/jquery.min.js"
};
}

Expand Down
14 changes: 7 additions & 7 deletions Controllers/docs/report-viewer/ExcelOptionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)

reportOption.ReportModel.ExportResources.Scripts = new List<string>
{
resourcesPath + @"\scripts\bold-reports\common\bold.reports.common.min.js",
resourcesPath + @"\scripts\bold-reports\common\bold.reports.widgets.min.js",
//Chart component script
resourcesPath + @"\scripts\bold-reports\data-visualization\ej.chart.min.js",
//Report Viewer Script
resourcesPath + @"\scripts\bold-reports\bold.report-viewer.min.js"
resourcesPath + "/scripts/bold-reports/common/bold.reports.common.min.js",
resourcesPath + "/scripts/bold-reports/common/bold.reports.widgets.min.js",
// Chart component script
resourcesPath + "/scripts/bold-reports/data-visualization/ej.chart.min.js",
// Report Viewer Script
resourcesPath + "/scripts/bold-reports/bold.report-viewer.min.js"
};

reportOption.ReportModel.ExportResources.DependentScripts = new List<string>
{
resourcesPath + @"\scripts\dependent\jquery.min.js"
resourcesPath + "/scripts/dependent/jquery.min.js"
};

reportOption.ReportModel.ExcelOptions = new BoldReports.Writer.ExcelOptions()
Expand Down
14 changes: 7 additions & 7 deletions Controllers/docs/report-viewer/GetReportParametersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)

reportOption.ReportModel.ExportResources.Scripts = new List<string>
{
resourcesPath + @"\scripts\bold-reports\common\bold.reports.common.min.js",
resourcesPath + @"\scripts\bold-reports\common\bold.reports.widgets.min.js",
//Chart component script
resourcesPath + @"\scripts\bold-reports\data-visualization\ej.chart.min.js",
//Report Viewer Script
resourcesPath + @"\scripts\bold-reports\bold.report-viewer.min.js"
resourcesPath + "/scripts/bold-reports/common/bold.reports.common.min.js",
resourcesPath + "/scripts/bold-reports/common/bold.reports.widgets.min.js",
// Chart component script
resourcesPath + "/scripts/bold-reports/data-visualization/ej.chart.min.js",
// Report Viewer Script
resourcesPath + "/scripts/bold-reports/bold.report-viewer.min.js"
};

reportOption.ReportModel.ExportResources.DependentScripts = new List<string>
{
resourcesPath + @"\scripts\dependent\jquery.min.js"
resourcesPath + "/scripts/dependent/jquery.min.js"
};
}

Expand Down
14 changes: 7 additions & 7 deletions Controllers/docs/report-viewer/HtmlOptionsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ public void OnInitReportOptions(ReportViewerOptions reportOption)

reportOption.ReportModel.ExportResources.Scripts = new List<string>
{
resourcesPath + @"\scripts\bold-reports\common\bold.reports.common.min.js",
resourcesPath + @"\scripts\bold-reports\common\bold.reports.widgets.min.js",
//Chart component script
resourcesPath + @"\scripts\bold-reports\data-visualization\ej.chart.min.js",
//Report Viewer Script
resourcesPath + @"\scripts\bold-reports\bold.report-viewer.min.js"
resourcesPath + "/scripts/bold-reports/common/bold.reports.common.min.js",
resourcesPath + "/scripts/bold-reports/common/bold.reports.widgets.min.js",
// Chart component script
resourcesPath + "/scripts/bold-reports/data-visualization/ej.chart.min.js",
// Report Viewer Script
resourcesPath + "/scripts/bold-reports/bold.report-viewer.min.js"
};

reportOption.ReportModel.ExportResources.DependentScripts = new List<string>
{
resourcesPath + @"\scripts\dependent\jquery.min.js"
resourcesPath + "/scripts/dependent/jquery.min.js"
};

reportOption.ReportModel.HTMLOptions = new BoldReports.Writer.HTMLOptions()
Expand Down
Loading
Loading