feature: document instance exporting

resolves #154
This commit is contained in:
Gary Sharp
2025-02-14 16:05:23 +11:00
parent d3cef11796
commit 786d4809b5
31 changed files with 2194 additions and 38 deletions
+6
View File
@@ -60,6 +60,10 @@
<Compile Include="Repository\Device\Flag\DeviceFlagAssignment.cs" /> <Compile Include="Repository\Device\Flag\DeviceFlagAssignment.cs" />
<Compile Include="Services\Devices\DeviceFlags\DeviceFlagExportOptions.cs" /> <Compile Include="Services\Devices\DeviceFlags\DeviceFlagExportOptions.cs" />
<Compile Include="Services\Devices\DeviceFlags\DeviceFlagExportRecord.cs" /> <Compile Include="Services\Devices\DeviceFlags\DeviceFlagExportRecord.cs" />
<Compile Include="Services\Documents\DocumentExportOptions.cs" />
<Compile Include="Services\Documents\DocumentExportRecord.cs" />
<Compile Include="Services\Exporting\ExportOptionField.cs" />
<Compile Include="Services\Exporting\ExportOptionGroup.cs" />
<Compile Include="Services\Exporting\SavedExport.cs" /> <Compile Include="Services\Exporting\SavedExport.cs" />
<Compile Include="Services\Exporting\SavedExportSchedule.cs" /> <Compile Include="Services\Exporting\SavedExportSchedule.cs" />
<Compile Include="Services\Expressions\Extensions\ImageExpressionFormat.cs" /> <Compile Include="Services\Expressions\Extensions\ImageExpressionFormat.cs" />
@@ -198,6 +202,7 @@
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateBulkGenerate.cs" /> <Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateBulkGenerate.cs" />
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateCreatePackageModel.cs" /> <Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateCreatePackageModel.cs" />
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateCreateModel.cs" /> <Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateCreateModel.cs" />
<Compile Include="UI\Config\DocumentTemplate\ConfigDocumentTemplateExportModel.cs" />
<Compile Include="UI\Config\Export\ConfigExportShowModel.cs" /> <Compile Include="UI\Config\Export\ConfigExportShowModel.cs" />
<Compile Include="UI\Config\Export\ConfigExportEditModel.cs" /> <Compile Include="UI\Config\Export\ConfigExportEditModel.cs" />
<Compile Include="UI\Config\Export\ConfigExportIndexModel.cs" /> <Compile Include="UI\Config\Export\ConfigExportIndexModel.cs" />
@@ -239,6 +244,7 @@
<Compile Include="UI\Job\JobListModel.cs" /> <Compile Include="UI\Job\JobListModel.cs" />
<Compile Include="UI\Job\JobShowModel.cs" /> <Compile Include="UI\Job\JobShowModel.cs" />
<Compile Include="UI\Search\SearchQueryModel.cs" /> <Compile Include="UI\Search\SearchQueryModel.cs" />
<Compile Include="UI\Shared\SharedExportFieldsModel.cs" />
<Compile Include="UI\User\UserIndexModel.cs" /> <Compile Include="UI\User\UserIndexModel.cs" />
<Compile Include="UI\User\UserShowModel.cs" /> <Compile Include="UI\User\UserShowModel.cs" />
</ItemGroup> </ItemGroup>
@@ -0,0 +1,180 @@
using Disco.Models.Exporting;
using Disco.Models.Services.Exporting;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace Disco.Models.Services.Documents
{
public class DocumentExportOptions : IExportOptions
{
public int Version { get; set; } = 1;
public ExportFormat Format { get; set; }
[Required]
public List<string> DocumentTemplateIds { get; set; } = new List<string>();
[Display(Name = "Latest Instance Only")]
public bool LatestOnly { get; set; }
// Document Template
[Display(ShortName = "Document Template", Name = "Identifier", Description = "The identifier of the document template")]
public bool Id { get; set; }
[Display(ShortName = "Document Template", Name = "Description", Description = "The description of the document template")]
public bool Description { get; set; }
[Display(ShortName = "Document Template", Name = "Scope", Description = "The scope of the document template")]
public bool Scope { get; set; }
// Attachment
[Display(ShortName = "Attachment", Name = "Identifier", Description = "The identifier of the document instance")]
public bool AttachmentId { get; set; }
[Display(ShortName = "Attachment", Name = "Created Date", Description = "The date the document instance was created")]
public bool AttachmentCreatedDate { get; set; }
[Display(ShortName = "Attachment", Name = "Created User", Description = "The user who created the document instance")]
public bool AttachmentCreatedUser { get; set; }
[Display(ShortName = "Attachment", Name = "Filename", Description = "The filename of the document instance")]
public bool AttachmentFilename { get; set; }
[Display(ShortName = "Attachment", Name = "Mime Type", Description = "The mime type of the document instance")]
public bool AttachmentMimeType { get; set; }
[Display(ShortName = "Attachment", Name = "Comments", Description = "The comments of the document instance")]
public bool AttachmentComments { get; set; }
// Device
[Display(ShortName = "Device", Name = "Serial Number", Description = "The serial number of the device associated with the document instance")]
public bool DeviceSerialNumber { get; set; }
[Display(ShortName = "Device", Name = "Asset Number", Description = "The asset number of the device associated with the document instance")]
public bool DeviceAssetNumber { get; set; }
[Display(ShortName = "Device", Name = "Location", Description = "The location of the device associated with the document instance")]
public bool DeviceLocation { get; set; }
[Display(ShortName = "Device", Name = "Computer Name", Description = "The computer name of the device associated with the document instance")]
public bool DeviceComputerName { get; set; }
[Display(ShortName = "Device", Name = "Last Network Logon", Description = "The last recorded time that the device associated with the document instance accessed the network")]
public bool DeviceLastNetworkLogon { get; set; }
[Display(ShortName = "Device", Name = "Created Date", Description = "The date that the device associated with the document instance was created in Disco ICT")]
public bool DeviceCreatedDate { get; set; }
[Display(ShortName = "Device", Name = "First Enrolled Date", Description = "The date that the device associated with the document instance was first enrolled in Disco ICT")]
public bool DeviceFirstEnrolledDate { get; set; }
[Display(ShortName = "Device", Name = "Last Enrolled Date", Description = "The date that the device associated with the document instance was last enrolled in Disco ICT")]
public bool DeviceLastEnrolledDate { get; set; }
[Display(ShortName = "Device", Name = "Enrolment Trusted", Description = "Whether the device associated with the document instance is trusted to complete an unauthenticated enrolment")]
public bool DeviceAllowUnauthenticatedEnrol { get; set; }
[Display(ShortName = "Device", Name = "Decommissioned Date", Description = "The date that the device associated with the document instance was decommissioned in Disco ICT")]
public bool DeviceDecommissionedDate { get; set; }
[Display(ShortName = "Device", Name = "Decommissioned Reason", Description = "The reason that the device associated with the document instance was decommissioned")]
public bool DeviceDecommissionedReason { get; set; }
public bool HasDeviceOptions()
=> DeviceSerialNumber || DeviceAssetNumber || DeviceLocation || DeviceComputerName ||
DeviceLastNetworkLogon || DeviceCreatedDate || DeviceFirstEnrolledDate || DeviceLastEnrolledDate ||
DeviceAllowUnauthenticatedEnrol || DeviceDecommissionedDate || DeviceDecommissionedReason;
// Model
[Display(ShortName = "Model", Name = "Identifier", Description = "The identifier of the device model associated with the device")]
public bool ModelId { get; set; }
[Display(ShortName = "Model", Name = "Description", Description = "The description of the device model associated with the device")]
public bool ModelDescription { get; set; }
[Display(ShortName = "Model", Name = "Manufacturer", Description = "The manufacturer of the device model associated with the device")]
public bool ModelManufacturer { get; set; }
[Display(ShortName = "Model", Name = "Model", Description = "The model of the device model associated with the device")]
public bool ModelModel { get; set; }
[Display(ShortName = "Model", Name = "Type", Description = "The type of device model associated with the device")]
public bool ModelType { get; set; }
public bool HasDeviceModelOptions()
=> ModelId || ModelDescription || ModelManufacturer || ModelModel || ModelType;
// Batch
[Display(ShortName = "Batch", Name = "Identifier", Description = "The identifier of the device batch associated with the device")]
public bool BatchId { get; set; }
[Display(ShortName = "Batch", Name = "Name", Description = "The name of the device batch associated with the device")]
public bool BatchName { get; set; }
[Display(ShortName = "Batch", Name = "Purchase Date", Description = "The purchase date of the device batch associated with the device")]
public bool BatchPurchaseDate { get; set; }
[Display(ShortName = "Batch", Name = "Supplier", Description = "The supplier of the device batch associated with the device")]
public bool BatchSupplier { get; set; }
[Display(ShortName = "Batch", Name = "Unit Cost", Description = "The unit cost of the device batch associated with the device")]
public bool BatchUnitCost { get; set; }
[Display(ShortName = "Batch", Name = "Warranty Valid Until Date", Description = "The warranty valid until date of the device batch associated with the device")]
public bool BatchWarrantyValidUntilDate { get; set; }
[Display(ShortName = "Batch", Name = "Insured Date", Description = "The insured date of the device batch associated with the device")]
public bool BatchInsuredDate { get; set; }
[Display(ShortName = "Batch", Name = "Insurance Supplier", Description = "The insurance supplier of the device batch associated with the device")]
public bool BatchInsuranceSupplier { get; set; }
[Display(ShortName = "Batch", Name = "Insured Until Date", Description = "The insured until date of the device batch associated with the device")]
public bool BatchInsuredUntilDate { get; set; }
public bool HasDeviceBatchOptions()
=> BatchId || BatchName || BatchPurchaseDate || BatchSupplier || BatchUnitCost ||
BatchWarrantyValidUntilDate || BatchInsuredDate || BatchInsuranceSupplier || BatchInsuredUntilDate;
// Profile
[Display(ShortName = "Profile", Name = "Identifier", Description = "The identifier of the device profile associated with the device")]
public bool ProfileId { get; set; }
[Display(ShortName = "Profile", Name = "Name", Description = "The name of the device profile associated with the device")]
public bool ProfileName { get; set; }
[Display(ShortName = "Profile", Name = "Short Name", Description = "The short name of the device profile associated with the device")]
public bool ProfileShortName { get; set; }
public bool HasDeviceProfileOptions()
=> ProfileId || ProfileName || ProfileShortName;
// Job
[Display(ShortName = "Job", Name = "Identifier", Description = "The identifier of the job associated with the document instance")]
public bool JobId { get; set; }
[Display(ShortName = "Job", Name = "Status", Description = "The status of the job associated with the document instance")]
public bool JobStatus { get; set; }
[Display(ShortName = "Job", Name = "Type", Description = "The type of the job associated with the document instance")]
public bool JobType { get; set; }
[Display(ShortName = "Job", Name = "Sub Types", Description = "The sub types of the job associated with the document instance")]
public bool JobSubTypes { get; set; }
[Display(ShortName = "Job", Name = "Opened Date", Description = "The date the job was opened associated with the document instance")]
public bool JobOpenedDate { get; set; }
[Display(ShortName = "Job", Name = "Opened User", Description = "The user who opened the job associated with the document instance")]
public bool JobOpenedUser { get; set; }
[Display(ShortName = "Job", Name = "Expected Closed Date", Description = "The expected closed date of the job associated with the document instance")]
public bool JobExpectedClosedDate { get; set; }
[Display(ShortName = "Job", Name = "Closed Date", Description = "The date the job was closed associated with the document instance")]
public bool JobClosedDate { get; set; }
[Display(ShortName = "Job", Name = "Closed User", Description = "The user who closed the job associated with the document instance")]
public bool JobClosedUser { get; set; }
public bool HasJobOptions()
=> JobId || JobStatus || JobType || JobSubTypes || JobOpenedDate || JobOpenedUser ||
JobExpectedClosedDate || JobClosedDate || JobClosedUser;
// User
[Display(ShortName = "User", Name = "Identifier", Description = "The identifier of the user associated with the document instance")]
public bool UserId { get; set; }
[Display(ShortName = "User", Name = "Display Name", Description = "The display name of the user associated with the document instance")]
public bool UserDisplayName { get; set; }
[Display(ShortName = "User", Name = "Surname", Description = "The surname of the user associated with the document instance")]
public bool UserSurname { get; set; }
[Display(ShortName = "User", Name = "Given Name", Description = "The given name of the user associated with the document instance")]
public bool UserGivenName { get; set; }
[Display(ShortName = "User", Name = "Phone Number", Description = "The phone number of the user associated with the document instance")]
public bool UserPhoneNumber { get; set; }
[Display(ShortName = "User", Name = "Email Address", Description = "The email address of the user associated with the document instance")]
public bool UserEmailAddress { get; set; }
public List<string> UserDetailCustom { get; set; } = new List<string>();
public bool HasUserOptions()
=> UserDisplayName || UserSurname || UserGivenName || UserPhoneNumber || UserEmailAddress || UserDetailCustom.Any();
public static DocumentExportOptions DefaultOptions()
{
return new DocumentExportOptions()
{
Format = ExportFormat.Xlsx,
LatestOnly = true,
Id = true,
Description = true,
Scope = true,
AttachmentId = true,
AttachmentCreatedUser = true,
AttachmentCreatedDate = true,
AttachmentComments = true,
DeviceSerialNumber = true,
JobId = true,
JobStatus = true,
JobType = true,
UserId = true,
UserDisplayName = true,
};
}
}
}
@@ -0,0 +1,23 @@
using Disco.Models.Exporting;
using Disco.Models.Repository;
using System.Collections.Generic;
namespace Disco.Models.Services.Documents
{
public class DocumentExportRecord : IExportRecord
{
public DocumentTemplate DocumentTemplate { get; set; }
public IAttachment Attachment { get; set; }
public IAttachmentTarget AttachmentTarget { get; set; }
public Device Device { get; set; }
public Job Job { get; set; }
public string JobStatus { get; set; }
public string JobTypeDescription { get; set; }
public IEnumerable<string> JobSubTypeDescriptions { get; set; }
public User User { get; set; }
public Dictionary<string, string> UserCustomDetails { get; set; }
}
}
@@ -0,0 +1,13 @@
namespace Disco.Models.Services.Exporting
{
public class ExportOptionField
{
public string GroupName { get; set; }
public string Name { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public bool Checked { get; set; }
public string Key { get; set; }
public string Value { get; set; }
}
}
@@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace Disco.Models.Services.Exporting
{
public class ExportOptionGroup : List<ExportOptionField>
{
public string Name { get; set; }
public ExportOptionGroup(string name)
{
Name = name;
}
}
}
@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Disco.Models.Services.Exporting namespace Disco.Models.Services.Exporting
{ {
@@ -0,0 +1,20 @@
using Disco.Models.Services.Documents;
using Disco.Models.Services.Exporting;
using Disco.Models.UI;
using Disco.Models.UI.Shared;
using System;
using System.Collections.Generic;
namespace Disco.Models.Areas.Config.UI.UserFlag
{
public interface ConfigDocumentTemplateExportModel : BaseUIModel
{
DocumentExportOptions Options { get; set; }
Guid? ExportId { get; set; }
ExportResult ExportResult { get; set; }
List<Repository.DocumentTemplate> DocumentTemplates { get; set; }
SharedExportFieldsModel<DocumentExportOptions> Fields { get; set; }
}
}
@@ -0,0 +1,12 @@
using Disco.Models.Services.Exporting;
using System.Collections.Generic;
namespace Disco.Models.UI.Shared
{
public interface SharedExportFieldsModel<T> : BaseUIModel
where T : IExportOptions
{
T Options { get; set; }
List<ExportOptionGroup> FieldGroups { get; set; }
}
}
+8
View File
@@ -51,6 +51,7 @@ namespace Disco.Services.Authorization
{ "Config.DocumentTemplate.Configure", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DocumentTemplate.Configure, (c, v) => c.Config.DocumentTemplate.Configure = v, "Configure Document Templates", "Can configure document templates", false) }, { "Config.DocumentTemplate.Configure", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DocumentTemplate.Configure, (c, v) => c.Config.DocumentTemplate.Configure = v, "Configure Document Templates", "Can configure document templates", false) },
{ "Config.DocumentTemplate.Create", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DocumentTemplate.Create, (c, v) => c.Config.DocumentTemplate.Create = v, "Create Document Templates", "Can create document templates", false) }, { "Config.DocumentTemplate.Create", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DocumentTemplate.Create, (c, v) => c.Config.DocumentTemplate.Create = v, "Create Document Templates", "Can create document templates", false) },
{ "Config.DocumentTemplate.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DocumentTemplate.Delete, (c, v) => c.Config.DocumentTemplate.Delete = v, "Delete Document Templates", "Can delete document templates", false) }, { "Config.DocumentTemplate.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DocumentTemplate.Delete, (c, v) => c.Config.DocumentTemplate.Delete = v, "Delete Document Templates", "Can delete document templates", false) },
{ "Config.DocumentTemplate.Export", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DocumentTemplate.Export, (c, v) => c.Config.DocumentTemplate.Export = v, "Export Attachment Instances", "Can export document attachment instances", false) },
{ "Config.DocumentTemplate.UndetectedPages", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DocumentTemplate.UndetectedPages, (c, v) => c.Config.DocumentTemplate.UndetectedPages = v, "Process Undetected Pages", "Can show and assign imported documents which were not undetected", false) }, { "Config.DocumentTemplate.UndetectedPages", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DocumentTemplate.UndetectedPages, (c, v) => c.Config.DocumentTemplate.UndetectedPages = v, "Process Undetected Pages", "Can show and assign imported documents which were not undetected", false) },
{ "Config.DocumentTemplate.ShowStatus", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DocumentTemplate.ShowStatus, (c, v) => c.Config.DocumentTemplate.ShowStatus = v, "Show Document Template Import Status", "Can show the document template import status", false) }, { "Config.DocumentTemplate.ShowStatus", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DocumentTemplate.ShowStatus, (c, v) => c.Config.DocumentTemplate.ShowStatus = v, "Show Document Template Import Status", "Can show the document template import status", false) },
{ "Config.DocumentTemplate.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DocumentTemplate.Show, (c, v) => c.Config.DocumentTemplate.Show = v, "Show Document Templates", "Can show document templates", false) }, { "Config.DocumentTemplate.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DocumentTemplate.Show, (c, v) => c.Config.DocumentTemplate.Show = v, "Show Document Templates", "Can show document templates", false) },
@@ -275,6 +276,7 @@ namespace Disco.Services.Authorization
new ClaimNavigatorItem("Config.DocumentTemplate.Configure", false), new ClaimNavigatorItem("Config.DocumentTemplate.Configure", false),
new ClaimNavigatorItem("Config.DocumentTemplate.Create", false), new ClaimNavigatorItem("Config.DocumentTemplate.Create", false),
new ClaimNavigatorItem("Config.DocumentTemplate.Delete", false), new ClaimNavigatorItem("Config.DocumentTemplate.Delete", false),
new ClaimNavigatorItem("Config.DocumentTemplate.Export", false),
new ClaimNavigatorItem("Config.DocumentTemplate.UndetectedPages", false), new ClaimNavigatorItem("Config.DocumentTemplate.UndetectedPages", false),
new ClaimNavigatorItem("Config.DocumentTemplate.ShowStatus", false), new ClaimNavigatorItem("Config.DocumentTemplate.ShowStatus", false),
new ClaimNavigatorItem("Config.DocumentTemplate.Show", false), new ClaimNavigatorItem("Config.DocumentTemplate.Show", false),
@@ -595,6 +597,7 @@ namespace Disco.Services.Authorization
c.Config.DocumentTemplate.Configure = true; c.Config.DocumentTemplate.Configure = true;
c.Config.DocumentTemplate.Create = true; c.Config.DocumentTemplate.Create = true;
c.Config.DocumentTemplate.Delete = true; c.Config.DocumentTemplate.Delete = true;
c.Config.DocumentTemplate.Export = true;
c.Config.DocumentTemplate.UndetectedPages = true; c.Config.DocumentTemplate.UndetectedPages = true;
c.Config.DocumentTemplate.ShowStatus = true; c.Config.DocumentTemplate.ShowStatus = true;
c.Config.DocumentTemplate.Show = true; c.Config.DocumentTemplate.Show = true;
@@ -990,6 +993,11 @@ namespace Disco.Services.Authorization
/// </summary> /// </summary>
public const string Delete = "Config.DocumentTemplate.Delete"; public const string Delete = "Config.DocumentTemplate.Delete";
/// <summary>Export Attachment Instances
/// <para>Can export document attachment instances</para>
/// </summary>
public const string Export = "Config.DocumentTemplate.Export";
/// <summary>Process Undetected Pages /// <summary>Process Undetected Pages
/// <para>Can show and assign imported documents which were not undetected</para> /// <para>Can show and assign imported documents which were not undetected</para>
/// </summary> /// </summary>
@@ -27,6 +27,9 @@
[ClaimDetails("Bulk Generate Document Templates", "Can bulk generate document templates")] [ClaimDetails("Bulk Generate Document Templates", "Can bulk generate document templates")]
public bool BulkGenerate { get; set; } public bool BulkGenerate { get; set; }
[ClaimDetails("Export Attachment Instances", "Can export document attachment instances")]
public bool Export { get; set; }
[ClaimDetails("Process Undetected Pages", "Can show and assign imported documents which were not undetected")] [ClaimDetails("Process Undetected Pages", "Can show and assign imported documents which were not undetected")]
public bool UndetectedPages { get; set; } public bool UndetectedPages { get; set; }
} }
+1
View File
@@ -366,6 +366,7 @@
<Compile Include="Devices\DeviceFlags\DeviceFlagService.cs" /> <Compile Include="Devices\DeviceFlags\DeviceFlagService.cs" />
<Compile Include="Devices\DeviceFlags\DeviceFlagDeviceAssignedUsersManagedGroup.cs" /> <Compile Include="Devices\DeviceFlags\DeviceFlagDeviceAssignedUsersManagedGroup.cs" />
<Compile Include="Devices\DeviceFlags\DeviceFlagDevicesManagedGroup.cs" /> <Compile Include="Devices\DeviceFlags\DeviceFlagDevicesManagedGroup.cs" />
<Compile Include="Documents\DocumentExport.cs" />
<Compile Include="Exporting\Exporter.cs" /> <Compile Include="Exporting\Exporter.cs" />
<Compile Include="Exporting\ExportTask.cs" /> <Compile Include="Exporting\ExportTask.cs" />
<Compile Include="Exporting\ExportTaskContext.cs" /> <Compile Include="Exporting\ExportTaskContext.cs" />
+335
View File
@@ -0,0 +1,335 @@
using Disco.Data.Repository;
using Disco.Models.Exporting;
using Disco.Models.Repository;
using Disco.Models.Services.Documents;
using Disco.Models.Services.Exporting;
using Disco.Services.Exporting;
using Disco.Services.Tasks;
using Newtonsoft.Json;
using System.Data.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using Disco.Services.Users;
using Disco.Services.Plugins.Features.DetailsProvider;
namespace Disco.Services.Documents
{
public class DocumentExport : IExport<DocumentExportOptions, DocumentExportRecord>
{
public Guid Id { get; set; }
public string Name { get; } = "Document Export";
public DocumentExportOptions Options { get; set; }
public string FilenamePrefix { get; } = "DocumentExport";
public string ExcelWorksheetName { get; } = "DocumentExport";
public string ExcelTableName { get; } = "Documents";
public DocumentExport(DocumentExportOptions options)
{
Id = Guid.NewGuid();
Options = options;
}
[JsonConstructor]
public DocumentExport()
: this(DocumentExportOptions.DefaultOptions())
{
}
public ExportMetadata<DocumentExportOptions, DocumentExportRecord> BuildMetadata(DiscoDataContext database, List<DocumentExportRecord> records, IScheduledTaskStatus status)
{
var metadata = new ExportMetadata<DocumentExportOptions, DocumentExportRecord>(Options);
// Document Template
metadata.Add(o => o.Id, r => r.DocumentTemplate.Id);
metadata.Add(o => o.Description, r => r.DocumentTemplate?.Description);
metadata.Add(o => o.Scope, r => r.DocumentTemplate?.Scope);
// Attachment
metadata.Add(o => o.AttachmentId, r => r.Attachment.Id);
metadata.Add(o => o.AttachmentCreatedDate, r => r.Attachment.Timestamp);
metadata.Add(o => o.AttachmentCreatedUser, r => r.Attachment.TechUserId);
metadata.Add(o => o.AttachmentFilename, r => r.Attachment.Filename);
metadata.Add(o => o.AttachmentMimeType, r => r.Attachment.MimeType);
metadata.Add(o => o.AttachmentComments, r => r.Attachment.Comments);
// Device
metadata.Add(o => o.DeviceSerialNumber, r => r.Device?.SerialNumber);
metadata.Add(o => o.DeviceAssetNumber, r => r.Device?.AssetNumber);
metadata.Add(o => o.DeviceLocation, r => r.Device?.Location);
metadata.Add(o => o.DeviceComputerName, r => r.Device?.DeviceDomainId);
metadata.Add(o => o.DeviceLastNetworkLogon, r => r.Device?.LastNetworkLogonDate);
metadata.Add(o => o.DeviceCreatedDate, r => r.Device?.CreatedDate);
metadata.Add(o => o.DeviceFirstEnrolledDate, r => r.Device?.EnrolledDate);
metadata.Add(o => o.DeviceLastEnrolledDate, r => r.Device?.LastEnrolDate);
metadata.Add(o => o.DeviceAllowUnauthenticatedEnrol, r => r.Device?.AllowUnauthenticatedEnrol);
metadata.Add(o => o.DeviceDecommissionedDate, r => r.Device?.DecommissionedDate);
metadata.Add(o => o.DeviceDecommissionedReason, r => r.Device?.DecommissionReason?.ToString());
// Model
metadata.Add(o => o.ModelId, r => r.Device?.DeviceModel?.Id);
metadata.Add(o => o.ModelDescription, r => r.Device?.DeviceModel?.Description);
metadata.Add(o => o.ModelManufacturer, r => r.Device?.DeviceModel?.Manufacturer);
metadata.Add(o => o.ModelModel, r => r.Device?.DeviceModel?.Model);
metadata.Add(o => o.ModelType, r => r.Device?.DeviceModel?.ModelType);
// Batch
metadata.Add(o => o.BatchId, r => r.Device?.DeviceBatch?.Id);
metadata.Add(o => o.BatchName, r => r.Device?.DeviceBatch?.Name);
metadata.Add(o => o.BatchPurchaseDate, r => r.Device?.DeviceBatch?.PurchaseDate);
metadata.Add(o => o.BatchSupplier, r => r.Device?.DeviceBatch?.Supplier);
metadata.Add(o => o.BatchUnitCost, r => r.Device?.DeviceBatch?.UnitCost, Exporter.CsvEncoders.NullableCurrencyEncoder);
metadata.Add(o => o.BatchWarrantyValidUntilDate, r => r.Device?.DeviceBatch?.WarrantyValidUntil);
metadata.Add(o => o.BatchInsuredDate, r => r.Device?.DeviceBatch?.InsuredDate);
metadata.Add(o => o.BatchInsuranceSupplier, r => r.Device?.DeviceBatch?.InsuranceSupplier);
metadata.Add(o => o.BatchInsuredUntilDate, r => r.Device?.DeviceBatch?.InsuredUntil);
// Profile
metadata.Add(o => o.ProfileId, r => r.Device?.DeviceProfile?.Id);
metadata.Add(o => o.ProfileName, r => r.Device?.DeviceProfile?.Name);
metadata.Add(o => o.ProfileShortName, r => r.Device?.DeviceProfile?.ShortName);
// Job
metadata.Add(o => o.JobId, r => r.Job?.Id);
metadata.Add(o => o.JobStatus, r => r.JobStatus == null ? null : Job.JobStatusIds.StatusDescriptions.TryGetValue(r.JobStatus, out var jobStatus) ? jobStatus : "Unknown");
metadata.Add(o => o.JobType, r => r.JobTypeDescription);
metadata.Add(o => o.JobSubTypes, r => r.JobSubTypeDescriptions == null ? null : string.Join(", ", r.JobSubTypeDescriptions));
metadata.Add(o => o.JobOpenedDate, r => r.Job?.OpenedDate);
metadata.Add(o => o.JobOpenedUser, r => r.Job?.OpenedTechUserId);
metadata.Add(o => o.JobExpectedClosedDate, r => r.Job?.ExpectedClosedDate);
metadata.Add(o => o.JobClosedDate, r => r.Job?.ClosedDate);
metadata.Add(o => o.JobClosedUser, r => r.Job?.ClosedTechUserId);
// User
metadata.Add(o => o.UserId, r => r.User?.UserId);
metadata.Add(o => o.UserDisplayName, r => r.User?.DisplayName);
metadata.Add(o => o.UserSurname, r => r.User?.Surname);
metadata.Add(o => o.UserGivenName, r => r.User?.GivenName);
metadata.Add(o => o.UserPhoneNumber, r => r.User?.PhoneNumber);
metadata.Add(o => o.UserEmailAddress, r => r.User?.EmailAddress);
// User Custom Details
if (Options.UserDetailCustom.Any())
{
foreach (var key in Options.UserDetailCustom.OrderBy(k => k, StringComparer.OrdinalIgnoreCase))
{
metadata.Add(key, r => r.UserCustomDetails != null && r.UserCustomDetails.TryGetValue(key, out var value) ? value : null);
}
}
return metadata;
}
public List<DocumentExportRecord> BuildRecords(DiscoDataContext database, IScheduledTaskStatus status)
{
var records = new List<DocumentExportRecord>();
var documentTemplates = database.DocumentTemplates.Where(t => Options.DocumentTemplateIds.Contains(t.Id)).ToList();
foreach (var documentTemplate in documentTemplates)
{
var documentRecords = BuildDocumentRecords(database, documentTemplate, status);
records.AddRange(documentRecords);
}
return records;
}
private List<DocumentExportRecord> BuildDocumentRecords(DiscoDataContext database, DocumentTemplate document, IScheduledTaskStatus status)
{
switch (document.AttachmentType)
{
case AttachmentTypes.Device:
return BuildDeviceDocumentRecords(database, document, status);
case AttachmentTypes.Job:
return BuildJobDocumentRecords(database, document, status);
case AttachmentTypes.User:
return BuildUserDocumentRecords(database, document, status);
default:
throw new NotSupportedException($"Unsupported document scope: {document.Scope}");
}
}
private List<DocumentExportRecord> BuildDeviceDocumentRecords(DiscoDataContext database, DocumentTemplate document, IScheduledTaskStatus status)
{
var query = database.DeviceAttachments
.Include(a => a.Device);
if (Options.HasDeviceBatchOptions())
query = query.Include(a => a.Device.DeviceBatch);
if (Options.HasDeviceModelOptions())
query = query.Include(a => a.Device.DeviceModel);
if (Options.HasDeviceProfileOptions())
query = query.Include(a => a.Device.DeviceProfile);
if (Options.HasUserOptions())
query = query.Include(a => a.Device.AssignedUser);
query = query.Where(a => a.DocumentTemplateId == document.Id);
if (Options.HasUserOptions())
RefreshAdUsers(database, query.Select(d => d.Device.AssignedUserId).Distinct().ToList(), status);
status.UpdateStatus(15, "Extracting records from the database");
var attachments = query.OrderBy(a => a.Timestamp).ToList();
if (Options.LatestOnly)
{
attachments.Reverse();
attachments = attachments.GroupBy(a => a.DeviceSerialNumber).Select(g => g.First()).OrderBy(a => a.Timestamp).ToList();
}
var records = attachments.Select(a => new DocumentExportRecord()
{
DocumentTemplate = document,
Attachment = a,
Device = a.Device,
Job = null,
User = a.Device.AssignedUser,
}).ToList();
if (Options.UserDetailCustom.Any())
AddUserCustomDetails(database, records, status);
return records;
}
private List<DocumentExportRecord> BuildJobDocumentRecords(DiscoDataContext database, DocumentTemplate document, IScheduledTaskStatus status)
{
var query = database.JobAttachments
.Include(a => a.Job);
if (Options.JobStatus)
{
query = query
.Include(a => a.Job.JobMetaWarranty)
.Include(a => a.Job.JobMetaNonWarranty)
.Include(a => a.Job.JobMetaInsurance);
}
if (Options.JobType)
query = query.Include(a => a.Job.JobType);
if (Options.JobSubTypes)
query = query.Include(a => a.Job.JobSubTypes);
if (Options.HasDeviceOptions())
query = query.Include(a => a.Job.Device);
if (Options.HasDeviceBatchOptions())
query = query.Include(a => a.Job.Device.DeviceBatch);
if (Options.HasDeviceModelOptions())
query = query.Include(a => a.Job.Device.DeviceModel);
if (Options.HasDeviceProfileOptions())
query = query.Include(a => a.Job.Device.DeviceProfile);
if (Options.HasUserOptions())
query = query.Include(a => a.Job.User);
query = query.Where(a => a.DocumentTemplateId == document.Id);
if (Options.HasUserOptions())
RefreshAdUsers(database, query.Select(d => d.Job.UserId).Distinct().ToList(), status);
status.UpdateStatus(15, "Extracting records from the database");
var attachments = query.OrderBy(a => a.Timestamp).ToList();
if (Options.LatestOnly)
{
attachments.Reverse();
attachments = attachments.GroupBy(a => a.JobId).Select(g => g.First()).OrderBy(a => a.Timestamp).ToList();
}
var records = attachments.Select(a => new DocumentExportRecord()
{
DocumentTemplate = document,
Attachment = a,
Device = a.Job.Device,
Job = a.Job,
User = a.Job.User,
}).ToList();
if (Options.UserDetailCustom.Any())
AddUserCustomDetails(database, records, status);
return records;
}
private List<DocumentExportRecord> BuildUserDocumentRecords(DiscoDataContext database, DocumentTemplate document, IScheduledTaskStatus status)
{
var query = database.UserAttachments
.Include(a => a.User);
if (Options.HasDeviceOptions())
query = query.Include(a => a.User.DeviceUserAssignments.Select(u => u.Device));
if (Options.HasDeviceBatchOptions())
query = query.Include(a => a.User.DeviceUserAssignments.Select(u => u.Device.DeviceBatch));
if (Options.HasDeviceModelOptions())
query = query.Include(a => a.User.DeviceUserAssignments.Select(u => u.Device.DeviceModel));
if (Options.HasDeviceProfileOptions())
query = query.Include(a => a.User.DeviceUserAssignments.Select(u => u.Device.DeviceProfile));
query = query.Where(a => a.DocumentTemplateId == document.Id);
if (Options.HasUserOptions())
RefreshAdUsers(database, query.Select(d => d.UserId).Distinct().ToList(), status);
status.UpdateStatus(15, "Extracting records from the database");
var attachments = query.OrderBy(a => a.Timestamp).ToList();
if (Options.LatestOnly)
{
attachments.Reverse();
attachments = attachments.GroupBy(a => a.UserId).Select(g => g.First()).OrderBy(a => a.Timestamp).ToList();
}
var records = attachments.Select(a => new DocumentExportRecord()
{
DocumentTemplate = document,
Attachment = a,
Device = a.User.DeviceUserAssignments?
.Where(u => !u.UnassignedDate.HasValue)
.OrderByDescending(u => u.AssignedDate)
.FirstOrDefault()?.Device,
Job = null,
User = a.User,
}).ToList();
if (Options.UserDetailCustom.Any())
AddUserCustomDetails(database, records, status);
return records;
}
private static void RefreshAdUsers(DiscoDataContext database, List<string> userIds, IScheduledTaskStatus status)
{
if (!userIds.Any())
return;
status.UpdateStatus(5, "Refreshing user details from Active Directory");
foreach (var userId in userIds)
{
if (string.IsNullOrWhiteSpace(userId))
continue;
try
{
UserService.GetUser(userId, database, true);
}
catch (Exception) { } // Ignore Errors
}
}
private static void AddUserCustomDetails(DiscoDataContext database, List<DocumentExportRecord> records, IScheduledTaskStatus status)
{
if (!records.Any(r => r.User != null))
return;
status.UpdateStatus(50, "Extracting custom user detail records");
var detailsService = new DetailsProviderService(database);
var cache = new Dictionary<string, Dictionary<string, string>>(StringComparer.Ordinal);
foreach (var record in records)
{
var userId = record.User?.UserId;
if (string.IsNullOrWhiteSpace(userId))
continue;
if (!cache.TryGetValue(userId, out var details))
details = detailsService.GetDetails(record.User);
record.UserCustomDetails = details;
}
}
public ExportResult Export(DiscoDataContext database, IScheduledTaskStatus status)
=> Exporter.Export(this, database, status);
}
}
+3
View File
@@ -3,12 +3,14 @@ using Disco.Models.Exporting;
using Disco.Models.Repository; using Disco.Models.Repository;
using Disco.Models.Services.Devices; using Disco.Models.Services.Devices;
using Disco.Models.Services.Devices.DeviceFlag; using Disco.Models.Services.Devices.DeviceFlag;
using Disco.Models.Services.Documents;
using Disco.Models.Services.Exporting; using Disco.Models.Services.Exporting;
using Disco.Models.Services.Jobs; using Disco.Models.Services.Jobs;
using Disco.Models.Services.Users.UserFlags; using Disco.Models.Services.Users.UserFlags;
using Disco.Services.Authorization; using Disco.Services.Authorization;
using Disco.Services.Devices; using Disco.Services.Devices;
using Disco.Services.Devices.DeviceFlags; using Disco.Services.Devices.DeviceFlags;
using Disco.Services.Documents;
using Disco.Services.Jobs; using Disco.Services.Jobs;
using Disco.Services.Logging; using Disco.Services.Logging;
using Disco.Services.Tasks; using Disco.Services.Tasks;
@@ -32,6 +34,7 @@ namespace Disco.Services.Exporting
RegisterExportType<DeviceExport, DeviceExportOptions, DeviceExportRecord>(); RegisterExportType<DeviceExport, DeviceExportOptions, DeviceExportRecord>();
RegisterExportType<JobExport, JobExportOptions, JobExportRecord>(); RegisterExportType<JobExport, JobExportOptions, JobExportRecord>();
RegisterExportType<UserFlagExport, UserFlagExportOptions, UserFlagExportRecord>(); RegisterExportType<UserFlagExport, UserFlagExportOptions, UserFlagExportRecord>();
RegisterExportType<DocumentExport, DocumentExportOptions, DocumentExportRecord>();
} }
internal static void RegisterExportType<T, E, R>() internal static void RegisterExportType<T, E, R>()
+3 -1
View File
@@ -43,7 +43,9 @@ namespace Disco.Services
public static List<DeviceUserAssignment> CurrentDeviceUserAssignments(this User u) public static List<DeviceUserAssignment> CurrentDeviceUserAssignments(this User u)
{ {
return u.DeviceUserAssignments.Where(dua => !dua.UnassignedDate.HasValue).ToList(); return u.DeviceUserAssignments?
.Where(dua => !dua.UnassignedDate.HasValue)
.ToList() ?? new List<DeviceUserAssignment>(0);
} }
public static bool CanCreateJob(this User u) public static bool CanCreateJob(this User u)
@@ -5,13 +5,17 @@ using Disco.Services;
using Disco.Services.Authorization; using Disco.Services.Authorization;
using Disco.Services.Documents; using Disco.Services.Documents;
using Disco.Services.Documents.ManagedGroups; using Disco.Services.Documents.ManagedGroups;
using Disco.Services.Exporting;
using Disco.Services.Interop.ActiveDirectory; using Disco.Services.Interop.ActiveDirectory;
using Disco.Services.Plugins; using Disco.Services.Plugins;
using Disco.Services.Plugins.Features.DocumentHandlerProvider; using Disco.Services.Plugins.Features.DocumentHandlerProvider;
using Disco.Services.Tasks; using Disco.Services.Tasks;
using Disco.Services.Users; using Disco.Services.Users;
using Disco.Services.Users.UserFlags;
using Disco.Services.Web; using Disco.Services.Web;
using Disco.Web.Areas.API.Models.DocumentTemplate; using Disco.Web.Areas.API.Models.DocumentTemplate;
using Disco.Web.Areas.Config.Models.DocumentTemplate;
using Disco.Web.Extensions;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
@@ -1444,5 +1448,58 @@ namespace Disco.Web.Areas.API.Controllers
return Json(model); return Json(model);
} }
#endregion #endregion
#region Exporting
[DiscoAuthorize(Claims.Config.DocumentTemplate.Export)]
[HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult Export(ExportModel Model)
{
if (Model == null || Model.Options == null)
throw new ArgumentNullException(nameof(Model));
var templateId = default(string);
if (Model.Options.DocumentTemplateIds.Count == 1)
templateId = Model.Options.DocumentTemplateIds.First();
// Start Export
var exportContext = new DocumentExport(Model.Options);
var taskContext = ExportTask.ScheduleNowCacheResult(exportContext, id => Url.Action(MVC.Config.DocumentTemplate.Export(templateId, id)));
// Try waiting for completion
if (taskContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(1)))
return RedirectToAction(MVC.Config.DocumentTemplate.Export(templateId, taskContext.Id));
else
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskContext.TaskStatus.SessionId));
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.Export)]
public virtual ActionResult ExportRetrieve(Guid id)
{
if (!ExportTask.TryFromCache(id, out var context))
throw new ArgumentException("The export id specified is invalid, or the export data expired (60 minutes)", nameof(id));
if (context.Result == null || context.Result.Result == null)
throw new ArgumentException("The export session is still running, or failed to complete successfully", nameof(id));
if (context.Result.RecordCount == 0)
throw new ArgumentException("No records were found to export", nameof(id));
var fileStream = context.Result.Result;
return this.File(fileStream.GetBuffer(), 0, (int)fileStream.Length, context.Result.MimeType, context.Result.Filename);
}
[DiscoAuthorizeAll(Claims.Config.ManageSavedExports, Claims.Config.DocumentTemplate.Export)]
[HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult SaveExport(ExportModel Model)
{
var export = new DocumentExport(Model.Options);
var savedExport = SavedExports.SaveExport(export, Database, CurrentUser);
return RedirectToAction(MVC.Config.Export.Create(savedExport.Id));
}
#endregion
} }
} }
@@ -64,6 +64,11 @@ namespace Disco.Web.Areas.Config
"Config/DocumentTemplate/CreatePackage", "Config/DocumentTemplate/CreatePackage",
new { controller = "DocumentTemplate", action = "CreatePackage" } new { controller = "DocumentTemplate", action = "CreatePackage" }
); );
context.MapRoute(
"Config_DocumentTemplate_Export",
"Config/DocumentTemplate/Export/{id}",
new { controller = "DocumentTemplate", action = "Export", id = UrlParameter.Optional }
);
context.MapRoute( context.MapRoute(
"Config_DocumentTemplate_ImportStatus", "Config_DocumentTemplate_ImportStatus",
"Config/DocumentTemplate/ImportStatus", "Config/DocumentTemplate/ImportStatus",
@@ -1,16 +1,19 @@
using Disco.BI.Extensions; using Disco.BI.Extensions;
using Disco.Data.Repository; using Disco.Data.Repository;
using Disco.Models.Areas.Config.UI.UserFlag;
using Disco.Models.Repository; using Disco.Models.Repository;
using Disco.Models.Services.Documents;
using Disco.Models.Services.Exporting;
using Disco.Models.UI.Config.DocumentTemplate; using Disco.Models.UI.Config.DocumentTemplate;
using Disco.Services; using Disco.Services;
using Disco.Services.Authorization; using Disco.Services.Authorization;
using Disco.Services.Documents; using Disco.Services.Documents;
using Disco.Services.Documents.ManagedGroups; using Disco.Services.Documents.ManagedGroups;
using Disco.Services.Expressions; using Disco.Services.Exporting;
using Disco.Services.Plugins.Features.ExpressionExtensionProvider;
using Disco.Services.Plugins.Features.UIExtension; using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Web; using Disco.Services.Web;
using Disco.Web.Areas.Config.Models.DocumentTemplate; using Disco.Web.Areas.Config.Models.DocumentTemplate;
using Disco.Web.Models.Shared;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -293,6 +296,60 @@ namespace Disco.Web.Areas.Config.Controllers
return View(MVC.Config.DocumentTemplate.Views.BulkGenerate, model); return View(MVC.Config.DocumentTemplate.Views.BulkGenerate, model);
} }
[HttpGet]
[DiscoAuthorize(Claims.Config.DocumentTemplate.Export)]
public virtual ActionResult Export(string id, Guid? exportId)
{
var m = new ExportModel()
{
Options = DocumentExportOptions.DefaultOptions(),
DocumentTemplates = Database.DocumentTemplates.OrderBy(d => d.Id).ToList(),
};
m.Fields = ExportFieldsModel.Create(m.Options, nameof(DocumentExportOptions.LatestOnly));
var userCustomDetailKeys = Database.UserDetails.Where(d => d.Scope == "Details").Select(d => d.Key).Distinct().OrderBy(k => k).ToList();
if (userCustomDetailKeys.Any())
{
var group = new ExportOptionGroup("User Custom Details");
foreach (var key in userCustomDetailKeys)
{
group.Add(new ExportOptionField()
{
GroupName = group.Name,
Name = key,
DisplayName = key.TrimEnd('*', '&'),
Description = $"{key} custom detail for the user associated with the document instance",
Checked = false,
Key = "UserDetailCustom",
Value = key,
});
}
m.Fields.FieldGroups.Add(group);
}
if (ExportTask.TryFromCache(exportId, out var context))
{
m.ExportId = exportId;
m.ExportResult = context.Result;
}
if (!string.IsNullOrWhiteSpace(id))
{
var template = m.DocumentTemplates.FirstOrDefault(d => string.Equals(d.Id, id, StringComparison.OrdinalIgnoreCase));
if (template != null)
{
m.Options.DocumentTemplateIds.Add(template.Id);
}
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateExportModel>(ControllerContext, m);
return View(m);
}
public virtual ActionResult ExpressionBrowser() public virtual ActionResult ExpressionBrowser()
{ {
// for backwards compatibility // for backwards compatibility
@@ -0,0 +1,20 @@
using Disco.Models.Areas.Config.UI.UserFlag;
using Disco.Models.Services.Documents;
using Disco.Models.Services.Exporting;
using Disco.Models.UI.Shared;
using System;
using System.Collections.Generic;
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
{
public class ExportModel : ConfigDocumentTemplateExportModel
{
public DocumentExportOptions Options { get; set; }
public Guid? ExportId { get; set; }
public ExportResult ExportResult { get; set; }
public List<Disco.Models.Repository.DocumentTemplate> DocumentTemplates { get; set; }
public SharedExportFieldsModel<DocumentExportOptions> Fields { get; set; }
}
}
@@ -0,0 +1,219 @@
@using Disco.Web.Areas.Config.Models.DocumentTemplate;
@using Disco.Services.Exporting;
@model ExportModel
@{
Authorization.Require(Claims.Config.DocumentTemplate.Export);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), "Export");
}
<div id="DocumentTemplate_Export">
@using (Html.BeginForm(MVC.API.DocumentTemplate.Export(), FormMethod.Post, new { @data_saveaction = Url.Action(MVC.API.DocumentTemplate.SaveExport()) }))
{
@Html.AntiForgeryToken()
<div id="DocumentTemplate_Export_Scope" class="form" style="width: 570px">
<h2>Export Scope</h2>
<table>
<tr>
<th style="width: 100px">
Documents:
</th>
<td class="details">
<table class="tableData">
@{
var index = 0;
foreach (var document in Model.DocumentTemplates)
{
<tr>
<td>
<label>
<input type="checkbox" id="Options_DocumentTemplateIds_@index" name="Options.DocumentTemplateIds" value="@document.Id" @(((bool)Model.Options.DocumentTemplateIds.Contains(document.Id)) ? "checked " : null) />
<strong>@document.Id</strong>
</label>
</td>
<td>
<label for="Options_DocumentTemplateIds_@index">@document.Description</label>
</td>
<td>
@document.Scope
</td>
</tr>
index++;
}
}
</table>
</td>
</tr>
<tr>
<th>@Html.LabelFor(m => m.Options.LatestOnly)</th>
<td>
@Html.CheckBoxFor(m => m.Options.LatestOnly)
<p>Uncheck to include all document instances.</p>
</td>
</tr>
<tr>
<th>@Html.LabelFor(m => m.Options.Format)</th>
<td>
@Html.DropDownListFor(m => m.Options.Format, Enum.GetNames(typeof(Disco.Models.Exporting.ExportFormat)).Select(v => new SelectListItem() { Value = v, Text = v }))
</td>
</tr>
</table>
</div>
<div id="DocumentTemplate_Export_Fields" class="form" style="width: 570px; margin-top: 15px;">
<h2>Export Fields <a id="DocumentTemplate_Export_Fields_Defaults" href="#">(Defaults)</a></h2>
<table>
@foreach (var optionGroup in Model.Fields.FieldGroups)
{
var optionFields = optionGroup.ToList();
var itemsPerColumn = (int)Math.Ceiling((double)optionFields.Count / 2);
<tr>
<th style="width: 120px;">
@optionGroup.Name
@if (optionFields.Count > 2)
{
<span style="display: block;" class="select"><a class="selectAll" href="#">ALL</a> | <a class="selectNone" href="#">NONE</a></span>
}
</th>
<td>
<div class="DocumentTemplate_Export_Fields_Group">
<table class="none">
<tr>
<td style="width: 50%">
<ul class="none">
@foreach (var optionItem in optionFields.Take(itemsPerColumn))
{
<li title="@optionItem.Description">
<input type="checkbox" id="Options_@optionItem.Name" name="Options.@(optionItem.Key ?? optionItem.Name)" value="@(optionItem.Value ?? "true")" @((optionItem.Checked) ? "checked " : null) /><label for="Options_@optionItem.Name">@optionItem.DisplayName</label>
</li>
}
</ul>
</td>
<td style="width: 50%">
<ul class="none">
@foreach (var optionItem in optionFields.Skip(itemsPerColumn))
{
<li title="@optionItem.Description">
<input type="checkbox" id="Options_@optionItem.Name" name="Options.@(optionItem.Key ?? optionItem.Name)" value="@(optionItem.Value ?? "true")" @((optionItem.Checked) ? "checked " : null) /><label for="Options_@optionItem.Name">@optionItem.DisplayName</label>
</li>
}
</ul>
</td>
</tr>
</table>
</div>
</td>
</tr>
}
</table>
</div>
<script>
$(function () {
var exportDefaultFields = ['Id', 'Description', 'Scope', 'AttachmentId', 'AttachmentCreatedUser', 'AttachmentCreatedDate', 'AttachmentComments', 'DeviceSerialNumber', 'JobId', 'JobStatus', 'JobType', 'UserId', 'UserDisplayName'];
var $exportFields = $('#DocumentTemplate_Export_Fields');
var $exportScope = $('#DocumentTemplate_Export_Scope');
var $form = $exportScope.closest('form');
var $exportingDialog = null;
$exportFields.on('click', 'a.selectAll,a.selectNone', function () {
var $this = $(this);
$this.closest('tr').find('input').prop('checked', $this.is('.selectAll'));
return false;
});
$('#DocumentTemplate_Export_Fields_Defaults').click(function () {
$exportFields.find('input').prop('checked', false);
$.each(exportDefaultFields, function (index, value) {
$('#Options_' + value).prop('checked', true);
});
return false;
});
// Submit Validation
function submitHandler() {
var exportFieldCount = $exportFields.find('input:checked').length;
if (exportFieldCount > 0) {
if ($exportingDialog == null) {
$exportingDialog = $('#DocumentTemplate_Export_Exporting').dialog({
width: 400,
height: 164,
resizable: false,
modal: true,
autoOpen: false
});
}
$exportingDialog.dialog('open');
$form[0].submit();
}
else
alert('Select at least one field to export.');
}
$.validator.unobtrusive.parse($form);
$form.data("validator").settings.submitHandler = submitHandler;
$('#DocumentTemplate_Export_Download_Dialog').dialog({
width: 400,
height: 164,
resizable: false,
modal: true,
autoOpen: true
});
$('#DocumentTemplate_Export_Button').click(function () {
$form.submit();
});
$('#DocumentTemplate_Export_Save_Button').click(function () {
$form.attr('action', $form[0].dataset.saveaction);
$form.submit();
});
});
</script>
}
</div>
@if (Model.ExportId.HasValue)
{
<div id="DocumentTemplate_Export_Download_Dialog" class="dialog" title="Export Document Instances">
@if (Model.ExportResult.RecordCount == 0)
{
<h4>No records matched the filter criteria</h4>
}
else
{
<h4>@Model.ExportResult.RecordCount record@(Model.ExportResult.RecordCount != 1 ? "s" : null) were successfully exported.</h4>
<a href="@Url.Action(MVC.API.DocumentTemplate.ExportRetrieve(Model.ExportId.Value))" class="button"><i class="fa fa-download fa-lg"></i>Download Document Instance Export</a>
}
</div>
<script>
$(function () {
$('#DocumentTemplate_Export_Download_Dialog')
.dialog({
width: 400,
height: 164,
resizable: false,
modal: true,
autoOpen: true
});
});
</script>
}
<div id="DocumentTemplate_Export_Exporting" class="dialog" title="Exporting Document Instances...">
<h4><i class="fa fa-lg fa-cog fa-spin" title="Please Wait"></i>Exporting document instances...</h4>
</div>
<div class="actionBar">
@if (Authorization.Has(Claims.Config.ManageSavedExports))
{
<button type="button" id="DocumentTemplate_Export_Save_Button" class="button">Save Export</button>
}
else
{
<button type="button" class="button" disabled title="Requires Manage Saved Exports Permission">Save Export</button>
}
<button type="button" id="DocumentTemplate_Export_Button" class="button">Export Now</button>
</div>
@@ -0,0 +1,871 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DocumentTemplate
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
#line 2 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
using Disco.Services.Exporting;
#line default
#line hidden
using Disco.Services.Web;
using Disco.Web;
#line 1 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
using Disco.Web.Areas.Config.Models.DocumentTemplate;
#line default
#line hidden
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DocumentTemplate/Export.cshtml")]
public partial class Export : Disco.Services.Web.WebViewPage<ExportModel>
{
public Export()
{
}
public override void Execute()
{
#line 4 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Authorization.Require(Claims.Config.DocumentTemplate.Export);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), "Export");
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"DocumentTemplate_Export\"");
WriteLiteral(">\r\n");
#line 10 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
#line default
#line hidden
#line 10 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
using (Html.BeginForm(MVC.API.DocumentTemplate.Export(), FormMethod.Post, new { @data_saveaction = Url.Action(MVC.API.DocumentTemplate.SaveExport()) }))
{
#line default
#line hidden
#line 12 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
#line 12 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"DocumentTemplate_Export_Scope\"");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 570px\"");
WriteLiteral(">\r\n <h2>Export Scope</h2>\r\n <table>\r\n <tr>\r\n" +
" <th");
WriteLiteral(" style=\"width: 100px\"");
WriteLiteral(">\r\n Documents:\r\n </th>\r\n " +
" <td");
WriteLiteral(" class=\"details\"");
WriteLiteral(">\r\n <table");
WriteLiteral(" class=\"tableData\"");
WriteLiteral(">\r\n");
#line 22 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
#line default
#line hidden
#line 22 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
var index = 0;
foreach (var document in Model.DocumentTemplates)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n " +
" <td>\r\n <label>\r\n " +
" <input");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("id", Tuple.Create(" id=\"", 1353), Tuple.Create("\"", 1392)
, Tuple.Create(Tuple.Create("", 1358), Tuple.Create("Options_DocumentTemplateIds_", 1358), true)
#line 29 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 1386), Tuple.Create<System.Object, System.Int32>(index
#line default
#line hidden
, 1386), false)
);
WriteLiteral(" name=\"Options.DocumentTemplateIds\"");
WriteAttribute("value", Tuple.Create(" value=\"", 1428), Tuple.Create("\"", 1448)
#line 29 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 1436), Tuple.Create<System.Object, System.Int32>(document.Id
#line default
#line hidden
, 1436), false)
);
WriteLiteral(" ");
#line 29 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(((bool)Model.Options.DocumentTemplateIds.Contains(document.Id)) ? "checked " : null);
#line default
#line hidden
WriteLiteral(" />\r\n <strong>");
#line 30 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(document.Id);
#line default
#line hidden
WriteLiteral("</strong>\r\n </label>\r\n " +
" </td>\r\n <td>\r\n " +
" <label");
WriteAttribute("for", Tuple.Create(" for=\"", 1817), Tuple.Create("\"", 1857)
, Tuple.Create(Tuple.Create("", 1823), Tuple.Create("Options_DocumentTemplateIds_", 1823), true)
#line 34 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 1851), Tuple.Create<System.Object, System.Int32>(index
#line default
#line hidden
, 1851), false)
);
WriteLiteral(">");
#line 34 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(document.Description);
#line default
#line hidden
WriteLiteral("</label>\r\n </td>\r\n " +
" <td>\r\n");
WriteLiteral(" ");
#line 37 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(document.Scope);
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n " +
" </tr>\r\n");
#line 40 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
index++;
}
#line default
#line hidden
WriteLiteral("\r\n </table>\r\n </td>\r\n </" +
"tr>\r\n <tr>\r\n <th>");
#line 47 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(Html.LabelFor(m => m.Options.LatestOnly));
#line default
#line hidden
WriteLiteral("</th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 49 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(Html.CheckBoxFor(m => m.Options.LatestOnly));
#line default
#line hidden
WriteLiteral("\r\n <p>Uncheck to include all document instances.</p>\r\n " +
" </td>\r\n </tr>\r\n <tr>\r\n " +
" <th>");
#line 54 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(Html.LabelFor(m => m.Options.Format));
#line default
#line hidden
WriteLiteral("</th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 56 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(Html.DropDownListFor(m => m.Options.Format, Enum.GetNames(typeof(Disco.Models.Exporting.ExportFormat)).Select(v => new SelectListItem() { Value = v, Text = v })));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n " +
" </div>\r\n");
WriteLiteral(" <div");
WriteLiteral(" id=\"DocumentTemplate_Export_Fields\"");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 570px; margin-top: 15px;\"");
WriteLiteral(">\r\n <h2>Export Fields <a");
WriteLiteral(" id=\"DocumentTemplate_Export_Fields_Defaults\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(">(Defaults)</a></h2>\r\n <table>\r\n");
#line 64 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
#line default
#line hidden
#line 64 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
foreach (var optionGroup in Model.Fields.FieldGroups)
{
var optionFields = optionGroup.ToList();
var itemsPerColumn = (int)Math.Ceiling((double)optionFields.Count / 2);
#line default
#line hidden
WriteLiteral(" <tr>\r\n <th");
WriteLiteral(" style=\"width: 120px;\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 70 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(optionGroup.Name);
#line default
#line hidden
WriteLiteral("\r\n");
#line 71 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
#line default
#line hidden
#line 71 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
if (optionFields.Count > 2)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" style=\"display: block;\"");
WriteLiteral(" class=\"select\"");
WriteLiteral("><a");
WriteLiteral(" class=\"selectAll\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(">ALL</a> | <a");
WriteLiteral(" class=\"selectNone\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(">NONE</a></span>\r\n");
#line 74 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
}
#line default
#line hidden
WriteLiteral(" </th>\r\n <td>\r\n " +
" <div");
WriteLiteral(" class=\"DocumentTemplate_Export_Fields_Group\"");
WriteLiteral(">\r\n <table");
WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n <tr>\r\n " +
" <td");
WriteLiteral(" style=\"width: 50%\"");
WriteLiteral(">\r\n <ul");
WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n");
#line 82 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
#line default
#line hidden
#line 82 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
foreach (var optionItem in optionFields.Take(itemsPerColumn))
{
#line default
#line hidden
WriteLiteral(" <li");
WriteAttribute("title", Tuple.Create(" title=\"", 4509), Tuple.Create("\"", 4540)
#line 84 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4517), Tuple.Create<System.Object, System.Int32>(optionItem.Description
#line default
#line hidden
, 4517), false)
);
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("id", Tuple.Create(" id=\"", 4622), Tuple.Create("\"", 4651)
, Tuple.Create(Tuple.Create("", 4627), Tuple.Create("Options_", 4627), true)
#line 85 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4635), Tuple.Create<System.Object, System.Int32>(optionItem.Name
#line default
#line hidden
, 4635), false)
);
WriteAttribute("name", Tuple.Create(" name=\"", 4652), Tuple.Create("\"", 4703)
, Tuple.Create(Tuple.Create("", 4659), Tuple.Create("Options.", 4659), true)
#line 85 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4667), Tuple.Create<System.Object, System.Int32>(optionItem.Key ?? optionItem.Name
#line default
#line hidden
, 4667), false)
);
WriteAttribute("value", Tuple.Create(" value=\"", 4704), Tuple.Create("\"", 4741)
#line 85 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4712), Tuple.Create<System.Object, System.Int32>(optionItem.Value ?? "true"
#line default
#line hidden
, 4712), false)
);
WriteLiteral(" ");
#line 85 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write((optionItem.Checked) ? "checked " : null);
#line default
#line hidden
WriteLiteral(" /><label");
WriteAttribute("for", Tuple.Create(" for=\"", 4795), Tuple.Create("\"", 4825)
, Tuple.Create(Tuple.Create("", 4801), Tuple.Create("Options_", 4801), true)
#line 85 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4809), Tuple.Create<System.Object, System.Int32>(optionItem.Name
#line default
#line hidden
, 4809), false)
);
WriteLiteral(">");
#line 85 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(optionItem.DisplayName);
#line default
#line hidden
WriteLiteral("</label>\r\n </li>\r\n");
#line 87 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
}
#line default
#line hidden
WriteLiteral(" </ul>\r\n " +
" </td>\r\n <td");
WriteLiteral(" style=\"width: 50%\"");
WriteLiteral(">\r\n <ul");
WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n");
#line 92 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
#line default
#line hidden
#line 92 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
foreach (var optionItem in optionFields.Skip(itemsPerColumn))
{
#line default
#line hidden
WriteLiteral(" <li");
WriteAttribute("title", Tuple.Create(" title=\"", 5414), Tuple.Create("\"", 5445)
#line 94 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 5422), Tuple.Create<System.Object, System.Int32>(optionItem.Description
#line default
#line hidden
, 5422), false)
);
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("id", Tuple.Create(" id=\"", 5527), Tuple.Create("\"", 5556)
, Tuple.Create(Tuple.Create("", 5532), Tuple.Create("Options_", 5532), true)
#line 95 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 5540), Tuple.Create<System.Object, System.Int32>(optionItem.Name
#line default
#line hidden
, 5540), false)
);
WriteAttribute("name", Tuple.Create(" name=\"", 5557), Tuple.Create("\"", 5608)
, Tuple.Create(Tuple.Create("", 5564), Tuple.Create("Options.", 5564), true)
#line 95 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 5572), Tuple.Create<System.Object, System.Int32>(optionItem.Key ?? optionItem.Name
#line default
#line hidden
, 5572), false)
);
WriteAttribute("value", Tuple.Create(" value=\"", 5609), Tuple.Create("\"", 5646)
#line 95 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 5617), Tuple.Create<System.Object, System.Int32>(optionItem.Value ?? "true"
#line default
#line hidden
, 5617), false)
);
WriteLiteral(" ");
#line 95 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write((optionItem.Checked) ? "checked " : null);
#line default
#line hidden
WriteLiteral(" /><label");
WriteAttribute("for", Tuple.Create(" for=\"", 5700), Tuple.Create("\"", 5730)
, Tuple.Create(Tuple.Create("", 5706), Tuple.Create("Options_", 5706), true)
#line 95 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 5714), Tuple.Create<System.Object, System.Int32>(optionItem.Name
#line default
#line hidden
, 5714), false)
);
WriteLiteral(">");
#line 95 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(optionItem.DisplayName);
#line default
#line hidden
WriteLiteral("</label>\r\n </li>\r\n");
#line 97 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
}
#line default
#line hidden
WriteLiteral(@" </ul>
</td>
</tr>
</table>
</div>
</td>
</tr>
");
#line 105 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
}
#line default
#line hidden
WriteLiteral(" </table>\r\n </div>\r\n");
WriteLiteral(" <script>\r\n $(function () {\r\n var exportDefaultF" +
"ields = [\'Id\', \'Description\', \'Scope\', \'AttachmentId\', \'AttachmentCreatedUser\', " +
"\'AttachmentCreatedDate\', \'AttachmentComments\', \'DeviceSerialNumber\', \'JobId\', \'J" +
"obStatus\', \'JobType\', \'UserId\', \'UserDisplayName\'];\r\n var $export" +
"Fields = $(\'#DocumentTemplate_Export_Fields\');\r\n var $exportScope" +
" = $(\'#DocumentTemplate_Export_Scope\');\r\n var $form = $exportScop" +
"e.closest(\'form\');\r\n var $exportingDialog = null;\r\n\r\n " +
" $exportFields.on(\'click\', \'a.selectAll,a.selectNone\', function () {\r\n " +
" var $this = $(this);\r\n\r\n $this.closest(\'tr\').fin" +
"d(\'input\').prop(\'checked\', $this.is(\'.selectAll\'));\r\n\r\n retur" +
"n false;\r\n });\r\n\r\n $(\'#DocumentTemplate_Export_Fie" +
"lds_Defaults\').click(function () {\r\n\r\n $exportFields.find(\'in" +
"put\').prop(\'checked\', false);\r\n\r\n $.each(exportDefaultFields," +
" function (index, value) {\r\n $(\'#Options_\' + value).prop(" +
"\'checked\', true);\r\n });\r\n\r\n return false;\r" +
"\n });\r\n\r\n // Submit Validation\r\n fu" +
"nction submitHandler() {\r\n var exportFieldCount = $exportFiel" +
"ds.find(\'input:checked\').length;\r\n\r\n if (exportFieldCount > 0" +
") {\r\n\r\n if ($exportingDialog == null) {\r\n " +
" $exportingDialog = $(\'#DocumentTemplate_Export_Exporting\').dialog({\r" +
"\n width: 400,\r\n he" +
"ight: 164,\r\n resizable: false,\r\n " +
" modal: true,\r\n autoOpen: false\r\n " +
" });\r\n }\r\n " +
" $exportingDialog.dialog(\'open\');\r\n\r\n $form[0].submit();" +
"\r\n }\r\n else\r\n alert" +
"(\'Select at least one field to export.\');\r\n }\r\n $." +
"validator.unobtrusive.parse($form);\r\n $form.data(\"validator\").set" +
"tings.submitHandler = submitHandler;\r\n\r\n $(\'#DocumentTemplate_Exp" +
"ort_Download_Dialog\').dialog({\r\n width: 400,\r\n " +
" height: 164,\r\n resizable: false,\r\n mo" +
"dal: true,\r\n autoOpen: true\r\n });\r\n " +
" $(\'#DocumentTemplate_Export_Button\').click(function () {\r\n " +
" $form.submit();\r\n });\r\n $(\'#DocumentTemplate_Ex" +
"port_Save_Button\').click(function () {\r\n $form.attr(\'action\'," +
" $form[0].dataset.saveaction);\r\n $form.submit();\r\n " +
" });\r\n });\r\n </script>\r\n");
#line 177 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
}
#line default
#line hidden
WriteLiteral("</div>\r\n");
#line 179 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
if (Model.ExportId.HasValue)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"DocumentTemplate_Export_Download_Dialog\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Export Document Instances\"");
WriteLiteral(">\r\n");
#line 182 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
#line default
#line hidden
#line 182 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
if (Model.ExportResult.RecordCount == 0)
{
#line default
#line hidden
WriteLiteral(" <h4>No records matched the filter criteria</h4>\r\n");
#line 185 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <h4>");
#line 188 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(Model.ExportResult.RecordCount);
#line default
#line hidden
WriteLiteral(" record");
#line 188 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
Write(Model.ExportResult.RecordCount != 1 ? "s" : null);
#line default
#line hidden
WriteLiteral(" were successfully exported.</h4>\r\n");
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 9605), Tuple.Create("\"", 9686)
#line 189 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 9612), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DocumentTemplate.ExportRetrieve(Model.ExportId.Value))
#line default
#line hidden
, 9612), false)
);
WriteLiteral(" class=\"button\"");
WriteLiteral("><i");
WriteLiteral(" class=\"fa fa-download fa-lg\"");
WriteLiteral("></i>Download Document Instance Export</a>\r\n");
#line 190 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
WriteLiteral(@" <script>
$(function () {
$('#DocumentTemplate_Export_Download_Dialog')
.dialog({
width: 400,
height: 164,
resizable: false,
modal: true,
autoOpen: true
});
});
</script>
");
#line 204 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
}
#line default
#line hidden
WriteLiteral("<div");
WriteLiteral(" id=\"DocumentTemplate_Export_Exporting\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Exporting Document Instances...\"");
WriteLiteral(">\r\n <h4><i");
WriteLiteral(" class=\"fa fa-lg fa-cog fa-spin\"");
WriteLiteral(" title=\"Please Wait\"");
WriteLiteral("></i>Exporting document instances...</h4>\r\n</div>\r\n<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
#line 209 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
#line default
#line hidden
#line 209 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
if (Authorization.Has(Claims.Config.ManageSavedExports))
{
#line default
#line hidden
WriteLiteral(" <button");
WriteLiteral(" type=\"button\"");
WriteLiteral(" id=\"DocumentTemplate_Export_Save_Button\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(">Save Export</button>\r\n");
#line 212 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <button");
WriteLiteral(" type=\"button\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(" disabled");
WriteLiteral(" title=\"Requires Manage Saved Exports Permission\"");
WriteLiteral(">Save Export</button>\r\n");
#line 216 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n <button");
WriteLiteral(" type=\"button\"");
WriteLiteral(" id=\"DocumentTemplate_Export_Button\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(">Export Now</button>\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
@@ -120,6 +120,10 @@ else
{ {
@Html.ActionLinkButton("Expression Browser", MVC.Config.Expressions.Browser()) @Html.ActionLinkButton("Expression Browser", MVC.Config.Expressions.Browser())
} }
@if (Authorization.Has(Claims.Config.DocumentTemplate.Export))
{
@Html.ActionLinkButton("Export Instances", MVC.Config.DocumentTemplate.Export())
}
@if (Model.DocumentTemplates.Count > 2 && Authorization.HasAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure)) @if (Model.DocumentTemplates.Count > 2 && Authorization.HasAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure))
{ {
@Html.ActionLinkButton("Create Package", MVC.Config.DocumentTemplate.CreatePackage()) @Html.ActionLinkButton("Create Package", MVC.Config.DocumentTemplate.CreatePackage())
@@ -629,7 +629,7 @@ WriteLiteral(" ");
#line 123 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml" #line 123 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
if (Model.DocumentTemplates.Count > 2 && Authorization.HasAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure)) if (Authorization.Has(Claims.Config.DocumentTemplate.Export))
{ {
@@ -637,7 +637,7 @@ WriteLiteral(" ");
#line hidden #line hidden
#line 125 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml" #line 125 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.ActionLinkButton("Create Package", MVC.Config.DocumentTemplate.CreatePackage())); Write(Html.ActionLinkButton("Export Instances", MVC.Config.DocumentTemplate.Export()));
#line default #line default
@@ -654,7 +654,7 @@ WriteLiteral(" ");
#line 127 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml" #line 127 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
if (Authorization.HasAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure)) if (Model.DocumentTemplates.Count > 2 && Authorization.HasAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure))
{ {
@@ -662,7 +662,7 @@ WriteLiteral(" ");
#line hidden #line hidden
#line 129 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml" #line 129 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.ActionLinkButton("Create Document Template", MVC.Config.DocumentTemplate.Create())); Write(Html.ActionLinkButton("Create Package", MVC.Config.DocumentTemplate.CreatePackage()));
#line default #line default
@@ -673,6 +673,31 @@ WriteLiteral(" ");
} }
#line default
#line hidden
WriteLiteral(" ");
#line 131 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
if (Authorization.HasAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure))
{
#line default
#line hidden
#line 133 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.ActionLinkButton("Create Document Template", MVC.Config.DocumentTemplate.Create()));
#line default
#line hidden
#line 133 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
}
#line default #line default
#line hidden #line hidden
WriteLiteral("</div>\r\n"); WriteLiteral("</div>\r\n");
@@ -1052,6 +1052,10 @@
{ {
@Html.ActionLinkButton("Expression Browser", MVC.Config.Expressions.Browser()) @Html.ActionLinkButton("Expression Browser", MVC.Config.Expressions.Browser())
} }
@if (Authorization.Has(Claims.Config.DocumentTemplate.Export))
{
@Html.ActionLinkButton("Export Instances", MVC.Config.DocumentTemplate.Export(Model.DocumentTemplate.Id, null))
}
@if (canBulkGenerate) @if (canBulkGenerate)
{ {
if (Model.DocumentTemplate.Scope == DocumentTemplate.DocumentTemplateScopes.User) if (Model.DocumentTemplate.Scope == DocumentTemplate.DocumentTemplateScopes.User)
@@ -3198,6 +3198,31 @@ WriteLiteral(" ");
#line 1055 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1055 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
if (Authorization.Has(Claims.Config.DocumentTemplate.Export))
{
#line default
#line hidden
#line 1057 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
Write(Html.ActionLinkButton("Export Instances", MVC.Config.DocumentTemplate.Export(Model.DocumentTemplate.Id, null)));
#line default
#line hidden
#line 1057 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 1059 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
if (canBulkGenerate) if (canBulkGenerate)
{ {
if (Model.DocumentTemplate.Scope == DocumentTemplate.DocumentTemplateScopes.User) if (Model.DocumentTemplate.Scope == DocumentTemplate.DocumentTemplateScopes.User)
@@ -3207,14 +3232,14 @@ WriteLiteral(" ");
#line default #line default
#line hidden #line hidden
#line 1059 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1063 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
Write(Html.ActionLinkButton("Bulk Generate", MVC.Config.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id))); Write(Html.ActionLinkButton("Bulk Generate", MVC.Config.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id)));
#line default #line default
#line hidden #line hidden
#line 1059 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1063 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
} }
else else
@@ -3239,16 +3264,16 @@ WriteLiteral(" id=\"dialogBulkGenerate\"");
WriteLiteral(" class=\"hiddenDialog dialog-bulk-generate\""); WriteLiteral(" class=\"hiddenDialog dialog-bulk-generate\"");
WriteAttribute("title", Tuple.Create(" title=\"", 62552), Tuple.Create("\"", 62603) WriteAttribute("title", Tuple.Create(" title=\"", 62787), Tuple.Create("\"", 62838)
, Tuple.Create(Tuple.Create("", 62560), Tuple.Create("Bulk", 62560), true) , Tuple.Create(Tuple.Create("", 62795), Tuple.Create("Bulk", 62795), true)
, Tuple.Create(Tuple.Create(" ", 62564), Tuple.Create("Generate:", 62565), true) , Tuple.Create(Tuple.Create(" ", 62799), Tuple.Create("Generate:", 62800), true)
#line 1064 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1068 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
, Tuple.Create(Tuple.Create(" ", 62574), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Id , Tuple.Create(Tuple.Create(" ", 62809), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Id
#line default #line default
#line hidden #line hidden
, 62575), false) , 62810), false)
); );
WriteLiteral(">\r\n <div"); WriteLiteral(">\r\n <div");
@@ -3258,13 +3283,13 @@ WriteLiteral(" class=\"brief\"");
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
#line 1066 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1070 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
#line default #line default
#line hidden #line hidden
#line 1066 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1070 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
switch (Model.DocumentTemplate.Scope) switch (Model.DocumentTemplate.Scope)
{ {
case "Device": case "Device":
@@ -3306,7 +3331,7 @@ WriteLiteral(" class=\"example3 code\"");
WriteLiteral(">01234567;ABCD9876;8VQ6G2R</div>\r\n </div>\r\n"); WriteLiteral(">01234567;ABCD9876;8VQ6G2R</div>\r\n </div>\r\n");
#line 1082 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1086 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
break; break;
case "Job": case "Job":
@@ -3345,7 +3370,7 @@ WriteLiteral(" class=\"example3 code\"");
WriteLiteral(">86;99;44</div>\r\n </div>\r\n"); WriteLiteral(">86;99;44</div>\r\n </div>\r\n");
#line 1097 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1101 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
break; break;
} }
@@ -3355,13 +3380,13 @@ WriteLiteral(">86;99;44</div>\r\n </div>\r\n"
WriteLiteral(" </div>\r\n"); WriteLiteral(" </div>\r\n");
#line 1100 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1104 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
#line default #line default
#line hidden #line hidden
#line 1100 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1104 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id), FormMethod.Post)) using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id), FormMethod.Post))
{ {
@@ -3391,7 +3416,7 @@ WriteLiteral(" data-val-required=\"Identifiers are required\"");
WriteLiteral("></textarea>\r\n"); WriteLiteral("></textarea>\r\n");
#line 1104 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1108 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
if (Model.TemplatePageCount > 1 && Model.TemplatePageCount % 2 != 0) if (Model.TemplatePageCount > 1 && Model.TemplatePageCount % 2 != 0)
{ {
@@ -3420,7 +3445,7 @@ WriteLiteral(">Insert Blank Pages for Double-Sided Printing</label>\r\n
" </div>\r\n"); " </div>\r\n");
#line 1109 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1113 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
} }
} }
@@ -3430,7 +3455,7 @@ WriteLiteral(">Insert Blank Pages for Double-Sided Printing</label>\r\n
WriteLiteral(" </div>\r\n"); WriteLiteral(" </div>\r\n");
#line 1112 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1116 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
@@ -3469,7 +3494,7 @@ WriteLiteral(@" <script>
"); ");
#line 1143 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1147 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
} }
} }
@@ -3479,7 +3504,7 @@ WriteLiteral(@" <script>
WriteLiteral(" "); WriteLiteral(" ");
#line 1145 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1149 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
if (Authorization.Has(Claims.Config.DocumentTemplate.Delete)) if (Authorization.Has(Claims.Config.DocumentTemplate.Delete))
{ {
@@ -3487,14 +3512,14 @@ WriteLiteral(" ");
#line default #line default
#line hidden #line hidden
#line 1147 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1151 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
Write(Html.ActionLinkButton("Delete", MVC.API.DocumentTemplate.Delete(Model.DocumentTemplate.Id, true), "buttonDelete")); Write(Html.ActionLinkButton("Delete", MVC.API.DocumentTemplate.Delete(Model.DocumentTemplate.Id, true), "buttonDelete"));
#line default #line default
#line hidden #line hidden
#line 1147 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1151 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
} }
@@ -3504,13 +3529,13 @@ WriteLiteral(" ");
WriteLiteral(" </div>\r\n"); WriteLiteral(" </div>\r\n");
#line 1150 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1154 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
#line default #line default
#line hidden #line hidden
#line 1150 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1154 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
if (!string.IsNullOrWhiteSpace(Model.BulkGenerateDownloadId)) if (!string.IsNullOrWhiteSpace(Model.BulkGenerateDownloadId))
{ {
@@ -3527,14 +3552,14 @@ WriteLiteral(" title=\"Download Bulk Documents\"");
WriteLiteral(">\r\n <a"); WriteLiteral(">\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 67854), Tuple.Create("\"", 67985) WriteAttribute("href", Tuple.Create(" href=\"", 68089), Tuple.Create("\"", 68220)
#line 1153 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1157 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
, Tuple.Create(Tuple.Create("", 67861), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DocumentTemplate.BulkGenerateDownload(Model.BulkGenerateDownloadId, Model.BulkGenerateDownloadFilename)) , Tuple.Create(Tuple.Create("", 68096), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DocumentTemplate.BulkGenerateDownload(Model.BulkGenerateDownloadId, Model.BulkGenerateDownloadFilename))
#line default #line default
#line hidden #line hidden
, 67861), false) , 68096), false)
); );
WriteLiteral(" class=\"button\""); WriteLiteral(" class=\"button\"");
@@ -3560,7 +3585,7 @@ WriteLiteral(@" <script>
"); ");
#line 1167 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line 1171 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml"
} }
#line default #line default
+28
View File
@@ -2067,3 +2067,31 @@ h1.Config_DocumentTemplates {
#Config_Export_Edit_OnDemand #Config_Export_Edit_OnDemand_List li .remove:hover { #Config_Export_Edit_OnDemand #Config_Export_Edit_OnDemand_List li .remove:hover {
opacity: 1; opacity: 1;
} }
#DocumentTemplate_Export #DocumentTemplate_Export_Fields #DocumentTemplate_Export_Fields_Defaults {
font-size: 0.75em;
}
#DocumentTemplate_Export #DocumentTemplate_Export_Fields th {
font-size: 1.05em;
}
#DocumentTemplate_Export #DocumentTemplate_Export_Fields th span {
margin-top: 4px;
font-size: 0.8em;
}
#DocumentTemplate_Export_Download_Dialog {
padding-top: 20px;
text-align: center;
}
#DocumentTemplate_Export_Download_Dialog h4 {
margin-bottom: 30px;
}
#DocumentTemplate_Export_Download_Dialog a {
margin-bottom: 20px;
}
#DocumentTemplate_Export_Exporting {
padding-top: 50px;
text-align: center;
}
#DocumentTemplate_Export_Exporting i {
margin-right: 10px;
color: #1e6dab;
}
+40
View File
@@ -2497,3 +2497,43 @@ h1.Config_DocumentTemplates {
} }
} }
} }
#DocumentTemplate_Export {
#DocumentTemplate_Export_Fields {
#DocumentTemplate_Export_Fields_Defaults {
font-size: .75em;
}
th {
font-size: 1.05em;
span {
margin-top: 4px;
font-size: .8em;
}
}
}
}
#DocumentTemplate_Export_Download_Dialog {
padding-top: 20px;
text-align: center;
h4 {
margin-bottom: 30px;
}
a {
margin-bottom: 20px;
}
}
#DocumentTemplate_Export_Exporting {
padding-top: 50px;
text-align: center;
i {
margin-right: 10px;
color: @StatusInformation;
}
}
File diff suppressed because one or more lines are too long
+11
View File
@@ -248,6 +248,7 @@
<Compile Include="Areas\Config\Models\Config\IndexModel.cs" /> <Compile Include="Areas\Config\Models\Config\IndexModel.cs" />
<Compile Include="Areas\Config\Models\DocumentTemplate\BulkGenerateModel.cs" /> <Compile Include="Areas\Config\Models\DocumentTemplate\BulkGenerateModel.cs" />
<Compile Include="Areas\Config\Models\DocumentTemplate\CreatePackageModel.cs" /> <Compile Include="Areas\Config\Models\DocumentTemplate\CreatePackageModel.cs" />
<Compile Include="Areas\Config\Models\DocumentTemplate\ExportModel.cs" />
<Compile Include="Areas\Config\Models\DocumentTemplate\ShowPackageModel.cs" /> <Compile Include="Areas\Config\Models\DocumentTemplate\ShowPackageModel.cs" />
<Compile Include="Areas\Config\Models\Export\EditModel.cs" /> <Compile Include="Areas\Config\Models\Export\EditModel.cs" />
<Compile Include="Areas\Config\Models\Export\IndexModel.cs" /> <Compile Include="Areas\Config\Models\Export\IndexModel.cs" />
@@ -299,6 +300,11 @@
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
</Compile> </Compile>
<Compile Include="Areas\Config\Views\DocumentTemplate\Export.generated.cs">
<DependentUpon>Export.cshtml</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Areas\Config\Views\DocumentTemplate\ShowPackage1.generated.cs"> <Compile Include="Areas\Config\Views\DocumentTemplate\ShowPackage1.generated.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
@@ -901,6 +907,7 @@
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
<DependentUpon>T4MVC.tt</DependentUpon> <DependentUpon>T4MVC.tt</DependentUpon>
</Compile> </Compile>
<Compile Include="Models\Shared\ExportFieldsModel.cs" />
<Compile Include="Models\Shared\GenerateDocumentControlModel.cs" /> <Compile Include="Models\Shared\GenerateDocumentControlModel.cs" />
<Compile Include="Views\Device\DeviceParts\_Flags.generated.cs"> <Compile Include="Views\Device\DeviceParts\_Flags.generated.cs">
<DependentUpon>_Flags.cshtml</DependentUpon> <DependentUpon>_Flags.cshtml</DependentUpon>
@@ -1375,6 +1382,10 @@
<Generator>RazorGenerator</Generator> <Generator>RazorGenerator</Generator>
<LastGenOutput>BulkGenerate.generated.cs</LastGenOutput> <LastGenOutput>BulkGenerate.generated.cs</LastGenOutput>
</None> </None>
<None Include="Areas\Config\Views\DocumentTemplate\Export.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>Export.generated.cs</LastGenOutput>
</None>
<None Include="Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml"> <None Include="Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml">
<Generator>RazorGenerator</Generator> <Generator>RazorGenerator</Generator>
<LastGenOutput>ShowPackage1.generated.cs</LastGenOutput> <LastGenOutput>ShowPackage1.generated.cs</LastGenOutput>
@@ -281,6 +281,24 @@ namespace Disco.Web.Areas.API.Controllers
{ {
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.DocumentHandlers); return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.DocumentHandlers);
} }
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult Export()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult ExportRetrieve()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.ExportRetrieve);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult SaveExport()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.SaveExport);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public DocumentTemplateController Actions { get { return MVC.API.DocumentTemplate; } } public DocumentTemplateController Actions { get { return MVC.API.DocumentTemplate; } }
@@ -335,6 +353,9 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string AddOnImportUserFlagRule = "AddOnImportUserFlagRule"; public readonly string AddOnImportUserFlagRule = "AddOnImportUserFlagRule";
public readonly string GenerateDocumentHandlerUi = "GenerateDocumentHandlerUi"; public readonly string GenerateDocumentHandlerUi = "GenerateDocumentHandlerUi";
public readonly string DocumentHandlers = "DocumentHandlers"; public readonly string DocumentHandlers = "DocumentHandlers";
public readonly string Export = "Export";
public readonly string ExportRetrieve = "ExportRetrieve";
public readonly string SaveExport = "SaveExport";
} }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -378,6 +399,9 @@ namespace Disco.Web.Areas.API.Controllers
public const string AddOnImportUserFlagRule = "AddOnImportUserFlagRule"; public const string AddOnImportUserFlagRule = "AddOnImportUserFlagRule";
public const string GenerateDocumentHandlerUi = "GenerateDocumentHandlerUi"; public const string GenerateDocumentHandlerUi = "GenerateDocumentHandlerUi";
public const string DocumentHandlers = "DocumentHandlers"; public const string DocumentHandlers = "DocumentHandlers";
public const string Export = "Export";
public const string ExportRetrieve = "ExportRetrieve";
public const string SaveExport = "SaveExport";
} }
@@ -728,6 +752,30 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string templateId = "templateId"; public readonly string templateId = "templateId";
public readonly string targetId = "targetId"; public readonly string targetId = "targetId";
} }
static readonly ActionParamsClass_Export s_params_Export = new ActionParamsClass_Export();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_Export ExportParams { get { return s_params_Export; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Export
{
public readonly string Model = "Model";
}
static readonly ActionParamsClass_ExportRetrieve s_params_ExportRetrieve = new ActionParamsClass_ExportRetrieve();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_ExportRetrieve ExportRetrieveParams { get { return s_params_ExportRetrieve; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_ExportRetrieve
{
public readonly string id = "id";
}
static readonly ActionParamsClass_SaveExport s_params_SaveExport = new ActionParamsClass_SaveExport();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_SaveExport SaveExportParams { get { return s_params_SaveExport; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_SaveExport
{
public readonly string Model = "Model";
}
static readonly ViewsClass s_views = new ViewsClass(); static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ViewsClass Views { get { return s_views; } } public ViewsClass Views { get { return s_views; } }
@@ -1265,6 +1313,42 @@ namespace Disco.Web.Areas.API.Controllers
return callInfo; return callInfo;
} }
[NonAction]
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Disco.Web.Areas.Config.Models.DocumentTemplate.ExportModel Model);
[NonAction]
public override System.Web.Mvc.ActionResult Export(Disco.Web.Areas.Config.Models.DocumentTemplate.ExportModel Model)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Model", Model);
ExportOverride(callInfo, Model);
return callInfo;
}
[NonAction]
partial void ExportRetrieveOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, System.Guid id);
[NonAction]
public override System.Web.Mvc.ActionResult ExportRetrieve(System.Guid id)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.ExportRetrieve);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ExportRetrieveOverride(callInfo, id);
return callInfo;
}
[NonAction]
partial void SaveExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Disco.Web.Areas.Config.Models.DocumentTemplate.ExportModel Model);
[NonAction]
public override System.Web.Mvc.ActionResult SaveExport(Disco.Web.Areas.Config.Models.DocumentTemplate.ExportModel Model)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.SaveExport);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Model", Model);
SaveExportOverride(callInfo, Model);
return callInfo;
}
} }
} }
@@ -77,6 +77,12 @@ namespace Disco.Web.Areas.Config.Controllers
{ {
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.BulkGenerate); return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.BulkGenerate);
} }
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult Export()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public DocumentTemplateController Actions { get { return MVC.Config.DocumentTemplate; } } public DocumentTemplateController Actions { get { return MVC.Config.DocumentTemplate; } }
@@ -100,6 +106,7 @@ namespace Disco.Web.Areas.Config.Controllers
public readonly string Create = "Create"; public readonly string Create = "Create";
public readonly string CreatePackage = "CreatePackage"; public readonly string CreatePackage = "CreatePackage";
public readonly string BulkGenerate = "BulkGenerate"; public readonly string BulkGenerate = "BulkGenerate";
public readonly string Export = "Export";
public readonly string ExpressionBrowser = "ExpressionBrowser"; public readonly string ExpressionBrowser = "ExpressionBrowser";
} }
@@ -113,6 +120,7 @@ namespace Disco.Web.Areas.Config.Controllers
public const string Create = "Create"; public const string Create = "Create";
public const string CreatePackage = "CreatePackage"; public const string CreatePackage = "CreatePackage";
public const string BulkGenerate = "BulkGenerate"; public const string BulkGenerate = "BulkGenerate";
public const string Export = "Export";
public const string ExpressionBrowser = "ExpressionBrowser"; public const string ExpressionBrowser = "ExpressionBrowser";
} }
@@ -159,6 +167,15 @@ namespace Disco.Web.Areas.Config.Controllers
{ {
public readonly string id = "id"; public readonly string id = "id";
} }
static readonly ActionParamsClass_Export s_params_Export = new ActionParamsClass_Export();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_Export ExportParams { get { return s_params_Export; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Export
{
public readonly string id = "id";
public readonly string exportId = "exportId";
}
static readonly ViewsClass s_views = new ViewsClass(); static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ViewsClass Views { get { return s_views; } } public ViewsClass Views { get { return s_views; } }
@@ -173,6 +190,7 @@ namespace Disco.Web.Areas.Config.Controllers
public readonly string BulkGenerate = "BulkGenerate"; public readonly string BulkGenerate = "BulkGenerate";
public readonly string Create = "Create"; public readonly string Create = "Create";
public readonly string CreatePackage = "CreatePackage"; public readonly string CreatePackage = "CreatePackage";
public readonly string Export = "Export";
public readonly string ImportStatus = "ImportStatus"; public readonly string ImportStatus = "ImportStatus";
public readonly string Index = "Index"; public readonly string Index = "Index";
public readonly string Show = "Show"; public readonly string Show = "Show";
@@ -183,6 +201,7 @@ namespace Disco.Web.Areas.Config.Controllers
public readonly string BulkGenerate = "~/Areas/Config/Views/DocumentTemplate/BulkGenerate.cshtml"; public readonly string BulkGenerate = "~/Areas/Config/Views/DocumentTemplate/BulkGenerate.cshtml";
public readonly string Create = "~/Areas/Config/Views/DocumentTemplate/Create.cshtml"; public readonly string Create = "~/Areas/Config/Views/DocumentTemplate/Create.cshtml";
public readonly string CreatePackage = "~/Areas/Config/Views/DocumentTemplate/CreatePackage.cshtml"; public readonly string CreatePackage = "~/Areas/Config/Views/DocumentTemplate/CreatePackage.cshtml";
public readonly string Export = "~/Areas/Config/Views/DocumentTemplate/Export.cshtml";
public readonly string ImportStatus = "~/Areas/Config/Views/DocumentTemplate/ImportStatus.cshtml"; public readonly string ImportStatus = "~/Areas/Config/Views/DocumentTemplate/ImportStatus.cshtml";
public readonly string Index = "~/Areas/Config/Views/DocumentTemplate/Index.cshtml"; public readonly string Index = "~/Areas/Config/Views/DocumentTemplate/Index.cshtml";
public readonly string Show = "~/Areas/Config/Views/DocumentTemplate/Show.cshtml"; public readonly string Show = "~/Areas/Config/Views/DocumentTemplate/Show.cshtml";
@@ -302,6 +321,19 @@ namespace Disco.Web.Areas.Config.Controllers
return callInfo; return callInfo;
} }
[NonAction]
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string id, System.Guid? exportId);
[NonAction]
public override System.Web.Mvc.ActionResult Export(string id, System.Guid? exportId)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "exportId", exportId);
ExportOverride(callInfo, id, exportId);
return callInfo;
}
[NonAction] [NonAction]
partial void ExpressionBrowserOverride(T4MVC_System_Web_Mvc_ActionResult callInfo); partial void ExpressionBrowserOverride(T4MVC_System_Web_Mvc_ActionResult callInfo);
@@ -0,0 +1,55 @@
using Disco.Models.Services.Exporting;
using Disco.Models.UI.Shared;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
namespace Disco.Web.Models.Shared
{
public static class ExportFieldsModel
{
public static ExportFieldsModel<V> Create<V>(V options, params string[] ignoreProperties)
where V : IExportOptions
{
return new ExportFieldsModel<V>(options, ignoreProperties);
}
}
public class ExportFieldsModel<T> : SharedExportFieldsModel<T> where T : IExportOptions
{
public T Options { get; set; }
public List<ExportOptionGroup> FieldGroups { get; set; }
public ExportFieldsModel(T options, params string[] ignoreProperties)
{
FieldGroups = GetFields(options, ignoreProperties);
}
private static List<ExportOptionGroup> GetFields(T options, params string[] ignoreProperties)
{
var viewData = new ViewDataDictionary<IExportOptions>(options);
var metaData = ModelMetadata.FromLambdaExpression(o => o, viewData);
var properties = metaData.Properties
.Where(p => p.ShortDisplayName != null && p.ModelType == typeof(bool) && !ignoreProperties.Contains(p.PropertyName));
return properties
.Select(p => new ExportOptionField()
{
GroupName = p.ShortDisplayName,
Name = p.PropertyName,
DisplayName = p.DisplayName,
Description = p.Description,
Checked = (bool)p.Model,
})
.GroupBy(p => p.GroupName)
.Select(g =>
{
var group = new ExportOptionGroup(g.Key);
group.AddRange(g);
return group;
})
.ToList();
}
}
}