diff --git a/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Controllers/ExportController.cs b/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Controllers/ExportController.cs index 1d445a94b..c993e0d15 100644 --- a/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Controllers/ExportController.cs +++ b/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Controllers/ExportController.cs @@ -306,7 +306,7 @@ public ActionResult GenerateZip(long id, long versionid, string format) if (manifest != null) { string manifestPath = OutputDatasetManager.GetDynamicDatasetStorePath(id, - datasetVersionNumber, "manifest", ".json"); + datasetVersionNumber, "general_metadata", ".json"); string fullFilePath = Path.Combine(AppConfiguration.DataPath, manifestPath); string directory = Path.GetDirectoryName(fullFilePath); if (!Directory.Exists(directory)) @@ -314,7 +314,7 @@ public ActionResult GenerateZip(long id, long versionid, string format) System.IO.File.WriteAllText(fullFilePath, manifest, System.Text.Encoding.UTF8); - archive.AddFileToArchive(fullFilePath, "manifest.json"); + archive.AddFileToArchive(fullFilePath, "general_metadata.json"); } string title = datasetVersion.Title; diff --git a/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Helpers/ApiDatasetHelper.cs b/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Helpers/ApiDatasetHelper.cs index f5bea837d..1bd9e2285 100644 --- a/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Helpers/ApiDatasetHelper.cs +++ b/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Helpers/ApiDatasetHelper.cs @@ -14,6 +14,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Web; using System.Xml.Linq; namespace BExIS.Modules.Dim.UI.Helpers @@ -85,6 +86,51 @@ public ApiDatasetModel GetContent(DatasetVersion datasetVersion, long id, long v // check for publication date datasetModel.PublicationDate = publicAndDate.Item2.ToString(new CultureInfo("en-US")); + // Add download information + try + { + // Get download source URL from current request context + if (HttpContext.Current != null && HttpContext.Current.Request != null) + { + datasetModel.DownloadSource = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority); + } + else + { + datasetModel.DownloadSource = "unknown"; + } + } + catch (Exception) + { + datasetModel.DownloadSource = "unknown"; + } + + // Set download date time to current time + datasetModel.DownloadDateTime = DateTime.Now.ToString(new CultureInfo("en-US")); + + // Set downloaded by user (simplified version for safety) + try + { + var userName = string.Empty; + try + { + userName = HttpContext.Current?.User?.Identity?.Name; + } + catch { } + + if (!string.IsNullOrEmpty(userName)) + { + datasetModel.DownloadedBy = userName; + } + else + { + datasetModel.DownloadedBy = "anonymous"; + } + } + catch (Exception) + { + datasetModel.DownloadedBy = "anonymous"; + } + return datasetModel; } diff --git a/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Models/API/ApiModels.cs b/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Models/API/ApiModels.cs index b063fd88a..ba21c8986 100644 --- a/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Models/API/ApiModels.cs +++ b/Console/BExIS.Web.Shell/Areas/DIM/BExIS.Modules.Dim.UI/Models/API/ApiModels.cs @@ -43,6 +43,9 @@ public class ApiDatasetModel public Dictionary> Parties { get; set; } public string VersionDate { get; set; } public object Names { get; internal set; } + public string DownloadSource { get; set; } + public string DownloadDateTime { get; set; } + public string DownloadedBy { get; set; } public ApiDatasetModel() {