From 7deead494b948e9230d9b9273a8da0d8746da809 Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Fri, 25 Jul 2025 12:32:44 +1000 Subject: [PATCH] security: use more antiforgery tokens --- .../Extensions/DocumentTemplateExtensions.cs | 38 +- Disco.BI/BI/Interop/Pdf/PdfGenerator.cs | 90 +- .../ConfigAuthorizationRoleCreateModel.cs | 2 +- .../ConfigDeviceBatchCreateModel.cs | 7 +- .../DeviceFlag/ConfigDeviceFlagCreateModel.cs | 3 +- .../ConfigDeviceProfileCreateModel.cs | 4 +- .../ConfigDocumentTemplateCreateModel.cs | 4 +- ...onfigDocumentTemplateCreatePackageModel.cs | 6 +- .../ConfigDocumentTemplateShowModel.cs | 3 +- .../JobQueue/ConfigJobQueueCreateModel.cs | 3 +- .../UserFlag/ConfigUserFlagCreateModel.cs | 3 +- .../Devices/DeviceFlags/DeviceFlagService.cs | 20 +- .../Documents/DocumentBulkGenerateTask.cs | 2 +- .../Documents/DocumentTemplatePackages.cs | 26 +- .../Jobs/JobQueues/JobQueueService.cs | 42 +- .../Users/UserFlags/UserFlagService.cs | 20 +- Disco.Services/Users/UserService.cs | 20 +- .../AuthorizationRoleController.cs | 57 +- .../API/Controllers/BootstrapperController.cs | 53 - .../API/Controllers/DeviceBatchController.cs | 183 +- .../DeviceCertificateController.cs | 1 + .../Areas/API/Controllers/DeviceController.cs | 108 +- .../DeviceFlagAssignmentController.cs | 4 +- .../API/Controllers/DeviceFlagController.cs | 32 +- .../API/Controllers/DeviceModelController.cs | 177 +- .../Controllers/DeviceProfileController.cs | 160 +- .../Controllers/DocumentTemplateController.cs | 178 +- .../DocumentTemplatePackageController.cs | 65 +- .../API/Controllers/EnrolmentController.cs | 57 +- .../Areas/API/Controllers/ExportController.cs | 2 +- .../API/Controllers/ExpressionsController.cs | 8 +- .../Areas/API/Controllers/JobController.cs | 206 ++- .../Controllers/JobPreferencesController.cs | 37 +- .../API/Controllers/JobQueueController.cs | 73 +- .../API/Controllers/JobQueueJobController.cs | 16 +- .../API/Controllers/LoggingController.cs | 3 +- .../Areas/API/Controllers/PluginController.cs | 15 +- .../Areas/API/Controllers/SystemController.cs | 61 +- .../Areas/API/Controllers/UserController.cs | 42 +- .../UserFlagAssignmentController.cs | 4 +- .../API/Controllers/UserFlagController.cs | 56 +- .../API/Models/DeviceModel/ComponentModel.cs | 25 +- .../API/Models/DeviceModel/_ComponentModel.cs | 25 - .../Areas/API/Models/Job/ComponentModel.cs | 15 +- .../Areas/API/Models/Job/_ComponentModel.cs | 19 - .../AuthorizationRoleController.cs | 13 +- .../Controllers/DeviceBatchController.cs | 31 +- .../Controllers/DeviceFlagController.cs | 16 +- .../Controllers/DeviceProfileController.cs | 34 +- .../Controllers/DocumentTemplateController.cs | 38 +- .../Config/Controllers/JobQueueController.cs | 20 +- .../Config/Controllers/PluginsController.cs | 3 +- .../Config/Controllers/UserFlagController.cs | 22 +- .../Models/AuthorizationRole/CreateModel.cs | 4 +- .../Config/Models/DeviceBatch/CreateModel.cs | 8 +- .../Config/Models/DeviceFlag/CreateModel.cs | 7 +- .../Models/DeviceProfile/CreateModel.cs | 10 +- .../Models/DocumentTemplate/CreateModel.cs | 19 +- .../DocumentTemplate/CreatePackageModel.cs | 17 +- .../Models/DocumentTemplate/ShowModel.cs | 3 +- .../Config/Models/JobQueue/CreateModel.cs | 6 +- .../Config/Models/UserFlag/CreateModel.cs | 7 +- .../Views/AuthorizationRole/Create.cshtml | 7 +- .../AuthorizationRole/Create.generated.cs | 30 +- .../Views/AuthorizationRole/Index.cshtml | 217 ++- .../AuthorizationRole/Index.generated.cs | 391 +++-- .../Views/AuthorizationRole/Show.cshtml | 364 ++-- .../Views/AuthorizationRole/Show.generated.cs | 741 ++++---- .../Config/Views/DeviceBatch/Create.cshtml | 8 +- .../Views/DeviceBatch/Create.generated.cs | 37 +- .../Config/Views/DeviceBatch/Show.cshtml | 357 ++-- .../Views/DeviceBatch/Show.generated.cs | 878 +++++----- .../Config/Views/DeviceBatch/Timeline.cshtml | 60 +- .../Views/DeviceBatch/Timeline.generated.cs | 135 +- .../Config/Views/DeviceFlag/Create.cshtml | 17 +- .../Views/DeviceFlag/Create.generated.cs | 45 +- .../Areas/Config/Views/DeviceFlag/Show.cshtml | 116 +- .../Config/Views/DeviceFlag/Show.generated.cs | 527 +++--- .../Config/Views/DeviceModel/Create.cshtml | 12 +- .../Views/DeviceModel/Create.generated.cs | 28 +- .../Config/Views/DeviceModel/Show.cshtml | 42 +- .../Views/DeviceModel/Show.generated.cs | 179 +- .../DeviceModel/_DeviceComponentsTable.cshtml | 297 ++-- .../_DeviceComponentsTable.generated.cs | 480 +++-- .../Config/Views/DeviceProfile/Create.cshtml | 17 +- .../Views/DeviceProfile/Create.generated.cs | 103 +- .../Views/DeviceProfile/Defaults.cshtml | 42 +- .../Views/DeviceProfile/Defaults.generated.cs | 76 +- .../Config/Views/DeviceProfile/Show.cshtml | 165 +- .../Views/DeviceProfile/Show.generated.cs | 450 ++--- .../DocumentTemplate/BulkGenerate.cshtml | 18 +- .../BulkGenerate.generated.cs | 196 +-- .../Views/DocumentTemplate/Create.cshtml | 24 +- .../DocumentTemplate/Create.generated.cs | 86 +- .../DocumentTemplate/CreatePackage.cshtml | 13 +- .../CreatePackage.generated.cs | 48 +- .../DocumentTemplate/ImportStatus.cshtml | 3 +- .../ImportStatus.generated.cs | 33 +- .../Config/Views/DocumentTemplate/Show.cshtml | 141 +- .../Views/DocumentTemplate/Show.generated.cs | 913 +++++----- .../Views/DocumentTemplate/ShowPackage.cshtml | 203 ++- .../ShowPackage1.generated.cs | 789 +++++---- .../DocumentTemplate/UndetectedPages.cshtml | 147 +- .../UndetectedPages.generated.cs | 366 ++-- .../Areas/Config/Views/Enrolment/Index.cshtml | 144 +- .../Config/Views/Enrolment/Index.generated.cs | 266 +-- .../Config/Views/Enrolment/Status.cshtml | 8 +- .../Views/Enrolment/Status.generated.cs | 86 +- .../Areas/Config/Views/Export/_Edit.cshtml | 4 +- .../Config/Views/Export/_Edit.generated.cs | 110 +- .../JobPreferences/Parts/Locations.cshtml | 164 +- .../Parts/Locations.generated.cs | 483 ++--- .../Areas/Config/Views/JobQueue/Create.cshtml | 12 +- .../Config/Views/JobQueue/Create.generated.cs | 56 +- .../Areas/Config/Views/JobQueue/Show.cshtml | 703 ++++---- .../Config/Views/JobQueue/Show.generated.cs | 1549 +++++++++-------- .../Config/Views/Organisation/Index.cshtml | 1 + .../Views/Organisation/Index.generated.cs | 42 +- .../Config/Views/Plugins/Configure.cshtml | 7 +- .../Areas/Config/Views/Plugins/Index.cshtml | 2 +- .../Config/Views/Plugins/Index.generated.cs | 2 +- .../Areas/Config/Views/Plugins/Install.cshtml | 2 +- .../Config/Views/Plugins/Install.generated.cs | 2 +- .../ProviderConfiguration.generated.cs | 25 +- .../Views/Shared/LinkedGroupInstance.cshtml | 12 +- .../Shared/LinkedGroupInstance.generated.cs | 103 +- .../Views/Shared/LinkedGroupShared.cshtml | 5 +- .../Shared/LinkedGroupShared.generated.cs | 154 +- .../Config/Views/Shared/LogEvents.cshtml | 3 +- .../Views/Shared/LogEvents.generated.cs | 53 +- .../_DeviceGroupDocumentBulkGenerate.cshtml | 2 +- ...viceGroupDocumentBulkGenerate.generated.cs | 8 +- .../Config/Views/SystemConfig/Index.cshtml | 71 +- .../Views/SystemConfig/Index.generated.cs | 625 ++++--- .../Areas/Config/Views/UserFlag/Create.cshtml | 17 +- .../Config/Views/UserFlag/Create.generated.cs | 45 +- .../Areas/Config/Views/UserFlag/Show.cshtml | 86 +- .../Config/Views/UserFlag/Show.generated.cs | 596 ++++--- .../Services/Controllers/ClientController.cs | 7 +- .../Modules/Disco-AttachmentUploader.js | 4 +- .../Modules/Disco-AttachmentUploader.min.js | 2 +- .../disco-attachmentuploader.js | 4 +- .../Modules/Disco-DocumentGenerator.js | 51 +- .../Modules/Disco-DocumentGenerator.min.js | 2 +- .../disco.documentgenerator.js | 51 +- .../Modules/Disco-PropertyChangeHelpers.js | 162 +- .../Disco-PropertyChangeHelpers.min.js | 2 +- .../disco.propertychangehelpers.js | 162 +- Disco.Web/ClientSource/Style/BundleSite.css | 3 - .../ClientSource/Style/BundleSite.min.css | 2 +- Disco.Web/ClientSource/Style/Config.css | 4 +- Disco.Web/ClientSource/Style/Config.less | 4 +- Disco.Web/ClientSource/Style/Config.min.css | 2 +- Disco.Web/ClientSource/Style/Job.css | 3 - Disco.Web/ClientSource/Style/Job.less | 4 - Disco.Web/ClientSource/Style/Job.min.css | 2 +- Disco.Web/ClientSource/Style/Site.css | 3 - Disco.Web/ClientSource/Style/Site.less | 4 - Disco.Web/ClientSource/Style/Site.min.css | 2 +- Disco.Web/Disco.Web.csproj | 63 +- Disco.Web/Extensions/AntiForgeryExtensions.cs | 30 + ...I.AuthorizationRoleController.generated.cs | 20 +- .../API.BootstrapperController.generated.cs | 165 -- .../API.DeviceBatchController.generated.cs | 40 +- .../T4MVC/API.DeviceController.generated.cs | 64 +- .../API.DeviceModelController.generated.cs | 38 +- .../API.DeviceProfileController.generated.cs | 30 +- ...PI.DocumentTemplateController.generated.cs | 32 +- ...mentTemplatePackageController.generated.cs | 22 +- .../API.EnrolmentController.generated.cs | 56 + .../T4MVC/API.JobController.generated.cs | 88 +- .../API.JobPreferencesController.generated.cs | 10 +- .../T4MVC/API.UserController.generated.cs | 64 - .../T4MVC/API.UserFlagController.generated.cs | 34 +- ...ig.DocumentTemplateController.generated.cs | 4 +- Disco.Web/Extensions/T4MVC/T4MVC.cs | 1 - .../Device/DeviceParts/_Certificates.cshtml | 37 +- .../DeviceParts/_Certificates.generated.cs | 133 +- .../Views/Device/DeviceParts/_Comments.cshtml | 7 +- .../Device/DeviceParts/_Comments.generated.cs | 146 +- .../Device/DeviceParts/_Resources.cshtml | 50 +- .../DeviceParts/_Resources.generated.cs | 196 +-- .../Views/Device/DeviceParts/_Subject.cshtml | 337 ++-- .../Device/DeviceParts/_Subject.generated.cs | 1374 ++++++++------- Disco.Web/Views/Device/Import.cshtml | 11 +- Disco.Web/Views/Device/Import.generated.cs | 133 +- Disco.Web/Views/Device/ImportHeaders.cshtml | 1 + .../Views/Device/ImportHeaders.generated.cs | 26 +- Disco.Web/Views/Device/ImportReview.cshtml | 198 +-- .../Views/Device/ImportReview.generated.cs | 345 ++-- Disco.Web/Views/Job/Create.cshtml | 2 +- Disco.Web/Views/Job/Create.generated.cs | 10 +- .../Views/Job/JobParts/Components.cshtml | 200 ++- .../Job/JobParts/Components.generated.cs | 369 ++-- Disco.Web/Views/Job/JobParts/Flags.cshtml | 92 +- .../Views/Job/JobParts/Flags.generated.cs | 126 +- Disco.Web/Views/Job/JobParts/Queues.cshtml | 4 + .../Views/Job/JobParts/Queues.generated.cs | 102 +- Disco.Web/Views/Job/JobParts/Resources.cshtml | 58 +- .../Views/Job/JobParts/Resources.generated.cs | 365 ++-- Disco.Web/Views/Job/JobParts/_Subject.cshtml | 215 ++- .../Views/Job/JobParts/_Subject.generated.cs | 1505 +++++++++------- Disco.Web/Views/Job/LogInsurance.cshtml | 4 +- Disco.Web/Views/Job/LogInsurance.generated.cs | 81 +- .../Views/Job/LogInsuranceDisclose.cshtml | 2 +- .../Job/LogInsuranceDisclose.generated.cs | 38 +- Disco.Web/Views/Job/LogRepair.cshtml | 4 +- Disco.Web/Views/Job/LogRepair.generated.cs | 80 +- Disco.Web/Views/Job/LogRepairDisclose.cshtml | 2 +- .../Views/Job/LogRepairDisclose.generated.cs | 38 +- Disco.Web/Views/Job/LogWarranty.cshtml | 4 +- Disco.Web/Views/Job/LogWarranty.generated.cs | 80 +- .../Views/Job/LogWarrantyDisclose.cshtml | 2 +- .../Job/LogWarrantyDisclose.generated.cs | 38 +- .../Shared/_GenerateDocumentControl.cshtml | 4 +- .../_GenerateDocumentControl.generated.cs | 23 +- Disco.Web/Views/Shared/_Layout.cshtml | 2 +- Disco.Web/Views/Shared/_Layout.generated.cs | 75 +- .../Views/User/UserParts/_Comments.cshtml | 7 +- .../User/UserParts/_Comments.generated.cs | 146 +- .../Views/User/UserParts/_Resources.cshtml | 50 +- .../User/UserParts/_Resources.generated.cs | 202 +-- 222 files changed, 12919 insertions(+), 11728 deletions(-) delete mode 100644 Disco.Web/Areas/API/Controllers/BootstrapperController.cs delete mode 100644 Disco.Web/Areas/API/Models/DeviceModel/_ComponentModel.cs delete mode 100644 Disco.Web/Areas/API/Models/Job/_ComponentModel.cs create mode 100644 Disco.Web/Extensions/AntiForgeryExtensions.cs delete mode 100644 Disco.Web/Extensions/T4MVC/API.BootstrapperController.generated.cs diff --git a/Disco.BI/BI/Extensions/DocumentTemplateExtensions.cs b/Disco.BI/BI/Extensions/DocumentTemplateExtensions.cs index ca5fee60..8fa8d174 100644 --- a/Disco.BI/BI/Extensions/DocumentTemplateExtensions.cs +++ b/Disco.BI/BI/Extensions/DocumentTemplateExtensions.cs @@ -66,54 +66,54 @@ namespace Disco.BI.Extensions return CreateExpressions(templateFileName, database); } - public static Dictionary PdfExpressionsFromCache(this DocumentTemplate dt, DiscoDataContext Database) + public static Dictionary PdfExpressionsFromCache(this DocumentTemplate dt, DiscoDataContext database) { - return ExpressionCache.GetOrCreateExpressions(dt, () => CreateExpressions(dt, Database)); + return ExpressionCache.GetOrCreateExpressions(dt, () => CreateExpressions(dt, database)); } - public static List PdfFieldsFromCache(this DocumentTemplate dt, DiscoDataContext Database) + public static List PdfFieldsFromCache(this DocumentTemplate dt, DiscoDataContext database) { - return ExpressionCache.GetOrCreateFields(dt, () => CreateExpressions(dt, Database)); + return ExpressionCache.GetOrCreateFields(dt, () => CreateExpressions(dt, database)); } - public static List ExtractPdfExpressions(this DocumentTemplate dt, DiscoDataContext Database) + public static List ExtractPdfExpressions(this DocumentTemplate dt, DiscoDataContext database) { - return dt.PdfExpressionsFromCache(Database).Values.OrderBy(e => e.Ordinal).ToList(); + return dt.PdfExpressionsFromCache(database).Values.OrderBy(e => e.Ordinal).ToList(); } - public static Stream GeneratePdf(this DocumentTemplate dt, DiscoDataContext Database, IAttachmentTarget Target, User CreatorUser, DateTime TimeStamp, DocumentState State, bool FlattenFields = false) + public static Stream GeneratePdf(this DocumentTemplate dt, DiscoDataContext database, IAttachmentTarget target, User creatorUser, DateTime timeStamp, DocumentState state, bool flattenFields = false) { bool generateExpression = !string.IsNullOrEmpty(dt.OnGenerateExpression); string generateExpressionResult = null; if (generateExpression) - generateExpressionResult = dt.EvaluateOnGenerateExpression(Target, Database, CreatorUser, TimeStamp, State); + generateExpressionResult = dt.EvaluateOnGenerateExpression(target, database, creatorUser, timeStamp, state); - var pdfStream = Interop.Pdf.PdfGenerator.GenerateFromTemplate(dt, Database, Target, CreatorUser, TimeStamp, State, FlattenFields); + var pdfStream = Interop.Pdf.PdfGenerator.GenerateFromTemplate(dt, database, target, creatorUser, timeStamp, state, flattenFields); if (generateExpression) - DocumentsLog.LogDocumentGenerated(dt, Target, CreatorUser, generateExpressionResult); + DocumentsLog.LogDocumentGenerated(dt, target, creatorUser, generateExpressionResult); else - DocumentsLog.LogDocumentGenerated(dt, Target, CreatorUser); + DocumentsLog.LogDocumentGenerated(dt, target, creatorUser); return pdfStream; } - public static Stream GeneratePdfPackage(this DocumentTemplatePackage package, DiscoDataContext Database, IAttachmentTarget Target, User CreatorUser, DateTime TimeStamp, DocumentState State) + public static Stream GeneratePdfPackage(this DocumentTemplatePackage package, DiscoDataContext database, IAttachmentTarget target, User creatorUser, DateTime timeStamp, DocumentState state) { - return Interop.Pdf.PdfGenerator.GenerateFromPackage(package, Database, Target, CreatorUser, TimeStamp, State); + return Interop.Pdf.PdfGenerator.GenerateFromPackage(package, database, target, creatorUser, timeStamp, state); } - public static Stream GeneratePdfPackageBulk(this DocumentTemplatePackage package, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, List DataObjectsIds) + public static Stream GeneratePdfPackageBulk(this DocumentTemplatePackage package, DiscoDataContext database, User creatorUser, DateTime timestamp, bool? insertBlankPages, List dataObjectsIds) { - return Interop.Pdf.PdfGenerator.GenerateBulkFromPackage(package, Database, CreatorUser, Timestamp, InsertBlankPages, DataObjectsIds); + return Interop.Pdf.PdfGenerator.GenerateBulkFromPackage(package, database, creatorUser, timestamp, insertBlankPages, dataObjectsIds); } - public static Stream GeneratePdfPackageBulk(this DocumentTemplatePackage package, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, List DataObjects) + public static Stream GeneratePdfPackageBulk(this DocumentTemplatePackage package, DiscoDataContext database, User creatorUser, DateTime timestamp, bool? insertBlankPages, List dataObjects) { - return Interop.Pdf.PdfGenerator.GenerateBulkFromPackage(package, Database, CreatorUser, Timestamp, InsertBlankPages, DataObjects); + return Interop.Pdf.PdfGenerator.GenerateBulkFromPackage(package, database, creatorUser, timestamp, insertBlankPages, dataObjects); } - public static List PdfPageHasAttachmentId(this DocumentTemplate dt, DiscoDataContext Database) + public static List PdfPageHasAttachmentId(this DocumentTemplate dt, DiscoDataContext database) { - string templateFilename = dt.RepositoryFilename(Database); + string templateFilename = dt.RepositoryFilename(database); if (!File.Exists(templateFilename)) throw new FileNotFoundException("PDF template not found", templateFilename); diff --git a/Disco.BI/BI/Interop/Pdf/PdfGenerator.cs b/Disco.BI/BI/Interop/Pdf/PdfGenerator.cs index b4a08f25..8c5931e2 100644 --- a/Disco.BI/BI/Interop/Pdf/PdfGenerator.cs +++ b/Disco.BI/BI/Interop/Pdf/PdfGenerator.cs @@ -21,16 +21,16 @@ namespace Disco.BI.Interop.Pdf { public static class PdfGenerator { - public static Stream GenerateBulkFromPackage(DocumentTemplatePackage package, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, List DataObjects) + public static Stream GenerateBulkFromPackage(DocumentTemplatePackage package, DiscoDataContext database, User creatorUser, DateTime timestamp, bool? insertBlankPages, List dataObjects) { - if (DataObjects.Count > 0) + if (dataObjects.Count > 0) { - List generatedPdfs = new List(DataObjects.Count); + List generatedPdfs = new List(dataObjects.Count); using (var state = DocumentState.DefaultState()) { - foreach (var d in DataObjects) + foreach (var d in dataObjects) { - generatedPdfs.Add(package.GeneratePdfPackage(Database, d, CreatorUser, Timestamp, state)); + generatedPdfs.Add(package.GeneratePdfPackage(database, d, creatorUser, timestamp, state)); state.SequenceNumber++; state.FlushScopeCache(); } @@ -41,7 +41,7 @@ namespace Disco.BI.Interop.Pdf } else { - Stream bulkPdf = Utilities.JoinPdfs(package.InsertBlankPages || InsertBlankPages, generatedPdfs); + Stream bulkPdf = Utilities.JoinPdfs(insertBlankPages.GetValueOrDefault(package.InsertBlankPages), generatedPdfs); foreach (Stream singlePdf in generatedPdfs) singlePdf.Dispose(); return bulkPdf; @@ -50,25 +50,25 @@ namespace Disco.BI.Interop.Pdf return null; } - public static Stream GenerateBulkFromPackage(DocumentTemplatePackage package, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, List DataObjectsIds) + public static Stream GenerateBulkFromPackage(DocumentTemplatePackage package, DiscoDataContext database, User creatorUser, DateTime timestamp, bool? insertBlankPages, List dataObjectsIds) { List DataObjects; switch (package.Scope) { case AttachmentTypes.Device: - DataObjects = Database.Devices.Where(d => DataObjectsIds.Contains(d.SerialNumber)).ToList(); + DataObjects = database.Devices.Where(d => dataObjectsIds.Contains(d.SerialNumber)).ToList(); break; case AttachmentTypes.Job: - int[] intDataObjectsIds = DataObjectsIds.Select(i => int.Parse(i)).ToArray(); - DataObjects = Database.Jobs.Where(j => intDataObjectsIds.Contains(j.Id)).ToList(); + int[] intDataObjectsIds = dataObjectsIds.Select(i => int.Parse(i)).ToArray(); + DataObjects = database.Jobs.Where(j => intDataObjectsIds.Contains(j.Id)).ToList(); break; case AttachmentTypes.User: - DataObjects = new List(DataObjectsIds.Count); - for (int idIndex = 0; idIndex < DataObjectsIds.Count; idIndex++) + DataObjects = new List(dataObjectsIds.Count); + for (int idIndex = 0; idIndex < dataObjectsIds.Count; idIndex++) { - string dataObjectId = DataObjectsIds[idIndex]; - var user = UserService.GetUser(ActiveDirectory.ParseDomainAccountId(dataObjectId), Database, true); + string dataObjectId = dataObjectsIds[idIndex]; + var user = UserService.GetUser(ActiveDirectory.ParseDomainAccountId(dataObjectId), database, true); if (user == null) throw new Exception($"Unknown Username specified: {dataObjectId}"); DataObjects.Add(user); @@ -78,12 +78,12 @@ namespace Disco.BI.Interop.Pdf throw new InvalidOperationException("Invalid DocumentType Scope"); } - return GenerateBulkFromPackage(package, Database, CreatorUser, Timestamp, InsertBlankPages, DataObjects); + return GenerateBulkFromPackage(package, database, creatorUser, timestamp, insertBlankPages, DataObjects); } - public static Stream GenerateFromPackage(DocumentTemplatePackage package, DiscoDataContext Database, IAttachmentTarget Data, User CreatorUser, DateTime Timestamp, DocumentState State) + public static Stream GenerateFromPackage(DocumentTemplatePackage package, DiscoDataContext database, IAttachmentTarget data, User creatorUser, DateTime timestamp, DocumentState state) { - var templates = package.GetDocumentTemplates(Database); + var templates = package.GetDocumentTemplates(database); if (templates.Count == 0) return null; @@ -92,21 +92,21 @@ namespace Disco.BI.Interop.Pdf string generateExpressionResult = null; if (generateExpression) - generateExpressionResult = package.EvaluateOnGenerateExpression(Data, Database, CreatorUser, Timestamp, State); + generateExpressionResult = package.EvaluateOnGenerateExpression(data, database, creatorUser, timestamp, state); List generatedPdfs = new List(templates.Count); foreach (var template in templates) { - generatedPdfs.Add(template.GeneratePdf(Database, Data, CreatorUser, Timestamp, State, true)); + generatedPdfs.Add(template.GeneratePdf(database, data, creatorUser, timestamp, state, true)); - State.SequenceNumber++; - State.FlushScopeCache(); + state.SequenceNumber++; + state.FlushScopeCache(); } if (generateExpression) - DocumentsLog.LogDocumentPackageGenerated(package, Data, CreatorUser, generateExpressionResult); + DocumentsLog.LogDocumentPackageGenerated(package, data, creatorUser, generateExpressionResult); else - DocumentsLog.LogDocumentPackageGenerated(package, Data, CreatorUser); + DocumentsLog.LogDocumentPackageGenerated(package, data, creatorUser); if (generatedPdfs.Count == 1) { @@ -120,20 +120,20 @@ namespace Disco.BI.Interop.Pdf return bulkPdf; } } - public static Stream GenerateBulkFromTemplate(DocumentTemplate dt, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, List DataObjects, IScheduledTaskStatus taskStatus) + public static Stream GenerateBulkFromTemplate(DocumentTemplate dt, DiscoDataContext database, User creatorUser, DateTime timestamp, bool insertBlankPages, List dataObjects, IScheduledTaskStatus taskStatus) { - if (DataObjects.Count > 0) + if (dataObjects.Count > 0) { - List generatedPdfs = new List(DataObjects.Count); - var progressPerDoc = 80d / DataObjects.Count; + List generatedPdfs = new List(dataObjects.Count); + var progressPerDoc = 80d / dataObjects.Count; var progressDoc = 10d; using (var state = DocumentState.DefaultState()) { taskStatus.UpdateStatus(10, "Rendering", "Starting"); - foreach (var d in DataObjects) + foreach (var d in dataObjects) { taskStatus.UpdateStatus(progressDoc += progressPerDoc, $"Rendering {d.AttachmentReferenceId}"); - generatedPdfs.Add(dt.GeneratePdf(Database, d, CreatorUser, Timestamp, state, true)); + generatedPdfs.Add(dt.GeneratePdf(database, d, creatorUser, timestamp, state, true)); state.SequenceNumber++; state.FlushScopeCache(); } @@ -145,7 +145,7 @@ namespace Disco.BI.Interop.Pdf else { taskStatus.UpdateStatus(90, "Merging", "Merging documents"); - Stream bulkPdf = Utilities.JoinPdfs(InsertBlankPages, generatedPdfs); + Stream bulkPdf = Utilities.JoinPdfs(insertBlankPages, generatedPdfs); foreach (Stream singlePdf in generatedPdfs) singlePdf.Dispose(); return bulkPdf; @@ -154,28 +154,28 @@ namespace Disco.BI.Interop.Pdf return null; } - public static Stream GenerateBulkFromTemplate(DocumentTemplate dt, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, List DataObjectsIds, IScheduledTaskStatus taskStatus) + public static Stream GenerateBulkFromTemplate(DocumentTemplate dt, DiscoDataContext database, User creatorUser, DateTime timestamp, bool insertBlankPages, List dataObjectsIds, IScheduledTaskStatus taskStatus) { Dictionary dataObjectLookup; - List dataObjectIds = DataObjectsIds; + List dataObjectIds = dataObjectsIds; taskStatus.UpdateStatus(0, "Resolving targets", "Resolving render targets"); switch (dt.Scope) { case DocumentTemplate.DocumentTemplateScopes.Device: - dataObjectLookup = Database.Devices.Where(d => DataObjectsIds.Contains(d.SerialNumber)).AsEnumerable().Cast().ToDictionary(i => i.AttachmentReferenceId, StringComparer.OrdinalIgnoreCase); + dataObjectLookup = database.Devices.Where(d => dataObjectsIds.Contains(d.SerialNumber)).AsEnumerable().Cast().ToDictionary(i => i.AttachmentReferenceId, StringComparer.OrdinalIgnoreCase); break; case DocumentTemplate.DocumentTemplateScopes.Job: - var intDataObjectsIds = DataObjectsIds.Select(i => int.Parse(i)).ToList(); - dataObjectLookup = Database.Jobs.Where(j => intDataObjectsIds.Contains(j.Id)).AsEnumerable().Cast().ToDictionary(i => i.AttachmentReferenceId, StringComparer.OrdinalIgnoreCase); + var intDataObjectsIds = dataObjectsIds.Select(i => int.Parse(i)).ToList(); + dataObjectLookup = database.Jobs.Where(j => intDataObjectsIds.Contains(j.Id)).AsEnumerable().Cast().ToDictionary(i => i.AttachmentReferenceId, StringComparer.OrdinalIgnoreCase); break; case DocumentTemplate.DocumentTemplateScopes.User: - dataObjectLookup = new Dictionary(DataObjectsIds.Count, StringComparer.OrdinalIgnoreCase); - dataObjectIds = new List(DataObjectsIds.Count); - foreach (var userId in DataObjectsIds) + dataObjectLookup = new Dictionary(dataObjectsIds.Count, StringComparer.OrdinalIgnoreCase); + dataObjectIds = new List(dataObjectsIds.Count); + foreach (var userId in dataObjectsIds) { - var user = UserService.GetUser(ActiveDirectory.ParseDomainAccountId(userId), Database, true); + var user = UserService.GetUser(ActiveDirectory.ParseDomainAccountId(userId), database, true); if (user == null) { dataObjectIds.Add(userId); @@ -190,7 +190,7 @@ namespace Disco.BI.Interop.Pdf } // recreate list to honor the sort-order provided in DataObjectsIds - var dataObjects = new List(DataObjectsIds.Count); + var dataObjects = new List(dataObjectsIds.Count); var missingIds = new List(); foreach (var id in dataObjectIds) { @@ -204,10 +204,10 @@ namespace Disco.BI.Interop.Pdf throw new Exception($"Unknown id specified: {string.Join("; ", missingIds)}"); } - return GenerateBulkFromTemplate(dt, Database, CreatorUser, Timestamp, InsertBlankPages, dataObjects, taskStatus); + return GenerateBulkFromTemplate(dt, database, creatorUser, timestamp, insertBlankPages, dataObjects, taskStatus); } - public static Stream GenerateFromTemplate(DocumentTemplate dt, DiscoDataContext Database, IAttachmentTarget Data, User CreatorUser, DateTime TimeStamp, DocumentState State, bool FlattenFields = false) + public static Stream GenerateFromTemplate(DocumentTemplate dt, DiscoDataContext Database, IAttachmentTarget Data, User CreatorUser, DateTime TimeStamp, DocumentState State, bool flattenFields = false) { // Validate Data switch (dt.Scope) @@ -232,7 +232,7 @@ namespace Disco.BI.Interop.Pdf // Override FlattenFields if Document Template instructs. if (dt.FlattenForm) - FlattenFields = true; + flattenFields = true; var expressionCache = dt.PdfExpressionsFromCache(Database); @@ -242,7 +242,7 @@ namespace Disco.BI.Interop.Pdf MemoryStream pdfGeneratedStream = new MemoryStream(); PdfStamper pdfStamper = new PdfStamper(pdfReader, pdfGeneratedStream); - pdfStamper.FormFlattening = FlattenFields; + pdfStamper.FormFlattening = flattenFields; pdfStamper.Writer.CloseStream = false; IDictionary expressionVariables = Expression.StandardVariables(dt, Database, CreatorUser, TimeStamp, State, Data); @@ -253,7 +253,7 @@ namespace Disco.BI.Interop.Pdf { AcroFields.Item fields = pdfStamper.AcroFields.Fields[pdfFieldKey]; string fieldValue = dt.CreateUniqueIdentifier(Database, Data, CreatorUser, TimeStamp, 0).ToJson(); - if (FlattenFields) + if (flattenFields) pdfStamper.AcroFields.SetField(pdfFieldKey, string.Empty); else pdfStamper.AcroFields.SetField(pdfFieldKey, fieldValue); diff --git a/Disco.Models/UI/Config/AuthorizationRole/ConfigAuthorizationRoleCreateModel.cs b/Disco.Models/UI/Config/AuthorizationRole/ConfigAuthorizationRoleCreateModel.cs index 2cddd5ec..23373dda 100644 --- a/Disco.Models/UI/Config/AuthorizationRole/ConfigAuthorizationRoleCreateModel.cs +++ b/Disco.Models/UI/Config/AuthorizationRole/ConfigAuthorizationRoleCreateModel.cs @@ -2,6 +2,6 @@ { public interface ConfigAuthorizationRoleCreateModel : BaseUIModel { - Repository.AuthorizationRole AuthorizationRole { get; set; } + string Name { get; set; } } } diff --git a/Disco.Models/UI/Config/DeviceBatch/ConfigDeviceBatchCreateModel.cs b/Disco.Models/UI/Config/DeviceBatch/ConfigDeviceBatchCreateModel.cs index da7c377c..d79652e2 100644 --- a/Disco.Models/UI/Config/DeviceBatch/ConfigDeviceBatchCreateModel.cs +++ b/Disco.Models/UI/Config/DeviceBatch/ConfigDeviceBatchCreateModel.cs @@ -1,7 +1,10 @@ -namespace Disco.Models.UI.Config.DeviceBatch +using System; + +namespace Disco.Models.UI.Config.DeviceBatch { public interface ConfigDeviceBatchCreateModel : BaseUIModel { - Repository.DeviceBatch DeviceBatch { get; set; } + string Name { get; set; } + DateTime PurchaseDate { get; set; } } } diff --git a/Disco.Models/UI/Config/DeviceFlag/ConfigDeviceFlagCreateModel.cs b/Disco.Models/UI/Config/DeviceFlag/ConfigDeviceFlagCreateModel.cs index cd141612..1aa195aa 100644 --- a/Disco.Models/UI/Config/DeviceFlag/ConfigDeviceFlagCreateModel.cs +++ b/Disco.Models/UI/Config/DeviceFlag/ConfigDeviceFlagCreateModel.cs @@ -2,6 +2,7 @@ { public interface ConfigDeviceFlagCreateModel : BaseUIModel { - Repository.DeviceFlag DeviceFlag { get; set; } + string Name { get; set; } + string Description { get; set; } } } diff --git a/Disco.Models/UI/Config/DeviceProfile/ConfigDeviceProfileCreateModel.cs b/Disco.Models/UI/Config/DeviceProfile/ConfigDeviceProfileCreateModel.cs index 6716d411..ae496083 100644 --- a/Disco.Models/UI/Config/DeviceProfile/ConfigDeviceProfileCreateModel.cs +++ b/Disco.Models/UI/Config/DeviceProfile/ConfigDeviceProfileCreateModel.cs @@ -2,6 +2,8 @@ { public interface ConfigDeviceProfileCreateModel : BaseUIModel { - Repository.DeviceProfile DeviceProfile { get; set; } + string Name { get; set; } + string ShortName { get; set; } + string Description { get; set; } } } diff --git a/Disco.Models/UI/Config/DocumentTemplate/ConfigDocumentTemplateCreateModel.cs b/Disco.Models/UI/Config/DocumentTemplate/ConfigDocumentTemplateCreateModel.cs index 2014c091..f6c58a7e 100644 --- a/Disco.Models/UI/Config/DocumentTemplate/ConfigDocumentTemplateCreateModel.cs +++ b/Disco.Models/UI/Config/DocumentTemplate/ConfigDocumentTemplateCreateModel.cs @@ -4,7 +4,9 @@ namespace Disco.Models.UI.Config.DocumentTemplate { public interface ConfigDocumentTemplateCreateModel : BaseUIModel { - Repository.DocumentTemplate DocumentTemplate { get; set; } + string Id { get; set; } + string Description { get; set; } + string Scope { get; set; } List Types { get; set; } List SubTypes { get; set; } diff --git a/Disco.Models/UI/Config/DocumentTemplate/ConfigDocumentTemplateCreatePackageModel.cs b/Disco.Models/UI/Config/DocumentTemplate/ConfigDocumentTemplateCreatePackageModel.cs index 86f1c795..72c90b3e 100644 --- a/Disco.Models/UI/Config/DocumentTemplate/ConfigDocumentTemplateCreatePackageModel.cs +++ b/Disco.Models/UI/Config/DocumentTemplate/ConfigDocumentTemplateCreatePackageModel.cs @@ -1,11 +1,13 @@ -using Disco.Models.Services.Documents; +using Disco.Models.Repository; using System.Collections.Generic; namespace Disco.Models.UI.Config.DocumentTemplate { public interface ConfigDocumentTemplateCreatePackageModel : BaseUIModel { - DocumentTemplatePackage Package { get; set; } + string Id { get; set; } + string Description { get; set; } + AttachmentTypes Scope { get; set; } List Scopes { get; } } diff --git a/Disco.Models/UI/Config/DocumentTemplate/ConfigDocumentTemplateShowModel.cs b/Disco.Models/UI/Config/DocumentTemplate/ConfigDocumentTemplateShowModel.cs index f1610b4d..07718b83 100644 --- a/Disco.Models/UI/Config/DocumentTemplate/ConfigDocumentTemplateShowModel.cs +++ b/Disco.Models/UI/Config/DocumentTemplate/ConfigDocumentTemplateShowModel.cs @@ -1,4 +1,5 @@ using Disco.Models.Services.Documents; +using System; using System.Collections.Generic; namespace Disco.Models.UI.Config.DocumentTemplate @@ -9,7 +10,7 @@ namespace Disco.Models.UI.Config.DocumentTemplate int StoredInstanceCount { get; set; } List TemplatePagesHaveAttachmentId { get; set; } int TemplatePageCount { get; } - string BulkGenerateDownloadId { get; } + Guid? BulkGenerateDownloadId { get; } string BulkGenerateDownloadFilename { get; } List UserFlags { get; set; } diff --git a/Disco.Models/UI/Config/JobQueue/ConfigJobQueueCreateModel.cs b/Disco.Models/UI/Config/JobQueue/ConfigJobQueueCreateModel.cs index ba3c8d4e..4384bc5d 100644 --- a/Disco.Models/UI/Config/JobQueue/ConfigJobQueueCreateModel.cs +++ b/Disco.Models/UI/Config/JobQueue/ConfigJobQueueCreateModel.cs @@ -2,6 +2,7 @@ { public interface ConfigJobQueueCreateModel : BaseUIModel { - Repository.JobQueue JobQueue { get; set; } + string Name { get; set; } + string Description { get; set; } } } diff --git a/Disco.Models/UI/Config/UserFlag/ConfigUserFlagCreateModel.cs b/Disco.Models/UI/Config/UserFlag/ConfigUserFlagCreateModel.cs index 28217cb1..9839cd14 100644 --- a/Disco.Models/UI/Config/UserFlag/ConfigUserFlagCreateModel.cs +++ b/Disco.Models/UI/Config/UserFlag/ConfigUserFlagCreateModel.cs @@ -2,6 +2,7 @@ { public interface ConfigUserFlagCreateModel : BaseUIModel { - Repository.UserFlag UserFlag { get; set; } + string Name { get; set; } + string Description { get; set; } } } \ No newline at end of file diff --git a/Disco.Services/Devices/DeviceFlags/DeviceFlagService.cs b/Disco.Services/Devices/DeviceFlags/DeviceFlagService.cs index dcfe1c51..1496bda4 100644 --- a/Disco.Services/Devices/DeviceFlags/DeviceFlagService.cs +++ b/Disco.Services/Devices/DeviceFlags/DeviceFlagService.cs @@ -45,25 +45,23 @@ namespace Disco.Services.Devices.DeviceFlags public static DeviceFlag GetDeviceFlag(int deviceFlagId) { return _cache.GetDeviceFlag(deviceFlagId); } #region Device Flag Maintenance - public static DeviceFlag CreateDeviceFlag(DiscoDataContext database, DeviceFlag deviceFlag) + public static DeviceFlag CreateDeviceFlag(DiscoDataContext database, string name, string description) { // Verify - if (string.IsNullOrWhiteSpace(deviceFlag.Name)) - throw new ArgumentException("The Device Flag Name is required", nameof(deviceFlag)); + if (string.IsNullOrWhiteSpace(name)) + throw new ArgumentException("The Device Flag Name is required", nameof(name)); // Name Unique - if (_cache.GetDeviceFlags().Any(f => f.Name == deviceFlag.Name)) - throw new ArgumentException("Another Device Flag already exists with that name", nameof(deviceFlag)); + if (_cache.GetDeviceFlags().Any(f => f.Name.Equals(name, StringComparison.Ordinal))) + throw new ArgumentException("Another Device Flag already exists with that name", nameof(name)); // Clone to break reference var flag = new DeviceFlag() { - Name = deviceFlag.Name, - Description = deviceFlag.Description, - Icon = deviceFlag.Icon, - IconColour = deviceFlag.IconColour, - DevicesLinkedGroup = deviceFlag.DevicesLinkedGroup, - DeviceUsersLinkedGroup = deviceFlag.DeviceUsersLinkedGroup, + Name = name, + Description = description, + Icon = RandomUnusedIcon(), + IconColour = RandomUnusedThemeColour(), }; database.DeviceFlags.Add(flag); diff --git a/Disco.Services/Documents/DocumentBulkGenerateTask.cs b/Disco.Services/Documents/DocumentBulkGenerateTask.cs index 06c6c687..b21da345 100644 --- a/Disco.Services/Documents/DocumentBulkGenerateTask.cs +++ b/Disco.Services/Documents/DocumentBulkGenerateTask.cs @@ -25,7 +25,7 @@ namespace Disco.Services.Documents Directory.Delete(cachePath, true); } - public static Stream GetCached(DiscoDataContext database, string id) + public static Stream GetCached(DiscoDataContext database, Guid id) { var cachePath = GetCachePath(database); var path = Path.Combine(cachePath, $"{id}.pdf"); diff --git a/Disco.Services/Documents/DocumentTemplatePackages.cs b/Disco.Services/Documents/DocumentTemplatePackages.cs index 613b31e4..0eb9b3e8 100644 --- a/Disco.Services/Documents/DocumentTemplatePackages.cs +++ b/Disco.Services/Documents/DocumentTemplatePackages.cs @@ -1,6 +1,7 @@ using Disco.Data.Repository; using Disco.Models.Repository; using Disco.Models.Services.Documents; +using Disco.Models.UI.Config.DocumentTemplate; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -121,19 +122,26 @@ namespace Disco.Services.Documents return packages; } - public static DocumentTemplatePackage CreatePackage(DocumentTemplatePackage Package) + public static DocumentTemplatePackage CreatePackage(string id, string description, AttachmentTypes scope) { - if (string.IsNullOrWhiteSpace(Package.Id)) - throw new ArgumentNullException(nameof(Package), "The Package Id is required"); - if (cache.ContainsKey(Package.Id)) // Name Unique - throw new ArgumentException("Another Package already exists with that Id", nameof(Package)); - if (string.IsNullOrWhiteSpace(Package.Description)) - throw new ArgumentNullException(nameof(Package), "The Package Description is required"); + if (string.IsNullOrWhiteSpace(id)) + throw new ArgumentNullException(nameof(id), "The Package Id is required"); + if (cache.ContainsKey(id)) // Name Unique + throw new ArgumentException("Another Package already exists with that Id", nameof(id)); + if (string.IsNullOrWhiteSpace(description)) + throw new ArgumentNullException(nameof(description), "The Package Description is required"); - if (cache.TryAdd(Package.Id, Package)) + var package = new DocumentTemplatePackage() + { + Id = id, + Description = description, + Scope = scope, + }; + + if (cache.TryAdd(id, package)) { PersistCache(); - return Package; + return package; } else throw new Exception("Unable to add the Package to the Cache, check the Package Id and try again"); diff --git a/Disco.Services/Jobs/JobQueues/JobQueueService.cs b/Disco.Services/Jobs/JobQueues/JobQueueService.cs index 892cfad4..532b4b4a 100644 --- a/Disco.Services/Jobs/JobQueues/JobQueueService.cs +++ b/Disco.Services/Jobs/JobQueues/JobQueueService.cs @@ -28,41 +28,24 @@ namespace Disco.Services.Jobs.JobQueues public static JobQueueToken GetQueue(int JobQueueId) { return _cache.GetQueue(JobQueueId); } #region Job Queues Maintenance - public static JobQueueToken CreateJobQueue(DiscoDataContext Database, JobQueue JobQueue) + public static JobQueueToken CreateJobQueue(DiscoDataContext Database, string name, string description) { // Verify - if (string.IsNullOrWhiteSpace(JobQueue.Name)) + if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("The Job Queue Name is required"); // Name Unique - if (_cache.GetQueues().Any(q => q.JobQueue.Name == JobQueue.Name)) + if (_cache.GetQueues().Any(q => q.JobQueue.Name.Equals(name, StringComparison.Ordinal))) throw new ArgumentException("Another Job Queue already exists with that name", "JobQueue"); - // Sanitize Subject Ids - if (string.IsNullOrWhiteSpace(JobQueue.SubjectIds)) - { - JobQueue.SubjectIds = null; - } - else - { - var subjectIds = JobQueue.SubjectIds.Split(','); - foreach (var subjectId in subjectIds) - { - UserService.GetUser(subjectId, Database); - } - JobQueue.SubjectIds = string.Join(",", Database.Users.Where(u => subjectIds.Contains(u.UserId)).Select(u => u.UserId)); - } - // Clone to break reference var queue = new JobQueue() { - Name = JobQueue.Name, - Description = JobQueue.Description, - Icon = JobQueue.Icon, - IconColour = JobQueue.IconColour, - DefaultSLAExpiry = JobQueue.DefaultSLAExpiry, - Priority = JobQueue.Priority, - SubjectIds = JobQueue.SubjectIds + Name = name, + Description = description, + Icon = RandomUnusedIcon(), + IconColour = RandomUnusedThemeColour(), + Priority = JobQueuePriority.Normal, }; Database.JobQueues.Add(queue); @@ -85,15 +68,6 @@ namespace Disco.Services.Jobs.JobQueues { JobQueue.SubjectIds = null; } - else - { - var subjectIds = JobQueue.SubjectIds.Split(','); - foreach (var subjectId in subjectIds) - { - UserService.GetUser(subjectId, Database); - } - JobQueue.SubjectIds = string.Join(",", Database.Users.Where(u => subjectIds.Contains(u.UserId)).Select(u => u.UserId)); - } Database.SaveChanges(); diff --git a/Disco.Services/Users/UserFlags/UserFlagService.cs b/Disco.Services/Users/UserFlags/UserFlagService.cs index 8139907a..ae1bc55e 100644 --- a/Disco.Services/Users/UserFlags/UserFlagService.cs +++ b/Disco.Services/Users/UserFlags/UserFlagService.cs @@ -45,25 +45,23 @@ namespace Disco.Services.Users.UserFlags public static UserFlag GetUserFlag(int UserFlagId) { return _cache.GetUserFlag(UserFlagId); } #region User Flag Maintenance - public static UserFlag CreateUserFlag(DiscoDataContext Database, UserFlag UserFlag) + public static UserFlag CreateUserFlag(DiscoDataContext Database, string name, string description) { // Verify - if (string.IsNullOrWhiteSpace(UserFlag.Name)) - throw new ArgumentException("The User Flag Name is required"); + if (string.IsNullOrWhiteSpace(name)) + throw new ArgumentException("The User Flag Name is required", nameof(name)); // Name Unique - if (_cache.GetUserFlags().Any(f => f.Name == UserFlag.Name)) - throw new ArgumentException("Another User Flag already exists with that name", "UserFlag"); + if (_cache.GetUserFlags().Any(f => f.Name.Equals(name, StringComparison.Ordinal))) + throw new ArgumentException("Another User Flag already exists with that name", nameof(name)); // Clone to break reference var flag = new UserFlag() { - Name = UserFlag.Name, - Description = UserFlag.Description, - Icon = UserFlag.Icon, - IconColour = UserFlag.IconColour, - UsersLinkedGroup = UserFlag.UsersLinkedGroup, - UserDevicesLinkedGroup = UserFlag.UserDevicesLinkedGroup + Name = name, + Description = description, + Icon = RandomUnusedIcon(), + IconColour = RandomUnusedThemeColour(), }; Database.UserFlags.Add(flag); diff --git a/Disco.Services/Users/UserService.cs b/Disco.Services/Users/UserService.cs index bbe5520a..b928629a 100644 --- a/Disco.Services/Users/UserService.cs +++ b/Disco.Services/Users/UserService.cs @@ -138,26 +138,28 @@ namespace Disco.Services.Users return Cache.InvalidateRecord(UserId); } - public static int CreateAuthorizationRole(DiscoDataContext Database, AuthorizationRole Role) + public static int CreateAuthorizationRole(DiscoDataContext Database, string name) { - if (Role == null) + if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullException("Role"); - if (string.IsNullOrWhiteSpace(Role.ClaimsJson)) - Role.ClaimsJson = JsonConvert.SerializeObject(new RoleClaims()); - - Database.AuthorizationRoles.Add(Role); + var role = new AuthorizationRole() + { + Name = name, + ClaimsJson = JsonConvert.SerializeObject(new RoleClaims()), + }; + Database.AuthorizationRoles.Add(role); Database.SaveChanges(); - AuthorizationLog.LogRoleCreated(Role, CurrentUserId); + AuthorizationLog.LogRoleCreated(role, CurrentUserId); // Add to Cache - RoleCache.AddRole(Role); + RoleCache.AddRole(role); // Flush User Cache Cache.FlushCache(); - return Role.Id; + return role.Id; } public static void DeleteAuthorizationRole(DiscoDataContext Database, AuthorizationRole Role) { diff --git a/Disco.Web/Areas/API/Controllers/AuthorizationRoleController.cs b/Disco.Web/Areas/API/Controllers/AuthorizationRoleController.cs index bef77c36..1a1be917 100644 --- a/Disco.Web/Areas/API/Controllers/AuthorizationRoleController.cs +++ b/Disco.Web/Areas/API/Controllers/AuthorizationRoleController.cs @@ -17,7 +17,7 @@ namespace Disco.Web.Areas.API.Controllers #region Properties const string pName = "name"; - + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false) { try @@ -40,19 +40,19 @@ namespace Disco.Web.Areas.API.Controllers } else { - return Json("Invalid Authorization Role Id", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Authorization Role Id"); } if (redirect) return RedirectToAction(MVC.Config.AuthorizationRole.Index(authorizationRole.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } @@ -96,27 +96,27 @@ namespace Disco.Web.Areas.API.Controllers AuthorizationLog.LogRoleConfiguredClaimsAdded(AuthorizationRole, CurrentUser.UserId, addedClaims); } - private void UpdateSubjects(AuthorizationRole AuthorizationRole, string[] Subjects) + private void UpdateSubjects(AuthorizationRole AuthorizationRole, string[] subjects) { string subjectIds = null; string[] removedSubjects = null; string[] addedSubjects = null; // Validate Subjects - if (Subjects != null && Subjects.Length > 0) + if (subjects != null && subjects.Length > 0) { - var subjects = Subjects + var subjectRecords = subjects .Where(s => !string.IsNullOrWhiteSpace(s)) .Select(s => s.Trim()) .Select(s => Tuple.Create(s, ActiveDirectory.RetrieveADObject(s, Quick: true))) .Where(s => s.Item2 is ADUserAccount || s.Item2 is ADGroup) .ToList(); - var invalidSubjects = subjects.Where(s => s.Item2 == null).ToList(); + var invalidSubjects = subjectRecords.Where(s => s.Item2 == null).ToList(); if (invalidSubjects.Count > 0) throw new ArgumentException($"Subjects not found: {string.Join(", ", invalidSubjects)}", "Subjects"); - var proposedSubjects = subjects.Select(s => s.Item2.Id).OrderBy(s => s).ToArray(); + var proposedSubjects = subjectRecords.Select(s => s.Item2.Id).OrderBy(s => s).ToArray(); var currentSubjects = AuthorizationRole.SubjectIds == null ? new string[0] : AuthorizationRole.SubjectIds.Split(','); removedSubjects = currentSubjects.Except(proposedSubjects).ToArray(); addedSubjects = proposedSubjects.Except(currentSubjects).ToArray(); @@ -139,12 +139,14 @@ namespace Disco.Web.Areas.API.Controllers } } + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateName(int id, string RoleName = null, bool redirect = false) { return Update(id, pName, RoleName, redirect); } - public virtual ActionResult UpdateClaims(int id, string[] ClaimKeys = null, bool redirect = false) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult UpdateClaims(int id, string[] claimKeys = null, bool redirect = false) { try { @@ -154,26 +156,27 @@ namespace Disco.Web.Areas.API.Controllers var authorizationRole = Database.AuthorizationRoles.Find(id); if (authorizationRole != null) { - UpdateClaims(authorizationRole, ClaimKeys); + UpdateClaims(authorizationRole, claimKeys); } else { - return Json("Invalid Authorization Role Id", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Authorization Role Id"); } if (redirect) return RedirectToAction(MVC.Config.AuthorizationRole.Index(authorizationRole.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateSubjects(int id, string[] Subjects = null, bool redirect = false) { try @@ -188,26 +191,26 @@ namespace Disco.Web.Areas.API.Controllers } else { - return Json("Invalid Authorization Role Id", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Authorization Role Id"); } if (redirect) return RedirectToAction(MVC.Config.AuthorizationRole.Index(authorizationRole.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #endregion #region Actions - + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Delete(int id, bool? redirect = false) { try @@ -220,7 +223,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.AuthorizationRole.Index(null)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } throw new Exception("Invalid Authorization Role Id"); } @@ -229,33 +232,33 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } - [HttpPost] - public virtual ActionResult UpdateAdministratorSubjects(string[] Subjects, bool redirect = false) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult UpdateAdministratorSubjects(string[] subjects, bool redirect = false) { string[] proposedSubjects; string[] removedSubjects = null; string[] addedSubjects = null; // Validate Subjects - if (Subjects == null || Subjects.Length == 0) + if (subjects == null || subjects.Length == 0) throw new ArgumentNullException("Subjects", "At least one Id must be supplied"); - var subjects = Subjects + var subjectValues = subjects .Where(s => !string.IsNullOrWhiteSpace(s)) .Select(s => s.Trim()) .Select(s => Tuple.Create(s, ActiveDirectory.RetrieveADObject(s, Quick: true))) .Where(s => s.Item2 is ADUserAccount || s.Item2 is ADGroup) .ToList(); - var invalidSubjects = subjects.Where(s => s.Item2 == null).ToList(); + var invalidSubjects = subjectValues.Where(s => s.Item2 == null).ToList(); if (invalidSubjects.Count > 0) throw new ArgumentException($"Subjects not found: {string.Join(", ", invalidSubjects)}", "Subjects"); - proposedSubjects = subjects.Select(s => s.Item2.Id).OrderBy(s => s).ToArray(); + proposedSubjects = subjectValues.Select(s => s.Item2.Id).OrderBy(s => s).ToArray(); var currentSubjects = UserService.AdministratorSubjectIds; removedSubjects = currentSubjects.Except(proposedSubjects).ToArray(); addedSubjects = proposedSubjects.Except(currentSubjects).ToArray(); @@ -270,7 +273,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.AuthorizationRole.Index()); else - return Json("OK"); + return Ok(); } #endregion diff --git a/Disco.Web/Areas/API/Controllers/BootstrapperController.cs b/Disco.Web/Areas/API/Controllers/BootstrapperController.cs deleted file mode 100644 index cb42446d..00000000 --- a/Disco.Web/Areas/API/Controllers/BootstrapperController.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Disco.Services.Authorization; -using Disco.Services.Web; -using System; -using System.Web.Mvc; - -namespace Disco.Web.Areas.API.Controllers -{ - [DiscoAuthorize(Claims.Config.Enrolment.Configure)] - public partial class BootstrapperController : AuthorizedDatabaseController - { - public virtual ActionResult MacSshUsername(string MacSshUsername) - { - try - { - if (!string.IsNullOrWhiteSpace(MacSshUsername)) - { - Database.DiscoConfiguration.Bootstrapper.MacSshUsername = MacSshUsername; - Database.SaveChanges(); - return Json("OK", JsonRequestBehavior.AllowGet); - } - else - { - throw new Exception("The Username cannot be null or empty"); - } - } - catch (Exception ex) - { - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); - } - } - public virtual ActionResult MacSshPassword(string MacSshPassword) - { - try - { - if (!string.IsNullOrWhiteSpace(MacSshPassword)) - { - Database.DiscoConfiguration.Bootstrapper.MacSshPassword = MacSshPassword; - Database.SaveChanges(); - return Json("OK", JsonRequestBehavior.AllowGet); - } - else - { - throw new Exception("The Password cannot be null or empty"); - } - } - catch (Exception ex) - { - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); - } - } - - } -} diff --git a/Disco.Web/Areas/API/Controllers/DeviceBatchController.cs b/Disco.Web/Areas/API/Controllers/DeviceBatchController.cs index 0b413de5..db91a5e4 100644 --- a/Disco.Web/Areas/API/Controllers/DeviceBatchController.cs +++ b/Disco.Web/Areas/API/Controllers/DeviceBatchController.cs @@ -9,6 +9,7 @@ using Disco.Services.Web; using Disco.Web.Extensions; using System; using System.Collections.Generic; +using System.Data.Entity; using System.Drawing; using System.Linq; using System.Web.Mvc; @@ -35,6 +36,7 @@ namespace Disco.Web.Areas.API.Controllers const string pAssignedUsersLinkedGroup = "assigneduserslinkedgroup"; [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false) { Authorization.Require(Claims.Config.DeviceBatch.Configure); @@ -104,109 +106,124 @@ namespace Disco.Web.Areas.API.Controllers } else { - return Json("Invalid Device Batch Id", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Device Batch Id"); } if (redirect) return RedirectToAction(MVC.Config.DeviceBatch.Index(deviceBatch.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #region Update Shortcut Methods [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateName(int id, string BatchName = null, bool redirect = false) { return Update(id, pName, BatchName, redirect); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdatePurchaseDate(int id, string PurchaseDate = null, bool redirect = false) { return Update(id, pPurchaseDate, PurchaseDate, redirect); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateSupplier(int id, string Supplier = null, bool redirect = false) { return Update(id, pSupplier, Supplier, redirect); } - [DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)] - public virtual ActionResult UpdatePurchaseDetails(int id, string PurchaseDetails = null, bool redirect = false) + [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken, ValidateInput(false)] + public virtual ActionResult UpdatePurchaseDetails(int id, string purchaseDetails = null, bool redirect = false) { - return Update(id, pPurchaseDetails, PurchaseDetails, redirect); + return Update(id, pPurchaseDetails, purchaseDetails, redirect); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateUnitCost(int id, string UnitCost = null, bool redirect = false) { return Update(id, pUnitCost, UnitCost, redirect); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateUnitQuantity(int id, string UnitQuantity = null, bool redirect = false) { return Update(id, pUnitQuantity, UnitQuantity, redirect); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDefaultDeviceModelId(int id, string DefaultDeviceModelId = null, bool redirect = false) { return Update(id, pDefaultDeviceModelId, DefaultDeviceModelId, redirect); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateWarrantyValidUntil(int id, string WarrantyValidUntil = null, bool redirect = false) { return Update(id, pWarrantyValidUntil, WarrantyValidUntil, redirect); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)] - public virtual ActionResult UpdateWarrantyDetails(int id, string WarrantyDetails = null, bool redirect = false) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult UpdateWarrantyDetails(int id, string warrantyDetails = null, bool redirect = false) { - return Update(id, pWarrantyDetails, WarrantyDetails, redirect); + return Update(id, pWarrantyDetails, warrantyDetails, redirect); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuredDate(int id, string InsuredDate = null, bool redirect = false) { return Update(id, pInsuredDate, InsuredDate, redirect); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceSupplier(int id, string InsuranceSupplier = null, bool redirect = false) { return Update(id, pInsuranceSupplier, InsuranceSupplier, redirect); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuredUntil(int id, string InsuredUntil = null, bool redirect = false) { return Update(id, pInsuredUntil, InsuredUntil, redirect); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)] - public virtual ActionResult UpdateInsuranceDetails(int id, string InsuranceDetails = null, bool redirect = false) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult UpdateInsuranceDetails(int id, string insuranceDetails = null, bool redirect = false) { - return Update(id, pInsuranceDetails, InsuranceDetails, redirect); + return Update(id, pInsuranceDetails, insuranceDetails, redirect); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)] - public virtual ActionResult UpdateComments(int id, string Comments = null, bool redirect = false) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult UpdateComments(int id, string comments = null, bool redirect = false) { - return Update(id, pComments, Comments, redirect); + return Update(id, pComments, comments, redirect); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDevicesLinkedGroup(int id, string GroupId = null, bool redirect = false) { try @@ -228,17 +245,18 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId)); } else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateAssignedUsersLinkedGroup(int id, string GroupId = null, bool redirect = false) { try @@ -260,42 +278,42 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId)); } else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #endregion #region Update Properties - private void UpdateName(DeviceBatch deviceBatch, string Name) + private void UpdateName(DeviceBatch deviceBatch, string name) { - if (string.IsNullOrWhiteSpace(Name)) + if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullException("Name", "Device Batch Name is required"); else { // Check for Duplicates - var d = Database.DeviceBatches.Where(db => db.Id != deviceBatch.Id && db.Name == Name).Count(); + var d = Database.DeviceBatches.Where(db => db.Id != deviceBatch.Id && db.Name == name).Count(); if (d > 0) { throw new Exception("A Device Batch with that name already exists"); } - deviceBatch.Name = Name; + deviceBatch.Name = name; } Database.SaveChanges(); } - private void UpdatePurchaseDate(DeviceBatch deviceBatch, string PurchaseDate) + private void UpdatePurchaseDate(DeviceBatch deviceBatch, string purchaseDate) { - if (string.IsNullOrEmpty(PurchaseDate)) + if (string.IsNullOrEmpty(purchaseDate)) throw new ArgumentNullException("PurchaseDate", "A Device Batch Purchase Date is required"); else { - if (DateTime.TryParse(PurchaseDate, out var ecd)) + if (DateTime.TryParse(purchaseDate, out var ecd)) { deviceBatch.PurchaseDate = ecd.Date; } @@ -306,48 +324,48 @@ namespace Disco.Web.Areas.API.Controllers } Database.SaveChanges(); } - private void UpdateSupplier(DeviceBatch deviceBatch, string Supplier) + private void UpdateSupplier(DeviceBatch deviceBatch, string supplier) { - if (string.IsNullOrWhiteSpace(Supplier)) + if (string.IsNullOrWhiteSpace(supplier)) deviceBatch.Supplier = null; else - deviceBatch.Supplier = Supplier; + deviceBatch.Supplier = supplier; Database.SaveChanges(); } - private void UpdatePurchaseDetails(DeviceBatch deviceBatch, string PurchaseDetails) + private void UpdatePurchaseDetails(DeviceBatch deviceBatch, string purchaseDetails) { - if (string.IsNullOrWhiteSpace(PurchaseDetails)) + if (string.IsNullOrWhiteSpace(purchaseDetails)) deviceBatch.PurchaseDetails = null; else - deviceBatch.PurchaseDetails = PurchaseDetails; + deviceBatch.PurchaseDetails = purchaseDetails; Database.SaveChanges(); } - private void UpdateUnitCost(DeviceBatch deviceBatch, string UnitCost) + private void UpdateUnitCost(DeviceBatch deviceBatch, string unitCost) { - if (string.IsNullOrWhiteSpace(UnitCost)) + if (string.IsNullOrWhiteSpace(unitCost)) deviceBatch.UnitCost = null; else { - if (decimal.TryParse(UnitCost, out var unitCost)) - { - deviceBatch.UnitCost = unitCost; - } + unitCost = unitCost.Trim(); + if (unitCost.StartsWith("$")) + unitCost = unitCost.Substring(1).Trim(); // Remove $ sign if present + + if (decimal.TryParse(unitCost, out var unitCostValue)) + deviceBatch.UnitCost = unitCostValue; else - { throw new Exception("Invalid Currency Format"); - } } Database.SaveChanges(); } - private void UpdateUnitQuantity(DeviceBatch deviceBatch, string UnitQuantity) + private void UpdateUnitQuantity(DeviceBatch deviceBatch, string unitQuantity) { - if (string.IsNullOrWhiteSpace(UnitQuantity)) + if (string.IsNullOrWhiteSpace(unitQuantity)) deviceBatch.UnitQuantity = null; else { - if (int.TryParse(UnitQuantity, out var unitQuantity)) + if (int.TryParse(unitQuantity, out var unitQuantityValue)) { - deviceBatch.UnitQuantity = unitQuantity; + deviceBatch.UnitQuantity = unitQuantityValue; } else { @@ -356,11 +374,11 @@ namespace Disco.Web.Areas.API.Controllers } Database.SaveChanges(); } - private void UpdateDefaultDeviceModelId(DeviceBatch deviceBatch, string DefaultDeviceModelId) + private void UpdateDefaultDeviceModelId(DeviceBatch deviceBatch, string defaultDeviceModelId) { - if (!string.IsNullOrEmpty(DefaultDeviceModelId)) + if (!string.IsNullOrEmpty(defaultDeviceModelId)) { - if (int.TryParse(DefaultDeviceModelId, out var bId)) + if (int.TryParse(defaultDeviceModelId, out var bId)) { var dm = Database.DeviceModels.Find(bId); if (dm != null) @@ -384,13 +402,13 @@ namespace Disco.Web.Areas.API.Controllers } throw new Exception("Invalid Device Model Id"); } - private void UpdateWarrantyValidUntil(DeviceBatch deviceBatch, string WarrantyValidUntil) + private void UpdateWarrantyValidUntil(DeviceBatch deviceBatch, string warrantyValidUntil) { - if (string.IsNullOrEmpty(WarrantyValidUntil)) + if (string.IsNullOrEmpty(warrantyValidUntil)) deviceBatch.WarrantyValidUntil = null; else { - if (DateTime.TryParse(WarrantyValidUntil, out var ecd)) + if (DateTime.TryParse(warrantyValidUntil, out var ecd)) { deviceBatch.WarrantyValidUntil = ecd.Date; } @@ -401,21 +419,21 @@ namespace Disco.Web.Areas.API.Controllers } Database.SaveChanges(); } - private void UpdateWarrantyDetails(DeviceBatch deviceBatch, string WarrantyDetails) + private void UpdateWarrantyDetails(DeviceBatch deviceBatch, string warrantyDetails) { - if (string.IsNullOrWhiteSpace(WarrantyDetails)) + if (string.IsNullOrWhiteSpace(warrantyDetails)) deviceBatch.WarrantyDetails = null; else - deviceBatch.WarrantyDetails = WarrantyDetails; + deviceBatch.WarrantyDetails = warrantyDetails; Database.SaveChanges(); } - private void UpdateInsuredDate(DeviceBatch deviceBatch, string InsuredDate) + private void UpdateInsuredDate(DeviceBatch deviceBatch, string insuredDate) { - if (string.IsNullOrEmpty(InsuredDate)) + if (string.IsNullOrEmpty(insuredDate)) deviceBatch.InsuredDate = null; else { - if (DateTime.TryParse(InsuredDate, out var ecd)) + if (DateTime.TryParse(insuredDate, out var ecd)) { deviceBatch.InsuredDate = ecd.Date; } @@ -426,21 +444,21 @@ namespace Disco.Web.Areas.API.Controllers } Database.SaveChanges(); } - private void UpdateInsuranceSupplier(DeviceBatch deviceBatch, string InsuranceSupplier) + private void UpdateInsuranceSupplier(DeviceBatch deviceBatch, string insuranceSupplier) { - if (string.IsNullOrWhiteSpace(InsuranceSupplier)) + if (string.IsNullOrWhiteSpace(insuranceSupplier)) deviceBatch.InsuranceSupplier = null; else - deviceBatch.InsuranceSupplier = InsuranceSupplier; + deviceBatch.InsuranceSupplier = insuranceSupplier; Database.SaveChanges(); } - private void UpdateInsuredUntil(DeviceBatch deviceBatch, string InsuredUntil) + private void UpdateInsuredUntil(DeviceBatch deviceBatch, string insuredUntil) { - if (string.IsNullOrEmpty(InsuredUntil)) + if (string.IsNullOrEmpty(insuredUntil)) deviceBatch.InsuredUntil = null; else { - if (DateTime.TryParse(InsuredUntil, out var ecd)) + if (DateTime.TryParse(insuredUntil, out var ecd)) { deviceBatch.InsuredUntil = ecd.Date; } @@ -451,26 +469,26 @@ namespace Disco.Web.Areas.API.Controllers } Database.SaveChanges(); } - private void UpdateInsuranceDetails(DeviceBatch deviceBatch, string InsuranceDetails) + private void UpdateInsuranceDetails(DeviceBatch deviceBatch, string insuranceDetails) { - if (string.IsNullOrWhiteSpace(InsuranceDetails)) + if (string.IsNullOrWhiteSpace(insuranceDetails)) deviceBatch.InsuranceDetails = null; else - deviceBatch.InsuranceDetails = InsuranceDetails; + deviceBatch.InsuranceDetails = insuranceDetails; Database.SaveChanges(); } - private void UpdateComments(DeviceBatch deviceBatch, string Comments) + private void UpdateComments(DeviceBatch deviceBatch, string comments) { - if (string.IsNullOrWhiteSpace(Comments)) + if (string.IsNullOrWhiteSpace(comments)) deviceBatch.Comments = null; else - deviceBatch.Comments = Comments; + deviceBatch.Comments = comments; Database.SaveChanges(); } - private ScheduledTaskStatus UpdateDevicesLinkedGroup(DeviceBatch DeviceBatch, string DevicesLinkedGroup) + private ScheduledTaskStatus UpdateDevicesLinkedGroup(DeviceBatch DeviceBatch, string devicesLinkedGroup) { - var configJson = ADManagedGroup.ValidConfigurationToJson(DeviceBatchDevicesManagedGroup.GetKey(DeviceBatch), DevicesLinkedGroup, null); + var configJson = ADManagedGroup.ValidConfigurationToJson(DeviceBatchDevicesManagedGroup.GetKey(DeviceBatch), devicesLinkedGroup, null); if (DeviceBatch.DevicesLinkedGroup != configJson) { @@ -485,9 +503,9 @@ namespace Disco.Web.Areas.API.Controllers return null; } - private ScheduledTaskStatus UpdateAssignedUsersLinkedGroup(DeviceBatch DeviceBatch, string AssignedUsersLinkedGroup) + private ScheduledTaskStatus UpdateAssignedUsersLinkedGroup(DeviceBatch DeviceBatch, string assignedUsersLinkedGroup) { - var configJson = ADManagedGroup.ValidConfigurationToJson(DeviceBatchAssignedUsersManagedGroup.GetKey(DeviceBatch), AssignedUsersLinkedGroup, null); + var configJson = ADManagedGroup.ValidConfigurationToJson(DeviceBatchAssignedUsersManagedGroup.GetKey(DeviceBatch), assignedUsersLinkedGroup, null); if (DeviceBatch.AssignedUsersLinkedGroup != configJson) { @@ -506,6 +524,7 @@ namespace Disco.Web.Areas.API.Controllers #region Actions [DiscoAuthorize(Claims.Config.DeviceBatch.Delete)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Delete(int id, bool? redirect = false) { try @@ -518,7 +537,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.DeviceBatch.Index(null)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } throw new Exception("Invalid Device Batch Number"); } @@ -527,7 +546,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } @@ -536,6 +555,7 @@ namespace Disco.Web.Areas.API.Controllers #region Index [DiscoAuthorize(Claims.Config.DeviceBatch.Show)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Index(int? id) { if (id.HasValue) @@ -556,6 +576,7 @@ namespace Disco.Web.Areas.API.Controllers #region Timeline [DiscoAuthorizeAll(Claims.Config.DeviceBatch.Show, Claims.Config.DeviceBatch.ShowTimeline)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Timeline() { @@ -601,7 +622,7 @@ namespace Disco.Web.Areas.API.Controllers } #endregion - #region Attachements + #region Attachments [DiscoAuthorize(Claims.Config.DeviceBatch.Show)] [OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)] @@ -660,6 +681,9 @@ namespace Disco.Web.Areas.API.Controllers if (string.IsNullOrEmpty(contentType) || contentType.Equals("unknown/unknown", StringComparison.OrdinalIgnoreCase)) contentType = MimeTypes.ResolveMimeType(file.FileName); + if (string.IsNullOrWhiteSpace(comments)) + comments = null; + var attachment = new DeviceBatchAttachment() { DeviceBatchId = batch.Id, @@ -687,7 +711,7 @@ namespace Disco.Web.Areas.API.Controllers [DiscoAuthorize(Claims.Config.DeviceBatch.Show)] public virtual ActionResult Attachment(int id) { - var attachment = Database.DeviceBatchAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault(); + var attachment = Database.DeviceBatchAttachments.Include(a => a.TechUser).Where(m => m.Id == id).FirstOrDefault(); if (attachment != null) { @@ -699,13 +723,13 @@ namespace Disco.Web.Areas.API.Controllers return Json(m, JsonRequestBehavior.AllowGet); } - return Json(new Models.Attachment.AttachmentModel() { Result = "Invalid Attachment Number" }, JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Attachment Number"); } [DiscoAuthorize(Claims.Config.DeviceBatch.Show)] public virtual ActionResult Attachments(int id) { - var batch = Database.DeviceBatches.Include("DeviceBatchAttachments.TechUser").Where(m => m.Id == id).FirstOrDefault(); + var batch = Database.DeviceBatches.Include(b => b.DeviceBatchAttachments.Select(a => a.TechUser)).Where(m => m.Id == id).FirstOrDefault(); if (batch != null) { var m = new Models.Attachment.AttachmentsModel() @@ -716,20 +740,21 @@ namespace Disco.Web.Areas.API.Controllers return Json(m, JsonRequestBehavior.AllowGet); } - return Json(new Models.Attachment.AttachmentsModel() { Result = "Invalid Device Batch Id" }, JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Device Batch Id"); } [DiscoAuthorize(Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult AttachmentRemove(int id) { - var attachment = Database.DeviceBatchAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault(); + var attachment = Database.DeviceBatchAttachments.Include(a => a.TechUser).Where(m => m.Id == id).FirstOrDefault(); if (attachment != null) { attachment.OnDelete(Database); Database.SaveChanges(); - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } - return Json("Invalid Attachment Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Attachment Number"); } #endregion diff --git a/Disco.Web/Areas/API/Controllers/DeviceCertificateController.cs b/Disco.Web/Areas/API/Controllers/DeviceCertificateController.cs index 96526ac0..8d5200e1 100644 --- a/Disco.Web/Areas/API/Controllers/DeviceCertificateController.cs +++ b/Disco.Web/Areas/API/Controllers/DeviceCertificateController.cs @@ -9,6 +9,7 @@ namespace Disco.Web.Areas.API.Controllers { [DiscoAuthorize(Claims.Config.DeviceCertificate.DownloadCertificates)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Download(int id) { var wc = Database.DeviceCertificates.Find(id); diff --git a/Disco.Web/Areas/API/Controllers/DeviceController.cs b/Disco.Web/Areas/API/Controllers/DeviceController.cs index 9c762614..5f9440fb 100644 --- a/Disco.Web/Areas/API/Controllers/DeviceController.cs +++ b/Disco.Web/Areas/API/Controllers/DeviceController.cs @@ -26,7 +26,6 @@ namespace Disco.Web.Areas.API.Controllers { public partial class DeviceController : AuthorizedDatabaseController { - const string pDeviceProfileId = "deviceprofileid"; const string pDeviceBatchId = "devicebatchid"; const string pAssetNumber = "assetnumber"; @@ -37,6 +36,7 @@ namespace Disco.Web.Areas.API.Controllers const string pDetailBattery = "detailbattery"; const string pDetailKeyboard = "detailkeyboard"; + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false) { Database.Configuration.LazyLoadingEnabled = true; @@ -99,20 +99,21 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Device.Show(device.SerialNumber)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #region Update Shortcut Methods - [DiscoAuthorize(Claims.Device.Properties.DeviceProfile), HttpPost, ValidateAntiForgeryToken] + [DiscoAuthorize(Claims.Device.Properties.DeviceProfile)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDeviceProfileId(string id, string DeviceProfileId = null, bool enforceOrganisationalUnit = false, bool redirect = false) { var updateResult = Update(id, pDeviceProfileId, DeviceProfileId, redirect); @@ -163,24 +164,28 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.Device.Properties.DeviceBatch)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDeviceBatchId(string id, string DeviceBatchId = null, bool redirect = false) { return Update(id, pDeviceBatchId, DeviceBatchId, redirect); } [DiscoAuthorize(Claims.Device.Properties.AssetNumber)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateAssetNumber(string id, string AssetNumber = null, bool redirect = false) { return Update(id, pAssetNumber, AssetNumber, redirect); } [DiscoAuthorize(Claims.Device.Properties.Location)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateLocation(string id, string Location = null, bool redirect = false) { return Update(id, pLocation, Location, redirect); } [DiscoAuthorize(Claims.Device.Actions.AssignUser)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateAssignedUserId(string id, string AssignedUserId = null, bool redirect = false) { if (!string.IsNullOrWhiteSpace(AssignedUserId)) @@ -190,24 +195,28 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.Device.Actions.AllowUnauthenticatedEnrol)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateAllowUnauthenticatedEnrol(string id, string AllowUnauthenticatedEnrol = null, bool redirect = false) { return Update(id, pAllowUnauthenticatedEnrol, AllowUnauthenticatedEnrol, redirect); } [DiscoAuthorize(Claims.Device.Properties.Details)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDetailACAdapter(string id, string DetailACAdapter = null, bool redirect = false) { return Update(id, pDetailACAdapter, DetailACAdapter, redirect); } [DiscoAuthorize(Claims.Device.Properties.Details)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDetailBattery(string id, string DetailBattery = null, bool redirect = false) { return Update(id, pDetailBattery, DetailBattery, redirect); } [DiscoAuthorize(Claims.Device.Properties.Details)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDetailKeyboard(string id, string DetailKeyboard = null, bool redirect = false) { return Update(id, pDetailKeyboard, DetailKeyboard, redirect); @@ -344,31 +353,36 @@ namespace Disco.Web.Areas.API.Controllers #region Device Actions [DiscoAuthorize(Claims.Device.Actions.Decommission)] - public virtual ActionResult Decommission(string id, int Reason, bool redirect) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult Decommission(string id, int? Reason = null, bool redirect = false) { + if (Reason == null) + throw new ArgumentNullException(nameof(Reason), "Decommission Reason is required"); + var d = Database.Devices.Find(id); Database.Configuration.LazyLoadingEnabled = true; if (d != null) { if (d.CanDecommission()) { - d.OnDecommission((DecommissionReasons)Reason, Database); + d.OnDecommission((DecommissionReasons)Reason.Value, Database); Database.SaveChanges(); if (redirect) return RedirectToAction(MVC.Device.Show(id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { - return Json("Device's state doesn't allow this action", JsonRequestBehavior.AllowGet); + return BadRequest("Device's state doesn't allow this action"); } } - return Json("Invalid Device Serial Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Device Serial Number"); } [DiscoAuthorize(Claims.Device.Actions.Recommission)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Recommission(string id, bool redirect) { var d = Database.Devices.Find(id); @@ -383,17 +397,18 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Device.Show(id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { - return Json("Device's state doesn't allow this action", JsonRequestBehavior.AllowGet); + return BadRequest("Device's state doesn't allow this action"); } } - return Json("Invalid Device Serial Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Device Serial Number"); } [DiscoAuthorize(Claims.Device.Actions.Delete)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Delete(string id, bool redirect) { var j = Database.Devices.Find(id); @@ -408,43 +423,20 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Device.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { - return Json("Job's state doesn't allow this action", JsonRequestBehavior.AllowGet); + return BadRequest("Job's state doesn't allow this action"); } } - return Json("Invalid Device Serial Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Device Serial Number"); } #endregion - [DiscoAuthorize(Claims.Device.Actions.GenerateDocuments)] - public virtual ActionResult GeneratePdf(string id, string DocumentTemplateId) - { - if (string.IsNullOrEmpty(id)) - throw new ArgumentNullException(nameof(id)); - if (string.IsNullOrEmpty(DocumentTemplateId)) - throw new ArgumentNullException(nameof(DocumentTemplateId)); - - // Obsolete: Use API\DocumentTemplate\Generate instead - return RedirectToAction(MVC.API.DocumentTemplate.Generate(DocumentTemplateId, id)); - } - - [DiscoAuthorize(Claims.Device.Actions.GenerateDocuments)] - public virtual ActionResult GeneratePdfPackage(string id, string DocumentTemplatePackageId) - { - if (string.IsNullOrEmpty(id)) - throw new ArgumentNullException(nameof(id)); - if (string.IsNullOrEmpty(DocumentTemplatePackageId)) - throw new ArgumentNullException(nameof(DocumentTemplatePackageId)); - - // Obsolete: Use API\DocumentTemplatePackage\Generate instead - return RedirectToAction(MVC.API.DocumentTemplatePackage.Generate(DocumentTemplatePackageId, id)); - } - [DiscoAuthorize(Claims.Device.Show)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult LastNetworkLogonDate(string id) { if (string.IsNullOrWhiteSpace(id)) @@ -585,7 +577,8 @@ namespace Disco.Web.Areas.API.Controllers return HttpNotFound("Invalid Attachment Number"); } - [DiscoAuthorize(Claims.Device.Actions.AddAttachments), ValidateAntiForgeryToken] + [DiscoAuthorize(Claims.Device.Actions.AddAttachments)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult AttachmentUpload(string id, string comments) { var d = Database.Devices.Find(id); @@ -644,7 +637,7 @@ namespace Disco.Web.Areas.API.Controllers return Json(m, JsonRequestBehavior.AllowGet); } - return Json(new Models.Attachment.AttachmentModel() { Result = "Invalid Attachment Number" }, JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Attachment Number"); } [DiscoAuthorize(Claims.Device.ShowAttachments)] @@ -661,10 +654,11 @@ namespace Disco.Web.Areas.API.Controllers return Json(m, JsonRequestBehavior.AllowGet); } - return Json(new Models.Attachment.AttachmentsModel() { Result = "Invalid Device Serial Number" }, JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Device Serial Number"); } [DiscoAuthorizeAny(Claims.Job.Actions.RemoveAnyAttachments, Claims.Job.Actions.RemoveOwnAttachments)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult AttachmentRemove(int id) { var da = Database.DeviceAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault(); @@ -677,9 +671,9 @@ namespace Disco.Web.Areas.API.Controllers da.OnDelete(Database); Database.SaveChanges(); - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } - return Json("Invalid Attachment Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Attachment Number"); } [DiscoAuthorize(Claims.Device.Actions.AddAttachments)] @@ -706,11 +700,7 @@ namespace Disco.Web.Areas.API.Controllers } catch (InvalidOperationException ex) { - return Json(new - { - Success = false, - ErrorMessage = ex.Message, - }); + return BadRequest(ex.Message); } } @@ -736,6 +726,7 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.Device.Actions.Import)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult ImportBegin(HttpPostedFileBase ImportFile, bool HasHeader) { if (ImportFile == null || ImportFile.ContentLength == 0) @@ -752,15 +743,14 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.Device.Actions.Import)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult ImportParse(string Id, List Headers) { if (string.IsNullOrWhiteSpace(Id)) - throw new ArgumentNullException("Id"); + throw new ArgumentNullException(nameof(Id)); - var context = Import_RetrieveContext(Id); - - if (context == null) - throw new ArgumentException("The Import Session Id is invalid or the session timed out (60 minutes), try importing again", "Id"); + var context = Import_RetrieveContext(Id) + ?? throw new ArgumentException("The Import Session Id is invalid or the session timed out (60 minutes), try importing again", nameof(Id)); context.UpdateColumnTypes(Headers); @@ -777,15 +767,14 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.Device.Actions.Import)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult ImportApply(string Id) { if (string.IsNullOrWhiteSpace(Id)) - throw new ArgumentNullException("Id"); + throw new ArgumentNullException(nameof(Id)); - var context = Import_RetrieveContext(Id); - - if (context == null) - throw new ArgumentException("The Import Session Id is invalid or the session timed out (60 minutes), try importing again", "Id"); + var context = Import_RetrieveContext(Id) + ?? throw new ArgumentException("The Import Session Id is invalid or the session timed out (60 minutes), try importing again", nameof(Id)); var status = DeviceImportApplyTask.ScheduleNow(context); status.SetFinishedUrl(Url.Action(MVC.Device.Import(context.SessionId))); @@ -895,6 +884,7 @@ namespace Disco.Web.Areas.API.Controllers #endregion [DiscoAuthorize(Claims.DiscoAdminAccount)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult MigrateDeviceMacAddressesFromLog() { var taskStatus = Disco.Services.Devices.Enrolment.LogMacAddressImportingTask.ScheduleImmediately(); diff --git a/Disco.Web/Areas/API/Controllers/DeviceFlagAssignmentController.cs b/Disco.Web/Areas/API/Controllers/DeviceFlagAssignmentController.cs index 1aa8f054..e20b0838 100644 --- a/Disco.Web/Areas/API/Controllers/DeviceFlagAssignmentController.cs +++ b/Disco.Web/Areas/API/Controllers/DeviceFlagAssignmentController.cs @@ -40,14 +40,14 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return Redirect($"{Url.Action(MVC.Device.Show(assignment.DeviceSerialNumber))}#DeviceDetailTab-Flags"); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } diff --git a/Disco.Web/Areas/API/Controllers/DeviceFlagController.cs b/Disco.Web/Areas/API/Controllers/DeviceFlagController.cs index 08859713..98766d67 100644 --- a/Disco.Web/Areas/API/Controllers/DeviceFlagController.cs +++ b/Disco.Web/Areas/API/Controllers/DeviceFlagController.cs @@ -24,6 +24,7 @@ namespace Disco.Web.Areas.API.Controllers const string pOnUnassignmentExpression = "onunassignmentexpression"; [DiscoAuthorize(Claims.Config.DeviceFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null) { Authorization.Require(Claims.Config.DeviceFlag.Configure); @@ -68,43 +69,48 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.DeviceFlag.Index(flag.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #region Update Shortcut Methods [DiscoAuthorize(Claims.Config.DeviceFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateName(int id, string FlagName = null, bool? redirect = null) { return Update(id, pName, FlagName, redirect); } [DiscoAuthorize(Claims.Config.DeviceFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null) { return Update(id, pDescription, Description, redirect); } [DiscoAuthorize(Claims.Config.DeviceFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateIcon(int id, string Icon = null, bool? redirect = null) { return Update(id, pIcon, Icon, redirect); } [DiscoAuthorize(Claims.Config.DeviceFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateIconColour(int id, string IconColour = null, bool? redirect = null) { return Update(id, pIconColour, IconColour, redirect); } [DiscoAuthorize(Claims.Config.DeviceFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateIconAndColour(int id, string Icon = null, string IconColour = null, bool redirect = false) { try @@ -124,27 +130,30 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.DeviceFlag.Index(DeviceFlag.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Config.DeviceFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateOnAssignmentExpression(int id, string OnAssignmentExpression = null, bool redirect = false) { return Update(id, pOnAssignmentExpression, OnAssignmentExpression, redirect); } [DiscoAuthorize(Claims.Config.DeviceFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateOnUnassignmentExpression(int id, string OnUnassignmentExpression = null, bool redirect = false) { return Update(id, pOnUnassignmentExpression, OnUnassignmentExpression, redirect); } [DiscoAuthorize(Claims.Config.DeviceFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDevicesLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false) { try @@ -167,17 +176,18 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId)); } else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Config.DeviceFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateAssignedUserLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false) { try @@ -200,14 +210,14 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId)); } else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #endregion @@ -341,6 +351,7 @@ namespace Disco.Web.Areas.API.Controllers #region Actions [DiscoAuthorizeAll(Claims.Config.DeviceFlag.Configure, Claims.Config.DeviceFlag.Delete)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Delete(int id, bool? redirect = false) { try @@ -354,7 +365,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } throw new ArgumentException("Invalid Device Flag Id", nameof(id)); } @@ -363,11 +374,12 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorizeAll(Claims.Config.DeviceFlag.Configure, Claims.Device.Actions.AddFlags, Claims.Device.Actions.RemoveFlags, Claims.Device.ShowFlagAssignments)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult BulkAssignDevices(int id, bool Override, string DeviceSerialNumbers = null, string Comments = null) { if (id < 0) diff --git a/Disco.Web/Areas/API/Controllers/DeviceModelController.cs b/Disco.Web/Areas/API/Controllers/DeviceModelController.cs index 50f7de3f..2446e9b7 100644 --- a/Disco.Web/Areas/API/Controllers/DeviceModelController.cs +++ b/Disco.Web/Areas/API/Controllers/DeviceModelController.cs @@ -7,6 +7,7 @@ using Disco.Services.Plugins.Features.WarrantyProvider; using Disco.Services.Web; using System; using System.Collections.Generic; +using System.Data.Entity; using System.Linq; using System.Web; using System.Web.Mvc; @@ -24,6 +25,7 @@ namespace Disco.Web.Areas.API.Controllers const string pDefaultRepairProvider = "defaultrepairprovider"; [DiscoAuthorize(Claims.Config.DeviceModel.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false) { Authorization.Require(Claims.Config.DeviceModel.Configure); @@ -63,19 +65,19 @@ namespace Disco.Web.Areas.API.Controllers } else { - return Json("Invalid Device Model Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Device Model Number"); } if (redirect) return RedirectToAction(MVC.Config.DeviceModel.Index(deviceModel.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } @@ -120,12 +122,12 @@ namespace Disco.Web.Areas.API.Controllers #endregion #region Update Properties - private void UpdateDescription(DeviceModel deviceModel, string Description) + private void UpdateDescription(DeviceModel deviceModel, string description) { - if (string.IsNullOrWhiteSpace(Description)) + if (string.IsNullOrWhiteSpace(description)) deviceModel.Description = null; else - deviceModel.Description = Description; + deviceModel.Description = description; Database.SaveChanges(); } private void UpdateManufacturer(DeviceModel deviceModel, string manufacturer) @@ -150,15 +152,15 @@ namespace Disco.Web.Areas.API.Controllers deviceModel.Model = model; Database.SaveChanges(); } - private void UpdateDefaultPurchaseDate(DeviceModel deviceModel, string DefaultPurchaseDate) + private void UpdateDefaultPurchaseDate(DeviceModel deviceModel, string defaultPurchaseDate) { - if (string.IsNullOrEmpty(DefaultPurchaseDate)) + if (string.IsNullOrEmpty(defaultPurchaseDate)) { deviceModel.DefaultPurchaseDate = null; } else { - if (DateTime.TryParse(DefaultPurchaseDate, out var d)) + if (DateTime.TryParse(defaultPurchaseDate, out var d)) { deviceModel.DefaultPurchaseDate = d; } @@ -169,30 +171,30 @@ namespace Disco.Web.Areas.API.Controllers } Database.SaveChanges(); } - private void UpdateDefaultWarrantyProvider(DeviceModel deviceModel, string DefaultWarrantyProvider) + private void UpdateDefaultWarrantyProvider(DeviceModel deviceModel, string defaultWarrantyProvider) { - if (string.IsNullOrEmpty(DefaultWarrantyProvider)) + if (string.IsNullOrEmpty(defaultWarrantyProvider)) { deviceModel.DefaultWarrantyProvider = null; } else { // Validate - var WarrantyProvider = Plugins.GetPluginFeature(DefaultWarrantyProvider, typeof(WarrantyProviderFeature)); + var WarrantyProvider = Plugins.GetPluginFeature(defaultWarrantyProvider, typeof(WarrantyProviderFeature)); deviceModel.DefaultWarrantyProvider = WarrantyProvider.Id; } Database.SaveChanges(); } - private void UpdateDefaultRepairProvider(DeviceModel deviceModel, string DefaultRepairProvider) + private void UpdateDefaultRepairProvider(DeviceModel deviceModel, string defaultRepairProvider) { - if (string.IsNullOrEmpty(DefaultRepairProvider)) + if (string.IsNullOrEmpty(defaultRepairProvider)) { deviceModel.DefaultRepairProvider = null; } else { // Validate - var RepairProvider = Plugins.GetPluginFeature(DefaultRepairProvider, typeof(RepairProviderFeature)); + var RepairProvider = Plugins.GetPluginFeature(defaultRepairProvider, typeof(RepairProviderFeature)); deviceModel.DefaultRepairProvider = RepairProvider.Id; } Database.SaveChanges(); @@ -213,12 +215,7 @@ namespace Disco.Web.Areas.API.Controllers var deviceModelImage = m.Image(); if (deviceModelImage != null) return File(deviceModelImage, "image/png"); - //if ( m.Image != null) - //{ - // return File(m.Image, "image/png"); - //} - //else - //{ + // DataStore Failed - Use Generic Images if (m.ModelType != null) { @@ -228,13 +225,13 @@ namespace Disco.Web.Areas.API.Controllers return File(modelTypePath, "image/png"); } } - //} } } return File(Links.ClientSource.Style.Images.DeviceTypes.Unknown_png, "image/png"); } - [DiscoAuthorize(Claims.Config.DeviceModel.Configure), HttpPost] + [DiscoAuthorize(Claims.Config.DeviceModel.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Image(int id, bool redirect, HttpPostedFileBase Image) { if (Image != null && Image.ContentLength > 0) @@ -248,31 +245,32 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.DeviceModel.Index(dm.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { if (redirect) return RedirectToAction(MVC.Config.DeviceModel.Index(dm.Id)); else - return Json("Invalid Image Format", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Image Format"); } } if (redirect) return RedirectToAction(MVC.Config.DeviceModel.Index()); else - return Json("Invalid Device Model Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Device Model Number"); } if (redirect) return RedirectToAction(MVC.Config.DeviceModel.Index()); else - return Json("No Image Supplied", JsonRequestBehavior.AllowGet); + return BadRequest("No Image Supplied"); } #endregion #region Actions [DiscoAuthorize(Claims.Config.DeviceModel.Delete)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Delete(int id, bool? redirect = false) { try @@ -285,7 +283,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.DeviceModel.Index(null)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } throw new Exception("Invalid Device Model Number"); } @@ -294,7 +292,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } @@ -303,39 +301,38 @@ namespace Disco.Web.Areas.API.Controllers #region Device Model Components [DiscoAuthorize(Claims.Config.DeviceModel.Show)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Component(int id) { - var dc = Database.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault(); - if (dc != null) - { - return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet); - } - return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet); + var dc = Database.DeviceComponents.Include(c => c.JobSubTypes).Where(i => i.Id == id).FirstOrDefault(); + if (dc == null) + return BadRequest("Invalid Device Component Id"); + + return Json(Models.DeviceModel.ComponentModel.FromDeviceComponent(dc)); } [DiscoAuthorize(Claims.Config.DeviceModel.ConfigureComponents)] - public virtual ActionResult ComponentAdd(int? id, string Description, string Cost) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult ComponentAdd(int? id, string description, string cost) { DeviceModel dm = null; if (id.HasValue) { dm = Database.DeviceModels.Find(id.Value); if (dm == null) - { - return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Model Id" }, JsonRequestBehavior.AllowGet); - } + return BadRequest("Invalid Device Model Id"); } - if (string.IsNullOrEmpty(Description)) - Description = "?"; - if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$")) - Cost = Cost.Substring(Cost.IndexOf("$") + 1); - decimal.TryParse(Cost, out var cost); + if (string.IsNullOrEmpty(description)) + description = "?"; + if (!string.IsNullOrEmpty(cost) && cost.Contains("$")) + cost = cost.Substring(cost.IndexOf("$") + 1); + decimal.TryParse(cost, out var costValue); var dc = new DeviceComponent() { - Description = Description, - Cost = cost + Description = description, + Cost = costValue }; if (dm != null) { @@ -346,77 +343,77 @@ namespace Disco.Web.Areas.API.Controllers Database.DeviceComponents.Add(dc); Database.SaveChanges(); - return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet); + return Json(Models.DeviceModel.ComponentModel.FromDeviceComponent(dc)); } [DiscoAuthorize(Claims.Config.DeviceModel.ConfigureComponents)] - public virtual ActionResult ComponentUpdateJobSubTypes(int id, List JobSubTypes) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult ComponentUpdateJobSubTypes(int id, List jobSubTypes) { - var dc = Database.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault(); - if (dc != null) - { - dc.JobSubTypes.Clear(); + var dc = Database.DeviceComponents.Include(c => c.JobSubTypes).Where(i => i.Id == id).FirstOrDefault(); + if (dc == null) + return BadRequest("Invalid Device Component Id"); - if (JobSubTypes != null) + dc.JobSubTypes.Clear(); + + if (jobSubTypes != null) + { + var jsts = Database.JobSubTypes.Where(jst => jobSubTypes.Contains(jst.JobTypeId + "_" + jst.Id)); + foreach (var jst in jsts) { - var jsts = Database.JobSubTypes.Where(jst => JobSubTypes.Contains(jst.JobTypeId + "_" + jst.Id)); - foreach (var jst in jsts) - { - dc.JobSubTypes.Add(jst); - } + dc.JobSubTypes.Add(jst); } - - Database.SaveChanges(); - - return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet); } - return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet); + + Database.SaveChanges(); + + return Json(Models.DeviceModel.ComponentModel.FromDeviceComponent(dc)); } [DiscoAuthorize(Claims.Config.DeviceModel.ConfigureComponents)] - public virtual ActionResult ComponentUpdate(int id, string Description, string Cost) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult ComponentUpdate(int id, string description, string cost) { - var dc = Database.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault(); - if (dc != null) - { + var dc = Database.DeviceComponents.Include(c => c.JobSubTypes).Where(i => i.Id == id).FirstOrDefault(); + if (dc == null) + return BadRequest("Invalid Device Component Id"); - if (string.IsNullOrEmpty(Description)) - Description = "?"; - if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$")) - Cost = Cost.Substring(Cost.IndexOf("$") + 1); - decimal.TryParse(Cost, out var cost); + if (string.IsNullOrEmpty(description)) + description = "?"; + if (!string.IsNullOrEmpty(cost) && cost.Contains("$")) + cost = cost.Substring(cost.IndexOf("$") + 1); + decimal.TryParse(cost, out var costValue); - dc.Description = Description; - dc.Cost = cost; + dc.Description = description; + dc.Cost = costValue; - Database.SaveChanges(); + Database.SaveChanges(); - return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet); - } - return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet); + return Json(Models.DeviceModel.ComponentModel.FromDeviceComponent(dc)); } [DiscoAuthorize(Claims.Config.DeviceModel.ConfigureComponents)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult ComponentRemove(int id) { - var dc = Database.DeviceComponents.Include("JobSubTypes").Where(c => c.Id == id).FirstOrDefault(); - if (dc != null) - { - dc.JobSubTypes.Clear(); - Database.DeviceComponents.Remove(dc); - Database.SaveChanges(); - return Json("OK", JsonRequestBehavior.AllowGet); - } - return Json("Invalid Device Component Id", JsonRequestBehavior.AllowGet); + var dc = Database.DeviceComponents.Include(c => c.JobSubTypes).Where(c => c.Id == id).FirstOrDefault(); + if (dc == null) + return BadRequest("Invalid Device Component Id"); + + dc.JobSubTypes.Clear(); + Database.DeviceComponents.Remove(dc); + Database.SaveChanges(); + return Ok(); } #endregion #region Index - [DiscoAuthorize(Claims.Config.DeviceModel.Show)] + [DiscoAuthorizeAny(Claims.Config.DeviceModel.Show, Claims.Config.Enrolment.ShowStatus)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Index() { - var deviceModels = Database.DeviceModels.ToArray().Select(dm => Models.DeviceModel._DeviceModel.FromDeviceModel(dm)).ToArray(); - return Json(deviceModels, JsonRequestBehavior.AllowGet); + var deviceModels = Database.DeviceModels.AsEnumerable().Select(dm => Models.DeviceModel._DeviceModel.FromDeviceModel(dm)).ToList(); + return Json(deviceModels); } #endregion diff --git a/Disco.Web/Areas/API/Controllers/DeviceProfileController.cs b/Disco.Web/Areas/API/Controllers/DeviceProfileController.cs index 60f624c1..2481d268 100644 --- a/Disco.Web/Areas/API/Controllers/DeviceProfileController.cs +++ b/Disco.Web/Areas/API/Controllers/DeviceProfileController.cs @@ -40,6 +40,7 @@ namespace Disco.Web.Areas.API.Controllers const string pAssignedUsersLinkedGroup = "assigneduserslinkedgroup"; [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null) { Authorization.Require(Claims.Config.DeviceProfile.Configure); @@ -114,62 +115,70 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.DeviceProfile.Index(deviceProfile.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #region Update Shortcut Methods [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null) { return Update(id, pDescription, Description, redirect); } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateName(int id, string ProfileName = null, bool? redirect = null) { return Update(id, pName, ProfileName, redirect); } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateShortName(int id, string ShortName = null, bool? redirect = null) { return Update(id, pShortName, ShortName, redirect); } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDistributionType(int id, string DistributionType = null, bool? redirect = null) { return Update(id, pDistributionType, DistributionType, redirect); } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] - public virtual ActionResult UpdateCertificateProviders(int id, string CertificateProviders = null, bool? redirect = null) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult UpdateCertificateProviders(int id, string certificateProviders = null, bool? redirect = null) { - return Update(id, pCertificateProviders, CertificateProviders, redirect); + return Update(id, pCertificateProviders, certificateProviders, redirect); } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] - public virtual ActionResult UpdateCertificateAuthorityProviders(int id, string CertificateAuthorityProviders = null, bool? redirect = null) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult UpdateCertificateAuthorityProviders(int id, string certificateAuthorityProviders = null, bool? redirect = null) { - return Update(id, pCertificateAuthorityProviders, CertificateAuthorityProviders, redirect); + return Update(id, pCertificateAuthorityProviders, certificateAuthorityProviders, redirect); } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] - public virtual ActionResult UpdateWirelessProfileProviders(int id, string WirelessProfileProviders = null, bool? redirect = null) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult UpdateWirelessProfileProviders(int id, string wirelessProfileProviders = null, bool? redirect = null) { - return Update(id, pWirelessProfileProviders, WirelessProfileProviders, redirect); + return Update(id, pWirelessProfileProviders, wirelessProfileProviders, redirect); } - [DiscoAuthorize(Claims.Config.DeviceProfile.Configure), HttpPost, ValidateAntiForgeryToken] + [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateOrganisationalUnit(int id, string OrganisationalUnit = null, bool enforce = false, bool? redirect = null) { var updateResult = Update(id, pOrganisationalUnit, OrganisationalUnit, redirect); @@ -187,13 +196,14 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDefaultOrganisationAddress(int id, string DefaultOrganisationAddress = null, bool? redirect = null) { return Update(id, pDefaultOrganisationAddress, DefaultOrganisationAddress, redirect); } [DiscoAuthorizeAll(Claims.Config.DeviceProfile.Configure, Claims.Config.DeviceProfile.ConfigureComputerNameTemplate)] - [ValidateAntiForgeryToken] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateComputerNameTemplate(int id, string ComputerNameTemplate = null, bool? redirect = null) { var deviceProfile = Database.DeviceProfiles.Find(id); @@ -219,11 +229,11 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.GetValueOrDefault(false)) return RedirectToAction(MVC.Config.DeviceProfile.Index(deviceProfile.Id)); else - return Json("OK"); + return Ok(); } [DiscoAuthorizeAll(Claims.Config.DeviceProfile.Configure, Claims.Config.DeviceProfile.ConfigureComputerNameTemplate)] - [ValidateAntiForgeryToken] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult TestComputerNameTemplate(int id, string ComputerNameTemplate = null, string UserSpecifiedDeviceSerialNumber = null) { Database.Configuration.LazyLoadingEnabled = true; @@ -317,36 +327,42 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateEnforceComputerNameConvention(int id, string EnforceComputerNameConvention = null, bool? redirect = null) { return Update(id, pEnforceComputerNameConvention, EnforceComputerNameConvention, redirect); } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateEnforceOrganisationalUnit(int id, string EnforceOrganisationalUnit = null, bool? redirect = null) { return Update(id, pEnforceOrganisationalUnit, EnforceOrganisationalUnit, redirect); } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateProvisionADAccount(int id, string ProvisionADAccount = null, bool? redirect = null) { return Update(id, pProvisionADAccount, ProvisionADAccount, redirect); } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateAssignedUserLocalAdmin(int id, string AssignedUserLocalAdmin = null, bool? redirect = null) { return Update(id, pAssignedUserLocalAdmin, AssignedUserLocalAdmin, redirect); } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateAllowUntrustedReimageJobEnrolment(int id, string AllowUntrustedReimageJobEnrolment = null, bool? redirect = null) { return Update(id, pAllowUntrustedReimageJobEnrolment, AllowUntrustedReimageJobEnrolment, redirect); } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDevicesLinkedGroup(int id, string GroupId = null, bool redirect = false) { try @@ -368,17 +384,18 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId)); } else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateAssignedUsersLinkedGroup(int id, string GroupId = null, bool redirect = false) { try @@ -400,49 +417,49 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId)); } else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #endregion #region Update Properties - private void UpdateDescription(DeviceProfile deviceProfile, string Description) + private void UpdateDescription(DeviceProfile deviceProfile, string description) { - if (string.IsNullOrWhiteSpace(Description)) + if (string.IsNullOrWhiteSpace(description)) deviceProfile.Description = null; else - deviceProfile.Description = Description; + deviceProfile.Description = description; Database.SaveChanges(); } - private void UpdateName(DeviceProfile deviceProfile, string Name) + private void UpdateName(DeviceProfile deviceProfile, string name) { - if (string.IsNullOrWhiteSpace(Name)) + if (string.IsNullOrWhiteSpace(name)) throw new Exception("Profile name cannot be empty"); else - deviceProfile.Name = Name; + deviceProfile.Name = name; Database.SaveChanges(); } - private void UpdateShortName(DeviceProfile deviceProfile, string ShortName) + private void UpdateShortName(DeviceProfile deviceProfile, string shortName) { - if (string.IsNullOrWhiteSpace(ShortName)) + if (string.IsNullOrWhiteSpace(shortName)) throw new Exception("Profile short name cannot be empty"); else - deviceProfile.ShortName = ShortName; + deviceProfile.ShortName = shortName; Database.SaveChanges(); } - private void UpdateDistributionType(DeviceProfile deviceProfile, string DistributionType) + private void UpdateDistributionType(DeviceProfile deviceProfile, string distributionType) { - if (int.TryParse(DistributionType, out var iDt)) + if (int.TryParse(distributionType, out var iDt)) { deviceProfile.DistributionType = (DeviceProfile.DistributionTypes)iDt; Database.SaveChanges(); @@ -451,9 +468,9 @@ namespace Disco.Web.Areas.API.Controllers throw new Exception("Invalid Distribution Type Number"); } - private void UpdateCertificateProviders(DeviceProfile deviceProfile, string CertificateProviderIds) + private void UpdateCertificateProviders(DeviceProfile deviceProfile, string certificateProviderIds) { - if (string.IsNullOrWhiteSpace(CertificateProviderIds)) + if (string.IsNullOrWhiteSpace(certificateProviderIds)) { deviceProfile.CertificateProviders = null; } @@ -461,7 +478,7 @@ namespace Disco.Web.Areas.API.Controllers { // Validate var validatedProviders = new List(); - foreach (var certificateProviderId in CertificateProviderIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + foreach (var certificateProviderId in certificateProviderIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { var featureManifest = Plugins.GetPluginFeature(certificateProviderId, typeof(CertificateProviderFeature)); if (featureManifest == null) @@ -487,9 +504,9 @@ namespace Disco.Web.Areas.API.Controllers Database.SaveChanges(); } - private void UpdateCertificateAuthorityProviders(DeviceProfile deviceProfile, string CertificateAuthorityProviderIds) + private void UpdateCertificateAuthorityProviders(DeviceProfile deviceProfile, string certificateAuthorityProviderIds) { - if (string.IsNullOrWhiteSpace(CertificateAuthorityProviderIds)) + if (string.IsNullOrWhiteSpace(certificateAuthorityProviderIds)) { deviceProfile.CertificateAuthorityProviders = null; } @@ -497,7 +514,7 @@ namespace Disco.Web.Areas.API.Controllers { // Validate var validatedProviders = new List(); - foreach (var certificateAuthorityProviderId in CertificateAuthorityProviderIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + foreach (var certificateAuthorityProviderId in certificateAuthorityProviderIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { var featureManifest = Plugins.GetPluginFeature(certificateAuthorityProviderId, typeof(CertificateAuthorityProviderFeature)); if (featureManifest == null) @@ -523,9 +540,9 @@ namespace Disco.Web.Areas.API.Controllers Database.SaveChanges(); } - private void UpdateWirelessProfileProviders(DeviceProfile deviceProfile, string WirelessProfileProviderIds) + private void UpdateWirelessProfileProviders(DeviceProfile deviceProfile, string wirelessProfileProviderIds) { - if (string.IsNullOrWhiteSpace(WirelessProfileProviderIds)) + if (string.IsNullOrWhiteSpace(wirelessProfileProviderIds)) { deviceProfile.WirelessProfileProviders = null; } @@ -533,7 +550,7 @@ namespace Disco.Web.Areas.API.Controllers { // Validate var validatedProviders = new List(); - foreach (var wirelessProfileProviderId in WirelessProfileProviderIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + foreach (var wirelessProfileProviderId in wirelessProfileProviderIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { var featureManifest = Plugins.GetPluginFeature(wirelessProfileProviderId, typeof(WirelessProfileProviderFeature)); if (featureManifest == null) @@ -559,28 +576,28 @@ namespace Disco.Web.Areas.API.Controllers Database.SaveChanges(); } - private void UpdateOrganisationalUnit(DeviceProfile deviceProfile, string OrganisationalUnit) + private void UpdateOrganisationalUnit(DeviceProfile deviceProfile, string organisationalUnit) { - if (string.IsNullOrWhiteSpace(OrganisationalUnit)) - OrganisationalUnit = ActiveDirectory.Context.PrimaryDomain.DefaultComputerContainer; + if (string.IsNullOrWhiteSpace(organisationalUnit)) + organisationalUnit = ActiveDirectory.Context.PrimaryDomain.DefaultComputerContainer; - if (OrganisationalUnit != deviceProfile.OrganisationalUnit) + if (organisationalUnit != deviceProfile.OrganisationalUnit) { - deviceProfile.OrganisationalUnit = OrganisationalUnit; + deviceProfile.OrganisationalUnit = organisationalUnit; Database.SaveChanges(); } } - private void UpdateDefaultOrganisationAddress(DeviceProfile deviceProfile, string DefaultOrganisationAddress) + private void UpdateDefaultOrganisationAddress(DeviceProfile deviceProfile, string defaultOrganisationAddress) { - if (string.IsNullOrEmpty(DefaultOrganisationAddress)) + if (string.IsNullOrEmpty(defaultOrganisationAddress)) { deviceProfile.DefaultOrganisationAddress = null; } else { // Validate - if (int.TryParse(DefaultOrganisationAddress, out var daoId)) + if (int.TryParse(defaultOrganisationAddress, out var daoId)) { var oa = Database.DiscoConfiguration.OrganisationAddresses.GetAddress(daoId); if (oa != null) @@ -602,9 +619,9 @@ namespace Disco.Web.Areas.API.Controllers Database.SaveChanges(); } - private void UpdateEnforceComputerNameConvention(DeviceProfile deviceProfile, string EnforceComputerNameConvention) + private void UpdateEnforceComputerNameConvention(DeviceProfile deviceProfile, string enforceComputerNameConvention) { - if (bool.TryParse(EnforceComputerNameConvention, out var bValue)) + if (bool.TryParse(enforceComputerNameConvention, out var bValue)) { deviceProfile.EnforceComputerNameConvention = bValue; @@ -614,9 +631,9 @@ namespace Disco.Web.Areas.API.Controllers throw new Exception("Invalid Boolean Value"); } - private void UpdateEnforceOrganisationalUnit(DeviceProfile deviceProfile, string EnforceOrganisationalUnit) + private void UpdateEnforceOrganisationalUnit(DeviceProfile deviceProfile, string enforceOrganisationalUnit) { - if (bool.TryParse(EnforceOrganisationalUnit, out var bValue)) + if (bool.TryParse(enforceOrganisationalUnit, out var bValue)) { deviceProfile.EnforceOrganisationalUnit = bValue; @@ -626,9 +643,9 @@ namespace Disco.Web.Areas.API.Controllers throw new Exception("Invalid Boolean Value"); } - private void UpdateProvisionADAccount(DeviceProfile deviceProfile, string ProvisionADAccount) + private void UpdateProvisionADAccount(DeviceProfile deviceProfile, string provisionADAccount) { - if (bool.TryParse(ProvisionADAccount, out var bValue)) + if (bool.TryParse(provisionADAccount, out var bValue)) { deviceProfile.ProvisionADAccount = bValue; @@ -638,9 +655,9 @@ namespace Disco.Web.Areas.API.Controllers throw new Exception("Invalid Boolean Value"); } - private void UpdateAssignedUserLocalAdmin(DeviceProfile deviceProfile, string AssignedUserLocalAdmin) + private void UpdateAssignedUserLocalAdmin(DeviceProfile deviceProfile, string assignedUserLocalAdmin) { - if (bool.TryParse(AssignedUserLocalAdmin, out var bValue)) + if (bool.TryParse(assignedUserLocalAdmin, out var bValue)) { deviceProfile.AssignedUserLocalAdmin = bValue; @@ -650,9 +667,9 @@ namespace Disco.Web.Areas.API.Controllers throw new Exception("Invalid Boolean Value"); } - private void UpdateAllowUntrustedReimageJobEnrolment(DeviceProfile deviceProfile, string AllowUntrustedReimageJobEnrolment) + private void UpdateAllowUntrustedReimageJobEnrolment(DeviceProfile deviceProfile, string allowUntrustedReimageJobEnrolment) { - if (bool.TryParse(AllowUntrustedReimageJobEnrolment, out var bValue)) + if (bool.TryParse(allowUntrustedReimageJobEnrolment, out var bValue)) { deviceProfile.AllowUntrustedReimageJobEnrolment = bValue; @@ -662,16 +679,16 @@ namespace Disco.Web.Areas.API.Controllers throw new Exception("Invalid Boolean Value"); } - private ScheduledTaskStatus UpdateDevicesLinkedGroup(DeviceProfile DeviceProfile, string DevicesLinkedGroup) + private ScheduledTaskStatus UpdateDevicesLinkedGroup(DeviceProfile deviceProfile, string devicesLinkedGroup) { - var configJson = ADManagedGroup.ValidConfigurationToJson(DeviceProfileDevicesManagedGroup.GetKey(DeviceProfile), DevicesLinkedGroup, null); + var configJson = ADManagedGroup.ValidConfigurationToJson(DeviceProfileDevicesManagedGroup.GetKey(deviceProfile), devicesLinkedGroup, null); - if (DeviceProfile.DevicesLinkedGroup != configJson) + if (deviceProfile.DevicesLinkedGroup != configJson) { - DeviceProfile.DevicesLinkedGroup = configJson; + deviceProfile.DevicesLinkedGroup = configJson; Database.SaveChanges(); - var managedGroup = DeviceProfileDevicesManagedGroup.Initialize(DeviceProfile); + var managedGroup = DeviceProfileDevicesManagedGroup.Initialize(deviceProfile); if (managedGroup != null) // Sync Group return ADManagedGroupsSyncTask.ScheduleSync(managedGroup); } @@ -679,16 +696,16 @@ namespace Disco.Web.Areas.API.Controllers return null; } - private ScheduledTaskStatus UpdateAssignedUsersLinkedGroup(DeviceProfile DeviceProfile, string AssignedUsersLinkedGroup) + private ScheduledTaskStatus UpdateAssignedUsersLinkedGroup(DeviceProfile deviceProfile, string assignedUsersLinkedGroup) { - var configJson = ADManagedGroup.ValidConfigurationToJson(DeviceProfileAssignedUsersManagedGroup.GetKey(DeviceProfile), AssignedUsersLinkedGroup, null); + var configJson = ADManagedGroup.ValidConfigurationToJson(DeviceProfileAssignedUsersManagedGroup.GetKey(deviceProfile), assignedUsersLinkedGroup, null); - if (DeviceProfile.AssignedUsersLinkedGroup != configJson) + if (deviceProfile.AssignedUsersLinkedGroup != configJson) { - DeviceProfile.AssignedUsersLinkedGroup = configJson; + deviceProfile.AssignedUsersLinkedGroup = configJson; Database.SaveChanges(); - var managedGroup = DeviceProfileAssignedUsersManagedGroup.Initialize(DeviceProfile); + var managedGroup = DeviceProfileAssignedUsersManagedGroup.Initialize(deviceProfile); if (managedGroup != null) // Sync Group return ADManagedGroupsSyncTask.ScheduleSync(managedGroup); } @@ -700,6 +717,7 @@ namespace Disco.Web.Areas.API.Controllers #region Actions [DiscoAuthorize(Claims.Config.DeviceProfile.Delete)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Delete(int id, bool? redirect = false) { try @@ -712,7 +730,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.DeviceProfile.Index(null)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } throw new Exception("Invalid Device Profile Number"); } @@ -721,7 +739,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } @@ -730,6 +748,7 @@ namespace Disco.Web.Areas.API.Controllers #region Defaults [DiscoAuthorize(Claims.Config.DeviceProfile.ConfigureDefaults)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Default(int id, bool? redirect = null) { try @@ -742,7 +761,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.DeviceProfile.Index(id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } throw new Exception("Invalid Device Profile Number"); } @@ -751,11 +770,12 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Config.DeviceProfile.ConfigureDefaults)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult DefaultAddDeviceOffline(int id, bool? redirect = false) { try @@ -778,14 +798,14 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.DeviceProfile.Index(id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } diff --git a/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs b/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs index 10ed502a..55c7eef6 100644 --- a/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs +++ b/Disco.Web/Areas/API/Controllers/DocumentTemplateController.cs @@ -21,7 +21,7 @@ using System.ComponentModel.DataAnnotations; using System.Data.Entity; using System.IO; using System.Linq; -using System.Net; +using System.Text.RegularExpressions; using System.Web; using System.Web.Mvc; using System.Web.UI.WebControls; @@ -40,6 +40,7 @@ namespace Disco.Web.Areas.API.Controllers const string pIsHidden = "ishidden"; [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false) { try @@ -97,18 +98,19 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(resultTask.SessionId)); } else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } - [DiscoAuthorize(Claims.Config.DocumentTemplate.Upload), HttpGet] + [DiscoAuthorize(Claims.Config.DocumentTemplate.Upload)] + [HttpGet] public virtual ActionResult Template(string id) { if (string.IsNullOrEmpty(id)) @@ -128,7 +130,8 @@ namespace Disco.Web.Areas.API.Controllers } } - [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Upload, Claims.Config.DocumentTemplate.Configure), HttpPost] + [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Upload, Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Template(string id, bool redirect, HttpPostedFileBase Template) { try @@ -144,18 +147,19 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.DocumentTemplate.Index(documentTemplate.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } - [DiscoAuthorize(Claims.Config.DocumentTemplate.Show), HttpGet] + [DiscoAuthorize(Claims.Config.DocumentTemplate.Show)] + [HttpGet] public virtual ActionResult TemplatePreview(string id) { if (string.IsNullOrEmpty(id)) @@ -180,41 +184,49 @@ namespace Disco.Web.Areas.API.Controllers #region Update Shortcut Methods [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDescription(string id, string Description = null, bool redirect = false) { return Update(id, pDescription, Description, redirect); } [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateFilterExpression(string id, string FilterExpression = null, bool redirect = false) { return Update(id, pFilterExpression, FilterExpression, redirect); } [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateOnGenerateExpression(string id, string OnGenerateExpression = null, bool redirect = false) { return Update(id, pOnGenerateExpression, OnGenerateExpression, redirect); } [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateOnImportAttachmentExpression(string id, string OnImportAttachmentExpression = null, bool redirect = false) { return Update(id, pOnImportAttachmentExpression, OnImportAttachmentExpression, redirect); } [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateFlattenForm(string id, string FlattenForm = null, bool redirect = false) { return Update(id, pFlattenForm, FlattenForm, redirect); } [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateIsHidden(string id, string IsHidden = null, bool redirect = false) { return Update(id, pIsHidden, IsHidden, redirect); } [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateScope(string id, string Scope = null, bool redirect = false) { return Update(id, pScope, Scope, redirect); } [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateJobSubTypes(string id, List JobSubTypes = null, bool redirect = false) { try @@ -228,19 +240,20 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.DocumentTemplate.Index(documentTemplate.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDevicesLinkedGroup(string id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false) { try @@ -262,18 +275,19 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId)); } else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateUsersLinkedGroup(string id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false) { try @@ -295,14 +309,14 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId)); } else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #endregion @@ -493,7 +507,7 @@ namespace Disco.Web.Areas.API.Controllers #region Actions [DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages), OutputCache(NoStore = true, Duration = 0)] - public virtual ActionResult ImporterThumbnail(string SessionId, int PageNumber) + public virtual ActionResult ImporterThumbnail(Guid SessionId, int PageNumber) { var dataStoreSessionPagesCacheLocation = DataStore.CreateLocation(Database, "Cache\\DocumentDropBox_SessionPages"); var filename = Path.Combine(dataStoreSessionPagesCacheLocation, $"{SessionId}-{PageNumber}"); @@ -504,6 +518,7 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult ImporterUndetectedFiles() { var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned"); @@ -577,47 +592,51 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)] + [HttpGet] public virtual ActionResult ImporterUndetectedFile(string id, bool? Source, bool? Thumbnail) { - if (!string.IsNullOrEmpty(id)) + if (!Regex.IsMatch(id, @"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}_\d+$")) + return BadRequest("Invalid page identifier"); + + var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned"); + if (Source.HasValue && Source.Value) { - var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned"); - if (Source.HasValue && Source.Value) + var filename = Path.Combine(undetectedLocation, $"{id}.pdf"); + if (System.IO.File.Exists(filename)) + return File(filename, DocumentTemplate.PdfMimeType); + else + return HttpNotFound(); + } + else + { + if (Thumbnail.HasValue && Thumbnail.Value) { - var filename = Path.Combine(undetectedLocation, string.Concat(id, ".pdf")); + var filename = Path.Combine(undetectedLocation, $"{id}_thumbnail.png"); if (System.IO.File.Exists(filename)) - return File(filename, DocumentTemplate.PdfMimeType); + return File(filename, "image/png"); else - return HttpNotFound(); + return File(Links.ClientSource.Style.Images.Status.fileBroken256_png, "image/png"); } else { - if (Thumbnail.HasValue && Thumbnail.Value) - { - var filename = Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png")); - if (System.IO.File.Exists(filename)) - return File(filename, "image/png"); - else - return File(Links.ClientSource.Style.Images.Status.fileBroken256_png, "image/png"); - } + var filename = Path.Combine(undetectedLocation, $"{id}.jpg"); + if (System.IO.File.Exists(filename)) + return File(filename, "image/jpeg"); else - { - var filename = Path.Combine(undetectedLocation, string.Concat(id, ".jpg")); - if (System.IO.File.Exists(filename)) - return File(filename, "image/jpeg"); - else - return File(Links.ClientSource.Style.Images.Status.fileBroken256_png, "image/png"); - } + return File(Links.ClientSource.Style.Images.Status.fileBroken256_png, "image/png"); } } - return HttpNotFound(); } [DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult ImporterUndetectedAssign(string id, string DocumentTemplateId, string DataId) { + if (!Regex.IsMatch(id, @"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}_\d+$")) + return BadRequest("Invalid page identifier"); + var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned"); - var filename = Path.Combine(undetectedLocation, string.Concat(id, ".pdf")); + var filename = Path.Combine(undetectedLocation, $"{id}.pdf"); var identifier = DocumentUniqueIdentifier.Create(Database, DocumentTemplateId, DataId, UserService.CurrentUser.UserId, DateTime.Now, 0); if (Disco.Services.Documents.AttachmentImport.Importer.ImportPdfAttachment(identifier, Database, filename) != null) @@ -626,48 +645,53 @@ namespace Disco.Web.Areas.API.Controllers System.IO.File.Delete(filename); // Delete Thumbnail/Preview - var thumbnailFilename = Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png")); + var thumbnailFilename = Path.Combine(undetectedLocation, $"{id}_thumbnail.png"); if (System.IO.File.Exists(thumbnailFilename)) System.IO.File.Delete(thumbnailFilename); - var previewFilename = Path.Combine(undetectedLocation, string.Concat(id, ".jpg")); + var previewFilename = Path.Combine(undetectedLocation, $"{id}.jpg"); if (System.IO.File.Exists(previewFilename)) System.IO.File.Delete(previewFilename); - return Json("OK"); + return Ok(); } else { - return Json("Unable to Import File with the supplied parameters"); + return BadRequest("Unable to Import File with the supplied parameters"); } } [DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult ImporterUndetectedDelete(string id) { + if (!Regex.IsMatch(id, @"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}_\d+$")) + return BadRequest("Invalid page identifier"); + var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned"); - var filename = Path.Combine(undetectedLocation, string.Concat(id, ".pdf")); + var filename = Path.Combine(undetectedLocation, $"{id}.pdf"); if (System.IO.File.Exists(filename)) { // Delete File System.IO.File.Delete(filename); // Delete Thumbnail/Preview - var thumbnailFilename = Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png")); + var thumbnailFilename = Path.Combine(undetectedLocation, $"{id}_thumbnail.png"); if (System.IO.File.Exists(thumbnailFilename)) System.IO.File.Delete(thumbnailFilename); - var previewFilename = Path.Combine(undetectedLocation, string.Concat(id, ".jpg")); + var previewFilename = Path.Combine(undetectedLocation, $"{id}.jpg"); if (System.IO.File.Exists(previewFilename)) System.IO.File.Delete(previewFilename); - return Json("OK"); + return Ok(); } else { - return Json("File Not Found"); + return BadRequest("File Not Found"); } } [DiscoAuthorizeAll(Claims.Config.DeviceModel.Show, Claims.Config.DocumentTemplate.BulkGenerate)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult BulkGenerateDeviceModel(string id, int deviceGroupId) { var template = Database.DocumentTemplates.FirstOrDefault(t => t.Id == id); @@ -701,6 +725,7 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorizeAll(Claims.Config.DeviceProfile.Show, Claims.Config.DocumentTemplate.BulkGenerate)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult BulkGenerateDeviceProfile(string id, int deviceGroupId) { var template = Database.DocumentTemplates.FirstOrDefault(t => t.Id == id); @@ -734,6 +759,7 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorizeAll(Claims.Config.DeviceBatch.Show, Claims.Config.DocumentTemplate.BulkGenerate)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult BulkGenerateDeviceBatch(string id, int deviceGroupId) { var template = Database.DocumentTemplates.FirstOrDefault(t => t.Id == id); @@ -767,11 +793,12 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.Config.DocumentTemplate.BulkGenerate)] - public virtual ActionResult BulkGenerate(string id, string DataIds = null, bool InsertBlankPage = false) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult BulkGenerate(string id, string dataIds = null, bool insertBlankPage = false) { if (string.IsNullOrEmpty(id)) throw new ArgumentNullException("id"); - if (string.IsNullOrEmpty(DataIds)) + if (string.IsNullOrEmpty(dataIds)) throw new ArgumentNullException("DataIds"); var documentTemplate = Database.DocumentTemplates.Find(id); if (documentTemplate == null) @@ -792,35 +819,34 @@ namespace Disco.Web.Areas.API.Controllers throw new InvalidOperationException("Unknown DocumentType Scope"); } - var dataIds = DataIds.Split(new string[] { Environment.NewLine, ",", ";" }, StringSplitOptions.RemoveEmptyEntries).Select(d => d.Trim()).Where(d => !string.IsNullOrEmpty(d)).ToList(); + var ids = dataIds.Split(new string[] { Environment.NewLine, ",", ";" }, StringSplitOptions.RemoveEmptyEntries).Select(d => d.Trim()).Where(d => !string.IsNullOrEmpty(d)).ToList(); var timeStamp = DateTime.Now; - var taskStatus = DocumentBulkGenerateTask.ScheduleNow(BI.Interop.Pdf.PdfGenerator.GenerateBulkFromTemplate, documentTemplate, UserService.CurrentUser, timeStamp, InsertBlankPage, dataIds); + var taskStatus = DocumentBulkGenerateTask.ScheduleNow(BI.Interop.Pdf.PdfGenerator.GenerateBulkFromTemplate, documentTemplate, UserService.CurrentUser, timeStamp, insertBlankPage, ids); var fileName = $"{documentTemplate.Id}_Bulk_{timeStamp:yyyyMMdd-HHmmss}.pdf"; - taskStatus.SetFinishedUrl(Url.Action(MVC.Config.DocumentTemplate.Index(documentTemplate.Id, taskStatus.SessionId, fileName))); + taskStatus.SetFinishedUrl(Url.Action(MVC.Config.DocumentTemplate.Index(documentTemplate.Id, Guid.Parse(taskStatus.SessionId), fileName))); if (!taskStatus.WaitUntilFinished(TimeSpan.FromSeconds(1))) return RedirectToAction(MVC.Config.Logging.TaskStatus(taskStatus.SessionId)); - var stream = DocumentBulkGenerateTask.GetCached(Database, taskStatus.SessionId); + var stream = DocumentBulkGenerateTask.GetCached(Database, Guid.Parse(taskStatus.SessionId)); return File(stream, "application/pdf", fileName); } [DiscoAuthorize(Claims.Config.DocumentTemplate.BulkGenerate)] - public virtual ActionResult BulkGenerateDownload(string id, string fileName) + public virtual ActionResult BulkGenerateDownload(Guid id, string fileName) { var stream = DocumentBulkGenerateTask.GetCached(Database, id); return File(stream, "application/pdf", fileName); } - [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.BulkGenerate, Claims.User.Actions.GenerateDocuments)] [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult BulkGenerateAddUsers(string userIds) { if (string.IsNullOrWhiteSpace(userIds)) - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); + return BadRequest(); var dataIds = userIds.Split(new string[] { Environment.NewLine, ",", ";" }, StringSplitOptions.RemoveEmptyEntries).Select(d => d.Trim()).Where(d => !string.IsNullOrEmpty(d)).ToList(); var results = new List(dataIds.Count); @@ -893,7 +919,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateAddGroupMembers(string groupId) { if (string.IsNullOrWhiteSpace(groupId)) - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); + return BadRequest(); var results = new List(); var accountId = ActiveDirectory.ParseDomainAccountId(groupId); @@ -954,7 +980,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateAddUserFlag(int flagId) { if (flagId <= 0) - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); + return BadRequest(); var results = new List(); @@ -1008,7 +1034,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateAddDeviceProfile(int deviceProfileId) { if (deviceProfileId <= 0) - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); + return BadRequest(); var results = new List(); @@ -1062,7 +1088,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateAddDeviceBatch(int deviceBatchId) { if (deviceBatchId <= 0) - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); + return BadRequest(); var results = new List(); @@ -1116,7 +1142,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateAddDocumentAttachment(string documentTemplateId, DateTime? threshold) { if (string.IsNullOrWhiteSpace(documentTemplateId)) - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); + return BadRequest(); var results = new List(); @@ -1229,7 +1255,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateGetUserDetailValues(string key) { if (string.IsNullOrWhiteSpace(key)) - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); + return BadRequest(); var results = Database.UserDetails.Where(d => d.Scope == "Details" && d.Key == key).Select(d => d.Value).Distinct().ToList(); @@ -1241,7 +1267,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult BulkGenerateAddUserDetail(string key, string value) { if (string.IsNullOrWhiteSpace(key)) - return new HttpStatusCodeResult(HttpStatusCode.BadRequest); + return BadRequest(); var results = new List(); @@ -1279,9 +1305,10 @@ namespace Disco.Web.Areas.API.Controllers return Json(results); } - public virtual ActionResult Generate(string id, string TargetId) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult Generate(string id, string targetId) { - Disco.Services.DocumentTemplateExtensions.GetTemplateAndTarget(Database, Authorization, id, TargetId, out var template, out var target, out _); + Disco.Services.DocumentTemplateExtensions.GetTemplateAndTarget(Database, Authorization, id, targetId, out var template, out var target, out _); // generate document var timestamp = DateTime.Now; @@ -1296,6 +1323,7 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.Config.DocumentTemplate.Delete)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Delete(string id, bool? redirect = false) { try @@ -1308,7 +1336,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.DocumentTemplate.Index(null)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } throw new Exception("Invalid Document Template Id"); } @@ -1317,12 +1345,12 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } - [HttpPost, ValidateAntiForgeryToken] [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.UserFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult RemoveOnImportUserFlagRule([Required] string id, Guid? ruleId = null) { try @@ -1334,16 +1362,16 @@ namespace Disco.Web.Areas.API.Controllers template.RemoveOnImportUserFlagRule(Database, ruleId.Value); - return new HttpStatusCodeResult(HttpStatusCode.OK); + return Ok(); } catch (Exception ex) { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest, ex.Message); + return BadRequest(ex.Message); } } - [HttpPost, ValidateAntiForgeryToken] [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.UserFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult AddOnImportUserFlagRule([Required] string id, bool? addFlag = null, int? userFlagId = null, string comments = null) { try @@ -1379,14 +1407,14 @@ namespace Disco.Web.Areas.API.Controllers } catch (Exception ex) { - return new HttpStatusCodeResult(HttpStatusCode.BadRequest, ex.Message); + return BadRequest(ex.Message); } } #endregion #region Handlers - [HttpPost] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult GenerateDocumentHandlerUi(string templateId, string targetId, string handlerId) { Disco.Services.DocumentTemplateExtensions.GetTemplateAndTarget(Database, Authorization, templateId, targetId, out var template, out var target, out var targetUser); @@ -1403,15 +1431,13 @@ namespace Disco.Web.Areas.API.Controllers if (handlerPartialView == null) throw new NotSupportedException("Handler does not have a Generation Options UI"); - - var model = handler.GetGenerationOptionsUiModel(template, target, targetUser, CurrentUser); return this.PrecompiledPartialView(handlerPartialView, model); } } - [HttpPost] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult DocumentHandlers(string templateId, string targetId) { Disco.Services.DocumentTemplateExtensions.GetTemplateAndTarget(Database, Authorization, templateId, targetId, out var template, out var target, out _); diff --git a/Disco.Web/Areas/API/Controllers/DocumentTemplatePackageController.cs b/Disco.Web/Areas/API/Controllers/DocumentTemplatePackageController.cs index c2a60768..5445358e 100644 --- a/Disco.Web/Areas/API/Controllers/DocumentTemplatePackageController.cs +++ b/Disco.Web/Areas/API/Controllers/DocumentTemplatePackageController.cs @@ -24,6 +24,7 @@ namespace Disco.Web.Areas.API.Controllers const string pInsertBlankPages = "insertblankpages"; [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false) { try @@ -69,24 +70,26 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.DocumentTemplate.ShowPackage(package.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #region Update Shortcut Methods [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDescription(string id, string Description = null, bool redirect = false) { return Update(id, pDescription, Description, redirect); } [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDocumentTemplates(string id, List DocumentTemplates = null, bool redirect = false) { try @@ -104,43 +107,49 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.DocumentTemplate.ShowPackage(package.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateFilterExpression(string id, string FilterExpression = null, bool redirect = false) { return Update(id, pFilterExpression, FilterExpression, redirect); } [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateOnGenerateExpression(string id, string OnGenerateExpression = null, bool redirect = false) { return Update(id, pOnGenerateExpression, OnGenerateExpression, redirect); } [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateIsHidden(string id, string IsHidden = null, bool redirect = false) { return Update(id, pIsHidden, IsHidden, redirect); } [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsertBlankPages(string id, string InsertBlankPages = null, bool redirect = false) { return Update(id, pInsertBlankPages, InsertBlankPages, redirect); } [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateScope(string id, string Scope = null, bool redirect = false) { return Update(id, pScope, Scope, redirect); } [DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateJobSubTypes(string id, List JobSubTypes = null, bool redirect = false) { try @@ -158,32 +167,31 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.DocumentTemplate.ShowPackage(package.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #endregion #region Update Properties - private void UpdateDescription(DocumentTemplatePackage Package, string Description) + private void UpdateDescription(DocumentTemplatePackage Package, string description) { - if (!string.IsNullOrWhiteSpace(Description)) + if (string.IsNullOrWhiteSpace(description)) + throw new Exception("Invalid Description"); + + description = description.Trim(); + if (Package.Description != description) { - var description = Description.Trim(); - if (Package.Description != description) - { - Package.Description = description; - DocumentTemplatePackages.UpdatePackage(Package); - } + Package.Description = description; + DocumentTemplatePackages.UpdatePackage(Package); } - throw new Exception("Invalid Description"); } private void UpdateDocumentTemplates(DocumentTemplatePackage Package, List DocumentTemplates) { @@ -349,12 +357,13 @@ namespace Disco.Web.Areas.API.Controllers #region Actions [DiscoAuthorize(Claims.Config.DocumentTemplate.BulkGenerate)] - public virtual ActionResult BulkGenerate(string id, string DataIds = null, bool InsertBlankPage = false) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult BulkGenerate(string id, string dataIds = null) { if (string.IsNullOrEmpty(id)) throw new ArgumentNullException(nameof(id)); - if (string.IsNullOrEmpty(DataIds)) - throw new ArgumentNullException(nameof(DataIds)); + if (string.IsNullOrEmpty(dataIds)) + throw new ArgumentNullException(nameof(dataIds)); var package = DocumentTemplatePackages.GetPackage(id); @@ -376,19 +385,20 @@ namespace Disco.Web.Areas.API.Controllers throw new InvalidOperationException("Unknown DocumentType Scope"); } - var dataIds = DataIds.Split(new string[] { Environment.NewLine, ",", ";" }, StringSplitOptions.RemoveEmptyEntries).Select(d => d.Trim()).Where(d => !string.IsNullOrEmpty(d)).ToList(); + var ids = dataIds.Split(new string[] { Environment.NewLine, ",", ";" }, StringSplitOptions.RemoveEmptyEntries).Select(d => d.Trim()).Where(d => !string.IsNullOrEmpty(d)).ToList(); var timeStamp = DateTime.Now; - var pdf = package.GeneratePdfPackageBulk(Database, UserService.CurrentUser, timeStamp, InsertBlankPage, dataIds); + var pdf = package.GeneratePdfPackageBulk(Database, UserService.CurrentUser, timeStamp, null, ids); return File(pdf, "application/pdf", $"{package.Id}_Bulk_{timeStamp:yyyyMMdd-HHmmss}.pdf"); } - public virtual ActionResult Generate(string id, string TargetId) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult Generate(string id, string targetId) { if (string.IsNullOrWhiteSpace(id)) throw new ArgumentNullException(nameof(id)); - if (string.IsNullOrWhiteSpace(TargetId)) - throw new ArgumentNullException(nameof(TargetId)); + if (string.IsNullOrWhiteSpace(targetId)) + throw new ArgumentNullException(nameof(targetId)); var package = DocumentTemplatePackages.GetPackage(id); if (package == null) @@ -410,9 +420,9 @@ namespace Disco.Web.Areas.API.Controllers } // resolve target - var target = package.ResolveScopeTarget(Database, TargetId); + var target = package.ResolveScopeTarget(Database, targetId); if (target == null) - throw new ArgumentException("Target not found", nameof(TargetId)); + throw new ArgumentException("Target not found", nameof(targetId)); var timestamp = DateTime.Now; var document = default(Stream); @@ -426,6 +436,7 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.Config.DocumentTemplate.Delete)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Delete(string id, bool? redirect = false) { try @@ -445,7 +456,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.DocumentTemplate.Index(null)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } throw new Exception("Invalid Document Template Package Id"); } @@ -454,7 +465,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } diff --git a/Disco.Web/Areas/API/Controllers/EnrolmentController.cs b/Disco.Web/Areas/API/Controllers/EnrolmentController.cs index 066a0798..958b5fc0 100644 --- a/Disco.Web/Areas/API/Controllers/EnrolmentController.cs +++ b/Disco.Web/Areas/API/Controllers/EnrolmentController.cs @@ -8,9 +8,8 @@ namespace Disco.Web.Areas.API.Controllers { public partial class EnrolmentController : AuthorizedDatabaseController { - [HttpPost] - [ValidateAntiForgeryToken] [DiscoAuthorize(Claims.Device.Actions.EnrolDevices)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult ResolveSessionPending(string sessionId, bool approve, int? deviceProfileId, int? deviceBatchId, string reason) { if (approve && deviceProfileId == null) @@ -18,11 +17,11 @@ namespace Disco.Web.Areas.API.Controllers WindowsDeviceEnrolment.ResolvePendingEnrolment(sessionId, approve, CurrentUser.UserId, deviceProfileId, deviceBatchId, reason); - return new HttpStatusCodeResult(200); + return Ok(); } - [HttpPost] [DiscoAuthorize(Claims.Config.Enrolment.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult PendingTimeoutMinutes(int PendingTimeoutMinutes) { try @@ -31,7 +30,7 @@ namespace Disco.Web.Areas.API.Controllers { Database.DiscoConfiguration.Bootstrapper.PendingTimeout = TimeSpan.FromMinutes(PendingTimeoutMinutes); Database.SaveChanges(); - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { @@ -40,7 +39,53 @@ namespace Disco.Web.Areas.API.Controllers } catch (Exception ex) { - return Json($"Error: {ex.Message}"); + return BadRequest(ex.Message); + } + } + + [DiscoAuthorize(Claims.Config.Enrolment.Configure)] + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult MacSshUsername(string MacSshUsername) + { + try + { + if (!string.IsNullOrWhiteSpace(MacSshUsername)) + { + Database.DiscoConfiguration.Bootstrapper.MacSshUsername = MacSshUsername; + Database.SaveChanges(); + return Ok(); + } + else + { + throw new Exception("The Username cannot be null or empty"); + } + } + catch (Exception ex) + { + return BadRequest(ex.Message); + } + } + + [DiscoAuthorize(Claims.Config.Enrolment.Configure)] + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult MacSshPassword(string MacSshPassword) + { + try + { + if (!string.IsNullOrWhiteSpace(MacSshPassword)) + { + Database.DiscoConfiguration.Bootstrapper.MacSshPassword = MacSshPassword; + Database.SaveChanges(); + return Ok(); + } + else + { + throw new Exception("The Password cannot be null or empty"); + } + } + catch (Exception ex) + { + return BadRequest(ex.Message); } } } diff --git a/Disco.Web/Areas/API/Controllers/ExportController.cs b/Disco.Web/Areas/API/Controllers/ExportController.cs index a3cd9de4..7c24a359 100644 --- a/Disco.Web/Areas/API/Controllers/ExportController.cs +++ b/Disco.Web/Areas/API/Controllers/ExportController.cs @@ -33,7 +33,7 @@ namespace Disco.Web.Areas.API.Controllers { var errorState = ModelState.First(m => m.Value.Errors.Any()); var error = errorState.Value.Errors.First(); - return new HttpStatusCodeResult(400, $"{errorState.Key}: {error.Exception?.Message ?? error.ErrorMessage}"); + return BadRequest($"{errorState.Key}: {error.Exception?.Message ?? error.ErrorMessage}"); } SavedExports.UpdateSavedExport(Database, model.ToSavedExport()); diff --git a/Disco.Web/Areas/API/Controllers/ExpressionsController.cs b/Disco.Web/Areas/API/Controllers/ExpressionsController.cs index e5f07236..0cb3cb15 100644 --- a/Disco.Web/Areas/API/Controllers/ExpressionsController.cs +++ b/Disco.Web/Areas/API/Controllers/ExpressionsController.cs @@ -20,7 +20,7 @@ namespace Disco.Web.Areas.API.Controllers public virtual ActionResult TypeDescriptor(string type, bool staticMembersOnly = false) { if (string.IsNullOrWhiteSpace(type)) - return new HttpStatusCodeResult(400, "Type is required"); + return BadRequest("Type is required"); var t = Type.GetType(type, false); @@ -28,15 +28,15 @@ namespace Disco.Web.Areas.API.Controllers { var typeNameParts = type.Split(new string[] { ", " }, StringSplitOptions.None); if (typeNameParts.Length < 2) - return Json("Invalid Type Specified"); + return BadRequest("Invalid Type Specified"); if (!ExpressionExtensionProviderFeature.TryGetExtensionAssembly(typeNameParts[1], out var assembly)) - return Json("Invalid Type Specified"); + return BadRequest("Invalid Type Specified"); t = assembly.GetType(typeNameParts[0]); if (t == null) - return Json("Invalid Type Specified"); + return BadRequest("Invalid Type Specified"); } return Json(ExpressionTypeDescriptor.Build(t, staticMembersOnly)); diff --git a/Disco.Web/Areas/API/Controllers/JobController.cs b/Disco.Web/Areas/API/Controllers/JobController.cs index 53d6d2b3..f2d02ef9 100644 --- a/Disco.Web/Areas/API/Controllers/JobController.cs +++ b/Disco.Web/Areas/API/Controllers/JobController.cs @@ -78,6 +78,7 @@ namespace Disco.Web.Areas.API.Controllers #endregion + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null) { try @@ -287,7 +288,6 @@ namespace Disco.Web.Areas.API.Controllers } if (redirect.HasValue && redirect.Value) return this.RedirectToAction(MVC.Job.Show(job.Id), resultUrlFragment); - //return RedirectToAction(MVC.Job.Show(job.Id)); else { if (resultData != null) @@ -296,7 +296,7 @@ namespace Disco.Web.Areas.API.Controllers } else { - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } } } @@ -305,22 +305,25 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #region Update Shortcut Methods [DiscoAuthorize(Claims.Job.Properties.ExpectedClosedDate)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateExpectedClosedDate(int id, string ExpectedClosedDate, bool? redirect = null) { return Update(id, pExpectedClosedDate, ExpectedClosedDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.DeviceHeldLocation)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDeviceHeldLocation(int id, string DeviceHeldLocation, bool? redirect = null) { return Update(id, pDeviceHeldLocation, DeviceHeldLocation, redirect); } [DiscoAuthorize(Claims.Job.Properties.Flags)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateFlags(int id, string Flags, bool? redirect = null) { return Update(id, pFlags, Flags, redirect); @@ -328,61 +331,73 @@ namespace Disco.Web.Areas.API.Controllers #region NonWarranty [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.AccountingChargeRequired)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateNonWarrantyAccountingChargeRequired(int id, string AccountingChargeRequiredDate, bool? redirect = null) { return Update(id, pNonWarrantyAccountingChargeRequired, AccountingChargeRequiredDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.AccountingChargeAdded)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateNonWarrantyAccountingChargeAdded(int id, string AccountingChargeAddedDate, bool? redirect = null) { return Update(id, pNonWarrantyAccountingChargeAdded, AccountingChargeAddedDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.AccountingChargePaid)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateNonWarrantyAccountingChargePaid(int id, string AccountingChargePaidDate, bool? redirect = null) { return Update(id, pNonWarrantyAccountingChargePaid, AccountingChargePaidDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.PurchaseOrderRaised)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateNonWarrantyPurchaseOrderRaised(int id, string PurchaseOrderRaisedDate, bool? redirect = null) { return Update(id, pNonWarrantyPurchaseOrderRaised, PurchaseOrderRaisedDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.PurchaseOrderReference)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateNonWarrantyPurchaseOrderReference(int id, string PurchaseOrderReference, bool? redirect = null) { return Update(id, pNonWarrantyPurchaseOrderReference, PurchaseOrderReference, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.PurchaseOrderSent)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateNonWarrantyPurchaseOrderSent(int id, string PurchaseOrderSentDate, bool? redirect = null) { return Update(id, pNonWarrantyPurchaseOrderSent, PurchaseOrderSentDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InvoiceReceived)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateNonWarrantyInvoiceReceived(int id, string InvoiceReceivedDate, bool? redirect = null) { return Update(id, pNonWarrantyInvoiceReceived, InvoiceReceivedDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.RepairerName)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateNonWarrantyRepairerName(int id, string RepairerName, bool? redirect = null) { return Update(id, pNonWarrantyRepairerName, RepairerName, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.RepairerLoggedDate)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateNonWarrantyRepairerLoggedDate(int id, string RepairerLoggedDate, bool? redirect = null) { return Update(id, pNonWarrantyRepairerLoggedDate, RepairerLoggedDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.RepairerReference)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateNonWarrantyRepairerReference(int id, string RepairerReference, bool? redirect = null) { return Update(id, pNonWarrantyRepairerReference, RepairerReference, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.RepairerCompletedDate)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateNonWarrantyRepairerCompletedDate(int id, string RepairerCompletedDate, bool? redirect = null) { return Update(id, pNonWarrantyRepairerCompletedDate, RepairerCompletedDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.IsInsuranceClaim)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateNonWarrantyIsInsuranceClaim(int id, bool IsInsuranceClaim, bool? redirect = null) { return Update(id, pNonWarrantyIsInsuranceClaim, IsInsuranceClaim.ToString(), redirect); @@ -392,91 +407,109 @@ namespace Disco.Web.Areas.API.Controllers #region Insurance [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceLossOrDamageDate(int id, string LossOrDamageDate, bool? redirect = null) { return Update(id, pInsuranceLossOrDamageDate, LossOrDamageDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceEventLocation(int id, string EventLocation, bool? redirect = null) { return Update(id, pInsuranceEventLocation, EventLocation, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceDescription(int id, string Description, bool? redirect = null) { return Update(id, pInsuranceDescription, Description, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceThirdPartyCaused(int id, string ThirdPartyCaused, bool? redirect = null) { return Update(id, pInsuranceThirdPartyCaused, ThirdPartyCaused, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceThirdPartyCausedName(int id, string ThirdPartyCausedName, bool? redirect = null) { return Update(id, pInsuranceThirdPartyCausedName, ThirdPartyCausedName, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceThirdPartyCausedWhy(int id, string ThirdPartyCausedWhy, bool? redirect = null) { return Update(id, pInsuranceThirdPartyCausedWhy, ThirdPartyCausedWhy, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceWitnessesNamesAddresses(int id, string WitnessesNamesAddresses, bool? redirect = null) { return Update(id, pInsuranceWitnessesNamesAddresses, WitnessesNamesAddresses, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceBurglaryTheftMethodOfEntry(int id, string BurglaryTheftMethodOfEntry, bool? redirect = null) { return Update(id, pInsuranceBurglaryTheftMethodOfEntry, BurglaryTheftMethodOfEntry, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsurancePropertyLastSeenDate(int id, string PropertyLastSeenDate, bool? redirect = null) { return Update(id, pInsurancePropertyLastSeenDate, PropertyLastSeenDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsurancePoliceNotified(int id, string PoliceNotified, bool? redirect = null) { return Update(id, pInsurancePoliceNotified, PoliceNotified, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsurancePoliceNotifiedStation(int id, string PoliceNotifiedStation, bool? redirect = null) { return Update(id, pInsurancePoliceNotifiedStation, PoliceNotifiedStation, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsurancePoliceNotifiedDate(int id, string PoliceNotifiedDate, bool? redirect = null) { return Update(id, pInsurancePoliceNotifiedDate, PoliceNotifiedDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsurancePoliceNotifiedCrimeReportNo(int id, string PoliceNotifiedCrimeReportNo, bool? redirect = null) { return Update(id, pInsurancePoliceNotifiedCrimeReportNo, PoliceNotifiedCrimeReportNo, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceRecoverReduceAction(int id, string RecoverReduceAction, bool? redirect = null) { return Update(id, pInsuranceRecoverReduceAction, RecoverReduceAction, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceOtherInterestedParties(int id, string OtherInterestedParties, bool? redirect = null) { return Update(id, pInsuranceOtherInterestedParties, OtherInterestedParties, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceDateOfPurchase(int id, string DateOfPurchase, bool? redirect = null) { return Update(id, pInsuranceDateOfPurchase, DateOfPurchase, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceClaimFormSentDate(int id, string ClaimFormSentDate, bool? redirect = null) { return Update(id, pInsuranceClaimFormSentDate, ClaimFormSentDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInsuranceClaimFormSentUserId(int id, string ClaimFormSentUserId, bool? redirect = null) { return Update(id, pInsuranceClaimFormSentUserId, ClaimFormSentUserId, redirect); @@ -486,21 +519,25 @@ namespace Disco.Web.Areas.API.Controllers #region Warranty [DiscoAuthorize(Claims.Job.Properties.WarrantyProperties.ExternalName)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateWarrantyExternalName(int id, string ExternalName, bool? redirect = null) { return Update(id, pWarrantyExternalName, ExternalName, redirect); } [DiscoAuthorize(Claims.Job.Properties.WarrantyProperties.ExternalLoggedDate)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateWarrantyExternalLoggedDate(int id, string ExternalLoggedDate, bool? redirect = null) { return Update(id, pWarrantyExternalLoggedDate, ExternalLoggedDate, redirect); } [DiscoAuthorize(Claims.Job.Properties.WarrantyProperties.ExternalReference)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateWarrantyExternalReference(int id, string ExternalReference, bool? redirect = null) { return Update(id, pWarrantyExternalReference, ExternalReference, redirect); } [DiscoAuthorize(Claims.Job.Properties.WarrantyProperties.ExternalCompletedDate)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateWarrantyExternalCompletedDate(int id, string ExternalCompletedDate, bool? redirect = null) { return Update(id, pWarrantyExternalCompletedDate, ExternalCompletedDate, redirect); @@ -1424,6 +1461,7 @@ namespace Disco.Web.Areas.API.Controllers #region Job Actions [DiscoAuthorize(Claims.Job.Actions.UpdateSubTypes)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateSubTypes(int id, List SubTypes = null, bool? AddComponents = null, bool? redirect = null) { try @@ -1448,18 +1486,19 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Job.Show(job.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Job.Properties.Flags)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateFlag(int id, long? Flag, string Reason, bool? redirect = null) { try @@ -1508,7 +1547,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Job.Show(job.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { @@ -1520,11 +1559,12 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Job.Properties.WaitingForUserAction)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult WaitingForUserAction(int id, string Reason, bool? redirect = null) { try @@ -1544,18 +1584,19 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Job.Show(job.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Job.Properties.NotWaitingForUserAction)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult NotWaitingForUserAction(int id, string Resolution, bool? redirect = null) { try @@ -1575,18 +1616,19 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Job.Show(job.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Job.Properties.DeviceReadyForReturn)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult DeviceReadyForReturn(int id, bool redirect) { Database.Configuration.LazyLoadingEnabled = true; @@ -1601,17 +1643,18 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Job.Show(id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { - return Json("Job's state doesn't allow this action", JsonRequestBehavior.AllowGet); + return BadRequest("Job's state doesn't allow this action"); } } - return Json("Invalid Job Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Number"); } [DiscoAuthorize(Claims.Job.Properties.DeviceHeld)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult DeviceHeld(int id, bool redirect) { var j = Database.Jobs.Find(id); @@ -1625,17 +1668,18 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Job.Show(id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { - return Json("Job's state doesn't allow this action", JsonRequestBehavior.AllowGet); + return BadRequest("Job's state doesn't allow this action"); } } - return Json("Invalid Job Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Number"); } [DiscoAuthorize(Claims.Job.Properties.DeviceReturned)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult DeviceReturned(int id, bool redirect) { var j = Database.Jobs.Find(id); @@ -1649,17 +1693,18 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Job.Show(id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { - return Json("Job's state doesn't allow this action", JsonRequestBehavior.AllowGet); + return BadRequest("Job's state doesn't allow this action"); } } - return Json("Invalid Job Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Number"); } [DiscoAuthorize(Claims.Job.Actions.ForceClose)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult ForceClose(int id, string Reason, bool? redirect = null) { var j = Database.Jobs.Find(id); @@ -1674,17 +1719,18 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Job.Show(id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { - return Json("Job's state doesn't allow this action", JsonRequestBehavior.AllowGet); + return BadRequest("Job's state doesn't allow this action"); } } - return Json("Invalid Job Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Number"); } [DiscoAuthorize(Claims.Job.Actions.Close)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Close(int id, bool redirect) { var j = Database.Jobs.Find(id); @@ -1699,17 +1745,18 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Job.Show(id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { - return Json("Job's state doesn't allow this action", JsonRequestBehavior.AllowGet); + return BadRequest("Job's state doesn't allow this action"); } } - return Json("Invalid Job Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Number"); } [DiscoAuthorize(Claims.Job.Actions.Reopen)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Reopen(int id, bool redirect) { var j = Database.Jobs @@ -1725,17 +1772,18 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Job.Show(id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { - return Json("Job's state doesn't allow this action", JsonRequestBehavior.AllowGet); + return BadRequest("Job's state doesn't allow this action"); } } - return Json("Invalid Job Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Number"); } [DiscoAuthorize(Claims.Job.Actions.Delete)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Delete(int id, bool redirect) { var j = Database.Jobs.Find(id); @@ -1750,17 +1798,18 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Job.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { - return Json("Job's state doesn't allow this action", JsonRequestBehavior.AllowGet); + return BadRequest("Job's state doesn't allow this action"); } } - return Json("Invalid Job Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Number"); } [DiscoAuthorize(Claims.Job.Actions.ConvertHWarToHNWar)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult ConvertHWarToHNWar(int id, bool redirect) { var j = Database.Jobs.Find(id); @@ -1775,14 +1824,14 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Job.Show(j.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { - return Json("Job's state doesn't allow this action", JsonRequestBehavior.AllowGet); + return BadRequest("Job's state doesn't allow this action"); } } - return Json("Invalid Job Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Number"); } #endregion @@ -1872,7 +1921,7 @@ namespace Disco.Web.Areas.API.Controllers } #endregion - #region Job Attachements + #region Job Attachments [DiscoAuthorize(Claims.Job.ShowAttachments), OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)] public virtual ActionResult AttachmentDownload(int id) @@ -1907,7 +1956,8 @@ namespace Disco.Web.Areas.API.Controllers return HttpNotFound("Invalid Attachment Number"); } - [DiscoAuthorize(Claims.Job.Actions.AddAttachments), ValidateAntiForgeryToken] + [DiscoAuthorize(Claims.Job.Actions.AddAttachments)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult AttachmentUpload(int id, string comments) { var j = Database.Jobs.Find(id); @@ -1987,6 +2037,7 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorizeAny(Claims.Job.Actions.RemoveAnyAttachments, Claims.Job.Actions.RemoveOwnAttachments)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult AttachmentRemove(int id) { var ja = Database.JobAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault(); @@ -1999,9 +2050,9 @@ namespace Disco.Web.Areas.API.Controllers ja.OnDelete(Database); Database.SaveChanges(); - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } - return Json("Invalid Attachment Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Attachment Number"); } [DiscoAuthorize(Claims.Job.Actions.AddAttachments)] @@ -2028,11 +2079,7 @@ namespace Disco.Web.Areas.API.Controllers } catch (InvalidOperationException ex) { - return Json(new - { - Success = false, - ErrorMessage = ex.Message, - }); + return BadRequest(ex.Message); } } @@ -2041,55 +2088,58 @@ namespace Disco.Web.Areas.API.Controllers #region Job Components [DiscoAuthorizeAll(Claims.Job.Properties.NonWarrantyProperties.AddComponents, Claims.Job.Properties.NonWarrantyProperties.EditComponents)] - public virtual ActionResult ComponentAdd(int id, string Description, string Cost) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult ComponentAdd(int id, string description, string cost) { var j = Database.Jobs.Find(id); if (j != null) { - if (string.IsNullOrEmpty(Description)) - Description = "?"; - if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$")) - Cost = Cost.Substring(Cost.IndexOf("$") + 1); - decimal.TryParse(Cost, out var cost); + if (string.IsNullOrEmpty(description)) + description = "?"; + if (!string.IsNullOrEmpty(cost) && cost.Contains("$")) + cost = cost.Substring(cost.IndexOf("$") + 1); + decimal.TryParse(cost, out var costValue); var jc = new JobComponent() { JobId = j.Id, - Description = Description, - Cost = cost, + Description = description, + Cost = costValue, TechUserId = CurrentUser.UserId }; Database.JobComponents.Add(jc); Database.SaveChanges(); - return Json(new Models.Job.ComponentModel { Result = "OK", Component = Models.Job._ComponentModel.FromJobComponent(jc) }, JsonRequestBehavior.AllowGet); + return Json(Models.Job.ComponentModel.FromJobComponent(jc)); } - return Json(new Models.Job.ComponentModel { Result = "Invalid Job Number" }, JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Number"); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.EditComponents)] - public virtual ActionResult ComponentUpdate(int id, string Description, string Cost) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult ComponentUpdate(int id, string description, string cost) { var jc = Database.JobComponents.Find(id); if (jc != null) { - if (string.IsNullOrEmpty(Description)) - Description = "?"; - if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$")) - Cost = Cost.Substring(Cost.IndexOf("$") + 1); - decimal.TryParse(Cost, out var cost); + if (string.IsNullOrEmpty(description)) + description = "?"; + if (!string.IsNullOrEmpty(cost) && cost.Contains("$")) + cost = cost.Substring(cost.IndexOf("$") + 1); + decimal.TryParse(cost, out var costValue); - jc.Description = Description; - jc.Cost = cost; + jc.Description = description; + jc.Cost = costValue; Database.SaveChanges(); - return Json(new Models.Job.ComponentModel { Result = "OK", Component = Models.Job._ComponentModel.FromJobComponent(jc) }, JsonRequestBehavior.AllowGet); + return Json(Models.Job.ComponentModel.FromJobComponent(jc)); } - return Json(new Models.Job.ComponentModel { Result = "Invalid Job Component Number" }, JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Component Number"); } [DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.EditComponents)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult ComponentRemove(int id) { var jc = Database.JobComponents.Find(id); @@ -2097,9 +2147,9 @@ namespace Disco.Web.Areas.API.Controllers { Database.JobComponents.Remove(jc); Database.SaveChanges(); - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } - return Json("Invalid Job Component Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Component Number"); } #endregion @@ -2116,30 +2166,6 @@ namespace Disco.Web.Areas.API.Controllers #endregion - [DiscoAuthorize(Claims.Job.Actions.GenerateDocuments)] - public virtual ActionResult GeneratePdf(int id, string DocumentTemplateId) - { - if (id <= 0) - throw new ArgumentOutOfRangeException(nameof(id)); - if (string.IsNullOrEmpty(DocumentTemplateId)) - throw new ArgumentNullException(nameof(DocumentTemplateId)); - - // Obsolete: Use API\DocumentTemplate\Generate instead - return RedirectToAction(MVC.API.DocumentTemplate.Generate(DocumentTemplateId, id.ToString())); - } - - [DiscoAuthorize(Claims.Job.Actions.GenerateDocuments)] - public virtual ActionResult GeneratePdfPackage(int id, string DocumentTemplatePackageId) - { - if (id <= 0) - throw new ArgumentOutOfRangeException(nameof(id)); - if (string.IsNullOrEmpty(DocumentTemplatePackageId)) - throw new ArgumentNullException(nameof(DocumentTemplatePackageId)); - - // Obsolete: Use API\DocumentTemplatePackage\Generate instead - return RedirectToAction(MVC.API.DocumentTemplatePackage.Generate(DocumentTemplatePackageId, id.ToString())); - } - [DiscoAuthorize(Claims.Job.Properties.DeviceHeldLocation)] public virtual ActionResult DeviceHeldLocations() { diff --git a/Disco.Web/Areas/API/Controllers/JobPreferencesController.cs b/Disco.Web/Areas/API/Controllers/JobPreferencesController.cs index 7947dd9e..996887f1 100644 --- a/Disco.Web/Areas/API/Controllers/JobPreferencesController.cs +++ b/Disco.Web/Areas/API/Controllers/JobPreferencesController.cs @@ -12,6 +12,7 @@ namespace Disco.Web.Areas.API.Controllers public partial class JobPreferencesController : AuthorizedDatabaseController { [DiscoAuthorize(Claims.Config.JobPreferences.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateInitialCommentsTemplate(string initialCommentsTemplate, bool redirect = false) { string expression = null; @@ -32,10 +33,11 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.JobPreferences.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } [DiscoAuthorize(Claims.Config.JobPreferences.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateLongRunningJobDaysThreshold(int LongRunningJobDaysThreshold, bool redirect = false) { Database.DiscoConfiguration.JobPreferences.LongRunningJobDaysThreshold = LongRunningJobDaysThreshold; @@ -44,10 +46,11 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.JobPreferences.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } [DiscoAuthorize(Claims.Config.JobPreferences.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateStaleJobMinutesThreshold(int StaleJobMinutesThreshold, bool redirect = false) { Database.DiscoConfiguration.JobPreferences.StaleJobMinutesThreshold = StaleJobMinutesThreshold; @@ -56,10 +59,11 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.JobPreferences.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } [DiscoAuthorize(Claims.Config.JobPreferences.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateLodgmentIncludeAllAttachmentsByDefault(bool includeAllAttachmentsByDefault, bool redirect = false) { Database.DiscoConfiguration.JobPreferences.LodgmentIncludeAllAttachmentsByDefault = includeAllAttachmentsByDefault; @@ -68,10 +72,11 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.JobPreferences.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } [DiscoAuthorize(Claims.Config.JobPreferences.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDefaultNoticeboardTheme(string DefaultNoticeboardTheme, bool redirect = false) { Database.DiscoConfiguration.JobPreferences.DefaultNoticeboardTheme = DefaultNoticeboardTheme; @@ -82,10 +87,11 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.JobPreferences.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } [DiscoAuthorize(Claims.Config.JobPreferences.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateLocationMode(LocationModes LocationMode, bool redirect = false) { Database.DiscoConfiguration.JobPreferences.LocationMode = LocationMode; @@ -94,13 +100,14 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.JobPreferences.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } [DiscoAuthorize(Claims.Config.JobPreferences.Configure)] - public virtual ActionResult UpdateLocationList(string[] LocationList, bool redirect = false) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult UpdateLocationList(string[] locationList, bool redirect = false) { - var list = LocationList + var list = locationList .Where(i => !string.IsNullOrWhiteSpace(i)) .Select(i => i.Trim()) .Distinct(StringComparer.OrdinalIgnoreCase) @@ -112,10 +119,11 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.JobPreferences.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } [DiscoAuthorize(Claims.Config.JobPreferences.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult ImportLocationList(string LocationList, bool AutomaticList = false, bool Override = false, bool redirect = false) { IEnumerable list; @@ -152,10 +160,11 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.JobPreferences.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } [DiscoAuthorize(Claims.Config.JobPreferences.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateOnCreateExpression(string OnCreateExpression, bool redirect = false) { string expression = null; @@ -176,10 +185,11 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.JobPreferences.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } [DiscoAuthorize(Claims.Config.JobPreferences.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateOnDeviceReadyForReturnExpression(string OnDeviceReadyForReturnExpression, bool redirect = false) { string expression = null; @@ -200,10 +210,11 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.JobPreferences.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } [DiscoAuthorize(Claims.Config.JobPreferences.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateOnCloseExpression(string OnCloseExpression, bool redirect = false) { string expression = null; @@ -224,7 +235,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.JobPreferences.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } } } \ No newline at end of file diff --git a/Disco.Web/Areas/API/Controllers/JobQueueController.cs b/Disco.Web/Areas/API/Controllers/JobQueueController.cs index 325feb8d..62e354de 100644 --- a/Disco.Web/Areas/API/Controllers/JobQueueController.cs +++ b/Disco.Web/Areas/API/Controllers/JobQueueController.cs @@ -20,6 +20,7 @@ namespace Disco.Web.Areas.API.Controllers const string pDefaultSLAExpiry = "defaultslaexpiry"; [DiscoAuthorize(Claims.Config.JobQueue.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null) { Authorization.Require(Claims.Config.JobQueue.Configure); @@ -64,55 +65,62 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.JobQueue.Index(jobQueue.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #region Update Shortcut Methods [DiscoAuthorize(Claims.Config.JobQueue.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateName(int id, string QueueName = null, bool? redirect = null) { return Update(id, pName, QueueName, redirect); } [DiscoAuthorize(Claims.Config.JobQueue.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null) { return Update(id, pDescription, Description, redirect); } [DiscoAuthorize(Claims.Config.JobQueue.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdatePriority(int id, string Priority = null, bool? redirect = null) { return Update(id, pPriority, Priority, redirect); } [DiscoAuthorize(Claims.Config.JobQueue.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDefaultSLAExpiry(int id, string DefaultSLAExpiry = null, bool? redirect = null) { return Update(id, pDefaultSLAExpiry, DefaultSLAExpiry, redirect); } [DiscoAuthorize(Claims.Config.JobQueue.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateIcon(int id, string Icon = null, bool? redirect = null) { return Update(id, pIcon, Icon, redirect); } [DiscoAuthorize(Claims.Config.JobQueue.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateIconColour(int id, string IconColour = null, bool? redirect = null) { return Update(id, pIconColour, IconColour, redirect); } [DiscoAuthorize(Claims.Config.JobQueue.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateIconAndColour(int id, string Icon = null, string IconColour = null, bool redirect = false) { try @@ -127,23 +135,24 @@ namespace Disco.Web.Areas.API.Controllers } else { - return Json("Invalid Job Queue Id", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Queue Id"); } if (redirect) return RedirectToAction(MVC.Config.JobQueue.Index(jobQueue.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Config.JobQueue.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateSubjects(int id, string[] Subjects = null, bool redirect = false) { try @@ -158,23 +167,24 @@ namespace Disco.Web.Areas.API.Controllers } else { - return Json("Invalid Job Queue Id", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Queue Id"); } if (redirect) return RedirectToAction(MVC.Config.JobQueue.Index(jobQueue.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Config.JobQueue.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateJobSubTypes(int id, List JobSubTypes = null, bool redirect = false) { try @@ -186,50 +196,50 @@ namespace Disco.Web.Areas.API.Controllers } else { - return Json("Invalid Job Queue Id", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Job Queue Id"); } if (redirect) return RedirectToAction(MVC.Config.JobQueue.Index(jobQueue.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #endregion #region Update Properties - private void UpdateIconAndColour(JobQueue jobQueue, string Icon, string IconColour) + private void UpdateIconAndColour(JobQueue jobQueue, string icon, string iconColour) { - if (string.IsNullOrWhiteSpace(Icon)) - throw new ArgumentNullException("Icon"); - if (string.IsNullOrWhiteSpace(IconColour)) - throw new ArgumentNullException("IconColour"); + if (string.IsNullOrWhiteSpace(icon)) + throw new ArgumentNullException(nameof(icon)); + if (string.IsNullOrWhiteSpace(iconColour)) + throw new ArgumentNullException(nameof(iconColour)); - jobQueue.Icon = Icon; - jobQueue.IconColour = IconColour; + jobQueue.Icon = icon; + jobQueue.IconColour = iconColour; JobQueueService.UpdateJobQueue(Database, jobQueue); } - private void UpdateIcon(JobQueue jobQueue, string Icon) + private void UpdateIcon(JobQueue jobQueue, string icon) { - if (string.IsNullOrWhiteSpace(Icon)) + if (string.IsNullOrWhiteSpace(icon)) throw new ArgumentNullException("Icon"); - jobQueue.Icon = Icon; + jobQueue.Icon = icon; JobQueueService.UpdateJobQueue(Database, jobQueue); } - private void UpdateIconColour(JobQueue jobQueue, string IconColour) + private void UpdateIconColour(JobQueue jobQueue, string iconColour) { - if (string.IsNullOrWhiteSpace(IconColour)) + if (string.IsNullOrWhiteSpace(iconColour)) throw new ArgumentNullException("IconColour"); - jobQueue.IconColour = IconColour; + jobQueue.IconColour = iconColour; JobQueueService.UpdateJobQueue(Database, jobQueue); } @@ -277,25 +287,25 @@ namespace Disco.Web.Areas.API.Controllers JobQueueService.UpdateJobQueue(Database, jobQueue); } - private void UpdateSubjects(JobQueue jobQueue, string[] Subjects) + private void UpdateSubjects(JobQueue jobQueue, string[] subjects) { string subjectIds = null; // Validate Subjects - if (Subjects != null && Subjects.Length > 0) + if (subjects != null && subjects.Length > 0) { - var subjects = Subjects + var subjectRecords = subjects .Where(s => !string.IsNullOrWhiteSpace(s)) .Select(s => s.Trim()) .Select(s => Tuple.Create(s, ActiveDirectory.RetrieveADObject(s, Quick: true))) .Where(s => s.Item2 is ADUserAccount || s.Item2 is ADGroup) .ToList(); - var invalidSubjects = subjects.Where(s => s.Item2 == null).ToList(); + var invalidSubjects = subjectRecords.Where(s => s.Item2 == null).ToList(); if (invalidSubjects.Count > 0) throw new ArgumentException($"Subjects not found: {string.Join(", ", invalidSubjects)}", "Subjects"); - var proposedSubjects = subjects.Select(s => s.Item2.Id).OrderBy(s => s).ToArray(); + var proposedSubjects = subjectRecords.Select(s => s.Item2.Id).OrderBy(s => s).ToArray(); subjectIds = string.Join(",", proposedSubjects); @@ -340,6 +350,7 @@ namespace Disco.Web.Areas.API.Controllers #region Actions [DiscoAuthorize(Claims.Config.JobQueue.Delete)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Delete(int id, bool? redirect = false) { try @@ -353,7 +364,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } throw new Exception("Invalid Job Queue Id"); } @@ -362,7 +373,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #endregion diff --git a/Disco.Web/Areas/API/Controllers/JobQueueJobController.cs b/Disco.Web/Areas/API/Controllers/JobQueueJobController.cs index e365e288..1d5e5817 100644 --- a/Disco.Web/Areas/API/Controllers/JobQueueJobController.cs +++ b/Disco.Web/Areas/API/Controllers/JobQueueJobController.cs @@ -16,6 +16,7 @@ namespace Disco.Web.Areas.API.Controllers const string pSla = "sla"; const string pPriority = "priority"; + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null) { try @@ -52,40 +53,45 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return Redirect($"{Url.Action(MVC.Job.Show(jobQueueJob.JobId))}#jobDetailTab-Queues"); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #region Update Shortcut Methods [DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyComments, Claims.Job.Properties.JobQueueProperties.EditOwnComments)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateAddedComment(int id, string AddedComment = null, bool? redirect = null) { return Update(id, pAddedComment, AddedComment, redirect); } [DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyComments, Claims.Job.Properties.JobQueueProperties.EditOwnComments)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateRemovedComment(int id, string RemovedComment = null, bool? redirect = null) { return Update(id, pRemovedComment, RemovedComment, redirect); } [DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnySLA, Claims.Job.Properties.JobQueueProperties.EditOwnSLA)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateSla(int id, string SLA = null, bool? redirect = null) { return Update(id, pSla, SLA, redirect); } [DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyPriority, Claims.Job.Properties.JobQueueProperties.EditOwnPriority)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdatePriority(int id, string Priority = null, bool? redirect = null) { return Update(id, pPriority, Priority, redirect); } [DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnySLA, Claims.Job.Properties.JobQueueProperties.EditOwnSLA, Claims.Job.Properties.JobQueueProperties.EditAnyPriority, Claims.Job.Properties.JobQueueProperties.EditOwnPriority)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateSlaAndPriority(int id, string Sla = null, string Priority = null, bool? redirect = null) { try @@ -106,14 +112,14 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return Redirect($"{Url.Action(MVC.Job.Show(jobQueueJob.JobId))}#jobDetailTab-Queues"); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #endregion @@ -175,6 +181,7 @@ namespace Disco.Web.Areas.API.Controllers #region Actions [DiscoAuthorizeAny(Claims.Job.Actions.AddAnyQueues, Claims.Job.Actions.AddOwnQueues)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult AddJob(int id, int JobId, string Comment, int? SLAExpiresMinutes, JobQueuePriority Priority) { DateTime? SLAExpires = (SLAExpiresMinutes.HasValue && SLAExpiresMinutes.Value > 0) ? DateTime.Now.AddMinutes(SLAExpiresMinutes.Value) : (DateTime?)null; @@ -197,6 +204,7 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorizeAny(Claims.Job.Actions.RemoveAnyQueues, Claims.Job.Actions.RemoveOwnQueues)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult RemoveJob(int id, string Comment, bool? CloseJob = null) { Database.Configuration.LazyLoadingEnabled = true; diff --git a/Disco.Web/Areas/API/Controllers/LoggingController.cs b/Disco.Web/Areas/API/Controllers/LoggingController.cs index 512a1fab..712c48b6 100644 --- a/Disco.Web/Areas/API/Controllers/LoggingController.cs +++ b/Disco.Web/Areas/API/Controllers/LoggingController.cs @@ -21,7 +21,8 @@ namespace Disco.Web.Areas.API.Controllers return Json(m, JsonRequestBehavior.AllowGet); } - [HttpPost, ValidateAntiForgeryToken, DiscoAuthorize(Claims.Config.Logging.Show)] + [DiscoAuthorize(Claims.Config.Logging.Show)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult RetrieveEvents(string Format, DateTime? Start = null, DateTime? End = null, int? ModuleId = null, List EventTypeIds = null, int? Take = null) { if (string.Equals(Format, "json", StringComparison.OrdinalIgnoreCase)) diff --git a/Disco.Web/Areas/API/Controllers/PluginController.cs b/Disco.Web/Areas/API/Controllers/PluginController.cs index 98097db4..ca52bacb 100644 --- a/Disco.Web/Areas/API/Controllers/PluginController.cs +++ b/Disco.Web/Areas/API/Controllers/PluginController.cs @@ -31,7 +31,8 @@ namespace Disco.Web.Areas.API.Controllers } } - [HttpPost, DiscoAuthorize(Claims.Config.Plugin.Install), ValidateAntiForgeryToken] + [DiscoAuthorize(Claims.Config.Plugin.Install)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateAll() { var status = UpdatePluginTask.UpdateAllPlugins(); @@ -39,7 +40,8 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId)); } - [HttpPost, DiscoAuthorize(Claims.Config.Plugin.Install), ValidateAntiForgeryToken] + [DiscoAuthorize(Claims.Config.Plugin.Install)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Update(string pluginId) { if (string.IsNullOrEmpty(pluginId)) @@ -50,7 +52,8 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId)); } - [HttpPost, DiscoAuthorize(Claims.Config.Plugin.Uninstall), ValidateAntiForgeryToken] + [DiscoAuthorize(Claims.Config.Plugin.Uninstall)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Uninstall(string id, bool uninstallData) { if (string.IsNullOrEmpty(id)) @@ -63,7 +66,8 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId)); } - [HttpPost, DiscoAuthorize(Claims.Config.Plugin.Install), ValidateAntiForgeryToken] + [DiscoAuthorize(Claims.Config.Plugin.Install)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Install(string pluginId) { if (string.IsNullOrEmpty(pluginId)) @@ -92,7 +96,8 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId)); } - [HttpPost, DiscoAuthorizeAll(Claims.Config.Plugin.Install, Claims.Config.Plugin.InstallLocal), ValidateAntiForgeryToken] + [DiscoAuthorizeAll(Claims.Config.Plugin.Install, Claims.Config.Plugin.InstallLocal)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult InstallLocal(HttpPostedFileBase plugin, bool immediateRestart = false) { if (plugin == null || plugin.ContentLength <= 0 || string.IsNullOrWhiteSpace(plugin.FileName)) diff --git a/Disco.Web/Areas/API/Controllers/SystemController.cs b/Disco.Web/Areas/API/Controllers/SystemController.cs index 463218f3..09fbc256 100644 --- a/Disco.Web/Areas/API/Controllers/SystemController.cs +++ b/Disco.Web/Areas/API/Controllers/SystemController.cs @@ -19,6 +19,7 @@ namespace Disco.Web.Areas.API.Controllers public partial class SystemController : AuthorizedDatabaseController { [DiscoAuthorize(Claims.Config.System.Show)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateLastNetworkLogonDates() { var taskStatus = ADNetworkLogonDatesUpdateTask.ScheduleImmediately(); @@ -27,6 +28,7 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.DiscoAdminAccount)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateAttachmentThumbnails() { var ts = Disco.Services.Documents.AttachmentImport.ThumbnailUpdateTask.ScheduleImmediately(); @@ -35,6 +37,7 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.DiscoAdminAccount)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateADDeviceDescriptions() { var ts = ADDeviceDescriptionUpdateTask.ScheduleImmediately(); @@ -63,6 +66,7 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorize(Claims.Config.System.Show)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateCheck() { var ts = UpdateQueryTask.ScheduleNow(); @@ -70,7 +74,8 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(ts.SessionId)); } - [HttpPost, ValidateAntiForgeryToken, DiscoAuthorize(Claims.Config.System.Show)] + [DiscoAuthorize(Claims.Config.System.Show)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult OnlineServicesConnectStart() { OnlineServicesConnect.QueueStart(); @@ -82,6 +87,7 @@ namespace Disco.Web.Areas.API.Controllers #region Organisation Name [DiscoAuthorize(Claims.Config.Organisation.ConfigureName)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateOrganisationName(string OrganisationName, bool redirect = false) { if (string.IsNullOrWhiteSpace(OrganisationName)) @@ -96,7 +102,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.Organisation.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } #endregion @@ -117,7 +123,8 @@ namespace Disco.Web.Areas.API.Controllers } } } - [DiscoAuthorize(Claims.Config.Organisation.ConfigureLogo), HttpPost] + [DiscoAuthorize(Claims.Config.Organisation.ConfigureLogo)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult OrganisationLogo(bool redirect, HttpPostedFileBase Image, bool? ResetLogo = null) { if (ResetLogo.HasValue && ResetLogo.Value) @@ -127,7 +134,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.Organisation.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } if (Image != null && Image.ContentLength > 0) @@ -139,25 +146,26 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.Organisation.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { if (redirect) return RedirectToAction(MVC.Config.Organisation.Index()); else - return Json("Invalid Content Type", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Content Type"); } } if (redirect) return RedirectToAction(MVC.Config.Organisation.Index()); else - return Json("No Image Supplied", JsonRequestBehavior.AllowGet); + return BadRequest("No Image Supplied"); } #endregion #region Organisation Addresses - [HttpPost, ValidateAntiForgeryToken, DiscoAuthorize(Claims.Config.Organisation.ConfigureAddresses)] + [DiscoAuthorize(Claims.Config.Organisation.ConfigureAddresses)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateOrganisationAddress(Disco.Models.BI.Config.OrganisationAddress organisationAddress, bool redirect = false) { if (organisationAddress == null) @@ -171,7 +179,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.Organisation.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } else { @@ -193,7 +201,8 @@ namespace Disco.Web.Areas.API.Controllers return Json(em.ToString(), JsonRequestBehavior.AllowGet); } } - [HttpPost, ValidateAntiForgeryToken, DiscoAuthorize(Claims.Config.Organisation.ConfigureAddresses)] + [DiscoAuthorize(Claims.Config.Organisation.ConfigureAddresses)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult DeleteOrganisationAddress(int id, bool redirect = false) { // Remove References in Device Profiles @@ -207,7 +216,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.Organisation.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } #endregion @@ -215,6 +224,7 @@ namespace Disco.Web.Areas.API.Controllers #region MultiSiteMode [DiscoAuthorize(Claims.Config.Organisation.ConfigureMultiSiteMode)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateMultiSiteMode(bool MultiSiteMode, bool redirect = false) { Database.DiscoConfiguration.MultiSiteMode = MultiSiteMode; @@ -226,7 +236,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.Organisation.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } #endregion @@ -236,6 +246,7 @@ namespace Disco.Web.Areas.API.Controllers #region Active Directory [DiscoAuthorize(Claims.Config.System.ConfigureActiveDirectory)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateActiveDirectorySearchScope(List Containers, bool redirect = false) { ActiveDirectory.Context.UpdateSearchContainers(Database, Containers); @@ -244,10 +255,11 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.SystemConfig.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } [DiscoAuthorize(Claims.Config.System.ConfigureActiveDirectory)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateActiveDirectorySearchAllServers(bool SearchAllServers, bool redirect = false) { try @@ -268,18 +280,19 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.SystemConfig.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Config.System.ConfigureActiveDirectory)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateActiveDirectorySearchWildcardSuffixOnly(bool SearchWildcardSuffixOnly, bool redirect = false) { ActiveDirectory.Context.UpdateWildcardSearchSuffixOnly(Database, SearchWildcardSuffixOnly); @@ -289,7 +302,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.SystemConfig.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } [DiscoAuthorizeAny(Claims.Config.System.ConfigureActiveDirectory, Claims.Config.DeviceProfile.Configure)] @@ -341,7 +354,8 @@ namespace Disco.Web.Areas.API.Controllers return Json(Models.Shared.SubjectDescriptorModel.FromActiveDirectoryObject(subject), JsonRequestBehavior.AllowGet); } - [DiscoAuthorizeAny(Claims.Config.UserFlag.Configure)] + [DiscoAuthorizeAny(Claims.Config.UserFlag.Configure, Claims.Config.DeviceFlag.Configure, Claims.Config.DeviceProfile.Configure, Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult SyncActiveDirectoryManagedGroup(string id, string redirectUrl = null) { @@ -361,6 +375,7 @@ namespace Disco.Web.Areas.API.Controllers #region Proxy Settings [DiscoAuthorize(Claims.Config.System.ConfigureProxy)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateProxySettings(string ProxyAddress, int? ProxyPort, string ProxyUsername, string ProxyPassword, bool redirect = false) { // Default Proxy Port @@ -387,14 +402,15 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.SystemConfig.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } #endregion #region Email Settings - [DiscoAuthorize(Claims.Config.System.ConfigureEmail), ValidateInput(false), ValidateAntiForgeryToken] + [DiscoAuthorize(Claims.Config.System.ConfigureEmail), ValidateInput(false)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateEmailSettings(string SmtpServer, int? SmtpPort, string FromAddress, string ReplyToAddress, bool EnableSsl, string Username, string Password, bool redirect = false) { // Default Port @@ -419,10 +435,11 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.SystemConfig.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } - [DiscoAuthorize(Claims.Config.System.ConfigureEmail), ValidateAntiForgeryToken] + [DiscoAuthorize(Claims.Config.System.ConfigureEmail)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult SendTestEmail(string Recipient, bool redirect = false) { if (string.IsNullOrWhiteSpace(Recipient)) @@ -433,7 +450,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect) return RedirectToAction(MVC.Config.SystemConfig.Index()); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } #endregion diff --git a/Disco.Web/Areas/API/Controllers/UserController.cs b/Disco.Web/Areas/API/Controllers/UserController.cs index e02b0df2..03c28510 100644 --- a/Disco.Web/Areas/API/Controllers/UserController.cs +++ b/Disco.Web/Areas/API/Controllers/UserController.cs @@ -139,7 +139,8 @@ namespace Disco.Web.Areas.API.Controllers return HttpNotFound("Invalid Attachment Number"); } - [DiscoAuthorize(Claims.User.Actions.AddAttachments), ValidateAntiForgeryToken] + [DiscoAuthorize(Claims.User.Actions.AddAttachments)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult AttachmentUpload(string id, string domain, string comments) { id = ActiveDirectory.ParseDomainAccountId(id, domain); @@ -224,6 +225,7 @@ namespace Disco.Web.Areas.API.Controllers } [DiscoAuthorizeAny(Claims.User.Actions.RemoveAnyAttachments, Claims.User.Actions.RemoveOwnAttachments)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult AttachmentRemove(int id) { var ua = Database.UserAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault(); @@ -236,9 +238,9 @@ namespace Disco.Web.Areas.API.Controllers ua.OnDelete(Database); Database.SaveChanges(); - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } - return Json("Invalid Attachment Number", JsonRequestBehavior.AllowGet); + return BadRequest("Invalid Attachment Number"); } [DiscoAuthorize(Claims.User.Actions.AddAttachments)] @@ -267,44 +269,12 @@ namespace Disco.Web.Areas.API.Controllers } catch (InvalidOperationException ex) { - return Json(new - { - Success = false, - ErrorMessage = ex.Message, - }); + return BadRequest(ex.Message); } } #endregion - [DiscoAuthorize(Claims.User.Actions.GenerateDocuments)] - public virtual ActionResult GeneratePdf(string id, string domain, string DocumentTemplateId) - { - if (string.IsNullOrEmpty(id)) - throw new ArgumentNullException(nameof(id)); - if (string.IsNullOrEmpty(DocumentTemplateId)) - throw new ArgumentNullException(nameof(DocumentTemplateId)); - - var userId = ActiveDirectory.ParseDomainAccountId(id, domain); - - // Obsolete: Use API\DocumentTemplate\Generate instead - return RedirectToAction(MVC.API.DocumentTemplate.Generate(DocumentTemplateId, userId)); - } - - [DiscoAuthorize(Claims.User.Actions.GenerateDocuments)] - public virtual ActionResult GeneratePdfPackage(string id, string domain, string DocumentTemplatePackageId) - { - if (string.IsNullOrEmpty(id)) - throw new ArgumentNullException(nameof(id)); - if (string.IsNullOrEmpty(DocumentTemplatePackageId)) - throw new ArgumentNullException(nameof(DocumentTemplatePackageId)); - - var userId = ActiveDirectory.ParseDomainAccountId(id, domain); - - // Obsolete: Use API\DocumentTemplatePackage\Generate instead - return RedirectToAction(MVC.API.DocumentTemplatePackage.Generate(DocumentTemplatePackageId, userId)); - } - public virtual ActionResult Photo(string userId) { if (string.IsNullOrEmpty(userId)) diff --git a/Disco.Web/Areas/API/Controllers/UserFlagAssignmentController.cs b/Disco.Web/Areas/API/Controllers/UserFlagAssignmentController.cs index ec1348b2..a89e3f2e 100644 --- a/Disco.Web/Areas/API/Controllers/UserFlagAssignmentController.cs +++ b/Disco.Web/Areas/API/Controllers/UserFlagAssignmentController.cs @@ -40,14 +40,14 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return Redirect($"{Url.Action(MVC.User.Show(userFlagAssignment.UserId))}#UserDetailTab-Flags"); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } diff --git a/Disco.Web/Areas/API/Controllers/UserFlagController.cs b/Disco.Web/Areas/API/Controllers/UserFlagController.cs index 5b6ee2df..ccd26005 100644 --- a/Disco.Web/Areas/API/Controllers/UserFlagController.cs +++ b/Disco.Web/Areas/API/Controllers/UserFlagController.cs @@ -24,6 +24,7 @@ namespace Disco.Web.Areas.API.Controllers const string pOnUnassignmentExpression = "onunassignmentexpression"; [DiscoAuthorize(Claims.Config.UserFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null) { Authorization.Require(Claims.Config.UserFlag.Configure); @@ -68,93 +69,101 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.UserFlag.Index(flag.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #region Update Shortcut Methods [DiscoAuthorize(Claims.Config.UserFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateName(int id, string FlagName = null, bool? redirect = null) { return Update(id, pName, FlagName, redirect); } [DiscoAuthorize(Claims.Config.UserFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null) { return Update(id, pDescription, Description, redirect); } [DiscoAuthorize(Claims.Config.UserFlag.Configure)] - public virtual ActionResult UpdateIcon(int id, string Icon = null, bool? redirect = null) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult UpdateIcon(int id, string icon = null, bool? redirect = null) { - return Update(id, pIcon, Icon, redirect); + return Update(id, pIcon, icon, redirect); } [DiscoAuthorize(Claims.Config.UserFlag.Configure)] - public virtual ActionResult UpdateIconColour(int id, string IconColour = null, bool? redirect = null) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult UpdateIconColour(int id, string iconColour = null, bool? redirect = null) { - return Update(id, pIconColour, IconColour, redirect); + return Update(id, pIconColour, iconColour, redirect); } [DiscoAuthorize(Claims.Config.UserFlag.Configure)] - public virtual ActionResult UpdateIconAndColour(int id, string Icon = null, string IconColour = null, bool redirect = false) + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult UpdateIconAndColour(int id, string icon = null, string iconColour = null, bool redirect = false) { try { if (id < 0) - throw new ArgumentOutOfRangeException("id"); + throw new ArgumentOutOfRangeException(nameof(id)); var UserFlag = Database.UserFlags.Find(id); if (UserFlag != null) { - UpdateIconAndColour(UserFlag, Icon, IconColour); + UpdateIconAndColour(UserFlag, icon, iconColour); } else { - throw new ArgumentException("Invalid User Flag Id", "id"); + throw new ArgumentException("Invalid User Flag Id", nameof(id)); } if (redirect) return RedirectToAction(MVC.Config.UserFlag.Index(UserFlag.Id)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Config.UserFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateOnAssignmentExpression(int id, string OnAssignmentExpression = null, bool redirect = false) { return Update(id, pOnAssignmentExpression, OnAssignmentExpression, redirect); } [DiscoAuthorize(Claims.Config.UserFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateOnUnassignmentExpression(int id, string OnUnassignmentExpression = null, bool redirect = false) { return Update(id, pOnUnassignmentExpression, OnUnassignmentExpression, redirect); } [DiscoAuthorize(Claims.Config.UserFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateAssignedUsersLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false) { try { if (id < 0) - throw new ArgumentOutOfRangeException("id"); + throw new ArgumentOutOfRangeException(nameof(id)); var UserFlag = Database.UserFlags.Find(id); if (UserFlag == null) - throw new ArgumentException("Invalid User Flag Id", "id"); + throw new ArgumentException("Invalid User Flag Id", nameof(id)); var syncTaskStatus = UpdateAssignedUsersLinkedGroup(UserFlag, GroupId, FilterBeginDate); @@ -167,27 +176,28 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId)); } else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorize(Claims.Config.UserFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult UpdateAssignedUserDevicesLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false) { try { if (id < 0) - throw new ArgumentOutOfRangeException("id"); + throw new ArgumentOutOfRangeException(nameof(id)); var UserFlag = Database.UserFlags.Find(id); if (UserFlag == null) - throw new ArgumentException("Invalid User Flag Id", "id"); + throw new ArgumentException("Invalid User Flag Id", nameof(id)); var syncTaskStatus = UpdateAssignedUserDevicesLinkedGroup(UserFlag, GroupId, FilterBeginDate); @@ -200,14 +210,14 @@ namespace Disco.Web.Areas.API.Controllers return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId)); } else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } catch (Exception ex) { if (redirect) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } #endregion @@ -347,6 +357,7 @@ namespace Disco.Web.Areas.API.Controllers #region Actions [DiscoAuthorizeAll(Claims.Config.UserFlag.Configure, Claims.Config.UserFlag.Delete)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Delete(int id, bool? redirect = false) { try @@ -360,7 +371,7 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId)); else - return Json("OK", JsonRequestBehavior.AllowGet); + return Ok(); } throw new Exception("Invalid User Flag Id"); } @@ -369,11 +380,12 @@ namespace Disco.Web.Areas.API.Controllers if (redirect.HasValue && redirect.Value) throw; else - return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet); + return BadRequest(ex.Message); } } [DiscoAuthorizeAll(Claims.Config.UserFlag.Configure, Claims.User.Actions.AddFlags, Claims.User.Actions.RemoveFlags, Claims.User.ShowFlagAssignments)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult BulkAssignUsers(int id, bool Override, string UserIds = null, string Comments = null) { if (id < 0) diff --git a/Disco.Web/Areas/API/Models/DeviceModel/ComponentModel.cs b/Disco.Web/Areas/API/Models/DeviceModel/ComponentModel.cs index 74eff9cc..4970f544 100644 --- a/Disco.Web/Areas/API/Models/DeviceModel/ComponentModel.cs +++ b/Disco.Web/Areas/API/Models/DeviceModel/ComponentModel.cs @@ -1,8 +1,25 @@ -namespace Disco.Web.Areas.API.Models.DeviceModel +using System.Collections.Generic; +using System.Linq; + +namespace Disco.Web.Areas.API.Models.DeviceModel { public class ComponentModel { - public _ComponentModel Component { get; set; } - public string Result { get; set; } + public int Id { get; set; } + public string Description { get; set; } + public string Cost { get; set; } + public List JobSubTypes { get; set; } + + public static ComponentModel FromDeviceComponent(Disco.Models.Repository.DeviceComponent dc) + { + return new ComponentModel + { + Id = dc.Id, + Description = dc.Description, + Cost = dc.Cost.ToString("C"), + JobSubTypes = dc.JobSubTypes.Select(j => $"{j.JobTypeId}_{j.Id}").ToList() + }; + + } } -} \ No newline at end of file +} diff --git a/Disco.Web/Areas/API/Models/DeviceModel/_ComponentModel.cs b/Disco.Web/Areas/API/Models/DeviceModel/_ComponentModel.cs deleted file mode 100644 index e39c537a..00000000 --- a/Disco.Web/Areas/API/Models/DeviceModel/_ComponentModel.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -namespace Disco.Web.Areas.API.Models.DeviceModel -{ - public class _ComponentModel - { - public int Id { get; set; } - public string Description { get; set; } - public string Cost { get; set; } - public List JobSubTypes { get; set; } - - public static _ComponentModel FromDeviceComponent(Disco.Models.Repository.DeviceComponent dc) - { - return new _ComponentModel - { - Id = dc.Id, - Description = dc.Description, - Cost = dc.Cost.ToString("C"), - JobSubTypes = dc.JobSubTypes.Select(j => $"{j.JobTypeId}_{j.Id}").ToList() - }; - - } - } -} \ No newline at end of file diff --git a/Disco.Web/Areas/API/Models/Job/ComponentModel.cs b/Disco.Web/Areas/API/Models/Job/ComponentModel.cs index 370a41d9..d01aa2ed 100644 --- a/Disco.Web/Areas/API/Models/Job/ComponentModel.cs +++ b/Disco.Web/Areas/API/Models/Job/ComponentModel.cs @@ -2,7 +2,18 @@ { public class ComponentModel { - public _ComponentModel Component { get; set; } - public string Result { get; set; } + public int Id { get; set; } + public string Description { get; set; } + public string Cost { get; set; } + + public static ComponentModel FromJobComponent(Disco.Models.Repository.JobComponent jc) + { + return new ComponentModel + { + Id = jc.Id, + Description = jc.Description, + Cost = jc.Cost.ToString("C") + }; + } } } \ No newline at end of file diff --git a/Disco.Web/Areas/API/Models/Job/_ComponentModel.cs b/Disco.Web/Areas/API/Models/Job/_ComponentModel.cs deleted file mode 100644 index c9940671..00000000 --- a/Disco.Web/Areas/API/Models/Job/_ComponentModel.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Disco.Web.Areas.API.Models.Job -{ - public class _ComponentModel - { - public int Id { get; set; } - public string Description { get; set; } - public string Cost { get; set; } - - public static _ComponentModel FromJobComponent(Disco.Models.Repository.JobComponent jc) - { - return new _ComponentModel - { - Id = jc.Id, - Description = jc.Description, - Cost = jc.Cost.ToString("C") - }; - } - } -} \ No newline at end of file diff --git a/Disco.Web/Areas/Config/Controllers/AuthorizationRoleController.cs b/Disco.Web/Areas/Config/Controllers/AuthorizationRoleController.cs index cc1f90d2..d34b1b10 100644 --- a/Disco.Web/Areas/Config/Controllers/AuthorizationRoleController.cs +++ b/Disco.Web/Areas/Config/Controllers/AuthorizationRoleController.cs @@ -17,6 +17,7 @@ namespace Disco.Web.Areas.Config.Controllers [DiscoAuthorize(Claims.DiscoAdminAccount)] public partial class AuthorizationRoleController : AuthorizedDatabaseController { + [HttpGet] public virtual ActionResult Index(int? id) { if (id.HasValue) @@ -72,13 +73,11 @@ namespace Disco.Web.Areas.Config.Controllers } } + [HttpGet] public virtual ActionResult Create() { // Default Role - var m = new Models.AuthorizationRole.CreateModel() - { - AuthorizationRole = new Disco.Models.Repository.AuthorizationRole() - }; + var m = new Models.AuthorizationRole.CreateModel(); // UI Extensions UIExtensions.ExecuteExtensions(ControllerContext, m); @@ -86,16 +85,16 @@ namespace Disco.Web.Areas.Config.Controllers return View(m); } - [HttpPost] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Create(Models.AuthorizationRole.CreateModel model) { if (ModelState.IsValid) { // Check for Existing - var existing = Database.AuthorizationRoles.Where(m => m.Name == model.AuthorizationRole.Name).FirstOrDefault(); + var existing = Database.AuthorizationRoles.Where(m => m.Name == model.Name).FirstOrDefault(); if (existing == null) { - var roleId = UserService.CreateAuthorizationRole(Database, model.AuthorizationRole); + var roleId = UserService.CreateAuthorizationRole(Database, model.Name); return RedirectToAction(MVC.Config.AuthorizationRole.Index(roleId)); } diff --git a/Disco.Web/Areas/Config/Controllers/DeviceBatchController.cs b/Disco.Web/Areas/Config/Controllers/DeviceBatchController.cs index 8e7f4927..052ef399 100644 --- a/Disco.Web/Areas/Config/Controllers/DeviceBatchController.cs +++ b/Disco.Web/Areas/Config/Controllers/DeviceBatchController.cs @@ -6,6 +6,7 @@ using Disco.Services.Devices; using Disco.Services.Devices.ManagedGroups; using Disco.Services.Plugins.Features.UIExtension; using Disco.Services.Web; +using Disco.Web.Areas.Config.Models.DeviceBatch; using System; using System.Linq; using System.Web.Mvc; @@ -24,7 +25,7 @@ namespace Disco.Web.Areas.Config.Controllers var m = Database.DeviceBatches .Include(nameof(DeviceBatch.DeviceBatchAttachments)) .Where(db => db.Id == id.Value) - .Select(db => new Models.DeviceBatch.ShowModel() + .Select(db => new ShowModel() { DeviceBatch = db, DeviceCount = db.Devices.Count(), @@ -34,7 +35,7 @@ namespace Disco.Web.Areas.Config.Controllers if (m == null || m.DeviceBatch == null) throw new ArgumentException("Invalid Device Batch Id", "id"); - m.DeviceModelMembers = m.DeviceBatch.Devices.GroupBy(d => d.DeviceModel).Select(dG => new Models.DeviceBatch._ShowModelMembership() + m.DeviceModelMembers = m.DeviceBatch.Devices.GroupBy(d => d.DeviceModel).Select(dG => new _ShowModelMembership() { DeviceModel = dG.Key, DeviceCount = dG.Count(), @@ -82,9 +83,9 @@ namespace Disco.Web.Areas.Config.Controllers public virtual ActionResult Create() { // Default Batch - var m = new Models.DeviceBatch.CreateModel() + var m = new CreateModel() { - DeviceBatch = DeviceBatches.DefaultNewDeviceBatch(Database) + PurchaseDate = DateTime.Today, }; // UI Extensions @@ -93,22 +94,28 @@ namespace Disco.Web.Areas.Config.Controllers return View(m); } - [DiscoAuthorizeAll(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.Configure), HttpPost] - public virtual ActionResult Create(Models.DeviceBatch.CreateModel model) + [DiscoAuthorizeAll(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.Configure)] + [HttpPost, ValidateAntiForgeryToken] + public virtual ActionResult Create(CreateModel model) { if (ModelState.IsValid) { // Check for Existing - var existing = Database.DeviceBatches.Where(m => m.Name == model.DeviceBatch.Name).FirstOrDefault(); - if (existing == null) + var alreadyExists = Database.DeviceBatches.Any(m => m.Name == model.Name); + if (!alreadyExists) { - Database.DeviceBatches.Add(model.DeviceBatch); + var batch = new DeviceBatch() + { + Name = model.Name, + PurchaseDate = model.PurchaseDate, + }; + Database.DeviceBatches.Add(batch); Database.SaveChanges(); - return RedirectToAction(MVC.Config.DeviceBatch.Index(model.DeviceBatch.Id)); + return RedirectToAction(MVC.Config.DeviceBatch.Index(batch.Id)); } else { - ModelState.AddModelError("Name", "A Device Batch with this name already exists."); + ModelState.AddModelError(nameof(CreateModel.Name), "A Device Batch with this name already exists."); } } @@ -121,7 +128,7 @@ namespace Disco.Web.Areas.Config.Controllers [DiscoAuthorize(Claims.Config.DeviceBatch.ShowTimeline)] public virtual ActionResult Timeline() { - var m = new Models.DeviceBatch.TimelineModel(); + var m = new TimelineModel(); // UI Extensions UIExtensions.ExecuteExtensions(ControllerContext, m); diff --git a/Disco.Web/Areas/Config/Controllers/DeviceFlagController.cs b/Disco.Web/Areas/Config/Controllers/DeviceFlagController.cs index 0495c961..9eef3f4b 100644 --- a/Disco.Web/Areas/Config/Controllers/DeviceFlagController.cs +++ b/Disco.Web/Areas/Config/Controllers/DeviceFlagController.cs @@ -79,14 +79,7 @@ namespace Disco.Web.Areas.Config.Controllers public virtual ActionResult Create() { // Default Queue - var m = new CreateModel() - { - DeviceFlag = new DeviceFlag() - { - Icon = DeviceFlagService.RandomUnusedIcon(), - IconColour = DeviceFlagService.RandomUnusedThemeColour() - } - }; + var m = new CreateModel(); // UI Extensions UIExtensions.ExecuteExtensions(ControllerContext, m); @@ -94,16 +87,17 @@ namespace Disco.Web.Areas.Config.Controllers return View(m); } - [DiscoAuthorizeAll(Claims.Config.DeviceFlag.Create, Claims.Config.DeviceFlag.Configure), HttpPost] + [DiscoAuthorizeAll(Claims.Config.DeviceFlag.Create, Claims.Config.DeviceFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Create(CreateModel model) { if (ModelState.IsValid) { // Check for Existing - var existing = Database.DeviceFlags.Where(m => m.Name == model.DeviceFlag.Name).FirstOrDefault(); + var existing = Database.DeviceFlags.Where(m => m.Name == model.Name).FirstOrDefault(); if (existing == null) { - var flag = DeviceFlagService.CreateDeviceFlag(Database, model.DeviceFlag); + var flag = DeviceFlagService.CreateDeviceFlag(Database, model.Name, model.Description); return RedirectToAction(MVC.Config.DeviceFlag.Index(flag.Id)); } diff --git a/Disco.Web/Areas/Config/Controllers/DeviceProfileController.cs b/Disco.Web/Areas/Config/Controllers/DeviceProfileController.cs index 5bf4c632..a9490e1b 100644 --- a/Disco.Web/Areas/Config/Controllers/DeviceProfileController.cs +++ b/Disco.Web/Areas/Config/Controllers/DeviceProfileController.cs @@ -105,18 +105,10 @@ namespace Disco.Web.Areas.Config.Controllers } [DiscoAuthorizeAll(Claims.Config.DeviceProfile.Create, Claims.Config.DeviceProfile.Configure)] + [HttpGet] public virtual ActionResult Create() { - var m = new Models.DeviceProfile.CreateModel() - { - DeviceProfile = new DeviceProfile() - { - ComputerNameTemplate = DeviceProfile.DefaultComputerNameTemplate, - ProvisionADAccount = true, - DistributionType = DeviceProfile.DistributionTypes.OneToMany, - OrganisationalUnit = ActiveDirectory.Context.PrimaryDomain.DefaultComputerContainer - } - }; + var m = new Models.DeviceProfile.CreateModel(); // UI Extensions UIExtensions.ExecuteExtensions(ControllerContext, m); @@ -124,20 +116,30 @@ namespace Disco.Web.Areas.Config.Controllers return View(m); } - [DiscoAuthorizeAll(Claims.Config.DeviceProfile.Create, Claims.Config.DeviceProfile.Configure), HttpPost] + [DiscoAuthorizeAll(Claims.Config.DeviceProfile.Create, Claims.Config.DeviceProfile.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Create(Models.DeviceProfile.CreateModel model) { if (ModelState.IsValid) { // Check for Existing - var existing = Database.DeviceProfiles.Where(m => m.Name == model.DeviceProfile.Name).FirstOrDefault(); - if (existing == null) + var existingName = Database.DeviceProfiles.Any(m => m.Name.Equals(model.Name, StringComparison.OrdinalIgnoreCase)); + if (!existingName) { - model.DeviceProfile.ProvisionADAccount = true; + var deviceProfile = new DeviceProfile() + { + Name = model.Name, + ShortName = model.ShortName, + Description = model.Description, + ProvisionADAccount = true, + ComputerNameTemplate = DeviceProfile.DefaultComputerNameTemplate, + DistributionType = DeviceProfile.DistributionTypes.OneToMany, + OrganisationalUnit = ActiveDirectory.Context.PrimaryDomain.DefaultComputerContainer + }; - Database.DeviceProfiles.Add(model.DeviceProfile); + Database.DeviceProfiles.Add(deviceProfile); Database.SaveChanges(); - return RedirectToAction(MVC.Config.DeviceProfile.Index(model.DeviceProfile.Id)); + return RedirectToAction(MVC.Config.DeviceProfile.Index(deviceProfile.Id)); } else { diff --git a/Disco.Web/Areas/Config/Controllers/DocumentTemplateController.cs b/Disco.Web/Areas/Config/Controllers/DocumentTemplateController.cs index 03791514..00158416 100644 --- a/Disco.Web/Areas/Config/Controllers/DocumentTemplateController.cs +++ b/Disco.Web/Areas/Config/Controllers/DocumentTemplateController.cs @@ -23,7 +23,7 @@ namespace Disco.Web.Areas.Config.Controllers public partial class DocumentTemplateController : AuthorizedDatabaseController { [DiscoAuthorize(Claims.Config.DocumentTemplate.Show)] - public virtual ActionResult Index(string id, string bulkGenerateId = null, string bulkGenerateFilename = null) + public virtual ActionResult Index(string id, Guid? bulkGenerateId = null, string bulkGenerateFilename = null) { if (string.IsNullOrEmpty(id)) { @@ -76,6 +76,7 @@ namespace Disco.Web.Areas.Config.Controllers } } + [DiscoAuthorize(Claims.Config.DocumentTemplate.Show)] public virtual ActionResult ShowPackage(string id) { // Document Template Package @@ -139,7 +140,8 @@ namespace Disco.Web.Areas.Config.Controllers return View(m); } - [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure), HttpPost] + [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Create(CreateModel model) { model.UpdateModel(Database); @@ -147,27 +149,30 @@ namespace Disco.Web.Areas.Config.Controllers if (ModelState.IsValid) { // Check for Existing - var existing = Database.DocumentTemplates.Where(m => m.Id == model.DocumentTemplate.Id).FirstOrDefault(); + var existing = Database.DocumentTemplates.Where(m => m.Id == model.Id).FirstOrDefault(); if (existing == null) { - - Database.DocumentTemplates.Add(model.DocumentTemplate); - - if (model.DocumentTemplate.Scope == DocumentTemplate.DocumentTemplateScopes.Job) + var template = new DocumentTemplate() { - model.DocumentTemplate.JobSubTypes = model.GetJobSubTypes(); - } + Id = model.Id, + Description = model.Description, + Scope = model.Scope, + }; + if (model.Scope == DocumentTemplate.DocumentTemplateScopes.Job) + template.JobSubTypes = model.GetJobSubTypes(); + + Database.DocumentTemplates.Add(template); Database.SaveChanges(); // Save Template - model.DocumentTemplate.SavePdfTemplate(Database, model.Template.InputStream); + template.SavePdfTemplate(Database, model.Template.InputStream); - return RedirectToAction(MVC.Config.DocumentTemplate.Index(model.DocumentTemplate.Id)); + return RedirectToAction(MVC.Config.DocumentTemplate.Index(template.Id)); } else { - ModelState.AddModelError("Id", "A Document Template with this Id already exists."); + ModelState.AddModelError(nameof(DocumentTemplate.Id), "A Document Template with this Id already exists."); } } @@ -188,18 +193,19 @@ namespace Disco.Web.Areas.Config.Controllers return View(m); } - [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure), HttpPost] + [DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult CreatePackage(CreatePackageModel model) { if (ModelState.IsValid) { // Check for Existing - var existing = DocumentTemplatePackages.GetPackage(model.Package.Id); + var existing = DocumentTemplatePackages.GetPackage(model.Id); if (existing == null) { - DocumentTemplatePackages.CreatePackage(model.Package); + DocumentTemplatePackages.CreatePackage(model.Id, model.Description, model.Scope); - return RedirectToAction(MVC.Config.DocumentTemplate.ShowPackage(model.Package.Id)); + return RedirectToAction(MVC.Config.DocumentTemplate.ShowPackage(model.Id)); } else { diff --git a/Disco.Web/Areas/Config/Controllers/JobQueueController.cs b/Disco.Web/Areas/Config/Controllers/JobQueueController.cs index c96443c7..07fcbc35 100644 --- a/Disco.Web/Areas/Config/Controllers/JobQueueController.cs +++ b/Disco.Web/Areas/Config/Controllers/JobQueueController.cs @@ -78,18 +78,11 @@ namespace Disco.Web.Areas.Config.Controllers } [DiscoAuthorizeAll(Claims.Config.JobQueue.Create, Claims.Config.JobQueue.Configure)] + [HttpGet] public virtual ActionResult Create() { // Default Queue - var m = new Models.JobQueue.CreateModel() - { - JobQueue = new JobQueue() - { - Icon = JobQueueService.RandomUnusedIcon(), - IconColour = JobQueueService.RandomUnusedThemeColour(), - Priority = JobQueuePriority.Normal - } - }; + var m = new Models.JobQueue.CreateModel(); // UI Extensions UIExtensions.ExecuteExtensions(ControllerContext, m); @@ -97,16 +90,17 @@ namespace Disco.Web.Areas.Config.Controllers return View(m); } - [DiscoAuthorizeAll(Claims.Config.JobQueue.Create, Claims.Config.JobQueue.Configure), HttpPost] + [DiscoAuthorizeAll(Claims.Config.JobQueue.Create, Claims.Config.JobQueue.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Create(Models.JobQueue.CreateModel model) { if (ModelState.IsValid) { // Check for Existing - var existing = Database.JobQueues.Where(m => m.Name == model.JobQueue.Name).FirstOrDefault(); - if (existing == null) + var nameExists = Database.JobQueues.Any(m => m.Name.Equals(model.Name, StringComparison.Ordinal)); + if (!nameExists) { - var token = JobQueueService.CreateJobQueue(Database, model.JobQueue); + var token = JobQueueService.CreateJobQueue(Database, model.Name, model.Description); return RedirectToAction(MVC.Config.JobQueue.Index(token.JobQueue.Id)); } diff --git a/Disco.Web/Areas/Config/Controllers/PluginsController.cs b/Disco.Web/Areas/Config/Controllers/PluginsController.cs index d004d975..14862c78 100644 --- a/Disco.Web/Areas/Config/Controllers/PluginsController.cs +++ b/Disco.Web/Areas/Config/Controllers/PluginsController.cs @@ -23,7 +23,8 @@ namespace Disco.Web.Areas.Config.Controllers } #region Plugin Configuration - [DiscoAuthorize(Claims.Config.Plugin.Configure), HttpPost, ValidateInput(false)] + [DiscoAuthorize(Claims.Config.Plugin.Configure), ValidateInput(false)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Configure(string PluginId, FormCollection form) { if (string.IsNullOrEmpty(PluginId)) diff --git a/Disco.Web/Areas/Config/Controllers/UserFlagController.cs b/Disco.Web/Areas/Config/Controllers/UserFlagController.cs index dc2e84ef..56123b8d 100644 --- a/Disco.Web/Areas/Config/Controllers/UserFlagController.cs +++ b/Disco.Web/Areas/Config/Controllers/UserFlagController.cs @@ -1,5 +1,4 @@ using Disco.Models.Areas.Config.UI.UserFlag; -using Disco.Models.Repository; using Disco.Models.Services.Users.UserFlags; using Disco.Models.UI.Config.UserFlag; using Disco.Services.Authorization; @@ -76,17 +75,11 @@ namespace Disco.Web.Areas.Config.Controllers } [DiscoAuthorizeAll(Claims.Config.UserFlag.Create, Claims.Config.UserFlag.Configure)] + [HttpGet] public virtual ActionResult Create() { // Default Queue - var m = new CreateModel() - { - UserFlag = new UserFlag() - { - Icon = UserFlagService.RandomUnusedIcon(), - IconColour = UserFlagService.RandomUnusedThemeColour() - } - }; + var m = new CreateModel(); // UI Extensions UIExtensions.ExecuteExtensions(ControllerContext, m); @@ -94,22 +87,23 @@ namespace Disco.Web.Areas.Config.Controllers return View(m); } - [DiscoAuthorizeAll(Claims.Config.UserFlag.Create, Claims.Config.UserFlag.Configure), HttpPost] + [DiscoAuthorizeAll(Claims.Config.UserFlag.Create, Claims.Config.UserFlag.Configure)] + [HttpPost, ValidateAntiForgeryToken] public virtual ActionResult Create(CreateModel model) { if (ModelState.IsValid) { // Check for Existing - var existing = Database.UserFlags.Where(m => m.Name == model.UserFlag.Name).FirstOrDefault(); - if (existing == null) + var nameExists = Database.UserFlags.Any(m => m.Name.Equals(model.Name, StringComparison.Ordinal)); + if (!nameExists) { - var flag = UserFlagService.CreateUserFlag(Database, model.UserFlag); + var flag = UserFlagService.CreateUserFlag(Database, model.Name, model.Description); return RedirectToAction(MVC.Config.UserFlag.Index(flag.Id)); } else { - ModelState.AddModelError("Name", "A User Flag with this name already exists."); + ModelState.AddModelError(nameof(CreateModel.Name), "A User Flag with this name already exists."); } } diff --git a/Disco.Web/Areas/Config/Models/AuthorizationRole/CreateModel.cs b/Disco.Web/Areas/Config/Models/AuthorizationRole/CreateModel.cs index 917cedf6..772ead72 100644 --- a/Disco.Web/Areas/Config/Models/AuthorizationRole/CreateModel.cs +++ b/Disco.Web/Areas/Config/Models/AuthorizationRole/CreateModel.cs @@ -1,9 +1,11 @@ using Disco.Models.UI.Config.AuthorizationRole; +using System.ComponentModel.DataAnnotations; namespace Disco.Web.Areas.Config.Models.AuthorizationRole { public class CreateModel : ConfigAuthorizationRoleCreateModel { - public Disco.Models.Repository.AuthorizationRole AuthorizationRole { get; set; } + [Required, StringLength(100)] + public string Name { get; set; } } } \ No newline at end of file diff --git a/Disco.Web/Areas/Config/Models/DeviceBatch/CreateModel.cs b/Disco.Web/Areas/Config/Models/DeviceBatch/CreateModel.cs index c869332a..a51281f8 100644 --- a/Disco.Web/Areas/Config/Models/DeviceBatch/CreateModel.cs +++ b/Disco.Web/Areas/Config/Models/DeviceBatch/CreateModel.cs @@ -1,9 +1,15 @@ using Disco.Models.UI.Config.DeviceBatch; +using System; +using System.ComponentModel.DataAnnotations; namespace Disco.Web.Areas.Config.Models.DeviceBatch { public class CreateModel : ConfigDeviceBatchCreateModel { - public Disco.Models.Repository.DeviceBatch DeviceBatch { get; set; } + [Required, StringLength(500)] + public string Name { get; set; } + + [Required, DisplayFormat(ApplyFormatInEditMode = true, ConvertEmptyStringToNull = true, DataFormatString = "{0:yyyy/MM/dd}", HtmlEncode = false)] + public DateTime PurchaseDate { get; set; } } } \ No newline at end of file diff --git a/Disco.Web/Areas/Config/Models/DeviceFlag/CreateModel.cs b/Disco.Web/Areas/Config/Models/DeviceFlag/CreateModel.cs index c3d447c8..4e809253 100644 --- a/Disco.Web/Areas/Config/Models/DeviceFlag/CreateModel.cs +++ b/Disco.Web/Areas/Config/Models/DeviceFlag/CreateModel.cs @@ -1,9 +1,14 @@ using Disco.Models.UI.Config.DeviceFlag; +using System.ComponentModel.DataAnnotations; namespace Disco.Web.Areas.Config.Models.DeviceFlag { public class CreateModel : ConfigDeviceFlagCreateModel { - public Disco.Models.Repository.DeviceFlag DeviceFlag { get; set; } + [Required, StringLength(100)] + public string Name { get; set; } + + [StringLength(500), DataType(DataType.MultilineText)] + public string Description { get; set; } } } diff --git a/Disco.Web/Areas/Config/Models/DeviceProfile/CreateModel.cs b/Disco.Web/Areas/Config/Models/DeviceProfile/CreateModel.cs index a4c7e363..1b3eb81f 100644 --- a/Disco.Web/Areas/Config/Models/DeviceProfile/CreateModel.cs +++ b/Disco.Web/Areas/Config/Models/DeviceProfile/CreateModel.cs @@ -1,9 +1,17 @@ using Disco.Models.UI.Config.DeviceProfile; +using System.ComponentModel.DataAnnotations; namespace Disco.Web.Areas.Config.Models.DeviceProfile { public class CreateModel : ConfigDeviceProfileCreateModel { - public Disco.Models.Repository.DeviceProfile DeviceProfile { get; set; } + [Required, StringLength(100)] + public string Name { get; set; } + + [Required, StringLength(10)] + public string ShortName { get; set; } + + [StringLength(500), DataType(DataType.MultilineText)] + public string Description { get; set; } } } \ No newline at end of file diff --git a/Disco.Web/Areas/Config/Models/DocumentTemplate/CreateModel.cs b/Disco.Web/Areas/Config/Models/DocumentTemplate/CreateModel.cs index 4ae057c0..54523304 100644 --- a/Disco.Web/Areas/Config/Models/DocumentTemplate/CreateModel.cs +++ b/Disco.Web/Areas/Config/Models/DocumentTemplate/CreateModel.cs @@ -10,7 +10,13 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate [CustomValidation(typeof(CreateModelValidation), "ValidateCreateModel")] public class CreateModel : ConfigDocumentTemplateCreateModel { - public Disco.Models.Repository.DocumentTemplate DocumentTemplate { get; set; } + [StringLength(30), Required] + public string Id { get; set; } + + [StringLength(250), Required] + public string Description { get; set; } + [Required, StringLength(6)] + public string Scope { get; set; } [Required] public HttpPostedFileBase Template { get; set; } @@ -21,13 +27,8 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate public List JobTypes { get; set; } public List JobSubTypes { get; set; } - public List Scopes - { - get - { - return Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList(); - } - } + public List Scopes => + Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList(); public List GetJobTypes() { @@ -63,7 +64,7 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate public static ValidationResult ValidateCreateModel(CreateModel model) { - if (model.DocumentTemplate != null && model.DocumentTemplate.Scope == Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Job) + if (model.Scope == Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Job) { if (model.Types != null && model.SubTypes != null) { diff --git a/Disco.Web/Areas/Config/Models/DocumentTemplate/CreatePackageModel.cs b/Disco.Web/Areas/Config/Models/DocumentTemplate/CreatePackageModel.cs index bfe637d8..d3b0257d 100644 --- a/Disco.Web/Areas/Config/Models/DocumentTemplate/CreatePackageModel.cs +++ b/Disco.Web/Areas/Config/Models/DocumentTemplate/CreatePackageModel.cs @@ -1,20 +1,21 @@ -using Disco.Models.Services.Documents; +using Disco.Models.Repository; using Disco.Models.UI.Config.DocumentTemplate; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; namespace Disco.Web.Areas.Config.Models.DocumentTemplate { public class CreatePackageModel : ConfigDocumentTemplateCreatePackageModel { - public DocumentTemplatePackage Package { get; set; } + [StringLength(30), Required] + public string Id { get; set; } + [StringLength(250), Required] + public string Description { get; set; } + [Required] + public AttachmentTypes Scope { get; set; } public List Scopes - { - get - { - return Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList(); - } - } + => Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList(); } diff --git a/Disco.Web/Areas/Config/Models/DocumentTemplate/ShowModel.cs b/Disco.Web/Areas/Config/Models/DocumentTemplate/ShowModel.cs index 7e2c5534..ecf2970a 100644 --- a/Disco.Web/Areas/Config/Models/DocumentTemplate/ShowModel.cs +++ b/Disco.Web/Areas/Config/Models/DocumentTemplate/ShowModel.cs @@ -5,6 +5,7 @@ using Disco.Models.UI.Config.DocumentTemplate; using Disco.Services; using Disco.Services.Documents.ManagedGroups; using Disco.Services.Expressions; +using System; using System.Collections.Generic; using System.Linq; @@ -36,7 +37,7 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate public DocumentTemplateDevicesManagedGroup DevicesLinkedGroup { get; set; } public DocumentTemplateUsersManagedGroup UsersLinkedGroup { get; set; } - public string BulkGenerateDownloadId { get; set; } + public Guid? BulkGenerateDownloadId { get; set; } public string BulkGenerateDownloadFilename { get; set; } diff --git a/Disco.Web/Areas/Config/Models/JobQueue/CreateModel.cs b/Disco.Web/Areas/Config/Models/JobQueue/CreateModel.cs index ea1bb1d4..9973346c 100644 --- a/Disco.Web/Areas/Config/Models/JobQueue/CreateModel.cs +++ b/Disco.Web/Areas/Config/Models/JobQueue/CreateModel.cs @@ -1,9 +1,13 @@ using Disco.Models.UI.Config.JobQueue; +using System.ComponentModel.DataAnnotations; namespace Disco.Web.Areas.Config.Models.JobQueue { public class CreateModel : ConfigJobQueueCreateModel { - public Disco.Models.Repository.JobQueue JobQueue { get; set; } + [Required, StringLength(100)] + public string Name { get; set; } + [StringLength(500), DataType(DataType.MultilineText)] + public string Description { get; set; } } } \ No newline at end of file diff --git a/Disco.Web/Areas/Config/Models/UserFlag/CreateModel.cs b/Disco.Web/Areas/Config/Models/UserFlag/CreateModel.cs index 41594b91..5a6b6623 100644 --- a/Disco.Web/Areas/Config/Models/UserFlag/CreateModel.cs +++ b/Disco.Web/Areas/Config/Models/UserFlag/CreateModel.cs @@ -1,9 +1,14 @@ using Disco.Models.UI.Config.UserFlag; +using System.ComponentModel.DataAnnotations; namespace Disco.Web.Areas.Config.Models.UserFlag { public class CreateModel : ConfigUserFlagCreateModel { - public Disco.Models.Repository.UserFlag UserFlag { get; set; } + [Required, StringLength(100)] + public string Name { get; set; } + + [StringLength(500), DataType(DataType.MultilineText)] + public string Description { get; set; } } } \ No newline at end of file diff --git a/Disco.Web/Areas/Config/Views/AuthorizationRole/Create.cshtml b/Disco.Web/Areas/Config/Views/AuthorizationRole/Create.cshtml index ab13efa1..28686d41 100644 --- a/Disco.Web/Areas/Config/Views/AuthorizationRole/Create.cshtml +++ b/Disco.Web/Areas/Config/Views/AuthorizationRole/Create.cshtml @@ -4,7 +4,8 @@ ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles", MVC.Config.AuthorizationRole.Index(null), "Create"); } @using (Html.BeginForm()) -{ +{ + @Html.AntiForgeryToken()
@@ -12,7 +13,7 @@ Name:
- @Html.EditorFor(model => model.AuthorizationRole.Name)
@Html.ValidationMessageFor(model => model.AuthorizationRole.Name) + @Html.EditorFor(model => model.Name)
@Html.ValidationMessageFor(model => model.Name)
@@ -22,7 +23,7 @@
} diff --git a/Disco.Web/Areas/Config/Views/AuthorizationRole/Create.generated.cs b/Disco.Web/Areas/Config/Views/AuthorizationRole/Create.generated.cs index b9f56eb3..298e45af 100644 --- a/Disco.Web/Areas/Config/Views/AuthorizationRole/Create.generated.cs +++ b/Disco.Web/Areas/Config/Views/AuthorizationRole/Create.generated.cs @@ -57,7 +57,21 @@ WriteLiteral("\r\n"); #line 6 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml" using (Html.BeginForm()) -{ +{ + + + #line default + #line hidden + + #line 8 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml" +Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 8 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml" + #line default @@ -74,8 +88,8 @@ WriteLiteral(">\r\n \r\n \r\n \r\n \r\n WriteLiteral(" id=\"DeviceBatch_PurchaseDetails_Container\""); +WriteLiteral(" data-updateurl=\""); + + + #line 288 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + Write(Url.Action(MVC.API.DeviceBatch.UpdatePurchaseDetails(Model.DeviceBatch.Id))); + + + #line default + #line hidden +WriteLiteral("\""); + WriteLiteral(">\r\n
\r\n Details "); @@ -1120,60 +1131,38 @@ WriteLiteral(" - $(function () { - var model = { - $field: $('#DeviceBatch_PurchaseDetails'), - fieldName: 'PurchaseDetails', - $ajax_loading: null, - $ajax_ok: null, - updated: function () { - if (!model.$ajax_loading) - model.$ajax_loading = $('#ajax' + model.fieldName + '_loading'); - if (!model.$ajax_ok) - model.$ajax_ok = $('#ajax' + model.fieldName + '_ok'); - model.$ajax_loading.show(); - var data = {}; - data[model.fieldName] = model.$field.tinymce().getContent(); - $.ajax({ - url: '"); +WriteLiteral(">\r\n $(function () {\r\n c" + +"onst $field = $(\'#DeviceBatch_PurchaseDetails\');\r\n\r\n " + +" async function updated() {\r\n $(\'#ajaxPurc" + +"haseDetails_loading\').show();\r\n try {\r\n " + +" const body = new FormData();\r\n " + +" body.append(\'__RequestVerificationToken\', document.body." + +"dataset.antiforgery);\r\n body.append(\'purc" + +"haseDetails\', $field.tinymce().getContent())\r\n\r\n " + +" const response = await fetch($(\'#DeviceBatch_PurchaseDetails_Container\')" + +".attr(\'data-updateurl\'), {\r\n method: " + +"\'POST\',\r\n body: body\r\n " + +" });\r\n\r\n if (resp" + +"onse.ok) {\r\n $(\'#ajaxPurchaseDetails_" + +"ok\').show().delay(\'fast\').fadeOut(\'slow\');\r\n " + +" } else {\r\n alert(\'Unable to updat" + +"e purchase details: \' + response.statusText);\r\n " + +" }\r\n } catch (e) {\r\n " + +" alert(\'Unable to update purchase details: \' + e);\r\n " + +" }\r\n $(\'#ajaxPurch" + +"aseDetails_loading\').hide();\r\n }\r\n\r\n " + +" $field.tinymce({\r\n theme: " + +"\'simple\',\r\n add_unload_trigger: false,\r\n " + +" schema: \"html5\",\r\n " + +" statusbar: false,\r\n setup: function (ed)" + +" {\r\n ed.on(\'init\', function () {\r\n " + +" $(ed.getWin()).blur(function () { updated()" + +"; });\r\n });\r\n " + +" }\r\n });\r\n });\r" + +"\n \r\n"); - #line 311 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" - Write(Url.Action(MVC.API.DeviceBatch.UpdatePurchaseDetails(Model.DeviceBatch.Id))); - - - #line default - #line hidden -WriteLiteral("\',\r\n dataType: \'json\',\r\n " + -" data: data,\r\n " + -" traditional: true,\r\n type: \'PO" + -"ST\',\r\n success: function (d) {\r\n " + -" if (d == \'OK\') {\r\n " + -" model.$ajax_loading.hide();\r\n " + -" model.$ajax_ok.show().delay(\'fast\').fadeOut(\'s" + -"low\');\r\n } else {\r\n " + -" model.$ajax_loading.hide();\r\n " + -" alert(\'Unable to update purchase details:" + -" \' + d);\r\n }\r\n " + -" },\r\n error: " + -"function (jqXHR, textStatus, errorThrown) {\r\n " + -" alert(\'Unable to update purchase details: \' + errorThrown);\r\n " + -" model.$ajax_loading.hide();\r\n " + -" }\r\n })" + -"\r\n }\r\n };\r\n\r\n " + -" model.$field.tinymce({\r\n " + -" theme: \'simple\',\r\n add_unload_trig" + -"ger: false,\r\n schema: \"html5\",\r\n " + -" statusbar: false,\r\n se" + -"tup: function (ed) {\r\n ed.on(\'init\', func" + -"tion () {\r\n $(ed.getWin()).blur(model" + -".updated);\r\n });\r\n " + -" }\r\n });\r\n " + -" });\r\n \r\n"); - - - #line 346 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 335 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } else { @@ -1189,7 +1178,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>"); - #line 350 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 339 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } else { @@ -1197,14 +1186,14 @@ WriteLiteral("><None Specified>"); #line default #line hidden - #line 352 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 341 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(new HtmlString(Model.DeviceBatch.PurchaseDetails)); #line default #line hidden - #line 352 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 341 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } } @@ -1230,13 +1219,13 @@ WriteLiteral(">\r\n Valid Until:\r\n "
\r\n \r\n \r\n " + -" \r\n \r\n \r\n \r\n \r\n WriteLiteral(" id=\"DeviceBatch_Attachments\""); -WriteAttribute("class", Tuple.Create(" class=\"", 35231), Tuple.Create("\"", 35298) +WriteAttribute("class", Tuple.Create(" class=\"", 32441), Tuple.Create("\"", 32508) - #line 696 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" -, Tuple.Create(Tuple.Create("", 35239), Tuple.Create(canConfig ? "canAddAttachments" : "cannotAddAttachments" + #line 654 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" +, Tuple.Create(Tuple.Create("", 32449), Tuple.Create(canConfig ? "canAddAttachments" : "cannotAddAttachments" #line default #line hidden -, 35239), false) +, 32449), false) ); WriteLiteral(" data-uploadurl=\""); - #line 696 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 654 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Url.Action(MVC.API.DeviceBatch.AttachmentUpload(Model.DeviceBatch.Id, null))); @@ -2085,18 +2048,18 @@ WriteLiteral(" data-uploadurl=\""); #line hidden WriteLiteral("\""); -WriteLiteral(">\r\n"); - -WriteLiteral(" "); +WriteLiteral(" data-removeurl=\""); - #line 697 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" - Write(Html.AntiForgeryToken()); + #line 654 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + Write(Url.Action(MVC.API.DeviceBatch.AttachmentRemove())); #line default #line hidden -WriteLiteral("\r\n \r\n \r\n"); - #line 702 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 659 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 702 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 659 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (Model.DeviceBatch.DeviceBatchAttachments != null) { foreach (var attachment in Model.DeviceBatch.DeviceBatchAttachments) @@ -2125,20 +2088,20 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" (Url.Action(MVC.API.DeviceBatch.AttachmentDownload(attachment.Id)) + #line 663 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" +, Tuple.Create(Tuple.Create("", 33160), Tuple.Create(Url.Action(MVC.API.DeviceBatch.AttachmentDownload(attachment.Id)) #line default #line hidden -, 35927), false) +, 33160), false) ); WriteLiteral(" data-attachmentid=\""); - #line 706 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 663 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(attachment.Id); @@ -2149,7 +2112,7 @@ WriteLiteral("\""); WriteLiteral(" data-mimetype=\""); - #line 706 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 663 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(attachment.MimeType); @@ -2161,28 +2124,28 @@ WriteLiteral(">\r\n (attachment.Filename + #line 664 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" +, Tuple.Create(Tuple.Create("", 33364), Tuple.Create(attachment.Filename #line default #line hidden -, 36131), false) +, 33364), false) ); WriteLiteral(">\r\n (Url.Action(MVC.API.DeviceBatch.AttachmentThumbnail(attachment.Id)) + #line 665 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" +, Tuple.Create(Tuple.Create("", 33465), Tuple.Create(Url.Action(MVC.API.DeviceBatch.AttachmentThumbnail(attachment.Id)) #line default #line hidden -, 36232), false) +, 33465), false) ); WriteLiteral(" />\r\n \r\n " + @@ -2190,14 +2153,14 @@ WriteLiteral(" />\r\n \r\n WriteLiteral(" class=\"comments\""); -WriteAttribute("title", Tuple.Create(" title=\"", 36410), Tuple.Create("\"", 36438) +WriteAttribute("title", Tuple.Create(" title=\"", 33643), Tuple.Create("\"", 33671) - #line 710 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" -, Tuple.Create(Tuple.Create("", 36418), Tuple.Create(attachment.Comments + #line 667 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" +, Tuple.Create(Tuple.Create("", 33651), Tuple.Create(attachment.Comments #line default #line hidden -, 36418), false) +, 33651), false) ); WriteLiteral(">\r\n"); @@ -2205,8 +2168,8 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 711 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" - Write(attachment.Comments); + #line 668 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + Write(attachment.Comments ?? attachment.Filename); #line default @@ -2218,7 +2181,7 @@ WriteLiteral(" class=\"author\""); WriteLiteral(">"); - #line 712 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 669 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(attachment.TechUser.ToString()); @@ -2227,7 +2190,7 @@ WriteLiteral(">"); WriteLiteral(""); - #line 712 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 669 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (canConfig) { @@ -2240,7 +2203,7 @@ WriteLiteral(" class=\"remove fa fa-times-circle\""); WriteLiteral(">"); - #line 713 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 670 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } #line default @@ -2249,20 +2212,20 @@ WriteLiteral("(attachment.Timestamp.ToFullDateTime() + #line 670 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + , Tuple.Create(Tuple.Create("", 34010), Tuple.Create(attachment.Timestamp.ToFullDateTime() #line default #line hidden -, 36752), false) +, 34010), false) ); WriteLiteral(" data-livestamp=\""); - #line 713 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 670 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(attachment.Timestamp.ToUnixEpoc()); @@ -2273,7 +2236,7 @@ WriteLiteral("\""); WriteLiteral(">"); - #line 713 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 670 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(attachment.Timestamp.ToFullDateTime()); @@ -2282,7 +2245,7 @@ WriteLiteral(">"); WriteLiteral("\r\n \r\n"); - #line 715 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 672 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } } @@ -2292,13 +2255,13 @@ WriteLiteral("\r\n \r\n"); WriteLiteral(" \r\n"); - #line 718 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 675 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 718 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 675 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (canConfig) { @@ -2345,7 +2308,7 @@ WriteLiteral("> Are you sure?\r\n

\r\n " \r\n"); - #line 729 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 686 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } @@ -2377,7 +2340,7 @@ WriteLiteral(@"> $.connection.hub.qs = { DeviceBatchId: '"); - #line 749 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 706 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Model.DeviceBatch.Id); @@ -2422,7 +2385,7 @@ WriteLiteral("\' };\r\n\r\n $.connection.hub.reconnec " url: \'"); - #line 795 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 752 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Url.Action(MVC.API.DeviceBatch.Attachment())); @@ -2437,13 +2400,13 @@ WriteLiteral(@"', "); - #line 801 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 758 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 801 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 758 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (canConfig) { @@ -2457,7 +2420,7 @@ WriteLiteral("buildAttachment(a, true, quick);"); WriteLiteral("\r\n"); - #line 804 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 761 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } else { @@ -2472,7 +2435,7 @@ WriteLiteral("buildAttachment(a, false, quick);"); WriteLiteral("\r\n"); - #line 808 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 765 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } @@ -2499,7 +2462,7 @@ WriteLiteral(@" } else { e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '"); - #line 827 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 784 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Url.Action(MVC.API.DeviceBatch.AttachmentDownload())); @@ -2530,7 +2493,7 @@ WriteLiteral(@"/' + a.Id); img.attr('src', '"); - #line 849 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 806 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Url.Action(MVC.API.DeviceBatch.AttachmentThumbnail())); @@ -2576,13 +2539,13 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n " }\r\n\r\n"); - #line 901 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 858 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 901 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 858 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (canConfig) { @@ -2611,53 +2574,41 @@ WriteLiteral("\r\n //#region Add Attachments\r\n " attachmentUploader.uploadFiles();\r\n " + " });\r\n //#endregion\r\n " + "//#region Remove Attachments\r\n $attachmentOutput.find" + -"(\'span.remove\').click(removeAttachment);\r\n\r\n function" + -" removeAttachment() {\r\n $this = $(this).closest(\'" + -"a\');\r\n\r\n var data = { id: $this.attr(\'data-attach" + -"mentid\') };\r\n\r\n if (!$dialogRemoveAttachment) {\r\n" + -" $dialogRemoveAttachment = $(\'#dialogRemoveAt" + -"tachment\').dialog({\r\n resizable: false,\r\n" + -" height: 140,\r\n " + -" modal: true,\r\n autoOpen: fa" + -"lse\r\n });\r\n }\r" + -"\n\r\n $dialogRemoveAttachment.dialog(\"enable\");\r\n " + -" $dialogRemoveAttachment.dialog(\'option\', \'buttons\'" + -", {\r\n \"Remove\": function () {\r\n " + -" $dialogRemoveAttachment.dialog(\"disable\");\r\n " + -" $dialogRemoveAttachment.dialog(\"option\", \"buttons\"" + -", null);\r\n $.ajax({\r\n " + -" url: \'"); +"(\'span.remove\').on(\'click\', removeAttachment);\r\n\r\n fu" + +"nction removeAttachment() {\r\n const attachmentId " + +"= $(this).closest(\'a\').attr(\'data-attachmentid\');\r\n\r\n " + +" if (!$dialogRemoveAttachment) {\r\n $dialo" + +"gRemoveAttachment = $(\'#dialogRemoveAttachment\').dialog({\r\n " + +" resizable: false,\r\n he" + +"ight: 140,\r\n modal: true,\r\n " + +" autoOpen: false\r\n }" + +");\r\n }\r\n\r\n $dialog" + +"RemoveAttachment.dialog(\'option\', \'buttons\', {\r\n " + +" \"Remove\": function () {\r\n $dialogRemo" + +"veAttachment.dialog(\"option\", \"buttons\", null);\r\n\r\n " + +" const body = new FormData();\r\n " + +" body.append(\'__RequestVerificationToken\', document.body.dataset.antiforgery);\r\n" + +" body.append(\'id\', attachmentId);\r\n " + +" fetch($Attachments.attr(\'data-removeurl\'), {\r\n" + +" method: \'POST\',\r\n " + +" body: body\r\n })." + +"then(r => {\r\n if (!r.ok) {\r\n " + +" alert(\'Unable to remove attachment: \' + r" + +".statusText);\r\n }\r\n " + +" $dialogRemoveAttachment.dialog(\'close\');\r\n " + +" }).catch(e => {\r\n " + +" alert(\'Unable to remove attachment: \' + e);\r\n " + +" $dialogRemoveAttachment.dialog(\'close\');\r\n " + +" });\r\n },\r\n " + +" Cancel: function () {\r\n " + +" $(this).dialog(\"close\");\r\n }\r\n " + +" });\r\n\r\n $dialogRemoveAttachm" + +"ent.dialog(\'open\');\r\n\r\n return false;\r\n " + +" }\r\n //#endregion\r\n " + +" "); - #line 951 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" - Write(Url.Action(MVC.API.DeviceBatch.AttachmentRemove())); - - - #line default - #line hidden -WriteLiteral("\',\r\n dataType: \'json\',\r\n " + -" data: data,\r\n " + -" success: function (d) {\r\n " + -"if (d == \'OK\') {\r\n // Do noth" + -"ing, await SignalR notification\r\n " + -" } else {\r\n alert(\'Unable to " + -"remove attachment: \' + d);\r\n }\r\n " + -" $dialogRemoveAttachment.dialog(\"c" + -"lose\");\r\n },\r\n " + -" error: function (jqXHR, textStatus, errorThrown) {\r\n " + -" alert(\'Unable to remove attachment: \' +" + -" textStatus);\r\n $dialogRemoveAtta" + -"chment.dialog(\"close\");\r\n }\r\n " + -" });\r\n },\r\n " + -" Cancel: function () {\r\n " + -" $dialogRemoveAttachment.dialog(\"close\");\r\n " + -" }\r\n });\r\n\r\n " + -" $dialogRemoveAttachment.dialog(\'open\');\r\n\r\n " + -" return false;\r\n }\r\n //#" + -"endregion\r\n "); - - - #line 978 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 930 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } @@ -2680,13 +2631,13 @@ WriteLiteral(@" "); - #line 993 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 945 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 993 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 945 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (hideAdvanced) { @@ -2720,7 +2671,7 @@ WriteLiteral(@">Show Advanced Options "); - #line 1009 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 961 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } @@ -2736,7 +2687,7 @@ WriteLiteral(">\r\n
\r\n
\r WriteLiteral(" "); - #line 15 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml" - Write(Html.EditorFor(model => model.AuthorizationRole.Name)); + #line 16 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml" + Write(Html.EditorFor(model => model.Name)); #line default @@ -83,8 +97,8 @@ WriteLiteral(" "); WriteLiteral("
"); - #line 15 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml" - Write(Html.ValidationMessageFor(model => model.AuthorizationRole.Name)); + #line 16 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml" + Write(Html.ValidationMessageFor(model => model.Name)); #line default @@ -107,11 +121,11 @@ WriteLiteral(" \r\n $(function () {\r\n $(\'#AuthorizationRole_Name\').focus().sele" + -"ct();\r\n });\r\n \r\n"); +WriteLiteral(">\r\n $(function () {\r\n $(\'#Name\').focus().select();\r\n });" + +"\r\n \r\n"); - #line 28 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml" + #line 29 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml" } diff --git a/Disco.Web/Areas/Config/Views/AuthorizationRole/Index.cshtml b/Disco.Web/Areas/Config/Views/AuthorizationRole/Index.cshtml index b45b8140..c017e1eb 100644 --- a/Disco.Web/Areas/Config/Views/AuthorizationRole/Index.cshtml +++ b/Disco.Web/Areas/Config/Views/AuthorizationRole/Index.cshtml @@ -7,15 +7,17 @@ {

No authorization roles are configured

-
+ } else { - - @foreach (var item in Model.Tokens) @@ -39,58 +41,75 @@ else
Name + + Name Linked Groups/Users + + Linked Groups/Users
} -
-
- None Associated -
    - @foreach (var sg in Model.AdministratorSubjects) - { - var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id); -
  • @if (sg.IsGroup) - { - @displayName - } - else - { - @displayName - }
  • - } -
-
+
+ @using (Html.BeginForm(MVC.API.AuthorizationRole.UpdateAdministratorSubjects(null, true))) + { + @Html.AntiForgeryToken() +
+ None Associated +
    + @foreach (var sg in Model.AdministratorSubjects) + { + var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id); +
  • + + @if (sg.IsGroup) + { + @displayName + } + else + { + @displayName + } +
  • + } +
+
+ }
- Add +
-
\r\n\r\nAdd\r\n
\r\n\r\n\r\n\r\nUpdate Disco ICT Administrators ["); - #line 226 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml" + #line 215 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml" Write(Model.AdministratorSubjects.Count); @@ -482,7 +511,7 @@ WriteLiteral("]\r\n"); WriteLiteral(" "); - #line 227 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml" + #line 216 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml" Write(Html.ActionLinkButton("Create Authorization Role", MVC.Config.AuthorizationRole.Create())); diff --git a/Disco.Web/Areas/Config/Views/AuthorizationRole/Show.cshtml b/Disco.Web/Areas/Config/Views/AuthorizationRole/Show.cshtml index a86e2b28..a41fa141 100644 --- a/Disco.Web/Areas/Config/Views/AuthorizationRole/Show.cshtml +++ b/Disco.Web/Areas/Config/Views/AuthorizationRole/Show.cshtml @@ -11,16 +11,19 @@
- - - \r\n \r\n \r\n\r\n\r\n Delete\r\n \r\n

\r\n \r\n"); + + + #line 307 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + + + #line default + #line hidden + + #line 307 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + using (Html.BeginForm(MVC.API.AuthorizationRole.Delete(Model.Token.Role.Id, true))) + { + + + #line default + #line hidden + + #line 309 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 309 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + + } + + + #line default + #line hidden +WriteLiteral("

\r\n $(function () { - var button = $('#Config_AuthRoles_Actions_Delete_Button'); - var buttonDialog = $('#Config_AuthRoles_Actions_Delete_Dialog'); - var buttonLink = button.attr('href'); - button.attr('href', '#'); - button.click(function () { - buttonDialog.dialog('open'); - return false; - }); - buttonDialog.dialog({ - resizable: false, - modal: true, - autoOpen: false, - buttons: { - ""Delete"": function () { - var $this = $(this); - $this.dialog(""disable""); - $this.dialog(""option"", ""buttons"", null); - window.location.href = buttonLink; - }, - Cancel: function () { - $(this).dialog(""close""); - } + let buttonDialog = null; + $('#Config_AuthRoles_Actions_Delete_Button').click(function () { + if (!buttonDialog) { + buttonDialog = $('#Config_AuthRoles_Actions_Delete_Dialog').dialog({ + resizable: false, + modal: true, + autoOpen: false, + buttons: { + ""Delete"": function () { + $(this) + .dialog(""option"", ""buttons"", null) + .find('form').trigger('submit'); + }, + Cancel: function () { + $(this).dialog(""close""); + } + } + }); } + buttonDialog.dialog('open'); }); + }); diff --git a/Disco.Web/Areas/Config/Views/DeviceBatch/Create.cshtml b/Disco.Web/Areas/Config/Views/DeviceBatch/Create.cshtml index c1c85096..dff4e1a2 100644 --- a/Disco.Web/Areas/Config/Views/DeviceBatch/Create.cshtml +++ b/Disco.Web/Areas/Config/Views/DeviceBatch/Create.cshtml @@ -4,20 +4,21 @@ ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Create"); } @using (Html.BeginForm()) -{ +{ + @Html.AntiForgeryToken() @Html.ValidationSummary(false)

Id: + + Id: @Html.DisplayFor(model => model.Token.Role.Id)
Name: + + Name: @Html.EditorFor(model => model.Token.Role.Name) + + @Html.EditorFor(model => model.Token.Role.Name) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader() @@ -248,13 +237,16 @@
- Save Changes@AjaxHelpers.AjaxLoader() + @AjaxHelpers.AjaxLoader()
+ diff --git a/Disco.Web/Areas/Config/Views/AuthorizationRole/Show.generated.cs b/Disco.Web/Areas/Config/Views/AuthorizationRole/Show.generated.cs index 9a3f6064..7e5d5eae 100644 --- a/Disco.Web/Areas/Config/Views/AuthorizationRole/Show.generated.cs +++ b/Disco.Web/Areas/Config/Views/AuthorizationRole/Show.generated.cs @@ -74,22 +74,24 @@ WriteLiteral(">\r\n \r\n \r\n Id:\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \")\r\n " + +" .data(\"item.autocomplete\", item)\r\n " + +" .append(\"\" + item.Name + \"
\" + item.Id + \" (\" + item.Type + \")
\")\r\n " + +" .appendTo(ul);\r\n };\r\n\r\n " + +" $(\'#Config_AuthRoles_Subjects_Update_Dialog_A" + +"dd\').on(\'click\', add);\r\n }\r\n\r\n " + +" dialog.dialog(\'open\');\r\n\r\n updateNoS" + +"ubjects();\r\n return false;\r\n " + +" }\r\n\r\n async function add() {\r\n " + +" const id = textAdd.val();\r\n\r\n try" + +" {\r\n const body = new FormData();\r\n " + +" body.append(\'__RequestVerificationToken\', document.bod" + +"y.dataset.antiforgery);\r\n body.append(\'id\', i" + +"d);\r\n const response = await fetch(dialog.att" + +"r(\'data-subjecturl\'), {\r\n method: \'POST\'," + +"\r\n body: body\r\n " + +" });\r\n\r\n if (response.ok) {\r\n " + +" const data = await response.json();\r\n\r\n " + +" if (!data)\r\n " + +" throw \'Unknown user id\';\r\n\r\n if (" + +"!data.IsGroup && !data.IsUserAccount)\r\n " + +" throw data.Name + \' [\' + data.Id + \'] is a \' + data.Type + \'. Only users and " + +"groups can be added.\';\r\n\r\n if (list.find(" + +"\'li[data-subjectid=\"\' + data.Id.replace(\'\\\\\', \'\\\\\\\\\') + \'\"]\').length != 0) {\r\n " + +" throw \'That subject has already been a" + +"dded\';\r\n }\r\n\r\n " + +" const liIcon = $(\'\').addClass(\'fa fa-lg\');\r\n " + +" if (data.Type === \'user\')\r\n " + +" liIcon.addClass(\'fa-user\');\r\n " + +"else\r\n liIcon.addClass(\'fa-users\');\r\n" + +"\r\n const li = $(\'
  • \')\r\n " + +" .append($(\'\').attr({ type: \'hidden\', name: \'s" + +"ubjects\', value: data.Id }))\r\n .appen" + +"d(liIcon)\r\n .append($(\'\').text(" + +"data.Id == data.Name ? data.Id : data.Name + \' [\' + data.Id + \']\'))\r\n " + +" .append($(\'\').addClass(\'fa fa-times-circle r" + +"emove\'))\r\n .addClass(data.Type)\r\n " + +" .attr(\'data-subjectid\', data.Id)\r\n " + +" .attr(\'data-subjectstatus\', \'new\');\r\n\r\n " + +" list.append(li);\r\n " + +" textAdd.val(\'\');\r\n\r\n updat" + +"eNoSubjects();\r\n } else {\r\n " + +" alert(\'Error: \' + response.statusText);\r\n " + +" }\r\n\r\n } catch (e) {\r\n " + +" alert(\'Error: \' + e);\r\n " + +" }\r\n\r\n return false;\r\n " + +" }\r\n\r\n function updateNoSubjects() {\r\n " + +" if (list.find(\'li:visible\').length > 0)\r\n " + +" noSubjects.hide();\r\n else\r\n " + +" noSubjects.show();\r\n }\r\n" + +"\r\n function saveChanges() {\r\n " + +" dialog\r\n .dialog(\"option\", \"buttons\"," + +" null)\r\n .find(\'form\').trigger(\'submit\');\r\n " + +" }\r\n\r\n $(\'#Config_AuthRoles_" + +"Subjects_Update\').click(showDialog);\r\n })();\r\n " + +" \r\n \r\n \r\n
  • \r\n " + +" \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n Save Changes"); +WriteLiteral(" data-saveurl=\""); - #line 251 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" - Write(AjaxHelpers.AjaxLoader()); + #line 240 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + Write(Url.Action(MVC.API.AuthorizationRole.UpdateClaims(Model.Token.Role.Id))); #line default #line hidden -WriteLiteral("\r\n
    \r\n - -
    -
    \r\n"); +WriteLiteral(">\r\n Id:\r\n \r\n \r\n"); WriteLiteral(" "); - #line 17 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + #line 18 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" Write(Html.DisplayFor(model => model.Token.Role.Id)); #line default #line hidden -WriteLiteral("\r\n
    Name:\r\n " + -" "); +WriteLiteral("\r\n
    \r\n " + +" Name:\r\n \r\n"); + +WriteLiteral(" "); - #line 23 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + #line 26 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" Write(Html.EditorFor(model => model.Token.Role.Name)); @@ -100,7 +102,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 24 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + #line 27 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" Write(AjaxHelpers.AjaxSave()); @@ -111,7 +113,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 25 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + #line 28 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" Write(AjaxHelpers.AjaxLoader()); @@ -126,7 +128,7 @@ WriteLiteral(">\r\n $(function () {\r\n "\r\n \'Invalid Name\',\r\n \'"); - #line 31 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + #line 34 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" Write(Url.Action(MVC.API.AuthorizationRole.UpdateName(Model.Token.Role.Id))); @@ -137,13 +139,13 @@ WriteLiteral("\',\r\n \'RoleName\'\r\n "
    Linked Groups/Users:\r\n"); - #line 41 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + #line 44 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" #line default #line hidden - #line 41 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + #line 44 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" if (Model.Token.SubjectIds.Count == 0) { @@ -157,7 +159,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral(">None Associated\r\n"); - #line 44 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + #line 47 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" } else { @@ -174,13 +176,13 @@ WriteLiteral(" class=\"none\""); WriteLiteral(">\r\n"); - #line 48 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + #line 51 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" #line default #line hidden - #line 48 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + #line 51 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" foreach (var sg in Model.Subjects) { var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id); @@ -190,66 +192,72 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" (sg.IsGroup ? "group" : "user" + #line 54 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" +, Tuple.Create(Tuple.Create("", 2258), Tuple.Create(sg.IsGroup ? "group" : "user" #line default #line hidden -, 2204), false) +, 2258), false) ); -WriteLiteral(">"); +WriteLiteral(">\r\n"); - #line 51 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" - if (sg.IsGroup) - { + #line 55 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + + + #line default + #line hidden + + #line 55 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + if (sg.IsGroup) + { #line default #line hidden -WriteLiteral(" "); - #line 53 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" - + #line 57 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + #line default #line hidden - #line 53 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" - Write(displayName); - - - #line default - #line hidden - - #line 53 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" - - } - else - { - - - #line default - #line hidden -WriteLiteral(" (Url.Action(MVC.User.Show(sg.Id)) + Write(displayName); + #line default #line hidden -, 2683), false) -, Tuple.Create(Tuple.Create("", 2718), Tuple.Create("#UserDetailTab-Authorization", 2718), true) + + #line 57 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + + } + else + { + + + #line default + #line hidden +WriteLiteral(" (Url.Action(MVC.User.Show(sg.Id)) + + #line default + #line hidden +, 2615), false) +, Tuple.Create(Tuple.Create("", 2650), Tuple.Create("#UserDetailTab-Authorization", 2650), true) ); WriteLiteral(">"); - #line 57 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" - Write(displayName); + #line 61 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + Write(displayName); #line default @@ -268,15 +276,16 @@ WriteLiteral(">"); WriteLiteral("\r\n"); - #line 58 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" - } + #line 62 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + } + #line default #line hidden -WriteLiteral("\r\n"); +WriteLiteral(" \r\n"); - #line 59 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + #line 64 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" } @@ -285,7 +294,7 @@ WriteLiteral("\r\n"); WriteLiteral(" \r\n"); - #line 61 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + #line 66 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" } @@ -307,17 +316,69 @@ WriteLiteral(" class=\"dialog\""); WriteLiteral(" title=\"Authorization Role Linked Groups/Users\""); -WriteLiteral(">\r\n
    - -\r\n"); -WriteLiteral(" "); +WriteLiteral(" "); - #line 311 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" -Write(Html.ActionLinkButton("Delete", MVC.API.AuthorizationRole.Delete(Model.Token.Role.Id, true), "Config_AuthRoles_Actions_Delete_Button")); + #line 243 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml" + Write(Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.ClaimNavigatorFancyTreeNodes))); #line default #line hidden -WriteLiteral("\r\n \r\n \r\n
    Name: - @Html.EditorFor(model => model.DeviceBatch.Name)
    @Html.ValidationMessageFor(model => model.DeviceBatch.Name) + @Html.EditorFor(model => model.Name)
    @Html.ValidationMessageFor(model => model.Name)
    Purchase Date: - @Html.EditorFor(model => model.DeviceBatch.PurchaseDate)
    @Html.ValidationMessageFor(model => model.DeviceBatch.PurchaseDate) + @Html.EditorFor(model => model.PurchaseDate)
    @Html.ValidationMessageFor(model => model.PurchaseDate)
    @@ -29,6 +30,7 @@ $(function () { $('#Name').focus().select(); $('#PurchaseDate').datepicker({ + minDate: new Date(1900, 1-1, 1), changeYear: true, changeMonth: true, dateFormat: 'yy/mm/dd' diff --git a/Disco.Web/Areas/Config/Views/DeviceBatch/Create.generated.cs b/Disco.Web/Areas/Config/Views/DeviceBatch/Create.generated.cs index 96cf72bb..4cf82d7c 100644 --- a/Disco.Web/Areas/Config/Views/DeviceBatch/Create.generated.cs +++ b/Disco.Web/Areas/Config/Views/DeviceBatch/Create.generated.cs @@ -57,20 +57,34 @@ WriteLiteral("\r\n"); #line 6 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" using (Html.BeginForm()) -{ +{ #line default #line hidden #line 8 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" -Write(Html.ValidationSummary(false)); +Write(Html.AntiForgeryToken()); #line default #line hidden #line 8 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" + + + + #line default + #line hidden + + #line 9 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" +Write(Html.ValidationSummary(false)); + + + #line default + #line hidden + + #line 9 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" @@ -88,8 +102,8 @@ WriteLiteral(">\r\n \r\n \r\n \r\n WriteLiteral(" "); - #line 20 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" - Write(Html.EditorFor(model => model.DeviceBatch.PurchaseDate)); + #line 21 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" + Write(Html.EditorFor(model => model.PurchaseDate)); #line default @@ -118,8 +132,8 @@ WriteLiteral(" "); WriteLiteral("
    "); - #line 20 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" - Write(Html.ValidationMessageFor(model => model.DeviceBatch.PurchaseDate)); + #line 21 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" + Write(Html.ValidationMessageFor(model => model.PurchaseDate)); #line default @@ -146,6 +160,7 @@ WriteLiteral(@"> $(function () { $('#Name').focus().select(); $('#PurchaseDate').datepicker({ + minDate: new Date(1900, 1-1, 1), changeYear: true, changeMonth: true, dateFormat: 'yy/mm/dd' @@ -155,7 +170,7 @@ WriteLiteral(@"> "); - #line 38 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" + #line 40 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" } diff --git a/Disco.Web/Areas/Config/Views/DeviceBatch/Show.cshtml b/Disco.Web/Areas/Config/Views/DeviceBatch/Show.cshtml index aecd2ffd..af00ded4 100644 --- a/Disco.Web/Areas/Config/Views/DeviceBatch/Show.cshtml +++ b/Disco.Web/Areas/Config/Views/DeviceBatch/Show.cshtml @@ -285,7 +285,7 @@
    Na WriteLiteral(" "); - #line 14 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" - Write(Html.EditorFor(model => model.DeviceBatch.Name)); + #line 15 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" + Write(Html.EditorFor(model => model.Name)); #line default @@ -97,8 +111,8 @@ WriteLiteral(" "); WriteLiteral("
    "); - #line 14 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" - Write(Html.ValidationMessageFor(model => model.DeviceBatch.Name)); + #line 15 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml" + Write(Html.ValidationMessageFor(model => model.Name)); #line default @@ -109,8 +123,8 @@ WriteLiteral("\r\n \r\n
    -
    +
    Details @AjaxHelpers.AjaxLoader("ajaxPurchaseDetails")
    @@ -294,50 +294,39 @@ @Html.EditorFor(model => model.DeviceBatch.PurchaseDetails) } else @@ -693,8 +651,7 @@
    Attachments: -
    - @Html.AntiForgeryToken() +

    Drop Attachments Here

    @@ -708,7 +665,7 @@ Attachment Thumbnail - @attachment.Comments + @(attachment.Comments ?? attachment.Filename) @attachment.TechUser.ToString()@if (canConfig) {}@attachment.Timestamp.ToFullDateTime() @@ -926,12 +883,10 @@ }); //#endregion //#region Remove Attachments - $attachmentOutput.find('span.remove').click(removeAttachment); + $attachmentOutput.find('span.remove').on('click', removeAttachment); function removeAttachment() { - $this = $(this).closest('a'); - - var data = { id: $this.attr('data-attachmentid') }; + const attachmentId = $(this).closest('a').attr('data-attachmentid'); if (!$dialogRemoveAttachment) { $dialogRemoveAttachment = $('#dialogRemoveAttachment').dialog({ @@ -942,31 +897,28 @@ }); } - $dialogRemoveAttachment.dialog("enable"); $dialogRemoveAttachment.dialog('option', 'buttons', { "Remove": function () { - $dialogRemoveAttachment.dialog("disable"); $dialogRemoveAttachment.dialog("option", "buttons", null); - $.ajax({ - url: '@Url.Action(MVC.API.DeviceBatch.AttachmentRemove())', - dataType: 'json', - data: data, - success: function (d) { - if (d == 'OK') { - // Do nothing, await SignalR notification - } else { - alert('Unable to remove attachment: ' + d); - } - $dialogRemoveAttachment.dialog("close"); - }, - error: function (jqXHR, textStatus, errorThrown) { - alert('Unable to remove attachment: ' + textStatus); - $dialogRemoveAttachment.dialog("close"); + + const body = new FormData(); + body.append('__RequestVerificationToken', document.body.dataset.antiforgery); + body.append('id', attachmentId); + fetch($Attachments.attr('data-removeurl'), { + method: 'POST', + body: body + }).then(r => { + if (!r.ok) { + alert('Unable to remove attachment: ' + r.statusText); } + $dialogRemoveAttachment.dialog('close'); + }).catch(e => { + alert('Unable to remove attachment: ' + e); + $dialogRemoveAttachment.dialog('close'); }); }, Cancel: function () { - $dialogRemoveAttachment.dialog("close"); + $(this).dialog("close"); } }); @@ -1044,7 +996,7 @@ {
    - @using (Html.BeginForm(MVC.API.Device.DeviceBatchDecommission(Model.DeviceBatch.Id), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.Device.DeviceBatchDecommission(Model.DeviceBatch.Id))) { @Html.AntiForgeryToken()
    @@ -1101,7 +1053,44 @@ } @if (Model.CanDelete) { - @Html.ActionLinkButton("Delete", MVC.API.DeviceBatch.Delete(Model.DeviceBatch.Id, true), "buttonDelete") + +
    + @using (Html.BeginForm(MVC.API.DeviceBatch.Delete(Model.DeviceBatch.Id, true))) + { + @Html.AntiForgeryToken() + } +

    + + This item will be permanently deleted and cannot be recovered. Are you sure? +

    +
    + } @if (Model.DeviceCount > 0) { diff --git a/Disco.Web/Areas/Config/Views/DeviceBatch/Show.generated.cs b/Disco.Web/Areas/Config/Views/DeviceBatch/Show.generated.cs index 0d346fa8..2efc5a29 100644 --- a/Disco.Web/Areas/Config/Views/DeviceBatch/Show.generated.cs +++ b/Disco.Web/Areas/Config/Views/DeviceBatch/Show.generated.cs @@ -1077,6 +1077,17 @@ WriteLiteral("
    \r\n"); - #line 368 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 357 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 368 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 357 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (canConfig) { @@ -1244,28 +1233,28 @@ WriteLiteral(">\r\n Valid Until:\r\n #line default #line hidden - #line 370 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 359 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Html.EditorFor(model => model.DeviceBatch.WarrantyValidUntil)); #line default #line hidden - #line 370 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 359 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 371 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 360 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 371 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 360 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" @@ -1280,7 +1269,7 @@ WriteLiteral(@" \r\n"); - #line 416 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" - Write(Url.Action(MVC.API.DeviceBatch.UpdateWarrantyDetails(Model.DeviceBatch.Id))); - - - #line default - #line hidden -WriteLiteral("\',\r\n dataType: \'json\',\r\n " + -" data: data,\r\n " + -" traditional: true,\r\n type: \'PO" + -"ST\',\r\n success: function (d) {\r\n " + -" if (d == \'OK\') {\r\n " + -" model.$ajax_loading.hide();\r\n " + -" model.$ajax_ok.show().delay(\'fast\').fadeOut(\'s" + -"low\');\r\n } else {\r\n " + -" model.$ajax_loading.hide();\r\n " + -" alert(\'Unable to update warranty details:" + -" \' + d);\r\n }\r\n " + -" },\r\n error: " + -"function (jqXHR, textStatus, errorThrown) {\r\n " + -" alert(\'Unable to update warranty details: \' + errorThrown);\r\n " + -" model.$ajax_loading.hide();\r\n " + -" }\r\n })" + -"\r\n }\r\n };\r\n\r\n " + -" model.$field.tinymce({\r\n " + -" theme: \'simple\',\r\n add_unload_trig" + -"ger: false,\r\n schema: \"html5\",\r\n " + -" statusbar: false,\r\n se" + -"tup: function (ed) {\r\n ed.on(\'init\', func" + -"tion () {\r\n $(ed.getWin()).blur(model" + -".updated);\r\n });\r\n " + -" }\r\n });\r\n " + -" });\r\n \r\n"); - - - #line 451 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 429 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } else { @@ -1436,7 +1414,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>"); - #line 455 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 433 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } else { @@ -1444,14 +1422,14 @@ WriteLiteral("><None Specified>"); #line default #line hidden - #line 457 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 435 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(new HtmlString(Model.DeviceBatch.WarrantyDetails)); #line default #line hidden - #line 457 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 435 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } } @@ -1477,13 +1455,13 @@ WriteLiteral(">\r\n Supplier:\r\n " \r\n"); - #line 473 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 451 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 473 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 451 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (canConfig) { @@ -1491,42 +1469,42 @@ WriteLiteral(">\r\n Supplier:\r\n #line default #line hidden - #line 475 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 453 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Html.EditorFor(model => model.DeviceBatch.InsuranceSupplier)); #line default #line hidden - #line 475 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 453 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 476 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 454 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 476 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 454 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 477 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 455 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 477 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 455 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" @@ -1544,7 +1522,7 @@ WriteLiteral(@"> '"); - #line 483 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 461 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Url.Action(MVC.API.DeviceBatch.UpdateInsuranceSupplier(Model.DeviceBatch.Id))); @@ -1555,7 +1533,7 @@ WriteLiteral("\',\r\n \'InsuranceSupplier " \r\n"); - #line 488 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 466 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } else { @@ -1571,7 +1549,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>"); - #line 492 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 470 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } else { @@ -1579,14 +1557,14 @@ WriteLiteral("><None Specified>"); #line default #line hidden - #line 494 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 472 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Model.DeviceBatch.InsuranceSupplier); #line default #line hidden - #line 494 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 472 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" ; } } @@ -1603,13 +1581,13 @@ WriteLiteral(">\r\n Insured Date:\r\n " \r\n"); - #line 504 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 482 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 504 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 482 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (canConfig) { @@ -1617,28 +1595,28 @@ WriteLiteral(">\r\n Insured Date:\r\n #line default #line hidden - #line 506 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 484 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Html.EditorFor(model => model.DeviceBatch.InsuredDate)); #line default #line hidden - #line 506 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 484 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 507 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 485 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 507 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 485 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" @@ -1653,7 +1631,7 @@ WriteLiteral(@" \r\n"); - #line 579 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" - Write(Url.Action(MVC.API.DeviceBatch.UpdateInsuranceDetails(Model.DeviceBatch.Id))); - - - #line default - #line hidden -WriteLiteral("\',\r\n dataType: \'json\',\r\n " + -" data: data,\r\n " + -" traditional: true,\r\n type: \'PO" + -"ST\',\r\n success: function (d) {\r\n " + -" if (d == \'OK\') {\r\n " + -" model.$ajax_loading.hide();\r\n " + -" model.$ajax_ok.show().delay(\'fast\').fadeOut(\'s" + -"low\');\r\n } else {\r\n " + -" model.$ajax_loading.hide();\r\n " + -" alert(\'Unable to update insurance details" + -": \' + d);\r\n }\r\n " + -" },\r\n error:" + -" function (jqXHR, textStatus, errorThrown) {\r\n " + -" alert(\'Unable to update insurance details: \' + errorThrown);\r\n " + -" model.$ajax_loading.hide();\r\n " + -" }\r\n " + -"})\r\n }\r\n };\r\n\r" + -"\n model.$field.tinymce({\r\n " + -" theme: \'simple\',\r\n add_unload_tr" + -"igger: false,\r\n schema: \"html5\",\r\n " + -" statusbar: false,\r\n " + -"setup: function (ed) {\r\n ed.on(\'init\', fu" + -"nction () {\r\n $(ed.getWin()).blur(mod" + -"el.updated);\r\n });\r\n " + -" }\r\n });\r\n " + -" });\r\n \r\n"); - - - #line 614 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 582 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } else { @@ -1905,7 +1874,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>"); - #line 618 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 586 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } else { @@ -1913,27 +1882,41 @@ WriteLiteral("><None Specified>"); #line default #line hidden - #line 620 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 588 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(new HtmlString(Model.DeviceBatch.InsuranceDetails)); #line default #line hidden - #line 620 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 588 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } } #line default #line hidden -WriteLiteral(" \r\n
    \r\n Comments:
    \r\n"); +WriteLiteral(" \r\n \r\n
    \r\n Comments:
    \r\n"); WriteLiteral(" "); - #line 628 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 596 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(AjaxHelpers.AjaxLoader("ajaxComments")); @@ -1942,13 +1925,13 @@ WriteLiteral(" "); WriteLiteral("\r\n
    \r\n"); - #line 631 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 599 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 631 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 599 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (canConfig) { @@ -1956,14 +1939,14 @@ WriteLiteral("\r\n \r\n \r\n"); #line default #line hidden - #line 633 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 601 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Html.EditorFor(model => model.DeviceBatch.Comments)); #line default #line hidden - #line 633 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 601 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" @@ -1973,55 +1956,35 @@ WriteLiteral(" - $(function () { - var model = { - $field: $('#DeviceBatch_Comments'), - $ajax_loading: null, - $ajax_ok: null, - updated: function () { - if (!model.$ajax_loading) - model.$ajax_loading = $('#ajaxComments_loading'); - if (!model.$ajax_ok) - model.$ajax_ok = $('#ajaxComments_ok'); - model.$ajax_loading.show(); - var data = { Comments: model.$field.tinymce().getContent() }; - $.ajax({ - url: '"); +WriteLiteral(">\r\n $(function () {\r\n const $fi" + +"eld = $(\'#DeviceBatch_Comments\');\r\n async function up" + +"dated() {\r\n $(\'#ajaxComments_loading\').show();\r\n " + +" try {\r\n const " + +"body = new FormData();\r\n body.append(\'__Reque" + +"stVerificationToken\', document.body.dataset.antiforgery);\r\n " + +" body.append(\'comments\', $field.tinymce().getContent())\r\n\r\n " + +" const response = await fetch($(\'#DeviceBatch_Commen" + +"ts_Container\').attr(\'data-updateurl\'), {\r\n " + +" method: \'POST\',\r\n body: body\r\n " + +" });\r\n\r\n if (respon" + +"se.ok) {\r\n $(\'#ajaxComments_ok\').show().d" + +"elay(\'fast\').fadeOut(\'slow\');\r\n } else {\r\n " + +" alert(\'Unable to update comments: \' + respo" + +"nse.statusText);\r\n }\r\n " + +" } catch (e) {\r\n alert(\'Unable to upd" + +"ate comments: \' + e);\r\n }\r\n " + +" $(\'#ajaxComments_loading\').hide();\r\n }\r\n\r\n " + +" $field.tinymce({\r\n the" + +"me: \'simple\',\r\n add_unload_trigger: false,\r\n " + +" schema: \"html5\",\r\n sta" + +"tusbar: false,\r\n setup: function (ed) {\r\n " + +" ed.on(\'init\', function () {\r\n " + +" $(ed.getWin()).blur(function () { updated(); });\r\n " + +" });\r\n }\r\n " + +" });\r\n });\r\n \r\n"); - #line 648 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" - Write(Url.Action(MVC.API.DeviceBatch.UpdateComments(Model.DeviceBatch.Id))); - - - #line default - #line hidden -WriteLiteral("\',\r\n dataType: \'json\',\r\n " + -" data: data,\r\n traditional: true" + -",\r\n type: \'POST\',\r\n " + -" success: function (d) {\r\n if (d" + -" == \'OK\') {\r\n model.$ajax_loading.hid" + -"e();\r\n model.$ajax_ok.show().delay(\'f" + -"ast\').fadeOut(\'slow\');\r\n } else {\r\n " + -" model.$ajax_loading.hide();\r\n " + -" alert(\'Unable to update comments: \' + d);\r\n " + -" }\r\n },\r\n " + -" error: function (jqXHR, textStatus, errorThrown" + -") {\r\n alert(\'Unable to update comments: \'" + -" + errorThrown);\r\n model.$ajax_loading.hi" + -"de();\r\n }\r\n })" + -"\r\n }\r\n };\r\n\r\n " + -" model.$field.tinymce({\r\n theme: \'simple\',\r\n " + -" add_unload_trigger: false,\r\n " + -" schema: \"html5\",\r\n statusbar: false,\r\n " + -" setup: function (ed) {\r\n ed.on(\'ini" + -"t\', function () {\r\n $(ed.getWin()).blur(model" + -".updated);\r\n });\r\n }\r\n" + -" });\r\n });\r\n \r\n"); - - - #line 683 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 641 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } else { @@ -2037,7 +2000,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>"); - #line 687 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 645 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } else { @@ -2045,14 +2008,14 @@ WriteLiteral("><None Specified>"); #line default #line hidden - #line 689 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 647 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(new HtmlString(Model.DeviceBatch.Comments)); #line default #line hidden - #line 689 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 647 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } } @@ -2064,20 +2027,20 @@ WriteLiteral("
    \r\n Linked Groups:\r\n WriteLiteral(" "); - #line 1016 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 968 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel() { CanConfigure = canConfig, @@ -2754,7 +2705,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 1024 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 976 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel() { CanConfigure = canConfig, @@ -2770,13 +2721,13 @@ WriteLiteral(" "); WriteLiteral("\r\n"); - #line 1032 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 984 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 1032 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 984 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (canConfig) { @@ -2784,14 +2735,14 @@ WriteLiteral("\r\n"); #line default #line hidden - #line 1034 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 986 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupShared)); #line default #line hidden - #line 1034 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 986 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } @@ -2801,7 +2752,7 @@ WriteLiteral("\r\n"); WriteLiteral(" \r\n \r\n
    \r\n\r\n"); - #line 1041 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 993 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model)); @@ -2814,13 +2765,13 @@ WriteLiteral(" class=\"actionBar\""); WriteLiteral(">\r\n"); - #line 1043 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 995 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 1043 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 995 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (Model.CanDecommission) { @@ -2846,28 +2797,28 @@ WriteLiteral(" title=\"Batch Device Decommission\""); WriteLiteral(">\r\n"); - #line 1047 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 999 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 1047 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" - using (Html.BeginForm(MVC.API.Device.DeviceBatchDecommission(Model.DeviceBatch.Id), FormMethod.Post)) + #line 999 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + using (Html.BeginForm(MVC.API.Device.DeviceBatchDecommission(Model.DeviceBatch.Id))) { #line default #line hidden - #line 1049 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1001 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Html.AntiForgeryToken()); #line default #line hidden - #line 1049 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1001 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" @@ -2892,13 +2843,13 @@ WriteLiteral(" class=\"none\""); WriteLiteral(">\r\n"); - #line 1055 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1007 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" #line default #line hidden - #line 1055 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1007 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast().OrderBy(r => r.ToString())) { @@ -2909,33 +2860,33 @@ WriteLiteral("
  • \r\n WriteLiteral(" type=\"radio\""); -WriteAttribute("id", Tuple.Create(" id=\"", 56868), Tuple.Create("\"", 56938) -, Tuple.Create(Tuple.Create("", 56873), Tuple.Create("DeviceBatch_Decommission_Dialog_Reason_", 56873), true) +WriteAttribute("id", Tuple.Create(" id=\"", 53759), Tuple.Create("\"", 53829) +, Tuple.Create(Tuple.Create("", 53764), Tuple.Create("DeviceBatch_Decommission_Dialog_Reason_", 53764), true) - #line 1058 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" - , Tuple.Create(Tuple.Create("", 56912), Tuple.Create((int)decommissionReason + #line 1010 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + , Tuple.Create(Tuple.Create("", 53803), Tuple.Create((int)decommissionReason #line default #line hidden -, 56912), false) +, 53803), false) ); WriteLiteral("\r\n name=\"decommissionReason\""); -WriteAttribute("value", Tuple.Create(" value=\"", 57005), Tuple.Create("\"", 57039) +WriteAttribute("value", Tuple.Create(" value=\"", 53896), Tuple.Create("\"", 53930) - #line 1059 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" -, Tuple.Create(Tuple.Create("", 57013), Tuple.Create((int)decommissionReason + #line 1011 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" +, Tuple.Create(Tuple.Create("", 53904), Tuple.Create((int)decommissionReason #line default #line hidden -, 57013), false) +, 53904), false) ); WriteLiteral(" "); - #line 1059 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1011 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty); @@ -2943,21 +2894,21 @@ WriteLiteral(" "); #line hidden WriteLiteral(" />\r\n ((int)decommissionReason + #line 1012 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + , Tuple.Create(Tuple.Create("", 54115), Tuple.Create((int)decommissionReason #line default #line hidden -, 57224), false) +, 54115), false) ); WriteLiteral(">"); - #line 1060 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1012 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(decommissionReason.ReasonMessage()); @@ -2966,7 +2917,7 @@ WriteLiteral(">"); WriteLiteral("\r\n
  • \r\n"); - #line 1062 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1014 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } @@ -2985,7 +2936,7 @@ WriteLiteral(" />\r\n Unassign devices users\r\n "\r\n \r\n"); - #line 1070 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1022 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } @@ -3029,7 +2980,7 @@ WriteLiteral(@"> "); - #line 1101 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1053 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } @@ -3038,23 +2989,104 @@ WriteLiteral(@"> WriteLiteral(" "); - #line 1102 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1054 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (Model.CanDelete) { - + + + #line default + #line hidden +WriteLiteral(" Delete\r\n"); + +WriteLiteral(" \r\n"); + + + #line 1058 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line default #line hidden - #line 1104 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" - Write(Html.ActionLinkButton("Delete", MVC.API.DeviceBatch.Delete(Model.DeviceBatch.Id, true), "buttonDelete")); + #line 1058 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + using (Html.BeginForm(MVC.API.DeviceBatch.Delete(Model.DeviceBatch.Id, true))) + { + + + #line default + #line hidden + + #line 1060 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + Write(Html.AntiForgeryToken()); #line default #line hidden - #line 1104 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" - + #line 1060 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + + } + + + #line default + #line hidden +WriteLiteral("

    \r\n \r\n This item will be permanently deleted and cannot be recove" + +"red. Are you sure?\r\n

    \r\n \r\n"); + +WriteLiteral(" + $(function () { + let dialog = null; + $('#buttonDelete').on('click', function () { + if (!dialog) { + dialog = $(""#dialogConfirmDelete"").dialog({ + resizable: false, + width: 300, + modal: true, + autoOpen: false, + buttons: { + ""Delete"": function () { + $(this) + .dialog(""option"", ""buttons"", null) + .find('form').trigger('submit'); + }, + Cancel: function () { + $(this).dialog(""close""); + } + } + }); + } + + dialog.dialog('open'); + }); + }); + +"); + + + #line 1094 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } @@ -3063,7 +3095,7 @@ WriteLiteral(" "); WriteLiteral(" "); - #line 1106 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1095 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" if (Model.DeviceCount > 0) { if (Authorization.Has(Claims.Device.Actions.Export)) @@ -3073,14 +3105,14 @@ WriteLiteral(" "); #line default #line hidden - #line 1110 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1099 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.DeviceExportTypes.Batch, Model.DeviceBatch.Id))); #line default #line hidden - #line 1110 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1099 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0) @@ -3090,14 +3122,14 @@ WriteLiteral(" "); #line default #line hidden - #line 1114 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1103 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" Write(Html.ActionLinkButton(string.Format("View {0} Device{1}", Model.DeviceCount, (Model.DeviceCount != 1 ? "s" : null)), MVC.Search.Query(Model.DeviceBatch.Id.ToString(), "DeviceBatch"))); #line default #line hidden - #line 1114 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" + #line 1103 "..\..\Areas\Config\Views\DeviceBatch\Show.cshtml" } } diff --git a/Disco.Web/Areas/Config/Views/DeviceBatch/Timeline.cshtml b/Disco.Web/Areas/Config/Views/DeviceBatch/Timeline.cshtml index fed516e6..8f667890 100644 --- a/Disco.Web/Areas/Config/Views/DeviceBatch/Timeline.cshtml +++ b/Disco.Web/Areas/Config/Views/DeviceBatch/Timeline.cshtml @@ -1,15 +1,14 @@ @{ Authorization.Require(Claims.Config.DeviceBatch.ShowTimeline); - + ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Timeline"); Html.BundleDeferred("~/Style/Timeline"); Html.BundleDeferred("~/ClientScripts/Modules/Timeline"); } -
    +
    \r\n"); +WriteLiteral("\""); + +WriteLiteral(">\r\n
    \r\n\r\n (function () {\r\n var tl;\r\n\r\n $(function () {\r\n\r\n " + +"var eventSource = new Timeline.DefaultEventSource();\r\n\r\n var currentD" + +"ate = new Date();\r\n currentDate = new Date(currentDate.getFullYear()," + +" currentDate.getMonth(), currentDate.getDay(), 10, 0, 0);\r\n var tomor" + +"rowDate = new Date();\r\n tomorrowDate.setDate(currentDate.getDate() + " + +"1);\r\n var sixMonthsDate = new Date();\r\n sixMonthsDate.setD" + +"ate(currentDate.getDate());\r\n sixMonthsDate.setMonth(currentDate.getM" + +"onth() + 6);\r\n\r\n var hotZoneStart1 = new Date(currentDate.getFullYear" + +"(), 0, 1, 10, 0, 0);\r\n var hotZoneEnd1 = new Date(currentDate.getFull" + +"Year(), 11, 31, 10, 0, 0);\r\n var hotZoneStart2 = new Date(currentDate" + +".getFullYear() + 1, 0, 1, 10, 0, 0);\r\n var hotZoneEnd2 = new Date(cur" + +"rentDate.getFullYear() + 1, 11, 31, 10, 0, 0);\r\n //hotZoneEnd.setDate" + +"(hotZoneEnd.getDate() - 1);\r\n\r\n //hotZoneStart = hotZoneStart.toLocal" + +"eDateString();\r\n //hotZoneEnd = hotZoneEnd.toLocaleDateString();\r\n\r\n\r" + +"\n var bandInfos = [\r\n Timeline.createHotZoneBandInfo({" + +"\r\n zones: [\r\n {\r\n " + +" start: hotZoneStart1,\r\n end: hotZoneEnd1,\r\n " + +" magnify: 4,\r\n unit: Timeline" + +".DateTime.MONTH\r\n },\r\n {\r\n " + +" start: hotZoneStart2,\r\n end: hotZ" + +"oneEnd2,\r\n magnify: 4,\r\n u" + +"nit: Timeline.DateTime.MONTH\r\n }\r\n ],\r" + +"\n eventSource: eventSource,\r\n width: \"85%\"" + +",\r\n intervalUnit: Timeline.DateTime.YEAR,\r\n " + +" intervalPixels: 150,\r\n timeZone: 10,\r\n d" + +"ate: sixMonthsDate\r\n }),\r\n Timeline.createBandInfo" + +"({\r\n eventSource: eventSource,\r\n width: \"1" + +"5%\",\r\n intervalUnit: Timeline.DateTime.YEAR,\r\n " + +" intervalPixels: 150,\r\n overview: true,\r\n " + +" timeZone: 10,\r\n date: sixMonthsDate\r\n })\r\n" + +" ];\r\n bandInfos[1].syncWith = 0;\r\n bandInfos[1]" + +".highlight = true;\r\n\r\n for (var i = 0; i < bandInfos.length; i++) {\r\n" + +" bandInfos[i].decorators = [\r\n new Timeline.Sp" + +"anHighlightDecorator({\r\n startDate: currentDate,\r\n " + +" endDate: tomorrowDate,\r\n color: \"#CC2222" + +"\",\r\n opacity: 50\r\n }),\r\n " + +" new Timeline.SpanHighlightDecorator({\r\n startDate: " + +"hotZoneStart1,\r\n endDate: hotZoneEnd1,\r\n " + +" color: \"#CEA5A5\",\r\n opacity: 50\r\n " + +" }),\r\n new Timeline.SpanHighlightDecorator({\r\n " + +" startDate: hotZoneStart2,\r\n endDate: hotZoneEn" + +"d2,\r\n color: \"#CCB7B7\",\r\n opacity:" + +" 50\r\n })\r\n ];\r\n }\r\n\r\n tl" + +" = Timeline.create($(\'#deviceBatchesTimeline\')[0], bandInfos);\r\n\r\n va" + +"r tlResizeLayoutHandle = null;\r\n $(window).resize(function () {\r\n " + +" if (tlResizeLayoutHandle)\r\n window.clearTimeout(t" + +"lResizeLayoutHandle);\r\n tlResizeLayoutHandle = window.setTimeout(" + +"function () {\r\n tlResizeLayoutHandle = null;\r\n " + +" tl.layout();\r\n }, 500);\r\n });\r\n\r\n // L" + +"oad Events\r\n async function loadEventsAsync() {\r\n try " + +"{\r\n const dataUrl = $(\'#deviceBatchesTimeline\').attr(\'data-ur" + +"l\');\r\n const body = new FormData();\r\n body" + +".append(\'__RequestVerificationToken\', document.body.dataset.antiforgery);\r\n " + +" const response = await fetch(dataUrl, {\r\n " + +"method: \'POST\',\r\n body: body\r\n });\r\n " + +" if (response.ok) {\r\n const data = await" + +" response.json();\r\n eventSource.loadJSON(data, dataUrl);\r" + +"\n } else {\r\n alert(\'Unable to load Tim" + +"eline Data: \' + response.statusText);\r\n }\r\n } " + +"catch (e) {\r\n alert(\'Unable to load Timeline Data: \' + e);\r\n " + +" }\r\n }\r\n loadEventsAsync();\r\n });\r\n\r\n" + +" })();\r\n\r\n\r\n"); } } diff --git a/Disco.Web/Areas/Config/Views/DeviceFlag/Create.cshtml b/Disco.Web/Areas/Config/Views/DeviceFlag/Create.cshtml index f085dcca..8cea8e87 100644 --- a/Disco.Web/Areas/Config/Views/DeviceFlag/Create.cshtml +++ b/Disco.Web/Areas/Config/Views/DeviceFlag/Create.cshtml @@ -4,23 +4,24 @@ ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags", MVC.Config.DeviceFlag.Index(null), "Create"); } @using (Html.BeginForm()) -{ - @Html.HiddenFor(m => m.DeviceFlag.Icon) - @Html.HiddenFor(m => m.DeviceFlag.IconColour) +{ + @Html.AntiForgeryToken()
    - -
    Name: + + Name: - @Html.EditorFor(model => model.DeviceFlag.Name)
    @Html.ValidationMessageFor(model => model.DeviceFlag.Name) + @Html.EditorFor(model => model.Name)
    @Html.ValidationMessageFor(model => model.Name)
    Description: + + Description: - @Html.EditorFor(model => model.DeviceFlag.Description)
    @Html.ValidationMessageFor(model => model.DeviceFlag.Description) + @Html.EditorFor(model => model.Description)
    @Html.ValidationMessageFor(model => model.Description)
    @@ -30,7 +31,7 @@
    } diff --git a/Disco.Web/Areas/Config/Views/DeviceFlag/Create.generated.cs b/Disco.Web/Areas/Config/Views/DeviceFlag/Create.generated.cs index 0a7dba22..303375d3 100644 --- a/Disco.Web/Areas/Config/Views/DeviceFlag/Create.generated.cs +++ b/Disco.Web/Areas/Config/Views/DeviceFlag/Create.generated.cs @@ -57,35 +57,21 @@ WriteLiteral("\r\n"); #line 6 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml" using (Html.BeginForm()) -{ +{ #line default #line hidden #line 8 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml" -Write(Html.HiddenFor(m => m.DeviceFlag.Icon)); +Write(Html.AntiForgeryToken()); #line default #line hidden #line 8 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml" - - - - #line default - #line hidden - - #line 9 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml" -Write(Html.HiddenFor(m => m.DeviceFlag.IconColour)); - - - #line default - #line hidden - - #line 9 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml" - + #line default @@ -96,14 +82,14 @@ WriteLiteral(" class=\"form\""); WriteLiteral(" style=\"width: 450px\""); -WriteLiteral(">\r\n \r\n \r\n \r\n \');\r\n " + +" dc.insertBefore($deviceComponents.find(\'tr\').last());\r\n d" + +"c.find(\'input.description\').focus();\r\n return false;\r\n " + +" });\r\n\r\n $deviceComponents.on(\'change\', \'input\', function () { update" + +"Component(this); });\r\n $deviceComponents.on(\'focus\', \'input\', functio" + +"n () { $(this).select(); });\r\n\r\n $deviceComponents.on(\'click\', \'.remo" + +"ve\', removeComponent);\r\n $deviceComponents.on(\'click\', \'.edit\', funct" + +"ion () { editComponentJobTypes(this); });\r\n\r\n async function removeCo" + +"mponentConfirmed(id, row) {\r\n const body = new FormData();\r\n " + +" body.append(\'__RequestVerificationToken\', document.body.dataset.antif" + +"orgery);\r\n body.append(\'id\', id);\r\n\r\n try {\r\n " + +" const response = await fetch($deviceComponents.attr(\'data-removeu" + +"rl\'), {\r\n method: \'POST\',\r\n body: " + +"body\r\n });\r\n\r\n if (response.ok) {\r\n " + +" row.remove();\r\n } else {\r\n " + +" alert(\'Unable to remove component: \' + response.statusText);\r\n " + +" }\r\n } catch (e) {\r\n alert(\'Unable to r" + +"emove component: \' + e);\r\n }\r\n }\r\n function" + +" removeComponent() {\r\n const componentRow = $(this).closest(\'tr\')" + +";\r\n const id = componentRow.attr(\'data-devicecomponentid\');\r\n " + +" if (id) {\r\n const dialog = $(\"#dialogConfirmRemov" + +"e\");\r\n const buttons = dialog.dialog(\"option\", \"buttons\");\r\n " + +" buttons[\'Remove\'] = function () { removeComponentConfirmed(id" + +", componentRow); $(this).dialog(\"close\"); };\r\n dialog.dialog(" + +"\"option\", \"buttons\", buttons);\r\n dialog.dialog(\'open\');\r\n " + +" } else {\r\n // New - Remove\r\n c" + +"omponentRow.remove();\r\n }\r\n }\r\n async funct" + +"ion updateComponent(input) {\r\n const componentRow = $(input).clos" + +"est(\'tr\');\r\n componentRow.find(\'input\').attr(\'disabled\', true).ad" + +"dClass(\'updating\');\r\n\r\n const id = componentRow.attr(\'data-device" + +"componentid\');\r\n if (id) {\r\n // Update\r\n " + +" const body = new FormData();\r\n body.append(\'__R" + +"equestVerificationToken\', document.body.dataset.antiforgery);\r\n " + +" body.append(\'id\', id);\r\n body.append(\'description\', compon" + +"entRow.find(\'input.description\').val());\r\n body.append(\'cost\'" + +", componentRow.find(\'input.cost\').val());\r\n\r\n try {\r\n " + +" const response = await fetch($deviceComponents.attr(\'data-update" + +"url\'), {\r\n method: \'POST\',\r\n " + +" body: body\r\n });\r\n\r\n if (respon" + +"se.ok) {\r\n const result = await response.json();\r\n " + +" componentRow.find(\'input\').attr(\'disabled\', false).remo" + +"veClass(\'updating\');\r\n componentRow.find(\'input.descr" + +"iption\').val(result.Description);\r\n componentRow.find" + +"(\'input.cost\').val(result.Cost);\r\n } else {\r\n " + +" alert(\'Unable to update component: \' + response.statusText);\r\n " + +" }\r\n } catch (e) {\r\n " + +" alert(\'Unable to update component: \' + e);\r\n }\r\n " + +" } else {\r\n // Add\r\n const modelId =" + +" componentRow.closest(\'table\').attr(\'data-devicemodelid\');\r\n " + +"const body = new FormData();\r\n body.append(\'__RequestVerifica" + +"tionToken\', document.body.dataset.antiforgery);\r\n body.append" + +"(\'id\', modelId);\r\n body.append(\'description\', componentRow.fi" + +"nd(\'input.description\').val());\r\n body.append(\'cost\', compone" + +"ntRow.find(\'input.cost\').val());\r\n\r\n try {\r\n " + +" const response = await fetch($deviceComponents.attr(\'data-addurl\'), {\r\n " + +" method: \'POST\',\r\n body: bod" + +"y\r\n });\r\n\r\n if (response.ok) {\r\n " + +" const result = await response.json();\r\n " + +" componentRow.find(\'input\').attr(\'disabled\', false).removeClass(\'upd" + +"ating\');\r\n componentRow.attr(\'data-devicecomponentid\'" + +", result.Id);\r\n componentRow.find(\'input.description\'" + +").val(result.Description);\r\n componentRow.find(\'input" + +".cost\').val(result.Cost);\r\n } else {\r\n " + +" alert(\'Unable to add component: \' + response.statusText);\r\n " + +" }\r\n } catch (e) {\r\n alert(" + +"\'Unable to add component: \' + e);\r\n }\r\n }\r\n " + +" }\r\n async function editComponentJobTypes(input) {\r\n " + +" const edit$this = $(input);\r\n const componentRow = edit$th" + +"is.closest(\'tr\');\r\n const id = componentRow.attr(\'data-devicecomp" + +"onentid\');\r\n\r\n if (id) {\r\n try {\r\n " + +" const body = new FormData();\r\n body.append(\'_" + +"_RequestVerificationToken\', document.body.dataset.antiforgery);\r\n " + +" body.append(\'id\', id);\r\n const getResponse = awa" + +"it fetch($deviceComponents.attr(\'data-geturl\'), {\r\n m" + +"ethod: \'POST\',\r\n body: body\r\n " + +"})\r\n\r\n componentRow.find(\'input\').attr(\'disabled\', false)" + +".removeClass(\'updating\');\r\n if (getResponse.ok) {\r\n " + +" const component = await getResponse.json();\r\n " + +" $dialogUpdateJobTypes = $(\'#dialogUpdateJobTypes\');\r\n " + +" $dialogUpdateJobTypes.find(\'input:checked\').each(function () { $" + +"(this).prop(\'checked\', false) });\r\n for (var i = 0; i" + +" < component.JobSubTypes.length; i++) {\r\n var sjt" + +" = component.JobSubTypes[i];\r\n $dialogUpdateJobTy" + +"pes.find(\'#SubTypes_\' + sjt).prop(\'checked\', true);\r\n " + +" }\r\n $(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').ch" + +"eckboxBulkSelect(\'update\');\r\n const buttons = $dialog" + +"UpdateJobTypes.dialog(\"option\", \"buttons\");\r\n buttons" + +"[\'Save\'] = function () {\r\n async function saveAsy" + +"nc() {\r\n const body = new FormData();\r\n " + +" let jobSubTypeCount = 0;\r\n " + +" body.append(\'__RequestVerificationToken\', document.body.dataset.anti" + +"forgery);\r\n body.append(\'id\', id);\r\n " + +" $dialogUpdateJobTypes.find(\'input:checked\').each(func" + +"tion () { body.append(\'jobSubTypes\', $(this).val()); jobSubTypeCount++; });\r\n\r\n " + +" try {\r\n " + +" const updateResponse = await fetch($deviceComponents.attr(\'data-updatejobsubty" + +"pesurl\'), {\r\n method: \'POST\',\r\n " + +" body: body\r\n " + +" })\r\n\r\n if (updateResponse.ok) {" + +"\r\n if (jobSubTypeCount > 0) {\r\n " + +" edit$this.find(\'.fa-asterisk\').removeC" + +"lass(\'hidden\');\r\n } else {\r\n " + +" edit$this.find(\'.fa-asterisk\').addClass(\'" + +"hidden\');\r\n }\r\n " + +" $dialogUpdateJobTypes.dialog(\"close\");\r\n " + +" } else {\r\n aler" + +"t(\'Unable to update component sub types: \' + updateResponse.statusText);\r\n " + +" }\r\n } catch" + +" (e) {\r\n alert(\'Unable to update componen" + +"t sub types: \' + e);\r\n }\r\n " + +" }\r\n saveAsync();\r\n " + +" };\r\n $dialogUpdateJobTypes.dialog(\"option\"," + +" \"buttons\", buttons);\r\n $dialogUpdateJobTypes.dialog(" + +"\'open\');\r\n } else {\r\n alert(\'U" + +"nable to load component: \' + getResponse.statusText);\r\n }" + +"\r\n } catch (e) {\r\n alert(\'Unable to lo" + +"ad component: \' + e);\r\n }\r\n }\r\n }\r\n" + +"\r\n $(\"#dialogConfirmRemove\").dialog({\r\n resizable: fal" + +"se,\r\n height: 140,\r\n modal: true,\r\n " + +" autoOpen: false,\r\n buttons: {\r\n \"Remove\": fun" + +"ction () {\r\n $(this).dialog(\"close\");\r\n " + +" },\r\n Cancel: function () {\r\n $(this)" + +".dialog(\"close\");\r\n }\r\n }\r\n });\r\n\r\n" + +" $(\'#dialogUpdateJobTypes\').dialog({\r\n resizable: fals" + +"e,\r\n modal: true,\r\n autoOpen: false,\r\n " + +" width: 550,\r\n buttons: {\r\n \"Save\": functio" + +"n () {\r\n $(this).dialog(\"close\");\r\n }," + +"\r\n Cancel: function () {\r\n $(this).dia" + +"log(\"close\");\r\n }\r\n }\r\n });\r\n\r\n " + +" $(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').checkboxBulkSelect({ paren" + +"tSelector: \'div\' });\r\n });\r\n \r\n"); WriteLiteral(" \r\n \r\n \r\n \r\n <" + -"/tr>\r\n"); +WriteLiteral(">\r\n \r\n " + +"\r\n \r\n \r\n \r\n"); - #line 288 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 291 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" #line default #line hidden - #line 288 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 291 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" foreach (var item in Model.DeviceComponents) { @@ -493,7 +477,7 @@ WriteLiteral(" \r\n \r\n \r\n \r\n \r\n \r\n"); - #line 313 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 316 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" } @@ -609,7 +593,7 @@ WriteLiteral(" \r\n \r\n"); WriteLiteral("
    Name:\r\n " + -"\r\n"); +WriteLiteral(">\r\n \r\n \r\n \r\n \r\n \r\n \r\n Description:\r\n \r\n @@ -65,9 +65,9 @@ @@ -113,6 +113,12 @@
    Update
    + @using (Html.BeginForm(MVC.API.DeviceFlag.UpdateIconAndColour(id: Model.DeviceFlag.Id, redirect: true))) + { + @Html.AntiForgeryToken() + + + }
    @foreach (var colour in Model.ThemeColours) @@ -183,15 +189,11 @@ } function save() { - var url = '@(Url.Action(MVC.API.DeviceFlag.UpdateIconAndColour(id: Model.DeviceFlag.Id, redirect: true)))', - data = { - Icon: icons.find('i.selected').attr('data-icon'), - IconColour: colours.find('i.selected').attr('data-colour') - }; - window.location.href = url + '&' + $.param(data); - - dialog.dialog("disable"); dialog.dialog("option", "buttons", null); + const $form = dialog.find('form'); + $form.find('input[name="icon"]').val(icons.find('i.selected').attr('data-icon')); + $form.find('input[name="iconColour"]').val(colours.find('i.selected').attr('data-colour')); + $form.trigger('submit'); } function cancel() { @@ -391,7 +393,7 @@ UpdateUrl = Url.Action(MVC.API.DeviceFlag.UpdateAssignedUserLinkedGroup(Model.DeviceFlag.Id, redirect: true)) }) @if (canConfig) - { + { @Html.Partial(MVC.Config.Shared.Views.LinkedGroupShared) }
    @@ -442,7 +444,8 @@

    Loading current assignments...

    -
    + + @Html.AntiForgeryToken()

    Comments:

    @@ -502,8 +505,9 @@ assignDialog.dialog('option', 'buttons', buttons); assignDialog.dialog('option', 'title', 'Bulk Assign Devices: ' + mode); + const $form = assignDeviceSerialNumbers.closest('form'); if (mode == "Override") { - assignDeviceSerialNumbers.closest('form').attr('action', '@(Url.Action(MVC.API.DeviceFlag.BulkAssignDevices(Model.DeviceFlag.Id, true)))'); + $form.attr('action', $form.attr('data-overrideaction')); assignDialog.addClass('loading'); $.getJSON('@Url.Action(MVC.API.DeviceFlag.AssignedDevices(Model.DeviceFlag.Id))', function (response, result) { @@ -523,7 +527,7 @@ } else // Assume Add { - assignDeviceSerialNumbers.closest('form').attr('action', '@(Url.Action(MVC.API.DeviceFlag.BulkAssignDevices(Model.DeviceFlag.Id, false)))'); + $form.attr('action', $form.attr('data-addaction')); } assignDialog.dialog('open'); @@ -538,8 +542,12 @@ } @if (canDelete) { - @Html.ActionLinkButton("Delete", MVC.API.DeviceFlag.Delete(Model.DeviceFlag.Id, true), "Config_DeviceFlags_Actions_Delete_Button") -
    + +
    + @using (Html.BeginForm(MVC.API.DeviceFlag.Delete(Model.DeviceFlag.Id, true))) + { + @Html.AntiForgeryToken() + }

    This item will be permanently deleted and cannot be recovered.
    @@ -555,29 +563,27 @@

    diff --git a/Disco.Web/Areas/Config/Views/DeviceFlag/Show.generated.cs b/Disco.Web/Areas/Config/Views/DeviceFlag/Show.generated.cs index b8ea9c7c..eeebef49 100644 --- a/Disco.Web/Areas/Config/Views/DeviceFlag/Show.generated.cs +++ b/Disco.Web/Areas/Config/Views/DeviceFlag/Show.generated.cs @@ -130,53 +130,53 @@ WriteLiteral("\r\n \r\n
    \r\n \r\n #line 40 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" if (canConfig) - { + { #line default #line hidden #line 41 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - Write(Html.EditorFor(model => model.DeviceFlag.Name)); + Write(Html.EditorFor(model => model.DeviceFlag.Name)); #line default #line hidden #line 41 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - - + + #line default #line hidden #line 42 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - Write(AjaxHelpers.AjaxSave()); + Write(AjaxHelpers.AjaxSave()); #line default #line hidden #line 42 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - - + + #line default #line hidden #line 43 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - Write(AjaxHelpers.AjaxLoader()); + Write(AjaxHelpers.AjaxLoader()); #line default #line hidden #line 43 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - + #line default #line hidden -WriteLiteral(" #line default #line hidden WriteLiteral("\',\r\n \'FlagName\'\r\n );\r\n " + -" });\r\n \r\n"); +" });\r\n \r\n"); #line 54 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - } - else - { - + } + else + { + #line default #line hidden #line 57 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - Write(Model.DeviceFlag.Name); + Write(Model.DeviceFlag.Name); #line default #line hidden #line 57 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - - } + + } #line default @@ -247,39 +247,39 @@ WriteLiteral(" \r\n \r\n \r\n #line 67 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - + #line default #line hidden #line 68 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - Write(AjaxHelpers.AjaxSave()); + Write(AjaxHelpers.AjaxSave()); #line default #line hidden #line 68 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - - + + #line default #line hidden #line 69 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - Write(AjaxHelpers.AjaxLoader()); + Write(AjaxHelpers.AjaxLoader()); #line default #line hidden #line 69 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - + #line default #line hidden -WriteLiteral(" #line default #line hidden WriteLiteral("\',\r\n \'Description\'\r\n );" + -"\r\n });\r\n \r\n"); +"\r\n });\r\n \r\n"); #line 80 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - } - else - { + } + else + { #line default #line hidden -WriteLiteral("
    \r\n");
    +WriteLiteral("                
    \r\n");
     
                 
                 #line 84 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml"
    @@ -359,7 +359,7 @@ WriteLiteral("                    
    \r\n"); #line 93 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - } + } #line default @@ -429,25 +429,25 @@ WriteLiteral(" data-colour=\""); #line hidden WriteLiteral("\""); -WriteAttribute("class", Tuple.Create(" class=\"", 4688), Tuple.Create("\"", 4765) -, Tuple.Create(Tuple.Create("", 4696), Tuple.Create("fa", 4696), true) -, Tuple.Create(Tuple.Create(" ", 4698), Tuple.Create("fa-", 4699), true) +WriteAttribute("class", Tuple.Create(" class=\"", 4620), Tuple.Create("\"", 4697) +, Tuple.Create(Tuple.Create("", 4628), Tuple.Create("fa", 4628), true) +, Tuple.Create(Tuple.Create(" ", 4630), Tuple.Create("fa-", 4631), true) #line 110 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - , Tuple.Create(Tuple.Create("", 4702), Tuple.Create(Model.DeviceFlag.Icon + , Tuple.Create(Tuple.Create("", 4634), Tuple.Create(Model.DeviceFlag.Icon #line default #line hidden -, 4702), false) -, Tuple.Create(Tuple.Create(" ", 4726), Tuple.Create("fa-4x", 4727), true) -, Tuple.Create(Tuple.Create(" ", 4732), Tuple.Create("d-", 4733), true) +, 4634), false) +, Tuple.Create(Tuple.Create(" ", 4658), Tuple.Create("fa-4x", 4659), true) +, Tuple.Create(Tuple.Create(" ", 4664), Tuple.Create("d-", 4665), true) #line 110 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - , Tuple.Create(Tuple.Create("", 4735), Tuple.Create(Model.DeviceFlag.IconColour + , Tuple.Create(Tuple.Create("", 4667), Tuple.Create(Model.DeviceFlag.IconColour #line default #line hidden -, 4735), false) +, 4667), false) ); WriteLiteral(">\r\n"); @@ -482,20 +482,73 @@ WriteLiteral(" class=\"dialog\""); WriteLiteral(" title=\"Device Flag Icon\""); -WriteLiteral(">\r\n
    \r\n \r\n"); + + + #line 116 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + + + #line default + #line hidden + + #line 116 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + using (Html.BeginForm(MVC.API.DeviceFlag.UpdateIconAndColour(id: Model.DeviceFlag.Id, redirect: true))) + { + + + #line default + #line hidden + + #line 118 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 118 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + + + + #line default + #line hidden +WriteLiteral(" \r\n"); + +WriteLiteral(" \r\n"); + + + #line 121 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + } + + + #line default + #line hidden +WriteLiteral("
    \r\n \r\n"); - #line 118 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 124 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" #line default #line hidden - #line 118 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 124 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" foreach (var colour in Model.ThemeColours) { @@ -507,7 +560,7 @@ WriteLiteral("
    \r\n " iconCode = $this.attr(\'data-icon\');\r\n\r\n " + "icons.find(\'i\').removeClass(\'selected\');\r\n $t" + "his.addClass(\'selected\');\r\n }\r\n\r\n " + -" function save() {\r\n var url =" + -" \'"); +" function save() {\r\n dialog.di" + +"alog(\"option\", \"buttons\", null);\r\n const $for" + +"m = dialog.find(\'form\');\r\n $form.find(\'input[" + +"name=\"icon\"]\').val(icons.find(\'i.selected\').attr(\'data-icon\'));\r\n " + +" $form.find(\'input[name=\"iconColour\"]\').val(colours.find(\'i." + +"selected\').attr(\'data-colour\'));\r\n $form.trig" + +"ger(\'submit\');\r\n }\r\n\r\n " + +" function cancel() {\r\n $(this).dialog(\"cl" + +"ose\");\r\n }\r\n\r\n $(f" + +"unction () {\r\n icon = $(\'#Config_DeviceFlags_" + +"Icon\');\r\n $(\'#Config_DeviceFlags_Icon_Update\'" + +").click(showDialog);\r\n });\r\n " + +" }());\r\n \r\n
    \r\n"); - #line 186 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" - Write(Url.Action(MVC.API.DeviceFlag.UpdateIconAndColour(id: Model.DeviceFlag.Id, redirect: true))); - - - #line default - #line hidden -WriteLiteral(@"', - data = { - Icon: icons.find('i.selected').attr('data-icon'), - IconColour: colours.find('i.selected').attr('data-colour') - }; - window.location.href = url + '&' + $.param(data); - - dialog.dialog(""disable""); - dialog.dialog(""option"", ""buttons"", null); - } - - function cancel() { - $(this).dialog(""close""); - } - - $(function () { - icon = $('#Config_DeviceFlags_Icon'); - $('#Config_DeviceFlags_Icon_Update').click(showDialog); - }); - }()); - - -"); - - - #line 208 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 210 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" } @@ -692,13 +725,13 @@ WriteLiteral(@"', WriteLiteral(" \r\n
    \r\n"); - #line 211 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 213 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" #line default #line hidden - #line 211 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 213 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" if (hideAdvanced) { @@ -732,7 +765,7 @@ WriteLiteral(@">Show Advanced Options "); - #line 227 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 229 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" } @@ -746,13 +779,13 @@ WriteLiteral(">\r\n \r\n \r\n \r\n
    \r\n N" + +"ame:\r\n \r\n"); WriteLiteral(" "); #line 16 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml" - Write(Html.EditorFor(model => model.DeviceFlag.Name)); + Write(Html.EditorFor(model => model.Name)); #line default @@ -112,19 +98,20 @@ WriteLiteral("
    "); #line 16 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml" - Write(Html.ValidationMessageFor(model => model.DeviceFlag.Name)); + Write(Html.ValidationMessageFor(model => model.Name)); #line default #line hidden WriteLiteral("\r\n
    \r\n"); +">\r\n Description:\r\n \r\n " + +"\r\n"); WriteLiteral(" "); - #line 23 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml" - Write(Html.EditorFor(model => model.DeviceFlag.Description)); + #line 24 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml" + Write(Html.EditorFor(model => model.Description)); #line default @@ -132,8 +119,8 @@ WriteLiteral(" "); WriteLiteral("
    "); - #line 23 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml" - Write(Html.ValidationMessageFor(model => model.DeviceFlag.Description)); + #line 24 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml" + Write(Html.ValidationMessageFor(model => model.Description)); #line default @@ -156,11 +143,11 @@ WriteLiteral(" \r\n $(function () {\r\n $(\'#DeviceFlag_Name\').focus().select();\r\n" + -" });\r\n \r\n"); +WriteLiteral(">\r\n $(function () {\r\n $(\'#Name\').focus().select();\r\n });" + +"\r\n \r\n"); - #line 36 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml" + #line 37 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml" } diff --git a/Disco.Web/Areas/Config/Views/DeviceFlag/Show.cshtml b/Disco.Web/Areas/Config/Views/DeviceFlag/Show.cshtml index f9348a83..d466ee35 100644 --- a/Disco.Web/Areas/Config/Views/DeviceFlag/Show.cshtml +++ b/Disco.Web/Areas/Config/Views/DeviceFlag/Show.cshtml @@ -38,10 +38,10 @@
    @if (canConfig) - {@Html.EditorFor(model => model.DeviceFlag.Name) - @AjaxHelpers.AjaxSave() - @AjaxHelpers.AjaxLoader() - - } - else - { - @Model.DeviceFlag.Name - } + + } + else + { + @Model.DeviceFlag.Name + }
    @if (canConfig) {@Html.EditorFor(model => model.DeviceFlag.Description) - @AjaxHelpers.AjaxSave() - @AjaxHelpers.AjaxLoader() - - } - else - { -
    +                
    +            }
    +            else
    +            {
    +                
                         @if (string.IsNullOrEmpty(Model.DeviceFlag.Description))
                         {
                         <None>
    @@ -90,7 +90,7 @@
                             @Model.DeviceFlag.Description.ToHtmlComment()
                         }
                         
    - } + }
    \r\n On Assignment
    Expres "
    \r\n"); - #line 233 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 235 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" #line default #line hidden - #line 233 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 235 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" if (canConfig) { @@ -760,56 +793,56 @@ WriteLiteral(">\r\n \r\n On Assignment
    Expres #line default #line hidden - #line 235 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 237 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(Html.EditorFor(model => model.DeviceFlag.OnAssignmentExpression)); #line default #line hidden - #line 235 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 237 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" #line default #line hidden - #line 236 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 238 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(AjaxHelpers.AjaxRemove()); #line default #line hidden - #line 236 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 238 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" #line default #line hidden - #line 237 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 239 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 237 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 239 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" #line default #line hidden - #line 238 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 240 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 238 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 240 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" @@ -831,7 +864,7 @@ WriteLiteral(@"> '"); - #line 248 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 250 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(Url.Action(MVC.API.DeviceFlag.UpdateOnAssignmentExpression(Model.DeviceFlag.Id))); @@ -859,7 +892,7 @@ WriteLiteral("\',\r\n \'OnAssignmentExpressio " \r\n"); - #line 277 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 279 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" } else { @@ -876,7 +909,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>\r\n"); - #line 283 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 285 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" } else { @@ -893,7 +926,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 287 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 289 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(Model.DeviceFlag.OnAssignmentExpression); @@ -902,7 +935,7 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n"); - #line 289 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 291 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" } } @@ -932,13 +965,13 @@ WriteLiteral(">\r\n
    \r\n On Unassignment
    Expr "
    \r\n"); - #line 303 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 305 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" #line default #line hidden - #line 303 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 305 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" if (canConfig) { @@ -946,56 +979,56 @@ WriteLiteral(">\r\n \r\n On Unassignment
    Expr #line default #line hidden - #line 305 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 307 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(Html.EditorFor(model => model.DeviceFlag.OnUnassignmentExpression)); #line default #line hidden - #line 305 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 307 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" #line default #line hidden - #line 306 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 308 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(AjaxHelpers.AjaxRemove()); #line default #line hidden - #line 306 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 308 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" #line default #line hidden - #line 307 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 309 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 307 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 309 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" #line default #line hidden - #line 308 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 310 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 308 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 310 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" @@ -1017,7 +1050,7 @@ WriteLiteral(@"> '"); - #line 318 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 320 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(Url.Action(MVC.API.DeviceFlag.UpdateOnUnassignmentExpression(Model.DeviceFlag.Id))); @@ -1055,7 +1088,7 @@ WriteLiteral(@"', "); - #line 347 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 349 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" } else { @@ -1072,7 +1105,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>\r\n"); - #line 353 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 355 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" } else { @@ -1089,7 +1122,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 357 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 359 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(Model.DeviceFlag.OnUnassignmentExpression); @@ -1098,7 +1131,7 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n"); - #line 359 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 361 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" } } @@ -1130,7 +1163,7 @@ WriteLiteral(">\r\n
    \r\n Linked Groups:\r\n WriteLiteral(" "); - #line 375 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 377 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel() { CanConfigure = canConfig, @@ -1149,7 +1182,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 384 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 386 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel() { CanConfigure = canConfig, @@ -1166,28 +1199,28 @@ WriteLiteral(" "); WriteLiteral("\r\n"); - #line 393 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 395 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" #line default #line hidden - #line 393 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 395 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" if (canConfig) - { + { #line default #line hidden - #line 395 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 397 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupShared)); #line default #line hidden - #line 395 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 397 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" } @@ -1197,7 +1230,7 @@ WriteLiteral("\r\n"); WriteLiteral(" \r\n \r\n
    \r\n\r\n"); - #line 402 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 404 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" if (canBulkAssignment || canDelete || canShowDevices || canExportCurrent || canExportAll) { @@ -1211,13 +1244,13 @@ WriteLiteral(" class=\"actionBar\""); WriteLiteral(">\r\n"); - #line 405 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 407 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" #line default #line hidden - #line 405 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 407 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" if (canExportCurrent) { @@ -1225,14 +1258,14 @@ WriteLiteral(">\r\n"); #line default #line hidden - #line 407 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 409 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(Html.ActionLinkButton("Export Current Assignments", MVC.Config.DeviceFlag.Export(null, Model.DeviceFlag.Id, true), "Config_DeviceFlags_Actions_ExportCurrent_Button")); #line default #line hidden - #line 407 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 409 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" } @@ -1242,7 +1275,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 409 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 411 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" if (canExportAll) { @@ -1250,14 +1283,14 @@ WriteLiteral(" "); #line default #line hidden - #line 411 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 413 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" Write(Html.ActionLinkButton("Export All Assignments", MVC.Config.DeviceFlag.Export(null, Model.DeviceFlag.Id, false), "Config_DeviceFlags_Actions_ExportAll_Button")); #line default #line hidden - #line 411 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 413 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" } @@ -1267,7 +1300,7 @@ WriteLiteral(" "); WriteLiteral(" "); - #line 413 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" + #line 415 "..\..\Areas\Config\Views\DeviceFlag\Show.cshtml" if (canBulkAssignment) { @@ -1358,7 +1391,40 @@ WriteLiteral(" action=\"#\""); WriteLiteral(" method=\"post\""); -WriteLiteral(">\r\n
    " + +"
    Description\r\n " + -"Cost\r\n Job Types\r\n
    \r\n Description\r\n \r\n Cost\r\n \r\n " + +" Job Types\r\n
    \r\n"); WriteLiteral(" "); - #line 292 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 295 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" Write(item.Description); @@ -517,7 +501,7 @@ WriteLiteral("\r\n \r\n"); WriteLiteral(" "); - #line 295 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 298 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" Write(item.Cost.ToString("C")); @@ -526,13 +510,13 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n"); - #line 298 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 301 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" #line default #line hidden - #line 298 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 301 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" if (item.JobSubTypes.Count > 0) { @@ -542,13 +526,13 @@ WriteLiteral("\r\n \r\n"); WriteLiteral("
      \r\n"); - #line 301 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 304 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" #line default #line hidden - #line 301 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 304 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" foreach (var jst in item.JobSubTypes) { @@ -558,7 +542,7 @@ WriteLiteral("
        \r\n"); WriteLiteral("
      • "); - #line 303 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 306 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" Write(jst.Description); @@ -567,7 +551,7 @@ WriteLiteral("
      • "); WriteLiteral("
      • \r\n"); - #line 304 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 307 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" } @@ -576,7 +560,7 @@ WriteLiteral("\r\n"); WriteLiteral("
      \r\n"); - #line 306 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 309 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" } else { @@ -591,7 +575,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>\r\n"); - #line 310 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 313 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" } @@ -600,7 +584,7 @@ WriteLiteral("><None Specified>\r\n"); WriteLiteral("
    \r\n"); - #line 315 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" + #line 318 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml" } #line default diff --git a/Disco.Web/Areas/Config/Views/DeviceProfile/Create.cshtml b/Disco.Web/Areas/Config/Views/DeviceProfile/Create.cshtml index 62f55fbb..31085fac 100644 --- a/Disco.Web/Areas/Config/Views/DeviceProfile/Create.cshtml +++ b/Disco.Web/Areas/Config/Views/DeviceProfile/Create.cshtml @@ -1,11 +1,12 @@ @model Disco.Web.Areas.Config.Models.DeviceProfile.CreateModel @{ Authorization.RequireAll(Claims.Config.DeviceProfile.Create, Claims.Config.DeviceProfile.Configure); - + ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Create"); } @using (Html.BeginForm()) -{ +{ + @Html.AntiForgeryToken() @Html.ValidationSummary(false)
    @@ -14,28 +15,26 @@ Name: - -
    - @Html.TextBoxFor(model => model.DeviceProfile.Name)
    @Html.ValidationMessageFor(model => model.DeviceProfile.Name) + @Html.TextBoxFor(model => model.Name)
    @Html.ValidationMessageFor(model => model.Name)
    Short Name: @Html.TextBoxFor(model => model.DeviceProfile.ShortName)
    @Html.ValidationMessageFor(model => model.DeviceProfile.ShortName) +
    + @Html.TextBoxFor(model => model.ShortName)
    @Html.ValidationMessageFor(model => model.ShortName)
    Description: @Html.TextBoxFor(model => model.DeviceProfile.Description)
    @Html.ValidationMessageFor(model => model.DeviceProfile.Description) +
    + @Html.TextBoxFor(model => model.Description)
    @Html.ValidationMessageFor(model => model.Description)
    - @Html.HiddenFor(model => model.DeviceProfile.ComputerNameTemplate) - @Html.HiddenFor(model => model.DeviceProfile.ProvisionADAccount) - @Html.HiddenFor(model => model.DeviceProfile.DistributionType) - @Html.HiddenFor(model => model.DeviceProfile.OrganisationalUnit)

    diff --git a/Disco.Web/Areas/Config/Views/DeviceProfile/Create.generated.cs b/Disco.Web/Areas/Config/Views/DeviceProfile/Create.generated.cs index bbba5625..cda0a2de 100644 --- a/Disco.Web/Areas/Config/Views/DeviceProfile/Create.generated.cs +++ b/Disco.Web/Areas/Config/Views/DeviceProfile/Create.generated.cs @@ -47,7 +47,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile #line 2 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" Authorization.RequireAll(Claims.Config.DeviceProfile.Create, Claims.Config.DeviceProfile.Configure); - + ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Create"); @@ -58,20 +58,34 @@ WriteLiteral("\r\n"); #line 7 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" using (Html.BeginForm()) -{ +{ #line default #line hidden #line 9 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" -Write(Html.ValidationSummary(false)); +Write(Html.AntiForgeryToken()); #line default #line hidden #line 9 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" + + + + #line default + #line hidden + + #line 10 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" +Write(Html.ValidationSummary(false)); + + + #line default + #line hidden + + #line 10 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" @@ -86,11 +100,11 @@ WriteLiteral(" style=\"width: 450px\""); WriteLiteral(">\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n Short Name:\r\n \r\n \r\n \r\n WriteLiteral("
    "); - #line 24 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" - Write(Html.ValidationMessageFor(model => model.DeviceProfile.ShortName)); + #line 26 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" + Write(Html.ValidationMessageFor(model => model.ShortName)); #line default #line hidden WriteLiteral("\r\n \r\n \r\n \r\n \r\n Description:\r\n \r\n \r\n \r\n WriteLiteral("
    "); - #line 31 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" - Write(Html.ValidationMessageFor(model => model.DeviceProfile.Description)); + #line 34 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" + Write(Html.ValidationMessageFor(model => model.Description)); #line default #line hidden -WriteLiteral("\r\n \r\n \r\n
    \r\n N" + "ame:\r\n \r\n"); -WriteLiteral(" "); +WriteLiteral(" "); - #line 17 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" - Write(Html.TextBoxFor(model => model.DeviceProfile.Name)); + #line 18 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" + Write(Html.TextBoxFor(model => model.Name)); #line default @@ -98,18 +112,21 @@ WriteLiteral(" "); WriteLiteral("
    "); - #line 17 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" - Write(Html.ValidationMessageFor(model => model.DeviceProfile.Name)); + #line 18 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" + Write(Html.ValidationMessageFor(model => model.Name)); #line default #line hidden WriteLiteral("\r\n
    "); +">\r\n Short Name:\r\n \r\n \r" + +"\n"); + +WriteLiteral(" "); - #line 24 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" - Write(Html.TextBoxFor(model => model.DeviceProfile.ShortName)); + #line 26 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" + Write(Html.TextBoxFor(model => model.ShortName)); #line default @@ -117,19 +134,21 @@ WriteLiteral("\r\n
    " + -""); +"\r\n"); + +WriteLiteral(" "); - #line 31 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" - Write(Html.TextBoxFor(model => model.DeviceProfile.Description)); + #line 34 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" + Write(Html.TextBoxFor(model => model.Description)); #line default @@ -137,57 +156,13 @@ WriteLiteral("\r\n
    \r\n"); - -WriteLiteral(" "); - - - #line 35 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" - Write(Html.HiddenFor(model => model.DeviceProfile.ComputerNameTemplate)); - - - #line default - #line hidden -WriteLiteral("\r\n"); - -WriteLiteral(" "); - - - #line 36 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" - Write(Html.HiddenFor(model => model.DeviceProfile.ProvisionADAccount)); - - - #line default - #line hidden -WriteLiteral("\r\n"); - -WriteLiteral(" "); - - - #line 37 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" - Write(Html.HiddenFor(model => model.DeviceProfile.DistributionType)); - - - #line default - #line hidden -WriteLiteral("\r\n"); - -WriteLiteral(" "); - - - #line 38 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" - Write(Html.HiddenFor(model => model.DeviceProfile.OrganisationalUnit)); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n \r\n \r\n \r\n $(function () {\r\n $(\'#Name\').focus().s "\r\n \r\n"); - #line 48 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" + #line 47 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml" } diff --git a/Disco.Web/Areas/Config/Views/DeviceProfile/Defaults.cshtml b/Disco.Web/Areas/Config/Views/DeviceProfile/Defaults.cshtml index 15922834..e937f494 100644 --- a/Disco.Web/Areas/Config/Views/DeviceProfile/Defaults.cshtml +++ b/Disco.Web/Areas/Config/Views/DeviceProfile/Defaults.cshtml @@ -1,8 +1,10 @@ @model Disco.Web.Areas.Config.Models.DeviceProfile.DefaultsModel @{ Authorization.Require(Claims.Config.DeviceProfile.ConfigureDefaults); - + ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Defaults"); + + Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers"); }
    @@ -15,19 +17,12 @@ @AjaxHelpers.AjaxLoader() @@ -41,19 +36,12 @@ @AjaxHelpers.AjaxLoader() diff --git a/Disco.Web/Areas/Config/Views/DeviceProfile/Defaults.generated.cs b/Disco.Web/Areas/Config/Views/DeviceProfile/Defaults.generated.cs index 5752034e..e3989d41 100644 --- a/Disco.Web/Areas/Config/Views/DeviceProfile/Defaults.generated.cs +++ b/Disco.Web/Areas/Config/Views/DeviceProfile/Defaults.generated.cs @@ -47,9 +47,11 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile #line 2 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml" Authorization.Require(Claims.Config.DeviceProfile.ConfigureDefaults); - + ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Defaults"); + Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers"); + #line default #line hidden @@ -74,7 +76,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 14 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml" + #line 16 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml" Write(Html.DropDownListFor(m => m.Default, Model.DeviceProfiles.ToSelectListItems(Model.Default))); @@ -85,7 +87,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 15 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml" + #line 17 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml" Write(AjaxHelpers.AjaxLoader()); @@ -95,36 +97,20 @@ WriteLiteral("\r\n - $(function () { - $('#Default').change(function () { - $this = $(this); - $ajaxLoading = $this.next('.ajaxLoading').show(); - var data = { id: $this.val() }; - $.getJSON('"); +WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" + +"ctions.PropertyChangeHelper(\r\n $(\'#Default\'),\r\n " + +" \'Default Profile\',\r\n \'"); - #line 22 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml" - Write(Url.Action(MVC.API.DeviceProfile.Default())); + #line 23 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml" + Write(Url.Action(MVC.API.DeviceProfile.Default())); #line default #line hidden -WriteLiteral(@"', data, function (response, result) { - if (result != 'success' || response != 'OK') { - alert('Unable to change Default Device Profile:\n' + response); - $ajaxLoading.hide(); - } else { - $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow'); - } - }); - }); - }); - - - - - \r\n \r\n \r\n <" + +"tr>\r\n \r\n"); WriteLiteral(" "); - #line 40 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml" + #line 35 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml" Write(Html.DropDownListFor(m => m.DefaultAddDeviceOffline, Model.DeviceProfilesAndNone.ToSelectListItems(Model.DefaultAddDeviceOffline))); @@ -149,7 +135,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 41 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml" + #line 36 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml" Write(AjaxHelpers.AjaxLoader()); @@ -161,35 +147,21 @@ WriteLiteral(" type=\"text/javascript\""); WriteLiteral(@"> $(function () { - $('#DefaultAddDeviceOffline').change(function () { - $this = $(this); - $ajaxLoading = $this.next('.ajaxLoading').show(); - var data = { id: $this.val() }; - $.getJSON('"); + document.DiscoFunctions.PropertyChangeHelper( + $('#DefaultAddDeviceOffline'), + 'Default Add Device Offline Profile', + '"); - #line 48 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml" - Write(Url.Action(MVC.API.DeviceProfile.DefaultAddDeviceOffline())); + #line 42 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml" + Write(Url.Action(MVC.API.DeviceProfile.DefaultAddDeviceOffline())); #line default #line hidden -WriteLiteral(@"', data, function (response, result) { - if (result != 'success' || response != 'OK') { - alert('Unable to change Default Add Device Offline Device Profile:\n' + response); - $ajaxLoading.hide(); - } else { - $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow'); - } - }); - }); - }); - - - -
    -
    -"); +WriteLiteral("\',\r\n \'id\'\r\n );\r\n " + +" });\r\n \r\n \r\n \r\n \r\n
    \r\n"); } } diff --git a/Disco.Web/Areas/Config/Views/DeviceProfile/Show.cshtml b/Disco.Web/Areas/Config/Views/DeviceProfile/Show.cshtml index 039bd690..597b67f7 100644 --- a/Disco.Web/Areas/Config/Views/DeviceProfile/Show.cshtml +++ b/Disco.Web/Areas/Config/Views/DeviceProfile/Show.cshtml @@ -568,7 +568,7 @@
    - @using (Html.BeginForm(MVC.API.DeviceProfile.UpdateOrganisationalUnit(Model.DeviceProfile.Id, redirect: true), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.DeviceProfile.UpdateOrganisationalUnit(Model.DeviceProfile.Id, redirect: true))) { @Html.AntiForgeryToken(); @@ -754,23 +754,30 @@ { } @@ -783,18 +790,25 @@ $container.on('change', 'input', function () { var $ajaxLoading = $('#DeviceProfile_CertificateProviders_loading').show(); - var data = { - CertificateAuthorityProviders: $('input:checked', $container).map(function () { return $(this).val() }).get().join(',') - }; - $.getJSON('@(Url.Action(MVC.API.DeviceProfile.UpdateCertificateAuthorityProviders(Model.DeviceProfile.Id)))', data, function (response, result) { - if (result != 'success' || response != 'OK') { - alert('Unable to change property "CertificateAuthorityProviders":\n' + response); - $ajaxLoading.hide(); - } else { + const body = new FormData(); + body.append('__RequestVerificationToken', document.body.dataset.antiforgery); + body.append('certificateAuthorityProviders', $container.find('input:checked',).map(function () { return $(this).val() }).get().join(',')); + + fetch('@(Url.Action(MVC.API.DeviceProfile.UpdateCertificateAuthorityProviders(Model.DeviceProfile.Id)))', { + method: 'POST', + body: body + }).then(r => { + if (r.ok) { $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow'); + } else { + alert('Unable to change property "CertificateAuthorityProviders":\n' + r.statusText); + $ajaxLoading.hide(); } - }) - }) + }).catch(e => { + alert('Unable to change property "CertificateAuthorityProviders":\n' + e); + $ajaxLoading.hide(); + }); + }); }); } @@ -870,18 +884,25 @@ $container.on('change', 'input', function () { var $ajaxLoading = $('#DeviceProfile_WirelessProfileProviders_loading').show(); - var data = { - WirelessProfileProviders: $('input:checked', $container).map(function () { return $(this).val() }).get().join(',') - }; - $.getJSON('@(Url.Action(MVC.API.DeviceProfile.UpdateWirelessProfileProviders(Model.DeviceProfile.Id)))', data, function (response, result) { - if (result != 'success' || response != 'OK') { - alert('Unable to change property "WirelessProfileProviders":\n' + response); - $ajaxLoading.hide(); - } else { + const body = new FormData(); + body.append('__RequestVerificationToken', document.body.dataset.antiforgery); + body.append('wirelessProfileProviders', $container.find('input:checked',).map(function () { return $(this).val() }).get().join(',')); + + fetch('@(Url.Action(MVC.API.DeviceProfile.UpdateWirelessProfileProviders(Model.DeviceProfile.Id)))', { + method: 'POST', + body: body + }).then(r => { + if (r.ok) { $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow'); + } else { + alert('Unable to change property "WirelessProfileProviders":\n' + r.statusText); + $ajaxLoading.hide(); } - }) - }) + }).catch(e => { + alert('Unable to change property "WirelessProfileProviders":\n' + e); + $ajaxLoading.hide(); + }); + }); }); } @@ -967,50 +988,13 @@ -@if (canDelete) -{ -
    -

    - - This item will be permanently deleted and cannot be recovered. Are you sure? -

    -
    - -} @Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model)
    @if (Model.CanDecommission) {
    - @using (Html.BeginForm(MVC.API.Device.DeviceProfileDecommission(Model.DeviceProfile.Id), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.Device.DeviceProfileDecommission(Model.DeviceProfile.Id))) { @Html.AntiForgeryToken()
    @@ -1067,7 +1051,44 @@ } @if (canDelete) { - @Html.ActionLinkButton("Delete", MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true), "buttonDelete") + +
    + @using (Html.BeginForm(MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true))) + { + @Html.AntiForgeryToken() + } +

    + + This item will be permanently deleted and cannot be recovered. Are you sure? +

    +
    + } @if (Authorization.Has(Claims.Device.Actions.Export)) { diff --git a/Disco.Web/Areas/Config/Views/DeviceProfile/Show.generated.cs b/Disco.Web/Areas/Config/Views/DeviceProfile/Show.generated.cs index e2dc5092..8d746e60 100644 --- a/Disco.Web/Areas/Config/Views/DeviceProfile/Show.generated.cs +++ b/Disco.Web/Areas/Config/Views/DeviceProfile/Show.generated.cs @@ -1825,7 +1825,7 @@ WriteLiteral(">\r\n
    \r\n"); #line hidden #line 571 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" - using (Html.BeginForm(MVC.API.DeviceProfile.UpdateOrganisationalUnit(Model.DeviceProfile.Id, redirect: true), FormMethod.Post)) + using (Html.BeginForm(MVC.API.DeviceProfile.UpdateOrganisationalUnit(Model.DeviceProfile.Id, redirect: true))) { @@ -2230,38 +2230,45 @@ WriteLiteral(" type=\"text/javascript\""); WriteLiteral(@"> $(function () { - var $container = $('#DeviceProfile_CertificateProviders'); + const $container = $('#DeviceProfile_CertificateProviders'); $container.on('change', 'input', function () { - var $ajaxLoading = $('#DeviceProfile_CertificateProviders_loading').show(); + const $ajaxLoading = $('#DeviceProfile_CertificateProviders_loading').show(); - var data = { - CertificateProviders: $('input:checked', $container).map(function () { return $(this).val() }).get().join(',') - }; - $.getJSON('"); + const body = new FormData(); + body.append('__RequestVerificationToken', document.body.dataset.antiforgery); + body.append('certificateProviders', $container.find('input:checked',).map(function () { return $(this).val() }).get().join(',')); + + fetch('"); - #line 765 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" - Write(Url.Action(MVC.API.DeviceProfile.UpdateCertificateProviders(Model.DeviceProfile.Id))); + #line 766 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + Write(Url.Action(MVC.API.DeviceProfile.UpdateCertificateProviders(Model.DeviceProfile.Id))); #line default #line hidden -WriteLiteral(@"', data, function (response, result) { - if (result != 'success' || response != 'OK') { - alert('Unable to change property ""CertificateProviders"":\n' + response); - $ajaxLoading.hide(); - } else { +WriteLiteral(@"', { + method: 'POST', + body: body + }).then(r => { + if (r.ok) { $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow'); + } else { + alert('Unable to change property ""CertificateProviders"":\n' + r.statusText); + $ajaxLoading.hide(); } - }) - }) + }).catch(e => { + alert('Unable to change property ""CertificateProviders"":\n' + e); + $ajaxLoading.hide(); + }); + }); }); "); - #line 776 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 783 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -2270,7 +2277,7 @@ WriteLiteral(@"', data, function (response, result) { WriteLiteral(" "); - #line 777 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 784 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" if (canConfig && Model.CertificateProviders.Count > 0) { @@ -2288,33 +2295,40 @@ WriteLiteral(@"> $container.on('change', 'input', function () { var $ajaxLoading = $('#DeviceProfile_CertificateProviders_loading').show(); - var data = { - CertificateAuthorityProviders: $('input:checked', $container).map(function () { return $(this).val() }).get().join(',') - }; - $.getJSON('"); + const body = new FormData(); + body.append('__RequestVerificationToken', document.body.dataset.antiforgery); + body.append('certificateAuthorityProviders', $container.find('input:checked',).map(function () { return $(this).val() }).get().join(',')); + + fetch('"); - #line 789 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" - Write(Url.Action(MVC.API.DeviceProfile.UpdateCertificateAuthorityProviders(Model.DeviceProfile.Id))); + #line 797 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + Write(Url.Action(MVC.API.DeviceProfile.UpdateCertificateAuthorityProviders(Model.DeviceProfile.Id))); #line default #line hidden -WriteLiteral(@"', data, function (response, result) { - if (result != 'success' || response != 'OK') { - alert('Unable to change property ""CertificateAuthorityProviders"":\n' + response); - $ajaxLoading.hide(); - } else { +WriteLiteral(@"', { + method: 'POST', + body: body + }).then(r => { + if (r.ok) { $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow'); + } else { + alert('Unable to change property ""CertificateAuthorityProviders"":\n' + r.statusText); + $ajaxLoading.hide(); } - }) - }) + }).catch(e => { + alert('Unable to change property ""CertificateAuthorityProviders"":\n' + e); + $ajaxLoading.hide(); + }); + }); }); "); - #line 800 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 814 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -2324,13 +2338,13 @@ WriteLiteral(" \r\n \r\n

    Devic "tes

    \r\n"); - #line 804 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 818 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" #line default #line hidden - #line 804 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 818 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" if (canConfig && Model.CertificateProviders.Count > 0) { @@ -2338,14 +2352,14 @@ WriteLiteral(" \r\n \r\n

    Devic #line default #line hidden - #line 806 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 820 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(CommonHelpers.CheckBoxList("DeviceProfile_CertificateProviders", "DeviceProfile_CertificateProviders", Model.CertificateProviders.ToSelectListItems(Model.DeviceProfile.GetCertificateProviders()))); #line default #line hidden - #line 806 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 820 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } else @@ -2365,7 +2379,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Allocated>\r\n"); - #line 815 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 829 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } else { @@ -2376,13 +2390,13 @@ WriteLiteral("><None Allocated>\r\n"); WriteLiteral("
      \r\n"); - #line 819 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 833 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" #line default #line hidden - #line 819 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 833 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" foreach (var certificateProvider in certificateProviders) { @@ -2392,7 +2406,7 @@ WriteLiteral("
        \r\n"); WriteLiteral("
      • "); - #line 821 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 835 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(certificateProvider.Name); @@ -2401,7 +2415,7 @@ WriteLiteral("
      • "); WriteLiteral("
      • \r\n"); - #line 822 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 836 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -2410,7 +2424,7 @@ WriteLiteral("\r\n"); WriteLiteral("
      \r\n"); - #line 824 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 838 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } } @@ -2424,13 +2438,13 @@ WriteLiteral(" style=\"margin-top: 4px;\""); WriteLiteral(">Authority Certificates

    \r\n"); - #line 827 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 841 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" #line default #line hidden - #line 827 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 841 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" if (canConfig && Model.CertificateAuthorityProviders.Count > 0) { @@ -2438,14 +2452,14 @@ WriteLiteral(">Authority Certificates\r\n"); #line default #line hidden - #line 829 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 843 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(CommonHelpers.CheckBoxList("DeviceProfile_CertificateAuthorityProviders", "DeviceProfile_CertificateAuthorityProviders", Model.CertificateAuthorityProviders.ToSelectListItems(Model.DeviceProfile.GetCertificateAuthorityProviders()))); #line default #line hidden - #line 829 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 843 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } else @@ -2465,7 +2479,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Allocated>\r\n"); - #line 838 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 852 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } else { @@ -2476,13 +2490,13 @@ WriteLiteral("><None Allocated>\r\n"); WriteLiteral("
      \r\n"); - #line 842 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 856 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" #line default #line hidden - #line 842 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 856 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" foreach (var certificateProvider in certificateProviders) { @@ -2492,7 +2506,7 @@ WriteLiteral("
        \r\n"); WriteLiteral("
      • "); - #line 844 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 858 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(certificateProvider.Name); @@ -2501,7 +2515,7 @@ WriteLiteral("
      • "); WriteLiteral("
      • \r\n"); - #line 845 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 859 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -2510,7 +2524,7 @@ WriteLiteral("\r\n"); WriteLiteral("
      \r\n"); - #line 847 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 861 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } } @@ -2520,7 +2534,7 @@ WriteLiteral("
    \r\n"); WriteLiteral(" "); - #line 849 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 863 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" if (canViewPlugins) { @@ -2541,21 +2555,21 @@ WriteLiteral(" class=\"fa fa-info-circle\""); WriteLiteral(">View the (Url.Action(MVC.Config.Plugins.Install()) + #line 867 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" +, Tuple.Create(Tuple.Create("", 49627), Tuple.Create(Url.Action(MVC.Config.Plugins.Install()) #line default #line hidden -, 48831), false) +, 49627), false) ); WriteLiteral(">Plugin Catalogue to discover and install certificate provider plugins.\r\n " + "

    \r\n
    \r\n"); - #line 856 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 870 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -2565,13 +2579,13 @@ WriteLiteral(" \r\n \r\n \r\n " Provision Wireless Profiles:\r\n"); - #line 862 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 876 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" #line default #line hidden - #line 862 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 876 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" if (canConfig && Model.WirelessProfileProviders.Count > 0) { @@ -2581,20 +2595,20 @@ WriteLiteral(" \r\n \r\n \r\n WriteLiteral("
    \r\n"); - #line 865 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 879 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" #line default #line hidden - #line 865 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 879 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(AjaxHelpers.AjaxLoader("DeviceProfile_WirelessProfileProviders")); #line default #line hidden - #line 865 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 879 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" @@ -2611,33 +2625,40 @@ WriteLiteral(@"> $container.on('change', 'input', function () { var $ajaxLoading = $('#DeviceProfile_WirelessProfileProviders_loading').show(); - var data = { - WirelessProfileProviders: $('input:checked', $container).map(function () { return $(this).val() }).get().join(',') - }; - $.getJSON('"); + const body = new FormData(); + body.append('__RequestVerificationToken', document.body.dataset.antiforgery); + body.append('wirelessProfileProviders', $container.find('input:checked',).map(function () { return $(this).val() }).get().join(',')); + + fetch('"); - #line 876 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" - Write(Url.Action(MVC.API.DeviceProfile.UpdateWirelessProfileProviders(Model.DeviceProfile.Id))); + #line 891 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + Write(Url.Action(MVC.API.DeviceProfile.UpdateWirelessProfileProviders(Model.DeviceProfile.Id))); #line default #line hidden -WriteLiteral(@"', data, function (response, result) { - if (result != 'success' || response != 'OK') { - alert('Unable to change property ""WirelessProfileProviders"":\n' + response); - $ajaxLoading.hide(); - } else { +WriteLiteral(@"', { + method: 'POST', + body: body + }).then(r => { + if (r.ok) { $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow'); + } else { + alert('Unable to change property ""WirelessProfileProviders"":\n' + r.statusText); + $ajaxLoading.hide(); } - }) - }) + }).catch(e => { + alert('Unable to change property ""WirelessProfileProviders"":\n' + e); + $ajaxLoading.hide(); + }); + }); }); "); - #line 887 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 908 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -2646,13 +2667,13 @@ WriteLiteral(@"', data, function (response, result) { WriteLiteral(" \r\n \r\n"); - #line 890 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 911 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" #line default #line hidden - #line 890 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 911 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" if (canConfig && Model.WirelessProfileProviders.Count > 0) { @@ -2660,14 +2681,14 @@ WriteLiteral(" \r\n \r\n"); #line default #line hidden - #line 892 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 913 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(CommonHelpers.CheckBoxList("DeviceProfile_WirelessProfileProviders", "DeviceProfile_WirelessProfileProviders", Model.WirelessProfileProviders.ToSelectListItems(Model.DeviceProfile.GetWirelessProfileProviders()))); #line default #line hidden - #line 892 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 913 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } else @@ -2687,7 +2708,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Allocated>\r\n"); - #line 901 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 922 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } else { @@ -2698,13 +2719,13 @@ WriteLiteral("><None Allocated>\r\n"); WriteLiteral("
      \r\n"); - #line 905 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 926 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" #line default #line hidden - #line 905 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 926 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" foreach (var wirelessProfileProvider in wirelessProfileProviders) { @@ -2714,7 +2735,7 @@ WriteLiteral("
        \r\n"); WriteLiteral("
      • "); - #line 907 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 928 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(wirelessProfileProvider.Name); @@ -2723,7 +2744,7 @@ WriteLiteral("
      • "); WriteLiteral("
      • \r\n"); - #line 908 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 929 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -2732,7 +2753,7 @@ WriteLiteral("\r\n"); WriteLiteral("
      \r\n"); - #line 910 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 931 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } } @@ -2742,7 +2763,7 @@ WriteLiteral("
    \r\n"); WriteLiteral(" "); - #line 912 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 933 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" if (canViewPlugins) { @@ -2763,21 +2784,21 @@ WriteLiteral(" class=\"fa fa-info-circle\""); WriteLiteral(">View the (Url.Action(MVC.Config.Plugins.Install()) + #line 937 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" +, Tuple.Create(Tuple.Create("", 53285), Tuple.Create(Url.Action(MVC.Config.Plugins.Install()) #line default #line hidden -, 52085), false) +, 53285), false) ); WriteLiteral(">Plugin Catalogue to discover and install wireless profile provider plugins.\r" + "\n

    \r\n
    \r\n"); - #line 919 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 940 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -2786,13 +2807,13 @@ WriteLiteral(">Plugin Catalogue to discover and install wireless profile pro WriteLiteral(" \r\n \r\n"); - #line 922 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 943 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" #line default #line hidden - #line 922 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 943 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" if (hideAdvanced) { @@ -2826,7 +2847,7 @@ WriteLiteral(@">Show Advanced Options "); - #line 938 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 959 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -2842,7 +2863,7 @@ WriteLiteral(">\r\n \r\n Linked Groups:\r\n WriteLiteral(" "); - #line 945 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 966 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel() { CanConfigure = canConfig, @@ -2860,7 +2881,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 953 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 974 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel() { CanConfigure = canConfig, @@ -2876,13 +2897,13 @@ WriteLiteral(" "); WriteLiteral("\r\n"); - #line 961 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 982 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" #line default #line hidden - #line 961 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 982 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" if (canConfig) { @@ -2890,14 +2911,14 @@ WriteLiteral("\r\n"); #line default #line hidden - #line 963 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 984 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupShared)); #line default #line hidden - #line 963 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 984 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -2907,69 +2928,7 @@ WriteLiteral("\r\n"); WriteLiteral(" \r\n \r\n \r\n \r\n\r\n"); - #line 970 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" - if (canDelete) -{ - - - #line default - #line hidden -WriteLiteral(" \r\n

    \r\n \r\n This item will be permanently deleted and cannot be recovered." + -" Are you sure?\r\n

    \r\n \r\n"); - -WriteLiteral(" - $(function () { - - var button = $('#buttonDelete'); - var buttonLink = button.attr('href'); - button.attr('href', '#'); - button.click(function () { - $(""#dialogConfirmDelete"").dialog('open'); - }); - - $(""#dialogConfirmDelete"").dialog({ - resizable: false, - height: 140, - modal: true, - autoOpen: false, - buttons: { - ""Delete"": function () { - $(this).dialog('disable'); - window.location.href = buttonLink; - }, - Cancel: function () { - $(this).dialog(""close""); - } - } - }); - - }); - -"); - - - #line 1006 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" -} - - - #line default - #line hidden - - #line 1007 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 991 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model)); @@ -2982,13 +2941,13 @@ WriteLiteral(" class=\"actionBar\""); WriteLiteral(">\r\n"); - #line 1009 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 993 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" #line default #line hidden - #line 1009 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 993 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" if (Model.CanDecommission) { @@ -3014,28 +2973,28 @@ WriteLiteral(" title=\"Profile Device Decommission\""); WriteLiteral(">\r\n"); - #line 1013 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 997 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" #line default #line hidden - #line 1013 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" - using (Html.BeginForm(MVC.API.Device.DeviceProfileDecommission(Model.DeviceProfile.Id), FormMethod.Post)) + #line 997 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + using (Html.BeginForm(MVC.API.Device.DeviceProfileDecommission(Model.DeviceProfile.Id))) { #line default #line hidden - #line 1015 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 999 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(Html.AntiForgeryToken()); #line default #line hidden - #line 1015 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 999 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" @@ -3060,13 +3019,13 @@ WriteLiteral(" class=\"none\""); WriteLiteral(">\r\n"); - #line 1021 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1005 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" #line default #line hidden - #line 1021 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1005 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast().OrderBy(r => r.ToString())) { @@ -3077,33 +3036,33 @@ WriteLiteral("
  • \r\n WriteLiteral(" type=\"radio\""); -WriteAttribute("id", Tuple.Create(" id=\"", 56977), Tuple.Create("\"", 57049) -, Tuple.Create(Tuple.Create("", 56982), Tuple.Create("DeviceProfile_Decommission_Dialog_Reason_", 56982), true) +WriteAttribute("id", Tuple.Create(" id=\"", 56980), Tuple.Create("\"", 57052) +, Tuple.Create(Tuple.Create("", 56985), Tuple.Create("DeviceProfile_Decommission_Dialog_Reason_", 56985), true) - #line 1024 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" - , Tuple.Create(Tuple.Create("", 57023), Tuple.Create((int)decommissionReason + #line 1008 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + , Tuple.Create(Tuple.Create("", 57026), Tuple.Create((int)decommissionReason #line default #line hidden -, 57023), false) +, 57026), false) ); WriteLiteral("\r\n name=\"decommissionReason\""); -WriteAttribute("value", Tuple.Create(" value=\"", 57116), Tuple.Create("\"", 57150) +WriteAttribute("value", Tuple.Create(" value=\"", 57119), Tuple.Create("\"", 57153) - #line 1025 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" -, Tuple.Create(Tuple.Create("", 57124), Tuple.Create((int)decommissionReason + #line 1009 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" +, Tuple.Create(Tuple.Create("", 57127), Tuple.Create((int)decommissionReason #line default #line hidden -, 57124), false) +, 57127), false) ); WriteLiteral(" "); - #line 1025 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1009 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty); @@ -3111,21 +3070,21 @@ WriteLiteral(" "); #line hidden WriteLiteral(" />\r\n ((int)decommissionReason + #line 1010 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + , Tuple.Create(Tuple.Create("", 57340), Tuple.Create((int)decommissionReason #line default #line hidden -, 57337), false) +, 57340), false) ); WriteLiteral(">"); - #line 1026 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1010 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(decommissionReason.ReasonMessage()); @@ -3134,7 +3093,7 @@ WriteLiteral(">"); WriteLiteral("\r\n
  • \r\n"); - #line 1028 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1012 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -3153,7 +3112,7 @@ WriteLiteral(" />\r\n Unassign devices users\r\n "\r\n \r\n"); - #line 1036 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1020 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -3197,7 +3156,7 @@ WriteLiteral(@"> "); - #line 1067 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1051 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -3206,23 +3165,104 @@ WriteLiteral(@"> WriteLiteral(" "); - #line 1068 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1052 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" if (canDelete) { - + + + #line default + #line hidden +WriteLiteral(" Delete\r\n"); + +WriteLiteral(" \r\n"); + + + #line 1056 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line default #line hidden - #line 1070 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" - Write(Html.ActionLinkButton("Delete", MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true), "buttonDelete")); + #line 1056 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + using (Html.BeginForm(MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true))) + { + + + #line default + #line hidden + + #line 1058 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + Write(Html.AntiForgeryToken()); #line default #line hidden - #line 1070 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" - + #line 1058 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + + } + + + #line default + #line hidden +WriteLiteral("

    \r\n \r\n This item will be permanently deleted and cannot be recove" + +"red. Are you sure?\r\n

    \r\n \r\n"); + +WriteLiteral(" + $(function () { + let dialog = null; + $('#buttonDelete').on('click', function () { + if (!dialog) { + dialog = $(""#dialogConfirmDelete"").dialog({ + resizable: false, + width: 300, + modal: true, + autoOpen: false, + buttons: { + ""Delete"": function () { + $(this) + .dialog(""option"", ""buttons"", null) + .find('form').trigger('submit'); + }, + Cancel: function () { + $(this).dialog(""close""); + } + } + }); + } + + dialog.dialog('open'); + }); + }); + +"); + + + #line 1092 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -3231,7 +3271,7 @@ WriteLiteral(" "); WriteLiteral(" "); - #line 1072 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1093 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" if (Authorization.Has(Claims.Device.Actions.Export)) { @@ -3239,14 +3279,14 @@ WriteLiteral(" "); #line default #line hidden - #line 1074 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1095 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.DeviceExportTypes.Profile, Model.DeviceProfile.Id))); #line default #line hidden - #line 1074 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1095 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } @@ -3256,7 +3296,7 @@ WriteLiteral(" "); WriteLiteral(" "); - #line 1076 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1097 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0) { @@ -3264,14 +3304,14 @@ WriteLiteral(" "); #line default #line hidden - #line 1078 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1099 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" Write(Html.ActionLinkButton(string.Format("View {0} Device{1}", Model.DeviceCount, (Model.DeviceCount != 1 ? "s" : null)), MVC.Search.Query(Model.DeviceProfile.Id.ToString(), "DeviceProfile"))); #line default #line hidden - #line 1078 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" + #line 1099 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml" } diff --git a/Disco.Web/Areas/Config/Views/DocumentTemplate/BulkGenerate.cshtml b/Disco.Web/Areas/Config/Views/DocumentTemplate/BulkGenerate.cshtml index 0cd54e1a..b2e3d9ce 100644 --- a/Disco.Web/Areas/Config/Views/DocumentTemplate/BulkGenerate.cshtml +++ b/Disco.Web/Areas/Config/Views/DocumentTemplate/BulkGenerate.cshtml @@ -8,7 +8,7 @@ }
    - @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id))) { if (Model.TemplatePageCount > 1 && Model.TemplatePageCount % 2 != 0) { @@ -79,7 +79,7 @@
    user6;smi0099;@(ActiveDirectory.Context.PrimaryDomain.NetBiosName)\rsmith;Domain Admins
    - @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUsers(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUsers())) {
    @@ -93,7 +93,7 @@ Add all members of a group (including recursive members) to the bulk generation. - @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddGroupMembers(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddGroupMembers())) { @@ -119,7 +119,7 @@ Add all users associated with the flag to the bulk generation. - @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUserFlag(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUserFlag())) {
    @@ -144,7 +144,7 @@ Add all users associated with a device in the selected profile to the bulk generation.
    - @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceProfile(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceProfile())) {
    @@ -168,7 +168,7 @@ Add all users associated with a device in the selected batch to the bulk generation.
    - @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceBatch(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceBatch())) {
    @@ -192,7 +192,7 @@ Add all users associated with an attachment of the selected document template to the bulk generation.
    - @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDocumentAttachment(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDocumentAttachment())) {
    @@ -220,7 +220,7 @@ Add all users with a matching user detail to the bulk generation.
    - @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUserDetail(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUserDetail())) { @@ -236,7 +236,7 @@ @Html.AntiForgeryToken() } - @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateGetUserDetailValues(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateGetUserDetailValues())) { diff --git a/Disco.Web/Areas/Config/Views/DocumentTemplate/BulkGenerate.generated.cs b/Disco.Web/Areas/Config/Views/DocumentTemplate/BulkGenerate.generated.cs index 4a63d86e..1e410f57 100644 --- a/Disco.Web/Areas/Config/Views/DocumentTemplate/BulkGenerate.generated.cs +++ b/Disco.Web/Areas/Config/Views/DocumentTemplate/BulkGenerate.generated.cs @@ -78,7 +78,7 @@ WriteLiteral(">\r\n"); #line hidden #line 11 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id), FormMethod.Post)) + using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id))) { if (Model.TemplatePageCount > 1 && Model.TemplatePageCount % 2 != 0) { @@ -314,17 +314,17 @@ WriteLiteral(" id=\"DocumentTemplate_BulkGenerate_Dialog_AddUsers\""); WriteLiteral(" class=\"dialog dialog-bulk-generate\""); -WriteAttribute("title", Tuple.Create(" title=\"", 2917), Tuple.Create("\"", 2973) +WriteAttribute("title", Tuple.Create(" title=\"", 2900), Tuple.Create("\"", 2956) #line 62 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - , Tuple.Create(Tuple.Create("", 2925), Tuple.Create(Model.DocumentTemplate.Description + , Tuple.Create(Tuple.Create("", 2908), Tuple.Create(Model.DocumentTemplate.Description #line default #line hidden -, 2925), false) -, Tuple.Create(Tuple.Create("", 2962), Tuple.Create(":", 2962), true) -, Tuple.Create(Tuple.Create(" ", 2963), Tuple.Create("Add", 2964), true) -, Tuple.Create(Tuple.Create(" ", 2967), Tuple.Create("Users", 2968), true) +, 2908), false) +, Tuple.Create(Tuple.Create("", 2945), Tuple.Create(":", 2945), true) +, Tuple.Create(Tuple.Create(" ", 2946), Tuple.Create("Add", 2947), true) +, Tuple.Create(Tuple.Create(" ", 2950), Tuple.Create("Users", 2951), true) ); WriteLiteral(">\r\n \r\n \r\n \r\n") #line hidden #line 82 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUsers(), FormMethod.Post)) + using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUsers())) { @@ -451,18 +451,18 @@ WriteLiteral(" id=\"DocumentTemplate_BulkGenerate_Dialog_AddGroupMembers\""); WriteLiteral(" class=\"dialog dialog-bulk-generate\""); -WriteAttribute("title", Tuple.Create(" title=\"", 4437), Tuple.Create("\"", 4501) +WriteAttribute("title", Tuple.Create(" title=\"", 4403), Tuple.Create("\"", 4467) #line 90 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - , Tuple.Create(Tuple.Create("", 4445), Tuple.Create(Model.DocumentTemplate.Description + , Tuple.Create(Tuple.Create("", 4411), Tuple.Create(Model.DocumentTemplate.Description #line default #line hidden -, 4445), false) -, Tuple.Create(Tuple.Create("", 4482), Tuple.Create(":", 4482), true) -, Tuple.Create(Tuple.Create(" ", 4483), Tuple.Create("Add", 4484), true) -, Tuple.Create(Tuple.Create(" ", 4487), Tuple.Create("Group", 4488), true) -, Tuple.Create(Tuple.Create(" ", 4493), Tuple.Create("Members", 4494), true) +, 4411), false) +, Tuple.Create(Tuple.Create("", 4448), Tuple.Create(":", 4448), true) +, Tuple.Create(Tuple.Create(" ", 4449), Tuple.Create("Add", 4450), true) +, Tuple.Create(Tuple.Create(" ", 4453), Tuple.Create("Group", 4454), true) +, Tuple.Create(Tuple.Create(" ", 4459), Tuple.Create("Members", 4460), true) ); WriteLiteral(">\r\n \r\n
    \r\n Add all members of a group (incl #line hidden #line 96 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddGroupMembers(), FormMethod.Post)) + using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddGroupMembers())) { @@ -555,19 +555,19 @@ WriteLiteral(" id=\"DocumentTemplate_BulkGenerate_Dialog_AddUserFlag\""); WriteLiteral(" class=\"dialog dialog-bulk-generate\""); -WriteAttribute("title", Tuple.Create(" title=\"", 5539), Tuple.Create("\"", 5611) +WriteAttribute("title", Tuple.Create(" title=\"", 5488), Tuple.Create("\"", 5560) #line 116 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - , Tuple.Create(Tuple.Create("", 5547), Tuple.Create(Model.DocumentTemplate.Description + , Tuple.Create(Tuple.Create("", 5496), Tuple.Create(Model.DocumentTemplate.Description #line default #line hidden -, 5547), false) -, Tuple.Create(Tuple.Create("", 5584), Tuple.Create(":", 5584), true) -, Tuple.Create(Tuple.Create(" ", 5585), Tuple.Create("Add", 5586), true) -, Tuple.Create(Tuple.Create(" ", 5589), Tuple.Create("User", 5590), true) -, Tuple.Create(Tuple.Create(" ", 5594), Tuple.Create("Flag", 5595), true) -, Tuple.Create(Tuple.Create(" ", 5599), Tuple.Create("Assignments", 5600), true) +, 5496), false) +, Tuple.Create(Tuple.Create("", 5533), Tuple.Create(":", 5533), true) +, Tuple.Create(Tuple.Create(" ", 5534), Tuple.Create("Add", 5535), true) +, Tuple.Create(Tuple.Create(" ", 5538), Tuple.Create("User", 5539), true) +, Tuple.Create(Tuple.Create(" ", 5543), Tuple.Create("Flag", 5544), true) +, Tuple.Create(Tuple.Create(" ", 5548), Tuple.Create("Assignments", 5549), true) ); WriteLiteral(">\r\n \r\n
    \r\n Add all users associated #line hidden #line 122 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUserFlag(), FormMethod.Post)) + using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUserFlag())) { @@ -621,15 +621,15 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" (flag.Count == 0 ? "disabled" : null +, Tuple.Create(Tuple.Create(" ", 6041), Tuple.Create(flag.Count == 0 ? "disabled" : null #line default #line hidden -, 6110), false) +, 6042), false) ); WriteLiteral(" data-userflagid=\""); @@ -645,26 +645,26 @@ WriteLiteral("\""); WriteLiteral(">\r\n (flag.Item.Icon +, Tuple.Create(Tuple.Create("", 6156), Tuple.Create(flag.Item.Icon #line default #line hidden -, 6224), false) -, Tuple.Create(Tuple.Create(" ", 6241), Tuple.Create("fa-fw", 6242), true) -, Tuple.Create(Tuple.Create(" ", 6247), Tuple.Create("fa-lg", 6248), true) -, Tuple.Create(Tuple.Create(" ", 6253), Tuple.Create("d-", 6254), true) +, 6156), false) +, Tuple.Create(Tuple.Create(" ", 6173), Tuple.Create("fa-fw", 6174), true) +, Tuple.Create(Tuple.Create(" ", 6179), Tuple.Create("fa-lg", 6180), true) +, Tuple.Create(Tuple.Create(" ", 6185), Tuple.Create("d-", 6186), true) #line 129 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" -, Tuple.Create(Tuple.Create("", 6256), Tuple.Create(flag.Item.IconColour +, Tuple.Create(Tuple.Create("", 6188), Tuple.Create(flag.Item.IconColour #line default #line hidden -, 6256), false) +, 6188), false) ); WriteLiteral(">"); @@ -752,21 +752,21 @@ WriteLiteral(" id=\"DocumentTemplate_BulkGenerate_Dialog_AddDeviceProfile\""); WriteLiteral(" class=\"dialog dialog-bulk-generate\""); -WriteAttribute("title", Tuple.Create(" title=\"", 6673), Tuple.Create("\"", 6755) +WriteAttribute("title", Tuple.Create(" title=\"", 6605), Tuple.Create("\"", 6687) #line 141 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - , Tuple.Create(Tuple.Create("", 6681), Tuple.Create(Model.DocumentTemplate.Description + , Tuple.Create(Tuple.Create("", 6613), Tuple.Create(Model.DocumentTemplate.Description #line default #line hidden -, 6681), false) -, Tuple.Create(Tuple.Create("", 6718), Tuple.Create(":", 6718), true) -, Tuple.Create(Tuple.Create(" ", 6719), Tuple.Create("Add", 6720), true) -, Tuple.Create(Tuple.Create(" ", 6723), Tuple.Create("User", 6724), true) -, Tuple.Create(Tuple.Create(" ", 6728), Tuple.Create("by", 6729), true) -, Tuple.Create(Tuple.Create(" ", 6731), Tuple.Create("Assigned", 6732), true) -, Tuple.Create(Tuple.Create(" ", 6740), Tuple.Create("Device", 6741), true) -, Tuple.Create(Tuple.Create(" ", 6747), Tuple.Create("Profile", 6748), true) +, 6613), false) +, Tuple.Create(Tuple.Create("", 6650), Tuple.Create(":", 6650), true) +, Tuple.Create(Tuple.Create(" ", 6651), Tuple.Create("Add", 6652), true) +, Tuple.Create(Tuple.Create(" ", 6655), Tuple.Create("User", 6656), true) +, Tuple.Create(Tuple.Create(" ", 6660), Tuple.Create("by", 6661), true) +, Tuple.Create(Tuple.Create(" ", 6663), Tuple.Create("Assigned", 6664), true) +, Tuple.Create(Tuple.Create(" ", 6672), Tuple.Create("Device", 6673), true) +, Tuple.Create(Tuple.Create(" ", 6679), Tuple.Create("Profile", 6680), true) ); WriteLiteral(">\r\n \r\n
    \r\n Add all users associated #line hidden #line 147 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceProfile(), FormMethod.Post)) + using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceProfile())) { @@ -821,15 +821,15 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" (profile.Count == 0 ? "disabled" : null +, Tuple.Create(Tuple.Create(" ", 7214), Tuple.Create(profile.Count == 0 ? "disabled" : null #line default #line hidden -, 7300), false) +, 7215), false) ); WriteLiteral(" data-id=\""); @@ -931,21 +931,21 @@ WriteLiteral(" id=\"DocumentTemplate_BulkGenerate_Dialog_AddDeviceBatch\""); WriteLiteral(" class=\"dialog dialog-bulk-generate\""); -WriteAttribute("title", Tuple.Create(" title=\"", 7825), Tuple.Create("\"", 7905) +WriteAttribute("title", Tuple.Create(" title=\"", 7740), Tuple.Create("\"", 7820) #line 165 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - , Tuple.Create(Tuple.Create("", 7833), Tuple.Create(Model.DocumentTemplate.Description + , Tuple.Create(Tuple.Create("", 7748), Tuple.Create(Model.DocumentTemplate.Description #line default #line hidden -, 7833), false) -, Tuple.Create(Tuple.Create("", 7870), Tuple.Create(":", 7870), true) -, Tuple.Create(Tuple.Create(" ", 7871), Tuple.Create("Add", 7872), true) -, Tuple.Create(Tuple.Create(" ", 7875), Tuple.Create("User", 7876), true) -, Tuple.Create(Tuple.Create(" ", 7880), Tuple.Create("by", 7881), true) -, Tuple.Create(Tuple.Create(" ", 7883), Tuple.Create("Assigned", 7884), true) -, Tuple.Create(Tuple.Create(" ", 7892), Tuple.Create("Device", 7893), true) -, Tuple.Create(Tuple.Create(" ", 7899), Tuple.Create("Batch", 7900), true) +, 7748), false) +, Tuple.Create(Tuple.Create("", 7785), Tuple.Create(":", 7785), true) +, Tuple.Create(Tuple.Create(" ", 7786), Tuple.Create("Add", 7787), true) +, Tuple.Create(Tuple.Create(" ", 7790), Tuple.Create("User", 7791), true) +, Tuple.Create(Tuple.Create(" ", 7795), Tuple.Create("by", 7796), true) +, Tuple.Create(Tuple.Create(" ", 7798), Tuple.Create("Assigned", 7799), true) +, Tuple.Create(Tuple.Create(" ", 7807), Tuple.Create("Device", 7808), true) +, Tuple.Create(Tuple.Create(" ", 7814), Tuple.Create("Batch", 7815), true) ); WriteLiteral(">\r\n \r\n
    \r\n Add all users associated #line hidden #line 171 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceBatch(), FormMethod.Post)) + using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceBatch())) { @@ -999,15 +999,15 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" (batch.Count == 0 ? "disabled" : null +, Tuple.Create(Tuple.Create(" ", 8338), Tuple.Create(batch.Count == 0 ? "disabled" : null #line default #line hidden -, 8441), false) +, 8339), false) ); WriteLiteral(" data-id=\""); @@ -1109,21 +1109,21 @@ WriteLiteral(" id=\"DocumentTemplate_BulkGenerate_Dialog_AddDocumentAttachment\" WriteLiteral(" class=\"dialog dialog-bulk-generate\""); -WriteAttribute("title", Tuple.Create(" title=\"", 8967), Tuple.Create("\"", 9047) +WriteAttribute("title", Tuple.Create(" title=\"", 8865), Tuple.Create("\"", 8945) #line 189 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - , Tuple.Create(Tuple.Create("", 8975), Tuple.Create(Model.DocumentTemplate.Description + , Tuple.Create(Tuple.Create("", 8873), Tuple.Create(Model.DocumentTemplate.Description #line default #line hidden -, 8975), false) -, Tuple.Create(Tuple.Create("", 9012), Tuple.Create(":", 9012), true) -, Tuple.Create(Tuple.Create(" ", 9013), Tuple.Create("Add", 9014), true) -, Tuple.Create(Tuple.Create(" ", 9017), Tuple.Create("User", 9018), true) -, Tuple.Create(Tuple.Create(" ", 9022), Tuple.Create("by", 9023), true) -, Tuple.Create(Tuple.Create(" ", 9025), Tuple.Create("Assigned", 9026), true) -, Tuple.Create(Tuple.Create(" ", 9034), Tuple.Create("Device", 9035), true) -, Tuple.Create(Tuple.Create(" ", 9041), Tuple.Create("Batch", 9042), true) +, 8873), false) +, Tuple.Create(Tuple.Create("", 8910), Tuple.Create(":", 8910), true) +, Tuple.Create(Tuple.Create(" ", 8911), Tuple.Create("Add", 8912), true) +, Tuple.Create(Tuple.Create(" ", 8915), Tuple.Create("User", 8916), true) +, Tuple.Create(Tuple.Create(" ", 8920), Tuple.Create("by", 8921), true) +, Tuple.Create(Tuple.Create(" ", 8923), Tuple.Create("Assigned", 8924), true) +, Tuple.Create(Tuple.Create(" ", 8932), Tuple.Create("Device", 8933), true) +, Tuple.Create(Tuple.Create(" ", 8939), Tuple.Create("Batch", 8940), true) ); WriteLiteral(">\r\n \r\n
    \r\n Add all users associated #line hidden #line 195 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDocumentAttachment(), FormMethod.Post)) + using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDocumentAttachment())) { @@ -1178,15 +1178,15 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" (template.Count == 0 ? "disabled" : null +, Tuple.Create(Tuple.Create(" ", 9499), Tuple.Create(template.Count == 0 ? "disabled" : null #line default #line hidden -, 9619), false) +, 9500), false) ); WriteLiteral(" data-id=\""); @@ -1316,19 +1316,19 @@ WriteLiteral(" id=\"DocumentTemplate_BulkGenerate_Dialog_AddUserDetail\""); WriteLiteral(" class=\"dialog dialog-bulk-generate\""); -WriteAttribute("title", Tuple.Create(" title=\"", 10517), Tuple.Create("\"", 10582) +WriteAttribute("title", Tuple.Create(" title=\"", 10398), Tuple.Create("\"", 10463) #line 217 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - , Tuple.Create(Tuple.Create("", 10525), Tuple.Create(Model.DocumentTemplate.Description + , Tuple.Create(Tuple.Create("", 10406), Tuple.Create(Model.DocumentTemplate.Description #line default #line hidden -, 10525), false) -, Tuple.Create(Tuple.Create("", 10562), Tuple.Create(":", 10562), true) -, Tuple.Create(Tuple.Create(" ", 10563), Tuple.Create("Add", 10564), true) -, Tuple.Create(Tuple.Create(" ", 10567), Tuple.Create("User", 10568), true) -, Tuple.Create(Tuple.Create(" ", 10572), Tuple.Create("by", 10573), true) -, Tuple.Create(Tuple.Create(" ", 10575), Tuple.Create("Detail", 10576), true) +, 10406), false) +, Tuple.Create(Tuple.Create("", 10443), Tuple.Create(":", 10443), true) +, Tuple.Create(Tuple.Create(" ", 10444), Tuple.Create("Add", 10445), true) +, Tuple.Create(Tuple.Create(" ", 10448), Tuple.Create("User", 10449), true) +, Tuple.Create(Tuple.Create(" ", 10453), Tuple.Create("by", 10454), true) +, Tuple.Create(Tuple.Create(" ", 10456), Tuple.Create("Detail", 10457), true) ); WriteLiteral(">\r\n \r\n
    \r\n Add all users with a mat #line hidden #line 223 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUserDetail(), FormMethod.Post)) + using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUserDetail())) { @@ -1401,15 +1401,15 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" (key.Count == 0 ? "disabled" : null +, Tuple.Create(Tuple.Create(" ", 11092), Tuple.Create(key.Count == 0 ? "disabled" : null #line default #line hidden -, 11229), false) +, 11093), false) ); WriteLiteral(" data-id=\""); @@ -1491,7 +1491,7 @@ WriteLiteral(" "); #line 239 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml" - using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateGetUserDetailValues(), FormMethod.Post)) + using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateGetUserDetailValues())) { diff --git a/Disco.Web/Areas/Config/Views/DocumentTemplate/Create.cshtml b/Disco.Web/Areas/Config/Views/DocumentTemplate/Create.cshtml index d38fa9a0..70b62b15 100644 --- a/Disco.Web/Areas/Config/Views/DocumentTemplate/Create.cshtml +++ b/Disco.Web/Areas/Config/Views/DocumentTemplate/Create.cshtml @@ -1,25 +1,28 @@ @model Disco.Web.Areas.Config.Models.DocumentTemplate.CreateModel @{ Authorization.RequireAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure); - + ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), "Create"); } @using (Html.BeginForm(MVC.Config.DocumentTemplate.Create(), FormMethod.Post, new { enctype = "multipart/form-data" })) -{ +{ + @Html.AntiForgeryToken()
    - - @@ -27,7 +30,7 @@ Scope: @@ -52,12 +55,13 @@ - + + }
    Id: @Html.TextBoxFor(model => model.DocumentTemplate.Id)
    @Html.ValidationMessageFor(model => model.DocumentTemplate.Id) +
    + @Html.TextBoxFor(model => model.Id)
    @Html.ValidationMessageFor(model => model.Id)
    Description: @Html.TextBoxFor(model => model.DocumentTemplate.Description)
    @Html.ValidationMessageFor(model => model.DocumentTemplate.Description) +
    + @Html.TextBoxFor(model => model.Description)
    @Html.ValidationMessageFor(model => model.Description)
    - @Html.DropDownListFor(model => model.DocumentTemplate.Scope, Model.Scopes.ToSelectListItems(null)) + @Html.DropDownListFor(model => model.Scope, Model.Scopes.ToSelectListItems(null))
    @jt.Description
    Sub Types
    - @CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id)) + @CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id))
    @CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.Where(jst => jst.JobTypeId == jt.Id).ToList().ToSelectListItems(Model.SubTypes), 2)

    @@ -68,7 +72,7 @@ $(function () { $('#Name').focus().select(); - var $scope = $('#DocumentTemplate_Scope'); + var $scope = $('#Scope'); var $trJobTypes = $('#trJobTypes'); var $jobTypes = $trJobTypes.find('input[type="checkbox"]'); $scope.change(scopeChange); @@ -89,10 +93,10 @@ function jobTypesChange() { $('.jobSubTypes').hide(); $jobTypes.filter(':checked').each(function () { - $('#trJobSubType' + $(this).val()).show(); + $('#trJobSubType' + $(this).val()).show(); }); } }); -} \ No newline at end of file +} diff --git a/Disco.Web/Areas/Config/Views/DocumentTemplate/Create.generated.cs b/Disco.Web/Areas/Config/Views/DocumentTemplate/Create.generated.cs index 053c7b29..fa04a5da 100644 --- a/Disco.Web/Areas/Config/Views/DocumentTemplate/Create.generated.cs +++ b/Disco.Web/Areas/Config/Views/DocumentTemplate/Create.generated.cs @@ -47,7 +47,7 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate #line 2 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" Authorization.RequireAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure); - + ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), "Create"); @@ -58,7 +58,21 @@ WriteLiteral("\r\n"); #line 7 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" using (Html.BeginForm(MVC.Config.DocumentTemplate.Create(), FormMethod.Post, new { enctype = "multipart/form-data" })) -{ +{ + + + #line default + #line hidden + + #line 9 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" +Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 9 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + #line default @@ -70,11 +84,13 @@ WriteLiteral(" class=\"form\""); WriteLiteral(" style=\"width: 650px\""); WriteLiteral(">\r\n \r\n \r\n \r\n
    \r\n I" + -"d:\r\n "); +"d:\r\n \r\n \r\n"); + +WriteLiteral(" "); - #line 15 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" - Write(Html.TextBoxFor(model => model.DocumentTemplate.Id)); + #line 17 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + Write(Html.TextBoxFor(model => model.Id)); #line default @@ -82,19 +98,21 @@ WriteLiteral(">\r\n \r\n \r\n \r\n \r\n \r\n Description:\r\n \r\n \r\n \r\n WriteLiteral("
    "); - #line 22 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" - Write(Html.ValidationMessageFor(model => model.DocumentTemplate.Description)); + #line 25 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + Write(Html.ValidationMessageFor(model => model.Description)); #line default @@ -114,8 +132,8 @@ WriteLiteral("\r\n \r\n \r\n WriteLiteral(" "); - #line 30 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" - Write(Html.DropDownListFor(model => model.DocumentTemplate.Scope, Model.Scopes.ToSelectListItems(null))); + #line 33 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + Write(Html.DropDownListFor(model => model.Scope, Model.Scopes.ToSelectListItems(null))); #line default @@ -133,7 +151,7 @@ WriteLiteral(" accept=\".pdf\""); WriteLiteral(" />
    "); - #line 38 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + #line 41 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" Write(Html.ValidationMessage("Template")); @@ -156,7 +174,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 46 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + #line 49 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" Write(CommonHelpers.CheckBoxList("Types", Model.JobTypes.ToSelectListItems(Model.Types), 2)); @@ -165,13 +183,13 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n \r\n"); - #line 49 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + #line 52 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" #line default #line hidden - #line 49 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + #line 52 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" foreach (var jt in Model.JobTypes) { @@ -180,15 +198,15 @@ WriteLiteral("\r\n \r\n \r\n"); #line hidden WriteLiteral(" (jt.Id + #line 54 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" +, Tuple.Create(Tuple.Create("", 2047), Tuple.Create(jt.Id #line default #line hidden -, 2063), false) +, 2047), false) ); WriteLiteral(" class=\"jobSubTypes\""); @@ -202,7 +220,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 53 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + #line 56 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" Write(jt.Description); @@ -210,11 +228,11 @@ WriteLiteral(" "); #line hidden WriteLiteral("
    \r\n Sub Types
    \r\n"); -WriteLiteral(" "); +WriteLiteral(" "); - #line 55 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" - Write(CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id))); + #line 58 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + Write(CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id))); #line default @@ -228,16 +246,17 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 58 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + #line 61 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" Write(CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.Where(jst => jst.JobTypeId == jt.Id).ToList().ToSelectListItems(Model.SubTypes), 2)); #line default #line hidden -WriteLiteral("\r\n \r\n \r\n"); +WriteLiteral("\r\n \r\n \r\n"); - #line 61 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + #line 64 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + } @@ -265,7 +284,7 @@ WriteLiteral(@"> $(function () { $('#Name').focus().select(); - var $scope = $('#DocumentTemplate_Scope'); + var $scope = $('#Scope'); var $trJobTypes = $('#trJobTypes'); var $jobTypes = $trJobTypes.find('input[type=""checkbox""]'); $scope.change(scopeChange); @@ -286,7 +305,7 @@ WriteLiteral(@"> function jobTypesChange() { $('.jobSubTypes').hide(); $jobTypes.filter(':checked').each(function () { - $('#trJobSubType' + $(this).val()).show(); + $('#trJobSubType' + $(this).val()).show(); }); } @@ -295,8 +314,9 @@ WriteLiteral(@"> "); - #line 98 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + #line 102 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" } + #line default #line hidden diff --git a/Disco.Web/Areas/Config/Views/DocumentTemplate/CreatePackage.cshtml b/Disco.Web/Areas/Config/Views/DocumentTemplate/CreatePackage.cshtml index ee81cac7..dcba5348 100644 --- a/Disco.Web/Areas/Config/Views/DocumentTemplate/CreatePackage.cshtml +++ b/Disco.Web/Areas/Config/Views/DocumentTemplate/CreatePackage.cshtml @@ -1,25 +1,28 @@ @model Disco.Web.Areas.Config.Models.DocumentTemplate.CreatePackageModel @{ Authorization.RequireAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure); - + ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), "Create Package"); } @using (Html.BeginForm(MVC.Config.DocumentTemplate.CreatePackage())) -{ +{ + @Html.AntiForgeryToken()
    \r WriteLiteral("
    "); - #line 15 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" - Write(Html.ValidationMessageFor(model => model.DocumentTemplate.Id)); + #line 17 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + Write(Html.ValidationMessageFor(model => model.Id)); #line default #line hidden WriteLiteral("\r\n \r\n
    " + -""); +"\r\n"); + +WriteLiteral(" "); - #line 22 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" - Write(Html.TextBoxFor(model => model.DocumentTemplate.Description)); + #line 25 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml" + Write(Html.TextBoxFor(model => model.Description)); #line default @@ -102,8 +120,8 @@ WriteLiteral("\r\n
    - - @@ -27,7 +30,7 @@ Scope:
    Id: @Html.TextBoxFor(model => model.Package.Id)
    @Html.ValidationMessageFor(model => model.Package.Id) +
    + @Html.TextBoxFor(model => model.Id)
    @Html.ValidationMessageFor(model => model.Id)
    Description: @Html.TextBoxFor(model => model.Package.Description)
    @Html.ValidationMessageFor(model => model.Package.Description) +
    + @Html.TextBoxFor(model => model.Description)
    @Html.ValidationMessageFor(model => model.Description)
    - @Html.DropDownListFor(model => model.Package.Scope, Model.Scopes.ToSelectListItems(null)) + @Html.DropDownListFor(model => model.Scope, Model.Scopes.ToSelectListItems(null))
    diff --git a/Disco.Web/Areas/Config/Views/DocumentTemplate/CreatePackage.generated.cs b/Disco.Web/Areas/Config/Views/DocumentTemplate/CreatePackage.generated.cs index 320e3916..463cc652 100644 --- a/Disco.Web/Areas/Config/Views/DocumentTemplate/CreatePackage.generated.cs +++ b/Disco.Web/Areas/Config/Views/DocumentTemplate/CreatePackage.generated.cs @@ -47,7 +47,7 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate #line 2 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" Authorization.RequireAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure); - + ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), "Create Package"); @@ -58,7 +58,21 @@ WriteLiteral("\r\n"); #line 7 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" using (Html.BeginForm(MVC.Config.DocumentTemplate.CreatePackage())) -{ +{ + + + #line default + #line hidden + + #line 9 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" +Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 9 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" + #line default @@ -70,11 +84,13 @@ WriteLiteral(" class=\"form\""); WriteLiteral(" style=\"width: 650px\""); WriteLiteral(">\r\n \r\n \r\n \r\n @@ -388,6 +385,7 @@

    Package Templates

    @using (Html.BeginForm(MVC.API.DocumentTemplatePackage.UpdateDocumentTemplates(Model.Package.Id, redirect: true))) { + @Html.AntiForgeryToken()
      @foreach (var template in Model.DocumentTemplatesSelected) { @@ -437,7 +435,6 @@ var $form = dialog.find('form'); if ($form.find('input').length > 0) { dialog.dialog('option', 'buttons', null); - dialog.dialog('disable'); $form.submit(); } else { alert('The package templates must include at least one document template'); @@ -618,7 +615,11 @@
    \r\n I" + -"d:\r\n "); +"d:\r\n \r\n \r\n"); + +WriteLiteral(" "); - #line 15 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" - Write(Html.TextBoxFor(model => model.Package.Id)); + #line 17 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" + Write(Html.TextBoxFor(model => model.Id)); #line default @@ -82,19 +98,21 @@ WriteLiteral(">\r\n \r\n \r\n \r\n \r\n \r\n Description:\r\n \r\n \r\n \r\n WriteLiteral("
    "); - #line 22 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" - Write(Html.ValidationMessageFor(model => model.Package.Description)); + #line 25 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" + Write(Html.ValidationMessageFor(model => model.Description)); #line default @@ -114,8 +132,8 @@ WriteLiteral("\r\n \r\n \r\n WriteLiteral(" "); - #line 30 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" - Write(Html.DropDownListFor(model => model.Package.Scope, Model.Scopes.ToSelectListItems(null))); + #line 33 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" + Write(Html.DropDownListFor(model => model.Scope, Model.Scopes.ToSelectListItems(null))); #line default @@ -135,7 +153,7 @@ WriteLiteral(" value=\"Create\""); WriteLiteral(" />\r\n

    \r\n \r\n"); - #line 38 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" + #line 41 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" } #line default diff --git a/Disco.Web/Areas/Config/Views/DocumentTemplate/ImportStatus.cshtml b/Disco.Web/Areas/Config/Views/DocumentTemplate/ImportStatus.cshtml index b3ba79a4..637abe28 100644 --- a/Disco.Web/Areas/Config/Views/DocumentTemplate/ImportStatus.cshtml +++ b/Disco.Web/Areas/Config/Views/DocumentTemplate/ImportStatus.cshtml @@ -9,7 +9,6 @@ Documents Imported Today
    - @Html.AntiForgeryToken()

    No imported documents today

    @@ -285,7 +284,7 @@ End: null, ModuleId: 40, Take: 2000, - '__RequestVerificationToken': host.find('input[name="__RequestVerificationToken"]').val() + '__RequestVerificationToken': document.body.dataset.antiforgery }; $.ajax({ url: '@(Url.Action(MVC.API.Logging.RetrieveEvents()))', diff --git a/Disco.Web/Areas/Config/Views/DocumentTemplate/ImportStatus.generated.cs b/Disco.Web/Areas/Config/Views/DocumentTemplate/ImportStatus.generated.cs index 3052f6da..54b27e7d 100644 --- a/Disco.Web/Areas/Config/Views/DocumentTemplate/ImportStatus.generated.cs +++ b/Disco.Web/Areas/Config/Views/DocumentTemplate/ImportStatus.generated.cs @@ -59,18 +59,7 @@ WriteLiteral("\r\n

    \r\n Documents Imported Today\r\n

    \r\n\r\n"); - -WriteLiteral(" "); - - - #line 12 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" -Write(Html.AntiForgeryToken()); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n \r\n $(function () {\r\n var vm;\r\n var host = "var urlDeviceShow = \'"); - #line 107 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" + #line 106 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" Write(Url.Action(MVC.Device.Show())); @@ -298,7 +287,7 @@ WriteLiteral(">\r\n $(function () {\r\n var vm;\r\n var host = WriteLiteral("/\'\r\n var urlJobShow = \'"); - #line 108 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" + #line 107 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" Write(Url.Action(MVC.Job.Show())); @@ -307,7 +296,7 @@ WriteLiteral("/\'\r\n var urlJobShow = \'"); WriteLiteral("/\'\r\n var urlUserShow = \'"); - #line 109 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" + #line 108 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" Write(Url.Action(MVC.User.Show())); @@ -316,7 +305,7 @@ WriteLiteral("/\'\r\n var urlUserShow = \'"); WriteLiteral("/\'\r\n var urlPageThumbnail = \'"); - #line 110 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" + #line 109 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" Write(Url.Action(MVC.API.DocumentTemplate.ImporterThumbnail())); @@ -325,7 +314,7 @@ WriteLiteral("/\'\r\n var urlPageThumbnail = \'"); WriteLiteral("/\'\r\n var urlDocumentTemplate = \'"); - #line 111 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" + #line 110 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" Write(Url.Action(MVC.Config.DocumentTemplate.Index())); @@ -334,7 +323,7 @@ WriteLiteral("/\'\r\n var urlDocumentTemplate = \'"); WriteLiteral("/\';\r\n var urlManuallyAssign = \'"); - #line 112 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" + #line 111 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" Write(Url.Action(MVC.Config.DocumentTemplate.UndetectedPages())); @@ -442,11 +431,11 @@ WriteLiteral("\';\r\n var isLive = false;\r\n\r\n function pageVie "ar loadData = {\r\n Format: \"json\",\r\n Start: d.getFu" + "llYear() + \'-\' + (d.getMonth() + 1) + \'-\' + d.getDate(),\r\n End: n" + "ull,\r\n ModuleId: 40,\r\n Take: 2000,\r\n " + -" \'__RequestVerificationToken\': host.find(\'input[name=\"__RequestVerificationToke" + -"n\"]\').val()\r\n };\r\n $.ajax({\r\n url: \'"); +" \'__RequestVerificationToken\': document.body.dataset.antiforgery\r\n }" + +";\r\n $.ajax({\r\n url: \'"); - #line 291 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" + #line 290 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" Write(Url.Action(MVC.API.Logging.RetrieveEvents())); @@ -478,7 +467,7 @@ WriteLiteral(@"', $.connection.hub.qs = { LogModules: '"); - #line 314 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" + #line 313 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml" Write(Disco.Services.Documents.DocumentsLog.Current.LiveLogGroupName); diff --git a/Disco.Web/Areas/Config/Views/DocumentTemplate/Show.cshtml b/Disco.Web/Areas/Config/Views/DocumentTemplate/Show.cshtml index 79b49c7b..9de0a95e 100644 --- a/Disco.Web/Areas/Config/Views/DocumentTemplate/Show.cshtml +++ b/Disco.Web/Areas/Config/Views/DocumentTemplate/Show.cshtml @@ -152,6 +152,7 @@
    @using (Html.BeginForm(MVC.API.DocumentTemplate.UpdateScope(Model.DocumentTemplate.Id, redirect: true))) { + @Html.AntiForgeryToken()
    }
    @@ -737,7 +717,7 @@ @Html.Hidden("ruleId", "") } Add User Flag Rule -
    +
    @switch (Model.DocumentTemplate.Scope) { @@ -758,7 +738,7 @@ break; }
    - @using (Html.BeginForm(MVC.API.DocumentTemplate.AddOnImportUserFlagRule(Model.DocumentTemplate.Id), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.DocumentTemplate.AddOnImportUserFlagRule(Model.DocumentTemplate.Id))) { @Html.AntiForgeryToken()
    @@ -878,7 +858,7 @@ rulesTable.find('tbody').append(row); rulesTable.find('tbody').find('tr').first().addClass('hidden'); - + dialog.dialog("close"); }) .catch(e => { @@ -997,6 +977,10 @@
    + @using (Html.BeginForm(MVC.API.DocumentTemplate.Delete(Model.DocumentTemplate.Id, true))) + { + @Html.AntiForgeryToken() + }

    This item will be permanently deleted and cannot be recovered.
    @@ -1008,31 +992,28 @@

    @@ -1065,7 +1046,7 @@ else { Bulk Generate -
    +
    @switch (Model.DocumentTemplate.Scope) { @@ -1101,8 +1082,9 @@ break; }
    - @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id))) { + @Html.AntiForgeryToken()
    if (Model.TemplatePageCount > 1 && Model.TemplatePageCount % 2 != 0) @@ -1127,8 +1109,7 @@ width: 460, buttons: { "Bulk Generate": function () { - dialog.find('form').submit(); - dialog.dialog("disable"); + $(this).find('form').trigger('submit'); }, Close: function () { $(this).dialog("close"); @@ -1148,13 +1129,13 @@ } @if (Authorization.Has(Claims.Config.DocumentTemplate.Delete)) { - @Html.ActionLinkButton("Delete", MVC.API.DocumentTemplate.Delete(Model.DocumentTemplate.Id, true), "buttonDelete") + }
    - @if (!string.IsNullOrWhiteSpace(Model.BulkGenerateDownloadId)) + @if (Model.BulkGenerateDownloadId.HasValue) { \r\n"); +" let dialog = null;\r\n $(\'#Config_Docume" + +"ntTemplates_Scope_Button\').on(\'click\', function () {\r\n " + +" if (!dialog) {\r\n dialog" + +" = $(\'#Config_DocumentTemplates_Scope_Dialog\').dialog({\r\n " + +" width: 400,\r\n " + +" resizable: false,\r\n modal: " + +"true,\r\n autoOpen: false,\r\n " + +" buttons: {\r\n " + +" \'Save Changes\': function () {\r\n " + +" $(this)\r\n " + +" .dialog(\'option\', \'buttons\', null)\r\n " + +" .find(\'form\').submit();\r\n " + +" },\r\n " + +" \'Cancel\': function () {\r\n " + +" $(this).dialog(\'close\');\r\n " + +" }\r\n }\r\n " + +" });\r\n }\r\n\r\n " + +" dialog.dialog(\'open\');\r\n " + +" });\r\n });\r\n " + +" \r\n"); - #line 211 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 207 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -708,7 +720,7 @@ WriteLiteral(">\r\n $(function () {\r\n WriteLiteral(" "); - #line 212 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 208 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (Model.DocumentTemplate.Scope == DocumentTemplate.DocumentTemplateScopes.Job) { @@ -726,13 +738,13 @@ WriteLiteral(" id=\"Config_DocumentTemplates_JobSubTypes\""); WriteLiteral(">\r\n
    \r\n"); - #line 218 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 214 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 218 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 214 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (Model.DocumentTemplate.JobSubTypes.Count > 0) { @@ -742,13 +754,13 @@ WriteLiteral(">\r\n
    \r\n"); WriteLiteral("
      \r\n"); - #line 221 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 217 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 221 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 217 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" foreach (var jobType in Model.DocumentTemplate.JobSubTypes.GroupBy(jst => jst.JobType).OrderBy(jtg => jtg.Key.Description)) { @@ -760,7 +772,7 @@ WriteLiteral("
    • \r\n"); WriteLiteral(" "); - #line 224 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 220 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(jobType.Key.Description); @@ -769,13 +781,13 @@ WriteLiteral(" "); WriteLiteral("\r\n
        \r\n"); - #line 226 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 222 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 226 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 222 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (jobType.Count() == Model.JobTypes.FirstOrDefault(jt => jt.Id == jobType.Key.Id).JobSubTypes.Count) { @@ -789,7 +801,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral(">[All Sub Types]\r\n"); - #line 229 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 225 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -802,7 +814,7 @@ WriteLiteral(">[All Sub Types]\r\n"); WriteLiteral("
      • "); - #line 234 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 230 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(jobSubType.Description); @@ -811,7 +823,7 @@ WriteLiteral(" \r\n"); - #line 235 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 231 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } } @@ -822,7 +834,7 @@ WriteLiteral("
      \r\n "
    • \r\n"); - #line 239 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 235 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -831,7 +843,7 @@ WriteLiteral("
    \r\n WriteLiteral(" \r\n"); - #line 241 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 237 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -846,7 +858,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><No Filter>\r\n"); - #line 245 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 241 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -855,13 +867,13 @@ WriteLiteral("><No Filter>\r\n"); WriteLiteral("
    \r\n"); - #line 247 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 243 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 247 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 243 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (canConfig) { @@ -889,15 +901,29 @@ WriteLiteral(" title=\"Job Type Filter\""); WriteLiteral(">\r\n"); - #line 251 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 247 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 251 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 247 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" using (Html.BeginForm(MVC.API.DocumentTemplate.UpdateJobSubTypes(Model.DocumentTemplate.Id, null, true))) { + + + #line default + #line hidden + + #line 249 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 249 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + var selectedTypes = Model.DocumentTemplate.JobSubTypes.Select(jst => jst.JobType).Distinct().ToList(); foreach (var jt in Model.JobTypes) { @@ -912,35 +938,35 @@ WriteLiteral(" class=\"jobTypes\""); WriteLiteral(">\r\n

    \r\n " + " (jt.Id + #line 255 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" +, Tuple.Create(Tuple.Create("", 14763), Tuple.Create(jt.Id #line default #line hidden -, 14805), false) +, 14763), false) ); WriteLiteral(" class=\"jobType\""); WriteLiteral(" type=\"checkbox\""); -WriteAttribute("value", Tuple.Create(" value=\"", 14846), Tuple.Create("\"", 14862) +WriteAttribute("value", Tuple.Create(" value=\"", 14804), Tuple.Create("\"", 14820) - #line 258 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" - , Tuple.Create(Tuple.Create("", 14854), Tuple.Create(jt.Id + #line 255 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + , Tuple.Create(Tuple.Create("", 14812), Tuple.Create(jt.Id #line default #line hidden -, 14854), false) +, 14812), false) ); WriteLiteral(" "); - #line 258 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 255 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(selectedTypes.Contains(jt) ? "checked=\" checked\"" : null); @@ -948,21 +974,21 @@ WriteLiteral(" "); #line hidden WriteLiteral(" />(jt.Id + #line 255 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + , Tuple.Create(Tuple.Create("", 14904), Tuple.Create(jt.Id #line default #line hidden -, 14946), false) +, 14904), false) ); WriteLiteral(">"); - #line 258 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 255 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(jt.Description); @@ -971,15 +997,15 @@ WriteLiteral(">"); WriteLiteral("\r\n

    \r\n " + " (jt.Id + #line 257 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" +, Tuple.Create(Tuple.Create("", 15068), Tuple.Create(jt.Id #line default #line hidden -, 15110), false) +, 15068), false) ); WriteLiteral(" class=\"jobSubTypes\""); @@ -989,7 +1015,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 261 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 258 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id), "div")); @@ -1000,7 +1026,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 262 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 259 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(CommonHelpers.CheckBoxList("JobSubTypes", jt.JobSubTypes.OrderBy(jst => jst.Description).ToSelectListItems(Model.DocumentTemplate.JobSubTypes), 2)); @@ -1010,7 +1036,7 @@ WriteLiteral("\r\n
    \r\n "
    \r\n"); - #line 265 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 262 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } } @@ -1020,55 +1046,51 @@ WriteLiteral("\r\n
    \r\n WriteLiteral("
    \r\n"); WriteLiteral(" \r\n"); +" $(function () {\r\n let dialog = n" + +"ull;\r\n $(\'#Config_DocumentTemplates_J" + +"obSubTypes_Update\').on(\'click\', function () {\r\n " + +" if (!dialog) {\r\n " + +" dialog = $(\'#Config_DocumentTemplates_JobSubTypes_Update_Dialog\').dialog({\r\n " + +" resizable: false,\r\n " + +" modal: true,\r\n " + +" autoOpen: false,\r\n " + +" width: 750,\r\n " + +" height: 580,\r\n " + +" buttons: {\r\n " + +" \"Save Changes\": function () {\r\n " + +" var form = dialog.find(\'form\');\r\n " + +" $(\'input.jobType:unchecked\').each(function " + +"() {\r\n $(\'#Su" + +"bTypes_\' + $(this).val()).find(\'input\').prop(\'checked\', false);\r\n " + +" });\r\n " + +" form.trigger(\'submit\');\r\n " + +" dialog.dialog(\"option\", \"buttons\"" + +", null);\r\n },\r\n " + +" Cancel: function () {\r\n " + +" dialog.dialog(\"opti" + +"on\", \"buttons\", null);\r\n " + +" // refresh Page\r\n " + +" window.location.reload(true);\r\n " + +" }\r\n }" + +"\r\n });\r\n\r\n " + +" dialog.find(\'.jobSubTypes\').hide();\r\n " + +" dialog.on(\'change\', \'input.jobType\', f" + +"unction () {\r\n var $this " + +"= $(this);\r\n if ($this.is" + +"(\':checked\'))\r\n $(\'#S" + +"ubTypes_\' + $this.val()).slideDown(\'fast\');\r\n " + +" else\r\n " + +" $(\'#SubTypes_\' + $this.val()).slideUp(\'fast\');\r\n " + +" }).find(\'input.jobType:checked\').each(function () {\r\n" + +" $(\'#SubTypes_\' + $(this)" + +".val()).show();\r\n });\r\n " + +" }\r\n\r\n " + +" dialog.dialog(\'open\');\r\n " + +" });\r\n });\r\n " + +" \r\n"); - #line 330 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 309 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -1077,7 +1099,7 @@ WriteLiteral(" \r\n"); - #line 356 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 335 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -1184,7 +1206,7 @@ WriteLiteral(" type=\"checkbox\""); WriteLiteral(" "); - #line 359 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 338 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Model.DocumentTemplate.FlattenForm ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty)); @@ -1199,7 +1221,7 @@ WriteLiteral(" for=\"DocumentTemplate_FlattenForm\""); WriteLiteral(">Flatten Form\r\n"); - #line 361 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 340 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -1242,27 +1264,27 @@ WriteLiteral(">\r\n (Url.Action(MVC.API.DocumentTemplate.TemplatePreview(Model.DocumentTemplate.Id)) + #line 360 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" +, Tuple.Create(Tuple.Create("", 21823), Tuple.Create(Url.Action(MVC.API.DocumentTemplate.TemplatePreview(Model.DocumentTemplate.Id)) #line default #line hidden -, 22207), false) +, 21823), false) ); WriteLiteral(" />\r\n
    \r\n \r\n <" + "/tr>\r\n"); - #line 385 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 364 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 385 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 364 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (canConfig) { @@ -1272,13 +1294,13 @@ WriteLiteral(" />\r\n
    \r\n WriteLiteral(" \r\n \r\n"); - #line 462 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 442 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -1504,13 +1540,13 @@ WriteLiteral(">\r\n

    Advanced Options

    \r\n
    \r WriteLiteral("
    "); - #line 15 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" - Write(Html.ValidationMessageFor(model => model.Package.Id)); + #line 17 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" + Write(Html.ValidationMessageFor(model => model.Id)); #line default #line hidden WriteLiteral("\r\n \r\n
    " + -""); +"\r\n"); + +WriteLiteral(" "); - #line 22 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" - Write(Html.TextBoxFor(model => model.Package.Description)); + #line 25 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml" + Write(Html.TextBoxFor(model => model.Description)); #line default @@ -102,8 +120,8 @@ WriteLiteral("\r\n
    \r\n"); - #line 389 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 368 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 389 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 368 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (Model.TemplatePagesHaveAttachmentId.Any(i => !i)) { @@ -1292,13 +1314,13 @@ WriteLiteral(" class=\"info-box\""); WriteLiteral(">\r\n"); - #line 392 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 371 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 392 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 371 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" for (int i = 0; i < Model.TemplatePagesHaveAttachmentId.Count; i++) { if (!Model.TemplatePagesHaveAttachmentId[i]) @@ -1318,7 +1340,7 @@ WriteLiteral(" class=\"fa fa-question-circle\""); WriteLiteral(">Note: Page "); - #line 397 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 376 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(i + 1); @@ -1328,7 +1350,7 @@ WriteLiteral(" does not have a DiscoAttachmentId field.\r\n "

    \r\n"); - #line 399 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 378 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } } @@ -1346,7 +1368,7 @@ WriteLiteral(@"> "); - #line 405 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 384 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -1361,7 +1383,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 407 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 386 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Html.ActionLinkSmallButton("Download Template", MVC.API.DocumentTemplate.Template(Model.DocumentTemplate.Id))); @@ -1370,13 +1392,13 @@ WriteLiteral(" "); WriteLiteral("\r\n"); - #line 408 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 387 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 408 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 387 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (canConfig && Authorization.Has(Claims.Config.DocumentTemplate.Upload)) { @@ -1403,15 +1425,29 @@ WriteLiteral(">\r\n

    Select a PDF Temp "h4>\r\n
    \r\n"); - #line 414 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 393 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 414 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 393 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" using (Html.BeginForm(MVC.API.DocumentTemplate.Template(Model.DocumentTemplate.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" })) { + + + #line default + #line hidden + + #line 395 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 395 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line default @@ -1431,7 +1467,7 @@ WriteLiteral(" style=\"width: 250px;\""); WriteLiteral(" />\r\n"); - #line 417 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 397 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -1477,7 +1513,7 @@ WriteLiteral(">\r\n $(function () {\r\n " });\r\n \r\n"); - #line 458 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 438 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -1487,7 +1523,7 @@ WriteLiteral("
    \r\n

    \r\n "sion:\r\n \r\n \r\n #line default #line hidden - #line 736 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 716 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Html.AntiForgeryToken()); #line default #line hidden - #line 736 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 716 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 737 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 717 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Html.Hidden("ruleId", "")); #line default #line hidden - #line 737 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 717 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -2362,21 +2398,21 @@ WriteLiteral(" (Model.DocumentTemplate.Id + #line 720 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + , Tuple.Create(Tuple.Create(" ", 43373), Tuple.Create(Model.DocumentTemplate.Id #line default #line hidden -, 43690), false) +, 43374), false) ); WriteLiteral(">\r\n \r\n"); - #line 742 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 722 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 742 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 722 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" switch (Model.DocumentTemplate.Scope) { case "Device": @@ -2405,7 +2441,7 @@ WriteLiteral("
    \r\n "gned user.\r\n
    \r\n"); - #line 748 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 728 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" break; case "Job": @@ -2417,7 +2453,7 @@ WriteLiteral("
    \r\n "ted user.\r\n
    \r\n"); - #line 753 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 733 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" break; case "User": @@ -2429,7 +2465,7 @@ WriteLiteral("
    \r\n "
    \r\n"); - #line 758 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 738 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" break; } @@ -2439,28 +2475,28 @@ WriteLiteral("
    \r\n WriteLiteral("
    \r\n"); - #line 761 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 741 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 761 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" - using (Html.BeginForm(MVC.API.DocumentTemplate.AddOnImportUserFlagRule(Model.DocumentTemplate.Id), FormMethod.Post)) + #line 741 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + using (Html.BeginForm(MVC.API.DocumentTemplate.AddOnImportUserFlagRule(Model.DocumentTemplate.Id))) { #line default #line hidden - #line 763 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 743 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Html.AntiForgeryToken()); #line default #line hidden - #line 763 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 743 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" @@ -2511,13 +2547,13 @@ WriteLiteral(" class=\"dialog-item-picker\""); WriteLiteral(">\r\n"); - #line 773 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 753 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 773 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 753 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" foreach (var flag in Model.UserFlags) { @@ -2530,72 +2566,72 @@ WriteLiteral(" class=\"item\""); WriteLiteral(">\r\n (flag.Id + #line 756 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + , Tuple.Create(Tuple.Create("", 46016), Tuple.Create(flag.Id #line default #line hidden -, 46349), false) +, 46016), false) ); WriteLiteral(" type=\"radio\""); WriteLiteral(" name=\"userFlagId\""); -WriteAttribute("value", Tuple.Create(" value=\"", 46389), Tuple.Create("\"", 46405) +WriteAttribute("value", Tuple.Create(" value=\"", 46056), Tuple.Create("\"", 46072) - #line 776 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" - , Tuple.Create(Tuple.Create("", 46397), Tuple.Create(flag.Id + #line 756 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + , Tuple.Create(Tuple.Create("", 46064), Tuple.Create(flag.Id #line default #line hidden -, 46397), false) +, 46064), false) ); WriteLiteral(" required />\r\n (flag.Id + #line 757 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + , Tuple.Create(Tuple.Create("", 46195), Tuple.Create(flag.Id #line default #line hidden -, 46528), false) +, 46195), false) ); WriteLiteral(">(flag.Icon + #line 757 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + , Tuple.Create(Tuple.Create("", 46221), Tuple.Create(flag.Icon #line default #line hidden -, 46554), false) -, Tuple.Create(Tuple.Create(" ", 46566), Tuple.Create("fa-fw", 46567), true) -, Tuple.Create(Tuple.Create(" ", 46572), Tuple.Create("fa-lg", 46573), true) -, Tuple.Create(Tuple.Create(" ", 46578), Tuple.Create("d-", 46579), true) +, 46221), false) +, Tuple.Create(Tuple.Create(" ", 46233), Tuple.Create("fa-fw", 46234), true) +, Tuple.Create(Tuple.Create(" ", 46239), Tuple.Create("fa-lg", 46240), true) +, Tuple.Create(Tuple.Create(" ", 46245), Tuple.Create("d-", 46246), true) - #line 777 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" - , Tuple.Create(Tuple.Create("", 46581), Tuple.Create(flag.IconColour + #line 757 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + , Tuple.Create(Tuple.Create("", 46248), Tuple.Create(flag.IconColour #line default #line hidden -, 46581), false) +, 46248), false) ); WriteLiteral(">"); - #line 777 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 757 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(flag.Name); @@ -2604,7 +2640,7 @@ WriteLiteral(">"); WriteLiteral("\r\n \r\n"); - #line 779 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 759 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -2632,7 +2668,7 @@ WriteLiteral(" name=\"comments\""); WriteLiteral(">\r\n \r\n"); - #line 787 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 767 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -2641,7 +2677,7 @@ WriteLiteral(">\r\n \r\n"); WriteLiteral(" \r\n"); - #line 789 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 769 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" @@ -2732,22 +2768,22 @@ WriteLiteral(">\r\n $(function () {\r\n "\').text(r.Comments);\r\n " + " rulesTable.find(\'tbody\').append(row);\r\n\r\n " + " rulesTable.find(\'tbody\').find(\'tr\').first().addClass(\'hid" + -"den\');\r\n \r\n " + -" dialog.dialog(\"close\");\r\n " + -" })\r\n " + -" .catch(e => {\r\n " + -" alert(e);\r\n " + -" })\r\n }\r\n " + -" },\r\n " + -"Close: function () {\r\n $(this).di" + -"alog(\"close\");\r\n }\r\n " + -" }\r\n });\r\n " + -" }\r\n\r\n dialog.dialog(\'open\');\r\n" + -" return false;\r\n });\r\n" + -" });\r\n \r\n"); +"den\');\r\n\r\n dialog.dia" + +"log(\"close\");\r\n })\r\n " + +" .catch(e => {\r\n " + +" alert(e);\r\n " + +" })\r\n " + +" }\r\n },\r\n " + +" Close: function () {\r\n " + +" $(this).dialog(\"close\");\r\n " + +"}\r\n }\r\n " + +" });\r\n }\r\n\r\n dial" + +"og.dialog(\'open\');\r\n return false;\r\n " + +" });\r\n });\r\n \r\n" + +""); - #line 901 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 881 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -2764,7 +2800,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>\r\n"); - #line 907 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 887 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -2788,13 +2824,13 @@ WriteLiteral(@"> "); - #line 919 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 899 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 919 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 899 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" foreach (var rule in Model.OnImportUserFlagRules) { @@ -2805,7 +2841,7 @@ WriteLiteral("
    \r\n " \r\n WriteLiteral("\r\n \r\n " \r\n WriteLiteral("  \r\n"); - #line 938 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 918 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -2924,7 +2960,7 @@ WriteLiteral(" class=\"whitespace-pre-wrap\""); WriteLiteral(">"); - #line 941 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 921 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(rule.Comments); @@ -2933,7 +2969,7 @@ WriteLiteral(">"); WriteLiteral("\r\n"); - #line 942 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 922 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -2943,7 +2979,7 @@ WriteLiteral(" \r\n " \r\n"); - #line 945 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 925 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -2952,7 +2988,7 @@ WriteLiteral(" \r\n WriteLiteral(" \r\n
    \r\n"); - #line 476 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 456 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 476 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 456 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (canConfig && Authorization.Has(Claims.Config.DocumentTemplate.ConfigureFilterExpression)) { @@ -1518,56 +1554,56 @@ WriteLiteral(">\r\n

    Advanced Options

    \r\n \r\n #line default #line hidden - #line 478 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 458 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Html.EditorFor(model => model.DocumentTemplate.FilterExpression)); #line default #line hidden - #line 478 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 458 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 479 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 459 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(AjaxHelpers.AjaxRemove()); #line default #line hidden - #line 479 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 459 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 480 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 460 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 480 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 460 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 481 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 461 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 481 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 461 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" @@ -1589,7 +1625,7 @@ WriteLiteral(@"> '"); - #line 491 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 471 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Url.Action(MVC.API.DocumentTemplate.UpdateFilterExpression(Model.DocumentTemplate.Id))); @@ -1618,7 +1654,7 @@ WriteLiteral("\',\r\n \'FilterExpression\ " \r\n"); - #line 520 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 500 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -1635,7 +1671,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>\r\n"); - #line 526 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 506 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -1652,7 +1688,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 530 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 510 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Model.DocumentTemplate.FilterExpression); @@ -1661,7 +1697,7 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n"); - #line 532 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 512 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } } @@ -1693,13 +1729,13 @@ WriteLiteral(@">This expression will be evaluated to determine if this templ "); - #line 546 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 526 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 546 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 526 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (canConfig && Authorization.Has(Claims.Config.DocumentTemplate.ConfigureFilterExpression)) { @@ -1707,56 +1743,56 @@ WriteLiteral(@">This expression will be evaluated to determine if this templ #line default #line hidden - #line 548 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 528 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Html.EditorFor(model => model.DocumentTemplate.OnGenerateExpression)); #line default #line hidden - #line 548 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 528 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 549 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 529 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(AjaxHelpers.AjaxRemove()); #line default #line hidden - #line 549 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 529 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 550 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 530 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 550 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 530 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 551 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 531 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 551 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 531 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" @@ -1778,7 +1814,7 @@ WriteLiteral(@"> '"); - #line 561 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 541 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Url.Action(MVC.API.DocumentTemplate.UpdateOnGenerateExpression(Model.DocumentTemplate.Id))); @@ -1807,7 +1843,7 @@ WriteLiteral("\',\r\n \'OnGenerateExpress " \r\n"); - #line 590 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 570 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -1824,7 +1860,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>\r\n"); - #line 596 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 576 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -1841,7 +1877,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 600 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 580 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Model.DocumentTemplate.OnGenerateExpression); @@ -1850,7 +1886,7 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n"); - #line 602 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 582 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } } @@ -1882,13 +1918,13 @@ WriteLiteral(@">This expression will be evaluated each time a document is ge "); - #line 616 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 596 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 616 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 596 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (canConfig && Authorization.Has(Claims.Config.DocumentTemplate.ConfigureFilterExpression)) { @@ -1896,56 +1932,56 @@ WriteLiteral(@">This expression will be evaluated each time a document is ge #line default #line hidden - #line 618 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 598 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Html.EditorFor(model => model.DocumentTemplate.OnImportAttachmentExpression)); #line default #line hidden - #line 618 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 598 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 619 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 599 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(AjaxHelpers.AjaxRemove()); #line default #line hidden - #line 619 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 599 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 620 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 600 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 620 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 600 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 621 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 601 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 621 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 601 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" @@ -1967,7 +2003,7 @@ WriteLiteral(@"> '"); - #line 631 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 611 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Url.Action(MVC.API.DocumentTemplate.UpdateOnImportAttachmentExpression(Model.DocumentTemplate.Id))); @@ -1996,7 +2032,7 @@ WriteLiteral("\',\r\n \'OnImportAttachmen " });\r\n \r\n"); - #line 660 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 640 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -2013,7 +2049,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>\r\n"); - #line 666 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 646 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -2030,7 +2066,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 670 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 650 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Model.DocumentTemplate.OnImportAttachmentExpression); @@ -2039,7 +2075,7 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n"); - #line 672 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 652 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } } @@ -2071,13 +2107,13 @@ WriteLiteral(@">This expression will be evaluated each time a document is im "); - #line 686 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 666 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 686 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 666 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (canConfig && Authorization.Has(Claims.Config.UserFlag.Configure)) { @@ -2102,14 +2138,14 @@ WriteLiteral(@"> (Model.OnImportUserFlagRules.Any() ? "hidden" : null + #line 678 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" +, Tuple.Create(Tuple.Create("", 40260), Tuple.Create(Model.OnImportUserFlagRules.Any() ? "hidden" : null #line default #line hidden -, 40570), false) +, 40260), false) ); WriteLiteral(">\r\n <None Specified>\r\n \r\n"); - #line 701 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 681 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 701 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 681 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" foreach (var rule in Model.OnImportUserFlagRules) { @@ -2141,7 +2177,7 @@ WriteLiteral(" \r\n \r\n \r\n " \r\n WriteLiteral("  \r\n"); - #line 720 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 700 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -2271,7 +2307,7 @@ WriteLiteral(" class=\"whitespace-pre-wrap\""); WriteLiteral(">"); - #line 723 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 703 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(rule.Comments); @@ -2280,7 +2316,7 @@ WriteLiteral(">"); WriteLiteral("\r\n"); - #line 724 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 704 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -2303,7 +2339,7 @@ WriteLiteral(">\r\n \r\n " \r\n"); - #line 731 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 711 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -2312,7 +2348,7 @@ WriteLiteral(">\r\n \r\n WriteLiteral(" \r\n
    "); - #line 704 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 684 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(rule.AddFlag ? "Assign" : "Remove"); @@ -2161,37 +2197,37 @@ WriteLiteral(">\r\n "); WriteLiteral("\r\n " + " (rule.UserFlag.Icon + #line 686 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" +, Tuple.Create(Tuple.Create("", 40878), Tuple.Create(rule.UserFlag.Icon #line default #line hidden -, 41188), false) -, Tuple.Create(Tuple.Create(" ", 41209), Tuple.Create("fa-lg", 41210), true) -, Tuple.Create(Tuple.Create(" ", 41215), Tuple.Create("d-", 41216), true) +, 40878), false) +, Tuple.Create(Tuple.Create(" ", 40899), Tuple.Create("fa-lg", 40900), true) +, Tuple.Create(Tuple.Create(" ", 40905), Tuple.Create("d-", 40906), true) - #line 706 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" - , Tuple.Create(Tuple.Create("", 41218), Tuple.Create(rule.UserFlag.IconColour + #line 686 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + , Tuple.Create(Tuple.Create("", 40908), Tuple.Create(rule.UserFlag.IconColour #line default #line hidden -, 41218), false) +, 40908), false) ); WriteLiteral(">\r\n"); - #line 707 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 687 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 707 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 687 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (Authorization.Has(Claims.Config.UserFlag.Configure)) { @@ -2201,7 +2237,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 709 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 689 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Html.ActionLink(rule.UserFlag.Name, MVC.Config.UserFlag.Index(rule.UserFlag.Id))); @@ -2210,7 +2246,7 @@ WriteLiteral(" "); WriteLiteral("\r\n"); - #line 710 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 690 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -2221,7 +2257,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 713 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 693 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(rule.UserFlag.Name); @@ -2230,7 +2266,7 @@ WriteLiteral(" "); WriteLiteral("\r\n"); - #line 714 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 694 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -2240,13 +2276,13 @@ WriteLiteral(" \r\n"); - #line 717 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 697 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 717 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 697 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (string.IsNullOrWhiteSpace(rule.Comments)) { @@ -2256,7 +2292,7 @@ WriteLiteral("
    \r\n"); - #line 734 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 714 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" using (Html.BeginForm(MVC.API.DocumentTemplate.RemoveOnImportUserFlagRule(Model.DocumentTemplate.Id), FormMethod.Post, new { id = "DocumentTemplate_OnImportUserFlagRules_Remove" })) { @@ -2320,28 +2356,28 @@ WriteLiteral("
    "); - #line 922 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 902 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(rule.AddFlag ? "Assign" : "Remove"); @@ -2814,37 +2850,37 @@ WriteLiteral("
    \r\n " + " (rule.UserFlag.Icon + #line 904 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" +, Tuple.Create(Tuple.Create("", 54483), Tuple.Create(rule.UserFlag.Icon #line default #line hidden -, 54876), false) -, Tuple.Create(Tuple.Create(" ", 54897), Tuple.Create("fa-lg", 54898), true) -, Tuple.Create(Tuple.Create(" ", 54903), Tuple.Create("d-", 54904), true) +, 54483), false) +, Tuple.Create(Tuple.Create(" ", 54504), Tuple.Create("fa-lg", 54505), true) +, Tuple.Create(Tuple.Create(" ", 54510), Tuple.Create("d-", 54511), true) - #line 924 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" - , Tuple.Create(Tuple.Create("", 54906), Tuple.Create(rule.UserFlag.IconColour + #line 904 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + , Tuple.Create(Tuple.Create("", 54513), Tuple.Create(rule.UserFlag.IconColour #line default #line hidden -, 54906), false) +, 54513), false) ); WriteLiteral(">\r\n"); - #line 925 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 905 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 925 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 905 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (Authorization.Has(Claims.Config.UserFlag.Configure)) { @@ -2854,7 +2890,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 927 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 907 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Html.ActionLink(rule.UserFlag.Name, MVC.Config.UserFlag.Index(rule.UserFlag.Id))); @@ -2863,7 +2899,7 @@ WriteLiteral(" "); WriteLiteral("\r\n"); - #line 928 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 908 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } else { @@ -2874,7 +2910,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 931 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 911 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(rule.UserFlag.Name); @@ -2883,7 +2919,7 @@ WriteLiteral(" "); WriteLiteral("\r\n"); - #line 932 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 912 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -2893,13 +2929,13 @@ WriteLiteral(" \r\n"); - #line 935 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 915 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 935 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 915 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (string.IsNullOrWhiteSpace(rule.Comments)) { @@ -2909,7 +2945,7 @@ WriteLiteral("
    \r\n"); - #line 948 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 928 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } } @@ -2990,7 +3026,7 @@ WriteLiteral(@"> WriteLiteral(" "); - #line 966 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 946 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel() { CanConfigure = canConfig, @@ -3009,7 +3045,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 975 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 955 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel() { CanConfigure = canConfig, @@ -3026,13 +3062,13 @@ WriteLiteral(" "); WriteLiteral("\r\n"); - #line 984 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 964 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 984 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 964 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (canConfig) { @@ -3040,14 +3076,14 @@ WriteLiteral("\r\n"); #line default #line hidden - #line 986 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 966 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupShared)); #line default #line hidden - #line 986 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 966 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" } @@ -3065,7 +3101,7 @@ WriteLiteral(">\r\n

    Template Expressions

    \r\n"); WriteLiteral(" "); - #line 996 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 976 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" Write(Html.Partial(MVC.Config.DocumentTemplate.Views._ExpressionsTable, Model.TemplateExpressions)); @@ -3079,7 +3115,38 @@ WriteLiteral(" title=\"Delete this Document Template?\""); WriteLiteral(" class=\"dialog\""); -WriteLiteral(">\r\n

    \r\n \r\n"); + + + #line 980 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + + + #line default + #line hidden + + #line 980 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + using (Html.BeginForm(MVC.API.DocumentTemplate.Delete(Model.DocumentTemplate.Id, true))) + { + + + #line default + #line hidden + + #line 982 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 982 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + + } + + + #line default + #line hidden +WriteLiteral("

    \r\n $(function () { - var button = $('#buttonDelete'); - var buttonDialog = $(""#dialogConfirmDelete""); - var buttonLink = button.attr('href'); - button.attr('href', '#'); + const button = $('#buttonDelete'); + let buttonDialog = null; button.click(function () { - buttonDialog.dialog('open'); - return false; - }); - buttonDialog.dialog({ - resizable: false, - modal: true, - autoOpen: false, - buttons: { - ""Delete"": function () { - $this = $(this); - $this.dialog('disable'); - $this.dialog(""option"", ""buttons"", null); - window.location.href = buttonLink; - }, - Cancel: function () { - $(this).dialog(""close""); - } + if (!buttonDialog) { + buttonDialog = $(""#dialogConfirmDelete"").dialog({ + resizable: false, + modal: true, + autoOpen: false, + buttons: { + ""Delete"": function () { + $(this) + .dialog(""option"", ""buttons"", null) + .find('form').trigger('submit'); + }, + Cancel: function () { + $(this).dialog(""close""); + } + } + }); } + buttonDialog.dialog('open'); }); - }); \r\n"); - #line 1039 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 1020 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" #line default #line hidden - #line 1039 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" + #line 1020 "..\..\Areas\Config\Views\DocumentTemplate\Show.cshtml" if (hideAdvanced) { @@ -3163,7 +3227,7 @@ WriteLiteral(@" + } @if (Model.Package.Scope == AttachmentTypes.Job) { -


    -

    Job Type Filters:

    -
    -
    - @if (Model.Package.JobSubTypes != null && Model.Package.JobSubTypes.Count > 0) +
    +

    Job Type Filters:

    +
    +
    + @if (Model.Package.JobSubTypes != null && Model.Package.JobSubTypes.Count > 0) { -
      - @foreach (var jobType in Model.JobSubTypesSelected.GroupBy(jst => jst.JobType).OrderBy(jtg => jtg.Key.Description)) +
        + @foreach (var jobType in Model.JobSubTypesSelected.GroupBy(jst => jst.JobType).OrderBy(jtg => jtg.Key.Description)) { -
      • - @jobType.Key.Description -
          - @if (jobType.Count() == Model.JobTypes.FirstOrDefault(jt => jt.Id == jobType.Key.Id).JobSubTypes.Count) +
        • + @jobType.Key.Description +
            + @if (jobType.Count() == Model.JobTypes.FirstOrDefault(jt => jt.Id == jobType.Key.Id).JobSubTypes.Count) { -
          • [All Sub Types]
          • +
          • [All Sub Types]
          • } else { foreach (var jobSubType in jobType) { -
          • @jobSubType.Description
          • +
          • @jobSubType.Description
          • } } -
          -
        • +
        +
      • } -
      +
    } else { - <No Filter> + <No Filter> } -
    - @if (canConfig) +
    + @if (canConfig) { - Update -
    - @using (Html.BeginForm(MVC.API.DocumentTemplatePackage.UpdateJobSubTypes(Model.Package.Id, null, true))) + Update +
    + @using (Html.BeginForm(MVC.API.DocumentTemplatePackage.UpdateJobSubTypes(Model.Package.Id, null, true))) { + @Html.AntiForgeryToken() var selectedTypes = Model.JobSubTypesSelected.Select(jst => jst.JobType).Distinct().ToList(); foreach (var jt in Model.JobTypes) { -
    -

    - -

    -
    - @CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id), "div") - @CommonHelpers.CheckBoxList("JobSubTypes", jt.JobSubTypes.OrderBy(jst => jst.Description).ToSelectListItems(Model.Package.JobSubTypes), 2) -
    -
    +
    +

    + +

    +
    + @CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id), "div") + @CommonHelpers.CheckBoxList("JobSubTypes", jt.JobSubTypes.OrderBy(jst => jst.Description).ToSelectListItems(Model.Package.JobSubTypes), 2) +
    +
    } } -
    - + } -
    +
    }
    -
    +
    + @using (Html.BeginForm(MVC.API.DocumentTemplatePackage.Delete(Model.Package.Id, true))) + { + @Html.AntiForgeryToken() + }

    This item will be permanently deleted.
    Are you sure? @@ -626,31 +627,29 @@

    @@ -668,8 +667,8 @@ } @if (canBulkGenerate) { - Bulk Generate -
    + +
    @switch (Model.Package.Scope) { @@ -702,8 +701,8 @@
    86,99,44
    86;99;44
    - break; - case AttachmentTypes.User: + break; + case AttachmentTypes.User:
    Enter multiple User Ids separated by <new line>, commas (,) or semicolons (;).
    @@ -719,21 +718,18 @@ break; }
    - @using (Html.BeginForm(MVC.API.DocumentTemplatePackage.BulkGenerate(Model.Package.Id), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.DocumentTemplatePackage.BulkGenerate(Model.Package.Id))) { -
    - -
    - -
    + @Html.AntiForgeryToken() +
    + }
    \r\n"); +"s\': function () {\r\n $(thi" + +"s)\r\n .dialog(\'option\'" + +", \'buttons\', null)\r\n " + +".find(\'form\').trigger(\'submit\');\r\n " + +" },\r\n \'Cancel\': function" + +" () {\r\n $(this).dialog(\'c" + +"lose\');\r\n }\r\n " + +" }\r\n }" + +");\r\n }\r\n\r\n " + +" dialog.dialog(\'open\');\r\n\r\n retur" + +"n false;\r\n }\r\n\r\n " + +" $(\'#Config_DocumentTemplatePackages_Scope_Button\').click(showDialog);\r\n " + +" });\r\n \r\n"); - #line 226 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 227 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } @@ -794,88 +807,88 @@ WriteLiteral(">\r\n $(function () {\r\n WriteLiteral(" "); - #line 227 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 228 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" if (Model.Package.Scope == AttachmentTypes.Job) { #line default #line hidden -WriteLiteral("
    \r\n"); +WriteLiteral("
    \r\n"); -WriteLiteral("

    Job Type Filters:

    \r\n"); +WriteLiteral("

    Job Type Filters:

    \r\n"); -WriteLiteral(" \r\n
    \r\n"); +WriteLiteral(">\r\n
    \r\n"); - #line 233 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - + #line 234 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line default #line hidden - #line 233 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - if (Model.Package.JobSubTypes != null && Model.Package.JobSubTypes.Count > 0) + #line 234 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + if (Model.Package.JobSubTypes != null && Model.Package.JobSubTypes.Count > 0) { #line default #line hidden -WriteLiteral("
      \r\n"); +WriteLiteral("
        \r\n"); - #line 236 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - + #line 237 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line default #line hidden - #line 236 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - foreach (var jobType in Model.JobSubTypesSelected.GroupBy(jst => jst.JobType).OrderBy(jtg => jtg.Key.Description)) + #line 237 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + foreach (var jobType in Model.JobSubTypesSelected.GroupBy(jst => jst.JobType).OrderBy(jtg => jtg.Key.Description)) { #line default #line hidden -WriteLiteral("
      • \r\n"); +WriteLiteral("
      • \r\n"); -WriteLiteral(" "); +WriteLiteral(" "); - #line 239 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - Write(jobType.Key.Description); + #line 240 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + Write(jobType.Key.Description); #line default #line hidden -WriteLiteral("\r\n
          \r\n"); +WriteLiteral("\r\n
            \r\n"); - #line 241 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - + #line 242 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line default #line hidden - #line 241 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - if (jobType.Count() == Model.JobTypes.FirstOrDefault(jt => jt.Id == jobType.Key.Id).JobSubTypes.Count) + #line 242 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + if (jobType.Count() == Model.JobTypes.FirstOrDefault(jt => jt.Id == jobType.Key.Id).JobSubTypes.Count) { #line default #line hidden -WriteLiteral("
          • [All Sub Types]
          • \r\n"); - #line 244 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 245 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } else { @@ -885,11 +898,11 @@ WriteLiteral(">[All Sub Types]\r\n"); #line default #line hidden -WriteLiteral("
          • "); +WriteLiteral("
          • "); - #line 249 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - Write(jobSubType.Description); + #line 250 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + Write(jobSubType.Description); #line default @@ -897,27 +910,27 @@ WriteLiteral("
          • "); WriteLiteral("
          • \r\n"); - #line 250 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 251 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } } #line default #line hidden -WriteLiteral("
          \r\n " + -" \r\n"); +WriteLiteral("
        \r\n " + +"
      • \r\n"); - #line 254 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 255 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } #line default #line hidden -WriteLiteral("
      \r\n"); +WriteLiteral("
    \r\n"); - #line 256 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 257 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } else { @@ -925,36 +938,36 @@ WriteLiteral(" \r\n"); #line default #line hidden -WriteLiteral(" <No Filter>\r\n"); - #line 260 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 261 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } #line default #line hidden -WriteLiteral("
    \r\n"); +WriteLiteral("
    \r\n"); - #line 262 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - + #line 263 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line default #line hidden - #line 262 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - if (canConfig) + #line 263 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + if (canConfig) { #line default #line hidden -WriteLiteral(" Update\r\n"); -WriteLiteral(" \r\n"); - #line 266 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - + #line 267 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line default #line hidden - #line 266 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - using (Html.BeginForm(MVC.API.DocumentTemplatePackage.UpdateJobSubTypes(Model.Package.Id, null, true))) + #line 267 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + using (Html.BeginForm(MVC.API.DocumentTemplatePackage.UpdateJobSubTypes(Model.Package.Id, null, true))) { + + + #line default + #line hidden + + #line 269 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 269 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + var selectedTypes = Model.JobSubTypesSelected.Select(jst => jst.JobType).Distinct().ToList(); foreach (var jt in Model.JobTypes) { @@ -991,179 +1018,177 @@ WriteLiteral(">\r\n"); #line default #line hidden -WriteLiteral(" \r\n

    \r\n " + -" \r\n

    \r\n " + +" (jt.Id + #line 275 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" +, Tuple.Create(Tuple.Create("", 15528), Tuple.Create(jt.Id #line default #line hidden -, 15267), false) +, 15528), false) ); WriteLiteral(" class=\"jobType\""); WriteLiteral(" type=\"checkbox\""); -WriteAttribute("value", Tuple.Create(" value=\"", 15308), Tuple.Create("\"", 15324) +WriteAttribute("value", Tuple.Create(" value=\"", 15569), Tuple.Create("\"", 15585) - #line 273 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - , Tuple.Create(Tuple.Create("", 15316), Tuple.Create(jt.Id + #line 275 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + , Tuple.Create(Tuple.Create("", 15577), Tuple.Create(jt.Id #line default #line hidden -, 15316), false) +, 15577), false) ); WriteLiteral(" "); - #line 273 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - Write(selectedTypes.Contains(jt) ? "checked=\" checked\"" : null); + #line 275 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + Write(selectedTypes.Contains(jt) ? "checked=\" checked\"" : null); #line default #line hidden WriteLiteral(" />(jt.Id + #line 275 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + , Tuple.Create(Tuple.Create("", 15669), Tuple.Create(jt.Id #line default #line hidden -, 15408), false) +, 15669), false) ); WriteLiteral(">"); - #line 273 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - Write(jt.Description); - - - #line default - #line hidden -WriteLiteral("\r\n

    \r\n " + -" (jt.Id + Write(jt.Description); + #line default #line hidden -, 15556), false) +WriteLiteral("\r\n

    \r\n " + +" (jt.Id + + #line default + #line hidden +, 15833), false) ); WriteLiteral(" class=\"jobSubTypes\""); WriteLiteral(">\r\n"); -WriteLiteral(" "); +WriteLiteral(" "); - #line 276 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - Write(CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id), "div")); + #line 278 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + Write(CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id), "div")); #line default #line hidden WriteLiteral("\r\n"); -WriteLiteral(" "); +WriteLiteral(" "); - #line 277 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" - Write(CommonHelpers.CheckBoxList("JobSubTypes", jt.JobSubTypes.OrderBy(jst => jst.Description).ToSelectListItems(Model.Package.JobSubTypes), 2)); + #line 279 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + Write(CommonHelpers.CheckBoxList("JobSubTypes", jt.JobSubTypes.OrderBy(jst => jst.Description).ToSelectListItems(Model.Package.JobSubTypes), 2)); #line default #line hidden -WriteLiteral("\r\n
    \r\n " + -"
    \r\n"); +WriteLiteral("\r\n \r\n " + +" \r\n"); - #line 280 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 282 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } } #line default #line hidden -WriteLiteral(" \r\n"); +WriteLiteral(" \r\n"); -WriteLiteral(" \r\n"); +WriteLiteral(" \r\n"); +" $form.submit();\r\n " + +" } else {\r\n " + +" alert(\'The package templates must include at l" + +"east one document template\');\r\n " + +" }\r\n },\r\n " + +" \'Cancel\': function () {\r\n " + +" dialog.dialog(\'close\');\r\n " + +" }\r\n " + +" }\r\n });\r\n\r\n " + +" dialog.find(\'.templates_connected\')\r\n " + +" .sortable({\r\n " + +" connectWith: \'.templates_connected\'\r\n " + +" })\r\n }\r\n\r\n " + +" dialog.dialog(\'open\');\r\n\r\n " + +" return false;\r\n }\r\n\r\n " + +" $(\'#Config_DocumentTemplatePackages_Templates_Button\'" + +").click(showDialog);\r\n });\r\n " + +" \r\n"); - #line 466 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 463 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } @@ -1576,13 +1614,13 @@ WriteLiteral(">\r\n

    Advanced Options

    \r\n \r\n "sion:\r\n \r\n
    \r\n"); - #line 482 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 479 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" #line default #line hidden - #line 482 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 479 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" if (canConfig && Authorization.Has(Claims.Config.DocumentTemplate.ConfigureFilterExpression)) { @@ -1590,56 +1628,56 @@ WriteLiteral(">\r\n

    Advanced Options

    \r\n \r\n #line default #line hidden - #line 484 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 481 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" Write(Html.EditorFor(model => Model.Package.FilterExpression)); #line default #line hidden - #line 484 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 481 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" #line default #line hidden - #line 485 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 482 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" Write(AjaxHelpers.AjaxRemove()); #line default #line hidden - #line 485 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 482 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" #line default #line hidden - #line 486 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 483 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 486 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 483 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" #line default #line hidden - #line 487 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 484 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 487 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 484 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" @@ -1661,7 +1699,7 @@ WriteLiteral(@"> '"); - #line 497 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 494 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" Write(Url.Action(MVC.API.DocumentTemplatePackage.UpdateFilterExpression(Model.Package.Id))); @@ -1690,7 +1728,7 @@ WriteLiteral("\',\r\n \'FilterExpression\ " \r\n"); - #line 526 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 523 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } else { @@ -1707,7 +1745,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>\r\n"); - #line 532 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 529 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } else { @@ -1724,7 +1762,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 536 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 533 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" Write(Model.Package.FilterExpression); @@ -1733,7 +1771,7 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n"); - #line 538 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 535 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } } @@ -1765,13 +1803,13 @@ WriteLiteral(@">This expression will be evaluated to determine if this packa "); - #line 552 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 549 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" #line default #line hidden - #line 552 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 549 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" if (canConfig && Authorization.Has(Claims.Config.DocumentTemplate.ConfigureFilterExpression)) { @@ -1779,56 +1817,56 @@ WriteLiteral(@">This expression will be evaluated to determine if this packa #line default #line hidden - #line 554 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 551 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" Write(Html.EditorFor(model => Model.Package.OnGenerateExpression)); #line default #line hidden - #line 554 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 551 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" #line default #line hidden - #line 555 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 552 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" Write(AjaxHelpers.AjaxRemove()); #line default #line hidden - #line 555 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 552 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" #line default #line hidden - #line 556 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 553 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 556 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 553 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" #line default #line hidden - #line 557 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 554 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 557 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 554 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" @@ -1850,7 +1888,7 @@ WriteLiteral(@"> '"); - #line 567 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 564 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" Write(Url.Action(MVC.API.DocumentTemplatePackage.UpdateOnGenerateExpression(Model.Package.Id))); @@ -1879,7 +1917,7 @@ WriteLiteral("\',\r\n \'OnGenerateExpress " \r\n"); - #line 596 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 593 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } else { @@ -1896,7 +1934,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>\r\n"); - #line 602 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 599 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } else { @@ -1913,7 +1951,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 606 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 603 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" Write(Model.Package.OnGenerateExpression); @@ -1922,7 +1960,7 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n"); - #line 608 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 605 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" } } @@ -1954,9 +1992,42 @@ WriteLiteral(@">This expression will be evaluated each time the package is g WriteLiteral(" id=\"dialogConfirmDelete\""); +WriteLiteral(" class=\"dialog\""); + WriteLiteral(" title=\"Delete this Document Template?\""); -WriteLiteral(">\r\n

    \r\n \r\n"); + + + #line 619 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + + + #line default + #line hidden + + #line 619 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + using (Html.BeginForm(MVC.API.DocumentTemplatePackage.Delete(Model.Package.Id, true))) + { + + + #line default + #line hidden + + #line 621 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 621 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + + } + + + #line default + #line hidden +WriteLiteral("

    \r\n $(function () { - var button = $('#buttonDelete'); - var buttonDialog = $(""#dialogConfirmDelete""); - var buttonLink = button.attr('href'); - button.attr('href', '#'); - button.click(function () { + const button = $('#buttonDelete'); + let buttonDialog = null; + button.on('click', function () { + if (!buttonDialog) { + buttonDialog = $(""#dialogConfirmDelete"").dialog({ + resizable: false, + modal: true, + autoOpen: false, + buttons: { + ""Delete"": function () { + $(this) + .dialog(""option"", ""buttons"", null) + .find('form').trigger('submit'); + }, + Cancel: function () { + $(this).dialog(""close""); + } + } + }); + } buttonDialog.dialog('open'); return false; }); - buttonDialog.dialog({ - resizable: false, - modal: true, - autoOpen: false, - buttons: { - ""Delete"": function () { - $this = $(this); - $this.dialog('disable'); - $this.dialog(""option"", ""buttons"", null); - window.location.href = buttonLink; - }, - Cancel: function () { - $(this).dialog(""close""); - } - } - }); - }); \r\n"); - #line 657 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 656 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" #line default #line hidden - #line 657 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" + #line 656 "..\..\Areas\Config\Views\DocumentTemplate\ShowPackage.cshtml" if (hideAdvanced) { @@ -2033,7 +2102,7 @@ WriteLiteral(@" diff --git a/Disco.Web/Areas/Config/Views/DocumentTemplate/UndetectedPages.generated.cs b/Disco.Web/Areas/Config/Views/DocumentTemplate/UndetectedPages.generated.cs index f8c44822..3e466cd7 100644 --- a/Disco.Web/Areas/Config/Views/DocumentTemplate/UndetectedPages.generated.cs +++ b/Disco.Web/Areas/Config/Views/DocumentTemplate/UndetectedPages.generated.cs @@ -59,6 +59,83 @@ WriteLiteral("\r\n

    -
    + Pending Timeout: @@ -21,50 +23,14 @@ @AjaxHelpers.AjaxLoader() minutes (default: 30) } else @@ -87,7 +53,7 @@

    Apple Mac Secure Enroll

    - - \r\n
    + Username: @@ -97,43 +63,14 @@ @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader() } else @@ -151,7 +88,7 @@
    + Password: @@ -161,43 +98,14 @@ @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader() } else diff --git a/Disco.Web/Areas/Config/Views/Enrolment/Index.generated.cs b/Disco.Web/Areas/Config/Views/Enrolment/Index.generated.cs index b480fac4..83f57c72 100644 --- a/Disco.Web/Areas/Config/Views/Enrolment/Index.generated.cs +++ b/Disco.Web/Areas/Config/Views/Enrolment/Index.generated.cs @@ -53,6 +53,8 @@ namespace Disco.Web.Areas.Config.Views.Enrolment ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Enrolment"); + Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers"); + #line default #line hidden @@ -62,17 +64,20 @@ WriteLiteral(" class=\"form\""); WriteLiteral(" style=\"width: 530px;\""); -WriteLiteral(">\r\n \r\n \r\n \r\n \r\n \r\n WriteLiteral(" style=\"width: 135px\""); -WriteLiteral(">\r\n  \r\n \r\n " + -"\r\n \r\n
    \r\n Pending Timeout:\r" + -"\n \r\n"); +WriteLiteral(">\r\n \r\n \r\n \r\n Pending Timeout:\r\n \r\n \r\n \r\n"); - #line 327 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 328 "..\..\Areas\Config\Views\Organisation\Index.cshtml" } @@ -1241,7 +1255,7 @@ WriteLiteral(">\r\n $(function () {\r\n let $addressEditDialog " return false;\r\n });\r\n });\r\n \r\n"); - #line 417 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 418 "..\..\Areas\Config\Views\Organisation\Index.cshtml" } #line default diff --git a/Disco.Web/Areas/Config/Views/Plugins/Configure.cshtml b/Disco.Web/Areas/Config/Views/Plugins/Configure.cshtml index 6d9b29df..cfbb8b3e 100644 --- a/Disco.Web/Areas/Config/Views/Plugins/Configure.cshtml +++ b/Disco.Web/Areas/Config/Views/Plugins/Configure.cshtml @@ -1,11 +1,12 @@ @model Disco.Web.Areas.Config.Models.Plugins.PluginConfigurationViewModel @{ Authorization.Require(Claims.Config.Plugin.Configure); - + ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Plugins", MVC.Config.Plugins.Index(), Model.Manifest.Name); } @using (Html.BeginForm()) -{ +{ + @Html.AntiForgeryToken() @Html.ValidationSummary(false)
    @Html.PartialCompiled(Model.PluginViewType, Model.PluginViewModel) @@ -13,4 +14,4 @@
    -} \ No newline at end of file +} diff --git a/Disco.Web/Areas/Config/Views/Plugins/Index.cshtml b/Disco.Web/Areas/Config/Views/Plugins/Index.cshtml index 4326089e..45e75a2c 100644 --- a/Disco.Web/Areas/Config/Views/Plugins/Index.cshtml +++ b/Disco.Web/Areas/Config/Views/Plugins/Index.cshtml @@ -88,7 +88,7 @@ Warning: Data will be permanently deleted

    - @using (Html.BeginForm(MVC.API.Plugin.Uninstall(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.Plugin.Uninstall())) { @Html.AntiForgeryToken() diff --git a/Disco.Web/Areas/Config/Views/Plugins/Index.generated.cs b/Disco.Web/Areas/Config/Views/Plugins/Index.generated.cs index afb72456..8788bf31 100644 --- a/Disco.Web/Areas/Config/Views/Plugins/Index.generated.cs +++ b/Disco.Web/Areas/Config/Views/Plugins/Index.generated.cs @@ -411,7 +411,7 @@ WriteLiteral(">Warning: Data will be permanently deleted\r\ #line hidden #line 91 "..\..\Areas\Config\Views\Plugins\Index.cshtml" - using (Html.BeginForm(MVC.API.Plugin.Uninstall(), FormMethod.Post)) + using (Html.BeginForm(MVC.API.Plugin.Uninstall())) { diff --git a/Disco.Web/Areas/Config/Views/Plugins/Install.cshtml b/Disco.Web/Areas/Config/Views/Plugins/Install.cshtml index 98fdd605..34a3e9f8 100644 --- a/Disco.Web/Areas/Config/Views/Plugins/Install.cshtml +++ b/Disco.Web/Areas/Config/Views/Plugins/Install.cshtml @@ -75,7 +75,7 @@ Only Install plugins from a trusted source.

    - @using (Html.BeginForm(MVC.API.Plugin.Install(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.Plugin.Install())) { @Html.AntiForgeryToken() } diff --git a/Disco.Web/Areas/Config/Views/Plugins/Install.generated.cs b/Disco.Web/Areas/Config/Views/Plugins/Install.generated.cs index 925aff78..fb288a4f 100644 --- a/Disco.Web/Areas/Config/Views/Plugins/Install.generated.cs +++ b/Disco.Web/Areas/Config/Views/Plugins/Install.generated.cs @@ -434,7 +434,7 @@ WriteLiteral(">Warning: All plugins run with the same level #line hidden #line 78 "..\..\Areas\Config\Views\Plugins\Install.cshtml" - using (Html.BeginForm(MVC.API.Plugin.Install(), FormMethod.Post)) + using (Html.BeginForm(MVC.API.Plugin.Install())) { diff --git a/Disco.Web/Areas/Config/Views/Plugins/ProviderConfiguration.generated.cs b/Disco.Web/Areas/Config/Views/Plugins/ProviderConfiguration.generated.cs index b9811634..401733fc 100644 --- a/Disco.Web/Areas/Config/Views/Plugins/ProviderConfiguration.generated.cs +++ b/Disco.Web/Areas/Config/Views/Plugins/ProviderConfiguration.generated.cs @@ -47,7 +47,7 @@ namespace Disco.Web.Areas.Config.Views.Plugins #line 2 "..\..\Areas\Config\Views\Plugins\Configure.cshtml" Authorization.Require(Claims.Config.Plugin.Configure); - + ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Plugins", MVC.Config.Plugins.Index(), Model.Manifest.Name); @@ -58,20 +58,34 @@ WriteLiteral("\r\n"); #line 7 "..\..\Areas\Config\Views\Plugins\Configure.cshtml" using (Html.BeginForm()) -{ +{ #line default #line hidden #line 9 "..\..\Areas\Config\Views\Plugins\Configure.cshtml" -Write(Html.ValidationSummary(false)); +Write(Html.AntiForgeryToken()); #line default #line hidden #line 9 "..\..\Areas\Config\Views\Plugins\Configure.cshtml" + + + + #line default + #line hidden + + #line 10 "..\..\Areas\Config\Views\Plugins\Configure.cshtml" +Write(Html.ValidationSummary(false)); + + + #line default + #line hidden + + #line 10 "..\..\Areas\Config\Views\Plugins\Configure.cshtml" @@ -86,7 +100,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 11 "..\..\Areas\Config\Views\Plugins\Configure.cshtml" + #line 12 "..\..\Areas\Config\Views\Plugins\Configure.cshtml" Write(Html.PartialCompiled(Model.PluginViewType, Model.PluginViewModel)); @@ -109,8 +123,9 @@ WriteLiteral(" value=\"Save Configuration\""); WriteLiteral(" />\r\n \r\n"); - #line 16 "..\..\Areas\Config\Views\Plugins\Configure.cshtml" + #line 17 "..\..\Areas\Config\Views\Plugins\Configure.cshtml" } + #line default #line hidden diff --git a/Disco.Web/Areas/Config/Views/Shared/LinkedGroupInstance.cshtml b/Disco.Web/Areas/Config/Views/Shared/LinkedGroupInstance.cshtml index c7de37a7..c9ce8f93 100644 --- a/Disco.Web/Areas/Config/Views/Shared/LinkedGroupInstance.cshtml +++ b/Disco.Web/Areas/Config/Views/Shared/LinkedGroupInstance.cshtml @@ -22,20 +22,24 @@
    @group.Domain.FriendlyDistinguishedNamePath(group.DistinguishedName)
    - - Synchronize Now + + using (Html.BeginForm(MVC.API.System.SyncActiveDirectoryManagedGroup(Model.ManagedGroup.Key, Context.Request.Path))) + { + @Html.AntiForgeryToken() + + } } else {
    Group Not Found: @Model.ManagedGroup.Configuration.GroupId
    - + } } else { - + } } else diff --git a/Disco.Web/Areas/Config/Views/Shared/LinkedGroupInstance.generated.cs b/Disco.Web/Areas/Config/Views/Shared/LinkedGroupInstance.generated.cs index ff02410f..0056e958 100644 --- a/Disco.Web/Areas/Config/Views/Shared/LinkedGroupInstance.generated.cs +++ b/Disco.Web/Areas/Config/Views/Shared/LinkedGroupInstance.generated.cs @@ -140,13 +140,15 @@ WriteLiteral("\r\n \r\n"); WriteLiteral(" Change Link\r\n"); -WriteLiteral(" (Url.Action(MVC.API.System.SyncActiveDirectoryManagedGroup(Model.ManagedGroup.Key, Context.Request.Path)) + using (Html.BeginForm(MVC.API.System.SyncActiveDirectoryManagedGroup(Model.ManagedGroup.Key, Context.Request.Path))) + { + #line default #line hidden -, 1342), false) -); + + #line 28 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 28 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" + + + + #line default + #line hidden +WriteLiteral(" Synchronize Now\r\n"); +WriteLiteral(">Synchronize Now\r\n"); - #line 27 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" + #line 30 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" + } } else { @@ -239,7 +256,7 @@ WriteLiteral(" class=\"code\""); WriteLiteral(">"); - #line 31 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" + #line 35 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" Write(Model.ManagedGroup.Configuration.GroupId); @@ -249,13 +266,15 @@ WriteLiteral("\r\n \r\n"); WriteLiteral(" Change Link\r\n"); - #line 34 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" + #line 38 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" } } else @@ -320,6 +339,8 @@ WriteLiteral(">Change Link\r\n"); #line hidden WriteLiteral(" Link Group\r\n"); - #line 39 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" + #line 43 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" } } else @@ -377,14 +398,14 @@ WriteLiteral(" (group.Id + #line 51 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" +, Tuple.Create(Tuple.Create("", 2974), Tuple.Create(group.Id #line default #line hidden -, 2785), false) +, 2974), false) ); WriteLiteral(">\r\n "); - #line 48 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" + #line 52 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" Write(group.Domain.FriendlyDistinguishedNamePath(group.DistinguishedName)); @@ -403,7 +424,7 @@ WriteLiteral(">"); WriteLiteral("\r\n \r\n"); - #line 50 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" + #line 54 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" } else { @@ -426,7 +447,7 @@ WriteLiteral(" class=\"code\""); WriteLiteral(">"); - #line 54 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" + #line 58 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" Write(Model.ManagedGroup.Configuration.GroupId); @@ -435,7 +456,7 @@ WriteLiteral(">"); WriteLiteral("\r\n \r\n"); - #line 56 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" + #line 60 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" } } else @@ -455,7 +476,7 @@ WriteLiteral(" class=\"fa fa-fw fa-lg fa-unlink information\""); WriteLiteral(">No Group Linked\r\n"); - #line 61 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" + #line 65 "..\..\Areas\Config\Views\Shared\LinkedGroupInstance.cshtml" } } diff --git a/Disco.Web/Areas/Config/Views/Shared/LinkedGroupShared.cshtml b/Disco.Web/Areas/Config/Views/Shared/LinkedGroupShared.cshtml index 2aa3dd1b..a2f23a34 100644 --- a/Disco.Web/Areas/Config/Views/Shared/LinkedGroupShared.cshtml +++ b/Disco.Web/Areas/Config/Views/Shared/LinkedGroupShared.cshtml @@ -4,6 +4,7 @@

    + @Html.AntiForgeryToken()
    \r\n"); - #line 17 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 19 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" #line default #line hidden - #line 17 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 19 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" if (canConfig) { @@ -80,42 +85,42 @@ WriteLiteral(">\r\n \r\n \r\n \r\n
    \r\n #line default #line hidden - #line 19 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 21 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(Html.TextBoxFor(model => model.PendingTimeoutMinutes, new { type = "number", min = "1" })); #line default #line hidden - #line 19 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 21 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" #line default #line hidden - #line 20 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 22 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 20 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 22 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" #line default #line hidden - #line 21 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 23 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 21 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 23 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" @@ -132,64 +137,24 @@ WriteLiteral(" - $(function () { - var $DOM = $('#PendingTimeoutMinutes'); - var $DOMAjaxSave = $DOM.next('.ajaxSave'); - $DOM - .watermark('Minutes') - .focus(function () { $DOM.select() }) - .keydown(function (e) { - $DOMAjaxSave.show(); - if (e.which == 13) { - $(this).blur(); - } - }).blur(function () { - $DOMAjaxSave.hide(); - }) - .change(function () { - $DOMAjaxSave.hide(); - var $ajaxLoading = $DOMAjaxSave.next('.ajaxLoading').show(); - var data = { PendingTimeoutMinutes: parseInt($DOM.val()) }; - if (data.PendingTimeoutMinutes <= 0) { - alert('Pending Timeout must be greater than zero'); - $ajaxLoading.hide(); - return; - } else { - $.ajax({ - url: '"); + $(function () { + document.DiscoFunctions.PropertyChangeHelper( + $('#PendingTimeoutMinutes'), + 'Pending Timeout', + '"); - #line 48 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 30 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(Url.Action(MVC.API.Enrolment.PendingTimeoutMinutes())); #line default #line hidden -WriteLiteral(@"', - dataType: 'json', - method: 'POST', - data: data, - success: function (d) { - if (d == 'OK') { - $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow'); - } else { - $ajaxLoading.hide(); - alert('Unable to update pending timeout: ' + d); - } - }, - error: function (jqXHR, textStatus, errorThrown) { - alert('Unable to update pending timeout: ' + textStatus); - $ajaxLoading.hide(); - } - }); - } - }); - }); - -"); +WriteLiteral("\',\r\n \'PendingTimeoutMinutes\'\r\n " + +" );\r\n });\r\n \r\n"); - #line 69 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 35 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" } else { @@ -198,14 +163,14 @@ WriteLiteral(@"', #line default #line hidden - #line 72 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 38 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(TimeSpan.FromMinutes(Model.PendingTimeoutMinutes)); #line default #line hidden - #line 72 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 38 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" } @@ -235,16 +200,20 @@ WriteLiteral(" class=\"form\""); WriteLiteral(" style=\"width: 530px; margin-top: 15px\""); WriteLiteral(">\r\n

    Apple Mac Secure Enroll

    \r\n \r\n \r\n <" + -"th>\r\n Username:\r\n \r\n \r\n \r\n \r\n #line 29 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" if (canConfig) - { + { #line default #line hidden #line 30 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(Html.EditorFor(model => model.Token.JobQueue.Name)); + Write(Html.EditorFor(model => model.Token.JobQueue.Name)); #line default #line hidden #line 30 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - + #line default @@ -189,65 +189,65 @@ WriteLiteral("\',\r\n \'QueueName\'\r\n #line default #line hidden -WriteLiteral(" \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n \r\n \r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n
    \r\n"); +"th"); + +WriteLiteral(" width=\"130\""); + +WriteLiteral(">\r\n Username:\r\n \r\n \r\n"); - #line 94 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 60 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" #line default #line hidden - #line 94 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 60 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" if (canConfig) { @@ -252,42 +221,42 @@ WriteLiteral(">\r\n

    Apple Mac Secure Enroll

    \r\n \r\n #line default #line hidden - #line 96 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 62 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(Html.TextBoxFor(model => model.MacSshUsername)); #line default #line hidden - #line 96 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 62 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" #line default #line hidden - #line 97 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 63 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 97 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 63 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" #line default #line hidden - #line 98 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 64 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 98 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 64 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" @@ -297,58 +266,23 @@ WriteLiteral(" - $(function () { - var $DOM = $('#MacSshUsername'); - var $DOMAjaxSave = $DOM.next('.ajaxSave'); - $DOM - .watermark('Username') - .focus(function () { $DOM.select() }) - .keydown(function (e) { - $DOMAjaxSave.show(); - if (e.which == 13) { - $(this).blur(); - } - }).blur(function () { - $DOMAjaxSave.hide(); - }) - .change(function () { - $DOMAjaxSave.hide(); - var $ajaxLoading = $DOMAjaxSave.next('.ajaxLoading').show(); - var data = { MacSshUsername: $DOM.val() }; - $.ajax({ - url: '"); +WriteLiteral(">\r\n $(function () {\r\n document." + +"DiscoFunctions.PropertyChangeHelper(\r\n $(\'#MacSsh" + +"Username\'),\r\n \'Username\',\r\n " + +" \'"); - #line 119 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" - Write(Url.Action(MVC.API.Bootstrapper.MacSshUsername())); + #line 70 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + Write(Url.Action(MVC.API.Enrolment.MacSshUsername())); #line default #line hidden -WriteLiteral(@"', - dataType: 'json', - data: data, - success: function (d) { - if (d == 'OK') { - $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow'); - } else { - $ajaxLoading.hide(); - alert('Unable to update Username: ' + d); - } - }, - error: function (jqXHR, textStatus, errorThrown) { - alert('Unable to update Username: ' + textStatus); - $ajaxLoading.hide(); - } - }); - }); - }); - -"); +WriteLiteral("\',\r\n \'MacSshUsername\'\r\n " + +" );\r\n });\r\n \r\n"); - #line 138 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 75 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" } else { @@ -365,7 +299,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>\r\n"); - #line 144 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 81 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" } else { @@ -374,14 +308,14 @@ WriteLiteral("><None Specified>\r\n"); #line default #line hidden - #line 147 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 84 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(Model.MacSshUsername); #line default #line hidden - #line 147 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 84 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" } } @@ -389,17 +323,20 @@ WriteLiteral("><None Specified>\r\n"); #line default #line hidden -WriteLiteral(" \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n Password:\r\n \r\n \r\n \r\n (Model.ScheduleEnabled ? null : "hidden" +, Tuple.Create(Tuple.Create("", 1297), Tuple.Create(Model.ScheduleEnabled ? null : "hidden" #line default #line hidden -, 1314), false) +, 1297), false) ); WriteLiteral(">\r\n \r\n " + @@ -245,14 +245,14 @@ WriteLiteral(" Saturday\r\n
  • \r\n \r\n \r\n " + " \r\n (Model.ScheduleEnabled ? null : "hidden" +, Tuple.Create(Tuple.Create("", 2249), Tuple.Create(Model.ScheduleEnabled ? null : "hidden" #line default #line hidden -, 2266), false) +, 2249), false) ); WriteLiteral(">\r\n \r\n" + @@ -300,14 +300,14 @@ WriteLiteral(">12:00 AM\r\n"); #line hidden WriteLiteral(" (i +, Tuple.Create(Tuple.Create("", 2731), Tuple.Create(i #line default #line hidden -, 2748), false) +, 2731), false) ); WriteLiteral(" "); @@ -362,14 +362,14 @@ WriteLiteral(">12:00 PM\r\n"); #line hidden WriteLiteral(" (i +, Tuple.Create(Tuple.Create("", 3093), Tuple.Create(i #line default #line hidden -, 3110), false) +, 3093), false) ); WriteLiteral(" "); @@ -418,14 +418,14 @@ WriteLiteral(@"> By default, Disco ICT shuts down at 1:30am and does not res (Model.ScheduleEnabled ? null : "hidden" +, Tuple.Create(Tuple.Create("", 3728), Tuple.Create(Model.ScheduleEnabled ? null : "hidden" #line default #line hidden -, 3745), false) +, 3728), false) ); WriteLiteral(">\r\n \r\n " + " (Model.ScheduleEnabled ? null : "hidden" +, Tuple.Create(Tuple.Create("", 4806), Tuple.Create(Model.ScheduleEnabled ? null : "hidden" #line default #line hidden -, 4823), false) +, 4806), false) ); WriteLiteral(">\r\n \r\n \r\n WriteLiteral(" type=\"text\""); -WriteAttribute("value", Tuple.Create(" value=\"", 8472), Tuple.Create("\"", 8485) +WriteAttribute("value", Tuple.Create(" value=\"", 8455), Tuple.Create("\"", 8468) #line 171 "..\..\Areas\Config\Views\Export\_Edit.cshtml" -, Tuple.Create(Tuple.Create("", 8480), Tuple.Create(link +, Tuple.Create(Tuple.Create("", 8463), Tuple.Create(link #line default #line hidden -, 8480), false) +, 8463), false) ); WriteLiteral(" style=\"width: 90%;\""); @@ -928,14 +928,14 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" (Url.Action(MVC.Config.Export.RunScheduled(Model.Id)) +, Tuple.Create(Tuple.Create("", 8766), Tuple.Create(Url.Action(MVC.Config.Export.RunScheduled(Model.Id)) #line default #line hidden -, 8783), false) +, 8766), false) ); WriteLiteral(" class=\"button\""); @@ -952,14 +952,14 @@ WriteLiteral(">Schedule Now\r\n"); #line hidden WriteLiteral(" (Url.Action(MVC.Config.Export.Run(Model.Id)) +, Tuple.Create(Tuple.Create("", 8892), Tuple.Create(Url.Action(MVC.Config.Export.Run(Model.Id)) #line default #line hidden -, 8909), false) +, 8892), false) ); WriteLiteral(" class=\"button\""); @@ -1017,24 +1017,24 @@ WriteLiteral(" (Model.ExportTypeName +, Tuple.Create(Tuple.Create(" ", 9259), Tuple.Create(Model.ExportTypeName #line default #line hidden -, 9277), false) -, Tuple.Create(Tuple.Create("", 9298), Tuple.Create(":", 9298), true) +, 9260), false) +, Tuple.Create(Tuple.Create("", 9281), Tuple.Create(":", 9281), true) #line 196 "..\..\Areas\Config\Views\Export\_Edit.cshtml" - , Tuple.Create(Tuple.Create(" ", 9299), Tuple.Create(Model.Name + , Tuple.Create(Tuple.Create(" ", 9282), Tuple.Create(Model.Name #line default #line hidden -, 9300), false) +, 9283), false) ); WriteLiteral(" class=\"dialog\""); @@ -1079,7 +1079,7 @@ WriteLiteral("?\r\n

    \r\n \r\n"); #line hidden #line 202 "..\..\Areas\Config\Views\Export\_Edit.cshtml" - using (Html.BeginForm(MVC.API.Export.Delete(), FormMethod.Post)) + using (Html.BeginForm(MVC.API.Export.Delete())) { @@ -1105,14 +1105,14 @@ WriteLiteral(" type=\"hidden\""); WriteLiteral(" name=\"id\""); -WriteAttribute("value", Tuple.Create(" value=\"", 9729), Tuple.Create("\"", 9746) +WriteAttribute("value", Tuple.Create(" value=\"", 9695), Tuple.Create("\"", 9712) #line 205 "..\..\Areas\Config\Views\Export\_Edit.cshtml" -, Tuple.Create(Tuple.Create("", 9737), Tuple.Create(Model.Id +, Tuple.Create(Tuple.Create("", 9703), Tuple.Create(Model.Id #line default #line hidden -, 9737), false) +, 9703), false) ); WriteLiteral(" />\r\n"); diff --git a/Disco.Web/Areas/Config/Views/JobPreferences/Parts/Locations.cshtml b/Disco.Web/Areas/Config/Views/JobPreferences/Parts/Locations.cshtml index 3eefcd10..d8e92ed6 100644 --- a/Disco.Web/Areas/Config/Views/JobPreferences/Parts/Locations.cshtml +++ b/Disco.Web/Areas/Config/Views/JobPreferences/Parts/Locations.cshtml @@ -8,68 +8,75 @@

    Job Locations

    \r\n " + -" Password:\r\n \r\n"); +WriteLiteral("
    \r\n"); - #line 158 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 95 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" #line default #line hidden - #line 158 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 95 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" if (canConfig) { @@ -415,34 +352,34 @@ WriteLiteral(" type=\"password\""); WriteLiteral(" />\r\n"); - #line 161 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 98 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" #line default #line hidden - #line 161 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 98 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 161 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 98 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" #line default #line hidden - #line 162 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 99 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 162 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 99 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" @@ -452,58 +389,23 @@ WriteLiteral(" - $(function () { - var $DOM = $('#MacSshPassword'); - var $DOMAjaxSave = $DOM.next('.ajaxSave'); - $DOM - .watermark('Password') - .focus(function () { $DOM.select() }) - .keydown(function (e) { - $DOMAjaxSave.show(); - if (e.which == 13) { - $(this).blur(); - } - }).blur(function () { - $DOMAjaxSave.hide(); - }) - .change(function () { - $DOMAjaxSave.hide(); - var $ajaxLoading = $DOMAjaxSave.next('.ajaxLoading').show(); - var data = { MacSshPassword: $DOM.val() }; - $.ajax({ - url: '"); +WriteLiteral(">\r\n $(function () {\r\n document." + +"DiscoFunctions.PropertyChangeHelper(\r\n $(\'#MacSsh" + +"Password\'),\r\n \'Password\',\r\n " + +" \'"); - #line 183 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" - Write(Url.Action(MVC.API.Bootstrapper.MacSshPassword())); + #line 105 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + Write(Url.Action(MVC.API.Enrolment.MacSshPassword())); #line default #line hidden -WriteLiteral(@"', - dataType: 'json', - data: data, - success: function (d) { - if (d == 'OK') { - $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow'); - } else { - $ajaxLoading.hide(); - alert('Unable to update Password: ' + d); - } - }, - error: function (jqXHR, textStatus, errorThrown) { - alert('Unable to update Password: ' + textStatus); - $ajaxLoading.hide(); - } - }); - }); - }); - -"); +WriteLiteral("\',\r\n \'MacSshPassword\'\r\n " + +" );\r\n });\r\n \r\n"); - #line 202 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 110 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" } else { @@ -518,7 +420,7 @@ WriteLiteral("********"); WriteLiteral("\r\n"); - #line 206 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 114 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" } @@ -587,7 +489,7 @@ WriteLiteral("><script>\r\n tag embedded on the "\r\n\r\n"); - #line 228 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 136 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" if (canShowStatus && Authorization.Has(Claims.Config.Logging.Show)) { @@ -597,13 +499,13 @@ WriteLiteral("><script>\r\n tag embedded on the WriteLiteral("

    Live Enrolment Logging

    \r\n"); - #line 231 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 139 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" #line default #line hidden - #line 231 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 139 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LogEvents, new Disco.Web.Areas.Config.Models.Shared.LogEventsModel() { IsLive = true, @@ -617,7 +519,7 @@ Write(Html.Partial(MVC.Config.Shared.Views.LogEvents, new Disco.Web.Areas.Config #line default #line hidden - #line 238 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 146 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" } @@ -631,13 +533,13 @@ WriteLiteral(" class=\"actionBar\""); WriteLiteral(">\r\n"); - #line 241 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 149 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" #line default #line hidden - #line 241 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 149 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" if (Authorization.Has(Claims.Config.Enrolment.DownloadBootstrapper)) { @@ -645,14 +547,14 @@ WriteLiteral(">\r\n"); #line default #line hidden - #line 243 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 151 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(Html.ActionLinkButton("Download Bootstrapper", MVC.Services.Client.Bootstrapper())); #line default #line hidden - #line 243 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 151 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" } @@ -662,7 +564,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 245 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 153 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" if (canShowStatus) { @@ -670,14 +572,14 @@ WriteLiteral(" "); #line default #line hidden - #line 247 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 155 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" Write(Html.ActionLinkButton("Enrolment Status", MVC.Config.Enrolment.Status())); #line default #line hidden - #line 247 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" + #line 155 "..\..\Areas\Config\Views\Enrolment\Index.cshtml" } diff --git a/Disco.Web/Areas/Config/Views/Enrolment/Status.cshtml b/Disco.Web/Areas/Config/Views/Enrolment/Status.cshtml index d0bc9014..0d6b976b 100644 --- a/Disco.Web/Areas/Config/Views/Enrolment/Status.cshtml +++ b/Disco.Web/Areas/Config/Views/Enrolment/Status.cshtml @@ -8,7 +8,6 @@ Html.BundleDeferred("~/ClientScripts/Modules/jQuery-Isotope"); }
    - @Html.AntiForgeryToken()

    No enrolment sessions today

    @@ -31,7 +30,7 @@

    - @using (Html.BeginForm(MVC.API.Enrolment.ResolveSessionPending(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.Enrolment.ResolveSessionPending())) { @Html.AntiForgeryToken(); @@ -352,6 +351,9 @@ url: '@(Url.Action(MVC.API.DeviceModel.Index()))', dataType: 'json', type: 'POST', + data: { + '__RequestVerificationToken': document.body.dataset.antiforgery + }, success: init_loadedDeviceModels, error: function (jqXHR, textStatus, errorThrown) { alert('Unable to retrieve device models: ' + errorThrown); @@ -373,7 +375,7 @@ End: null, ModuleId: 50, Take: 2000, - '__RequestVerificationToken': host.find('input[name="__RequestVerificationToken"]').val() + '__RequestVerificationToken': document.body.dataset.antiforgery }; $.ajax({ url: '@(Url.Action(MVC.API.Logging.RetrieveEvents()))', diff --git a/Disco.Web/Areas/Config/Views/Enrolment/Status.generated.cs b/Disco.Web/Areas/Config/Views/Enrolment/Status.generated.cs index 02dbdbfa..73b1b653 100644 --- a/Disco.Web/Areas/Config/Views/Enrolment/Status.generated.cs +++ b/Disco.Web/Areas/Config/Views/Enrolment/Status.generated.cs @@ -71,18 +71,7 @@ WriteLiteral(" data-defaultdeviceprofileid=\""); #line hidden WriteLiteral("\""); -WriteLiteral(">\r\n"); - -WriteLiteral(" "); - - - #line 11 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" -Write(Html.AntiForgeryToken()); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n \r\n"); - #line 34 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 33 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" #line default #line hidden - #line 34 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" - using (Html.BeginForm(MVC.API.Enrolment.ResolveSessionPending(), FormMethod.Post)) + #line 33 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + using (Html.BeginForm(MVC.API.Enrolment.ResolveSessionPending())) { @@ -202,20 +191,20 @@ WriteLiteral(" data-bind=\"text: pendingIdentifier\""); WriteLiteral(">\r\n"); - #line 37 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 36 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" #line default #line hidden - #line 37 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 36 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" Write(Html.AntiForgeryToken()); #line default #line hidden - #line 37 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 36 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" ; @@ -245,13 +234,13 @@ WriteLiteral(" data-bind=\"value: deviceProfileId\""); WriteLiteral(">\r\n"); - #line 43 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 42 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" #line default #line hidden - #line 43 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 42 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" foreach (var deviceProfile in Model.DeviceProfiles) { @@ -260,20 +249,20 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" (deviceProfile.Id + #line 44 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" +, Tuple.Create(Tuple.Create("", 2775), Tuple.Create(deviceProfile.Id #line default #line hidden -, 2822), false) +, 2775), false) ); WriteLiteral(">"); - #line 45 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 44 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" Write(deviceProfile.Name); @@ -282,7 +271,7 @@ WriteLiteral(">"); WriteLiteral(" ("); - #line 45 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 44 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" Write(deviceProfile.Id); @@ -291,7 +280,7 @@ WriteLiteral(" ("); WriteLiteral(")\r\n"); - #line 46 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 45 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" } @@ -301,7 +290,7 @@ WriteLiteral(" \r\n < "
    \r\n"); - #line 50 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 49 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" if (Model.DeviceBatches.Count != 0) { @@ -326,13 +315,13 @@ WriteLiteral(" value=\"\""); WriteLiteral(" selected><None>\r\n"); - #line 57 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 56 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" #line default #line hidden - #line 57 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 56 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" foreach (var deviceBatch in Model.DeviceBatches) { @@ -341,20 +330,20 @@ WriteLiteral(" selected><None>\r\n"); #line hidden WriteLiteral(" (deviceBatch.Id + #line 58 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" +, Tuple.Create(Tuple.Create("", 3557), Tuple.Create(deviceBatch.Id #line default #line hidden -, 3604), false) +, 3557), false) ); WriteLiteral(">"); - #line 59 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 58 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" Write(deviceBatch.Name); @@ -363,7 +352,7 @@ WriteLiteral(">"); WriteLiteral(" ("); - #line 59 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 58 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" Write(deviceBatch.Id); @@ -372,7 +361,7 @@ WriteLiteral(" ("); WriteLiteral(")\r\n"); - #line 60 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 59 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" } @@ -382,7 +371,7 @@ WriteLiteral(" \r\n "
    \r\n"); - #line 64 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 63 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" } @@ -417,7 +406,7 @@ WriteLiteral(" class=\"button\""); WriteLiteral(">Reject\r\n \r\n"); - #line 70 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 69 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" } @@ -596,7 +585,7 @@ WriteLiteral(@"> var deviceBaseUrl = '"); - #line 149 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 148 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" Write(Url.Action(MVC.Device.Show())); @@ -605,7 +594,7 @@ WriteLiteral(@"> WriteLiteral("/\'\r\n var deviceModelImageUrl = \'"); - #line 150 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 149 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" Write(Url.Action(MVC.API.DeviceModel.Image())); @@ -614,7 +603,7 @@ WriteLiteral("/\'\r\n var deviceModelImageUrl = \'"); WriteLiteral("/\'\r\n var iconWarningUrl = \'url("); - #line 151 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 150 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" Write(Links.ClientSource.Style.Images.Status.warning32_png); @@ -623,7 +612,7 @@ WriteLiteral("/\'\r\n var iconWarningUrl = \'url("); WriteLiteral(")\';\r\n var iconErrorUrl = \'url("); - #line 152 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 151 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" Write(Links.ClientSource.Style.Images.Status.fail32_png); @@ -750,7 +739,7 @@ WriteLiteral(")\';\r\n\r\n function pageViewModel() {\r\n var "= new pageViewModel();\r\n $.ajax({\r\n url: \'"); - #line 352 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 351 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" Write(Url.Action(MVC.API.DeviceModel.Index())); @@ -759,6 +748,9 @@ WriteLiteral(")\';\r\n\r\n function pageViewModel() {\r\n var WriteLiteral(@"', dataType: 'json', type: 'POST', + data: { + '__RequestVerificationToken': document.body.dataset.antiforgery + }, success: init_loadedDeviceModels, error: function (jqXHR, textStatus, errorThrown) { alert('Unable to retrieve device models: ' + errorThrown); @@ -780,13 +772,13 @@ WriteLiteral(@"', End: null, ModuleId: 50, Take: 2000, - '__RequestVerificationToken': host.find('input[name=""__RequestVerificationToken""]').val() + '__RequestVerificationToken': document.body.dataset.antiforgery }; $.ajax({ url: '"); - #line 379 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 381 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" Write(Url.Action(MVC.API.Logging.RetrieveEvents())); @@ -825,7 +817,7 @@ WriteLiteral(@"', $.connection.hub.qs = { LogModules: '"); - #line 409 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" + #line 411 "..\..\Areas\Config\Views\Enrolment\Status.cshtml" Write(Disco.Services.Devices.Enrolment.EnrolmentLog.Current.LiveLogGroupName); diff --git a/Disco.Web/Areas/Config/Views/Export/_Edit.cshtml b/Disco.Web/Areas/Config/Views/Export/_Edit.cshtml index 99d6d4e6..0533e122 100644 --- a/Disco.Web/Areas/Config/Views/Export/_Edit.cshtml +++ b/Disco.Web/Areas/Config/Views/Export/_Edit.cshtml @@ -1,5 +1,5 @@ @model Disco.Web.Areas.Config.Models.Export.EditModel -@using (Html.BeginForm(MVC.API.Export.Update(), FormMethod.Post)) +@using (Html.BeginForm(MVC.API.Export.Update())) { @Html.AntiForgeryToken(); @Html.HiddenFor(m => m.Id) @@ -199,7 +199,7 @@ Are you sure you want to delete the Saved @Model.ExportTypeName: @Model.Name?

    - @using (Html.BeginForm(MVC.API.Export.Delete(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.Export.Delete())) { @Html.AntiForgeryToken() diff --git a/Disco.Web/Areas/Config/Views/Export/_Edit.generated.cs b/Disco.Web/Areas/Config/Views/Export/_Edit.generated.cs index bbdca761..476f0cd2 100644 --- a/Disco.Web/Areas/Config/Views/Export/_Edit.generated.cs +++ b/Disco.Web/Areas/Config/Views/Export/_Edit.generated.cs @@ -45,7 +45,7 @@ namespace Disco.Web.Areas.Config.Views.Export { #line 2 "..\..\Areas\Config\Views\Export\_Edit.cshtml" - using (Html.BeginForm(MVC.API.Export.Update(), FormMethod.Post)) + using (Html.BeginForm(MVC.API.Export.Update())) { @@ -164,14 +164,14 @@ WriteLiteral(" "); WriteLiteral("\r\n Enable Scheduled Export\r\n \r\n" + "
    \r\n Days:\r\n
    \r\n Start Time:\r\n
    \r\n Repeat Hourly Until:\r\n " + @@ -465,14 +465,14 @@ WriteLiteral(">Run once\r\n"); #line hidden WriteLiteral(" (i +, Tuple.Create(Tuple.Create("", 4214), Tuple.Create(i #line default #line hidden -, 4231), false) +, 4214), false) ); WriteLiteral(" "); @@ -527,14 +527,14 @@ WriteLiteral(">12:00 PM\r\n"); #line hidden WriteLiteral(" (i +, Tuple.Create(Tuple.Create("", 4572), Tuple.Create(i #line default #line hidden -, 4589), false) +, 4572), false) ); WriteLiteral(" "); @@ -567,14 +567,14 @@ WriteLiteral(":00 PM\r\n"); WriteLiteral("\r\n \r\n \r\n
    \r\n File System Location:\r\n " + @@ -709,29 +709,29 @@ WriteLiteral(" type=\"hidden\""); WriteLiteral(" name=\"OnDemandPrincipals\""); -WriteAttribute("value", Tuple.Create(" value=\"", 6700), Tuple.Create("\"", 6714) +WriteAttribute("value", Tuple.Create(" value=\"", 6683), Tuple.Create("\"", 6697) #line 141 "..\..\Areas\Config\Views\Export\_Edit.cshtml" - , Tuple.Create(Tuple.Create("", 6708), Tuple.Create(sg.Id + , Tuple.Create(Tuple.Create("", 6691), Tuple.Create(sg.Id #line default #line hidden -, 6708), false) +, 6691), false) ); WriteLiteral(" />\r\n (sg.IsGroup ? "s" : null +, Tuple.Create(Tuple.Create("", 6759), Tuple.Create(sg.IsGroup ? "s" : null #line default #line hidden -, 6776), false) -, Tuple.Create(Tuple.Create(" ", 6802), Tuple.Create("fa-lg", 6803), true) +, 6759), false) +, Tuple.Create(Tuple.Create(" ", 6785), Tuple.Create("fa-lg", 6786), true) ); WriteLiteral(">\r\n"); @@ -874,14 +874,14 @@ WriteLiteral("
    Link
    - - diff --git a/Disco.Web/Areas/Config/Views/JobPreferences/Parts/Locations.generated.cs b/Disco.Web/Areas/Config/Views/JobPreferences/Parts/Locations.generated.cs index 2d78ae41..3ef4bd44 100644 --- a/Disco.Web/Areas/Config/Views/JobPreferences/Parts/Locations.generated.cs +++ b/Disco.Web/Areas/Config/Views/JobPreferences/Parts/Locations.generated.cs @@ -65,83 +65,90 @@ WriteLiteral(">\r\n

    Job Locations

    \r\n
    Mode: + + Mode: @if (canConfig) + + @if (canConfig) { - @Html.DropDownListFor(model => model.LocationMode, Model.LocationModeOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value })) - @AjaxHelpers.AjaxSave() - @AjaxHelpers.AjaxLoader() -
    -
    -

    - Technicians will be able to specify any value when entering a location. A selection of locations used historically will be offered. -

    -
    -
    -
    - Update List Import List -
    -
    - The List is Empty -
      - @foreach (var loc in Model.LocationList) - { -
    • @loc
    • - } -
    + @Html.DropDownListFor(model => model.LocationMode, Model.LocationModeOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value })) + @AjaxHelpers.AjaxSave() + @AjaxHelpers.AjaxLoader() +
    +
    +

    + Technicians will be able to specify any value when entering a location. A selection of locations used historically will be offered. +

    -
    - - Add +
    +
    + Update List Import List +
    + @using (Html.BeginForm(MVC.API.JobPreferences.UpdateLocationList(null, redirect: true))) + { + @Html.AntiForgeryToken() +
    + The List is Empty +
      + @foreach (var loc in Model.LocationList) + { +
    • @loc
    • + } +
    +
    + } +
    + + +
    +
    +
    + @using (Html.BeginForm(MVC.API.JobPreferences.ImportLocationList(null, redirect: true))) + { + @Html.AntiForgeryToken() + +
    + +
    + +
    +

    + Enter multiple locations separated by <new line>, commas (,) or semicolons (;). +

    +
    + }
    -
    -
    -
    - -
    - -
    - -
    -

    - Enter multiple locations separated by <new line>, commas (,) or semicolons (;). -

    -
    -
    +
    +
    +

    + Technicians will be able to specify any value when entering a location. A defined list of location options is suggested. +

    +
    -
    -
    -
    -

    - Technicians will be able to specify any value when entering a location. A defined list of location options is suggested. -

    +
    +
    +

    + Technicians are restricted to select a location from the defined list. +

    +
    -
    -
    -
    -

    - Technicians are restricted to select a location from the defined list. -

    -
    -
    - + } else { - @Model.LocationModeOptions().First(o => o.Key == Model.LocationMode.ToString()).Value + @Model.LocationModeOptions().First(o => o.Key == Model.LocationMode.ToString()).Value }
    \r\n \r\n WriteLiteral(" style=\"width: 140px\""); -WriteLiteral(">Mode:\r\n \r\n + +
    "); +WriteLiteral(">\r\n Mode:\r\n \r\n \r\n"); - #line 13 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml" + #line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml" + + + #line default + #line hidden + + #line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml" if (canConfig) { - - - #line default - #line hidden - - #line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml" - Write(Html.DropDownListFor(model => model.LocationMode, Model.LocationModeOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value }))); - - - #line default - #line hidden - - #line 15 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml" - - - - #line default - #line hidden - - #line 16 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml" - Write(AjaxHelpers.AjaxSave()); - - - #line default - #line hidden - - #line 16 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml" - - + #line default #line hidden #line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml" - Write(AjaxHelpers.AjaxLoader()); + Write(Html.DropDownListFor(model => model.LocationMode, Model.LocationModeOptions().Select(o => new SelectListItem() { Value = o.Key.ToString(), Text = o.Value }))); #line default #line hidden #line 17 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml" - + + + + #line default + #line hidden + + #line 18 "..\..\Areas\Config\Views\JobPreferences\Parts\Locations.cshtml" + Write(AjaxHelpers.AjaxSave()); #line default #line hidden -WriteLiteral("
    @if (canDelete || canShowJobs) {
    @if (canDelete) { - @Html.ActionLinkButton("Delete", MVC.API.JobQueue.Delete(Model.Token.JobQueue.Id, true), "Config_JobQueues_Actions_Delete_Button") -
    + +
    + @using (Html.BeginForm(MVC.API.JobQueue.Delete(Model.Token.JobQueue.Id, true))) + { + @Html.AntiForgeryToken() + }

    This item will be permanently deleted and cannot be recovered.
    @@ -663,29 +644,29 @@

    diff --git a/Disco.Web/Areas/Config/Views/JobQueue/Show.generated.cs b/Disco.Web/Areas/Config/Views/JobQueue/Show.generated.cs index 3964d47e..96ac64dc 100644 --- a/Disco.Web/Areas/Config/Views/JobQueue/Show.generated.cs +++ b/Disco.Web/Areas/Config/Views/JobQueue/Show.generated.cs @@ -100,20 +100,20 @@ WriteLiteral("\r\n
    \r\n Description:\r\n " + -" \r\n"); +WriteLiteral("
    \r\n " + +" Description:\r\n \r\n"); #line 55 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - + #line default #line hidden #line 55 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - if (canConfig) - { + if (canConfig) + { #line default #line hidden #line 56 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(Html.EditorFor(model => model.Token.JobQueue.Description)); + Write(Html.EditorFor(model => model.Token.JobQueue.Description)); #line default #line hidden #line 56 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - + + #line default #line hidden #line 57 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(AjaxHelpers.AjaxSave()); + Write(AjaxHelpers.AjaxSave()); #line default #line hidden #line 57 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - + + #line default #line hidden #line 58 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(AjaxHelpers.AjaxLoader()); + Write(AjaxHelpers.AjaxLoader()); #line default #line hidden #line 58 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - + #line default #line hidden -WriteLiteral(" \r\n $(function () {\r\n docume #line default #line hidden WriteLiteral("\',\r\n \'Description\'\r\n );\r\n " + -" });\r\n \r\n"); +" });\r\n \r\n"); #line 69 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } - else - { + } + else + { #line default #line hidden -WriteLiteral("
    ");
    +WriteLiteral("                
    ");
     
                 
                 #line 72 "..\..\Areas\Config\Views\JobQueue\Show.cshtml"
    -                  if (string.IsNullOrEmpty(Model.Token.JobQueue.Description))
    +                      if (string.IsNullOrEmpty(Model.Token.JobQueue.Description))
                          {
     
                 
    @@ -318,17 +318,18 @@ WriteLiteral("                    
    \r\n"); #line 81 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } + } #line default #line hidden -WriteLiteral("
    \r\n Statistics:\r\n \r\n " + -"
    "); +WriteLiteral("
    \r\n " + +" Statistics:\r\n \r\n
    " + +""); #line 89 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(Model.OpenJobCount); + Write(Model.OpenJobCount); #line default @@ -337,16 +338,16 @@ WriteLiteral(" job"); #line 89 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(Model.OpenJobCount != 1 ? "s" : null); + Write(Model.OpenJobCount != 1 ? "s" : null); #line default #line hidden -WriteLiteral(" open
    \r\n
    "); +WriteLiteral(" open
    \r\n
    "); #line 90 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(Model.TotalJobCount); + Write(Model.TotalJobCount); #line default @@ -355,13 +356,13 @@ WriteLiteral(" total job"); #line 90 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(Model.TotalJobCount != 1 ? "s" : null); + Write(Model.TotalJobCount != 1 ? "s" : null); #line default #line hidden -WriteLiteral("
    \r\n
    \r\n Icon:\r\n \r\n " + -" \r\n
    \r\n " + +" Icon:\r\n \r\n
    \r\n Priority:\r\n \r\n"); - - - #line 205 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - + #line 118 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line default #line hidden - #line 205 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - if (canConfig) - { - var priorityValue = Model.Token.JobQueue.Priority.ToString(); - var priorityItems = Enum.GetNames(typeof(JobQueuePriority)).Select(i => new SelectListItem() { Text = i, Value = i, Selected = (i == priorityValue) }).ToList(); + #line 118 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + foreach (var icon in Model.Icons) + { #line default #line hidden -WriteLiteral(" (priorityValue.ToLower() + #line 120 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(icon.Key); + #line default #line hidden -, 8558), false) +WriteLiteral("\""); + +WriteAttribute("class", Tuple.Create(" class=\"", 5097), Tuple.Create("\"", 5122) +, Tuple.Create(Tuple.Create("", 5105), Tuple.Create("fa", 5105), true) +, Tuple.Create(Tuple.Create(" ", 5107), Tuple.Create("fa-", 5108), true) + + #line 120 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + , Tuple.Create(Tuple.Create("", 5111), Tuple.Create(icon.Key + + #line default + #line hidden +, 5111), false) ); -WriteAttribute("title", Tuple.Create(" title=\"", 8585), Tuple.Create("\"", 8618) +WriteAttribute("title", Tuple.Create(" title=\"", 5123), Tuple.Create("\"", 5142) - #line 209 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" -, Tuple.Create(Tuple.Create("", 8593), Tuple.Create(priorityValue + #line 120 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + , Tuple.Create(Tuple.Create("", 5131), Tuple.Create(icon.Value #line default #line hidden -, 8593), false) -, Tuple.Create(Tuple.Create(" ", 8609), Tuple.Create("Priority", 8610), true) +, 5131), false) ); WriteLiteral(">\r\n"); - #line 210 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - - #line default - #line hidden - - #line 210 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(Html.DropDownListFor(m => m.Token.JobQueue.Priority, priorityItems)); + #line 121 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + } #line default #line hidden +WriteLiteral(" \r\n \r\n " + +" \r\n \r\n \r\n"); + + + #line 198 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + } + + + #line default + #line hidden +WriteLiteral("
    \r\n " + +" Priority:\r\n \r\n"); + + + #line 206 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + + + #line default + #line hidden + + #line 206 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + if (canConfig) + { + var priorityValue = Model.Token.JobQueue.Priority.ToString(); + var priorityItems = Enum.GetNames(typeof(JobQueuePriority)).Select(i => new SelectListItem() { Text = i, Value = i, Selected = (i == priorityValue) }).ToList(); + + + #line default + #line hidden +WriteLiteral(" (priorityValue.ToLower() + + #line default + #line hidden +, 9691), false) +); + +WriteAttribute("title", Tuple.Create(" title=\"", 9718), Tuple.Create("\"", 9751) + + #line 210 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" +, Tuple.Create(Tuple.Create("", 9726), Tuple.Create(priorityValue + + #line default + #line hidden +, 9726), false) +, Tuple.Create(Tuple.Create(" ", 9742), Tuple.Create("Priority", 9743), true) +); + +WriteLiteral(">\r\n"); + + + #line 211 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line default #line hidden #line 211 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(AjaxHelpers.AjaxSave()); + Write(Html.DropDownListFor(m => m.Token.JobQueue.Priority, priorityItems)); #line default #line hidden #line 211 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - + + #line default #line hidden #line 212 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(AjaxHelpers.AjaxLoader()); + Write(AjaxHelpers.AjaxSave()); #line default #line hidden #line 212 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - + + + + #line default + #line hidden + + #line 213 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(AjaxHelpers.AjaxLoader()); #line default #line hidden -WriteLiteral("
    \r\n Default SLA:\r\n \r\n"); - - - #line 243 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - - #line default - #line hidden - - #line 243 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - if (canConfig) - { - var slaOptions = JobQueueService.SlaOptions.Select(o => new SelectListItem() { Text = o.Value, Value = o.Key.ToString() }).ToList(); - - if (this.Model.Token.JobQueue.DefaultSLAExpiry.HasValue) - { - var slaValue = this.Model.Token.JobQueue.DefaultSLAExpiry.Value; - if (JobQueueService.SlaOptions.Where(o => o.Key == slaValue).Count() == 0) - { - string slaValueText; - if (slaValue % (60 * 24 * 7 * 4) == 0) - { slaValueText = string.Format("{0} months", slaValue / (60 * 24 * 7 * 4)); } - else if (slaValue % (60 * 24 * 7) == 0) - { slaValueText = string.Format("{0} weeks", slaValue / (60 * 24 * 7)); } - else if (slaValue % (60 * 24) == 0) - { slaValueText = string.Format("{0} days", slaValue / (60 * 24)); } - else if (slaValue % (60) == 0) - { slaValueText = string.Format("{0} hours", slaValue / 60); } + #line 232 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + } else - { slaValueText = string.Format("{0} minutes", slaValue); } - - slaOptions.Insert(0, new SelectListItem() { Text = string.Format("{0} ", slaValueText), Value = slaValue.ToString() }); - } - } - + { + #line default #line hidden - #line 267 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(Html.DropDownListFor(m => m.Token.JobQueue.DefaultSLAExpiry, slaOptions)); + #line 235 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(Model.Token.JobQueue.Priority.ToString()); #line default #line hidden - #line 267 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - + #line 235 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + + } + + + #line default + #line hidden +WriteLiteral("
    \r\n " + +" Default SLA:\r\n \r\n"); + + + #line 244 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + + + #line default + #line hidden + + #line 244 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + if (canConfig) + { + var slaOptions = JobQueueService.SlaOptions.Select(o => new SelectListItem() { Text = o.Value, Value = o.Key.ToString() }).ToList(); + + if (this.Model.Token.JobQueue.DefaultSLAExpiry.HasValue) + { + var slaValue = this.Model.Token.JobQueue.DefaultSLAExpiry.Value; + if (JobQueueService.SlaOptions.Where(o => o.Key == slaValue).Count() == 0) + { + string slaValueText; + if (slaValue % (60 * 24 * 7 * 4) == 0) + { slaValueText = string.Format("{0} months", slaValue / (60 * 24 * 7 * 4)); } + else if (slaValue % (60 * 24 * 7) == 0) + { slaValueText = string.Format("{0} weeks", slaValue / (60 * 24 * 7)); } + else if (slaValue % (60 * 24) == 0) + { slaValueText = string.Format("{0} days", slaValue / (60 * 24)); } + else if (slaValue % (60) == 0) + { slaValueText = string.Format("{0} hours", slaValue / 60); } + else + { slaValueText = string.Format("{0} minutes", slaValue); } + + slaOptions.Insert(0, new SelectListItem() { Text = string.Format("{0} ", slaValueText), Value = slaValue.ToString() }); + } + } + #line default #line hidden #line 268 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(AjaxHelpers.AjaxSave()); + Write(Html.DropDownListFor(m => m.Token.JobQueue.DefaultSLAExpiry, slaOptions)); #line default #line hidden #line 268 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - + + #line default #line hidden #line 269 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(AjaxHelpers.AjaxLoader()); + Write(AjaxHelpers.AjaxSave()); #line default #line hidden #line 269 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - + + + + #line default + #line hidden + + #line 270 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(AjaxHelpers.AjaxLoader()); #line default #line hidden -WriteLiteral("
    Member Groups/Use" + +"rs:\r\n"); + + + #line 307 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" #line default #line hidden - #line 289 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(slaOption[0].Value); + #line 307 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + if (Model.Token.SubjectIds.Count == 0) + { #line default #line hidden - - #line 289 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - } - else - { - - - #line default - #line hidden -WriteLiteral(" "); - -WriteLiteral("<None>"); - -WriteLiteral("\r\n"); - - - #line 294 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } - } - else - { - - - #line default - #line hidden -WriteLiteral(" "); - -WriteLiteral("<None>"); - -WriteLiteral("\r\n"); - - - #line 299 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } - } - - - #line default - #line hidden -WriteLiteral("
    Member Groups/Users:\r\n"); - - - #line 306 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - - #line default - #line hidden - - #line 306 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - if (Model.Token.SubjectIds.Count == 0) - { - - - #line default - #line hidden -WriteLiteral(" None Associated\r\n"); - #line 309 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } - else - { + #line 310 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + } + else + { #line default #line hidden -WriteLiteral(" \r\n"); - #line 313 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - - #line default - #line hidden - - #line 313 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - foreach (var sg in Model.Subjects) - { - var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id); - - - #line default - #line hidden -WriteLiteral(" (sg.IsGroup ? "group" : "user" - - #line default - #line hidden -, 12804), false) -); - -WriteLiteral(">\r\n"); - - - #line 317 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 314 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" #line default #line hidden - #line 317 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - if (sg.IsGroup) - { + #line 314 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + foreach (var sg in Model.Subjects) + { + var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id); #line default #line hidden -WriteLiteral(" (sg.IsGroup ? "group" : "user" + + #line default + #line hidden +, 14781), false) +); + +WriteLiteral(">\r\n"); + + + #line 318 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + + + #line default + #line hidden + + #line 318 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + if (sg.IsGroup) + { + + + #line default + #line hidden +WriteLiteral(" "); - #line 319 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - - #line default - #line hidden - - #line 319 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(displayName); - - - #line default - #line hidden - - #line 319 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 320 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } - else - { + + #line default + #line hidden + + #line 320 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(displayName); #line default #line hidden -WriteLiteral(" (Url.Action(MVC.User.Show(sg.Id)) + #line 320 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + + } + else + { + #line default #line hidden -, 13081), false) +WriteLiteral(" (Url.Action(MVC.User.Show(sg.Id)) + + #line default + #line hidden +, 15138), false) ); WriteLiteral(">"); - #line 323 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(displayName); + #line 324 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(displayName); #line default @@ -1091,41 +1133,41 @@ WriteLiteral(">"); WriteLiteral("\r\n"); - #line 324 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } + #line 325 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + } #line default #line hidden -WriteLiteral(" \r\n"); +WriteLiteral(" \r\n"); - #line 326 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 327 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + } + + + #line default + #line hidden +WriteLiteral(" \r\n"); + + + #line 329 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" } #line default #line hidden -WriteLiteral(" \r\n"); +WriteLiteral(" "); - #line 328 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } + #line 330 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + if (canConfig) + { #line default #line hidden -WriteLiteral(" "); - - - #line 329 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - if (canConfig) - { - - - #line default - #line hidden -WriteLiteral("
    \r\n \r\n Update\r\n Update\r\n \r\n \r\n"); + + + #line 335 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + + + #line default + #line hidden + + #line 335 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + using (Html.BeginForm(MVC.API.JobQueue.UpdateSubjects(Model.Token.JobQueue.Id, null, true))) + { + + + #line default + #line hidden + + #line 337 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 337 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + + + + #line default + #line hidden +WriteLiteral(" \r\n \r\n None Associated\r\n None Associated\r\n \r\n"); - #line 337 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - + #line 341 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line default #line hidden - #line 337 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - foreach (var sg in Model.Subjects) - { - var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id); + #line 341 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + foreach (var sg in Model.Subjects) + { + var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id); #line default #line hidden -WriteLiteral(" (sg.IsGroup ? "group" : "user" + #line 344 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" +, Tuple.Create(Tuple.Create("", 16544), Tuple.Create(sg.IsGroup ? "group" : "user" #line default #line hidden -, 14103), false) +, 16544), false) ); WriteLiteral(" data-subjectid=\""); - #line 340 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(sg.Id); + #line 344 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(sg.Id); #line default #line hidden WriteLiteral("\""); -WriteLiteral(">\r\n"); +WriteLiteral(">\r\n (sg.Id + + #line default + #line hidden +, 16696), false) +); + +WriteLiteral(" />\r\n"); - #line 341 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - + #line 346 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line default #line hidden - #line 341 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - if (sg.IsGroup) - { + #line 346 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + if (sg.IsGroup) + { #line default #line hidden -WriteLiteral(" "); - #line 343 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - + #line 348 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line default #line hidden - #line 343 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(displayName); + #line 348 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(displayName); #line default #line hidden - #line 343 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - } - else - { + #line 348 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + + } + else + { #line default #line hidden -WriteLiteral(" "); - #line 347 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - + #line 352 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line default #line hidden - #line 347 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(displayName); + #line 352 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(displayName); #line default #line hidden - #line 347 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - } + #line 352 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + + } #line default #line hidden @@ -1272,27 +1360,36 @@ WriteLiteral("\r\n \r\n"); +WriteLiteral(">\r\n \r\n"); - #line 350 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 355 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + } + + + #line default + #line hidden +WriteLiteral(" \r\n
    " + +"\r\n"); + + + #line 358 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" } #line default #line hidden -WriteLiteral(" \r\n \r\n \r\n \r\n \r\n \r\n Add\r\n \r\n (Url.Action(MVC.API.JobQueue.UpdateSubjects(Model.Token.JobQueue.Id, null, true)) - - #line default - #line hidden -, 15138), false) -); - -WriteLiteral(" method=\"post\""); - -WriteLiteral(@"> - - \r\n \r\n"); +" if (list.find(\'li[data-subjectid=\"\' + response.Id + \'\"]\').lengt" + +"h == 0) {\r\n\r\n var liIcon = $(\'\').a" + +"ddClass(\'fa fa-lg\');\r\n if (response.T" + +"ype === \'user\')\r\n liIcon.addClass" + +"(\'fa-user\');\r\n else\r\n " + +" liIcon.addClass(\'fa-users\');\r\n\r\n " + +" var li = $(\'
  • \')\r\n " + +" .append($(\'\').attr({ type: \'hidden\', name: \'subjects\', va" + +"lue: response.Id }))\r\n .append(li" + +"Icon)\r\n .append($(\'\').text(" + +"response.Id == response.Name ? response.Id : response.Name + \' [\' + response.Id " + +"+ \']\'))\r\n .append($(\'\').addCla" + +"ss(\'fa fa-times-circle remove\'))\r\n " + +" .addClass(response.Type)\r\n .att" + +"r(\'data-subjectid\', response.Id)\r\n " + +" .attr(\'data-subjectstatus\', \'new\');\r\n\r\n " + +" list.append(li);\r\n\r\n updateNoSub" + +"jects();\r\n } else {\r\n " + +" alert(\'That subject has already been added\');\r\n " + +" }\r\n } else {\r\n" + +" alert(response.Name + \' [\' + response.Id" + +" + \'] is a \' + response.Type + \'. Only users and groups can be added.\');\r\n " + +" }\r\n } else {\r\n " + +" alert(\'Unknown Id\');\r\n " + +" }\r\n }).fail(function (jqXHR, textStatus, errorTh" + +"rown) {\r\n alert(\'Error: \' + errorThrown);\r\n " + +" });\r\n\r\n return false;\r\n " + +" }\r\n\r\n function updateNoSubjects() {\r\n " + +" if (list.find(\'li:visible\').length > 0)\r\n " + +" noSubjects.hide();\r\n else\r\n " + +" noSubjects.show();\r\n }\r\n\r\n " + +" function saveChanges() {\r\n dialog.fin" + +"d(\'form\').trigger(\'submit\');\r\n dialog.dialog(\"option\"" + +", \"buttons\", null);\r\n }\r\n\r\n $(func" + +"tion () {\r\n $(\'#Config_JobQueues_Subjects_Update\').on" + +"(\'click\', showDialog);\r\n });\r\n\r\n })();" + +"\r\n \r\n \r\n"); - #line 521 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } + #line 497 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + } #line default #line hidden -WriteLiteral("
  • Automatically Add Jobs:\r\n <" + -"div>\r\n"); +WriteLiteral("
    Automatically Add" + +" Jobs:\r\n
    \r\n"); - #line 528 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - - - #line default - #line hidden - - #line 528 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - if (Model.Token.JobQueue.JobSubTypes.Count > 0) - { - - - #line default - #line hidden -WriteLiteral("
      \r\n"); - - - #line 531 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 504 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" #line default #line hidden - #line 531 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - foreach (var jobType in Model.Token.JobQueue.JobSubTypes.GroupBy(jst => jst.JobType).OrderBy(jtg => jtg.Key.Description)) + #line 504 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + if (Model.Token.JobQueue.JobSubTypes.Count > 0) { #line default #line hidden -WriteLiteral("
    • \r\n"); - -WriteLiteral(" "); +WriteLiteral("
        \r\n"); - #line 534 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(jobType.Key.Description); - - - #line default - #line hidden -WriteLiteral("\r\n
          \r\n"); - - - #line 536 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - + #line 507 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line default #line hidden - #line 536 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - if (jobType.Count() == Model.JobTypes.FirstOrDefault(jt => jt.Id == jobType.Key.Id).JobSubTypes.Count) - { + #line 507 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + foreach (var jobType in Model.Token.JobQueue.JobSubTypes.GroupBy(jst => jst.JobType).OrderBy(jtg => jtg.Key.Description)) + { #line default #line hidden -WriteLiteral("
        • \r\n"); + +WriteLiteral(" "); + + + #line 510 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(jobType.Key.Description); + + + #line default + #line hidden +WriteLiteral("\r\n
            \r\n"); + + + #line 512 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + + + #line default + #line hidden + + #line 512 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + if (jobType.Count() == Model.JobTypes.FirstOrDefault(jt => jt.Id == jobType.Key.Id).JobSubTypes.Count) + { + + + #line default + #line hidden +WriteLiteral("
          • [All Sub Types]
          • \r\n"); - #line 539 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } - else - { - foreach (var jobSubType in jobType) - { + #line 515 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + } + else + { + foreach (var jobSubType in jobType) + { #line default #line hidden -WriteLiteral("
          • "); +WriteLiteral("
          • "); - #line 544 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(jobSubType.Description); + #line 520 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(jobSubType.Description); #line default @@ -1541,63 +1606,64 @@ WriteLiteral("
          • "); WriteLiteral("
          • \r\n"); - #line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } - } + #line 521 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + } + } #line default #line hidden -WriteLiteral("
          \r\n
        • \r\n"); +WriteLiteral("
        \r\n \r" + +"\n"); - #line 549 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 525 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + } + + + #line default + #line hidden +WriteLiteral("
      \r\n"); + + + #line 527 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" } + else + { #line default #line hidden -WriteLiteral("
    \r\n"); - - - #line 551 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } - else - { - - - #line default - #line hidden -WriteLiteral(" "); +WriteLiteral(" "); WriteLiteral("<None>"); WriteLiteral("\r\n"); - #line 555 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } + #line 531 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + } #line default #line hidden -WriteLiteral("
    \r\n"); +WriteLiteral(" \r\n"); - #line 557 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - + #line 533 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line default #line hidden - #line 557 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - if (canConfig) - { + #line 533 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + if (canConfig) + { #line default #line hidden -WriteLiteral(" \r\n"); - #line 561 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 537 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" #line default #line hidden - #line 561 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 537 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" using (Html.BeginForm(MVC.API.JobQueue.UpdateJobSubTypes(Model.Token.JobQueue.Id, null, true))) { + + + #line default + #line hidden + + #line 539 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 539 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + var selectedTypes = Model.Token.JobQueue.JobSubTypes.Select(jst => jst.JobType).Distinct().ToList(); foreach (var jt in Model.JobTypes) { @@ -1636,15 +1716,15 @@ WriteLiteral(">\r\n"); #line hidden WriteLiteral(" (jt.Id + #line 543 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" +, Tuple.Create(Tuple.Create("", 26943), Tuple.Create(jt.Id #line default #line hidden -, 25241), false) +, 26943), false) ); WriteLiteral(" class=\"jobTypes\""); @@ -1652,35 +1732,35 @@ WriteLiteral(" class=\"jobTypes\""); WriteLiteral(">\r\n

    \r\n " + " (jt.Id + #line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" +, Tuple.Create(Tuple.Create("", 27071), Tuple.Create(jt.Id #line default #line hidden -, 25369), false) +, 27071), false) ); WriteLiteral(" class=\"jobType\""); WriteLiteral(" type=\"checkbox\""); -WriteAttribute("value", Tuple.Create(" value=\"", 25410), Tuple.Create("\"", 25426) +WriteAttribute("value", Tuple.Create(" value=\"", 27112), Tuple.Create("\"", 27128) - #line 568 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - , Tuple.Create(Tuple.Create("", 25418), Tuple.Create(jt.Id + #line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + , Tuple.Create(Tuple.Create("", 27120), Tuple.Create(jt.Id #line default #line hidden -, 25418), false) +, 27120), false) ); WriteLiteral(" "); - #line 568 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" Write(selectedTypes.Contains(jt) ? "checked=\"checked\"" : null); @@ -1688,21 +1768,21 @@ WriteLiteral(" "); #line hidden WriteLiteral(" />(jt.Id + #line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + , Tuple.Create(Tuple.Create("", 27211), Tuple.Create(jt.Id #line default #line hidden -, 25509), false) +, 27211), false) ); WriteLiteral(">"); - #line 568 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 545 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" Write(jt.Description); @@ -1711,15 +1791,15 @@ WriteLiteral(">"); WriteLiteral("\r\n

    \r\n " + " (jt.Id + #line 547 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" +, Tuple.Create(Tuple.Create("", 27343), Tuple.Create(jt.Id #line default #line hidden -, 25641), false) +, 27343), false) ); WriteLiteral(" class=\"jobSubTypes\""); @@ -1729,7 +1809,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 571 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 548 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" Write(CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id), "div")); @@ -1740,7 +1820,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 572 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 549 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" Write(CommonHelpers.CheckBoxList("JobSubTypes", jt.JobSubTypes.OrderBy(jst => jst.Description).ToSelectListItems(Model.Token.JobQueue.JobSubTypes), 2)); @@ -1750,7 +1830,7 @@ WriteLiteral("\r\n \r\n "iv>\r\n"); - #line 575 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 552 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" } } @@ -1798,30 +1878,30 @@ WriteLiteral(" \r\n"); - #line 640 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - } + #line 617 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + } #line default #line hidden -WriteLiteral(" \r\n \r\n \r\n \r\n When jobs of these types are created, they will automatically be added into " + -"this queue.\r\n

    \r\n \r\n
    \r\n\r\n"); +"this queue.\r\n

    \r\n \r\n " + +"\r\n
    \r\n\r\n"); - #line 650 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 627 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" if (canDelete || canShowJobs) { @@ -1835,40 +1915,69 @@ WriteLiteral(" class=\"actionBar\""); WriteLiteral(">\r\n"); - #line 653 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 630 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" #line default #line hidden - #line 653 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 630 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" if (canDelete) { - - - #line default - #line hidden - - #line 655 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - Write(Html.ActionLinkButton("Delete", MVC.API.JobQueue.Delete(Model.Token.JobQueue.Id, true), "Config_JobQueues_Actions_Delete_Button")); #line default #line hidden - - #line 655 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" - +WriteLiteral(" Delete\r\n"); - - #line default - #line hidden WriteLiteral(" \r\n

    \r\n \r\n"); + + + #line 634 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + + + #line default + #line hidden + + #line 634 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + using (Html.BeginForm(MVC.API.JobQueue.Delete(Model.Token.JobQueue.Id, true))) + { + + + #line default + #line hidden + + #line 636 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 636 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + + } + + + #line default + #line hidden +WriteLiteral("

    \r\n $(function () { - var button = $('#Config_JobQueues_Actions_Delete_Button'); - var buttonDialog = $('#Config_JobQueues_Actions_Delete_Dialog'); - var buttonLink = button.attr('href'); - button.attr('href', '#'); - button.click(function () { - buttonDialog.dialog('open'); - return false; - }); - buttonDialog.dialog({ - resizable: false, - modal: true, - autoOpen: false, - buttons: { - ""Delete"": function () { - var $this = $(this); - $this.dialog(""disable""); - $this.dialog(""option"", ""buttons"", null); - window.location.href = buttonLink; - }, - Cancel: function () { - $(this).dialog(""close""); - } + const $button = $('#Config_JobQueues_Actions_Delete_Button'); + let $buttonDialog = null; + $button.on('click', function () { + if (!$buttonDialog) { + $buttonDialog = $('#Config_JobQueues_Actions_Delete_Dialog').dialog({ + resizable: false, + modal: true, + autoOpen: false, + buttons: { + ""Delete"": function () { + var $this = $(this); + $this.dialog(""option"", ""buttons"", null); + $this.find('form').trigger('submit'); + }, + Cancel: function () { + $(this).dialog(""close""); + } + } + }); } + + $buttonDialog.dialog('open'); + return false; }); }); "); - #line 692 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 673 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" } @@ -1920,7 +2029,7 @@ WriteLiteral(@"> WriteLiteral(" "); - #line 693 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 674 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" if (canShowJobs) { @@ -1928,14 +2037,14 @@ WriteLiteral(" "); #line default #line hidden - #line 695 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 676 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" Write(Html.ActionLinkButton(string.Format("Show {0} job{1}", Model.OpenJobCount, (Model.OpenJobCount == 1 ? null : "s")), MVC.Job.Queue(Model.Token.JobQueue.Id), "Config_JobQueues_Actions_ShowJobs_Button")); #line default #line hidden - #line 695 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 676 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" } @@ -1945,7 +2054,7 @@ WriteLiteral(" "); WriteLiteral(" \r\n"); - #line 698 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" + #line 679 "..\..\Areas\Config\Views\JobQueue\Show.cshtml" } #line default diff --git a/Disco.Web/Areas/Config/Views/Organisation/Index.cshtml b/Disco.Web/Areas/Config/Views/Organisation/Index.cshtml index 47512240..7318ff6e 100644 --- a/Disco.Web/Areas/Config/Views/Organisation/Index.cshtml +++ b/Disco.Web/Areas/Config/Views/Organisation/Index.cshtml @@ -159,6 +159,7 @@

    \r\n"); - #line 174 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 175 "..\..\Areas\Config\Views\Organisation\Index.cshtml" } @@ -890,14 +904,14 @@ WriteLiteral(">\r\n $(function () {\r\n var button = $(\'#butt " }\r\n });\r\n });\r\n \r\n"); - #line 221 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 222 "..\..\Areas\Config\Views\Organisation\Index.cshtml" } #line default #line hidden - #line 222 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 223 "..\..\Areas\Config\Views\Organisation\Index.cshtml" if (canConfigAddresses) { @@ -920,13 +934,13 @@ WriteLiteral(">\r\n This item will be permanently deleted.\r\n "

    \r\n Are you sure?\r\n

    \r\n"); - #line 232 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 233 "..\..\Areas\Config\Views\Organisation\Index.cshtml" #line default #line hidden - #line 232 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 233 "..\..\Areas\Config\Views\Organisation\Index.cshtml" using (Html.BeginForm(MVC.API.System.DeleteOrganisationAddress())) { @@ -934,14 +948,14 @@ WriteLiteral(">\r\n This item will be permanently deleted.\r\n #line default #line hidden - #line 234 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 235 "..\..\Areas\Config\Views\Organisation\Index.cshtml" Write(Html.AntiForgeryToken()); #line default #line hidden - #line 234 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 235 "..\..\Areas\Config\Views\Organisation\Index.cshtml" @@ -968,7 +982,7 @@ WriteLiteral(" type=\"hidden\""); WriteLiteral(" />\r\n"); - #line 237 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 238 "..\..\Areas\Config\Views\Organisation\Index.cshtml" } @@ -987,13 +1001,13 @@ WriteLiteral(" class=\"dialog\""); WriteLiteral(">\r\n"); - #line 240 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 241 "..\..\Areas\Config\Views\Organisation\Index.cshtml" #line default #line hidden - #line 240 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 241 "..\..\Areas\Config\Views\Organisation\Index.cshtml" using (Html.BeginForm(MVC.API.System.UpdateOrganisationAddress())) { @@ -1001,14 +1015,14 @@ WriteLiteral(">\r\n"); #line default #line hidden - #line 242 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 243 "..\..\Areas\Config\Views\Organisation\Index.cshtml" Write(Html.AntiForgeryToken()); #line default #line hidden - #line 242 "..\..\Areas\Config\Views\Organisation\Index.cshtml" + #line 243 "..\..\Areas\Config\Views\Organisation\Index.cshtml" @@ -1178,7 +1192,7 @@ WriteLiteral(" data-bind />\r\n
    @@ -11,7 +12,7 @@ @@ -59,7 +60,7 @@ dialogGroupId = $('#Config_LinkedGroup_Id'); dialogGroupId.focus(function () { $(this).select(); }); dialogGroupId.autocomplete({ - source: '@(Url.Action(MVC.API.System.SearchGroupSubjects()))', + source: dialogGroupId.attr('data-sourceurl'), minLength: 2, select: function (e, ui) { dialogGroupId.val(ui.item.Id); diff --git a/Disco.Web/Areas/Config/Views/Shared/LinkedGroupShared.generated.cs b/Disco.Web/Areas/Config/Views/Shared/LinkedGroupShared.generated.cs index a0a804f1..125b2bfa 100644 --- a/Disco.Web/Areas/Config/Views/Shared/LinkedGroupShared.generated.cs +++ b/Disco.Web/Areas/Config/Views/Shared/LinkedGroupShared.generated.cs @@ -69,7 +69,18 @@ WriteLiteral(" action=\"#\""); WriteLiteral(" method=\"post\""); -WriteLiteral(">\r\n \r\n"); + +WriteLiteral(" "); + + + #line 7 "..\..\Areas\Config\Views\Shared\LinkedGroupShared.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden +WriteLiteral("\r\n \r\n \r\n " + " WriteLiteral(" "); - #line 681 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 689 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.EditorFor(m => m.ProxyAddress)); @@ -2115,7 +2179,7 @@ WriteLiteral("
    \r\n"); WriteLiteral(" "); - #line 682 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 690 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.ValidationMessageFor(m => m.ProxyAddress)); @@ -2132,7 +2196,7 @@ WriteLiteral(">\r\n Port:\r\n \r\ WriteLiteral(" "); - #line 690 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 698 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.EditorFor(m => m.ProxyPort)); @@ -2143,7 +2207,7 @@ WriteLiteral("
    \r\n"); WriteLiteral(" "); - #line 691 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 699 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.ValidationMessageFor(m => m.ProxyPort)); @@ -2160,7 +2224,7 @@ WriteLiteral(">\r\n Username:\r\n m.ProxyUsername)); @@ -2171,7 +2235,7 @@ WriteLiteral("
    \r\n"); WriteLiteral(" "); - #line 700 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 708 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.ValidationMessageFor(m => m.ProxyUsername)); @@ -2188,7 +2252,7 @@ WriteLiteral(">\r\n Password:\r\n m.ProxyPassword)); @@ -2199,7 +2263,7 @@ WriteLiteral("
    \r\n"); WriteLiteral(" "); - #line 709 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 717 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.ValidationMessageFor(m => m.ProxyPassword)); @@ -2222,51 +2286,35 @@ WriteLiteral(" class=\"button small\""); WriteLiteral(">Save Proxy Settings"); - #line 717 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 725 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden -WriteLiteral(@" - \r\n \r\n \r\n <" + +"/table>\r\n \r\n"); - #line 723 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" - Write(Url.Action(MVC.API.System.UpdateProxySettings())); - - - #line default - #line hidden -WriteLiteral("\';\r\n var data = {\r\n " + -" ProxyAddress: $(\'#ProxyAddress\').val(),\r\n " + -" ProxyPort: $(\'#ProxyPort\').val(),\r\n " + -" ProxyUsername: $(\'#ProxyUsername\').val(),\r\n " + -" ProxyPassword: $(\'#ProxyPassword\').val()\r\n " + -" }\r\n var ajaxLoading = button.next(\'" + -".ajaxLoading\').first().show();\r\n\r\n $.ajax({\r\n" + -" type: \'POST\',\r\n " + -" dataType: \'json\',\r\n url: u" + -"rl,\r\n data: data,\r\n " + -" complete: function (response, result) {\r\n " + -" if (result != \'success\' || response.responseJSON != \'OK\')" + -" {\r\n alert(\'Unable to change prox" + -"y settings:\\nCheck logs for more information\');\r\n " + -" ajaxLoading.hide();\r\n " + -" } else {\r\n ajaxLoading.hide().n" + -"ext(\'.ajaxOk\').show().delay(\'fast\').fadeOut(\'slow\');\r\n " + -" }\r\n }\r\n " + -" });\r\n });\r\n " + -" });\r\n \r\n \r\n " + -" \r\n
    - +
    \r\n \r\n Warning: This group will be managed by Disco ICT.
    - Any existing members will be removed from the group, and it will be automatically synchronized with related members. -

    - - -\r\n"); +WriteLiteral(">Warning: This group will be managed by Disco ICT.
    \r\n " + +" Any existing members will be removed from the group, " + +"and it will be automatically synchronized with related members.\r\n

    \r\n " + +" \r\n\r\n" + +"\r\n"); } } diff --git a/Disco.Web/Areas/Config/Views/Shared/LogEvents.cshtml b/Disco.Web/Areas/Config/Views/Shared/LogEvents.cshtml index c7d13e07..2e0d2691 100644 --- a/Disco.Web/Areas/Config/Views/Shared/LogEvents.cshtml +++ b/Disco.Web/Areas/Config/Views/Shared/LogEvents.cshtml @@ -7,7 +7,6 @@ var uniqueId = Guid.NewGuid().ToString("N"); }
    - @Html.AntiForgeryToken() @@ -82,7 +81,7 @@ End: logEndFiler, ModuleId: logModuleId, Take: logTakeFiler, - '__RequestVerificationToken': logEventsHost.find('input[name="__RequestVerificationToken"]').val() + '__RequestVerificationToken': document.body.dataset.antiforgery }; if (logEventTypeFiltered) loadData["EventTypeIds"] = logEventTypeFiltered; diff --git a/Disco.Web/Areas/Config/Views/Shared/LogEvents.generated.cs b/Disco.Web/Areas/Config/Views/Shared/LogEvents.generated.cs index 6f4f0c8d..5d392cdb 100644 --- a/Disco.Web/Areas/Config/Views/Shared/LogEvents.generated.cs +++ b/Disco.Web/Areas/Config/Views/Shared/LogEvents.generated.cs @@ -70,18 +70,7 @@ WriteAttribute("id", Tuple.Create(" id=\"", 309), Tuple.Create("\"", 335) WriteLiteral(" class=\"logEventsViewport\""); -WriteLiteral(">\r\n"); - -WriteLiteral(" "); - - - #line 10 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" -Write(Html.AntiForgeryToken()); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n Message\r\n \r\n \r\n WriteLiteral(" class=\"logEventsViewportContainer\""); -WriteAttribute("style", Tuple.Create(" style=\"", 840), Tuple.Create("\"", 1050) +WriteAttribute("style", Tuple.Create(" style=\"", 810), Tuple.Create("\"", 1020) - #line 25 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" -, Tuple.Create(Tuple.Create("", 848), Tuple.Create(Model.ViewPortWidth.HasValue ? string.Format("width:{0}px;", Model.ViewPortWidth.Value) : null + #line 24 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" +, Tuple.Create(Tuple.Create("", 818), Tuple.Create(Model.ViewPortWidth.HasValue ? string.Format("width:{0}px;", Model.ViewPortWidth.Value) : null #line default #line hidden -, 848), false) +, 818), false) - #line 25 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" - , Tuple.Create(Tuple.Create("", 945), Tuple.Create(Model.ViewPortHeight.HasValue ? string.Format("height:{0}px;", Model.ViewPortHeight.Value - 18) : null + #line 24 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" + , Tuple.Create(Tuple.Create("", 915), Tuple.Create(Model.ViewPortHeight.HasValue ? string.Format("height:{0}px;", Model.ViewPortHeight.Value - 18) : null #line default #line hidden -, 945), false) +, 915), false) ); WriteLiteral(">\r\n \r\n \r\n \r\n "\r\n"); - #line 41 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" + #line 40 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" #line default #line hidden - #line 41 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" + #line 40 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" var eventTypesFilterJson = (Model.EventTypesFilter != null) ? Newtonsoft.Json.JsonConvert.SerializeObject(Model.EventTypesFilter.Select(et => et.Id).ToArray()) : "null"; @@ -196,7 +185,7 @@ WriteLiteral(" type=\"text/javascript\""); WriteLiteral(">\r\n $(function () {\r\n var logEventsHost = $(\'#LogEvents_"); - #line 46 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" + #line 45 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" Write(uniqueId); @@ -205,7 +194,7 @@ WriteLiteral(">\r\n $(function () {\r\n var logEventsHost = $( WriteLiteral("\');\r\n var logModuleId = \'"); - #line 47 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" + #line 46 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" Write(Model.ModuleFilter != null ? Model.ModuleFilter.ModuleId.ToString() : null); @@ -214,7 +203,7 @@ WriteLiteral("\');\r\n var logModuleId = \'"); WriteLiteral("\';\r\n var logModuleLiveGroupName = \'"); - #line 48 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" + #line 47 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" Write(Model.ModuleFilter != null ? Model.ModuleFilter.LiveLogGroupName : Disco.Services.Logging.LogNotificationsHub.AllLoggingNotification); @@ -223,7 +212,7 @@ WriteLiteral("\';\r\n var logModuleLiveGroupName = \'"); WriteLiteral("\';\r\n var logEventTypeFiltered = "); - #line 49 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" + #line 48 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" Write(eventTypesFilterJson); @@ -232,7 +221,7 @@ WriteLiteral("\';\r\n var logEventTypeFiltered = "); WriteLiteral("; \r\n var logStartFiler = "); - #line 50 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" + #line 49 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" Write(AjaxHelpers.JsonDate(Model.StartFilter)); @@ -241,7 +230,7 @@ WriteLiteral("; \r\n var logStartFiler = "); WriteLiteral(";\r\n var logEndFiler = "); - #line 51 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" + #line 50 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" Write(AjaxHelpers.JsonDate(Model.EndFilter)); @@ -250,7 +239,7 @@ WriteLiteral(";\r\n var logEndFiler = "); WriteLiteral(";\r\n var logTakeFiler = \'"); - #line 52 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" + #line 51 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" Write(Model.TakeFilter); @@ -260,7 +249,7 @@ WriteLiteral("\';\r\n var logHub = null;\r\n var liveEvent ""); - #line 54 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" + #line 53 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" Write(Model.JavascriptLiveEventFunctionName); @@ -269,7 +258,7 @@ WriteLiteral("\';\r\n var logHub = null;\r\n var liveEvent WriteLiteral("\';\r\n var useLive = (\'True\'===\'"); - #line 55 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" + #line 54 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" Write(Model.IsLive); @@ -305,7 +294,7 @@ WriteLiteral(@"'); End: logEndFiler, ModuleId: logModuleId, Take: logTakeFiler, - '__RequestVerificationToken': logEventsHost.find('input[name=""__RequestVerificationToken""]').val() + '__RequestVerificationToken': document.body.dataset.antiforgery }; if (logEventTypeFiltered) loadData[""EventTypeIds""] = logEventTypeFiltered; @@ -313,7 +302,7 @@ WriteLiteral(@"'); url: '"); - #line 90 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" + #line 89 "..\..\Areas\Config\Views\Shared\LogEvents.cshtml" Write(Url.Action(MVC.API.Logging.RetrieveEvents())); diff --git a/Disco.Web/Areas/Config/Views/Shared/_DeviceGroupDocumentBulkGenerate.cshtml b/Disco.Web/Areas/Config/Views/Shared/_DeviceGroupDocumentBulkGenerate.cshtml index 45d40f48..41ced35c 100644 --- a/Disco.Web/Areas/Config/Views/Shared/_DeviceGroupDocumentBulkGenerate.cshtml +++ b/Disco.Web/Areas/Config/Views/Shared/_DeviceGroupDocumentBulkGenerate.cshtml @@ -43,7 +43,7 @@

    Bulk generate documents for devices, users or jobs (based on document template scope) associated with this Device @(targetDescription).

    - @using (Html.BeginForm(urlDelegate(), FormMethod.Post)) + @using (Html.BeginForm(urlDelegate())) { @Html.AntiForgeryToken() @Html.Hidden("deviceGroupId", targetId) diff --git a/Disco.Web/Areas/Config/Views/Shared/_DeviceGroupDocumentBulkGenerate.generated.cs b/Disco.Web/Areas/Config/Views/Shared/_DeviceGroupDocumentBulkGenerate.generated.cs index 6a00e38b..1b87ebb5 100644 --- a/Disco.Web/Areas/Config/Views/Shared/_DeviceGroupDocumentBulkGenerate.generated.cs +++ b/Disco.Web/Areas/Config/Views/Shared/_DeviceGroupDocumentBulkGenerate.generated.cs @@ -131,7 +131,7 @@ WriteLiteral(".\r\n

    \r\n"); #line hidden #line 46 "..\..\Areas\Config\Views\Shared\_DeviceGroupDocumentBulkGenerate.cshtml" - using (Html.BeginForm(urlDelegate(), FormMethod.Post)) + using (Html.BeginForm(urlDelegate())) { @@ -191,14 +191,14 @@ WriteLiteral(">-- Choose Document Template --\r\n"); #line hidden WriteLiteral(" (template.Id +, Tuple.Create(Tuple.Create("", 2643), Tuple.Create(template.Id #line default #line hidden -, 2660), false) +, 2643), false) ); WriteLiteral(">"); diff --git a/Disco.Web/Areas/Config/Views/SystemConfig/Index.cshtml b/Disco.Web/Areas/Config/Views/SystemConfig/Index.cshtml index 818c429f..e32bd9f2 100644 --- a/Disco.Web/Areas/Config/Views/SystemConfig/Index.cshtml +++ b/Disco.Web/Areas/Config/Views/SystemConfig/Index.cshtml @@ -109,7 +109,7 @@ } else { - using (Html.BeginForm(MVC.Config.SystemConfig.Activate(), FormMethod.Post)) + using (Html.BeginForm(MVC.Config.SystemConfig.Activate())) { @Html.AntiForgeryToken(); @@ -127,7 +127,7 @@ License:
    \r\n\r\n\r\n\r\n \r\n
    - @using (Html.BeginForm(MVC.API.System.LicenseCheck(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.System.LicenseCheck())) { @Html.AntiForgeryToken(); @@ -259,7 +259,13 @@ @{ if (Model.UpdateRunningStatus == null) { - @Html.ActionLinkSmallButton("Check Now", MVC.API.System.UpdateCheck()) + + @using (Html.BeginForm(MVC.API.System.UpdateCheck())) + { + @Html.AntiForgeryToken(); + + } + [Will run automatically @CommonHelpers.FriendlyDate(Model.UpdateNextScheduled, "Unknown")] } else @@ -549,6 +555,7 @@ @using (Html.BeginForm(MVC.API.System.UpdateActiveDirectorySearchScope(null, redirect: true))) { + @Html.AntiForgeryToken() } @@ -864,17 +866,16 @@ else   - @Html.AntiForgeryToken() @AjaxHelpers.AjaxLoader()

     Recipient Email Address:


    - @using (Html.BeginForm(MVC.API.System.SendTestEmail(), FormMethod.Post)) + @using (Html.BeginForm(MVC.API.System.SendTestEmail())) { + @Html.AntiForgeryToken() - @Html.AntiForgeryToken() }
    \r\n"); - #line 416 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 422 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } @@ -1533,7 +1569,7 @@ WriteLiteral("\', \'SearchAllServers\');\r\n WriteLiteral(" \r\n"); - #line 418 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 424 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } else { @@ -1546,7 +1582,7 @@ WriteLiteral("
    \r\n"); WriteLiteral(" "); - #line 422 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 428 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.CheckBoxFor(m => m.ADSearchAllServers, new { disabled = "disabled" })); @@ -1555,7 +1591,7 @@ WriteLiteral(" "); WriteLiteral(" "); - #line 422 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 428 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.LabelFor(m => m.ADSearchAllServers)); @@ -1578,7 +1614,7 @@ WriteLiteral(">If this setting is enabled, Disco ICT will query all servers "

    \r\n
    \r\n \r\n"); - #line 429 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 435 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } @@ -1594,13 +1630,13 @@ WriteLiteral(" class=\"none\""); WriteLiteral(">\r\n"); - #line 434 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 440 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" #line default #line hidden - #line 434 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 440 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" var domainIndex = Model.ADDomains.ToDictionary(d => d.Name, StringComparer.OrdinalIgnoreCase); var siteServers = Model.ADServers.Where(s => s.IsSiteServer).ToDictionary(s => s.Name, StringComparer.OrdinalIgnoreCase); @@ -1623,7 +1659,7 @@ WriteLiteral("
  • \r\n " "); - #line 449 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 455 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(serverDescription); @@ -1632,7 +1668,7 @@ WriteLiteral("
  • \r\n WriteLiteral(""); - #line 449 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 455 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" if (siteServers.ContainsKey(server)) { @@ -1647,7 +1683,7 @@ WriteLiteral(" title=\"Site Server\""); WriteLiteral(">"); - #line 450 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 456 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } @@ -1656,7 +1692,7 @@ WriteLiteral(">"); WriteLiteral("
  • \r\n"); - #line 452 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 458 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } @@ -1690,7 +1726,7 @@ WriteLiteral(@" "); - #line 478 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 484 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } @@ -1703,13 +1739,13 @@ WriteLiteral(" style=\"width: 135px\""); WriteLiteral(">\r\n Searching:\r\n \r\n
    \r\n"); - #line 487 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 493 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" #line default #line hidden - #line 487 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 493 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" object ADSearchWildcardSuffixOnlyAttributes = null; if (!canConfigAD) @@ -1728,7 +1764,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 497 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 503 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.CheckBoxFor(m => m.ADSearchWildcardSuffixOnly, ADSearchWildcardSuffixOnlyAttributes)); @@ -1737,7 +1773,7 @@ WriteLiteral(" "); WriteLiteral(" "); - #line 497 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 503 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.LabelFor(m => m.ADSearchWildcardSuffixOnly)); @@ -1746,7 +1782,7 @@ WriteLiteral(" "); WriteLiteral(" "); - #line 497 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 503 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(AjaxHelpers.AjaxLoader()); @@ -1771,13 +1807,13 @@ WriteLiteral(@">If this setting is enabled, Disco ICT will utilize Active Di "); - #line 504 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 510 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" #line default #line hidden - #line 504 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 510 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" if (canConfigAD) { @@ -1789,7 +1825,7 @@ WriteLiteral(" \r\n"); - #line 511 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 517 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } @@ -1812,13 +1848,13 @@ WriteLiteral(" style=\"width: 135px\""); WriteLiteral(">\r\n Search Scope:\r\n \r\n \r\n"); - #line 519 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 525 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" #line default #line hidden - #line 519 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 525 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" if (Model.ADSearchContainers != null && Model.ADSearchContainers.Count > 0) { @@ -1835,13 +1871,13 @@ WriteLiteral(" id=\"Config_System_AD_SearchScope_DistinguishedNames\""); WriteLiteral(">\r\n"); - #line 523 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 529 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" #line default #line hidden - #line 523 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 529 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" foreach (var adContainer in Model.ADSearchContainers) { @@ -1853,7 +1889,7 @@ WriteLiteral(" "); - #line 525 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 531 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(adContainer.Item3); @@ -1873,7 +1909,7 @@ WriteLiteral(">"); WriteLiteral("\r\n"); - #line 526 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 532 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } @@ -1882,7 +1918,7 @@ WriteLiteral("\r\n"); WriteLiteral(" \r\n"); - #line 528 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 534 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } else { @@ -1910,7 +1946,7 @@ WriteLiteral(">When searching, the entire domain will be queried. This is su "/div>\r\n"); - #line 537 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 543 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } @@ -1919,7 +1955,7 @@ WriteLiteral(">When searching, the entire domain will be queried. This is su WriteLiteral(" "); - #line 538 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 544 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" if (canConfigAD) { @@ -1954,7 +1990,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 546 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 552 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(AjaxHelpers.AjaxLoader()); @@ -1970,15 +2006,29 @@ WriteLiteral(" class=\"organisationalUnitTree\""); WriteLiteral(">\r\n \r\n"); - #line 550 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 556 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" #line default #line hidden - #line 550 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 556 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" using (Html.BeginForm(MVC.API.System.UpdateActiveDirectorySearchScope(null, redirect: true))) { + + + #line default + #line hidden + + #line 558 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 558 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + } @@ -2023,7 +2073,7 @@ WriteLiteral(" \r\n"); - #line 661 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 668 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } @@ -2078,11 +2128,25 @@ WriteLiteral("\', null, function (data) {\r\n WriteLiteral("
    \r\n
    \r\n"); - #line 669 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 676 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" if (canConfigProxy) { using (Html.BeginForm(MVC.API.System.UpdateProxySettings())) { + + + #line default + #line hidden + + #line 680 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 680 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line default @@ -2104,7 +2168,7 @@ WriteLiteral(">\r\n Address:\r\n
    \r\n \r\n"); - - - #line 753 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 755 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } } else @@ -2291,7 +2339,7 @@ WriteLiteral(">\r\n Address:\r\n \r\n WriteLiteral(" "); - #line 765 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 767 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.DisplayFor(m => m.ProxyAddress)); @@ -2307,7 +2355,7 @@ WriteLiteral(">\r\n Port:\r\n \r\n WriteLiteral(" "); - #line 773 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 775 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.DisplayFor(m => m.ProxyPort)); @@ -2323,7 +2371,7 @@ WriteLiteral(">\r\n Username:\r\n \r\n WriteLiteral(" "); - #line 781 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 783 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.DisplayFor(m => m.ProxyUsername)); @@ -2339,14 +2387,14 @@ WriteLiteral(">\r\n Password:\r\n \r\n "table>\r\n \r\n"); - #line 794 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 796 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } #line default #line hidden - #line 795 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 797 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" if (canConfigEmail) { @@ -2370,7 +2418,7 @@ WriteLiteral(">\r\n SMTP Server:\r\n \r\n WriteLiteral(" "); - #line 805 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 807 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.EditorFor(m => m.EmailSmtpServer)); @@ -2381,7 +2429,7 @@ WriteLiteral("
    \r\n"); WriteLiteral(" "); - #line 806 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 808 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.ValidationMessageFor(m => m.EmailSmtpServer)); @@ -2397,7 +2445,7 @@ WriteLiteral(">\r\n Port:\r\n \r\n WriteLiteral(" "); - #line 814 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 816 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.EditorFor(m => m.EmailSmtpPort)); @@ -2408,7 +2456,7 @@ WriteLiteral("
    \r\n"); WriteLiteral(" "); - #line 815 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 817 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.ValidationMessageFor(m => m.EmailSmtpPort)); @@ -2425,7 +2473,7 @@ WriteLiteral(">\r\n Default From Address:\r\n WriteLiteral(" "); - #line 823 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 825 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.EditorFor(m => m.EmailFromAddress)); @@ -2436,7 +2484,7 @@ WriteLiteral("
    \r\n"); WriteLiteral(" "); - #line 824 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 826 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.ValidationMessageFor(m => m.EmailFromAddress)); @@ -2453,7 +2501,7 @@ WriteLiteral(">\r\n Reply To Address:\r\n m.EmailReplyToAddress)); @@ -2464,7 +2512,7 @@ WriteLiteral("
    \r\n"); WriteLiteral(" "); - #line 833 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 835 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.ValidationMessageFor(m => m.EmailReplyToAddress)); @@ -2480,7 +2528,7 @@ WriteLiteral(">\r\n  \r\n \r\n WriteLiteral(" "); - #line 841 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 843 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.CheckBoxFor(m => m.EmailEnableSsl)); @@ -2489,7 +2537,7 @@ WriteLiteral(" "); WriteLiteral(" "); - #line 841 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 843 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.LabelFor(m => m.EmailEnableSsl)); @@ -2505,7 +2553,7 @@ WriteLiteral(">\r\n Username:\r\n \r\n WriteLiteral(" "); - #line 849 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 851 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.EditorFor(m => m.EmailUsername)); @@ -2516,7 +2564,7 @@ WriteLiteral("
    \r\n"); WriteLiteral(" "); - #line 850 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 852 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.ValidationMessageFor(m => m.EmailUsername)); @@ -2532,7 +2580,7 @@ WriteLiteral(">\r\n Password:\r\n \r\n WriteLiteral(" "); - #line 858 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 860 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.EditorFor(m => m.EmailPassword)); @@ -2543,7 +2591,7 @@ WriteLiteral("
    \r\n"); WriteLiteral(" "); - #line 859 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 861 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.ValidationMessageFor(m => m.EmailPassword)); @@ -2554,18 +2602,8 @@ WriteLiteral("\r\n
    \r\n"); - -WriteLiteral(" "); - - - #line 867 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" - Write(Html.AntiForgeryToken()); - - - #line default - #line hidden -WriteLiteral("\r\n \r\n  \r\n \r\n \r\n " + +" Save Email Settings"); - #line 869 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 870 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(AjaxHelpers.AjaxLoader()); @@ -2614,15 +2652,29 @@ WriteLiteral(" class=\"fa fa-envelope information\""); WriteLiteral("> Recipient Email Address:\r\n
    \r\n"); - #line 873 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 874 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" #line default #line hidden - #line 873 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" - using (Html.BeginForm(MVC.API.System.SendTestEmail(), FormMethod.Post)) + #line 874 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + using (Html.BeginForm(MVC.API.System.SendTestEmail())) { + + + #line default + #line hidden + + #line 876 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 876 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line default @@ -2645,34 +2697,20 @@ WriteLiteral(" name=\"Recipient\""); WriteLiteral(" type=\"text\""); -WriteAttribute("value", Tuple.Create(" value=\"", 40530), Tuple.Create("\"", 40563) +WriteAttribute("value", Tuple.Create(" value=\"", 40398), Tuple.Create("\"", 40431) - #line 876 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" - , Tuple.Create(Tuple.Create("", 40538), Tuple.Create(CurrentUser.EmailAddress + #line 878 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + , Tuple.Create(Tuple.Create("", 40406), Tuple.Create(CurrentUser.EmailAddress #line default #line hidden -, 40538), false) +, 40406), false) ); WriteLiteral(" />\r\n"); - #line 877 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" - - - #line default - #line hidden - - #line 877 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" - Write(Html.AntiForgeryToken()); - - - #line default - #line hidden - - #line 877 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" - + #line 879 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } @@ -2689,7 +2727,7 @@ WriteLiteral(@" var url = '"); - #line 887 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 888 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Url.Action(MVC.API.System.UpdateEmailSettings())); @@ -2703,56 +2741,55 @@ WriteLiteral("\';\r\n var data = {\r\n " EnableSsl: $(\'#EmailEnableSsl\').is(\':checked\'),\r\n " + " Username: $(\'#EmailUsername\').val(),\r\n " + " Password: $(\'#EmailPassword\').val(),\r\n \'__R" + -"equestVerificationToken\': button.parent().find(\'input[name=\"__RequestVerificatio" + -"nToken\"]\').first().val()\r\n }\r\n " + -" var ajaxLoading = button.next(\'.ajaxLoading\').first().show();\r\n\r\n " + -" $.ajax({\r\n type" + -": \'POST\',\r\n dataType: \'json\',\r\n " + -" url: url,\r\n data: data," + -"\r\n complete: function (response, result) {\r\n " + -" if (result != \'success\' || response.respo" + -"nseJSON != \'OK\') {\r\n alert(\'Unable to" + -" change email settings:\\nCheck logs for more information\');\r\n " + -" ajaxLoading.hide();\r\n " + -" } else {\r\n ajaxLoading.hide().n" + -"ext(\'.ajaxOk\').show().delay(\'fast\').fadeOut(\'slow\');\r\n " + -" if (!!$(\'#EmailSmtpServer\').val()) {\r\n " + -" testButton.removeAttr(\'disabled\');\r\n " + -" } else {\r\n " + -" testButton.attr(\'disabled\', \'disabled\');\r\n " + -" }\r\n }\r\n " + -" }\r\n });\r\n })" + -";\r\n\r\n testButton.closest(\'table\').find(\'td>input\').ch" + -"ange(function () {\r\n testButton.attr(\'disabled\', " + -"\'disabled\');\r\n });\r\n testB" + -"utton.click(function () {\r\n if (!testDialog) {\r\n " + -" testDialog = $(\'#Config_System_Email_Test_Dia" + -"log\')\r\n .dialog({\r\n " + -" resizable: false,\r\n " + -" height: 180,\r\n modal: true,\r\n " + -" autoOpen: false,\r\n " + -" buttons: {\r\n " + -" Send: function () {\r\n var " + -"$this = $(this);\r\n var recipi" + -"entInput = $(\'#Config_System_Email_Test_Recipient\');\r\n " + -" if (!!recipientInput.val()) {\r\n " + -" $this.dialog(\"disable\");\r\n " + -" $this.dialog(\"option\", \"buttons\", null);\r\n " + -" recipientInput.closest(\'for" + -"m\').submit()\r\n } else {\r\n " + -" alert(\'Enter the recipient a" + -"ddress for the test email\');\r\n " + -" }\r\n },\r\n " + -" Cancel: function () {\r\n " + -" $(this).dialog(\"close\");\r\n " + -" }\r\n }\r\n " + -" });\r\n }\r\n " + -" testDialog.dialog(\'open\');\r\n });\r\n\r\n " + -" });\r\n \r\n
    \r\n \r\n"); +"equestVerificationToken\': document.body.dataset.antiforgery\r\n " + +" }\r\n var ajaxLoading = button.next(\'." + +"ajaxLoading\').first().show();\r\n\r\n $.ajax({\r\n " + +" type: \'POST\',\r\n " + +" dataType: \'json\',\r\n url: url,\r\n " + +" data: data,\r\n complet" + +"e: function (response, result) {\r\n if (re" + +"sult != \'success\') {\r\n alert(\'Unable " + +"to change email settings:\\nCheck logs for more information\');\r\n " + +" ajaxLoading.hide();\r\n " + +" } else {\r\n ajaxLoading.hide()" + +".next(\'.ajaxOk\').show().delay(\'fast\').fadeOut(\'slow\');\r\n " + +" if (!!$(\'#EmailSmtpServer\').val()) {\r\n " + +" testButton.removeAttr(\'disabled\');\r\n " + +" } else {\r\n " + +" testButton.attr(\'disabled\', \'disabled\');\r\n " + +" }\r\n }\r\n " + +" }\r\n });\r\n " + +"});\r\n\r\n testButton.closest(\'table\').find(\'td>input\')." + +"change(function () {\r\n testButton.attr(\'disabled\'" + +", \'disabled\');\r\n });\r\n tes" + +"tButton.click(function () {\r\n if (!testDialog) {\r" + +"\n testDialog = $(\'#Config_System_Email_Test_D" + +"ialog\')\r\n .dialog({\r\n " + +" resizable: false,\r\n " + +" height: 180,\r\n modal: true,\r\n " + +" autoOpen: false,\r\n " + +" buttons: {\r\n " + +" Send: function () {\r\n va" + +"r $this = $(this);\r\n var reci" + +"pientInput = $(\'#Config_System_Email_Test_Recipient\');\r\n " + +" if (!!recipientInput.val()) {\r\n " + +" $this.dialog(\"disable\");\r\n " + +" $this.dialog(\"option\", \"buttons\", null);\r\n " + +" recipientInput.closest(\'f" + +"orm\').submit()\r\n } else {\r\n " + +" alert(\'Enter the recipient" + +" address for the test email\');\r\n " + +" }\r\n },\r\n " + +" Cancel: function () {\r\n " + +" $(this).dialog(\"close\");\r\n " + +" }\r\n }\r\n " + +" });\r\n }\r\n " + +" testDialog.dialog(\'open\');\r\n });\r\n\r" + +"\n });\r\n \r\n \r\n
    \r\n \r\n"); - #line 959 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 960 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } else { @@ -2777,7 +2814,7 @@ WriteLiteral(">\r\n SMTP Server:\r\n \r\n WriteLiteral(" "); - #line 970 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 971 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.DisplayFor(m => m.EmailSmtpServer)); @@ -2793,7 +2830,7 @@ WriteLiteral(">\r\n Port:\r\n \r\n WriteLiteral(" "); - #line 978 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 979 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.DisplayFor(m => m.EmailSmtpPort)); @@ -2810,7 +2847,7 @@ WriteLiteral(">\r\n Default From Address:\r\n WriteLiteral(" "); - #line 986 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 987 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.DisplayFor(m => m.EmailFromAddress)); @@ -2827,7 +2864,7 @@ WriteLiteral(">\r\n Reply To Address:\r\n m.EmailReplyToAddress)); @@ -2844,7 +2881,7 @@ WriteLiteral(">\r\n Enable SSL:\r\n \r\n WriteLiteral(" "); - #line 1002 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 1003 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.CheckBoxFor(m => m.EmailEnableSsl, new { disabled = "disabled" })); @@ -2853,7 +2890,7 @@ WriteLiteral(" "); WriteLiteral(" "); - #line 1002 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 1003 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.LabelFor(m => m.EmailEnableSsl)); @@ -2869,7 +2906,7 @@ WriteLiteral(">\r\n Username:\r\n \r\n WriteLiteral(" "); - #line 1010 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 1011 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" Write(Html.DisplayFor(m => m.EmailUsername)); @@ -2885,7 +2922,7 @@ WriteLiteral(">\r\n Password:\r\n \r\n "table>\r\n \r\n"); - #line 1023 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + #line 1024 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" } @@ -2897,16 +2934,50 @@ WriteLiteral(" class=\"actionBar\""); WriteLiteral(">\r\n"); -WriteLiteral(" "); - - #line 1025 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" -Write(Html.ActionLinkButton("Update Device Last Network Logons", MVC.API.System.UpdateLastNetworkLogonDates())); + #line 1026 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + + + #line default + #line hidden + + #line 1026 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + using (Html.BeginForm(MVC.API.System.UpdateLastNetworkLogonDates())) + { + + + #line default + #line hidden + + #line 1028 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + Write(Html.AntiForgeryToken()); #line default #line hidden -WriteLiteral("\r\n\r\n"); + + #line 1028 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + ; + + + #line default + #line hidden +WriteLiteral(" Update Device Last Network Logons\r\n"); + + + #line 1030 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml" + } + + + #line default + #line hidden +WriteLiteral("\r\n"); } } diff --git a/Disco.Web/Areas/Config/Views/UserFlag/Create.cshtml b/Disco.Web/Areas/Config/Views/UserFlag/Create.cshtml index e015a11a..31afcc4b 100644 --- a/Disco.Web/Areas/Config/Views/UserFlag/Create.cshtml +++ b/Disco.Web/Areas/Config/Views/UserFlag/Create.cshtml @@ -4,23 +4,24 @@ ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "User Flags", MVC.Config.UserFlag.Index(null), "Create"); } @using (Html.BeginForm()) -{ - @Html.HiddenFor(m => m.UserFlag.Icon) - @Html.HiddenFor(m => m.UserFlag.IconColour) +{ + @Html.AntiForgeryToken()
    - -
    Name: + + Name: - @Html.EditorFor(model => model.UserFlag.Name)
    @Html.ValidationMessageFor(model => model.UserFlag.Name) + @Html.EditorFor(model => model.Name)
    @Html.ValidationMessageFor(model => model.Name)
    Description: + + Description: - @Html.EditorFor(model => model.UserFlag.Description)
    @Html.ValidationMessageFor(model => model.UserFlag.Description) + @Html.EditorFor(model => model.Description)
    @Html.ValidationMessageFor(model => model.Description)
    @@ -30,7 +31,7 @@
    } \ No newline at end of file diff --git a/Disco.Web/Areas/Config/Views/UserFlag/Create.generated.cs b/Disco.Web/Areas/Config/Views/UserFlag/Create.generated.cs index 584220eb..dbdd68d3 100644 --- a/Disco.Web/Areas/Config/Views/UserFlag/Create.generated.cs +++ b/Disco.Web/Areas/Config/Views/UserFlag/Create.generated.cs @@ -57,35 +57,21 @@ WriteLiteral("\r\n"); #line 6 "..\..\Areas\Config\Views\UserFlag\Create.cshtml" using (Html.BeginForm()) -{ +{ #line default #line hidden #line 8 "..\..\Areas\Config\Views\UserFlag\Create.cshtml" -Write(Html.HiddenFor(m => m.UserFlag.Icon)); +Write(Html.AntiForgeryToken()); #line default #line hidden #line 8 "..\..\Areas\Config\Views\UserFlag\Create.cshtml" - - - - #line default - #line hidden - - #line 9 "..\..\Areas\Config\Views\UserFlag\Create.cshtml" -Write(Html.HiddenFor(m => m.UserFlag.IconColour)); - - - #line default - #line hidden - - #line 9 "..\..\Areas\Config\Views\UserFlag\Create.cshtml" - + #line default @@ -96,14 +82,14 @@ WriteLiteral(" class=\"form\""); WriteLiteral(" style=\"width: 450px\""); -WriteLiteral(">\r\n \r\n \r\n \r\n
    Name:\r\n " + -"\r\n"); +WriteLiteral(">\r\n \r\n \r\n \r\n \r\n \r\n \r\n Description:\r\n \r\n \r\n \r\n \r\n #line 40 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" if (canConfig) - { - - #line default - #line hidden - - #line 41 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" - Write(Html.EditorFor(model => model.UserFlag.Name)); - - - #line default - #line hidden - - #line 41 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" - + { #line default #line hidden #line 42 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + Write(Html.EditorFor(model => model.UserFlag.Name)); + + + #line default + #line hidden + + #line 42 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + + + + #line default + #line hidden + + #line 43 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 42 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 43 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 43 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 44 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 43 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 44 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" @@ -186,7 +187,7 @@ WriteLiteral(">\r\n $(function () {\r\n " \'"); - #line 49 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 50 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Url.Action(MVC.API.UserFlag.UpdateName(Model.UserFlag.Id))); @@ -196,7 +197,7 @@ WriteLiteral("\',\r\n \'FlagName\'\r\n " });\r\n \r\n"); - #line 54 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 55 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } else { @@ -205,14 +206,14 @@ WriteLiteral("\',\r\n \'FlagName\'\r\n #line default #line hidden - #line 57 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 58 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Model.UserFlag.Name); #line default #line hidden - #line 57 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 58 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } @@ -223,55 +224,56 @@ WriteLiteral(" \r\n \r\n \r\n " Description:\r\n \r\n \r\n \r\n \r\n ""); - #line 101 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 103 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Model.CurrentAssignmentCount); @@ -376,7 +378,7 @@ WriteLiteral(" \r\n \r\n \r\n WriteLiteral(" user"); - #line 101 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 103 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Model.CurrentAssignmentCount != 1 ? "s" : null); @@ -385,7 +387,7 @@ WriteLiteral(" user"); WriteLiteral(" currently assigned\r\n
    "); - #line 102 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 104 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Model.TotalAssignmentCount); @@ -394,7 +396,7 @@ WriteLiteral(" currently assigned
    \r\n
    "); WriteLiteral(" total user historical assignment"); - #line 102 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 104 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Model.TotalAssignmentCount != 1 ? "s" : null); @@ -408,7 +410,7 @@ WriteLiteral(" id=\"Config_UserFlags_Icon\""); WriteLiteral(" data-icon=\""); - #line 110 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 112 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Model.UserFlag.Icon); @@ -419,7 +421,7 @@ WriteLiteral("\""); WriteLiteral(" data-colour=\""); - #line 110 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 112 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Model.UserFlag.IconColour); @@ -427,52 +429,52 @@ WriteLiteral(" data-colour=\""); #line hidden WriteLiteral("\""); -WriteAttribute("class", Tuple.Create(" class=\"", 4608), Tuple.Create("\"", 4681) -, Tuple.Create(Tuple.Create("", 4616), Tuple.Create("fa", 4616), true) -, Tuple.Create(Tuple.Create(" ", 4618), Tuple.Create("fa-", 4619), true) +WriteAttribute("class", Tuple.Create(" class=\"", 4656), Tuple.Create("\"", 4729) +, Tuple.Create(Tuple.Create("", 4664), Tuple.Create("fa", 4664), true) +, Tuple.Create(Tuple.Create(" ", 4666), Tuple.Create("fa-", 4667), true) - #line 110 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" - , Tuple.Create(Tuple.Create("", 4622), Tuple.Create(Model.UserFlag.Icon + #line 112 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + , Tuple.Create(Tuple.Create("", 4670), Tuple.Create(Model.UserFlag.Icon #line default #line hidden -, 4622), false) -, Tuple.Create(Tuple.Create(" ", 4644), Tuple.Create("fa-4x", 4645), true) -, Tuple.Create(Tuple.Create(" ", 4650), Tuple.Create("d-", 4651), true) +, 4670), false) +, Tuple.Create(Tuple.Create(" ", 4692), Tuple.Create("fa-4x", 4693), true) +, Tuple.Create(Tuple.Create(" ", 4698), Tuple.Create("d-", 4699), true) - #line 110 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" - , Tuple.Create(Tuple.Create("", 4653), Tuple.Create(Model.UserFlag.IconColour + #line 112 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + , Tuple.Create(Tuple.Create("", 4701), Tuple.Create(Model.UserFlag.IconColour #line default #line hidden -, 4653), false) +, 4701), false) ); WriteLiteral(">\r\n"); - #line 111 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 113 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 111 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 113 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" if (canConfig) { #line default #line hidden -WriteLiteral("
    \r\n \r\n Update\r\n Update\r\n \r\n
    \r\n \r\n"); + + + #line 118 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + + + #line default + #line hidden + + #line 118 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + using (Html.BeginForm(MVC.API.UserFlag.UpdateIconAndColour(id: Model.UserFlag.Id, redirect: true))) + { + + + #line default + #line hidden + + #line 120 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + Write(Html.AntiForgeryToken()); + + + #line default + #line hidden + + #line 120 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + + + + #line default + #line hidden +WriteLiteral(" \r\n"); + +WriteLiteral(" \r\n"); + + + #line 123 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + } + + + #line default + #line hidden +WriteLiteral("
    \r\n \r\n"); - #line 118 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 126 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 118 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 126 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" foreach (var colour in Model.ThemeColours) { @@ -505,7 +560,7 @@ WriteLiteral("
    \r\n " iconCode = $this.attr(\'data-icon\');\r\n\r\n ic" + "ons.find(\'i\').removeClass(\'selected\');\r\n $thi" + "s.addClass(\'selected\');\r\n }\r\n\r\n " + -" function save() {\r\n var url = \'" + -""); +" function save() {\r\n dialog.dial" + +"og(\"option\", \"buttons\", null);\r\n const $form " + +"= dialog.find(\'form\');\r\n $form.find(\'input[na" + +"me=\"icon\"]\').val(icons.find(\'i.selected\').attr(\'data-icon\'));\r\n " + +" $form.find(\'input[name=\"iconColour\"]\').val(colours.find(\'i.se" + +"lected\').attr(\'data-colour\'));\r\n $form.trigge" + +"r(\'submit\');\r\n }\r\n\r\n " + +" function cancel() {\r\n $(this).dialog(\"clos" + +"e\");\r\n }\r\n\r\n $(fun" + +"ction () {\r\n icon = $(\'#Config_UserFlags_Icon" + +"\');\r\n $(\'#Config_UserFlags_Icon_Update\').clic" + +"k(showDialog);\r\n });\r\n " + +" }());\r\n \r\n
    \r\n"); - #line 186 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" - Write(Url.Action(MVC.API.UserFlag.UpdateIconAndColour(id: Model.UserFlag.Id, redirect: true))); - - - #line default - #line hidden -WriteLiteral(@"', - data = { - Icon: icons.find('i.selected').attr('data-icon'), - IconColour: colours.find('i.selected').attr('data-colour') - }; - window.location.href = url + '&' + $.param(data); - - dialog.dialog(""disable""); - dialog.dialog(""option"", ""buttons"", null); - } - - function cancel() { - $(this).dialog(""close""); - } - - $(function () { - icon = $('#Config_UserFlags_Icon'); - $('#Config_UserFlags_Icon_Update').click(showDialog); - }); - }()); - -
    -"); - - - #line 208 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 212 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } @@ -690,13 +725,13 @@ WriteLiteral(@"', WriteLiteral(" \r\n
    \r\n"); - #line 211 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 215 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 211 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 215 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" if (hideAdvanced) { @@ -730,7 +765,7 @@ WriteLiteral(@">Show Advanced Options "); - #line 227 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 231 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } @@ -744,13 +779,13 @@ WriteLiteral(">\r\n \r\n \r\n \r\n
    \r\n N" + +"ame:\r\n \r\n"); WriteLiteral(" "); #line 16 "..\..\Areas\Config\Views\UserFlag\Create.cshtml" - Write(Html.EditorFor(model => model.UserFlag.Name)); + Write(Html.EditorFor(model => model.Name)); #line default @@ -112,19 +98,20 @@ WriteLiteral("
    "); #line 16 "..\..\Areas\Config\Views\UserFlag\Create.cshtml" - Write(Html.ValidationMessageFor(model => model.UserFlag.Name)); + Write(Html.ValidationMessageFor(model => model.Name)); #line default #line hidden WriteLiteral("\r\n
    \r\n"); +">\r\n Description:\r\n \r\n " + +"\r\n"); WriteLiteral(" "); - #line 23 "..\..\Areas\Config\Views\UserFlag\Create.cshtml" - Write(Html.EditorFor(model => model.UserFlag.Description)); + #line 24 "..\..\Areas\Config\Views\UserFlag\Create.cshtml" + Write(Html.EditorFor(model => model.Description)); #line default @@ -132,8 +119,8 @@ WriteLiteral(" "); WriteLiteral("
    "); - #line 23 "..\..\Areas\Config\Views\UserFlag\Create.cshtml" - Write(Html.ValidationMessageFor(model => model.UserFlag.Description)); + #line 24 "..\..\Areas\Config\Views\UserFlag\Create.cshtml" + Write(Html.ValidationMessageFor(model => model.Description)); #line default @@ -156,11 +143,11 @@ WriteLiteral(" \r\n $(function () {\r\n $(\'#UserFlag_Name\').focus().select();\r\n " + -" });\r\n \r\n"); +WriteLiteral(">\r\n $(function () {\r\n $(\'#Name\').focus().select();\r\n });" + +"\r\n \r\n"); - #line 36 "..\..\Areas\Config\Views\UserFlag\Create.cshtml" + #line 37 "..\..\Areas\Config\Views\UserFlag\Create.cshtml" } #line default diff --git a/Disco.Web/Areas/Config/Views/UserFlag/Show.cshtml b/Disco.Web/Areas/Config/Views/UserFlag/Show.cshtml index f78f4443..163079a5 100644 --- a/Disco.Web/Areas/Config/Views/UserFlag/Show.cshtml +++ b/Disco.Web/Areas/Config/Views/UserFlag/Show.cshtml @@ -38,7 +38,8 @@
    @if (canConfig) - {@Html.EditorFor(model => model.UserFlag.Name) + { + @Html.EditorFor(model => model.UserFlag.Name) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader() diff --git a/Disco.Web/Areas/Config/Views/UserFlag/Show.generated.cs b/Disco.Web/Areas/Config/Views/UserFlag/Show.generated.cs index 6a5a709c..9b5714b8 100644 --- a/Disco.Web/Areas/Config/Views/UserFlag/Show.generated.cs +++ b/Disco.Web/Areas/Config/Views/UserFlag/Show.generated.cs @@ -130,47 +130,48 @@ WriteLiteral("\r\n
    \r\n"); - #line 66 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 67 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 66 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 67 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" if (canConfig) { - - #line default - #line hidden - - #line 67 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" - Write(Html.EditorFor(model => model.UserFlag.Description)); - - - #line default - #line hidden - - #line 67 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" - #line default #line hidden - #line 68 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 69 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + Write(Html.EditorFor(model => model.UserFlag.Description)); + + + #line default + #line hidden + + #line 69 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + + + + #line default + #line hidden + + #line 70 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 68 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 70 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 69 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 71 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 69 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 71 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" @@ -289,7 +291,7 @@ WriteLiteral(@"> '"); - #line 75 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 77 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Url.Action(MVC.API.UserFlag.UpdateDescription(Model.UserFlag.Id))); @@ -299,7 +301,7 @@ WriteLiteral("\',\r\n \'Description\'\r\n "\r\n });\r\n \r\n"); - #line 80 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 82 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } else { @@ -310,13 +312,13 @@ WriteLiteral("\',\r\n \'Description\'\r\n WriteLiteral("
    \r\n");
     
                 
    -            #line 84 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
    +            #line 86 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
                         
                 
                 #line default
                 #line hidden
                 
    -            #line 84 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
    +            #line 86 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
                          if (string.IsNullOrEmpty(Model.UserFlag.Description))
                         {
     
    @@ -330,7 +332,7 @@ WriteLiteral("<None>");
     WriteLiteral("\r\n");
     
                 
    -            #line 87 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
    +            #line 89 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
                         }
                         else
                         {
    @@ -339,14 +341,14 @@ WriteLiteral("\r\n");
                 #line default
                 #line hidden
                 
    -            #line 90 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
    +            #line 92 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
                        Write(Model.UserFlag.Description.ToHtmlComment());
     
                 
                 #line default
                 #line hidden
                 
    -            #line 90 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
    +            #line 92 "..\..\Areas\Config\Views\UserFlag\Show.cshtml"
                                                                        
                         }
     
    @@ -356,7 +358,7 @@ WriteLiteral("\r\n");
     WriteLiteral("                    
    \r\n"); - #line 93 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 95 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } @@ -367,7 +369,7 @@ WriteLiteral("
    \r\n On Assignment
    Expres "
    \r\n"); - #line 233 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 237 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 233 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 237 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" if (canConfig) { @@ -758,56 +793,56 @@ WriteLiteral(">\r\n \r\n On Assignment
    Expres #line default #line hidden - #line 235 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 239 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Html.EditorFor(model => model.UserFlag.OnAssignmentExpression)); #line default #line hidden - #line 235 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 239 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 236 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 240 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(AjaxHelpers.AjaxRemove()); #line default #line hidden - #line 236 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 240 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 237 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 241 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 237 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 241 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 238 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 242 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 238 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 242 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" @@ -829,7 +864,7 @@ WriteLiteral(@"> '"); - #line 248 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 252 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Url.Action(MVC.API.UserFlag.UpdateOnAssignmentExpression(Model.UserFlag.Id))); @@ -857,7 +892,7 @@ WriteLiteral("\',\r\n \'OnAssignmentExpressio " \r\n"); - #line 277 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 281 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } else { @@ -874,7 +909,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>\r\n"); - #line 283 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 287 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } else { @@ -891,7 +926,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 287 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 291 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Model.UserFlag.OnAssignmentExpression); @@ -900,7 +935,7 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n"); - #line 289 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 293 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } } @@ -930,13 +965,13 @@ WriteLiteral(">\r\n
    \r\n On Unassignment
    Expr "
    \r\n"); - #line 303 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 307 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 303 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 307 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" if (canConfig) { @@ -944,56 +979,56 @@ WriteLiteral(">\r\n \r\n On Unassignment
    Expr #line default #line hidden - #line 305 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 309 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Html.EditorFor(model => model.UserFlag.OnUnassignmentExpression)); #line default #line hidden - #line 305 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 309 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 306 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 310 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(AjaxHelpers.AjaxRemove()); #line default #line hidden - #line 306 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 310 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 307 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 311 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(AjaxHelpers.AjaxSave()); #line default #line hidden - #line 307 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 311 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 308 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 312 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(AjaxHelpers.AjaxLoader()); #line default #line hidden - #line 308 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 312 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" @@ -1015,7 +1050,7 @@ WriteLiteral(@"> '"); - #line 318 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 322 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Url.Action(MVC.API.UserFlag.UpdateOnUnassignmentExpression(Model.UserFlag.Id))); @@ -1053,7 +1088,7 @@ WriteLiteral(@"', "); - #line 347 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 351 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } else { @@ -1070,7 +1105,7 @@ WriteLiteral(" class=\"smallMessage\""); WriteLiteral("><None Specified>\r\n"); - #line 353 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 357 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } else { @@ -1087,7 +1122,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 357 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 361 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Model.UserFlag.OnUnassignmentExpression); @@ -1096,7 +1131,7 @@ WriteLiteral(" "); WriteLiteral("\r\n \r\n"); - #line 359 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 363 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } } @@ -1128,7 +1163,7 @@ WriteLiteral(">\r\n
    \r\n Linked Groups:\r\n WriteLiteral(" "); - #line 375 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 379 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel() { CanConfigure = canConfig, @@ -1147,7 +1182,7 @@ WriteLiteral("\r\n"); WriteLiteral(" "); - #line 384 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 388 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel() { CanConfigure = canConfig, @@ -1164,28 +1199,28 @@ WriteLiteral(" "); WriteLiteral("\r\n"); - #line 393 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 397 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 393 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 397 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" if (canConfig) - { + { #line default #line hidden - #line 395 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 399 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupShared)); #line default #line hidden - #line 395 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 399 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } @@ -1195,7 +1230,7 @@ WriteLiteral("\r\n"); WriteLiteral(" \r\n \r\n
    \r\n\r\n"); - #line 402 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 406 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" if (canBulkAssignment || canDelete || canShowUsers || canExportCurrent || canExportAll) { @@ -1209,13 +1244,13 @@ WriteLiteral(" class=\"actionBar\""); WriteLiteral(">\r\n"); - #line 405 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 409 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" #line default #line hidden - #line 405 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 409 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" if (canExportCurrent) { @@ -1223,14 +1258,14 @@ WriteLiteral(">\r\n"); #line default #line hidden - #line 407 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 411 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Html.ActionLinkButton("Export Current Assignments", MVC.Config.UserFlag.Export(null, Model.UserFlag.Id, true), "Config_UserFlags_Actions_ExportCurrent_Button")); #line default #line hidden - #line 407 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 411 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } @@ -1240,7 +1275,7 @@ WriteLiteral(">\r\n"); WriteLiteral(" "); - #line 409 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 413 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" if (canExportAll) { @@ -1248,14 +1283,14 @@ WriteLiteral(" "); #line default #line hidden - #line 411 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 415 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(Html.ActionLinkButton("Export All Assignments", MVC.Config.UserFlag.Export(null, Model.UserFlag.Id, false), "Config_UserFlags_Actions_ExportAll_Button")); #line default #line hidden - #line 411 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 415 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" } @@ -1265,7 +1300,7 @@ WriteLiteral(" "); WriteLiteral(" "); - #line 413 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 417 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" if (canBulkAssignment) { @@ -1351,7 +1386,7 @@ WriteLiteral(">\r\n user6
    \r\n WriteLiteral(" "); - #line 446 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 450 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(ActiveDirectory.Context.PrimaryDomain.NetBiosName); @@ -1364,7 +1399,7 @@ WriteLiteral(" class=\"code\""); WriteLiteral(">user6,smi0099,"); - #line 448 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 452 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(ActiveDirectory.Context.PrimaryDomain.NetBiosName); @@ -1377,7 +1412,7 @@ WriteLiteral(" class=\"code\""); WriteLiteral(">user6;smi0099;"); - #line 449 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" + #line 453 "..\..\Areas\Config\Views\UserFlag\Show.cshtml" Write(ActiveDirectory.Context.PrimaryDomain.NetBiosName); @@ -1401,7 +1436,40 @@ WriteLiteral(" action=\"#\""); WriteLiteral(" method=\"post\""); -WriteLiteral(">\r\n