security: use more antiforgery tokens
This commit is contained in:
@@ -66,54 +66,54 @@ namespace Disco.BI.Extensions
|
|||||||
return CreateExpressions(templateFileName, database);
|
return CreateExpressions(templateFileName, database);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Dictionary<string, Expression> PdfExpressionsFromCache(this DocumentTemplate dt, DiscoDataContext Database)
|
public static Dictionary<string, Expression> PdfExpressionsFromCache(this DocumentTemplate dt, DiscoDataContext database)
|
||||||
{
|
{
|
||||||
return ExpressionCache.GetOrCreateExpressions(dt, () => CreateExpressions(dt, Database));
|
return ExpressionCache.GetOrCreateExpressions(dt, () => CreateExpressions(dt, database));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<DocumentField> PdfFieldsFromCache(this DocumentTemplate dt, DiscoDataContext Database)
|
public static List<DocumentField> PdfFieldsFromCache(this DocumentTemplate dt, DiscoDataContext database)
|
||||||
{
|
{
|
||||||
return ExpressionCache.GetOrCreateFields(dt, () => CreateExpressions(dt, Database));
|
return ExpressionCache.GetOrCreateFields(dt, () => CreateExpressions(dt, database));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Expression> ExtractPdfExpressions(this DocumentTemplate dt, DiscoDataContext Database)
|
public static List<Expression> 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);
|
bool generateExpression = !string.IsNullOrEmpty(dt.OnGenerateExpression);
|
||||||
string generateExpressionResult = null;
|
string generateExpressionResult = null;
|
||||||
|
|
||||||
if (generateExpression)
|
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)
|
if (generateExpression)
|
||||||
DocumentsLog.LogDocumentGenerated(dt, Target, CreatorUser, generateExpressionResult);
|
DocumentsLog.LogDocumentGenerated(dt, target, creatorUser, generateExpressionResult);
|
||||||
else
|
else
|
||||||
DocumentsLog.LogDocumentGenerated(dt, Target, CreatorUser);
|
DocumentsLog.LogDocumentGenerated(dt, target, creatorUser);
|
||||||
|
|
||||||
return pdfStream;
|
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<string> DataObjectsIds)
|
public static Stream GeneratePdfPackageBulk(this DocumentTemplatePackage package, DiscoDataContext database, User creatorUser, DateTime timestamp, bool? insertBlankPages, List<string> 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<IAttachmentTarget> DataObjects)
|
public static Stream GeneratePdfPackageBulk(this DocumentTemplatePackage package, DiscoDataContext database, User creatorUser, DateTime timestamp, bool? insertBlankPages, List<IAttachmentTarget> 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<bool> PdfPageHasAttachmentId(this DocumentTemplate dt, DiscoDataContext Database)
|
public static List<bool> PdfPageHasAttachmentId(this DocumentTemplate dt, DiscoDataContext database)
|
||||||
{
|
{
|
||||||
string templateFilename = dt.RepositoryFilename(Database);
|
string templateFilename = dt.RepositoryFilename(database);
|
||||||
if (!File.Exists(templateFilename))
|
if (!File.Exists(templateFilename))
|
||||||
throw new FileNotFoundException("PDF template not found", templateFilename);
|
throw new FileNotFoundException("PDF template not found", templateFilename);
|
||||||
|
|
||||||
|
|||||||
@@ -21,16 +21,16 @@ namespace Disco.BI.Interop.Pdf
|
|||||||
{
|
{
|
||||||
public static class PdfGenerator
|
public static class PdfGenerator
|
||||||
{
|
{
|
||||||
public static Stream GenerateBulkFromPackage(DocumentTemplatePackage package, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, List<IAttachmentTarget> DataObjects)
|
public static Stream GenerateBulkFromPackage(DocumentTemplatePackage package, DiscoDataContext database, User creatorUser, DateTime timestamp, bool? insertBlankPages, List<IAttachmentTarget> dataObjects)
|
||||||
{
|
{
|
||||||
if (DataObjects.Count > 0)
|
if (dataObjects.Count > 0)
|
||||||
{
|
{
|
||||||
List<Stream> generatedPdfs = new List<Stream>(DataObjects.Count);
|
List<Stream> generatedPdfs = new List<Stream>(dataObjects.Count);
|
||||||
using (var state = DocumentState.DefaultState())
|
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.SequenceNumber++;
|
||||||
state.FlushScopeCache();
|
state.FlushScopeCache();
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ namespace Disco.BI.Interop.Pdf
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Stream bulkPdf = Utilities.JoinPdfs(package.InsertBlankPages || InsertBlankPages, generatedPdfs);
|
Stream bulkPdf = Utilities.JoinPdfs(insertBlankPages.GetValueOrDefault(package.InsertBlankPages), generatedPdfs);
|
||||||
foreach (Stream singlePdf in generatedPdfs)
|
foreach (Stream singlePdf in generatedPdfs)
|
||||||
singlePdf.Dispose();
|
singlePdf.Dispose();
|
||||||
return bulkPdf;
|
return bulkPdf;
|
||||||
@@ -50,25 +50,25 @@ namespace Disco.BI.Interop.Pdf
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Stream GenerateBulkFromPackage(DocumentTemplatePackage package, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, List<string> DataObjectsIds)
|
public static Stream GenerateBulkFromPackage(DocumentTemplatePackage package, DiscoDataContext database, User creatorUser, DateTime timestamp, bool? insertBlankPages, List<string> dataObjectsIds)
|
||||||
{
|
{
|
||||||
List<IAttachmentTarget> DataObjects;
|
List<IAttachmentTarget> DataObjects;
|
||||||
|
|
||||||
switch (package.Scope)
|
switch (package.Scope)
|
||||||
{
|
{
|
||||||
case AttachmentTypes.Device:
|
case AttachmentTypes.Device:
|
||||||
DataObjects = Database.Devices.Where(d => DataObjectsIds.Contains(d.SerialNumber)).ToList<IAttachmentTarget>();
|
DataObjects = database.Devices.Where(d => dataObjectsIds.Contains(d.SerialNumber)).ToList<IAttachmentTarget>();
|
||||||
break;
|
break;
|
||||||
case AttachmentTypes.Job:
|
case AttachmentTypes.Job:
|
||||||
int[] intDataObjectsIds = DataObjectsIds.Select(i => int.Parse(i)).ToArray();
|
int[] intDataObjectsIds = dataObjectsIds.Select(i => int.Parse(i)).ToArray();
|
||||||
DataObjects = Database.Jobs.Where(j => intDataObjectsIds.Contains(j.Id)).ToList<IAttachmentTarget>();
|
DataObjects = database.Jobs.Where(j => intDataObjectsIds.Contains(j.Id)).ToList<IAttachmentTarget>();
|
||||||
break;
|
break;
|
||||||
case AttachmentTypes.User:
|
case AttachmentTypes.User:
|
||||||
DataObjects = new List<IAttachmentTarget>(DataObjectsIds.Count);
|
DataObjects = new List<IAttachmentTarget>(dataObjectsIds.Count);
|
||||||
for (int idIndex = 0; idIndex < DataObjectsIds.Count; idIndex++)
|
for (int idIndex = 0; idIndex < dataObjectsIds.Count; idIndex++)
|
||||||
{
|
{
|
||||||
string dataObjectId = DataObjectsIds[idIndex];
|
string dataObjectId = dataObjectsIds[idIndex];
|
||||||
var user = UserService.GetUser(ActiveDirectory.ParseDomainAccountId(dataObjectId), Database, true);
|
var user = UserService.GetUser(ActiveDirectory.ParseDomainAccountId(dataObjectId), database, true);
|
||||||
if (user == null)
|
if (user == null)
|
||||||
throw new Exception($"Unknown Username specified: {dataObjectId}");
|
throw new Exception($"Unknown Username specified: {dataObjectId}");
|
||||||
DataObjects.Add(user);
|
DataObjects.Add(user);
|
||||||
@@ -78,12 +78,12 @@ namespace Disco.BI.Interop.Pdf
|
|||||||
throw new InvalidOperationException("Invalid DocumentType Scope");
|
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)
|
if (templates.Count == 0)
|
||||||
return null;
|
return null;
|
||||||
@@ -92,21 +92,21 @@ namespace Disco.BI.Interop.Pdf
|
|||||||
string generateExpressionResult = null;
|
string generateExpressionResult = null;
|
||||||
|
|
||||||
if (generateExpression)
|
if (generateExpression)
|
||||||
generateExpressionResult = package.EvaluateOnGenerateExpression(Data, Database, CreatorUser, Timestamp, State);
|
generateExpressionResult = package.EvaluateOnGenerateExpression(data, database, creatorUser, timestamp, state);
|
||||||
|
|
||||||
List<Stream> generatedPdfs = new List<Stream>(templates.Count);
|
List<Stream> generatedPdfs = new List<Stream>(templates.Count);
|
||||||
foreach (var template in templates)
|
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.SequenceNumber++;
|
||||||
State.FlushScopeCache();
|
state.FlushScopeCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (generateExpression)
|
if (generateExpression)
|
||||||
DocumentsLog.LogDocumentPackageGenerated(package, Data, CreatorUser, generateExpressionResult);
|
DocumentsLog.LogDocumentPackageGenerated(package, data, creatorUser, generateExpressionResult);
|
||||||
else
|
else
|
||||||
DocumentsLog.LogDocumentPackageGenerated(package, Data, CreatorUser);
|
DocumentsLog.LogDocumentPackageGenerated(package, data, creatorUser);
|
||||||
|
|
||||||
if (generatedPdfs.Count == 1)
|
if (generatedPdfs.Count == 1)
|
||||||
{
|
{
|
||||||
@@ -120,20 +120,20 @@ namespace Disco.BI.Interop.Pdf
|
|||||||
return bulkPdf;
|
return bulkPdf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static Stream GenerateBulkFromTemplate(DocumentTemplate dt, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, List<IAttachmentTarget> DataObjects, IScheduledTaskStatus taskStatus)
|
public static Stream GenerateBulkFromTemplate(DocumentTemplate dt, DiscoDataContext database, User creatorUser, DateTime timestamp, bool insertBlankPages, List<IAttachmentTarget> dataObjects, IScheduledTaskStatus taskStatus)
|
||||||
{
|
{
|
||||||
if (DataObjects.Count > 0)
|
if (dataObjects.Count > 0)
|
||||||
{
|
{
|
||||||
List<Stream> generatedPdfs = new List<Stream>(DataObjects.Count);
|
List<Stream> generatedPdfs = new List<Stream>(dataObjects.Count);
|
||||||
var progressPerDoc = 80d / DataObjects.Count;
|
var progressPerDoc = 80d / dataObjects.Count;
|
||||||
var progressDoc = 10d;
|
var progressDoc = 10d;
|
||||||
using (var state = DocumentState.DefaultState())
|
using (var state = DocumentState.DefaultState())
|
||||||
{
|
{
|
||||||
taskStatus.UpdateStatus(10, "Rendering", "Starting");
|
taskStatus.UpdateStatus(10, "Rendering", "Starting");
|
||||||
foreach (var d in DataObjects)
|
foreach (var d in dataObjects)
|
||||||
{
|
{
|
||||||
taskStatus.UpdateStatus(progressDoc += progressPerDoc, $"Rendering {d.AttachmentReferenceId}");
|
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.SequenceNumber++;
|
||||||
state.FlushScopeCache();
|
state.FlushScopeCache();
|
||||||
}
|
}
|
||||||
@@ -145,7 +145,7 @@ namespace Disco.BI.Interop.Pdf
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
taskStatus.UpdateStatus(90, "Merging", "Merging documents");
|
taskStatus.UpdateStatus(90, "Merging", "Merging documents");
|
||||||
Stream bulkPdf = Utilities.JoinPdfs(InsertBlankPages, generatedPdfs);
|
Stream bulkPdf = Utilities.JoinPdfs(insertBlankPages, generatedPdfs);
|
||||||
foreach (Stream singlePdf in generatedPdfs)
|
foreach (Stream singlePdf in generatedPdfs)
|
||||||
singlePdf.Dispose();
|
singlePdf.Dispose();
|
||||||
return bulkPdf;
|
return bulkPdf;
|
||||||
@@ -154,28 +154,28 @@ namespace Disco.BI.Interop.Pdf
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Stream GenerateBulkFromTemplate(DocumentTemplate dt, DiscoDataContext Database, User CreatorUser, DateTime Timestamp, bool InsertBlankPages, List<string> DataObjectsIds, IScheduledTaskStatus taskStatus)
|
public static Stream GenerateBulkFromTemplate(DocumentTemplate dt, DiscoDataContext database, User creatorUser, DateTime timestamp, bool insertBlankPages, List<string> dataObjectsIds, IScheduledTaskStatus taskStatus)
|
||||||
{
|
{
|
||||||
Dictionary<string, IAttachmentTarget> dataObjectLookup;
|
Dictionary<string, IAttachmentTarget> dataObjectLookup;
|
||||||
List<string> dataObjectIds = DataObjectsIds;
|
List<string> dataObjectIds = dataObjectsIds;
|
||||||
|
|
||||||
taskStatus.UpdateStatus(0, "Resolving targets", "Resolving render targets");
|
taskStatus.UpdateStatus(0, "Resolving targets", "Resolving render targets");
|
||||||
|
|
||||||
switch (dt.Scope)
|
switch (dt.Scope)
|
||||||
{
|
{
|
||||||
case DocumentTemplate.DocumentTemplateScopes.Device:
|
case DocumentTemplate.DocumentTemplateScopes.Device:
|
||||||
dataObjectLookup = Database.Devices.Where(d => DataObjectsIds.Contains(d.SerialNumber)).AsEnumerable().Cast<IAttachmentTarget>().ToDictionary(i => i.AttachmentReferenceId, StringComparer.OrdinalIgnoreCase);
|
dataObjectLookup = database.Devices.Where(d => dataObjectsIds.Contains(d.SerialNumber)).AsEnumerable().Cast<IAttachmentTarget>().ToDictionary(i => i.AttachmentReferenceId, StringComparer.OrdinalIgnoreCase);
|
||||||
break;
|
break;
|
||||||
case DocumentTemplate.DocumentTemplateScopes.Job:
|
case DocumentTemplate.DocumentTemplateScopes.Job:
|
||||||
var intDataObjectsIds = DataObjectsIds.Select(i => int.Parse(i)).ToList();
|
var intDataObjectsIds = dataObjectsIds.Select(i => int.Parse(i)).ToList();
|
||||||
dataObjectLookup = Database.Jobs.Where(j => intDataObjectsIds.Contains(j.Id)).AsEnumerable().Cast<IAttachmentTarget>().ToDictionary(i => i.AttachmentReferenceId, StringComparer.OrdinalIgnoreCase);
|
dataObjectLookup = database.Jobs.Where(j => intDataObjectsIds.Contains(j.Id)).AsEnumerable().Cast<IAttachmentTarget>().ToDictionary(i => i.AttachmentReferenceId, StringComparer.OrdinalIgnoreCase);
|
||||||
break;
|
break;
|
||||||
case DocumentTemplate.DocumentTemplateScopes.User:
|
case DocumentTemplate.DocumentTemplateScopes.User:
|
||||||
dataObjectLookup = new Dictionary<string, IAttachmentTarget>(DataObjectsIds.Count, StringComparer.OrdinalIgnoreCase);
|
dataObjectLookup = new Dictionary<string, IAttachmentTarget>(dataObjectsIds.Count, StringComparer.OrdinalIgnoreCase);
|
||||||
dataObjectIds = new List<string>(DataObjectsIds.Count);
|
dataObjectIds = new List<string>(dataObjectsIds.Count);
|
||||||
foreach (var userId in DataObjectsIds)
|
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)
|
if (user == null)
|
||||||
{
|
{
|
||||||
dataObjectIds.Add(userId);
|
dataObjectIds.Add(userId);
|
||||||
@@ -190,7 +190,7 @@ namespace Disco.BI.Interop.Pdf
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recreate list to honor the sort-order provided in DataObjectsIds
|
// recreate list to honor the sort-order provided in DataObjectsIds
|
||||||
var dataObjects = new List<IAttachmentTarget>(DataObjectsIds.Count);
|
var dataObjects = new List<IAttachmentTarget>(dataObjectsIds.Count);
|
||||||
var missingIds = new List<string>();
|
var missingIds = new List<string>();
|
||||||
foreach (var id in dataObjectIds)
|
foreach (var id in dataObjectIds)
|
||||||
{
|
{
|
||||||
@@ -204,10 +204,10 @@ namespace Disco.BI.Interop.Pdf
|
|||||||
throw new Exception($"Unknown id specified: {string.Join("; ", missingIds)}");
|
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
|
// Validate Data
|
||||||
switch (dt.Scope)
|
switch (dt.Scope)
|
||||||
@@ -232,7 +232,7 @@ namespace Disco.BI.Interop.Pdf
|
|||||||
|
|
||||||
// Override FlattenFields if Document Template instructs.
|
// Override FlattenFields if Document Template instructs.
|
||||||
if (dt.FlattenForm)
|
if (dt.FlattenForm)
|
||||||
FlattenFields = true;
|
flattenFields = true;
|
||||||
|
|
||||||
var expressionCache = dt.PdfExpressionsFromCache(Database);
|
var expressionCache = dt.PdfExpressionsFromCache(Database);
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ namespace Disco.BI.Interop.Pdf
|
|||||||
MemoryStream pdfGeneratedStream = new MemoryStream();
|
MemoryStream pdfGeneratedStream = new MemoryStream();
|
||||||
PdfStamper pdfStamper = new PdfStamper(pdfReader, pdfGeneratedStream);
|
PdfStamper pdfStamper = new PdfStamper(pdfReader, pdfGeneratedStream);
|
||||||
|
|
||||||
pdfStamper.FormFlattening = FlattenFields;
|
pdfStamper.FormFlattening = flattenFields;
|
||||||
pdfStamper.Writer.CloseStream = false;
|
pdfStamper.Writer.CloseStream = false;
|
||||||
|
|
||||||
IDictionary expressionVariables = Expression.StandardVariables(dt, Database, CreatorUser, TimeStamp, State, Data);
|
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];
|
AcroFields.Item fields = pdfStamper.AcroFields.Fields[pdfFieldKey];
|
||||||
string fieldValue = dt.CreateUniqueIdentifier(Database, Data, CreatorUser, TimeStamp, 0).ToJson();
|
string fieldValue = dt.CreateUniqueIdentifier(Database, Data, CreatorUser, TimeStamp, 0).ToJson();
|
||||||
if (FlattenFields)
|
if (flattenFields)
|
||||||
pdfStamper.AcroFields.SetField(pdfFieldKey, string.Empty);
|
pdfStamper.AcroFields.SetField(pdfFieldKey, string.Empty);
|
||||||
else
|
else
|
||||||
pdfStamper.AcroFields.SetField(pdfFieldKey, fieldValue);
|
pdfStamper.AcroFields.SetField(pdfFieldKey, fieldValue);
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
{
|
{
|
||||||
public interface ConfigAuthorizationRoleCreateModel : BaseUIModel
|
public interface ConfigAuthorizationRoleCreateModel : BaseUIModel
|
||||||
{
|
{
|
||||||
Repository.AuthorizationRole AuthorizationRole { get; set; }
|
string Name { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
namespace Disco.Models.UI.Config.DeviceBatch
|
using System;
|
||||||
|
|
||||||
|
namespace Disco.Models.UI.Config.DeviceBatch
|
||||||
{
|
{
|
||||||
public interface ConfigDeviceBatchCreateModel : BaseUIModel
|
public interface ConfigDeviceBatchCreateModel : BaseUIModel
|
||||||
{
|
{
|
||||||
Repository.DeviceBatch DeviceBatch { get; set; }
|
string Name { get; set; }
|
||||||
|
DateTime PurchaseDate { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
{
|
{
|
||||||
public interface ConfigDeviceFlagCreateModel : BaseUIModel
|
public interface ConfigDeviceFlagCreateModel : BaseUIModel
|
||||||
{
|
{
|
||||||
Repository.DeviceFlag DeviceFlag { get; set; }
|
string Name { get; set; }
|
||||||
|
string Description { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
{
|
{
|
||||||
public interface ConfigDeviceProfileCreateModel : BaseUIModel
|
public interface ConfigDeviceProfileCreateModel : BaseUIModel
|
||||||
{
|
{
|
||||||
Repository.DeviceProfile DeviceProfile { get; set; }
|
string Name { get; set; }
|
||||||
|
string ShortName { get; set; }
|
||||||
|
string Description { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ namespace Disco.Models.UI.Config.DocumentTemplate
|
|||||||
{
|
{
|
||||||
public interface ConfigDocumentTemplateCreateModel : BaseUIModel
|
public interface ConfigDocumentTemplateCreateModel : BaseUIModel
|
||||||
{
|
{
|
||||||
Repository.DocumentTemplate DocumentTemplate { get; set; }
|
string Id { get; set; }
|
||||||
|
string Description { get; set; }
|
||||||
|
string Scope { get; set; }
|
||||||
|
|
||||||
List<string> Types { get; set; }
|
List<string> Types { get; set; }
|
||||||
List<string> SubTypes { get; set; }
|
List<string> SubTypes { get; set; }
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
using Disco.Models.Services.Documents;
|
using Disco.Models.Repository;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Disco.Models.UI.Config.DocumentTemplate
|
namespace Disco.Models.UI.Config.DocumentTemplate
|
||||||
{
|
{
|
||||||
public interface ConfigDocumentTemplateCreatePackageModel : BaseUIModel
|
public interface ConfigDocumentTemplateCreatePackageModel : BaseUIModel
|
||||||
{
|
{
|
||||||
DocumentTemplatePackage Package { get; set; }
|
string Id { get; set; }
|
||||||
|
string Description { get; set; }
|
||||||
|
AttachmentTypes Scope { get; set; }
|
||||||
|
|
||||||
List<string> Scopes { get; }
|
List<string> Scopes { get; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Disco.Models.Services.Documents;
|
using Disco.Models.Services.Documents;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Disco.Models.UI.Config.DocumentTemplate
|
namespace Disco.Models.UI.Config.DocumentTemplate
|
||||||
@@ -9,7 +10,7 @@ namespace Disco.Models.UI.Config.DocumentTemplate
|
|||||||
int StoredInstanceCount { get; set; }
|
int StoredInstanceCount { get; set; }
|
||||||
List<bool> TemplatePagesHaveAttachmentId { get; set; }
|
List<bool> TemplatePagesHaveAttachmentId { get; set; }
|
||||||
int TemplatePageCount { get; }
|
int TemplatePageCount { get; }
|
||||||
string BulkGenerateDownloadId { get; }
|
Guid? BulkGenerateDownloadId { get; }
|
||||||
string BulkGenerateDownloadFilename { get; }
|
string BulkGenerateDownloadFilename { get; }
|
||||||
|
|
||||||
List<Repository.UserFlag> UserFlags { get; set; }
|
List<Repository.UserFlag> UserFlags { get; set; }
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
{
|
{
|
||||||
public interface ConfigJobQueueCreateModel : BaseUIModel
|
public interface ConfigJobQueueCreateModel : BaseUIModel
|
||||||
{
|
{
|
||||||
Repository.JobQueue JobQueue { get; set; }
|
string Name { get; set; }
|
||||||
|
string Description { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
{
|
{
|
||||||
public interface ConfigUserFlagCreateModel : BaseUIModel
|
public interface ConfigUserFlagCreateModel : BaseUIModel
|
||||||
{
|
{
|
||||||
Repository.UserFlag UserFlag { get; set; }
|
string Name { get; set; }
|
||||||
|
string Description { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,25 +45,23 @@ namespace Disco.Services.Devices.DeviceFlags
|
|||||||
public static DeviceFlag GetDeviceFlag(int deviceFlagId) { return _cache.GetDeviceFlag(deviceFlagId); }
|
public static DeviceFlag GetDeviceFlag(int deviceFlagId) { return _cache.GetDeviceFlag(deviceFlagId); }
|
||||||
|
|
||||||
#region Device Flag Maintenance
|
#region Device Flag Maintenance
|
||||||
public static DeviceFlag CreateDeviceFlag(DiscoDataContext database, DeviceFlag deviceFlag)
|
public static DeviceFlag CreateDeviceFlag(DiscoDataContext database, string name, string description)
|
||||||
{
|
{
|
||||||
// Verify
|
// Verify
|
||||||
if (string.IsNullOrWhiteSpace(deviceFlag.Name))
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
throw new ArgumentException("The Device Flag Name is required", nameof(deviceFlag));
|
throw new ArgumentException("The Device Flag Name is required", nameof(name));
|
||||||
|
|
||||||
// Name Unique
|
// Name Unique
|
||||||
if (_cache.GetDeviceFlags().Any(f => f.Name == deviceFlag.Name))
|
if (_cache.GetDeviceFlags().Any(f => f.Name.Equals(name, StringComparison.Ordinal)))
|
||||||
throw new ArgumentException("Another Device Flag already exists with that name", nameof(deviceFlag));
|
throw new ArgumentException("Another Device Flag already exists with that name", nameof(name));
|
||||||
|
|
||||||
// Clone to break reference
|
// Clone to break reference
|
||||||
var flag = new DeviceFlag()
|
var flag = new DeviceFlag()
|
||||||
{
|
{
|
||||||
Name = deviceFlag.Name,
|
Name = name,
|
||||||
Description = deviceFlag.Description,
|
Description = description,
|
||||||
Icon = deviceFlag.Icon,
|
Icon = RandomUnusedIcon(),
|
||||||
IconColour = deviceFlag.IconColour,
|
IconColour = RandomUnusedThemeColour(),
|
||||||
DevicesLinkedGroup = deviceFlag.DevicesLinkedGroup,
|
|
||||||
DeviceUsersLinkedGroup = deviceFlag.DeviceUsersLinkedGroup,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
database.DeviceFlags.Add(flag);
|
database.DeviceFlags.Add(flag);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Disco.Services.Documents
|
|||||||
Directory.Delete(cachePath, true);
|
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 cachePath = GetCachePath(database);
|
||||||
var path = Path.Combine(cachePath, $"{id}.pdf");
|
var path = Path.Combine(cachePath, $"{id}.pdf");
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Disco.Data.Repository;
|
using Disco.Data.Repository;
|
||||||
using Disco.Models.Repository;
|
using Disco.Models.Repository;
|
||||||
using Disco.Models.Services.Documents;
|
using Disco.Models.Services.Documents;
|
||||||
|
using Disco.Models.UI.Config.DocumentTemplate;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -121,19 +122,26 @@ namespace Disco.Services.Documents
|
|||||||
return packages;
|
return packages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DocumentTemplatePackage CreatePackage(DocumentTemplatePackage Package)
|
public static DocumentTemplatePackage CreatePackage(string id, string description, AttachmentTypes scope)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(Package.Id))
|
if (string.IsNullOrWhiteSpace(id))
|
||||||
throw new ArgumentNullException(nameof(Package), "The Package Id is required");
|
throw new ArgumentNullException(nameof(id), "The Package Id is required");
|
||||||
if (cache.ContainsKey(Package.Id)) // Name Unique
|
if (cache.ContainsKey(id)) // Name Unique
|
||||||
throw new ArgumentException("Another Package already exists with that Id", nameof(Package));
|
throw new ArgumentException("Another Package already exists with that Id", nameof(id));
|
||||||
if (string.IsNullOrWhiteSpace(Package.Description))
|
if (string.IsNullOrWhiteSpace(description))
|
||||||
throw new ArgumentNullException(nameof(Package), "The Package Description is required");
|
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();
|
PersistCache();
|
||||||
return Package;
|
return package;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw new Exception("Unable to add the Package to the Cache, check the Package Id and try again");
|
throw new Exception("Unable to add the Package to the Cache, check the Package Id and try again");
|
||||||
|
|||||||
@@ -28,41 +28,24 @@ namespace Disco.Services.Jobs.JobQueues
|
|||||||
public static JobQueueToken GetQueue(int JobQueueId) { return _cache.GetQueue(JobQueueId); }
|
public static JobQueueToken GetQueue(int JobQueueId) { return _cache.GetQueue(JobQueueId); }
|
||||||
|
|
||||||
#region Job Queues Maintenance
|
#region Job Queues Maintenance
|
||||||
public static JobQueueToken CreateJobQueue(DiscoDataContext Database, JobQueue JobQueue)
|
public static JobQueueToken CreateJobQueue(DiscoDataContext Database, string name, string description)
|
||||||
{
|
{
|
||||||
// Verify
|
// Verify
|
||||||
if (string.IsNullOrWhiteSpace(JobQueue.Name))
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
throw new ArgumentException("The Job Queue Name is required");
|
throw new ArgumentException("The Job Queue Name is required");
|
||||||
|
|
||||||
// Name Unique
|
// 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");
|
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
|
// Clone to break reference
|
||||||
var queue = new JobQueue()
|
var queue = new JobQueue()
|
||||||
{
|
{
|
||||||
Name = JobQueue.Name,
|
Name = name,
|
||||||
Description = JobQueue.Description,
|
Description = description,
|
||||||
Icon = JobQueue.Icon,
|
Icon = RandomUnusedIcon(),
|
||||||
IconColour = JobQueue.IconColour,
|
IconColour = RandomUnusedThemeColour(),
|
||||||
DefaultSLAExpiry = JobQueue.DefaultSLAExpiry,
|
Priority = JobQueuePriority.Normal,
|
||||||
Priority = JobQueue.Priority,
|
|
||||||
SubjectIds = JobQueue.SubjectIds
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Database.JobQueues.Add(queue);
|
Database.JobQueues.Add(queue);
|
||||||
@@ -85,15 +68,6 @@ namespace Disco.Services.Jobs.JobQueues
|
|||||||
{
|
{
|
||||||
JobQueue.SubjectIds = null;
|
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();
|
Database.SaveChanges();
|
||||||
|
|
||||||
|
|||||||
@@ -45,25 +45,23 @@ namespace Disco.Services.Users.UserFlags
|
|||||||
public static UserFlag GetUserFlag(int UserFlagId) { return _cache.GetUserFlag(UserFlagId); }
|
public static UserFlag GetUserFlag(int UserFlagId) { return _cache.GetUserFlag(UserFlagId); }
|
||||||
|
|
||||||
#region User Flag Maintenance
|
#region User Flag Maintenance
|
||||||
public static UserFlag CreateUserFlag(DiscoDataContext Database, UserFlag UserFlag)
|
public static UserFlag CreateUserFlag(DiscoDataContext Database, string name, string description)
|
||||||
{
|
{
|
||||||
// Verify
|
// Verify
|
||||||
if (string.IsNullOrWhiteSpace(UserFlag.Name))
|
if (string.IsNullOrWhiteSpace(name))
|
||||||
throw new ArgumentException("The User Flag Name is required");
|
throw new ArgumentException("The User Flag Name is required", nameof(name));
|
||||||
|
|
||||||
// Name Unique
|
// Name Unique
|
||||||
if (_cache.GetUserFlags().Any(f => f.Name == UserFlag.Name))
|
if (_cache.GetUserFlags().Any(f => f.Name.Equals(name, StringComparison.Ordinal)))
|
||||||
throw new ArgumentException("Another User Flag already exists with that name", "UserFlag");
|
throw new ArgumentException("Another User Flag already exists with that name", nameof(name));
|
||||||
|
|
||||||
// Clone to break reference
|
// Clone to break reference
|
||||||
var flag = new UserFlag()
|
var flag = new UserFlag()
|
||||||
{
|
{
|
||||||
Name = UserFlag.Name,
|
Name = name,
|
||||||
Description = UserFlag.Description,
|
Description = description,
|
||||||
Icon = UserFlag.Icon,
|
Icon = RandomUnusedIcon(),
|
||||||
IconColour = UserFlag.IconColour,
|
IconColour = RandomUnusedThemeColour(),
|
||||||
UsersLinkedGroup = UserFlag.UsersLinkedGroup,
|
|
||||||
UserDevicesLinkedGroup = UserFlag.UserDevicesLinkedGroup
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Database.UserFlags.Add(flag);
|
Database.UserFlags.Add(flag);
|
||||||
|
|||||||
@@ -138,26 +138,28 @@ namespace Disco.Services.Users
|
|||||||
return Cache.InvalidateRecord(UserId);
|
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");
|
throw new ArgumentNullException("Role");
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(Role.ClaimsJson))
|
var role = new AuthorizationRole()
|
||||||
Role.ClaimsJson = JsonConvert.SerializeObject(new RoleClaims());
|
{
|
||||||
|
Name = name,
|
||||||
Database.AuthorizationRoles.Add(Role);
|
ClaimsJson = JsonConvert.SerializeObject(new RoleClaims()),
|
||||||
|
};
|
||||||
|
Database.AuthorizationRoles.Add(role);
|
||||||
Database.SaveChanges();
|
Database.SaveChanges();
|
||||||
|
|
||||||
AuthorizationLog.LogRoleCreated(Role, CurrentUserId);
|
AuthorizationLog.LogRoleCreated(role, CurrentUserId);
|
||||||
|
|
||||||
// Add to Cache
|
// Add to Cache
|
||||||
RoleCache.AddRole(Role);
|
RoleCache.AddRole(role);
|
||||||
|
|
||||||
// Flush User Cache
|
// Flush User Cache
|
||||||
Cache.FlushCache();
|
Cache.FlushCache();
|
||||||
|
|
||||||
return Role.Id;
|
return role.Id;
|
||||||
}
|
}
|
||||||
public static void DeleteAuthorizationRole(DiscoDataContext Database, AuthorizationRole Role)
|
public static void DeleteAuthorizationRole(DiscoDataContext Database, AuthorizationRole Role)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
const string pName = "name";
|
const string pName = "name";
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false)
|
public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -40,19 +40,19 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Json("Invalid Authorization Role Id", JsonRequestBehavior.AllowGet);
|
return BadRequest("Invalid Authorization Role Id");
|
||||||
}
|
}
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.AuthorizationRole.Index(authorizationRole.Id));
|
return RedirectToAction(MVC.Config.AuthorizationRole.Index(authorizationRole.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
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);
|
AuthorizationLog.LogRoleConfiguredClaimsAdded(AuthorizationRole, CurrentUser.UserId, addedClaims);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSubjects(AuthorizationRole AuthorizationRole, string[] Subjects)
|
private void UpdateSubjects(AuthorizationRole AuthorizationRole, string[] subjects)
|
||||||
{
|
{
|
||||||
string subjectIds = null;
|
string subjectIds = null;
|
||||||
string[] removedSubjects = null;
|
string[] removedSubjects = null;
|
||||||
string[] addedSubjects = null;
|
string[] addedSubjects = null;
|
||||||
|
|
||||||
// Validate Subjects
|
// 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))
|
.Where(s => !string.IsNullOrWhiteSpace(s))
|
||||||
.Select(s => s.Trim())
|
.Select(s => s.Trim())
|
||||||
.Select(s => Tuple.Create(s, ActiveDirectory.RetrieveADObject(s, Quick: true)))
|
.Select(s => Tuple.Create(s, ActiveDirectory.RetrieveADObject(s, Quick: true)))
|
||||||
.Where(s => s.Item2 is ADUserAccount || s.Item2 is ADGroup)
|
.Where(s => s.Item2 is ADUserAccount || s.Item2 is ADGroup)
|
||||||
.ToList();
|
.ToList();
|
||||||
var invalidSubjects = subjects.Where(s => s.Item2 == null).ToList();
|
var invalidSubjects = subjectRecords.Where(s => s.Item2 == null).ToList();
|
||||||
|
|
||||||
if (invalidSubjects.Count > 0)
|
if (invalidSubjects.Count > 0)
|
||||||
throw new ArgumentException($"Subjects not found: {string.Join(", ", invalidSubjects)}", "Subjects");
|
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(',');
|
var currentSubjects = AuthorizationRole.SubjectIds == null ? new string[0] : AuthorizationRole.SubjectIds.Split(',');
|
||||||
removedSubjects = currentSubjects.Except(proposedSubjects).ToArray();
|
removedSubjects = currentSubjects.Except(proposedSubjects).ToArray();
|
||||||
addedSubjects = proposedSubjects.Except(currentSubjects).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)
|
public virtual ActionResult UpdateName(int id, string RoleName = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pName, RoleName, redirect);
|
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
|
try
|
||||||
{
|
{
|
||||||
@@ -154,26 +156,27 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
var authorizationRole = Database.AuthorizationRoles.Find(id);
|
var authorizationRole = Database.AuthorizationRoles.Find(id);
|
||||||
if (authorizationRole != null)
|
if (authorizationRole != null)
|
||||||
{
|
{
|
||||||
UpdateClaims(authorizationRole, ClaimKeys);
|
UpdateClaims(authorizationRole, claimKeys);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Json("Invalid Authorization Role Id", JsonRequestBehavior.AllowGet);
|
return BadRequest("Invalid Authorization Role Id");
|
||||||
}
|
}
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.AuthorizationRole.Index(authorizationRole.Id));
|
return RedirectToAction(MVC.Config.AuthorizationRole.Index(authorizationRole.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
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)
|
public virtual ActionResult UpdateSubjects(int id, string[] Subjects = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -188,26 +191,26 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Json("Invalid Authorization Role Id", JsonRequestBehavior.AllowGet);
|
return BadRequest("Invalid Authorization Role Id");
|
||||||
}
|
}
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.AuthorizationRole.Index(authorizationRole.Id));
|
return RedirectToAction(MVC.Config.AuthorizationRole.Index(authorizationRole.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Actions
|
#region Actions
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Delete(int id, bool? redirect = false)
|
public virtual ActionResult Delete(int id, bool? redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -220,7 +223,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.AuthorizationRole.Index(null));
|
return RedirectToAction(MVC.Config.AuthorizationRole.Index(null));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
throw new Exception("Invalid Authorization Role Id");
|
throw new Exception("Invalid Authorization Role Id");
|
||||||
}
|
}
|
||||||
@@ -229,33 +232,33 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateAdministratorSubjects(string[] Subjects, bool redirect = false)
|
public virtual ActionResult UpdateAdministratorSubjects(string[] subjects, bool redirect = false)
|
||||||
{
|
{
|
||||||
string[] proposedSubjects;
|
string[] proposedSubjects;
|
||||||
string[] removedSubjects = null;
|
string[] removedSubjects = null;
|
||||||
string[] addedSubjects = null;
|
string[] addedSubjects = null;
|
||||||
|
|
||||||
// Validate Subjects
|
// 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");
|
throw new ArgumentNullException("Subjects", "At least one Id must be supplied");
|
||||||
|
|
||||||
var subjects = Subjects
|
var subjectValues = subjects
|
||||||
.Where(s => !string.IsNullOrWhiteSpace(s))
|
.Where(s => !string.IsNullOrWhiteSpace(s))
|
||||||
.Select(s => s.Trim())
|
.Select(s => s.Trim())
|
||||||
.Select(s => Tuple.Create(s, ActiveDirectory.RetrieveADObject(s, Quick: true)))
|
.Select(s => Tuple.Create(s, ActiveDirectory.RetrieveADObject(s, Quick: true)))
|
||||||
.Where(s => s.Item2 is ADUserAccount || s.Item2 is ADGroup)
|
.Where(s => s.Item2 is ADUserAccount || s.Item2 is ADGroup)
|
||||||
.ToList();
|
.ToList();
|
||||||
var invalidSubjects = subjects.Where(s => s.Item2 == null).ToList();
|
var invalidSubjects = subjectValues.Where(s => s.Item2 == null).ToList();
|
||||||
|
|
||||||
if (invalidSubjects.Count > 0)
|
if (invalidSubjects.Count > 0)
|
||||||
throw new ArgumentException($"Subjects not found: {string.Join(", ", invalidSubjects)}", "Subjects");
|
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;
|
var currentSubjects = UserService.AdministratorSubjectIds;
|
||||||
removedSubjects = currentSubjects.Except(proposedSubjects).ToArray();
|
removedSubjects = currentSubjects.Except(proposedSubjects).ToArray();
|
||||||
addedSubjects = proposedSubjects.Except(currentSubjects).ToArray();
|
addedSubjects = proposedSubjects.Except(currentSubjects).ToArray();
|
||||||
@@ -270,7 +273,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.AuthorizationRole.Index());
|
return RedirectToAction(MVC.Config.AuthorizationRole.Index());
|
||||||
else
|
else
|
||||||
return Json("OK");
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,6 +9,7 @@ using Disco.Services.Web;
|
|||||||
using Disco.Web.Extensions;
|
using Disco.Web.Extensions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Data.Entity;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
@@ -35,6 +36,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
const string pAssignedUsersLinkedGroup = "assigneduserslinkedgroup";
|
const string pAssignedUsersLinkedGroup = "assigneduserslinkedgroup";
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false)
|
public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
Authorization.Require(Claims.Config.DeviceBatch.Configure);
|
Authorization.Require(Claims.Config.DeviceBatch.Configure);
|
||||||
@@ -104,109 +106,124 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Json("Invalid Device Batch Id", JsonRequestBehavior.AllowGet);
|
return BadRequest("Invalid Device Batch Id");
|
||||||
}
|
}
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.DeviceBatch.Index(deviceBatch.Id));
|
return RedirectToAction(MVC.Config.DeviceBatch.Index(deviceBatch.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Update Shortcut Methods
|
#region Update Shortcut Methods
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateName(int id, string BatchName = null, bool redirect = false)
|
public virtual ActionResult UpdateName(int id, string BatchName = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pName, BatchName, redirect);
|
return Update(id, pName, BatchName, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdatePurchaseDate(int id, string PurchaseDate = null, bool redirect = false)
|
public virtual ActionResult UpdatePurchaseDate(int id, string PurchaseDate = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pPurchaseDate, PurchaseDate, redirect);
|
return Update(id, pPurchaseDate, PurchaseDate, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateSupplier(int id, string Supplier = null, bool redirect = false)
|
public virtual ActionResult UpdateSupplier(int id, string Supplier = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pSupplier, Supplier, redirect);
|
return Update(id, pSupplier, Supplier, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
public virtual ActionResult UpdatePurchaseDetails(int id, string PurchaseDetails = null, bool redirect = false)
|
[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)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateUnitCost(int id, string UnitCost = null, bool redirect = false)
|
public virtual ActionResult UpdateUnitCost(int id, string UnitCost = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pUnitCost, UnitCost, redirect);
|
return Update(id, pUnitCost, UnitCost, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateUnitQuantity(int id, string UnitQuantity = null, bool redirect = false)
|
public virtual ActionResult UpdateUnitQuantity(int id, string UnitQuantity = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pUnitQuantity, UnitQuantity, redirect);
|
return Update(id, pUnitQuantity, UnitQuantity, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDefaultDeviceModelId(int id, string DefaultDeviceModelId = null, bool redirect = false)
|
public virtual ActionResult UpdateDefaultDeviceModelId(int id, string DefaultDeviceModelId = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pDefaultDeviceModelId, DefaultDeviceModelId, redirect);
|
return Update(id, pDefaultDeviceModelId, DefaultDeviceModelId, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateWarrantyValidUntil(int id, string WarrantyValidUntil = null, bool redirect = false)
|
public virtual ActionResult UpdateWarrantyValidUntil(int id, string WarrantyValidUntil = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pWarrantyValidUntil, WarrantyValidUntil, redirect);
|
return Update(id, pWarrantyValidUntil, WarrantyValidUntil, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)]
|
[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)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuredDate(int id, string InsuredDate = null, bool redirect = false)
|
public virtual ActionResult UpdateInsuredDate(int id, string InsuredDate = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuredDate, InsuredDate, redirect);
|
return Update(id, pInsuredDate, InsuredDate, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceSupplier(int id, string InsuranceSupplier = null, bool redirect = false)
|
public virtual ActionResult UpdateInsuranceSupplier(int id, string InsuranceSupplier = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceSupplier, InsuranceSupplier, redirect);
|
return Update(id, pInsuranceSupplier, InsuranceSupplier, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuredUntil(int id, string InsuredUntil = null, bool redirect = false)
|
public virtual ActionResult UpdateInsuredUntil(int id, string InsuredUntil = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuredUntil, InsuredUntil, redirect);
|
return Update(id, pInsuredUntil, InsuredUntil, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)]
|
[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)]
|
[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)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDevicesLinkedGroup(int id, string GroupId = null, bool redirect = false)
|
public virtual ActionResult UpdateDevicesLinkedGroup(int id, string GroupId = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -228,17 +245,18 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateAssignedUsersLinkedGroup(int id, string GroupId = null, bool redirect = false)
|
public virtual ActionResult UpdateAssignedUsersLinkedGroup(int id, string GroupId = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -260,42 +278,42 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Update Properties
|
#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");
|
throw new ArgumentNullException("Name", "Device Batch Name is required");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Check for Duplicates
|
// 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)
|
if (d > 0)
|
||||||
{
|
{
|
||||||
throw new Exception("A Device Batch with that name already exists");
|
throw new Exception("A Device Batch with that name already exists");
|
||||||
}
|
}
|
||||||
deviceBatch.Name = Name;
|
deviceBatch.Name = name;
|
||||||
}
|
}
|
||||||
Database.SaveChanges();
|
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");
|
throw new ArgumentNullException("PurchaseDate", "A Device Batch Purchase Date is required");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (DateTime.TryParse(PurchaseDate, out var ecd))
|
if (DateTime.TryParse(purchaseDate, out var ecd))
|
||||||
{
|
{
|
||||||
deviceBatch.PurchaseDate = ecd.Date;
|
deviceBatch.PurchaseDate = ecd.Date;
|
||||||
}
|
}
|
||||||
@@ -306,48 +324,48 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
Database.SaveChanges();
|
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;
|
deviceBatch.Supplier = null;
|
||||||
else
|
else
|
||||||
deviceBatch.Supplier = Supplier;
|
deviceBatch.Supplier = supplier;
|
||||||
Database.SaveChanges();
|
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;
|
deviceBatch.PurchaseDetails = null;
|
||||||
else
|
else
|
||||||
deviceBatch.PurchaseDetails = PurchaseDetails;
|
deviceBatch.PurchaseDetails = purchaseDetails;
|
||||||
Database.SaveChanges();
|
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;
|
deviceBatch.UnitCost = null;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (decimal.TryParse(UnitCost, out var unitCost))
|
unitCost = unitCost.Trim();
|
||||||
{
|
if (unitCost.StartsWith("$"))
|
||||||
deviceBatch.UnitCost = unitCost;
|
unitCost = unitCost.Substring(1).Trim(); // Remove $ sign if present
|
||||||
}
|
|
||||||
|
if (decimal.TryParse(unitCost, out var unitCostValue))
|
||||||
|
deviceBatch.UnitCost = unitCostValue;
|
||||||
else
|
else
|
||||||
{
|
|
||||||
throw new Exception("Invalid Currency Format");
|
throw new Exception("Invalid Currency Format");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Database.SaveChanges();
|
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;
|
deviceBatch.UnitQuantity = null;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (int.TryParse(UnitQuantity, out var unitQuantity))
|
if (int.TryParse(unitQuantity, out var unitQuantityValue))
|
||||||
{
|
{
|
||||||
deviceBatch.UnitQuantity = unitQuantity;
|
deviceBatch.UnitQuantity = unitQuantityValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -356,11 +374,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
Database.SaveChanges();
|
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);
|
var dm = Database.DeviceModels.Find(bId);
|
||||||
if (dm != null)
|
if (dm != null)
|
||||||
@@ -384,13 +402,13 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
throw new Exception("Invalid Device Model Id");
|
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;
|
deviceBatch.WarrantyValidUntil = null;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (DateTime.TryParse(WarrantyValidUntil, out var ecd))
|
if (DateTime.TryParse(warrantyValidUntil, out var ecd))
|
||||||
{
|
{
|
||||||
deviceBatch.WarrantyValidUntil = ecd.Date;
|
deviceBatch.WarrantyValidUntil = ecd.Date;
|
||||||
}
|
}
|
||||||
@@ -401,21 +419,21 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
Database.SaveChanges();
|
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;
|
deviceBatch.WarrantyDetails = null;
|
||||||
else
|
else
|
||||||
deviceBatch.WarrantyDetails = WarrantyDetails;
|
deviceBatch.WarrantyDetails = warrantyDetails;
|
||||||
Database.SaveChanges();
|
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;
|
deviceBatch.InsuredDate = null;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (DateTime.TryParse(InsuredDate, out var ecd))
|
if (DateTime.TryParse(insuredDate, out var ecd))
|
||||||
{
|
{
|
||||||
deviceBatch.InsuredDate = ecd.Date;
|
deviceBatch.InsuredDate = ecd.Date;
|
||||||
}
|
}
|
||||||
@@ -426,21 +444,21 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
Database.SaveChanges();
|
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;
|
deviceBatch.InsuranceSupplier = null;
|
||||||
else
|
else
|
||||||
deviceBatch.InsuranceSupplier = InsuranceSupplier;
|
deviceBatch.InsuranceSupplier = insuranceSupplier;
|
||||||
Database.SaveChanges();
|
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;
|
deviceBatch.InsuredUntil = null;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (DateTime.TryParse(InsuredUntil, out var ecd))
|
if (DateTime.TryParse(insuredUntil, out var ecd))
|
||||||
{
|
{
|
||||||
deviceBatch.InsuredUntil = ecd.Date;
|
deviceBatch.InsuredUntil = ecd.Date;
|
||||||
}
|
}
|
||||||
@@ -451,26 +469,26 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
Database.SaveChanges();
|
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;
|
deviceBatch.InsuranceDetails = null;
|
||||||
else
|
else
|
||||||
deviceBatch.InsuranceDetails = InsuranceDetails;
|
deviceBatch.InsuranceDetails = insuranceDetails;
|
||||||
Database.SaveChanges();
|
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;
|
deviceBatch.Comments = null;
|
||||||
else
|
else
|
||||||
deviceBatch.Comments = Comments;
|
deviceBatch.Comments = comments;
|
||||||
Database.SaveChanges();
|
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)
|
if (DeviceBatch.DevicesLinkedGroup != configJson)
|
||||||
{
|
{
|
||||||
@@ -485,9 +503,9 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return null;
|
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)
|
if (DeviceBatch.AssignedUsersLinkedGroup != configJson)
|
||||||
{
|
{
|
||||||
@@ -506,6 +524,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Actions
|
#region Actions
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Delete)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Delete)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Delete(int id, bool? redirect = false)
|
public virtual ActionResult Delete(int id, bool? redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -518,7 +537,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.DeviceBatch.Index(null));
|
return RedirectToAction(MVC.Config.DeviceBatch.Index(null));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
throw new Exception("Invalid Device Batch Number");
|
throw new Exception("Invalid Device Batch Number");
|
||||||
}
|
}
|
||||||
@@ -527,7 +546,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -536,6 +555,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Index
|
#region Index
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Show)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Show)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Index(int? id)
|
public virtual ActionResult Index(int? id)
|
||||||
{
|
{
|
||||||
if (id.HasValue)
|
if (id.HasValue)
|
||||||
@@ -556,6 +576,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Timeline
|
#region Timeline
|
||||||
|
|
||||||
[DiscoAuthorizeAll(Claims.Config.DeviceBatch.Show, Claims.Config.DeviceBatch.ShowTimeline)]
|
[DiscoAuthorizeAll(Claims.Config.DeviceBatch.Show, Claims.Config.DeviceBatch.ShowTimeline)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Timeline()
|
public virtual ActionResult Timeline()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -601,7 +622,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Attachements
|
#region Attachments
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Show)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Show)]
|
||||||
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
|
[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))
|
if (string.IsNullOrEmpty(contentType) || contentType.Equals("unknown/unknown", StringComparison.OrdinalIgnoreCase))
|
||||||
contentType = MimeTypes.ResolveMimeType(file.FileName);
|
contentType = MimeTypes.ResolveMimeType(file.FileName);
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(comments))
|
||||||
|
comments = null;
|
||||||
|
|
||||||
var attachment = new DeviceBatchAttachment()
|
var attachment = new DeviceBatchAttachment()
|
||||||
{
|
{
|
||||||
DeviceBatchId = batch.Id,
|
DeviceBatchId = batch.Id,
|
||||||
@@ -687,7 +711,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
[DiscoAuthorize(Claims.Config.DeviceBatch.Show)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Show)]
|
||||||
public virtual ActionResult Attachment(int id)
|
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)
|
if (attachment != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -699,13 +723,13 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
return Json(m, JsonRequestBehavior.AllowGet);
|
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)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Show)]
|
||||||
public virtual ActionResult Attachments(int id)
|
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)
|
if (batch != null)
|
||||||
{
|
{
|
||||||
var m = new Models.Attachment.AttachmentsModel()
|
var m = new Models.Attachment.AttachmentsModel()
|
||||||
@@ -716,20 +740,21 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
return Json(m, JsonRequestBehavior.AllowGet);
|
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)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult AttachmentRemove(int id)
|
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)
|
if (attachment != null)
|
||||||
{
|
{
|
||||||
attachment.OnDelete(Database);
|
attachment.OnDelete(Database);
|
||||||
Database.SaveChanges();
|
Database.SaveChanges();
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
return Json("Invalid Attachment Number", JsonRequestBehavior.AllowGet);
|
return BadRequest("Invalid Attachment Number");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceCertificate.DownloadCertificates)]
|
[DiscoAuthorize(Claims.Config.DeviceCertificate.DownloadCertificates)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Download(int id)
|
public virtual ActionResult Download(int id)
|
||||||
{
|
{
|
||||||
var wc = Database.DeviceCertificates.Find(id);
|
var wc = Database.DeviceCertificates.Find(id);
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
public partial class DeviceController : AuthorizedDatabaseController
|
public partial class DeviceController : AuthorizedDatabaseController
|
||||||
{
|
{
|
||||||
|
|
||||||
const string pDeviceProfileId = "deviceprofileid";
|
const string pDeviceProfileId = "deviceprofileid";
|
||||||
const string pDeviceBatchId = "devicebatchid";
|
const string pDeviceBatchId = "devicebatchid";
|
||||||
const string pAssetNumber = "assetnumber";
|
const string pAssetNumber = "assetnumber";
|
||||||
@@ -37,6 +36,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
const string pDetailBattery = "detailbattery";
|
const string pDetailBattery = "detailbattery";
|
||||||
const string pDetailKeyboard = "detailkeyboard";
|
const string pDetailKeyboard = "detailkeyboard";
|
||||||
|
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
|
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
Database.Configuration.LazyLoadingEnabled = true;
|
Database.Configuration.LazyLoadingEnabled = true;
|
||||||
@@ -99,20 +99,21 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Device.Show(device.SerialNumber));
|
return RedirectToAction(MVC.Device.Show(device.SerialNumber));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Update Shortcut Methods
|
#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)
|
public virtual ActionResult UpdateDeviceProfileId(string id, string DeviceProfileId = null, bool enforceOrganisationalUnit = false, bool redirect = false)
|
||||||
{
|
{
|
||||||
var updateResult = Update(id, pDeviceProfileId, DeviceProfileId, redirect);
|
var updateResult = Update(id, pDeviceProfileId, DeviceProfileId, redirect);
|
||||||
@@ -163,24 +164,28 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Device.Properties.DeviceBatch)]
|
[DiscoAuthorize(Claims.Device.Properties.DeviceBatch)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDeviceBatchId(string id, string DeviceBatchId = null, bool redirect = false)
|
public virtual ActionResult UpdateDeviceBatchId(string id, string DeviceBatchId = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pDeviceBatchId, DeviceBatchId, redirect);
|
return Update(id, pDeviceBatchId, DeviceBatchId, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Device.Properties.AssetNumber)]
|
[DiscoAuthorize(Claims.Device.Properties.AssetNumber)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateAssetNumber(string id, string AssetNumber = null, bool redirect = false)
|
public virtual ActionResult UpdateAssetNumber(string id, string AssetNumber = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pAssetNumber, AssetNumber, redirect);
|
return Update(id, pAssetNumber, AssetNumber, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Device.Properties.Location)]
|
[DiscoAuthorize(Claims.Device.Properties.Location)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateLocation(string id, string Location = null, bool redirect = false)
|
public virtual ActionResult UpdateLocation(string id, string Location = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pLocation, Location, redirect);
|
return Update(id, pLocation, Location, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Device.Actions.AssignUser)]
|
[DiscoAuthorize(Claims.Device.Actions.AssignUser)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateAssignedUserId(string id, string AssignedUserId = null, bool redirect = false)
|
public virtual ActionResult UpdateAssignedUserId(string id, string AssignedUserId = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(AssignedUserId))
|
if (!string.IsNullOrWhiteSpace(AssignedUserId))
|
||||||
@@ -190,24 +195,28 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Device.Actions.AllowUnauthenticatedEnrol)]
|
[DiscoAuthorize(Claims.Device.Actions.AllowUnauthenticatedEnrol)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateAllowUnauthenticatedEnrol(string id, string AllowUnauthenticatedEnrol = null, bool redirect = false)
|
public virtual ActionResult UpdateAllowUnauthenticatedEnrol(string id, string AllowUnauthenticatedEnrol = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pAllowUnauthenticatedEnrol, AllowUnauthenticatedEnrol, redirect);
|
return Update(id, pAllowUnauthenticatedEnrol, AllowUnauthenticatedEnrol, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Device.Properties.Details)]
|
[DiscoAuthorize(Claims.Device.Properties.Details)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDetailACAdapter(string id, string DetailACAdapter = null, bool redirect = false)
|
public virtual ActionResult UpdateDetailACAdapter(string id, string DetailACAdapter = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pDetailACAdapter, DetailACAdapter, redirect);
|
return Update(id, pDetailACAdapter, DetailACAdapter, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Device.Properties.Details)]
|
[DiscoAuthorize(Claims.Device.Properties.Details)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDetailBattery(string id, string DetailBattery = null, bool redirect = false)
|
public virtual ActionResult UpdateDetailBattery(string id, string DetailBattery = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pDetailBattery, DetailBattery, redirect);
|
return Update(id, pDetailBattery, DetailBattery, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Device.Properties.Details)]
|
[DiscoAuthorize(Claims.Device.Properties.Details)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDetailKeyboard(string id, string DetailKeyboard = null, bool redirect = false)
|
public virtual ActionResult UpdateDetailKeyboard(string id, string DetailKeyboard = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pDetailKeyboard, DetailKeyboard, redirect);
|
return Update(id, pDetailKeyboard, DetailKeyboard, redirect);
|
||||||
@@ -344,31 +353,36 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Device Actions
|
#region Device Actions
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Device.Actions.Decommission)]
|
[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);
|
var d = Database.Devices.Find(id);
|
||||||
Database.Configuration.LazyLoadingEnabled = true;
|
Database.Configuration.LazyLoadingEnabled = true;
|
||||||
if (d != null)
|
if (d != null)
|
||||||
{
|
{
|
||||||
if (d.CanDecommission())
|
if (d.CanDecommission())
|
||||||
{
|
{
|
||||||
d.OnDecommission((DecommissionReasons)Reason, Database);
|
d.OnDecommission((DecommissionReasons)Reason.Value, Database);
|
||||||
|
|
||||||
Database.SaveChanges();
|
Database.SaveChanges();
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Device.Show(id));
|
return RedirectToAction(MVC.Device.Show(id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
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)]
|
[DiscoAuthorize(Claims.Device.Actions.Recommission)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Recommission(string id, bool redirect)
|
public virtual ActionResult Recommission(string id, bool redirect)
|
||||||
{
|
{
|
||||||
var d = Database.Devices.Find(id);
|
var d = Database.Devices.Find(id);
|
||||||
@@ -383,17 +397,18 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Device.Show(id));
|
return RedirectToAction(MVC.Device.Show(id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
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)]
|
[DiscoAuthorize(Claims.Device.Actions.Delete)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Delete(string id, bool redirect)
|
public virtual ActionResult Delete(string id, bool redirect)
|
||||||
{
|
{
|
||||||
var j = Database.Devices.Find(id);
|
var j = Database.Devices.Find(id);
|
||||||
@@ -408,43 +423,20 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Device.Index());
|
return RedirectToAction(MVC.Device.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
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
|
#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)]
|
[DiscoAuthorize(Claims.Device.Show)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult LastNetworkLogonDate(string id)
|
public virtual ActionResult LastNetworkLogonDate(string id)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(id))
|
if (string.IsNullOrWhiteSpace(id))
|
||||||
@@ -585,7 +577,8 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return HttpNotFound("Invalid Attachment Number");
|
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)
|
public virtual ActionResult AttachmentUpload(string id, string comments)
|
||||||
{
|
{
|
||||||
var d = Database.Devices.Find(id);
|
var d = Database.Devices.Find(id);
|
||||||
@@ -644,7 +637,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
return Json(m, JsonRequestBehavior.AllowGet);
|
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)]
|
[DiscoAuthorize(Claims.Device.ShowAttachments)]
|
||||||
@@ -661,10 +654,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
return Json(m, JsonRequestBehavior.AllowGet);
|
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)]
|
[DiscoAuthorizeAny(Claims.Job.Actions.RemoveAnyAttachments, Claims.Job.Actions.RemoveOwnAttachments)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult AttachmentRemove(int id)
|
public virtual ActionResult AttachmentRemove(int id)
|
||||||
{
|
{
|
||||||
var da = Database.DeviceAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
|
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);
|
da.OnDelete(Database);
|
||||||
Database.SaveChanges();
|
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)]
|
[DiscoAuthorize(Claims.Device.Actions.AddAttachments)]
|
||||||
@@ -706,11 +700,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
catch (InvalidOperationException ex)
|
catch (InvalidOperationException ex)
|
||||||
{
|
{
|
||||||
return Json(new
|
return BadRequest(ex.Message);
|
||||||
{
|
|
||||||
Success = false,
|
|
||||||
ErrorMessage = ex.Message,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -736,6 +726,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Device.Actions.Import)]
|
[DiscoAuthorize(Claims.Device.Actions.Import)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult ImportBegin(HttpPostedFileBase ImportFile, bool HasHeader)
|
public virtual ActionResult ImportBegin(HttpPostedFileBase ImportFile, bool HasHeader)
|
||||||
{
|
{
|
||||||
if (ImportFile == null || ImportFile.ContentLength == 0)
|
if (ImportFile == null || ImportFile.ContentLength == 0)
|
||||||
@@ -752,15 +743,14 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Device.Actions.Import)]
|
[DiscoAuthorize(Claims.Device.Actions.Import)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult ImportParse(string Id, List<DeviceImportFieldTypes> Headers)
|
public virtual ActionResult ImportParse(string Id, List<DeviceImportFieldTypes> Headers)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(Id))
|
if (string.IsNullOrWhiteSpace(Id))
|
||||||
throw new ArgumentNullException("Id");
|
throw new ArgumentNullException(nameof(Id));
|
||||||
|
|
||||||
var context = Import_RetrieveContext(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));
|
||||||
if (context == null)
|
|
||||||
throw new ArgumentException("The Import Session Id is invalid or the session timed out (60 minutes), try importing again", "Id");
|
|
||||||
|
|
||||||
context.UpdateColumnTypes(Headers);
|
context.UpdateColumnTypes(Headers);
|
||||||
|
|
||||||
@@ -777,15 +767,14 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Device.Actions.Import)]
|
[DiscoAuthorize(Claims.Device.Actions.Import)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult ImportApply(string Id)
|
public virtual ActionResult ImportApply(string Id)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(Id))
|
if (string.IsNullOrWhiteSpace(Id))
|
||||||
throw new ArgumentNullException("Id");
|
throw new ArgumentNullException(nameof(Id));
|
||||||
|
|
||||||
var context = Import_RetrieveContext(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));
|
||||||
if (context == null)
|
|
||||||
throw new ArgumentException("The Import Session Id is invalid or the session timed out (60 minutes), try importing again", "Id");
|
|
||||||
|
|
||||||
var status = DeviceImportApplyTask.ScheduleNow(context);
|
var status = DeviceImportApplyTask.ScheduleNow(context);
|
||||||
status.SetFinishedUrl(Url.Action(MVC.Device.Import(context.SessionId)));
|
status.SetFinishedUrl(Url.Action(MVC.Device.Import(context.SessionId)));
|
||||||
@@ -895,6 +884,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.DiscoAdminAccount)]
|
[DiscoAuthorize(Claims.DiscoAdminAccount)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult MigrateDeviceMacAddressesFromLog()
|
public virtual ActionResult MigrateDeviceMacAddressesFromLog()
|
||||||
{
|
{
|
||||||
var taskStatus = Disco.Services.Devices.Enrolment.LogMacAddressImportingTask.ScheduleImmediately();
|
var taskStatus = Disco.Services.Devices.Enrolment.LogMacAddressImportingTask.ScheduleImmediately();
|
||||||
|
|||||||
@@ -40,14 +40,14 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return Redirect($"{Url.Action(MVC.Device.Show(assignment.DeviceSerialNumber))}#DeviceDetailTab-Flags");
|
return Redirect($"{Url.Action(MVC.Device.Show(assignment.DeviceSerialNumber))}#DeviceDetailTab-Flags");
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
const string pOnUnassignmentExpression = "onunassignmentexpression";
|
const string pOnUnassignmentExpression = "onunassignmentexpression";
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
Authorization.Require(Claims.Config.DeviceFlag.Configure);
|
Authorization.Require(Claims.Config.DeviceFlag.Configure);
|
||||||
@@ -68,43 +69,48 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.DeviceFlag.Index(flag.Id));
|
return RedirectToAction(MVC.Config.DeviceFlag.Index(flag.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Update Shortcut Methods
|
#region Update Shortcut Methods
|
||||||
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateName(int id, string FlagName = null, bool? redirect = null)
|
public virtual ActionResult UpdateName(int id, string FlagName = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pName, FlagName, redirect);
|
return Update(id, pName, FlagName, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
|
public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pDescription, Description, redirect);
|
return Update(id, pDescription, Description, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateIcon(int id, string Icon = null, bool? redirect = null)
|
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.DeviceFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateIconColour(int id, string IconColour = null, bool? redirect = null)
|
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.DeviceFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateIconAndColour(int id, string Icon = null, string IconColour = null, bool redirect = false)
|
public virtual ActionResult UpdateIconAndColour(int id, string Icon = null, string IconColour = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -124,27 +130,30 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.DeviceFlag.Index(DeviceFlag.Id));
|
return RedirectToAction(MVC.Config.DeviceFlag.Index(DeviceFlag.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateOnAssignmentExpression(int id, string OnAssignmentExpression = null, bool redirect = false)
|
public virtual ActionResult UpdateOnAssignmentExpression(int id, string OnAssignmentExpression = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pOnAssignmentExpression, OnAssignmentExpression, redirect);
|
return Update(id, pOnAssignmentExpression, OnAssignmentExpression, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateOnUnassignmentExpression(int id, string OnUnassignmentExpression = null, bool redirect = false)
|
public virtual ActionResult UpdateOnUnassignmentExpression(int id, string OnUnassignmentExpression = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pOnUnassignmentExpression, OnUnassignmentExpression, redirect);
|
return Update(id, pOnUnassignmentExpression, OnUnassignmentExpression, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDevicesLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
|
public virtual ActionResult UpdateDevicesLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -167,17 +176,18 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateAssignedUserLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
|
public virtual ActionResult UpdateAssignedUserLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -200,14 +210,14 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -341,6 +351,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
#region Actions
|
#region Actions
|
||||||
[DiscoAuthorizeAll(Claims.Config.DeviceFlag.Configure, Claims.Config.DeviceFlag.Delete)]
|
[DiscoAuthorizeAll(Claims.Config.DeviceFlag.Configure, Claims.Config.DeviceFlag.Delete)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Delete(int id, bool? redirect = false)
|
public virtual ActionResult Delete(int id, bool? redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -354,7 +365,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
throw new ArgumentException("Invalid Device Flag Id", nameof(id));
|
throw new ArgumentException("Invalid Device Flag Id", nameof(id));
|
||||||
}
|
}
|
||||||
@@ -363,11 +374,12 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
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)]
|
[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)
|
public virtual ActionResult BulkAssignDevices(int id, bool Override, string DeviceSerialNumbers = null, string Comments = null)
|
||||||
{
|
{
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Disco.Services.Plugins.Features.WarrantyProvider;
|
|||||||
using Disco.Services.Web;
|
using Disco.Services.Web;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Data.Entity;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
@@ -24,6 +25,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
const string pDefaultRepairProvider = "defaultrepairprovider";
|
const string pDefaultRepairProvider = "defaultrepairprovider";
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceModel.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceModel.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false)
|
public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
Authorization.Require(Claims.Config.DeviceModel.Configure);
|
Authorization.Require(Claims.Config.DeviceModel.Configure);
|
||||||
@@ -63,19 +65,19 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Json("Invalid Device Model Number", JsonRequestBehavior.AllowGet);
|
return BadRequest("Invalid Device Model Number");
|
||||||
}
|
}
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.DeviceModel.Index(deviceModel.Id));
|
return RedirectToAction(MVC.Config.DeviceModel.Index(deviceModel.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,12 +122,12 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Update Properties
|
#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;
|
deviceModel.Description = null;
|
||||||
else
|
else
|
||||||
deviceModel.Description = Description;
|
deviceModel.Description = description;
|
||||||
Database.SaveChanges();
|
Database.SaveChanges();
|
||||||
}
|
}
|
||||||
private void UpdateManufacturer(DeviceModel deviceModel, string manufacturer)
|
private void UpdateManufacturer(DeviceModel deviceModel, string manufacturer)
|
||||||
@@ -150,15 +152,15 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
deviceModel.Model = model;
|
deviceModel.Model = model;
|
||||||
Database.SaveChanges();
|
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;
|
deviceModel.DefaultPurchaseDate = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (DateTime.TryParse(DefaultPurchaseDate, out var d))
|
if (DateTime.TryParse(defaultPurchaseDate, out var d))
|
||||||
{
|
{
|
||||||
deviceModel.DefaultPurchaseDate = d;
|
deviceModel.DefaultPurchaseDate = d;
|
||||||
}
|
}
|
||||||
@@ -169,30 +171,30 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
Database.SaveChanges();
|
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;
|
deviceModel.DefaultWarrantyProvider = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Validate
|
// Validate
|
||||||
var WarrantyProvider = Plugins.GetPluginFeature(DefaultWarrantyProvider, typeof(WarrantyProviderFeature));
|
var WarrantyProvider = Plugins.GetPluginFeature(defaultWarrantyProvider, typeof(WarrantyProviderFeature));
|
||||||
deviceModel.DefaultWarrantyProvider = WarrantyProvider.Id;
|
deviceModel.DefaultWarrantyProvider = WarrantyProvider.Id;
|
||||||
}
|
}
|
||||||
Database.SaveChanges();
|
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;
|
deviceModel.DefaultRepairProvider = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Validate
|
// Validate
|
||||||
var RepairProvider = Plugins.GetPluginFeature(DefaultRepairProvider, typeof(RepairProviderFeature));
|
var RepairProvider = Plugins.GetPluginFeature(defaultRepairProvider, typeof(RepairProviderFeature));
|
||||||
deviceModel.DefaultRepairProvider = RepairProvider.Id;
|
deviceModel.DefaultRepairProvider = RepairProvider.Id;
|
||||||
}
|
}
|
||||||
Database.SaveChanges();
|
Database.SaveChanges();
|
||||||
@@ -213,12 +215,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
var deviceModelImage = m.Image();
|
var deviceModelImage = m.Image();
|
||||||
if (deviceModelImage != null)
|
if (deviceModelImage != null)
|
||||||
return File(deviceModelImage, "image/png");
|
return File(deviceModelImage, "image/png");
|
||||||
//if ( m.Image != null)
|
|
||||||
//{
|
|
||||||
// return File(m.Image, "image/png");
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// DataStore Failed - Use Generic Images
|
// DataStore Failed - Use Generic Images
|
||||||
if (m.ModelType != null)
|
if (m.ModelType != null)
|
||||||
{
|
{
|
||||||
@@ -228,13 +225,13 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return File(modelTypePath, "image/png");
|
return File(modelTypePath, "image/png");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return File(Links.ClientSource.Style.Images.DeviceTypes.Unknown_png, "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)
|
public virtual ActionResult Image(int id, bool redirect, HttpPostedFileBase Image)
|
||||||
{
|
{
|
||||||
if (Image != null && Image.ContentLength > 0)
|
if (Image != null && Image.ContentLength > 0)
|
||||||
@@ -248,31 +245,32 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.DeviceModel.Index(dm.Id));
|
return RedirectToAction(MVC.Config.DeviceModel.Index(dm.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.DeviceModel.Index(dm.Id));
|
return RedirectToAction(MVC.Config.DeviceModel.Index(dm.Id));
|
||||||
else
|
else
|
||||||
return Json("Invalid Image Format", JsonRequestBehavior.AllowGet);
|
return BadRequest("Invalid Image Format");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.DeviceModel.Index());
|
return RedirectToAction(MVC.Config.DeviceModel.Index());
|
||||||
else
|
else
|
||||||
return Json("Invalid Device Model Number", JsonRequestBehavior.AllowGet);
|
return BadRequest("Invalid Device Model Number");
|
||||||
}
|
}
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.DeviceModel.Index());
|
return RedirectToAction(MVC.Config.DeviceModel.Index());
|
||||||
else
|
else
|
||||||
return Json("No Image Supplied", JsonRequestBehavior.AllowGet);
|
return BadRequest("No Image Supplied");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Actions
|
#region Actions
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceModel.Delete)]
|
[DiscoAuthorize(Claims.Config.DeviceModel.Delete)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Delete(int id, bool? redirect = false)
|
public virtual ActionResult Delete(int id, bool? redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -285,7 +283,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.DeviceModel.Index(null));
|
return RedirectToAction(MVC.Config.DeviceModel.Index(null));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
throw new Exception("Invalid Device Model Number");
|
throw new Exception("Invalid Device Model Number");
|
||||||
}
|
}
|
||||||
@@ -294,7 +292,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
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
|
#region Device Model Components
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceModel.Show)]
|
[DiscoAuthorize(Claims.Config.DeviceModel.Show)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Component(int id)
|
public virtual ActionResult Component(int id)
|
||||||
{
|
{
|
||||||
var dc = Database.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
|
var dc = Database.DeviceComponents.Include(c => c.JobSubTypes).Where(i => i.Id == id).FirstOrDefault();
|
||||||
if (dc != null)
|
if (dc == null)
|
||||||
{
|
return BadRequest("Invalid Device Component Id");
|
||||||
return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet);
|
|
||||||
}
|
return Json(Models.DeviceModel.ComponentModel.FromDeviceComponent(dc));
|
||||||
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceModel.ConfigureComponents)]
|
[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;
|
DeviceModel dm = null;
|
||||||
if (id.HasValue)
|
if (id.HasValue)
|
||||||
{
|
{
|
||||||
dm = Database.DeviceModels.Find(id.Value);
|
dm = Database.DeviceModels.Find(id.Value);
|
||||||
if (dm == null)
|
if (dm == null)
|
||||||
{
|
return BadRequest("Invalid Device Model Id");
|
||||||
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Model Id" }, JsonRequestBehavior.AllowGet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Description))
|
if (string.IsNullOrEmpty(description))
|
||||||
Description = "?";
|
description = "?";
|
||||||
if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$"))
|
if (!string.IsNullOrEmpty(cost) && cost.Contains("$"))
|
||||||
Cost = Cost.Substring(Cost.IndexOf("$") + 1);
|
cost = cost.Substring(cost.IndexOf("$") + 1);
|
||||||
decimal.TryParse(Cost, out var cost);
|
decimal.TryParse(cost, out var costValue);
|
||||||
|
|
||||||
var dc = new DeviceComponent()
|
var dc = new DeviceComponent()
|
||||||
{
|
{
|
||||||
Description = Description,
|
Description = description,
|
||||||
Cost = cost
|
Cost = costValue
|
||||||
};
|
};
|
||||||
if (dm != null)
|
if (dm != null)
|
||||||
{
|
{
|
||||||
@@ -346,77 +343,77 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
Database.DeviceComponents.Add(dc);
|
Database.DeviceComponents.Add(dc);
|
||||||
Database.SaveChanges();
|
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)]
|
[DiscoAuthorize(Claims.Config.DeviceModel.ConfigureComponents)]
|
||||||
public virtual ActionResult ComponentUpdateJobSubTypes(int id, List<string> JobSubTypes)
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
|
public virtual ActionResult ComponentUpdateJobSubTypes(int id, List<string> jobSubTypes)
|
||||||
{
|
{
|
||||||
var dc = Database.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
|
var dc = Database.DeviceComponents.Include(c => c.JobSubTypes).Where(i => i.Id == id).FirstOrDefault();
|
||||||
if (dc != null)
|
if (dc == null)
|
||||||
{
|
return BadRequest("Invalid Device Component Id");
|
||||||
dc.JobSubTypes.Clear();
|
|
||||||
|
|
||||||
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));
|
dc.JobSubTypes.Add(jst);
|
||||||
foreach (var jst in jsts)
|
|
||||||
{
|
|
||||||
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)]
|
[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();
|
var dc = Database.DeviceComponents.Include(c => c.JobSubTypes).Where(i => i.Id == id).FirstOrDefault();
|
||||||
if (dc != null)
|
if (dc == null)
|
||||||
{
|
return BadRequest("Invalid Device Component Id");
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Description))
|
if (string.IsNullOrEmpty(description))
|
||||||
Description = "?";
|
description = "?";
|
||||||
if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$"))
|
if (!string.IsNullOrEmpty(cost) && cost.Contains("$"))
|
||||||
Cost = Cost.Substring(Cost.IndexOf("$") + 1);
|
cost = cost.Substring(cost.IndexOf("$") + 1);
|
||||||
decimal.TryParse(Cost, out var cost);
|
decimal.TryParse(cost, out var costValue);
|
||||||
|
|
||||||
dc.Description = Description;
|
dc.Description = description;
|
||||||
dc.Cost = cost;
|
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(Models.DeviceModel.ComponentModel.FromDeviceComponent(dc));
|
||||||
}
|
|
||||||
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceModel.ConfigureComponents)]
|
[DiscoAuthorize(Claims.Config.DeviceModel.ConfigureComponents)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult ComponentRemove(int id)
|
public virtual ActionResult ComponentRemove(int id)
|
||||||
{
|
{
|
||||||
var dc = Database.DeviceComponents.Include("JobSubTypes").Where(c => c.Id == id).FirstOrDefault();
|
var dc = Database.DeviceComponents.Include(c => c.JobSubTypes).Where(c => c.Id == id).FirstOrDefault();
|
||||||
if (dc != null)
|
if (dc == null)
|
||||||
{
|
return BadRequest("Invalid Device Component Id");
|
||||||
dc.JobSubTypes.Clear();
|
|
||||||
Database.DeviceComponents.Remove(dc);
|
dc.JobSubTypes.Clear();
|
||||||
Database.SaveChanges();
|
Database.DeviceComponents.Remove(dc);
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
Database.SaveChanges();
|
||||||
}
|
return Ok();
|
||||||
return Json("Invalid Device Component Id", JsonRequestBehavior.AllowGet);
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Index
|
#region Index
|
||||||
[DiscoAuthorize(Claims.Config.DeviceModel.Show)]
|
[DiscoAuthorizeAny(Claims.Config.DeviceModel.Show, Claims.Config.Enrolment.ShowStatus)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Index()
|
public virtual ActionResult Index()
|
||||||
{
|
{
|
||||||
var deviceModels = Database.DeviceModels.ToArray().Select(dm => Models.DeviceModel._DeviceModel.FromDeviceModel(dm)).ToArray();
|
var deviceModels = Database.DeviceModels.AsEnumerable().Select(dm => Models.DeviceModel._DeviceModel.FromDeviceModel(dm)).ToList();
|
||||||
return Json(deviceModels, JsonRequestBehavior.AllowGet);
|
return Json(deviceModels);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
const string pAssignedUsersLinkedGroup = "assigneduserslinkedgroup";
|
const string pAssignedUsersLinkedGroup = "assigneduserslinkedgroup";
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
Authorization.Require(Claims.Config.DeviceProfile.Configure);
|
Authorization.Require(Claims.Config.DeviceProfile.Configure);
|
||||||
@@ -114,62 +115,70 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.DeviceProfile.Index(deviceProfile.Id));
|
return RedirectToAction(MVC.Config.DeviceProfile.Index(deviceProfile.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Update Shortcut Methods
|
#region Update Shortcut Methods
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
|
public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pDescription, Description, redirect);
|
return Update(id, pDescription, Description, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateName(int id, string ProfileName = null, bool? redirect = null)
|
public virtual ActionResult UpdateName(int id, string ProfileName = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pName, ProfileName, redirect);
|
return Update(id, pName, ProfileName, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateShortName(int id, string ShortName = null, bool? redirect = null)
|
public virtual ActionResult UpdateShortName(int id, string ShortName = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pShortName, ShortName, redirect);
|
return Update(id, pShortName, ShortName, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDistributionType(int id, string DistributionType = null, bool? redirect = null)
|
public virtual ActionResult UpdateDistributionType(int id, string DistributionType = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pDistributionType, DistributionType, redirect);
|
return Update(id, pDistributionType, DistributionType, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[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)]
|
[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)]
|
[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)
|
public virtual ActionResult UpdateOrganisationalUnit(int id, string OrganisationalUnit = null, bool enforce = false, bool? redirect = null)
|
||||||
{
|
{
|
||||||
var updateResult = Update(id, pOrganisationalUnit, OrganisationalUnit, redirect);
|
var updateResult = Update(id, pOrganisationalUnit, OrganisationalUnit, redirect);
|
||||||
@@ -187,13 +196,14 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDefaultOrganisationAddress(int id, string DefaultOrganisationAddress = null, bool? redirect = null)
|
public virtual ActionResult UpdateDefaultOrganisationAddress(int id, string DefaultOrganisationAddress = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pDefaultOrganisationAddress, DefaultOrganisationAddress, redirect);
|
return Update(id, pDefaultOrganisationAddress, DefaultOrganisationAddress, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Configure, Claims.Config.DeviceProfile.ConfigureComputerNameTemplate)]
|
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Configure, Claims.Config.DeviceProfile.ConfigureComputerNameTemplate)]
|
||||||
[ValidateAntiForgeryToken]
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateComputerNameTemplate(int id, string ComputerNameTemplate = null, bool? redirect = null)
|
public virtual ActionResult UpdateComputerNameTemplate(int id, string ComputerNameTemplate = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
var deviceProfile = Database.DeviceProfiles.Find(id);
|
var deviceProfile = Database.DeviceProfiles.Find(id);
|
||||||
@@ -219,11 +229,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.GetValueOrDefault(false))
|
if (redirect.GetValueOrDefault(false))
|
||||||
return RedirectToAction(MVC.Config.DeviceProfile.Index(deviceProfile.Id));
|
return RedirectToAction(MVC.Config.DeviceProfile.Index(deviceProfile.Id));
|
||||||
else
|
else
|
||||||
return Json("OK");
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Configure, Claims.Config.DeviceProfile.ConfigureComputerNameTemplate)]
|
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Configure, Claims.Config.DeviceProfile.ConfigureComputerNameTemplate)]
|
||||||
[ValidateAntiForgeryToken]
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult TestComputerNameTemplate(int id, string ComputerNameTemplate = null, string UserSpecifiedDeviceSerialNumber = null)
|
public virtual ActionResult TestComputerNameTemplate(int id, string ComputerNameTemplate = null, string UserSpecifiedDeviceSerialNumber = null)
|
||||||
{
|
{
|
||||||
Database.Configuration.LazyLoadingEnabled = true;
|
Database.Configuration.LazyLoadingEnabled = true;
|
||||||
@@ -317,36 +327,42 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateEnforceComputerNameConvention(int id, string EnforceComputerNameConvention = null, bool? redirect = null)
|
public virtual ActionResult UpdateEnforceComputerNameConvention(int id, string EnforceComputerNameConvention = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pEnforceComputerNameConvention, EnforceComputerNameConvention, redirect);
|
return Update(id, pEnforceComputerNameConvention, EnforceComputerNameConvention, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateEnforceOrganisationalUnit(int id, string EnforceOrganisationalUnit = null, bool? redirect = null)
|
public virtual ActionResult UpdateEnforceOrganisationalUnit(int id, string EnforceOrganisationalUnit = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pEnforceOrganisationalUnit, EnforceOrganisationalUnit, redirect);
|
return Update(id, pEnforceOrganisationalUnit, EnforceOrganisationalUnit, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateProvisionADAccount(int id, string ProvisionADAccount = null, bool? redirect = null)
|
public virtual ActionResult UpdateProvisionADAccount(int id, string ProvisionADAccount = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pProvisionADAccount, ProvisionADAccount, redirect);
|
return Update(id, pProvisionADAccount, ProvisionADAccount, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateAssignedUserLocalAdmin(int id, string AssignedUserLocalAdmin = null, bool? redirect = null)
|
public virtual ActionResult UpdateAssignedUserLocalAdmin(int id, string AssignedUserLocalAdmin = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pAssignedUserLocalAdmin, AssignedUserLocalAdmin, redirect);
|
return Update(id, pAssignedUserLocalAdmin, AssignedUserLocalAdmin, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateAllowUntrustedReimageJobEnrolment(int id, string AllowUntrustedReimageJobEnrolment = null, bool? redirect = null)
|
public virtual ActionResult UpdateAllowUntrustedReimageJobEnrolment(int id, string AllowUntrustedReimageJobEnrolment = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pAllowUntrustedReimageJobEnrolment, AllowUntrustedReimageJobEnrolment, redirect);
|
return Update(id, pAllowUntrustedReimageJobEnrolment, AllowUntrustedReimageJobEnrolment, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDevicesLinkedGroup(int id, string GroupId = null, bool redirect = false)
|
public virtual ActionResult UpdateDevicesLinkedGroup(int id, string GroupId = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -368,17 +384,18 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateAssignedUsersLinkedGroup(int id, string GroupId = null, bool redirect = false)
|
public virtual ActionResult UpdateAssignedUsersLinkedGroup(int id, string GroupId = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -400,49 +417,49 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Update Properties
|
#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;
|
deviceProfile.Description = null;
|
||||||
else
|
else
|
||||||
deviceProfile.Description = Description;
|
deviceProfile.Description = description;
|
||||||
Database.SaveChanges();
|
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");
|
throw new Exception("Profile name cannot be empty");
|
||||||
else
|
else
|
||||||
deviceProfile.Name = Name;
|
deviceProfile.Name = name;
|
||||||
Database.SaveChanges();
|
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");
|
throw new Exception("Profile short name cannot be empty");
|
||||||
else
|
else
|
||||||
deviceProfile.ShortName = ShortName;
|
deviceProfile.ShortName = shortName;
|
||||||
Database.SaveChanges();
|
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;
|
deviceProfile.DistributionType = (DeviceProfile.DistributionTypes)iDt;
|
||||||
Database.SaveChanges();
|
Database.SaveChanges();
|
||||||
@@ -451,9 +468,9 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
throw new Exception("Invalid Distribution Type Number");
|
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;
|
deviceProfile.CertificateProviders = null;
|
||||||
}
|
}
|
||||||
@@ -461,7 +478,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
// Validate
|
// Validate
|
||||||
var validatedProviders = new List<PluginFeatureManifest>();
|
var validatedProviders = new List<PluginFeatureManifest>();
|
||||||
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));
|
var featureManifest = Plugins.GetPluginFeature(certificateProviderId, typeof(CertificateProviderFeature));
|
||||||
if (featureManifest == null)
|
if (featureManifest == null)
|
||||||
@@ -487,9 +504,9 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
Database.SaveChanges();
|
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;
|
deviceProfile.CertificateAuthorityProviders = null;
|
||||||
}
|
}
|
||||||
@@ -497,7 +514,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
// Validate
|
// Validate
|
||||||
var validatedProviders = new List<PluginFeatureManifest>();
|
var validatedProviders = new List<PluginFeatureManifest>();
|
||||||
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));
|
var featureManifest = Plugins.GetPluginFeature(certificateAuthorityProviderId, typeof(CertificateAuthorityProviderFeature));
|
||||||
if (featureManifest == null)
|
if (featureManifest == null)
|
||||||
@@ -523,9 +540,9 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
Database.SaveChanges();
|
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;
|
deviceProfile.WirelessProfileProviders = null;
|
||||||
}
|
}
|
||||||
@@ -533,7 +550,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
// Validate
|
// Validate
|
||||||
var validatedProviders = new List<PluginFeatureManifest>();
|
var validatedProviders = new List<PluginFeatureManifest>();
|
||||||
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));
|
var featureManifest = Plugins.GetPluginFeature(wirelessProfileProviderId, typeof(WirelessProfileProviderFeature));
|
||||||
if (featureManifest == null)
|
if (featureManifest == null)
|
||||||
@@ -559,28 +576,28 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
Database.SaveChanges();
|
Database.SaveChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateOrganisationalUnit(DeviceProfile deviceProfile, string OrganisationalUnit)
|
private void UpdateOrganisationalUnit(DeviceProfile deviceProfile, string organisationalUnit)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(OrganisationalUnit))
|
if (string.IsNullOrWhiteSpace(organisationalUnit))
|
||||||
OrganisationalUnit = ActiveDirectory.Context.PrimaryDomain.DefaultComputerContainer;
|
organisationalUnit = ActiveDirectory.Context.PrimaryDomain.DefaultComputerContainer;
|
||||||
|
|
||||||
if (OrganisationalUnit != deviceProfile.OrganisationalUnit)
|
if (organisationalUnit != deviceProfile.OrganisationalUnit)
|
||||||
{
|
{
|
||||||
deviceProfile.OrganisationalUnit = OrganisationalUnit;
|
deviceProfile.OrganisationalUnit = organisationalUnit;
|
||||||
Database.SaveChanges();
|
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;
|
deviceProfile.DefaultOrganisationAddress = null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Validate
|
// Validate
|
||||||
if (int.TryParse(DefaultOrganisationAddress, out var daoId))
|
if (int.TryParse(defaultOrganisationAddress, out var daoId))
|
||||||
{
|
{
|
||||||
var oa = Database.DiscoConfiguration.OrganisationAddresses.GetAddress(daoId);
|
var oa = Database.DiscoConfiguration.OrganisationAddresses.GetAddress(daoId);
|
||||||
if (oa != null)
|
if (oa != null)
|
||||||
@@ -602,9 +619,9 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
Database.SaveChanges();
|
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;
|
deviceProfile.EnforceComputerNameConvention = bValue;
|
||||||
|
|
||||||
@@ -614,9 +631,9 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
throw new Exception("Invalid Boolean Value");
|
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;
|
deviceProfile.EnforceOrganisationalUnit = bValue;
|
||||||
|
|
||||||
@@ -626,9 +643,9 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
throw new Exception("Invalid Boolean Value");
|
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;
|
deviceProfile.ProvisionADAccount = bValue;
|
||||||
|
|
||||||
@@ -638,9 +655,9 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
throw new Exception("Invalid Boolean Value");
|
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;
|
deviceProfile.AssignedUserLocalAdmin = bValue;
|
||||||
|
|
||||||
@@ -650,9 +667,9 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
throw new Exception("Invalid Boolean Value");
|
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;
|
deviceProfile.AllowUntrustedReimageJobEnrolment = bValue;
|
||||||
|
|
||||||
@@ -662,16 +679,16 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
throw new Exception("Invalid Boolean Value");
|
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();
|
Database.SaveChanges();
|
||||||
|
|
||||||
var managedGroup = DeviceProfileDevicesManagedGroup.Initialize(DeviceProfile);
|
var managedGroup = DeviceProfileDevicesManagedGroup.Initialize(deviceProfile);
|
||||||
if (managedGroup != null) // Sync Group
|
if (managedGroup != null) // Sync Group
|
||||||
return ADManagedGroupsSyncTask.ScheduleSync(managedGroup);
|
return ADManagedGroupsSyncTask.ScheduleSync(managedGroup);
|
||||||
}
|
}
|
||||||
@@ -679,16 +696,16 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return null;
|
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();
|
Database.SaveChanges();
|
||||||
|
|
||||||
var managedGroup = DeviceProfileAssignedUsersManagedGroup.Initialize(DeviceProfile);
|
var managedGroup = DeviceProfileAssignedUsersManagedGroup.Initialize(deviceProfile);
|
||||||
if (managedGroup != null) // Sync Group
|
if (managedGroup != null) // Sync Group
|
||||||
return ADManagedGroupsSyncTask.ScheduleSync(managedGroup);
|
return ADManagedGroupsSyncTask.ScheduleSync(managedGroup);
|
||||||
}
|
}
|
||||||
@@ -700,6 +717,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Actions
|
#region Actions
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Delete)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.Delete)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Delete(int id, bool? redirect = false)
|
public virtual ActionResult Delete(int id, bool? redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -712,7 +730,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.DeviceProfile.Index(null));
|
return RedirectToAction(MVC.Config.DeviceProfile.Index(null));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
throw new Exception("Invalid Device Profile Number");
|
throw new Exception("Invalid Device Profile Number");
|
||||||
}
|
}
|
||||||
@@ -721,7 +739,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -730,6 +748,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Defaults
|
#region Defaults
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.ConfigureDefaults)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.ConfigureDefaults)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Default(int id, bool? redirect = null)
|
public virtual ActionResult Default(int id, bool? redirect = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -742,7 +761,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.DeviceProfile.Index(id));
|
return RedirectToAction(MVC.Config.DeviceProfile.Index(id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
throw new Exception("Invalid Device Profile Number");
|
throw new Exception("Invalid Device Profile Number");
|
||||||
}
|
}
|
||||||
@@ -751,11 +770,12 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DeviceProfile.ConfigureDefaults)]
|
[DiscoAuthorize(Claims.Config.DeviceProfile.ConfigureDefaults)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult DefaultAddDeviceOffline(int id, bool? redirect = false)
|
public virtual ActionResult DefaultAddDeviceOffline(int id, bool? redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -778,14 +798,14 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.DeviceProfile.Index(id));
|
return RedirectToAction(MVC.Config.DeviceProfile.Index(id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
using System.Data.Entity;
|
using System.Data.Entity;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Text.RegularExpressions;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.UI.WebControls;
|
using System.Web.UI.WebControls;
|
||||||
@@ -40,6 +40,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
const string pIsHidden = "ishidden";
|
const string pIsHidden = "ishidden";
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
|
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -97,18 +98,19 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(resultTask.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(resultTask.SessionId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
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)
|
public virtual ActionResult Template(string id)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(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)
|
public virtual ActionResult Template(string id, bool redirect, HttpPostedFileBase Template)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -144,18 +147,19 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.DocumentTemplate.Index(documentTemplate.Id));
|
return RedirectToAction(MVC.Config.DocumentTemplate.Index(documentTemplate.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
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)
|
public virtual ActionResult TemplatePreview(string id)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(id))
|
if (string.IsNullOrEmpty(id))
|
||||||
@@ -180,41 +184,49 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
#region Update Shortcut Methods
|
#region Update Shortcut Methods
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDescription(string id, string Description = null, bool redirect = false)
|
public virtual ActionResult UpdateDescription(string id, string Description = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pDescription, Description, redirect);
|
return Update(id, pDescription, Description, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)]
|
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateFilterExpression(string id, string FilterExpression = null, bool redirect = false)
|
public virtual ActionResult UpdateFilterExpression(string id, string FilterExpression = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pFilterExpression, FilterExpression, redirect);
|
return Update(id, pFilterExpression, FilterExpression, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)]
|
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateOnGenerateExpression(string id, string OnGenerateExpression = null, bool redirect = false)
|
public virtual ActionResult UpdateOnGenerateExpression(string id, string OnGenerateExpression = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pOnGenerateExpression, OnGenerateExpression, redirect);
|
return Update(id, pOnGenerateExpression, OnGenerateExpression, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)]
|
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateOnImportAttachmentExpression(string id, string OnImportAttachmentExpression = null, bool redirect = false)
|
public virtual ActionResult UpdateOnImportAttachmentExpression(string id, string OnImportAttachmentExpression = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pOnImportAttachmentExpression, OnImportAttachmentExpression, redirect);
|
return Update(id, pOnImportAttachmentExpression, OnImportAttachmentExpression, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateFlattenForm(string id, string FlattenForm = null, bool redirect = false)
|
public virtual ActionResult UpdateFlattenForm(string id, string FlattenForm = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pFlattenForm, FlattenForm, redirect);
|
return Update(id, pFlattenForm, FlattenForm, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateIsHidden(string id, string IsHidden = null, bool redirect = false)
|
public virtual ActionResult UpdateIsHidden(string id, string IsHidden = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pIsHidden, IsHidden, redirect);
|
return Update(id, pIsHidden, IsHidden, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateScope(string id, string Scope = null, bool redirect = false)
|
public virtual ActionResult UpdateScope(string id, string Scope = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pScope, Scope, redirect);
|
return Update(id, pScope, Scope, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateJobSubTypes(string id, List<string> JobSubTypes = null, bool redirect = false)
|
public virtual ActionResult UpdateJobSubTypes(string id, List<string> JobSubTypes = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -228,19 +240,20 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.DocumentTemplate.Index(documentTemplate.Id));
|
return RedirectToAction(MVC.Config.DocumentTemplate.Index(documentTemplate.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDevicesLinkedGroup(string id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
|
public virtual ActionResult UpdateDevicesLinkedGroup(string id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -262,18 +275,19 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateUsersLinkedGroup(string id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
|
public virtual ActionResult UpdateUsersLinkedGroup(string id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -295,14 +309,14 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -493,7 +507,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Actions
|
#region Actions
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages), OutputCache(NoStore = true, Duration = 0)]
|
[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 dataStoreSessionPagesCacheLocation = DataStore.CreateLocation(Database, "Cache\\DocumentDropBox_SessionPages");
|
||||||
var filename = Path.Combine(dataStoreSessionPagesCacheLocation, $"{SessionId}-{PageNumber}");
|
var filename = Path.Combine(dataStoreSessionPagesCacheLocation, $"{SessionId}-{PageNumber}");
|
||||||
@@ -504,6 +518,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult ImporterUndetectedFiles()
|
public virtual ActionResult ImporterUndetectedFiles()
|
||||||
{
|
{
|
||||||
var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned");
|
var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned");
|
||||||
@@ -577,47 +592,51 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)]
|
||||||
|
[HttpGet]
|
||||||
public virtual ActionResult ImporterUndetectedFile(string id, bool? Source, bool? Thumbnail)
|
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");
|
var filename = Path.Combine(undetectedLocation, $"{id}.pdf");
|
||||||
if (Source.HasValue && Source.Value)
|
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))
|
if (System.IO.File.Exists(filename))
|
||||||
return File(filename, DocumentTemplate.PdfMimeType);
|
return File(filename, "image/png");
|
||||||
else
|
else
|
||||||
return HttpNotFound();
|
return File(Links.ClientSource.Style.Images.Status.fileBroken256_png, "image/png");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Thumbnail.HasValue && Thumbnail.Value)
|
var filename = Path.Combine(undetectedLocation, $"{id}.jpg");
|
||||||
{
|
if (System.IO.File.Exists(filename))
|
||||||
var filename = Path.Combine(undetectedLocation, string.Concat(id, "_thumbnail.png"));
|
return File(filename, "image/jpeg");
|
||||||
if (System.IO.File.Exists(filename))
|
|
||||||
return File(filename, "image/png");
|
|
||||||
else
|
|
||||||
return File(Links.ClientSource.Style.Images.Status.fileBroken256_png, "image/png");
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
return File(Links.ClientSource.Style.Images.Status.fileBroken256_png, "image/png");
|
||||||
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 HttpNotFound();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult ImporterUndetectedAssign(string id, string DocumentTemplateId, string DataId)
|
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 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);
|
var identifier = DocumentUniqueIdentifier.Create(Database, DocumentTemplateId, DataId, UserService.CurrentUser.UserId, DateTime.Now, 0);
|
||||||
|
|
||||||
if (Disco.Services.Documents.AttachmentImport.Importer.ImportPdfAttachment(identifier, Database, filename) != null)
|
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);
|
System.IO.File.Delete(filename);
|
||||||
|
|
||||||
// Delete Thumbnail/Preview
|
// 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))
|
if (System.IO.File.Exists(thumbnailFilename))
|
||||||
System.IO.File.Delete(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))
|
if (System.IO.File.Exists(previewFilename))
|
||||||
System.IO.File.Delete(previewFilename);
|
System.IO.File.Delete(previewFilename);
|
||||||
|
|
||||||
return Json("OK");
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
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)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult ImporterUndetectedDelete(string id)
|
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 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))
|
if (System.IO.File.Exists(filename))
|
||||||
{
|
{
|
||||||
// Delete File
|
// Delete File
|
||||||
System.IO.File.Delete(filename);
|
System.IO.File.Delete(filename);
|
||||||
|
|
||||||
// Delete Thumbnail/Preview
|
// 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))
|
if (System.IO.File.Exists(thumbnailFilename))
|
||||||
System.IO.File.Delete(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))
|
if (System.IO.File.Exists(previewFilename))
|
||||||
System.IO.File.Delete(previewFilename);
|
System.IO.File.Delete(previewFilename);
|
||||||
|
|
||||||
return Json("OK");
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Json("File Not Found");
|
return BadRequest("File Not Found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorizeAll(Claims.Config.DeviceModel.Show, Claims.Config.DocumentTemplate.BulkGenerate)]
|
[DiscoAuthorizeAll(Claims.Config.DeviceModel.Show, Claims.Config.DocumentTemplate.BulkGenerate)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult BulkGenerateDeviceModel(string id, int deviceGroupId)
|
public virtual ActionResult BulkGenerateDeviceModel(string id, int deviceGroupId)
|
||||||
{
|
{
|
||||||
var template = Database.DocumentTemplates.FirstOrDefault(t => t.Id == id);
|
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)]
|
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Show, Claims.Config.DocumentTemplate.BulkGenerate)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult BulkGenerateDeviceProfile(string id, int deviceGroupId)
|
public virtual ActionResult BulkGenerateDeviceProfile(string id, int deviceGroupId)
|
||||||
{
|
{
|
||||||
var template = Database.DocumentTemplates.FirstOrDefault(t => t.Id == id);
|
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)]
|
[DiscoAuthorizeAll(Claims.Config.DeviceBatch.Show, Claims.Config.DocumentTemplate.BulkGenerate)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult BulkGenerateDeviceBatch(string id, int deviceGroupId)
|
public virtual ActionResult BulkGenerateDeviceBatch(string id, int deviceGroupId)
|
||||||
{
|
{
|
||||||
var template = Database.DocumentTemplates.FirstOrDefault(t => t.Id == id);
|
var template = Database.DocumentTemplates.FirstOrDefault(t => t.Id == id);
|
||||||
@@ -767,11 +793,12 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.BulkGenerate)]
|
[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))
|
if (string.IsNullOrEmpty(id))
|
||||||
throw new ArgumentNullException("id");
|
throw new ArgumentNullException("id");
|
||||||
if (string.IsNullOrEmpty(DataIds))
|
if (string.IsNullOrEmpty(dataIds))
|
||||||
throw new ArgumentNullException("DataIds");
|
throw new ArgumentNullException("DataIds");
|
||||||
var documentTemplate = Database.DocumentTemplates.Find(id);
|
var documentTemplate = Database.DocumentTemplates.Find(id);
|
||||||
if (documentTemplate == null)
|
if (documentTemplate == null)
|
||||||
@@ -792,35 +819,34 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
throw new InvalidOperationException("Unknown DocumentType Scope");
|
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 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";
|
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)))
|
if (!taskStatus.WaitUntilFinished(TimeSpan.FromSeconds(1)))
|
||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskStatus.SessionId));
|
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);
|
return File(stream, "application/pdf", fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.BulkGenerate)]
|
[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);
|
var stream = DocumentBulkGenerateTask.GetCached(Database, id);
|
||||||
return File(stream, "application/pdf", fileName);
|
return File(stream, "application/pdf", fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.BulkGenerate, Claims.User.Actions.GenerateDocuments)]
|
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.BulkGenerate, Claims.User.Actions.GenerateDocuments)]
|
||||||
[HttpPost, ValidateAntiForgeryToken]
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult BulkGenerateAddUsers(string userIds)
|
public virtual ActionResult BulkGenerateAddUsers(string userIds)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(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 dataIds = userIds.Split(new string[] { Environment.NewLine, ",", ";" }, StringSplitOptions.RemoveEmptyEntries).Select(d => d.Trim()).Where(d => !string.IsNullOrEmpty(d)).ToList();
|
||||||
var results = new List<BulkGenerateUserModel>(dataIds.Count);
|
var results = new List<BulkGenerateUserModel>(dataIds.Count);
|
||||||
@@ -893,7 +919,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public virtual ActionResult BulkGenerateAddGroupMembers(string groupId)
|
public virtual ActionResult BulkGenerateAddGroupMembers(string groupId)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(groupId))
|
if (string.IsNullOrWhiteSpace(groupId))
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
return BadRequest();
|
||||||
|
|
||||||
var results = new List<BulkGenerateUserModel>();
|
var results = new List<BulkGenerateUserModel>();
|
||||||
var accountId = ActiveDirectory.ParseDomainAccountId(groupId);
|
var accountId = ActiveDirectory.ParseDomainAccountId(groupId);
|
||||||
@@ -954,7 +980,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public virtual ActionResult BulkGenerateAddUserFlag(int flagId)
|
public virtual ActionResult BulkGenerateAddUserFlag(int flagId)
|
||||||
{
|
{
|
||||||
if (flagId <= 0)
|
if (flagId <= 0)
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
return BadRequest();
|
||||||
|
|
||||||
var results = new List<BulkGenerateUserModel>();
|
var results = new List<BulkGenerateUserModel>();
|
||||||
|
|
||||||
@@ -1008,7 +1034,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public virtual ActionResult BulkGenerateAddDeviceProfile(int deviceProfileId)
|
public virtual ActionResult BulkGenerateAddDeviceProfile(int deviceProfileId)
|
||||||
{
|
{
|
||||||
if (deviceProfileId <= 0)
|
if (deviceProfileId <= 0)
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
return BadRequest();
|
||||||
|
|
||||||
var results = new List<BulkGenerateUserModel>();
|
var results = new List<BulkGenerateUserModel>();
|
||||||
|
|
||||||
@@ -1062,7 +1088,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public virtual ActionResult BulkGenerateAddDeviceBatch(int deviceBatchId)
|
public virtual ActionResult BulkGenerateAddDeviceBatch(int deviceBatchId)
|
||||||
{
|
{
|
||||||
if (deviceBatchId <= 0)
|
if (deviceBatchId <= 0)
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
return BadRequest();
|
||||||
|
|
||||||
var results = new List<BulkGenerateUserModel>();
|
var results = new List<BulkGenerateUserModel>();
|
||||||
|
|
||||||
@@ -1116,7 +1142,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public virtual ActionResult BulkGenerateAddDocumentAttachment(string documentTemplateId, DateTime? threshold)
|
public virtual ActionResult BulkGenerateAddDocumentAttachment(string documentTemplateId, DateTime? threshold)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(documentTemplateId))
|
if (string.IsNullOrWhiteSpace(documentTemplateId))
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
return BadRequest();
|
||||||
|
|
||||||
var results = new List<BulkGenerateUserModel>();
|
var results = new List<BulkGenerateUserModel>();
|
||||||
|
|
||||||
@@ -1229,7 +1255,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public virtual ActionResult BulkGenerateGetUserDetailValues(string key)
|
public virtual ActionResult BulkGenerateGetUserDetailValues(string key)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(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();
|
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)
|
public virtual ActionResult BulkGenerateAddUserDetail(string key, string value)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(key))
|
if (string.IsNullOrWhiteSpace(key))
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
return BadRequest();
|
||||||
|
|
||||||
var results = new List<BulkGenerateUserModel>();
|
var results = new List<BulkGenerateUserModel>();
|
||||||
|
|
||||||
@@ -1279,9 +1305,10 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return Json(results);
|
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
|
// generate document
|
||||||
var timestamp = DateTime.Now;
|
var timestamp = DateTime.Now;
|
||||||
@@ -1296,6 +1323,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Delete)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Delete)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Delete(string id, bool? redirect = false)
|
public virtual ActionResult Delete(string id, bool? redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -1308,7 +1336,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.DocumentTemplate.Index(null));
|
return RedirectToAction(MVC.Config.DocumentTemplate.Index(null));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
throw new Exception("Invalid Document Template Id");
|
throw new Exception("Invalid Document Template Id");
|
||||||
}
|
}
|
||||||
@@ -1317,12 +1345,12 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost, ValidateAntiForgeryToken]
|
|
||||||
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.UserFlag.Configure)]
|
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.UserFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult RemoveOnImportUserFlagRule([Required] string id, Guid? ruleId = null)
|
public virtual ActionResult RemoveOnImportUserFlagRule([Required] string id, Guid? ruleId = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -1334,16 +1362,16 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
template.RemoveOnImportUserFlagRule(Database, ruleId.Value);
|
template.RemoveOnImportUserFlagRule(Database, ruleId.Value);
|
||||||
|
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.OK);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
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)]
|
[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)
|
public virtual ActionResult AddOnImportUserFlagRule([Required] string id, bool? addFlag = null, int? userFlagId = null, string comments = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -1379,14 +1407,14 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest, ex.Message);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Handlers
|
#region Handlers
|
||||||
[HttpPost]
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult GenerateDocumentHandlerUi(string templateId, string targetId, string handlerId)
|
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);
|
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)
|
if (handlerPartialView == null)
|
||||||
throw new NotSupportedException("Handler does not have a Generation Options UI");
|
throw new NotSupportedException("Handler does not have a Generation Options UI");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var model = handler.GetGenerationOptionsUiModel(template, target, targetUser, CurrentUser);
|
var model = handler.GetGenerationOptionsUiModel(template, target, targetUser, CurrentUser);
|
||||||
|
|
||||||
return this.PrecompiledPartialView(handlerPartialView, model);
|
return this.PrecompiledPartialView(handlerPartialView, model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult DocumentHandlers(string templateId, string targetId)
|
public virtual ActionResult DocumentHandlers(string templateId, string targetId)
|
||||||
{
|
{
|
||||||
Disco.Services.DocumentTemplateExtensions.GetTemplateAndTarget(Database, Authorization, templateId, targetId, out var template, out var target, out _);
|
Disco.Services.DocumentTemplateExtensions.GetTemplateAndTarget(Database, Authorization, templateId, targetId, out var template, out var target, out _);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
const string pInsertBlankPages = "insertblankpages";
|
const string pInsertBlankPages = "insertblankpages";
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
|
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -69,24 +70,26 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.DocumentTemplate.ShowPackage(package.Id));
|
return RedirectToAction(MVC.Config.DocumentTemplate.ShowPackage(package.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Update Shortcut Methods
|
#region Update Shortcut Methods
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDescription(string id, string Description = null, bool redirect = false)
|
public virtual ActionResult UpdateDescription(string id, string Description = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pDescription, Description, redirect);
|
return Update(id, pDescription, Description, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDocumentTemplates(string id, List<string> DocumentTemplates = null, bool redirect = false)
|
public virtual ActionResult UpdateDocumentTemplates(string id, List<string> DocumentTemplates = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -104,43 +107,49 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.DocumentTemplate.ShowPackage(package.Id));
|
return RedirectToAction(MVC.Config.DocumentTemplate.ShowPackage(package.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)]
|
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateFilterExpression(string id, string FilterExpression = null, bool redirect = false)
|
public virtual ActionResult UpdateFilterExpression(string id, string FilterExpression = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pFilterExpression, FilterExpression, redirect);
|
return Update(id, pFilterExpression, FilterExpression, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)]
|
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateOnGenerateExpression(string id, string OnGenerateExpression = null, bool redirect = false)
|
public virtual ActionResult UpdateOnGenerateExpression(string id, string OnGenerateExpression = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pOnGenerateExpression, OnGenerateExpression, redirect);
|
return Update(id, pOnGenerateExpression, OnGenerateExpression, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateIsHidden(string id, string IsHidden = null, bool redirect = false)
|
public virtual ActionResult UpdateIsHidden(string id, string IsHidden = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pIsHidden, IsHidden, redirect);
|
return Update(id, pIsHidden, IsHidden, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsertBlankPages(string id, string InsertBlankPages = null, bool redirect = false)
|
public virtual ActionResult UpdateInsertBlankPages(string id, string InsertBlankPages = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pInsertBlankPages, InsertBlankPages, redirect);
|
return Update(id, pInsertBlankPages, InsertBlankPages, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateScope(string id, string Scope = null, bool redirect = false)
|
public virtual ActionResult UpdateScope(string id, string Scope = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pScope, Scope, redirect);
|
return Update(id, pScope, Scope, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateJobSubTypes(string id, List<string> JobSubTypes = null, bool redirect = false)
|
public virtual ActionResult UpdateJobSubTypes(string id, List<string> JobSubTypes = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -158,32 +167,31 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.DocumentTemplate.ShowPackage(package.Id));
|
return RedirectToAction(MVC.Config.DocumentTemplate.ShowPackage(package.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Update Properties
|
#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();
|
Package.Description = description;
|
||||||
if (Package.Description != description)
|
DocumentTemplatePackages.UpdatePackage(Package);
|
||||||
{
|
|
||||||
Package.Description = description;
|
|
||||||
DocumentTemplatePackages.UpdatePackage(Package);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
throw new Exception("Invalid Description");
|
|
||||||
}
|
}
|
||||||
private void UpdateDocumentTemplates(DocumentTemplatePackage Package, List<string> DocumentTemplates)
|
private void UpdateDocumentTemplates(DocumentTemplatePackage Package, List<string> DocumentTemplates)
|
||||||
{
|
{
|
||||||
@@ -349,12 +357,13 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Actions
|
#region Actions
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.BulkGenerate)]
|
[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))
|
if (string.IsNullOrEmpty(id))
|
||||||
throw new ArgumentNullException(nameof(id));
|
throw new ArgumentNullException(nameof(id));
|
||||||
if (string.IsNullOrEmpty(DataIds))
|
if (string.IsNullOrEmpty(dataIds))
|
||||||
throw new ArgumentNullException(nameof(DataIds));
|
throw new ArgumentNullException(nameof(dataIds));
|
||||||
|
|
||||||
var package = DocumentTemplatePackages.GetPackage(id);
|
var package = DocumentTemplatePackages.GetPackage(id);
|
||||||
|
|
||||||
@@ -376,19 +385,20 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
throw new InvalidOperationException("Unknown DocumentType Scope");
|
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 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");
|
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))
|
if (string.IsNullOrWhiteSpace(id))
|
||||||
throw new ArgumentNullException(nameof(id));
|
throw new ArgumentNullException(nameof(id));
|
||||||
if (string.IsNullOrWhiteSpace(TargetId))
|
if (string.IsNullOrWhiteSpace(targetId))
|
||||||
throw new ArgumentNullException(nameof(TargetId));
|
throw new ArgumentNullException(nameof(targetId));
|
||||||
|
|
||||||
var package = DocumentTemplatePackages.GetPackage(id);
|
var package = DocumentTemplatePackages.GetPackage(id);
|
||||||
if (package == null)
|
if (package == null)
|
||||||
@@ -410,9 +420,9 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// resolve target
|
// resolve target
|
||||||
var target = package.ResolveScopeTarget(Database, TargetId);
|
var target = package.ResolveScopeTarget(Database, targetId);
|
||||||
if (target == null)
|
if (target == null)
|
||||||
throw new ArgumentException("Target not found", nameof(TargetId));
|
throw new ArgumentException("Target not found", nameof(targetId));
|
||||||
|
|
||||||
var timestamp = DateTime.Now;
|
var timestamp = DateTime.Now;
|
||||||
var document = default(Stream);
|
var document = default(Stream);
|
||||||
@@ -426,6 +436,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Delete)]
|
[DiscoAuthorize(Claims.Config.DocumentTemplate.Delete)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Delete(string id, bool? redirect = false)
|
public virtual ActionResult Delete(string id, bool? redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -445,7 +456,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.DocumentTemplate.Index(null));
|
return RedirectToAction(MVC.Config.DocumentTemplate.Index(null));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
throw new Exception("Invalid Document Template Package Id");
|
throw new Exception("Invalid Document Template Package Id");
|
||||||
}
|
}
|
||||||
@@ -454,7 +465,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,8 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
public partial class EnrolmentController : AuthorizedDatabaseController
|
public partial class EnrolmentController : AuthorizedDatabaseController
|
||||||
{
|
{
|
||||||
[HttpPost]
|
|
||||||
[ValidateAntiForgeryToken]
|
|
||||||
[DiscoAuthorize(Claims.Device.Actions.EnrolDevices)]
|
[DiscoAuthorize(Claims.Device.Actions.EnrolDevices)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult ResolveSessionPending(string sessionId, bool approve, int? deviceProfileId, int? deviceBatchId, string reason)
|
public virtual ActionResult ResolveSessionPending(string sessionId, bool approve, int? deviceProfileId, int? deviceBatchId, string reason)
|
||||||
{
|
{
|
||||||
if (approve && deviceProfileId == null)
|
if (approve && deviceProfileId == null)
|
||||||
@@ -18,11 +17,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
WindowsDeviceEnrolment.ResolvePendingEnrolment(sessionId, approve, CurrentUser.UserId, deviceProfileId, deviceBatchId, reason);
|
WindowsDeviceEnrolment.ResolvePendingEnrolment(sessionId, approve, CurrentUser.UserId, deviceProfileId, deviceBatchId, reason);
|
||||||
|
|
||||||
return new HttpStatusCodeResult(200);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
[DiscoAuthorize(Claims.Config.Enrolment.Configure)]
|
[DiscoAuthorize(Claims.Config.Enrolment.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult PendingTimeoutMinutes(int PendingTimeoutMinutes)
|
public virtual ActionResult PendingTimeoutMinutes(int PendingTimeoutMinutes)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -31,7 +30,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
Database.DiscoConfiguration.Bootstrapper.PendingTimeout = TimeSpan.FromMinutes(PendingTimeoutMinutes);
|
Database.DiscoConfiguration.Bootstrapper.PendingTimeout = TimeSpan.FromMinutes(PendingTimeoutMinutes);
|
||||||
Database.SaveChanges();
|
Database.SaveChanges();
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -40,7 +39,53 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
var errorState = ModelState.First(m => m.Value.Errors.Any());
|
var errorState = ModelState.First(m => m.Value.Errors.Any());
|
||||||
var error = errorState.Value.Errors.First();
|
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());
|
SavedExports.UpdateSavedExport(Database, model.ToSavedExport());
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public virtual ActionResult TypeDescriptor(string type, bool staticMembersOnly = false)
|
public virtual ActionResult TypeDescriptor(string type, bool staticMembersOnly = false)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(type))
|
if (string.IsNullOrWhiteSpace(type))
|
||||||
return new HttpStatusCodeResult(400, "Type is required");
|
return BadRequest("Type is required");
|
||||||
|
|
||||||
var t = Type.GetType(type, false);
|
var t = Type.GetType(type, false);
|
||||||
|
|
||||||
@@ -28,15 +28,15 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
var typeNameParts = type.Split(new string[] { ", " }, StringSplitOptions.None);
|
var typeNameParts = type.Split(new string[] { ", " }, StringSplitOptions.None);
|
||||||
if (typeNameParts.Length < 2)
|
if (typeNameParts.Length < 2)
|
||||||
return Json("Invalid Type Specified");
|
return BadRequest("Invalid Type Specified");
|
||||||
|
|
||||||
if (!ExpressionExtensionProviderFeature.TryGetExtensionAssembly(typeNameParts[1], out var assembly))
|
if (!ExpressionExtensionProviderFeature.TryGetExtensionAssembly(typeNameParts[1], out var assembly))
|
||||||
return Json("Invalid Type Specified");
|
return BadRequest("Invalid Type Specified");
|
||||||
|
|
||||||
t = assembly.GetType(typeNameParts[0]);
|
t = assembly.GetType(typeNameParts[0]);
|
||||||
|
|
||||||
if (t == null)
|
if (t == null)
|
||||||
return Json("Invalid Type Specified");
|
return BadRequest("Invalid Type Specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Json(ExpressionTypeDescriptor.Build(t, staticMembersOnly));
|
return Json(ExpressionTypeDescriptor.Build(t, staticMembersOnly));
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -287,7 +288,6 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return this.RedirectToAction(MVC.Job.Show(job.Id), resultUrlFragment);
|
return this.RedirectToAction(MVC.Job.Show(job.Id), resultUrlFragment);
|
||||||
//return RedirectToAction(MVC.Job.Show(job.Id));
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (resultData != null)
|
if (resultData != null)
|
||||||
@@ -296,7 +296,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,22 +305,25 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Update Shortcut Methods
|
#region Update Shortcut Methods
|
||||||
[DiscoAuthorize(Claims.Job.Properties.ExpectedClosedDate)]
|
[DiscoAuthorize(Claims.Job.Properties.ExpectedClosedDate)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateExpectedClosedDate(int id, string ExpectedClosedDate, bool? redirect = null)
|
public virtual ActionResult UpdateExpectedClosedDate(int id, string ExpectedClosedDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pExpectedClosedDate, ExpectedClosedDate, redirect);
|
return Update(id, pExpectedClosedDate, ExpectedClosedDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.DeviceHeldLocation)]
|
[DiscoAuthorize(Claims.Job.Properties.DeviceHeldLocation)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDeviceHeldLocation(int id, string DeviceHeldLocation, bool? redirect = null)
|
public virtual ActionResult UpdateDeviceHeldLocation(int id, string DeviceHeldLocation, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pDeviceHeldLocation, DeviceHeldLocation, redirect);
|
return Update(id, pDeviceHeldLocation, DeviceHeldLocation, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.Flags)]
|
[DiscoAuthorize(Claims.Job.Properties.Flags)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateFlags(int id, string Flags, bool? redirect = null)
|
public virtual ActionResult UpdateFlags(int id, string Flags, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pFlags, Flags, redirect);
|
return Update(id, pFlags, Flags, redirect);
|
||||||
@@ -328,61 +331,73 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
#region NonWarranty
|
#region NonWarranty
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.AccountingChargeRequired)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.AccountingChargeRequired)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateNonWarrantyAccountingChargeRequired(int id, string AccountingChargeRequiredDate, bool? redirect = null)
|
public virtual ActionResult UpdateNonWarrantyAccountingChargeRequired(int id, string AccountingChargeRequiredDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pNonWarrantyAccountingChargeRequired, AccountingChargeRequiredDate, redirect);
|
return Update(id, pNonWarrantyAccountingChargeRequired, AccountingChargeRequiredDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.AccountingChargeAdded)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.AccountingChargeAdded)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateNonWarrantyAccountingChargeAdded(int id, string AccountingChargeAddedDate, bool? redirect = null)
|
public virtual ActionResult UpdateNonWarrantyAccountingChargeAdded(int id, string AccountingChargeAddedDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pNonWarrantyAccountingChargeAdded, AccountingChargeAddedDate, redirect);
|
return Update(id, pNonWarrantyAccountingChargeAdded, AccountingChargeAddedDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.AccountingChargePaid)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.AccountingChargePaid)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateNonWarrantyAccountingChargePaid(int id, string AccountingChargePaidDate, bool? redirect = null)
|
public virtual ActionResult UpdateNonWarrantyAccountingChargePaid(int id, string AccountingChargePaidDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pNonWarrantyAccountingChargePaid, AccountingChargePaidDate, redirect);
|
return Update(id, pNonWarrantyAccountingChargePaid, AccountingChargePaidDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.PurchaseOrderRaised)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.PurchaseOrderRaised)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateNonWarrantyPurchaseOrderRaised(int id, string PurchaseOrderRaisedDate, bool? redirect = null)
|
public virtual ActionResult UpdateNonWarrantyPurchaseOrderRaised(int id, string PurchaseOrderRaisedDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pNonWarrantyPurchaseOrderRaised, PurchaseOrderRaisedDate, redirect);
|
return Update(id, pNonWarrantyPurchaseOrderRaised, PurchaseOrderRaisedDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.PurchaseOrderReference)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.PurchaseOrderReference)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateNonWarrantyPurchaseOrderReference(int id, string PurchaseOrderReference, bool? redirect = null)
|
public virtual ActionResult UpdateNonWarrantyPurchaseOrderReference(int id, string PurchaseOrderReference, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pNonWarrantyPurchaseOrderReference, PurchaseOrderReference, redirect);
|
return Update(id, pNonWarrantyPurchaseOrderReference, PurchaseOrderReference, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.PurchaseOrderSent)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.PurchaseOrderSent)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateNonWarrantyPurchaseOrderSent(int id, string PurchaseOrderSentDate, bool? redirect = null)
|
public virtual ActionResult UpdateNonWarrantyPurchaseOrderSent(int id, string PurchaseOrderSentDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pNonWarrantyPurchaseOrderSent, PurchaseOrderSentDate, redirect);
|
return Update(id, pNonWarrantyPurchaseOrderSent, PurchaseOrderSentDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InvoiceReceived)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InvoiceReceived)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateNonWarrantyInvoiceReceived(int id, string InvoiceReceivedDate, bool? redirect = null)
|
public virtual ActionResult UpdateNonWarrantyInvoiceReceived(int id, string InvoiceReceivedDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pNonWarrantyInvoiceReceived, InvoiceReceivedDate, redirect);
|
return Update(id, pNonWarrantyInvoiceReceived, InvoiceReceivedDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.RepairerName)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.RepairerName)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateNonWarrantyRepairerName(int id, string RepairerName, bool? redirect = null)
|
public virtual ActionResult UpdateNonWarrantyRepairerName(int id, string RepairerName, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pNonWarrantyRepairerName, RepairerName, redirect);
|
return Update(id, pNonWarrantyRepairerName, RepairerName, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.RepairerLoggedDate)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.RepairerLoggedDate)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateNonWarrantyRepairerLoggedDate(int id, string RepairerLoggedDate, bool? redirect = null)
|
public virtual ActionResult UpdateNonWarrantyRepairerLoggedDate(int id, string RepairerLoggedDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pNonWarrantyRepairerLoggedDate, RepairerLoggedDate, redirect);
|
return Update(id, pNonWarrantyRepairerLoggedDate, RepairerLoggedDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.RepairerReference)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.RepairerReference)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateNonWarrantyRepairerReference(int id, string RepairerReference, bool? redirect = null)
|
public virtual ActionResult UpdateNonWarrantyRepairerReference(int id, string RepairerReference, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pNonWarrantyRepairerReference, RepairerReference, redirect);
|
return Update(id, pNonWarrantyRepairerReference, RepairerReference, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.RepairerCompletedDate)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.RepairerCompletedDate)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateNonWarrantyRepairerCompletedDate(int id, string RepairerCompletedDate, bool? redirect = null)
|
public virtual ActionResult UpdateNonWarrantyRepairerCompletedDate(int id, string RepairerCompletedDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pNonWarrantyRepairerCompletedDate, RepairerCompletedDate, redirect);
|
return Update(id, pNonWarrantyRepairerCompletedDate, RepairerCompletedDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.IsInsuranceClaim)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.IsInsuranceClaim)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateNonWarrantyIsInsuranceClaim(int id, bool IsInsuranceClaim, bool? redirect = null)
|
public virtual ActionResult UpdateNonWarrantyIsInsuranceClaim(int id, bool IsInsuranceClaim, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pNonWarrantyIsInsuranceClaim, IsInsuranceClaim.ToString(), redirect);
|
return Update(id, pNonWarrantyIsInsuranceClaim, IsInsuranceClaim.ToString(), redirect);
|
||||||
@@ -392,91 +407,109 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Insurance
|
#region Insurance
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceLossOrDamageDate(int id, string LossOrDamageDate, bool? redirect = null)
|
public virtual ActionResult UpdateInsuranceLossOrDamageDate(int id, string LossOrDamageDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceLossOrDamageDate, LossOrDamageDate, redirect);
|
return Update(id, pInsuranceLossOrDamageDate, LossOrDamageDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceEventLocation(int id, string EventLocation, bool? redirect = null)
|
public virtual ActionResult UpdateInsuranceEventLocation(int id, string EventLocation, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceEventLocation, EventLocation, redirect);
|
return Update(id, pInsuranceEventLocation, EventLocation, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceDescription(int id, string Description, bool? redirect = null)
|
public virtual ActionResult UpdateInsuranceDescription(int id, string Description, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceDescription, Description, redirect);
|
return Update(id, pInsuranceDescription, Description, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceThirdPartyCaused(int id, string ThirdPartyCaused, bool? redirect = null)
|
public virtual ActionResult UpdateInsuranceThirdPartyCaused(int id, string ThirdPartyCaused, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceThirdPartyCaused, ThirdPartyCaused, redirect);
|
return Update(id, pInsuranceThirdPartyCaused, ThirdPartyCaused, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceThirdPartyCausedName(int id, string ThirdPartyCausedName, bool? redirect = null)
|
public virtual ActionResult UpdateInsuranceThirdPartyCausedName(int id, string ThirdPartyCausedName, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceThirdPartyCausedName, ThirdPartyCausedName, redirect);
|
return Update(id, pInsuranceThirdPartyCausedName, ThirdPartyCausedName, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceThirdPartyCausedWhy(int id, string ThirdPartyCausedWhy, bool? redirect = null)
|
public virtual ActionResult UpdateInsuranceThirdPartyCausedWhy(int id, string ThirdPartyCausedWhy, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceThirdPartyCausedWhy, ThirdPartyCausedWhy, redirect);
|
return Update(id, pInsuranceThirdPartyCausedWhy, ThirdPartyCausedWhy, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceWitnessesNamesAddresses(int id, string WitnessesNamesAddresses, bool? redirect = null)
|
public virtual ActionResult UpdateInsuranceWitnessesNamesAddresses(int id, string WitnessesNamesAddresses, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceWitnessesNamesAddresses, WitnessesNamesAddresses, redirect);
|
return Update(id, pInsuranceWitnessesNamesAddresses, WitnessesNamesAddresses, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceBurglaryTheftMethodOfEntry(int id, string BurglaryTheftMethodOfEntry, bool? redirect = null)
|
public virtual ActionResult UpdateInsuranceBurglaryTheftMethodOfEntry(int id, string BurglaryTheftMethodOfEntry, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceBurglaryTheftMethodOfEntry, BurglaryTheftMethodOfEntry, redirect);
|
return Update(id, pInsuranceBurglaryTheftMethodOfEntry, BurglaryTheftMethodOfEntry, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsurancePropertyLastSeenDate(int id, string PropertyLastSeenDate, bool? redirect = null)
|
public virtual ActionResult UpdateInsurancePropertyLastSeenDate(int id, string PropertyLastSeenDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsurancePropertyLastSeenDate, PropertyLastSeenDate, redirect);
|
return Update(id, pInsurancePropertyLastSeenDate, PropertyLastSeenDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsurancePoliceNotified(int id, string PoliceNotified, bool? redirect = null)
|
public virtual ActionResult UpdateInsurancePoliceNotified(int id, string PoliceNotified, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsurancePoliceNotified, PoliceNotified, redirect);
|
return Update(id, pInsurancePoliceNotified, PoliceNotified, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsurancePoliceNotifiedStation(int id, string PoliceNotifiedStation, bool? redirect = null)
|
public virtual ActionResult UpdateInsurancePoliceNotifiedStation(int id, string PoliceNotifiedStation, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsurancePoliceNotifiedStation, PoliceNotifiedStation, redirect);
|
return Update(id, pInsurancePoliceNotifiedStation, PoliceNotifiedStation, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsurancePoliceNotifiedDate(int id, string PoliceNotifiedDate, bool? redirect = null)
|
public virtual ActionResult UpdateInsurancePoliceNotifiedDate(int id, string PoliceNotifiedDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsurancePoliceNotifiedDate, PoliceNotifiedDate, redirect);
|
return Update(id, pInsurancePoliceNotifiedDate, PoliceNotifiedDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsurancePoliceNotifiedCrimeReportNo(int id, string PoliceNotifiedCrimeReportNo, bool? redirect = null)
|
public virtual ActionResult UpdateInsurancePoliceNotifiedCrimeReportNo(int id, string PoliceNotifiedCrimeReportNo, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsurancePoliceNotifiedCrimeReportNo, PoliceNotifiedCrimeReportNo, redirect);
|
return Update(id, pInsurancePoliceNotifiedCrimeReportNo, PoliceNotifiedCrimeReportNo, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceRecoverReduceAction(int id, string RecoverReduceAction, bool? redirect = null)
|
public virtual ActionResult UpdateInsuranceRecoverReduceAction(int id, string RecoverReduceAction, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceRecoverReduceAction, RecoverReduceAction, redirect);
|
return Update(id, pInsuranceRecoverReduceAction, RecoverReduceAction, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceOtherInterestedParties(int id, string OtherInterestedParties, bool? redirect = null)
|
public virtual ActionResult UpdateInsuranceOtherInterestedParties(int id, string OtherInterestedParties, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceOtherInterestedParties, OtherInterestedParties, redirect);
|
return Update(id, pInsuranceOtherInterestedParties, OtherInterestedParties, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceDetails)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceDateOfPurchase(int id, string DateOfPurchase, bool? redirect = null)
|
public virtual ActionResult UpdateInsuranceDateOfPurchase(int id, string DateOfPurchase, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceDateOfPurchase, DateOfPurchase, redirect);
|
return Update(id, pInsuranceDateOfPurchase, DateOfPurchase, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceClaimFormSentDate(int id, string ClaimFormSentDate, bool? redirect = null)
|
public virtual ActionResult UpdateInsuranceClaimFormSentDate(int id, string ClaimFormSentDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceClaimFormSentDate, ClaimFormSentDate, redirect);
|
return Update(id, pInsuranceClaimFormSentDate, ClaimFormSentDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.InsuranceClaimFormSent)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInsuranceClaimFormSentUserId(int id, string ClaimFormSentUserId, bool? redirect = null)
|
public virtual ActionResult UpdateInsuranceClaimFormSentUserId(int id, string ClaimFormSentUserId, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pInsuranceClaimFormSentUserId, ClaimFormSentUserId, redirect);
|
return Update(id, pInsuranceClaimFormSentUserId, ClaimFormSentUserId, redirect);
|
||||||
@@ -486,21 +519,25 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
#region Warranty
|
#region Warranty
|
||||||
[DiscoAuthorize(Claims.Job.Properties.WarrantyProperties.ExternalName)]
|
[DiscoAuthorize(Claims.Job.Properties.WarrantyProperties.ExternalName)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateWarrantyExternalName(int id, string ExternalName, bool? redirect = null)
|
public virtual ActionResult UpdateWarrantyExternalName(int id, string ExternalName, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pWarrantyExternalName, ExternalName, redirect);
|
return Update(id, pWarrantyExternalName, ExternalName, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.WarrantyProperties.ExternalLoggedDate)]
|
[DiscoAuthorize(Claims.Job.Properties.WarrantyProperties.ExternalLoggedDate)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateWarrantyExternalLoggedDate(int id, string ExternalLoggedDate, bool? redirect = null)
|
public virtual ActionResult UpdateWarrantyExternalLoggedDate(int id, string ExternalLoggedDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pWarrantyExternalLoggedDate, ExternalLoggedDate, redirect);
|
return Update(id, pWarrantyExternalLoggedDate, ExternalLoggedDate, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.WarrantyProperties.ExternalReference)]
|
[DiscoAuthorize(Claims.Job.Properties.WarrantyProperties.ExternalReference)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateWarrantyExternalReference(int id, string ExternalReference, bool? redirect = null)
|
public virtual ActionResult UpdateWarrantyExternalReference(int id, string ExternalReference, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pWarrantyExternalReference, ExternalReference, redirect);
|
return Update(id, pWarrantyExternalReference, ExternalReference, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Job.Properties.WarrantyProperties.ExternalCompletedDate)]
|
[DiscoAuthorize(Claims.Job.Properties.WarrantyProperties.ExternalCompletedDate)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateWarrantyExternalCompletedDate(int id, string ExternalCompletedDate, bool? redirect = null)
|
public virtual ActionResult UpdateWarrantyExternalCompletedDate(int id, string ExternalCompletedDate, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pWarrantyExternalCompletedDate, ExternalCompletedDate, redirect);
|
return Update(id, pWarrantyExternalCompletedDate, ExternalCompletedDate, redirect);
|
||||||
@@ -1424,6 +1461,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Job Actions
|
#region Job Actions
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Job.Actions.UpdateSubTypes)]
|
[DiscoAuthorize(Claims.Job.Actions.UpdateSubTypes)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateSubTypes(int id, List<string> SubTypes = null, bool? AddComponents = null, bool? redirect = null)
|
public virtual ActionResult UpdateSubTypes(int id, List<string> SubTypes = null, bool? AddComponents = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -1448,18 +1486,19 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Job.Show(job.Id));
|
return RedirectToAction(MVC.Job.Show(job.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Job.Properties.Flags)]
|
[DiscoAuthorize(Claims.Job.Properties.Flags)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateFlag(int id, long? Flag, string Reason, bool? redirect = null)
|
public virtual ActionResult UpdateFlag(int id, long? Flag, string Reason, bool? redirect = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -1508,7 +1547,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Job.Show(job.Id));
|
return RedirectToAction(MVC.Job.Show(job.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1520,11 +1559,12 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Job.Properties.WaitingForUserAction)]
|
[DiscoAuthorize(Claims.Job.Properties.WaitingForUserAction)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult WaitingForUserAction(int id, string Reason, bool? redirect = null)
|
public virtual ActionResult WaitingForUserAction(int id, string Reason, bool? redirect = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -1544,18 +1584,19 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Job.Show(job.Id));
|
return RedirectToAction(MVC.Job.Show(job.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Job.Properties.NotWaitingForUserAction)]
|
[DiscoAuthorize(Claims.Job.Properties.NotWaitingForUserAction)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult NotWaitingForUserAction(int id, string Resolution, bool? redirect = null)
|
public virtual ActionResult NotWaitingForUserAction(int id, string Resolution, bool? redirect = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -1575,18 +1616,19 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Job.Show(job.Id));
|
return RedirectToAction(MVC.Job.Show(job.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Job.Properties.DeviceReadyForReturn)]
|
[DiscoAuthorize(Claims.Job.Properties.DeviceReadyForReturn)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult DeviceReadyForReturn(int id, bool redirect)
|
public virtual ActionResult DeviceReadyForReturn(int id, bool redirect)
|
||||||
{
|
{
|
||||||
Database.Configuration.LazyLoadingEnabled = true;
|
Database.Configuration.LazyLoadingEnabled = true;
|
||||||
@@ -1601,17 +1643,18 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Job.Show(id));
|
return RedirectToAction(MVC.Job.Show(id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
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)]
|
[DiscoAuthorize(Claims.Job.Properties.DeviceHeld)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult DeviceHeld(int id, bool redirect)
|
public virtual ActionResult DeviceHeld(int id, bool redirect)
|
||||||
{
|
{
|
||||||
var j = Database.Jobs.Find(id);
|
var j = Database.Jobs.Find(id);
|
||||||
@@ -1625,17 +1668,18 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Job.Show(id));
|
return RedirectToAction(MVC.Job.Show(id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
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)]
|
[DiscoAuthorize(Claims.Job.Properties.DeviceReturned)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult DeviceReturned(int id, bool redirect)
|
public virtual ActionResult DeviceReturned(int id, bool redirect)
|
||||||
{
|
{
|
||||||
var j = Database.Jobs.Find(id);
|
var j = Database.Jobs.Find(id);
|
||||||
@@ -1649,17 +1693,18 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Job.Show(id));
|
return RedirectToAction(MVC.Job.Show(id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
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)]
|
[DiscoAuthorize(Claims.Job.Actions.ForceClose)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult ForceClose(int id, string Reason, bool? redirect = null)
|
public virtual ActionResult ForceClose(int id, string Reason, bool? redirect = null)
|
||||||
{
|
{
|
||||||
var j = Database.Jobs.Find(id);
|
var j = Database.Jobs.Find(id);
|
||||||
@@ -1674,17 +1719,18 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Job.Show(id));
|
return RedirectToAction(MVC.Job.Show(id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
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)]
|
[DiscoAuthorize(Claims.Job.Actions.Close)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Close(int id, bool redirect)
|
public virtual ActionResult Close(int id, bool redirect)
|
||||||
{
|
{
|
||||||
var j = Database.Jobs.Find(id);
|
var j = Database.Jobs.Find(id);
|
||||||
@@ -1699,17 +1745,18 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Job.Show(id));
|
return RedirectToAction(MVC.Job.Show(id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
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)]
|
[DiscoAuthorize(Claims.Job.Actions.Reopen)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Reopen(int id, bool redirect)
|
public virtual ActionResult Reopen(int id, bool redirect)
|
||||||
{
|
{
|
||||||
var j = Database.Jobs
|
var j = Database.Jobs
|
||||||
@@ -1725,17 +1772,18 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Job.Show(id));
|
return RedirectToAction(MVC.Job.Show(id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
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)]
|
[DiscoAuthorize(Claims.Job.Actions.Delete)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Delete(int id, bool redirect)
|
public virtual ActionResult Delete(int id, bool redirect)
|
||||||
{
|
{
|
||||||
var j = Database.Jobs.Find(id);
|
var j = Database.Jobs.Find(id);
|
||||||
@@ -1750,17 +1798,18 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Job.Index());
|
return RedirectToAction(MVC.Job.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
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)]
|
[DiscoAuthorize(Claims.Job.Actions.ConvertHWarToHNWar)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult ConvertHWarToHNWar(int id, bool redirect)
|
public virtual ActionResult ConvertHWarToHNWar(int id, bool redirect)
|
||||||
{
|
{
|
||||||
var j = Database.Jobs.Find(id);
|
var j = Database.Jobs.Find(id);
|
||||||
@@ -1775,14 +1824,14 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Job.Show(j.Id));
|
return RedirectToAction(MVC.Job.Show(j.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
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
|
#endregion
|
||||||
@@ -1872,7 +1921,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Job Attachements
|
#region Job Attachments
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Job.ShowAttachments), OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
|
[DiscoAuthorize(Claims.Job.ShowAttachments), OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
|
||||||
public virtual ActionResult AttachmentDownload(int id)
|
public virtual ActionResult AttachmentDownload(int id)
|
||||||
@@ -1907,7 +1956,8 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return HttpNotFound("Invalid Attachment Number");
|
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)
|
public virtual ActionResult AttachmentUpload(int id, string comments)
|
||||||
{
|
{
|
||||||
var j = Database.Jobs.Find(id);
|
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)]
|
[DiscoAuthorizeAny(Claims.Job.Actions.RemoveAnyAttachments, Claims.Job.Actions.RemoveOwnAttachments)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult AttachmentRemove(int id)
|
public virtual ActionResult AttachmentRemove(int id)
|
||||||
{
|
{
|
||||||
var ja = Database.JobAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
|
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);
|
ja.OnDelete(Database);
|
||||||
Database.SaveChanges();
|
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)]
|
[DiscoAuthorize(Claims.Job.Actions.AddAttachments)]
|
||||||
@@ -2028,11 +2079,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
catch (InvalidOperationException ex)
|
catch (InvalidOperationException ex)
|
||||||
{
|
{
|
||||||
return Json(new
|
return BadRequest(ex.Message);
|
||||||
{
|
|
||||||
Success = false,
|
|
||||||
ErrorMessage = ex.Message,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2041,55 +2088,58 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Job Components
|
#region Job Components
|
||||||
|
|
||||||
[DiscoAuthorizeAll(Claims.Job.Properties.NonWarrantyProperties.AddComponents, Claims.Job.Properties.NonWarrantyProperties.EditComponents)]
|
[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);
|
var j = Database.Jobs.Find(id);
|
||||||
if (j != null)
|
if (j != null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Description))
|
if (string.IsNullOrEmpty(description))
|
||||||
Description = "?";
|
description = "?";
|
||||||
if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$"))
|
if (!string.IsNullOrEmpty(cost) && cost.Contains("$"))
|
||||||
Cost = Cost.Substring(Cost.IndexOf("$") + 1);
|
cost = cost.Substring(cost.IndexOf("$") + 1);
|
||||||
decimal.TryParse(Cost, out var cost);
|
decimal.TryParse(cost, out var costValue);
|
||||||
|
|
||||||
var jc = new JobComponent()
|
var jc = new JobComponent()
|
||||||
{
|
{
|
||||||
JobId = j.Id,
|
JobId = j.Id,
|
||||||
Description = Description,
|
Description = description,
|
||||||
Cost = cost,
|
Cost = costValue,
|
||||||
TechUserId = CurrentUser.UserId
|
TechUserId = CurrentUser.UserId
|
||||||
};
|
};
|
||||||
Database.JobComponents.Add(jc);
|
Database.JobComponents.Add(jc);
|
||||||
Database.SaveChanges();
|
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)]
|
[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);
|
var jc = Database.JobComponents.Find(id);
|
||||||
if (jc != null)
|
if (jc != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Description))
|
if (string.IsNullOrEmpty(description))
|
||||||
Description = "?";
|
description = "?";
|
||||||
if (!string.IsNullOrEmpty(Cost) && Cost.Contains("$"))
|
if (!string.IsNullOrEmpty(cost) && cost.Contains("$"))
|
||||||
Cost = Cost.Substring(Cost.IndexOf("$") + 1);
|
cost = cost.Substring(cost.IndexOf("$") + 1);
|
||||||
decimal.TryParse(Cost, out var cost);
|
decimal.TryParse(cost, out var costValue);
|
||||||
|
|
||||||
jc.Description = Description;
|
jc.Description = description;
|
||||||
jc.Cost = cost;
|
jc.Cost = costValue;
|
||||||
Database.SaveChanges();
|
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)]
|
[DiscoAuthorize(Claims.Job.Properties.NonWarrantyProperties.EditComponents)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult ComponentRemove(int id)
|
public virtual ActionResult ComponentRemove(int id)
|
||||||
{
|
{
|
||||||
var jc = Database.JobComponents.Find(id);
|
var jc = Database.JobComponents.Find(id);
|
||||||
@@ -2097,9 +2147,9 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
Database.JobComponents.Remove(jc);
|
Database.JobComponents.Remove(jc);
|
||||||
Database.SaveChanges();
|
Database.SaveChanges();
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
return Json("Invalid Job Component Number", JsonRequestBehavior.AllowGet);
|
return BadRequest("Invalid Job Component Number");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -2116,30 +2166,6 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
#endregion
|
#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)]
|
[DiscoAuthorize(Claims.Job.Properties.DeviceHeldLocation)]
|
||||||
public virtual ActionResult DeviceHeldLocations()
|
public virtual ActionResult DeviceHeldLocations()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public partial class JobPreferencesController : AuthorizedDatabaseController
|
public partial class JobPreferencesController : AuthorizedDatabaseController
|
||||||
{
|
{
|
||||||
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateInitialCommentsTemplate(string initialCommentsTemplate, bool redirect = false)
|
public virtual ActionResult UpdateInitialCommentsTemplate(string initialCommentsTemplate, bool redirect = false)
|
||||||
{
|
{
|
||||||
string expression = null;
|
string expression = null;
|
||||||
@@ -32,10 +33,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateLongRunningJobDaysThreshold(int LongRunningJobDaysThreshold, bool redirect = false)
|
public virtual ActionResult UpdateLongRunningJobDaysThreshold(int LongRunningJobDaysThreshold, bool redirect = false)
|
||||||
{
|
{
|
||||||
Database.DiscoConfiguration.JobPreferences.LongRunningJobDaysThreshold = LongRunningJobDaysThreshold;
|
Database.DiscoConfiguration.JobPreferences.LongRunningJobDaysThreshold = LongRunningJobDaysThreshold;
|
||||||
@@ -44,10 +46,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateStaleJobMinutesThreshold(int StaleJobMinutesThreshold, bool redirect = false)
|
public virtual ActionResult UpdateStaleJobMinutesThreshold(int StaleJobMinutesThreshold, bool redirect = false)
|
||||||
{
|
{
|
||||||
Database.DiscoConfiguration.JobPreferences.StaleJobMinutesThreshold = StaleJobMinutesThreshold;
|
Database.DiscoConfiguration.JobPreferences.StaleJobMinutesThreshold = StaleJobMinutesThreshold;
|
||||||
@@ -56,10 +59,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateLodgmentIncludeAllAttachmentsByDefault(bool includeAllAttachmentsByDefault, bool redirect = false)
|
public virtual ActionResult UpdateLodgmentIncludeAllAttachmentsByDefault(bool includeAllAttachmentsByDefault, bool redirect = false)
|
||||||
{
|
{
|
||||||
Database.DiscoConfiguration.JobPreferences.LodgmentIncludeAllAttachmentsByDefault = includeAllAttachmentsByDefault;
|
Database.DiscoConfiguration.JobPreferences.LodgmentIncludeAllAttachmentsByDefault = includeAllAttachmentsByDefault;
|
||||||
@@ -68,10 +72,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDefaultNoticeboardTheme(string DefaultNoticeboardTheme, bool redirect = false)
|
public virtual ActionResult UpdateDefaultNoticeboardTheme(string DefaultNoticeboardTheme, bool redirect = false)
|
||||||
{
|
{
|
||||||
Database.DiscoConfiguration.JobPreferences.DefaultNoticeboardTheme = DefaultNoticeboardTheme;
|
Database.DiscoConfiguration.JobPreferences.DefaultNoticeboardTheme = DefaultNoticeboardTheme;
|
||||||
@@ -82,10 +87,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateLocationMode(LocationModes LocationMode, bool redirect = false)
|
public virtual ActionResult UpdateLocationMode(LocationModes LocationMode, bool redirect = false)
|
||||||
{
|
{
|
||||||
Database.DiscoConfiguration.JobPreferences.LocationMode = LocationMode;
|
Database.DiscoConfiguration.JobPreferences.LocationMode = LocationMode;
|
||||||
@@ -94,13 +100,14 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
[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))
|
.Where(i => !string.IsNullOrWhiteSpace(i))
|
||||||
.Select(i => i.Trim())
|
.Select(i => i.Trim())
|
||||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||||
@@ -112,10 +119,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult ImportLocationList(string LocationList, bool AutomaticList = false, bool Override = false, bool redirect = false)
|
public virtual ActionResult ImportLocationList(string LocationList, bool AutomaticList = false, bool Override = false, bool redirect = false)
|
||||||
{
|
{
|
||||||
IEnumerable<string> list;
|
IEnumerable<string> list;
|
||||||
@@ -152,10 +160,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateOnCreateExpression(string OnCreateExpression, bool redirect = false)
|
public virtual ActionResult UpdateOnCreateExpression(string OnCreateExpression, bool redirect = false)
|
||||||
{
|
{
|
||||||
string expression = null;
|
string expression = null;
|
||||||
@@ -176,10 +185,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateOnDeviceReadyForReturnExpression(string OnDeviceReadyForReturnExpression, bool redirect = false)
|
public virtual ActionResult UpdateOnDeviceReadyForReturnExpression(string OnDeviceReadyForReturnExpression, bool redirect = false)
|
||||||
{
|
{
|
||||||
string expression = null;
|
string expression = null;
|
||||||
@@ -200,10 +210,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
[DiscoAuthorize(Claims.Config.JobPreferences.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateOnCloseExpression(string OnCloseExpression, bool redirect = false)
|
public virtual ActionResult UpdateOnCloseExpression(string OnCloseExpression, bool redirect = false)
|
||||||
{
|
{
|
||||||
string expression = null;
|
string expression = null;
|
||||||
@@ -224,7 +235,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
return RedirectToAction(MVC.Config.JobPreferences.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
const string pDefaultSLAExpiry = "defaultslaexpiry";
|
const string pDefaultSLAExpiry = "defaultslaexpiry";
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
Authorization.Require(Claims.Config.JobQueue.Configure);
|
Authorization.Require(Claims.Config.JobQueue.Configure);
|
||||||
@@ -64,55 +65,62 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.JobQueue.Index(jobQueue.Id));
|
return RedirectToAction(MVC.Config.JobQueue.Index(jobQueue.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Update Shortcut Methods
|
#region Update Shortcut Methods
|
||||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateName(int id, string QueueName = null, bool? redirect = null)
|
public virtual ActionResult UpdateName(int id, string QueueName = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pName, QueueName, redirect);
|
return Update(id, pName, QueueName, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
|
public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pDescription, Description, redirect);
|
return Update(id, pDescription, Description, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdatePriority(int id, string Priority = null, bool? redirect = null)
|
public virtual ActionResult UpdatePriority(int id, string Priority = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pPriority, Priority, redirect);
|
return Update(id, pPriority, Priority, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDefaultSLAExpiry(int id, string DefaultSLAExpiry = null, bool? redirect = null)
|
public virtual ActionResult UpdateDefaultSLAExpiry(int id, string DefaultSLAExpiry = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pDefaultSLAExpiry, DefaultSLAExpiry, redirect);
|
return Update(id, pDefaultSLAExpiry, DefaultSLAExpiry, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateIcon(int id, string Icon = null, bool? redirect = null)
|
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.JobQueue.Configure)]
|
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateIconColour(int id, string IconColour = null, bool? redirect = null)
|
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.JobQueue.Configure)]
|
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateIconAndColour(int id, string Icon = null, string IconColour = null, bool redirect = false)
|
public virtual ActionResult UpdateIconAndColour(int id, string Icon = null, string IconColour = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -127,23 +135,24 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Json("Invalid Job Queue Id", JsonRequestBehavior.AllowGet);
|
return BadRequest("Invalid Job Queue Id");
|
||||||
}
|
}
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobQueue.Index(jobQueue.Id));
|
return RedirectToAction(MVC.Config.JobQueue.Index(jobQueue.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateSubjects(int id, string[] Subjects = null, bool redirect = false)
|
public virtual ActionResult UpdateSubjects(int id, string[] Subjects = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -158,23 +167,24 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Json("Invalid Job Queue Id", JsonRequestBehavior.AllowGet);
|
return BadRequest("Invalid Job Queue Id");
|
||||||
}
|
}
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobQueue.Index(jobQueue.Id));
|
return RedirectToAction(MVC.Config.JobQueue.Index(jobQueue.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
[DiscoAuthorize(Claims.Config.JobQueue.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateJobSubTypes(int id, List<string> JobSubTypes = null, bool redirect = false)
|
public virtual ActionResult UpdateJobSubTypes(int id, List<string> JobSubTypes = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -186,50 +196,50 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Json("Invalid Job Queue Id", JsonRequestBehavior.AllowGet);
|
return BadRequest("Invalid Job Queue Id");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.JobQueue.Index(jobQueue.Id));
|
return RedirectToAction(MVC.Config.JobQueue.Index(jobQueue.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Update Properties
|
#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))
|
if (string.IsNullOrWhiteSpace(icon))
|
||||||
throw new ArgumentNullException("Icon");
|
throw new ArgumentNullException(nameof(icon));
|
||||||
if (string.IsNullOrWhiteSpace(IconColour))
|
if (string.IsNullOrWhiteSpace(iconColour))
|
||||||
throw new ArgumentNullException("IconColour");
|
throw new ArgumentNullException(nameof(iconColour));
|
||||||
|
|
||||||
jobQueue.Icon = Icon;
|
jobQueue.Icon = icon;
|
||||||
jobQueue.IconColour = IconColour;
|
jobQueue.IconColour = iconColour;
|
||||||
JobQueueService.UpdateJobQueue(Database, jobQueue);
|
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");
|
throw new ArgumentNullException("Icon");
|
||||||
|
|
||||||
jobQueue.Icon = Icon;
|
jobQueue.Icon = icon;
|
||||||
JobQueueService.UpdateJobQueue(Database, jobQueue);
|
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");
|
throw new ArgumentNullException("IconColour");
|
||||||
|
|
||||||
jobQueue.IconColour = IconColour;
|
jobQueue.IconColour = iconColour;
|
||||||
JobQueueService.UpdateJobQueue(Database, jobQueue);
|
JobQueueService.UpdateJobQueue(Database, jobQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,25 +287,25 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
JobQueueService.UpdateJobQueue(Database, jobQueue);
|
JobQueueService.UpdateJobQueue(Database, jobQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSubjects(JobQueue jobQueue, string[] Subjects)
|
private void UpdateSubjects(JobQueue jobQueue, string[] subjects)
|
||||||
{
|
{
|
||||||
string subjectIds = null;
|
string subjectIds = null;
|
||||||
|
|
||||||
// Validate Subjects
|
// 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))
|
.Where(s => !string.IsNullOrWhiteSpace(s))
|
||||||
.Select(s => s.Trim())
|
.Select(s => s.Trim())
|
||||||
.Select(s => Tuple.Create(s, ActiveDirectory.RetrieveADObject(s, Quick: true)))
|
.Select(s => Tuple.Create(s, ActiveDirectory.RetrieveADObject(s, Quick: true)))
|
||||||
.Where(s => s.Item2 is ADUserAccount || s.Item2 is ADGroup)
|
.Where(s => s.Item2 is ADUserAccount || s.Item2 is ADGroup)
|
||||||
.ToList();
|
.ToList();
|
||||||
var invalidSubjects = subjects.Where(s => s.Item2 == null).ToList();
|
var invalidSubjects = subjectRecords.Where(s => s.Item2 == null).ToList();
|
||||||
|
|
||||||
if (invalidSubjects.Count > 0)
|
if (invalidSubjects.Count > 0)
|
||||||
throw new ArgumentException($"Subjects not found: {string.Join(", ", invalidSubjects)}", "Subjects");
|
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);
|
subjectIds = string.Join(",", proposedSubjects);
|
||||||
|
|
||||||
@@ -340,6 +350,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
#region Actions
|
#region Actions
|
||||||
[DiscoAuthorize(Claims.Config.JobQueue.Delete)]
|
[DiscoAuthorize(Claims.Config.JobQueue.Delete)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Delete(int id, bool? redirect = false)
|
public virtual ActionResult Delete(int id, bool? redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -353,7 +364,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
throw new Exception("Invalid Job Queue Id");
|
throw new Exception("Invalid Job Queue Id");
|
||||||
}
|
}
|
||||||
@@ -362,7 +373,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
const string pSla = "sla";
|
const string pSla = "sla";
|
||||||
const string pPriority = "priority";
|
const string pPriority = "priority";
|
||||||
|
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -52,40 +53,45 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return Redirect($"{Url.Action(MVC.Job.Show(jobQueueJob.JobId))}#jobDetailTab-Queues");
|
return Redirect($"{Url.Action(MVC.Job.Show(jobQueueJob.JobId))}#jobDetailTab-Queues");
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Update Shortcut Methods
|
#region Update Shortcut Methods
|
||||||
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyComments, Claims.Job.Properties.JobQueueProperties.EditOwnComments)]
|
[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)
|
public virtual ActionResult UpdateAddedComment(int id, string AddedComment = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pAddedComment, AddedComment, redirect);
|
return Update(id, pAddedComment, AddedComment, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyComments, Claims.Job.Properties.JobQueueProperties.EditOwnComments)]
|
[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)
|
public virtual ActionResult UpdateRemovedComment(int id, string RemovedComment = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pRemovedComment, RemovedComment, redirect);
|
return Update(id, pRemovedComment, RemovedComment, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnySLA, Claims.Job.Properties.JobQueueProperties.EditOwnSLA)]
|
[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)
|
public virtual ActionResult UpdateSla(int id, string SLA = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pSla, SLA, redirect);
|
return Update(id, pSla, SLA, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnyPriority, Claims.Job.Properties.JobQueueProperties.EditOwnPriority)]
|
[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)
|
public virtual ActionResult UpdatePriority(int id, string Priority = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pPriority, Priority, redirect);
|
return Update(id, pPriority, Priority, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnySLA, Claims.Job.Properties.JobQueueProperties.EditOwnSLA,
|
[DiscoAuthorizeAny(Claims.Job.Properties.JobQueueProperties.EditAnySLA, Claims.Job.Properties.JobQueueProperties.EditOwnSLA,
|
||||||
Claims.Job.Properties.JobQueueProperties.EditAnyPriority, Claims.Job.Properties.JobQueueProperties.EditOwnPriority)]
|
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)
|
public virtual ActionResult UpdateSlaAndPriority(int id, string Sla = null, string Priority = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -106,14 +112,14 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return Redirect($"{Url.Action(MVC.Job.Show(jobQueueJob.JobId))}#jobDetailTab-Queues");
|
return Redirect($"{Url.Action(MVC.Job.Show(jobQueueJob.JobId))}#jobDetailTab-Queues");
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -175,6 +181,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Actions
|
#region Actions
|
||||||
|
|
||||||
[DiscoAuthorizeAny(Claims.Job.Actions.AddAnyQueues, Claims.Job.Actions.AddOwnQueues)]
|
[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)
|
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;
|
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)]
|
[DiscoAuthorizeAny(Claims.Job.Actions.RemoveAnyQueues, Claims.Job.Actions.RemoveOwnQueues)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult RemoveJob(int id, string Comment, bool? CloseJob = null)
|
public virtual ActionResult RemoveJob(int id, string Comment, bool? CloseJob = null)
|
||||||
{
|
{
|
||||||
Database.Configuration.LazyLoadingEnabled = true;
|
Database.Configuration.LazyLoadingEnabled = true;
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return Json(m, JsonRequestBehavior.AllowGet);
|
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<int> EventTypeIds = null, int? Take = null)
|
public virtual ActionResult RetrieveEvents(string Format, DateTime? Start = null, DateTime? End = null, int? ModuleId = null, List<int> EventTypeIds = null, int? Take = null)
|
||||||
{
|
{
|
||||||
if (string.Equals(Format, "json", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(Format, "json", StringComparison.OrdinalIgnoreCase))
|
||||||
|
|||||||
@@ -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()
|
public virtual ActionResult UpdateAll()
|
||||||
{
|
{
|
||||||
var status = UpdatePluginTask.UpdateAllPlugins();
|
var status = UpdatePluginTask.UpdateAllPlugins();
|
||||||
@@ -39,7 +40,8 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
|
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)
|
public virtual ActionResult Update(string pluginId)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(pluginId))
|
if (string.IsNullOrEmpty(pluginId))
|
||||||
@@ -50,7 +52,8 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
|
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)
|
public virtual ActionResult Uninstall(string id, bool uninstallData)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(id))
|
if (string.IsNullOrEmpty(id))
|
||||||
@@ -63,7 +66,8 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
|
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)
|
public virtual ActionResult Install(string pluginId)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(pluginId))
|
if (string.IsNullOrEmpty(pluginId))
|
||||||
@@ -92,7 +96,8 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
|
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)
|
public virtual ActionResult InstallLocal(HttpPostedFileBase plugin, bool immediateRestart = false)
|
||||||
{
|
{
|
||||||
if (plugin == null || plugin.ContentLength <= 0 || string.IsNullOrWhiteSpace(plugin.FileName))
|
if (plugin == null || plugin.ContentLength <= 0 || string.IsNullOrWhiteSpace(plugin.FileName))
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public partial class SystemController : AuthorizedDatabaseController
|
public partial class SystemController : AuthorizedDatabaseController
|
||||||
{
|
{
|
||||||
[DiscoAuthorize(Claims.Config.System.Show)]
|
[DiscoAuthorize(Claims.Config.System.Show)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateLastNetworkLogonDates()
|
public virtual ActionResult UpdateLastNetworkLogonDates()
|
||||||
{
|
{
|
||||||
var taskStatus = ADNetworkLogonDatesUpdateTask.ScheduleImmediately();
|
var taskStatus = ADNetworkLogonDatesUpdateTask.ScheduleImmediately();
|
||||||
@@ -27,6 +28,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.DiscoAdminAccount)]
|
[DiscoAuthorize(Claims.DiscoAdminAccount)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateAttachmentThumbnails()
|
public virtual ActionResult UpdateAttachmentThumbnails()
|
||||||
{
|
{
|
||||||
var ts = Disco.Services.Documents.AttachmentImport.ThumbnailUpdateTask.ScheduleImmediately();
|
var ts = Disco.Services.Documents.AttachmentImport.ThumbnailUpdateTask.ScheduleImmediately();
|
||||||
@@ -35,6 +37,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.DiscoAdminAccount)]
|
[DiscoAuthorize(Claims.DiscoAdminAccount)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateADDeviceDescriptions()
|
public virtual ActionResult UpdateADDeviceDescriptions()
|
||||||
{
|
{
|
||||||
var ts = ADDeviceDescriptionUpdateTask.ScheduleImmediately();
|
var ts = ADDeviceDescriptionUpdateTask.ScheduleImmediately();
|
||||||
@@ -63,6 +66,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.System.Show)]
|
[DiscoAuthorize(Claims.Config.System.Show)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateCheck()
|
public virtual ActionResult UpdateCheck()
|
||||||
{
|
{
|
||||||
var ts = UpdateQueryTask.ScheduleNow();
|
var ts = UpdateQueryTask.ScheduleNow();
|
||||||
@@ -70,7 +74,8 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(ts.SessionId));
|
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()
|
public virtual ActionResult OnlineServicesConnectStart()
|
||||||
{
|
{
|
||||||
OnlineServicesConnect.QueueStart();
|
OnlineServicesConnect.QueueStart();
|
||||||
@@ -82,6 +87,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
#region Organisation Name
|
#region Organisation Name
|
||||||
[DiscoAuthorize(Claims.Config.Organisation.ConfigureName)]
|
[DiscoAuthorize(Claims.Config.Organisation.ConfigureName)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateOrganisationName(string OrganisationName, bool redirect = false)
|
public virtual ActionResult UpdateOrganisationName(string OrganisationName, bool redirect = false)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(OrganisationName))
|
if (string.IsNullOrWhiteSpace(OrganisationName))
|
||||||
@@ -96,7 +102,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
#endregion
|
#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)
|
public virtual ActionResult OrganisationLogo(bool redirect, HttpPostedFileBase Image, bool? ResetLogo = null)
|
||||||
{
|
{
|
||||||
if (ResetLogo.HasValue && ResetLogo.Value)
|
if (ResetLogo.HasValue && ResetLogo.Value)
|
||||||
@@ -127,7 +134,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Image != null && Image.ContentLength > 0)
|
if (Image != null && Image.ContentLength > 0)
|
||||||
@@ -139,25 +146,26 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
else
|
else
|
||||||
return Json("Invalid Content Type", JsonRequestBehavior.AllowGet);
|
return BadRequest("Invalid Content Type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
else
|
else
|
||||||
return Json("No Image Supplied", JsonRequestBehavior.AllowGet);
|
return BadRequest("No Image Supplied");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Organisation Addresses
|
#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)
|
public virtual ActionResult UpdateOrganisationAddress(Disco.Models.BI.Config.OrganisationAddress organisationAddress, bool redirect = false)
|
||||||
{
|
{
|
||||||
if (organisationAddress == null)
|
if (organisationAddress == null)
|
||||||
@@ -171,7 +179,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -193,7 +201,8 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return Json(em.ToString(), JsonRequestBehavior.AllowGet);
|
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)
|
public virtual ActionResult DeleteOrganisationAddress(int id, bool redirect = false)
|
||||||
{
|
{
|
||||||
// Remove References in Device Profiles
|
// Remove References in Device Profiles
|
||||||
@@ -207,7 +216,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -215,6 +224,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region MultiSiteMode
|
#region MultiSiteMode
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.Organisation.ConfigureMultiSiteMode)]
|
[DiscoAuthorize(Claims.Config.Organisation.ConfigureMultiSiteMode)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateMultiSiteMode(bool MultiSiteMode, bool redirect = false)
|
public virtual ActionResult UpdateMultiSiteMode(bool MultiSiteMode, bool redirect = false)
|
||||||
{
|
{
|
||||||
Database.DiscoConfiguration.MultiSiteMode = MultiSiteMode;
|
Database.DiscoConfiguration.MultiSiteMode = MultiSiteMode;
|
||||||
@@ -226,7 +236,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.Organisation.Index());
|
return RedirectToAction(MVC.Config.Organisation.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -236,6 +246,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Active Directory
|
#region Active Directory
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.System.ConfigureActiveDirectory)]
|
[DiscoAuthorize(Claims.Config.System.ConfigureActiveDirectory)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateActiveDirectorySearchScope(List<string> Containers, bool redirect = false)
|
public virtual ActionResult UpdateActiveDirectorySearchScope(List<string> Containers, bool redirect = false)
|
||||||
{
|
{
|
||||||
ActiveDirectory.Context.UpdateSearchContainers(Database, Containers);
|
ActiveDirectory.Context.UpdateSearchContainers(Database, Containers);
|
||||||
@@ -244,10 +255,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.System.ConfigureActiveDirectory)]
|
[DiscoAuthorize(Claims.Config.System.ConfigureActiveDirectory)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateActiveDirectorySearchAllServers(bool SearchAllServers, bool redirect = false)
|
public virtual ActionResult UpdateActiveDirectorySearchAllServers(bool SearchAllServers, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -268,18 +280,19 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.System.ConfigureActiveDirectory)]
|
[DiscoAuthorize(Claims.Config.System.ConfigureActiveDirectory)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateActiveDirectorySearchWildcardSuffixOnly(bool SearchWildcardSuffixOnly, bool redirect = false)
|
public virtual ActionResult UpdateActiveDirectorySearchWildcardSuffixOnly(bool SearchWildcardSuffixOnly, bool redirect = false)
|
||||||
{
|
{
|
||||||
ActiveDirectory.Context.UpdateWildcardSearchSuffixOnly(Database, SearchWildcardSuffixOnly);
|
ActiveDirectory.Context.UpdateWildcardSearchSuffixOnly(Database, SearchWildcardSuffixOnly);
|
||||||
@@ -289,7 +302,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorizeAny(Claims.Config.System.ConfigureActiveDirectory, Claims.Config.DeviceProfile.Configure)]
|
[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);
|
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)
|
public virtual ActionResult SyncActiveDirectoryManagedGroup(string id, string redirectUrl = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -361,6 +375,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
#region Proxy Settings
|
#region Proxy Settings
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.System.ConfigureProxy)]
|
[DiscoAuthorize(Claims.Config.System.ConfigureProxy)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateProxySettings(string ProxyAddress, int? ProxyPort, string ProxyUsername, string ProxyPassword, bool redirect = false)
|
public virtual ActionResult UpdateProxySettings(string ProxyAddress, int? ProxyPort, string ProxyUsername, string ProxyPassword, bool redirect = false)
|
||||||
{
|
{
|
||||||
// Default Proxy Port
|
// Default Proxy Port
|
||||||
@@ -387,14 +402,15 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Email Settings
|
#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)
|
public virtual ActionResult UpdateEmailSettings(string SmtpServer, int? SmtpPort, string FromAddress, string ReplyToAddress, bool EnableSsl, string Username, string Password, bool redirect = false)
|
||||||
{
|
{
|
||||||
// Default Port
|
// Default Port
|
||||||
@@ -419,10 +435,11 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
||||||
else
|
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)
|
public virtual ActionResult SendTestEmail(string Recipient, bool redirect = false)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(Recipient))
|
if (string.IsNullOrWhiteSpace(Recipient))
|
||||||
@@ -433,7 +450,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
return RedirectToAction(MVC.Config.SystemConfig.Index());
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -139,7 +139,8 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return HttpNotFound("Invalid Attachment Number");
|
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)
|
public virtual ActionResult AttachmentUpload(string id, string domain, string comments)
|
||||||
{
|
{
|
||||||
id = ActiveDirectory.ParseDomainAccountId(id, domain);
|
id = ActiveDirectory.ParseDomainAccountId(id, domain);
|
||||||
@@ -224,6 +225,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorizeAny(Claims.User.Actions.RemoveAnyAttachments, Claims.User.Actions.RemoveOwnAttachments)]
|
[DiscoAuthorizeAny(Claims.User.Actions.RemoveAnyAttachments, Claims.User.Actions.RemoveOwnAttachments)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult AttachmentRemove(int id)
|
public virtual ActionResult AttachmentRemove(int id)
|
||||||
{
|
{
|
||||||
var ua = Database.UserAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
|
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);
|
ua.OnDelete(Database);
|
||||||
Database.SaveChanges();
|
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)]
|
[DiscoAuthorize(Claims.User.Actions.AddAttachments)]
|
||||||
@@ -267,44 +269,12 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
catch (InvalidOperationException ex)
|
catch (InvalidOperationException ex)
|
||||||
{
|
{
|
||||||
return Json(new
|
return BadRequest(ex.Message);
|
||||||
{
|
|
||||||
Success = false,
|
|
||||||
ErrorMessage = ex.Message,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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)
|
public virtual ActionResult Photo(string userId)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(userId))
|
if (string.IsNullOrEmpty(userId))
|
||||||
|
|||||||
@@ -40,14 +40,14 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return Redirect($"{Url.Action(MVC.User.Show(userFlagAssignment.UserId))}#UserDetailTab-Flags");
|
return Redirect($"{Url.Action(MVC.User.Show(userFlagAssignment.UserId))}#UserDetailTab-Flags");
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
const string pOnUnassignmentExpression = "onunassignmentexpression";
|
const string pOnUnassignmentExpression = "onunassignmentexpression";
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
Authorization.Require(Claims.Config.UserFlag.Configure);
|
Authorization.Require(Claims.Config.UserFlag.Configure);
|
||||||
@@ -68,93 +69,101 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.UserFlag.Index(flag.Id));
|
return RedirectToAction(MVC.Config.UserFlag.Index(flag.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Update Shortcut Methods
|
#region Update Shortcut Methods
|
||||||
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateName(int id, string FlagName = null, bool? redirect = null)
|
public virtual ActionResult UpdateName(int id, string FlagName = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pName, FlagName, redirect);
|
return Update(id, pName, FlagName, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
|
public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
|
||||||
{
|
{
|
||||||
return Update(id, pDescription, Description, redirect);
|
return Update(id, pDescription, Description, redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
[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)]
|
[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)]
|
[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
|
try
|
||||||
{
|
{
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
throw new ArgumentOutOfRangeException("id");
|
throw new ArgumentOutOfRangeException(nameof(id));
|
||||||
|
|
||||||
var UserFlag = Database.UserFlags.Find(id);
|
var UserFlag = Database.UserFlags.Find(id);
|
||||||
if (UserFlag != null)
|
if (UserFlag != null)
|
||||||
{
|
{
|
||||||
UpdateIconAndColour(UserFlag, Icon, IconColour);
|
UpdateIconAndColour(UserFlag, icon, iconColour);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Invalid User Flag Id", "id");
|
throw new ArgumentException("Invalid User Flag Id", nameof(id));
|
||||||
}
|
}
|
||||||
if (redirect)
|
if (redirect)
|
||||||
return RedirectToAction(MVC.Config.UserFlag.Index(UserFlag.Id));
|
return RedirectToAction(MVC.Config.UserFlag.Index(UserFlag.Id));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateOnAssignmentExpression(int id, string OnAssignmentExpression = null, bool redirect = false)
|
public virtual ActionResult UpdateOnAssignmentExpression(int id, string OnAssignmentExpression = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pOnAssignmentExpression, OnAssignmentExpression, redirect);
|
return Update(id, pOnAssignmentExpression, OnAssignmentExpression, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateOnUnassignmentExpression(int id, string OnUnassignmentExpression = null, bool redirect = false)
|
public virtual ActionResult UpdateOnUnassignmentExpression(int id, string OnUnassignmentExpression = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
return Update(id, pOnUnassignmentExpression, OnUnassignmentExpression, redirect);
|
return Update(id, pOnUnassignmentExpression, OnUnassignmentExpression, redirect);
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateAssignedUsersLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
|
public virtual ActionResult UpdateAssignedUsersLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
throw new ArgumentOutOfRangeException("id");
|
throw new ArgumentOutOfRangeException(nameof(id));
|
||||||
|
|
||||||
var UserFlag = Database.UserFlags.Find(id);
|
var UserFlag = Database.UserFlags.Find(id);
|
||||||
if (UserFlag == null)
|
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);
|
var syncTaskStatus = UpdateAssignedUsersLinkedGroup(UserFlag, GroupId, FilterBeginDate);
|
||||||
@@ -167,27 +176,28 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
[DiscoAuthorize(Claims.Config.UserFlag.Configure)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult UpdateAssignedUserDevicesLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
|
public virtual ActionResult UpdateAssignedUserDevicesLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
throw new ArgumentOutOfRangeException("id");
|
throw new ArgumentOutOfRangeException(nameof(id));
|
||||||
|
|
||||||
var UserFlag = Database.UserFlags.Find(id);
|
var UserFlag = Database.UserFlags.Find(id);
|
||||||
if (UserFlag == null)
|
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);
|
var syncTaskStatus = UpdateAssignedUserDevicesLinkedGroup(UserFlag, GroupId, FilterBeginDate);
|
||||||
@@ -200,14 +210,14 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
if (redirect)
|
if (redirect)
|
||||||
throw;
|
throw;
|
||||||
else
|
else
|
||||||
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
|
return BadRequest(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -347,6 +357,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
|
|
||||||
#region Actions
|
#region Actions
|
||||||
[DiscoAuthorizeAll(Claims.Config.UserFlag.Configure, Claims.Config.UserFlag.Delete)]
|
[DiscoAuthorizeAll(Claims.Config.UserFlag.Configure, Claims.Config.UserFlag.Delete)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Delete(int id, bool? redirect = false)
|
public virtual ActionResult Delete(int id, bool? redirect = false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -360,7 +371,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
|
||||||
else
|
else
|
||||||
return Json("OK", JsonRequestBehavior.AllowGet);
|
return Ok();
|
||||||
}
|
}
|
||||||
throw new Exception("Invalid User Flag Id");
|
throw new Exception("Invalid User Flag Id");
|
||||||
}
|
}
|
||||||
@@ -369,11 +380,12 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
if (redirect.HasValue && redirect.Value)
|
if (redirect.HasValue && redirect.Value)
|
||||||
throw;
|
throw;
|
||||||
else
|
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)]
|
[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)
|
public virtual ActionResult BulkAssignUsers(int id, bool Override, string UserIds = null, string Comments = null)
|
||||||
{
|
{
|
||||||
if (id < 0)
|
if (id < 0)
|
||||||
|
|||||||
@@ -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 class ComponentModel
|
||||||
{
|
{
|
||||||
public _ComponentModel Component { get; set; }
|
public int Id { get; set; }
|
||||||
public string Result { get; set; }
|
public string Description { get; set; }
|
||||||
|
public string Cost { get; set; }
|
||||||
|
public List<string> 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()
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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<string> 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()
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,18 @@
|
|||||||
{
|
{
|
||||||
public class ComponentModel
|
public class ComponentModel
|
||||||
{
|
{
|
||||||
public _ComponentModel Component { get; set; }
|
public int Id { get; set; }
|
||||||
public string Result { 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")
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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")
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,6 +17,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
[DiscoAuthorize(Claims.DiscoAdminAccount)]
|
[DiscoAuthorize(Claims.DiscoAdminAccount)]
|
||||||
public partial class AuthorizationRoleController : AuthorizedDatabaseController
|
public partial class AuthorizationRoleController : AuthorizedDatabaseController
|
||||||
{
|
{
|
||||||
|
[HttpGet]
|
||||||
public virtual ActionResult Index(int? id)
|
public virtual ActionResult Index(int? id)
|
||||||
{
|
{
|
||||||
if (id.HasValue)
|
if (id.HasValue)
|
||||||
@@ -72,13 +73,11 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
public virtual ActionResult Create()
|
public virtual ActionResult Create()
|
||||||
{
|
{
|
||||||
// Default Role
|
// Default Role
|
||||||
var m = new Models.AuthorizationRole.CreateModel()
|
var m = new Models.AuthorizationRole.CreateModel();
|
||||||
{
|
|
||||||
AuthorizationRole = new Disco.Models.Repository.AuthorizationRole()
|
|
||||||
};
|
|
||||||
|
|
||||||
// UI Extensions
|
// UI Extensions
|
||||||
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleCreateModel>(ControllerContext, m);
|
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleCreateModel>(ControllerContext, m);
|
||||||
@@ -86,16 +85,16 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
return View(m);
|
return View(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
public virtual ActionResult Create(Models.AuthorizationRole.CreateModel model)
|
public virtual ActionResult Create(Models.AuthorizationRole.CreateModel model)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
// Check for Existing
|
// 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)
|
if (existing == null)
|
||||||
{
|
{
|
||||||
var roleId = UserService.CreateAuthorizationRole(Database, model.AuthorizationRole);
|
var roleId = UserService.CreateAuthorizationRole(Database, model.Name);
|
||||||
|
|
||||||
return RedirectToAction(MVC.Config.AuthorizationRole.Index(roleId));
|
return RedirectToAction(MVC.Config.AuthorizationRole.Index(roleId));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Disco.Services.Devices;
|
|||||||
using Disco.Services.Devices.ManagedGroups;
|
using Disco.Services.Devices.ManagedGroups;
|
||||||
using Disco.Services.Plugins.Features.UIExtension;
|
using Disco.Services.Plugins.Features.UIExtension;
|
||||||
using Disco.Services.Web;
|
using Disco.Services.Web;
|
||||||
|
using Disco.Web.Areas.Config.Models.DeviceBatch;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
@@ -24,7 +25,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
var m = Database.DeviceBatches
|
var m = Database.DeviceBatches
|
||||||
.Include(nameof(DeviceBatch.DeviceBatchAttachments))
|
.Include(nameof(DeviceBatch.DeviceBatchAttachments))
|
||||||
.Where(db => db.Id == id.Value)
|
.Where(db => db.Id == id.Value)
|
||||||
.Select(db => new Models.DeviceBatch.ShowModel()
|
.Select(db => new ShowModel()
|
||||||
{
|
{
|
||||||
DeviceBatch = db,
|
DeviceBatch = db,
|
||||||
DeviceCount = db.Devices.Count(),
|
DeviceCount = db.Devices.Count(),
|
||||||
@@ -34,7 +35,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
if (m == null || m.DeviceBatch == null)
|
if (m == null || m.DeviceBatch == null)
|
||||||
throw new ArgumentException("Invalid Device Batch Id", "id");
|
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,
|
DeviceModel = dG.Key,
|
||||||
DeviceCount = dG.Count(),
|
DeviceCount = dG.Count(),
|
||||||
@@ -82,9 +83,9 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
public virtual ActionResult Create()
|
public virtual ActionResult Create()
|
||||||
{
|
{
|
||||||
// Default Batch
|
// Default Batch
|
||||||
var m = new Models.DeviceBatch.CreateModel()
|
var m = new CreateModel()
|
||||||
{
|
{
|
||||||
DeviceBatch = DeviceBatches.DefaultNewDeviceBatch(Database)
|
PurchaseDate = DateTime.Today,
|
||||||
};
|
};
|
||||||
|
|
||||||
// UI Extensions
|
// UI Extensions
|
||||||
@@ -93,22 +94,28 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
return View(m);
|
return View(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorizeAll(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.Configure), HttpPost]
|
[DiscoAuthorizeAll(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.Configure)]
|
||||||
public virtual ActionResult Create(Models.DeviceBatch.CreateModel model)
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
|
public virtual ActionResult Create(CreateModel model)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
// Check for Existing
|
// Check for Existing
|
||||||
var existing = Database.DeviceBatches.Where(m => m.Name == model.DeviceBatch.Name).FirstOrDefault();
|
var alreadyExists = Database.DeviceBatches.Any(m => m.Name == model.Name);
|
||||||
if (existing == null)
|
if (!alreadyExists)
|
||||||
{
|
{
|
||||||
Database.DeviceBatches.Add(model.DeviceBatch);
|
var batch = new DeviceBatch()
|
||||||
|
{
|
||||||
|
Name = model.Name,
|
||||||
|
PurchaseDate = model.PurchaseDate,
|
||||||
|
};
|
||||||
|
Database.DeviceBatches.Add(batch);
|
||||||
Database.SaveChanges();
|
Database.SaveChanges();
|
||||||
return RedirectToAction(MVC.Config.DeviceBatch.Index(model.DeviceBatch.Id));
|
return RedirectToAction(MVC.Config.DeviceBatch.Index(batch.Id));
|
||||||
}
|
}
|
||||||
else
|
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)]
|
[DiscoAuthorize(Claims.Config.DeviceBatch.ShowTimeline)]
|
||||||
public virtual ActionResult Timeline()
|
public virtual ActionResult Timeline()
|
||||||
{
|
{
|
||||||
var m = new Models.DeviceBatch.TimelineModel();
|
var m = new TimelineModel();
|
||||||
|
|
||||||
// UI Extensions
|
// UI Extensions
|
||||||
UIExtensions.ExecuteExtensions<ConfigDeviceBatchTimelineModel>(ControllerContext, m);
|
UIExtensions.ExecuteExtensions<ConfigDeviceBatchTimelineModel>(ControllerContext, m);
|
||||||
|
|||||||
@@ -79,14 +79,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
public virtual ActionResult Create()
|
public virtual ActionResult Create()
|
||||||
{
|
{
|
||||||
// Default Queue
|
// Default Queue
|
||||||
var m = new CreateModel()
|
var m = new CreateModel();
|
||||||
{
|
|
||||||
DeviceFlag = new DeviceFlag()
|
|
||||||
{
|
|
||||||
Icon = DeviceFlagService.RandomUnusedIcon(),
|
|
||||||
IconColour = DeviceFlagService.RandomUnusedThemeColour()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// UI Extensions
|
// UI Extensions
|
||||||
UIExtensions.ExecuteExtensions<ConfigDeviceFlagCreateModel>(ControllerContext, m);
|
UIExtensions.ExecuteExtensions<ConfigDeviceFlagCreateModel>(ControllerContext, m);
|
||||||
@@ -94,16 +87,17 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
return View(m);
|
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)
|
public virtual ActionResult Create(CreateModel model)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
// Check for Existing
|
// 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)
|
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));
|
return RedirectToAction(MVC.Config.DeviceFlag.Index(flag.Id));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,18 +105,10 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Create, Claims.Config.DeviceProfile.Configure)]
|
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Create, Claims.Config.DeviceProfile.Configure)]
|
||||||
|
[HttpGet]
|
||||||
public virtual ActionResult Create()
|
public virtual ActionResult Create()
|
||||||
{
|
{
|
||||||
var m = new Models.DeviceProfile.CreateModel()
|
var m = new Models.DeviceProfile.CreateModel();
|
||||||
{
|
|
||||||
DeviceProfile = new DeviceProfile()
|
|
||||||
{
|
|
||||||
ComputerNameTemplate = DeviceProfile.DefaultComputerNameTemplate,
|
|
||||||
ProvisionADAccount = true,
|
|
||||||
DistributionType = DeviceProfile.DistributionTypes.OneToMany,
|
|
||||||
OrganisationalUnit = ActiveDirectory.Context.PrimaryDomain.DefaultComputerContainer
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// UI Extensions
|
// UI Extensions
|
||||||
UIExtensions.ExecuteExtensions<ConfigDeviceProfileCreateModel>(ControllerContext, m);
|
UIExtensions.ExecuteExtensions<ConfigDeviceProfileCreateModel>(ControllerContext, m);
|
||||||
@@ -124,20 +116,30 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
return View(m);
|
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)
|
public virtual ActionResult Create(Models.DeviceProfile.CreateModel model)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
// Check for Existing
|
// Check for Existing
|
||||||
var existing = Database.DeviceProfiles.Where(m => m.Name == model.DeviceProfile.Name).FirstOrDefault();
|
var existingName = Database.DeviceProfiles.Any(m => m.Name.Equals(model.Name, StringComparison.OrdinalIgnoreCase));
|
||||||
if (existing == null)
|
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();
|
Database.SaveChanges();
|
||||||
return RedirectToAction(MVC.Config.DeviceProfile.Index(model.DeviceProfile.Id));
|
return RedirectToAction(MVC.Config.DeviceProfile.Index(deviceProfile.Id));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
public partial class DocumentTemplateController : AuthorizedDatabaseController
|
public partial class DocumentTemplateController : AuthorizedDatabaseController
|
||||||
{
|
{
|
||||||
[DiscoAuthorize(Claims.Config.DocumentTemplate.Show)]
|
[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))
|
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)
|
public virtual ActionResult ShowPackage(string id)
|
||||||
{
|
{
|
||||||
// Document Template Package
|
// Document Template Package
|
||||||
@@ -139,7 +140,8 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
return View(m);
|
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)
|
public virtual ActionResult Create(CreateModel model)
|
||||||
{
|
{
|
||||||
model.UpdateModel(Database);
|
model.UpdateModel(Database);
|
||||||
@@ -147,27 +149,30 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
// Check for Existing
|
// 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)
|
if (existing == null)
|
||||||
{
|
{
|
||||||
|
var template = new DocumentTemplate()
|
||||||
Database.DocumentTemplates.Add(model.DocumentTemplate);
|
|
||||||
|
|
||||||
if (model.DocumentTemplate.Scope == DocumentTemplate.DocumentTemplateScopes.Job)
|
|
||||||
{
|
{
|
||||||
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();
|
Database.SaveChanges();
|
||||||
|
|
||||||
// Save Template
|
// 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
|
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);
|
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)
|
public virtual ActionResult CreatePackage(CreatePackageModel model)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
// Check for Existing
|
// Check for Existing
|
||||||
var existing = DocumentTemplatePackages.GetPackage(model.Package.Id);
|
var existing = DocumentTemplatePackages.GetPackage(model.Id);
|
||||||
if (existing == null)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,18 +78,11 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorizeAll(Claims.Config.JobQueue.Create, Claims.Config.JobQueue.Configure)]
|
[DiscoAuthorizeAll(Claims.Config.JobQueue.Create, Claims.Config.JobQueue.Configure)]
|
||||||
|
[HttpGet]
|
||||||
public virtual ActionResult Create()
|
public virtual ActionResult Create()
|
||||||
{
|
{
|
||||||
// Default Queue
|
// Default Queue
|
||||||
var m = new Models.JobQueue.CreateModel()
|
var m = new Models.JobQueue.CreateModel();
|
||||||
{
|
|
||||||
JobQueue = new JobQueue()
|
|
||||||
{
|
|
||||||
Icon = JobQueueService.RandomUnusedIcon(),
|
|
||||||
IconColour = JobQueueService.RandomUnusedThemeColour(),
|
|
||||||
Priority = JobQueuePriority.Normal
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// UI Extensions
|
// UI Extensions
|
||||||
UIExtensions.ExecuteExtensions<ConfigJobQueueCreateModel>(ControllerContext, m);
|
UIExtensions.ExecuteExtensions<ConfigJobQueueCreateModel>(ControllerContext, m);
|
||||||
@@ -97,16 +90,17 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
return View(m);
|
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)
|
public virtual ActionResult Create(Models.JobQueue.CreateModel model)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
// Check for Existing
|
// Check for Existing
|
||||||
var existing = Database.JobQueues.Where(m => m.Name == model.JobQueue.Name).FirstOrDefault();
|
var nameExists = Database.JobQueues.Any(m => m.Name.Equals(model.Name, StringComparison.Ordinal));
|
||||||
if (existing == null)
|
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));
|
return RedirectToAction(MVC.Config.JobQueue.Index(token.JobQueue.Id));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region Plugin Configuration
|
#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)
|
public virtual ActionResult Configure(string PluginId, FormCollection form)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(PluginId))
|
if (string.IsNullOrEmpty(PluginId))
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Disco.Models.Areas.Config.UI.UserFlag;
|
using Disco.Models.Areas.Config.UI.UserFlag;
|
||||||
using Disco.Models.Repository;
|
|
||||||
using Disco.Models.Services.Users.UserFlags;
|
using Disco.Models.Services.Users.UserFlags;
|
||||||
using Disco.Models.UI.Config.UserFlag;
|
using Disco.Models.UI.Config.UserFlag;
|
||||||
using Disco.Services.Authorization;
|
using Disco.Services.Authorization;
|
||||||
@@ -76,17 +75,11 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[DiscoAuthorizeAll(Claims.Config.UserFlag.Create, Claims.Config.UserFlag.Configure)]
|
[DiscoAuthorizeAll(Claims.Config.UserFlag.Create, Claims.Config.UserFlag.Configure)]
|
||||||
|
[HttpGet]
|
||||||
public virtual ActionResult Create()
|
public virtual ActionResult Create()
|
||||||
{
|
{
|
||||||
// Default Queue
|
// Default Queue
|
||||||
var m = new CreateModel()
|
var m = new CreateModel();
|
||||||
{
|
|
||||||
UserFlag = new UserFlag()
|
|
||||||
{
|
|
||||||
Icon = UserFlagService.RandomUnusedIcon(),
|
|
||||||
IconColour = UserFlagService.RandomUnusedThemeColour()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// UI Extensions
|
// UI Extensions
|
||||||
UIExtensions.ExecuteExtensions<ConfigUserFlagCreateModel>(ControllerContext, m);
|
UIExtensions.ExecuteExtensions<ConfigUserFlagCreateModel>(ControllerContext, m);
|
||||||
@@ -94,22 +87,23 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
return View(m);
|
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)
|
public virtual ActionResult Create(CreateModel model)
|
||||||
{
|
{
|
||||||
if (ModelState.IsValid)
|
if (ModelState.IsValid)
|
||||||
{
|
{
|
||||||
// Check for Existing
|
// Check for Existing
|
||||||
var existing = Database.UserFlags.Where(m => m.Name == model.UserFlag.Name).FirstOrDefault();
|
var nameExists = Database.UserFlags.Any(m => m.Name.Equals(model.Name, StringComparison.Ordinal));
|
||||||
if (existing == null)
|
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));
|
return RedirectToAction(MVC.Config.UserFlag.Index(flag.Id));
|
||||||
}
|
}
|
||||||
else
|
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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using Disco.Models.UI.Config.AuthorizationRole;
|
using Disco.Models.UI.Config.AuthorizationRole;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Disco.Web.Areas.Config.Models.AuthorizationRole
|
namespace Disco.Web.Areas.Config.Models.AuthorizationRole
|
||||||
{
|
{
|
||||||
public class CreateModel : ConfigAuthorizationRoleCreateModel
|
public class CreateModel : ConfigAuthorizationRoleCreateModel
|
||||||
{
|
{
|
||||||
public Disco.Models.Repository.AuthorizationRole AuthorizationRole { get; set; }
|
[Required, StringLength(100)]
|
||||||
|
public string Name { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,15 @@
|
|||||||
using Disco.Models.UI.Config.DeviceBatch;
|
using Disco.Models.UI.Config.DeviceBatch;
|
||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Disco.Web.Areas.Config.Models.DeviceBatch
|
namespace Disco.Web.Areas.Config.Models.DeviceBatch
|
||||||
{
|
{
|
||||||
public class CreateModel : ConfigDeviceBatchCreateModel
|
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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
using Disco.Models.UI.Config.DeviceFlag;
|
using Disco.Models.UI.Config.DeviceFlag;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Disco.Web.Areas.Config.Models.DeviceFlag
|
namespace Disco.Web.Areas.Config.Models.DeviceFlag
|
||||||
{
|
{
|
||||||
public class CreateModel : ConfigDeviceFlagCreateModel
|
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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
using Disco.Models.UI.Config.DeviceProfile;
|
using Disco.Models.UI.Config.DeviceProfile;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Disco.Web.Areas.Config.Models.DeviceProfile
|
namespace Disco.Web.Areas.Config.Models.DeviceProfile
|
||||||
{
|
{
|
||||||
public class CreateModel : ConfigDeviceProfileCreateModel
|
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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,13 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
|
|||||||
[CustomValidation(typeof(CreateModelValidation), "ValidateCreateModel")]
|
[CustomValidation(typeof(CreateModelValidation), "ValidateCreateModel")]
|
||||||
public class CreateModel : ConfigDocumentTemplateCreateModel
|
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]
|
[Required]
|
||||||
public HttpPostedFileBase Template { get; set; }
|
public HttpPostedFileBase Template { get; set; }
|
||||||
@@ -21,13 +27,8 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
|
|||||||
public List<Disco.Models.Repository.JobType> JobTypes { get; set; }
|
public List<Disco.Models.Repository.JobType> JobTypes { get; set; }
|
||||||
public List<Disco.Models.Repository.JobSubType> JobSubTypes { get; set; }
|
public List<Disco.Models.Repository.JobSubType> JobSubTypes { get; set; }
|
||||||
|
|
||||||
public List<string> Scopes
|
public List<string> Scopes =>
|
||||||
{
|
Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList();
|
||||||
get
|
|
||||||
{
|
|
||||||
return Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Disco.Models.Repository.JobType> GetJobTypes()
|
public List<Disco.Models.Repository.JobType> GetJobTypes()
|
||||||
{
|
{
|
||||||
@@ -63,7 +64,7 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
|
|||||||
public static ValidationResult ValidateCreateModel(CreateModel model)
|
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)
|
if (model.Types != null && model.SubTypes != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
using Disco.Models.Services.Documents;
|
using Disco.Models.Repository;
|
||||||
using Disco.Models.UI.Config.DocumentTemplate;
|
using Disco.Models.UI.Config.DocumentTemplate;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
|
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
|
||||||
{
|
{
|
||||||
public class CreatePackageModel : ConfigDocumentTemplateCreatePackageModel
|
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<string> Scopes
|
public List<string> Scopes
|
||||||
{
|
=> Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList();
|
||||||
get
|
|
||||||
{
|
|
||||||
return Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Disco.Models.UI.Config.DocumentTemplate;
|
|||||||
using Disco.Services;
|
using Disco.Services;
|
||||||
using Disco.Services.Documents.ManagedGroups;
|
using Disco.Services.Documents.ManagedGroups;
|
||||||
using Disco.Services.Expressions;
|
using Disco.Services.Expressions;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
|
|||||||
public DocumentTemplateDevicesManagedGroup DevicesLinkedGroup { get; set; }
|
public DocumentTemplateDevicesManagedGroup DevicesLinkedGroup { get; set; }
|
||||||
public DocumentTemplateUsersManagedGroup UsersLinkedGroup { get; set; }
|
public DocumentTemplateUsersManagedGroup UsersLinkedGroup { get; set; }
|
||||||
|
|
||||||
public string BulkGenerateDownloadId { get; set; }
|
public Guid? BulkGenerateDownloadId { get; set; }
|
||||||
|
|
||||||
public string BulkGenerateDownloadFilename { get; set; }
|
public string BulkGenerateDownloadFilename { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
using Disco.Models.UI.Config.JobQueue;
|
using Disco.Models.UI.Config.JobQueue;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Disco.Web.Areas.Config.Models.JobQueue
|
namespace Disco.Web.Areas.Config.Models.JobQueue
|
||||||
{
|
{
|
||||||
public class CreateModel : ConfigJobQueueCreateModel
|
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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,14 @@
|
|||||||
using Disco.Models.UI.Config.UserFlag;
|
using Disco.Models.UI.Config.UserFlag;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Disco.Web.Areas.Config.Models.UserFlag
|
namespace Disco.Web.Areas.Config.Models.UserFlag
|
||||||
{
|
{
|
||||||
public class CreateModel : ConfigUserFlagCreateModel
|
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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,8 @@
|
|||||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles", MVC.Config.AuthorizationRole.Index(null), "Create");
|
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles", MVC.Config.AuthorizationRole.Index(null), "Create");
|
||||||
}
|
}
|
||||||
@using (Html.BeginForm())
|
@using (Html.BeginForm())
|
||||||
{
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
<div class="form" style="width: 450px">
|
<div class="form" style="width: 450px">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -12,7 +13,7 @@
|
|||||||
Name:
|
Name:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.EditorFor(model => model.AuthorizationRole.Name)<br />@Html.ValidationMessageFor(model => model.AuthorizationRole.Name)
|
@Html.EditorFor(model => model.Name)<br />@Html.ValidationMessageFor(model => model.Name)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -22,7 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
$('#AuthorizationRole_Name').focus().select();
|
$('#Name').focus().select();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,21 @@ WriteLiteral("\r\n");
|
|||||||
|
|
||||||
#line 6 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
|
#line 6 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
|
||||||
using (Html.BeginForm())
|
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
|
#line default
|
||||||
@@ -74,8 +88,8 @@ WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 15 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
|
#line 16 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
|
||||||
Write(Html.EditorFor(model => model.AuthorizationRole.Name));
|
Write(Html.EditorFor(model => model.Name));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -83,8 +97,8 @@ WriteLiteral(" ");
|
|||||||
WriteLiteral("<br />");
|
WriteLiteral("<br />");
|
||||||
|
|
||||||
|
|
||||||
#line 15 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
|
#line 16 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.AuthorizationRole.Name));
|
Write(Html.ValidationMessageFor(model => model.Name));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -107,11 +121,11 @@ WriteLiteral(" <script");
|
|||||||
|
|
||||||
WriteLiteral(" type=\"text/javascript\"");
|
WriteLiteral(" type=\"text/javascript\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n $(function () {\r\n $(\'#AuthorizationRole_Name\').focus().sele" +
|
WriteLiteral(">\r\n $(function () {\r\n $(\'#Name\').focus().select();\r\n });" +
|
||||||
"ct();\r\n });\r\n </script>\r\n");
|
"\r\n </script>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 28 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
|
#line 29 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,17 @@
|
|||||||
{
|
{
|
||||||
<div class="form" style="width: 450px; padding: 100px 0;">
|
<div class="form" style="width: 450px; padding: 100px 0;">
|
||||||
<h2>No authorization roles are configured</h2>
|
<h2>No authorization roles are configured</h2>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<table class="tableData">
|
<table class="tableData">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name
|
<th>
|
||||||
|
Name
|
||||||
</th>
|
</th>
|
||||||
<th>Linked Groups/Users
|
<th>
|
||||||
|
Linked Groups/Users
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
@foreach (var item in Model.Tokens)
|
@foreach (var item in Model.Tokens)
|
||||||
@@ -39,58 +41,75 @@ else
|
|||||||
</table>
|
</table>
|
||||||
}
|
}
|
||||||
<!-- #region Administrator Subjects -->
|
<!-- #region Administrator Subjects -->
|
||||||
<div id="Config_AuthRoles_Subjects_Update_Dialog" class="dialog" title="Disco ICT Administrators">
|
<div id="Config_AuthRoles_Subjects_Update_Dialog" class="dialog" title="Disco ICT Administrators" data-searchsubjectsurl="@(Url.Action(MVC.API.System.SearchSubjects()))" data-subjecturl="@Url.Action(MVC.API.System.Subject())">
|
||||||
<div id="Config_AuthRoles_Subjects_Update_Dialog_ListContainer">
|
@using (Html.BeginForm(MVC.API.AuthorizationRole.UpdateAdministratorSubjects(null, true)))
|
||||||
<span id="Config_AuthRoles_Subjects_Update_Dialog_None" class="smallMessage">None Associated</span>
|
{
|
||||||
<ul id="Config_AuthRoles_Subjects_Update_Dialog_List" class="none">
|
@Html.AntiForgeryToken()
|
||||||
@foreach (var sg in Model.AdministratorSubjects)
|
<div id="Config_AuthRoles_Subjects_Update_Dialog_ListContainer">
|
||||||
{
|
<span id="Config_AuthRoles_Subjects_Update_Dialog_None" class="smallMessage">None Associated</span>
|
||||||
var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);
|
<ul id="Config_AuthRoles_Subjects_Update_Dialog_List" class="none">
|
||||||
<li class="@(sg.IsGroup ? "group" : "user")" data-subjectid="@sg.Id">@if (sg.IsGroup)
|
@foreach (var sg in Model.AdministratorSubjects)
|
||||||
{
|
{
|
||||||
<i class="fa fa-users fa-lg"></i>@displayName
|
var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);
|
||||||
}
|
<li class="@(sg.IsGroup ? "group" : "user")" data-subjectid="@sg.Id">
|
||||||
else
|
<input type="hidden" name="subjects" value="@sg.Id" />
|
||||||
{
|
@if (sg.IsGroup)
|
||||||
<i class="fa fa-user fa-lg"></i>@displayName
|
{
|
||||||
}<i class="fa fa-times-circle remove"></i></li>
|
<i class="fa fa-users fa-lg"></i>@displayName
|
||||||
}
|
}
|
||||||
</ul>
|
else
|
||||||
</div>
|
{
|
||||||
|
<i class="fa fa-user fa-lg"></i>@displayName
|
||||||
|
}<i class="fa fa-times-circle remove"></i>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
<div id="Config_AuthRoles_Subjects_Update_Dialog_AddContainer">
|
<div id="Config_AuthRoles_Subjects_Update_Dialog_AddContainer">
|
||||||
<input type="text" id="Config_AuthRoles_Subjects_Update_Dialog_TextAdd" />
|
<input type="text" id="Config_AuthRoles_Subjects_Update_Dialog_TextAdd" />
|
||||||
<a id="Config_AuthRoles_Subjects_Update_Dialog_Add" href="#" class="button small">Add</a>
|
<button id="Config_AuthRoles_Subjects_Update_Dialog_Add" type="button" class="button small">Add</button>
|
||||||
</div>
|
</div>
|
||||||
<form id="Config_AuthRoles_Subjects_Update_Dialog_Form" action="@(Url.Action(MVC.API.AuthorizationRole.UpdateAdministratorSubjects(null, true)))" method="post"></form>
|
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
var dialog, textAdd, list, noSubjects, form;
|
let dialog = null;
|
||||||
|
let originalList = null;
|
||||||
|
let list = null;
|
||||||
|
let textAdd = null;
|
||||||
|
let noSubjects = null;
|
||||||
|
|
||||||
function showDialog() {
|
function showDialog() {
|
||||||
if (!dialog) {
|
if (!dialog) {
|
||||||
|
list = $('#Config_AuthRoles_Subjects_Update_Dialog_List');
|
||||||
|
originalList = list.html();
|
||||||
|
noSubjects = $('#Config_AuthRoles_Subjects_Update_Dialog_None');
|
||||||
|
textAdd = $('#Config_AuthRoles_Subjects_Update_Dialog_TextAdd');
|
||||||
|
|
||||||
dialog = $('#Config_AuthRoles_Subjects_Update_Dialog').dialog({
|
dialog = $('#Config_AuthRoles_Subjects_Update_Dialog').dialog({
|
||||||
resizable: false,
|
resizable: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
width: 350,
|
width: 350,
|
||||||
height: 420,
|
|
||||||
buttons: {
|
buttons: {
|
||||||
"Save Changes": saveChanges,
|
"Save Changes": saveChanges,
|
||||||
Cancel: cancel
|
Cancel: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
close: function () {
|
||||||
|
list.html(originalList);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.on('click', '.remove', remove);
|
dialog.on('click', '.remove', function () {
|
||||||
|
$(this).closest('li').remove();
|
||||||
list = $('#Config_AuthRoles_Subjects_Update_Dialog_List');
|
updateNoSubjects();
|
||||||
noSubjects = $('#Config_AuthRoles_Subjects_Update_Dialog_None');
|
});
|
||||||
|
|
||||||
textAdd = $('#Config_AuthRoles_Subjects_Update_Dialog_TextAdd');
|
|
||||||
|
|
||||||
textAdd.watermark('Search Subjects')
|
textAdd.watermark('Search Subjects')
|
||||||
.autocomplete({
|
.autocomplete({
|
||||||
source: '@(Url.Action(MVC.API.System.SearchSubjects()))',
|
source: dialog.attr('data-searchsubjectsurl'),
|
||||||
minLength: 2,
|
minLength: 2,
|
||||||
focus: function (e, ui) {
|
focus: function (e, ui) {
|
||||||
textAdd.val(ui.item.Id);
|
textAdd.val(ui.item.Id);
|
||||||
@@ -98,6 +117,7 @@ else
|
|||||||
},
|
},
|
||||||
select: function (e, ui) {
|
select: function (e, ui) {
|
||||||
textAdd.val(ui.item.Id).blur();
|
textAdd.val(ui.item.Id).blur();
|
||||||
|
$('#Config_AuthRoles_Subjects_Update_Dialog_Add').trigger('click');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}).data('ui-autocomplete')._renderItem = function (ul, item) {
|
}).data('ui-autocomplete')._renderItem = function (ul, item) {
|
||||||
@@ -107,7 +127,7 @@ else
|
|||||||
.appendTo(ul);
|
.appendTo(ul);
|
||||||
};
|
};
|
||||||
|
|
||||||
$('#Config_AuthRoles_Subjects_Update_Dialog_Add').click(add);
|
$('#Config_AuthRoles_Subjects_Update_Dialog_Add').on('click', add);
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.dialog('open');
|
dialog.dialog('open');
|
||||||
@@ -116,79 +136,61 @@ else
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
async function add() {
|
||||||
$(this).dialog("close");
|
const id = textAdd.val();
|
||||||
|
|
||||||
list.find('li').each(function () {
|
try {
|
||||||
$this = $(this);
|
const body = new FormData();
|
||||||
if ($this.is('[data-subjectstatus="new"]')) {
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
$this.remove();
|
body.append('id', id);
|
||||||
} else {
|
const response = await fetch(dialog.attr('data-subjecturl'), {
|
||||||
if ($this.is('[data-subjectstatus="removed"]')) {
|
method: 'POST',
|
||||||
$this.show();
|
body: body
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
if (!data)
|
||||||
|
throw 'Unknown user id';
|
||||||
|
|
||||||
|
if (!data.IsGroup && !data.IsUserAccount)
|
||||||
|
throw data.Name + ' [' + data.Id + '] is a ' + data.Type + '. Only users and groups can be added.';
|
||||||
|
|
||||||
|
if (list.find('li[data-subjectid="' + data.Id.replace('\\', '\\\\') + '"]').length != 0) {
|
||||||
|
throw 'That subject has already been added';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const liIcon = $('<i>').addClass('fa fa-lg');
|
||||||
|
if (data.Type === 'user')
|
||||||
|
liIcon.addClass('fa-user');
|
||||||
|
else
|
||||||
|
liIcon.addClass('fa-users');
|
||||||
|
|
||||||
|
const li = $('<li>')
|
||||||
|
.append($('<input>').attr({ type: 'hidden', name: 'subjects', value: data.Id }))
|
||||||
|
.append(liIcon)
|
||||||
|
.append($('<span>').text(data.Id == data.Name ? data.Id : data.Name + ' [' + data.Id + ']'))
|
||||||
|
.append($('<i>').addClass('fa fa-times-circle remove'))
|
||||||
|
.addClass(data.Type)
|
||||||
|
.attr('data-subjectid', data.Id)
|
||||||
|
.attr('data-subjectstatus', 'new');
|
||||||
|
|
||||||
|
list.append(li);
|
||||||
|
textAdd.val('');
|
||||||
|
|
||||||
|
updateNoSubjects();
|
||||||
|
} else {
|
||||||
|
alert('Error: ' + response.statusText);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function remove() {
|
} catch (e) {
|
||||||
$this = $(this).closest('li');
|
alert('Error: ' + e);
|
||||||
|
|
||||||
if ($this.is('[data-subjectstatus="new"]')) {
|
|
||||||
$this.remove();
|
|
||||||
} else {
|
|
||||||
$this.attr('data-subjectstatus', 'removed').hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateNoSubjects();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function add() {
|
|
||||||
var id = textAdd.val();
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '@Url.Action(MVC.API.System.Subject())',
|
|
||||||
method: 'post',
|
|
||||||
data: { Id: id }
|
|
||||||
}).done(function (response) {
|
|
||||||
if (response) {
|
|
||||||
if (response.IsGroup || response.IsUserAccount) {
|
|
||||||
if (list.find('li[data-subjectid="' + response.Id.replace('\\', '\\\\') + '"]').length == 0) {
|
|
||||||
|
|
||||||
var liIcon = $('<i>').addClass('fa fa-lg');
|
|
||||||
if (response.Type === 'user')
|
|
||||||
liIcon.addClass('fa-user');
|
|
||||||
else
|
|
||||||
liIcon.addClass('fa-users');
|
|
||||||
|
|
||||||
var li = $('<li>')
|
|
||||||
.append(liIcon)
|
|
||||||
.append($('<span>').text(response.Id == response.Name ? response.Id : response.Name + ' [' + response.Id + ']'))
|
|
||||||
.append($('<i>').addClass('fa fa-times-circle remove'))
|
|
||||||
.addClass(response.Type)
|
|
||||||
.attr('data-subjectid', response.Id)
|
|
||||||
.attr('data-subjectstatus', 'new');
|
|
||||||
|
|
||||||
list.append(li);
|
|
||||||
|
|
||||||
updateNoSubjects();
|
|
||||||
} else {
|
|
||||||
alert('That subject has already been added');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
alert(response.Name + ' ['+response.Id+'] is a ' + response.Type + '. Only users and groups can be added.');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
alert('Unknown Id');
|
|
||||||
}
|
|
||||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
|
||||||
alert('Error: ' + errorThrown);
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateNoSubjects() {
|
function updateNoSubjects() {
|
||||||
if (list.find('li:visible').length > 0)
|
if (list.find('li:visible').length > 0)
|
||||||
noSubjects.hide();
|
noSubjects.hide();
|
||||||
@@ -197,22 +199,9 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
function saveChanges() {
|
function saveChanges() {
|
||||||
var form = $('#Config_AuthRoles_Subjects_Update_Dialog_Form').empty();
|
dialog
|
||||||
|
.dialog("option", "buttons", null)
|
||||||
list.find('li[data-subjectstatus!="removed"]').each(function () {
|
.find('form').trigger('submit');
|
||||||
var subjectId = $(this).attr('data-subjectid');
|
|
||||||
|
|
||||||
form.append($('<input>').attr({
|
|
||||||
'name': 'Subjects',
|
|
||||||
'type': 'hidden'
|
|
||||||
}).val(subjectId));
|
|
||||||
|
|
||||||
}).get();
|
|
||||||
|
|
||||||
form.submit();
|
|
||||||
|
|
||||||
dialog.dialog("disable");
|
|
||||||
dialog.dialog("option", "buttons", null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ WriteLiteral(" class=\"form\"");
|
|||||||
|
|
||||||
WriteLiteral(" style=\"width: 450px; padding: 100px 0;\"");
|
WriteLiteral(" style=\"width: 450px; padding: 100px 0;\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n <h2>No authorization roles are configured</h2>\r\n </div> \r\n");
|
WriteLiteral(">\r\n <h2>No authorization roles are configured</h2>\r\n </div>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 11 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 11 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
@@ -83,17 +83,18 @@ WriteLiteral(" <table");
|
|||||||
|
|
||||||
WriteLiteral(" class=\"tableData\"");
|
WriteLiteral(" class=\"tableData\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n <tr>\r\n <th>Name\r\n </th>\r\n <th>Linked " +
|
WriteLiteral(">\r\n <tr>\r\n <th>\r\n Name\r\n </th>\r\n " +
|
||||||
"Groups/Users\r\n </th>\r\n </tr>\r\n");
|
" <th>\r\n Linked Groups/Users\r\n </th>\r\n </t" +
|
||||||
|
"r>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 21 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 23 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 21 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 23 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
foreach (var item in Model.Tokens)
|
foreach (var item in Model.Tokens)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -105,7 +106,7 @@ WriteLiteral(" <tr>\r\n <td>\r\n");
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 25 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 27 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
Write(Html.ActionLink(item.Role.Name, MVC.Config.AuthorizationRole.Index(item.Role.Id)));
|
Write(Html.ActionLink(item.Role.Name, MVC.Config.AuthorizationRole.Index(item.Role.Id)));
|
||||||
|
|
||||||
|
|
||||||
@@ -114,13 +115,13 @@ WriteLiteral(" ");
|
|||||||
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 28 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 30 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 28 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 30 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
if (item.SubjectIds.Count == 0)
|
if (item.SubjectIds.Count == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -134,7 +135,7 @@ WriteLiteral(" class=\"smallMessage\"");
|
|||||||
WriteLiteral("><None></span>\r\n");
|
WriteLiteral("><None></span>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 31 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 33 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -143,14 +144,14 @@ WriteLiteral("><None></span>\r\n");
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 34 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 36 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
Write(string.Join(", ", item.SubjectIds.OrderBy(i => i)));
|
Write(string.Join(", ", item.SubjectIds.OrderBy(i => i)));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 34 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 36 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +161,7 @@ WriteLiteral("><None></span>\r\n");
|
|||||||
WriteLiteral(" </td>\r\n </tr>\r\n");
|
WriteLiteral(" </td>\r\n </tr>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 38 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 40 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -169,7 +170,7 @@ WriteLiteral(" </td>\r\n </tr>\r\n");
|
|||||||
WriteLiteral(" </table>\r\n");
|
WriteLiteral(" </table>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 40 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 42 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -183,17 +184,69 @@ WriteLiteral(" class=\"dialog\"");
|
|||||||
|
|
||||||
WriteLiteral(" title=\"Disco ICT Administrators\"");
|
WriteLiteral(" title=\"Disco ICT Administrators\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n <div");
|
WriteLiteral(" data-searchsubjectsurl=\"");
|
||||||
|
|
||||||
|
|
||||||
|
#line 44 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
Write(Url.Action(MVC.API.System.SearchSubjects()));
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral("\"");
|
||||||
|
|
||||||
|
WriteLiteral(" data-subjecturl=\"");
|
||||||
|
|
||||||
|
|
||||||
|
#line 44 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
Write(Url.Action(MVC.API.System.Subject()));
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral("\"");
|
||||||
|
|
||||||
|
WriteLiteral(">\r\n");
|
||||||
|
|
||||||
|
|
||||||
|
#line 45 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 45 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
using (Html.BeginForm(MVC.API.AuthorizationRole.UpdateAdministratorSubjects(null, true)))
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 47 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
Write(Html.AntiForgeryToken());
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 47 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral(" <div");
|
||||||
|
|
||||||
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_ListContainer\"");
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_ListContainer\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n <span");
|
WriteLiteral(">\r\n <span");
|
||||||
|
|
||||||
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_None\"");
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_None\"");
|
||||||
|
|
||||||
WriteLiteral(" class=\"smallMessage\"");
|
WriteLiteral(" class=\"smallMessage\"");
|
||||||
|
|
||||||
WriteLiteral(">None Associated</span>\r\n <ul");
|
WriteLiteral(">None Associated</span>\r\n <ul");
|
||||||
|
|
||||||
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_List\"");
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_List\"");
|
||||||
|
|
||||||
@@ -202,105 +255,127 @@ WriteLiteral(" class=\"none\"");
|
|||||||
WriteLiteral(">\r\n");
|
WriteLiteral(">\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 46 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 51 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 46 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 51 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
foreach (var sg in Model.AdministratorSubjects)
|
foreach (var sg in Model.AdministratorSubjects)
|
||||||
{
|
{
|
||||||
var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);
|
var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" <li");
|
WriteLiteral(" <li");
|
||||||
|
|
||||||
WriteAttribute("class", Tuple.Create(" class=\"", 1809), Tuple.Create("\"", 1849)
|
WriteAttribute("class", Tuple.Create(" class=\"", 2136), Tuple.Create("\"", 2176)
|
||||||
|
|
||||||
#line 49 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 54 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 1817), Tuple.Create<System.Object, System.Int32>(sg.IsGroup ? "group" : "user"
|
, Tuple.Create(Tuple.Create("", 2144), Tuple.Create<System.Object, System.Int32>(sg.IsGroup ? "group" : "user"
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 1817), false)
|
, 2144), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" data-subjectid=\"");
|
WriteLiteral(" data-subjectid=\"");
|
||||||
|
|
||||||
|
|
||||||
#line 49 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 54 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
Write(sg.Id);
|
Write(sg.Id);
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\"");
|
WriteLiteral("\"");
|
||||||
|
|
||||||
WriteLiteral(">");
|
WriteLiteral(">\r\n <input");
|
||||||
|
|
||||||
|
WriteLiteral(" type=\"hidden\"");
|
||||||
|
|
||||||
|
WriteLiteral(" name=\"subjects\"");
|
||||||
|
|
||||||
|
WriteAttribute("value", Tuple.Create(" value=\"", 2264), Tuple.Create("\"", 2278)
|
||||||
|
|
||||||
|
#line 55 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
, Tuple.Create(Tuple.Create("", 2272), Tuple.Create<System.Object, System.Int32>(sg.Id
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
, 2272), false)
|
||||||
|
);
|
||||||
|
|
||||||
|
WriteLiteral(" />\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 49 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 56 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
if (sg.IsGroup)
|
|
||||||
{
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 56 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
if (sg.IsGroup)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" <i");
|
WriteLiteral(" <i");
|
||||||
|
|
||||||
WriteLiteral(" class=\"fa fa-users fa-lg\"");
|
WriteLiteral(" class=\"fa fa-users fa-lg\"");
|
||||||
|
|
||||||
WriteLiteral("></i>");
|
WriteLiteral("></i>");
|
||||||
|
|
||||||
|
|
||||||
#line 51 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 58 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 51 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 58 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
Write(displayName);
|
Write(displayName);
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 51 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 58 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" <i");
|
WriteLiteral(" <i");
|
||||||
|
|
||||||
WriteLiteral(" class=\"fa fa-user fa-lg\"");
|
WriteLiteral(" class=\"fa fa-user fa-lg\"");
|
||||||
|
|
||||||
WriteLiteral("></i>");
|
WriteLiteral("></i>");
|
||||||
|
|
||||||
|
|
||||||
#line 55 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 62 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 55 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 62 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
Write(displayName);
|
Write(displayName);
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 55 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 62 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
@@ -308,16 +383,25 @@ WriteLiteral("<i");
|
|||||||
|
|
||||||
WriteLiteral(" class=\"fa fa-times-circle remove\"");
|
WriteLiteral(" class=\"fa fa-times-circle remove\"");
|
||||||
|
|
||||||
WriteLiteral("></i></li>\r\n");
|
WriteLiteral("></i>\r\n </li>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 57 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 65 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" </ul>\r\n </div>\r\n <div");
|
WriteLiteral(" </ul>\r\n </div>\r\n");
|
||||||
|
|
||||||
|
|
||||||
|
#line 68 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral(" <div");
|
||||||
|
|
||||||
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_AddContainer\"");
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_AddContainer\"");
|
||||||
|
|
||||||
@@ -327,136 +411,81 @@ WriteLiteral(" type=\"text\"");
|
|||||||
|
|
||||||
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_TextAdd\"");
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_TextAdd\"");
|
||||||
|
|
||||||
WriteLiteral(" />\r\n <a");
|
WriteLiteral(" />\r\n <button");
|
||||||
|
|
||||||
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_Add\"");
|
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_Add\"");
|
||||||
|
|
||||||
WriteLiteral(" href=\"#\"");
|
WriteLiteral(" type=\"button\"");
|
||||||
|
|
||||||
WriteLiteral(" class=\"button small\"");
|
WriteLiteral(" class=\"button small\"");
|
||||||
|
|
||||||
WriteLiteral(">Add</a>\r\n </div>\r\n <form");
|
WriteLiteral(">Add</button>\r\n </div>\r\n</div>\r\n<script>\r\n (function () {\r\n let dial" +
|
||||||
|
"og = null;\r\n let originalList = null;\r\n let list = null;\r\n " +
|
||||||
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_Form\"");
|
"let textAdd = null;\r\n let noSubjects = null;\r\n\r\n function showDial" +
|
||||||
|
"og() {\r\n if (!dialog) {\r\n list = $(\'#Config_AuthRoles_" +
|
||||||
WriteAttribute("action", Tuple.Create(" action=\"", 2880), Tuple.Create("\"", 2969)
|
"Subjects_Update_Dialog_List\');\r\n originalList = list.html();\r\n " +
|
||||||
|
" noSubjects = $(\'#Config_AuthRoles_Subjects_Update_Dialog_None\');\r\n " +
|
||||||
#line 64 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
" textAdd = $(\'#Config_AuthRoles_Subjects_Update_Dialog_TextAdd\');\r" +
|
||||||
, Tuple.Create(Tuple.Create("", 2889), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.AuthorizationRole.UpdateAdministratorSubjects(null, true))
|
"\n\r\n dialog = $(\'#Config_AuthRoles_Subjects_Update_Dialog\').dialog" +
|
||||||
|
"({\r\n resizable: false,\r\n modal: true,\r\n " +
|
||||||
#line default
|
" autoOpen: false,\r\n width: 350,\r\n " +
|
||||||
#line hidden
|
" buttons: {\r\n \"Save Changes\": saveChanges,\r\n " +
|
||||||
, 2889), false)
|
" Cancel: function () {\r\n $(this).dia" +
|
||||||
);
|
"log(\"close\");\r\n }\r\n },\r\n " +
|
||||||
|
" close: function () {\r\n list.html(originalList);\r\n " +
|
||||||
WriteLiteral(" method=\"post\"");
|
" }\r\n });\r\n\r\n dialog.on(\'click\', \'" +
|
||||||
|
".remove\', function () {\r\n $(this).closest(\'li\').remove();\r\n " +
|
||||||
WriteLiteral(@"></form>
|
" updateNoSubjects();\r\n });\r\n\r\n te" +
|
||||||
</div>
|
"xtAdd.watermark(\'Search Subjects\')\r\n .autocomplete({\r\n " +
|
||||||
<script>
|
" source: dialog.attr(\'data-searchsubjectsurl\'),\r\n " +
|
||||||
(function () {
|
" minLength: 2,\r\n focus: function (e, ui) {\r\n " +
|
||||||
var dialog, textAdd, list, noSubjects, form;
|
" textAdd.val(ui.item.Id);\r\n ret" +
|
||||||
|
"urn false;\r\n },\r\n select: function" +
|
||||||
function showDialog() {
|
" (e, ui) {\r\n textAdd.val(ui.item.Id).blur();\r\n " +
|
||||||
if (!dialog) {
|
" $(\'#Config_AuthRoles_Subjects_Update_Dialog_Add\').trigger(\'" +
|
||||||
dialog = $('#Config_AuthRoles_Subjects_Update_Dialog').dialog({
|
"click\');\r\n return false;\r\n }\r\n" +
|
||||||
resizable: false,
|
" }).data(\'ui-autocomplete\')._renderItem = function (ul, item)" +
|
||||||
modal: true,
|
" {\r\n return $(\"<li></li>\")\r\n ." +
|
||||||
autoOpen: false,
|
"data(\"item.autocomplete\", item)\r\n .append(\"<a><strong" +
|
||||||
width: 350,
|
">\" + item.Name + \"</strong><br>\" + item.Id + \" (\" + item.Type + \")</a>\")\r\n " +
|
||||||
height: 420,
|
" .appendTo(ul);\r\n };\r\n\r\n " +
|
||||||
buttons: {
|
"$(\'#Config_AuthRoles_Subjects_Update_Dialog_Add\').on(\'click\', add);\r\n " +
|
||||||
""Save Changes"": saveChanges,
|
" }\r\n\r\n dialog.dialog(\'open\');\r\n\r\n updateNoSubjects();\r\n " +
|
||||||
Cancel: cancel
|
" 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 = ne" +
|
||||||
});
|
"w FormData();\r\n body.append(\'__RequestVerificationToken\', documen" +
|
||||||
|
"t.body.dataset.antiforgery);\r\n body.append(\'id\', id);\r\n " +
|
||||||
dialog.on('click', '.remove', remove);
|
" const response = await fetch(dialog.attr(\'data-subjecturl\'), {\r\n " +
|
||||||
|
" method: \'POST\',\r\n body: body\r\n });\r\n" +
|
||||||
list = $('#Config_AuthRoles_Subjects_Update_Dialog_List');
|
"\r\n if (response.ok) {\r\n const data = await res" +
|
||||||
noSubjects = $('#Config_AuthRoles_Subjects_Update_Dialog_None');
|
"ponse.json();\r\n\r\n if (!data)\r\n throw \'" +
|
||||||
|
"Unknown user id\';\r\n\r\n if (!data.IsGroup && !data.IsUserAccoun" +
|
||||||
textAdd = $('#Config_AuthRoles_Subjects_Update_Dialog_TextAdd');
|
"t)\r\n throw data.Name + \' [\' + data.Id + \'] is a \' + data." +
|
||||||
|
"Type + \'. Only users and groups can be added.\';\r\n\r\n if (list." +
|
||||||
textAdd.watermark('Search Subjects')
|
"find(\'li[data-subjectid=\"\' + data.Id.replace(\'\\\\\', \'\\\\\\\\\') + \'\"]\').length != 0) " +
|
||||||
.autocomplete({
|
"{\r\n throw \'That subject has already been added\';\r\n " +
|
||||||
source: '");
|
" }\r\n\r\n const liIcon = $(\'<i>\').addClass(\'fa fa-lg" +
|
||||||
|
"\');\r\n if (data.Type === \'user\')\r\n liIc" +
|
||||||
|
"on.addClass(\'fa-user\');\r\n else\r\n liIco" +
|
||||||
#line 93 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
"n.addClass(\'fa-users\');\r\n\r\n const li = $(\'<li>\')\r\n " +
|
||||||
Write(Url.Action(MVC.API.System.SearchSubjects()));
|
" .append($(\'<input>\').attr({ type: \'hidden\', name: \'subjects\', value" +
|
||||||
|
": data.Id }))\r\n .append(liIcon)\r\n " +
|
||||||
|
".append($(\'<span>\').text(data.Id == data.Name ? data.Id : data.Name + \' [\' + dat" +
|
||||||
#line default
|
"a.Id + \']\'))\r\n .append($(\'<i>\').addClass(\'fa fa-times-cir" +
|
||||||
#line hidden
|
"cle remove\'))\r\n .addClass(data.Type)\r\n " +
|
||||||
WriteLiteral("\',\r\n minLength: 2,\r\n focus: functio" +
|
" .attr(\'data-subjectid\', data.Id)\r\n .attr(\'data-subje" +
|
||||||
"n (e, ui) {\r\n textAdd.val(ui.item.Id);\r\n " +
|
"ctstatus\', \'new\');\r\n\r\n list.append(li);\r\n " +
|
||||||
" return false;\r\n },\r\n " +
|
"textAdd.val(\'\');\r\n\r\n updateNoSubjects();\r\n } e" +
|
||||||
" select: function (e, ui) {\r\n textAdd.val(ui.item.Id" +
|
"lse {\r\n alert(\'Error: \' + response.statusText);\r\n " +
|
||||||
").blur();\r\n return false;\r\n }\r" +
|
" }\r\n\r\n } catch (e) {\r\n alert(\'Error: \' + e);\r\n " +
|
||||||
"\n }).data(\'ui-autocomplete\')._renderItem = function (ul, item" +
|
" }\r\n\r\n return false;\r\n }\r\n\r\n function updateNoSub" +
|
||||||
") {\r\n return $(\"<li></li>\")\r\n " +
|
"jects() {\r\n if (list.find(\'li:visible\').length > 0)\r\n " +
|
||||||
".data(\"item.autocomplete\", item)\r\n .append(\"<a><stron" +
|
"noSubjects.hide();\r\n else\r\n noSubjects.show();\r\n " +
|
||||||
"g>\" + item.Name + \"</strong><br>\" + item.Id + \" (\" + item.Type + \")</a>\")\r\n " +
|
" }\r\n\r\n function saveChanges() {\r\n dialog\r\n .di" +
|
||||||
" .appendTo(ul);\r\n };\r\n\r\n " +
|
"alog(\"option\", \"buttons\", null)\r\n .find(\'form\').trigger(\'submit\')" +
|
||||||
" $(\'#Config_AuthRoles_Subjects_Update_Dialog_Add\').click(add);\r\n }\r\n\r" +
|
";\r\n }\r\n\r\n $(function () {\r\n $(\'#Config_AuthRoles_Update" +
|
||||||
"\n dialog.dialog(\'open\');\r\n\r\n updateNoSubjects();\r\n " +
|
"Administrators\').click(showDialog);\r\n });\r\n\r\n })();\r\n</script>\r\n<!-- #" +
|
||||||
" return false;\r\n }\r\n\r\n function cancel() {\r\n $(this)" +
|
"endregion -->\r\n<div");
|
||||||
".dialog(\"close\");\r\n\r\n list.find(\'li\').each(function () {\r\n " +
|
|
||||||
" $this = $(this);\r\n if ($this.is(\'[data-subjectstatus=\"new\"]\'" +
|
|
||||||
")) {\r\n $this.remove();\r\n } else {\r\n " +
|
|
||||||
" if ($this.is(\'[data-subjectstatus=\"removed\"]\')) {\r\n " +
|
|
||||||
" $this.show();\r\n }\r\n }\r\n });\r\n " +
|
|
||||||
" }\r\n\r\n function remove() {\r\n $this = $(this).closest(\'li\'" +
|
|
||||||
");\r\n\r\n if ($this.is(\'[data-subjectstatus=\"new\"]\')) {\r\n " +
|
|
||||||
" $this.remove();\r\n } else {\r\n $this.attr(\'data-subject" +
|
|
||||||
"status\', \'removed\').hide();\r\n }\r\n\r\n updateNoSubjects();\r\n " +
|
|
||||||
" return false;\r\n }\r\n\r\n function add() {\r\n var" +
|
|
||||||
" id = textAdd.val();\r\n\r\n $.ajax({\r\n url: \'");
|
|
||||||
|
|
||||||
|
|
||||||
#line 151 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
|
||||||
Write(Url.Action(MVC.API.System.Subject()));
|
|
||||||
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral("\',\r\n method: \'post\',\r\n data: { Id: id }\r\n " +
|
|
||||||
" }).done(function (response) {\r\n if (response) {\r\n " +
|
|
||||||
" if (response.IsGroup || response.IsUserAccount) {\r\n " +
|
|
||||||
" if (list.find(\'li[data-subjectid=\"\' + response.Id.replace(\'\\\\\', \'\\\\\\\\\') + \'\"]\')" +
|
|
||||||
".length == 0) {\r\n\r\n var liIcon = $(\'<i>\').addClass(\'f" +
|
|
||||||
"a fa-lg\');\r\n if (response.Type === \'user\')\r\n " +
|
|
||||||
" liIcon.addClass(\'fa-user\');\r\n " +
|
|
||||||
"else\r\n liIcon.addClass(\'fa-users\');\r\n\r\n " +
|
|
||||||
" var li = $(\'<li>\')\r\n .append(li" +
|
|
||||||
"Icon)\r\n .append($(\'<span>\').text(response.Id == r" +
|
|
||||||
"esponse.Name ? response.Id : response.Name + \' [\' + response.Id + \']\'))\r\n " +
|
|
||||||
" .append($(\'<i>\').addClass(\'fa fa-times-circle remove\'))" +
|
|
||||||
"\r\n .addClass(response.Type)\r\n " +
|
|
||||||
" .attr(\'data-subjectid\', response.Id)\r\n " +
|
|
||||||
" .attr(\'data-subjectstatus\', \'new\');\r\n\r\n list.append" +
|
|
||||||
"(li);\r\n\r\n updateNoSubjects();\r\n " +
|
|
||||||
" } else {\r\n alert(\'That subject has already been add" +
|
|
||||||
"ed\');\r\n }\r\n }\r\n els" +
|
|
||||||
"e {\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, errorThrown) {\r\n " +
|
|
||||||
" alert(\'Error: \' + errorThrown);\r\n });\r\n retu" +
|
|
||||||
"rn false;\r\n }\r\n\r\n function updateNoSubjects() {\r\n i" +
|
|
||||||
"f (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 var form = $(\'#Config_AuthRoles_Subjects_Update_Dia" +
|
|
||||||
"log_Form\').empty();\r\n\r\n list.find(\'li[data-subjectstatus!=\"removed\"]\'" +
|
|
||||||
").each(function () {\r\n var subjectId = $(this).attr(\'data-subject" +
|
|
||||||
"id\');\r\n\r\n form.append($(\'<input>\').attr({\r\n \'n" +
|
|
||||||
"ame\': \'Subjects\',\r\n \'type\': \'hidden\'\r\n }).val(" +
|
|
||||||
"subjectId));\r\n\r\n }).get();\r\n\r\n form.submit();\r\n\r\n " +
|
|
||||||
" dialog.dialog(\"disable\");\r\n dialog.dialog(\"option\", \"buttons\", nul" +
|
|
||||||
"l);\r\n }\r\n\r\n $(function () {\r\n $(\'#Config_AuthRoles_Upda" +
|
|
||||||
"teAdministrators\').click(showDialog);\r\n });\r\n\r\n })();\r\n</script>\r\n<!--" +
|
|
||||||
" #endregion -->\r\n<div");
|
|
||||||
|
|
||||||
WriteLiteral(" class=\"actionBar\"");
|
WriteLiteral(" class=\"actionBar\"");
|
||||||
|
|
||||||
@@ -471,7 +500,7 @@ WriteLiteral(" class=\"button\"");
|
|||||||
WriteLiteral(">Update Disco ICT Administrators [");
|
WriteLiteral(">Update Disco ICT Administrators [");
|
||||||
|
|
||||||
|
|
||||||
#line 226 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
#line 215 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
|
||||||
Write(Model.AdministratorSubjects.Count);
|
Write(Model.AdministratorSubjects.Count);
|
||||||
|
|
||||||
|
|
||||||
@@ -482,7 +511,7 @@ WriteLiteral("]</a>\r\n");
|
|||||||
WriteLiteral(" ");
|
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()));
|
Write(Html.ActionLinkButton("Create Authorization Role", MVC.Config.AuthorizationRole.Create()));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,16 +11,19 @@
|
|||||||
<div id="Config_AuthRoles_Show" class="form" style="width: 550px">
|
<div id="Config_AuthRoles_Show" class="form" style="width: 550px">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 150px">Id:
|
<th style="width: 150px">
|
||||||
|
Id:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(model => model.Token.Role.Id)
|
@Html.DisplayFor(model => model.Token.Role.Id)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name:
|
<th>
|
||||||
|
Name:
|
||||||
</th>
|
</th>
|
||||||
<td>@Html.EditorFor(model => model.Token.Role.Name)
|
<td>
|
||||||
|
@Html.EditorFor(model => model.Token.Role.Name)
|
||||||
@AjaxHelpers.AjaxSave()
|
@AjaxHelpers.AjaxSave()
|
||||||
@AjaxHelpers.AjaxLoader()
|
@AjaxHelpers.AjaxLoader()
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -48,71 +51,87 @@
|
|||||||
@foreach (var sg in Model.Subjects)
|
@foreach (var sg in Model.Subjects)
|
||||||
{
|
{
|
||||||
var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);
|
var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);
|
||||||
<li class="@(sg.IsGroup ? "group" : "user")">@if (sg.IsGroup)
|
<li class="@(sg.IsGroup ? "group" : "user")">
|
||||||
{
|
@if (sg.IsGroup)
|
||||||
<i class="fa fa-users fa-lg"></i>@displayName
|
{
|
||||||
}
|
<i class="fa fa-users fa-lg"></i>@displayName
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
<a href="@(Url.Action(MVC.User.Show(sg.Id)))#UserDetailTab-Authorization"><i class="fa fa-user fa-lg"></i>@displayName</a>
|
{
|
||||||
}</li>
|
<a href="@(Url.Action(MVC.User.Show(sg.Id)))#UserDetailTab-Authorization"><i class="fa fa-user fa-lg"></i>@displayName</a>
|
||||||
|
}
|
||||||
|
</li>
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
}
|
}
|
||||||
<div>
|
<div>
|
||||||
<a id="Config_AuthRoles_Subjects_Update" href="#" class="button small">Update</a>
|
<a id="Config_AuthRoles_Subjects_Update" href="#" class="button small">Update</a>
|
||||||
<div id="Config_AuthRoles_Subjects_Update_Dialog" class="dialog" title="Authorization Role Linked Groups/Users">
|
<div id="Config_AuthRoles_Subjects_Update_Dialog" class="dialog" title="Authorization Role Linked Groups/Users" data-searchsubjectsurl="@(Url.Action(MVC.API.System.SearchSubjects()))" data-subjecturl="@Url.Action(MVC.API.System.Subject())">
|
||||||
<div id="Config_AuthRoles_Subjects_Update_Dialog_ListContainer">
|
@using (Html.BeginForm(MVC.API.AuthorizationRole.UpdateSubjects(Model.Token.Role.Id, null, true)))
|
||||||
<span id="Config_AuthRoles_Subjects_Update_Dialog_None" class="smallMessage">None Associated</span>
|
{
|
||||||
<ul id="Config_AuthRoles_Subjects_Update_Dialog_List" class="none">
|
@Html.AntiForgeryToken()
|
||||||
@foreach (var sg in Model.Subjects)
|
<div id="Config_AuthRoles_Subjects_Update_Dialog_ListContainer">
|
||||||
{
|
<span id="Config_AuthRoles_Subjects_Update_Dialog_None" class="smallMessage">None Associated</span>
|
||||||
var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);
|
<ul id="Config_AuthRoles_Subjects_Update_Dialog_List" class="none">
|
||||||
<li class="@(sg.IsGroup ? "group" : "user")" data-subjectid="@sg.Id">@if (sg.IsGroup)
|
@foreach (var sg in Model.Subjects)
|
||||||
{
|
{
|
||||||
<i class="fa fa-users fa-lg"></i>@displayName
|
var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);
|
||||||
}
|
<li class="@(sg.IsGroup ? "group" : "user")" data-subjectid="@sg.Id">
|
||||||
else
|
<input type="hidden" name="subjects" value="@sg.Id" />
|
||||||
{
|
@if (sg.IsGroup)
|
||||||
<i class="fa fa-user fa-lg"></i>@displayName
|
{
|
||||||
}<i class="fa fa-times-circle remove"></i></li>
|
<i class="fa fa-users fa-lg"></i>@displayName
|
||||||
}
|
}
|
||||||
</ul>
|
else
|
||||||
</div>
|
{
|
||||||
|
<i class="fa fa-user fa-lg"></i>@displayName
|
||||||
|
}<i class="fa fa-times-circle remove"></i>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
<div id="Config_AuthRoles_Subjects_Update_Dialog_AddContainer">
|
<div id="Config_AuthRoles_Subjects_Update_Dialog_AddContainer">
|
||||||
<input type="text" id="Config_AuthRoles_Subjects_Update_Dialog_TextAdd" />
|
<input type="text" id="Config_AuthRoles_Subjects_Update_Dialog_TextAdd" />
|
||||||
<a id="Config_AuthRoles_Subjects_Update_Dialog_Add" href="#" class="button small">Add</a>
|
<button id="Config_AuthRoles_Subjects_Update_Dialog_Add" type="button" class="button small">Add</button>
|
||||||
</div>
|
</div>
|
||||||
<form id="Config_AuthRoles_Subjects_Update_Dialog_Form" action="@(Url.Action(MVC.API.AuthorizationRole.UpdateSubjects(Model.Token.Role.Id, null, true)))" method="post"></form>
|
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
(function(){
|
(function () {
|
||||||
var dialog, textAdd, list, noSubjects, form;
|
let dialog, textAdd, list, originalList, noSubjects;
|
||||||
|
|
||||||
function showDialog(){
|
function showDialog() {
|
||||||
if (!dialog){
|
if (!dialog) {
|
||||||
|
list = $('#Config_AuthRoles_Subjects_Update_Dialog_List');
|
||||||
|
originalList = list.html();
|
||||||
|
noSubjects = $('#Config_AuthRoles_Subjects_Update_Dialog_None');
|
||||||
|
textAdd = $('#Config_AuthRoles_Subjects_Update_Dialog_TextAdd');
|
||||||
|
|
||||||
dialog = $('#Config_AuthRoles_Subjects_Update_Dialog').dialog({
|
dialog = $('#Config_AuthRoles_Subjects_Update_Dialog').dialog({
|
||||||
resizable: false,
|
resizable: false,
|
||||||
modal: true,
|
modal: true,
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
width: 350,
|
width: 350,
|
||||||
height: 420,
|
|
||||||
buttons: {
|
buttons: {
|
||||||
"Save Changes": saveChanges,
|
"Save Changes": saveChanges,
|
||||||
Cancel: cancel
|
Cancel: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
close: function () {
|
||||||
|
list.html(originalList);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.on('click', '.remove', remove);
|
dialog.on('click', '.remove', function () {
|
||||||
|
$(this).closest('li').remove();
|
||||||
|
updateNoSubjects();
|
||||||
|
});
|
||||||
|
|
||||||
list = $('#Config_AuthRoles_Subjects_Update_Dialog_List');
|
|
||||||
noSubjects = $('#Config_AuthRoles_Subjects_Update_Dialog_None');
|
|
||||||
|
|
||||||
textAdd = $('#Config_AuthRoles_Subjects_Update_Dialog_TextAdd');
|
|
||||||
|
|
||||||
textAdd.watermark('Search Subjects')
|
textAdd.watermark('Search Subjects')
|
||||||
.autocomplete({
|
.autocomplete({
|
||||||
source: '@(Url.Action(MVC.API.System.SearchSubjects()))',
|
source: dialog.attr('data-searchsubjectsurl'),
|
||||||
minLength: 2,
|
minLength: 2,
|
||||||
focus: function (e, ui) {
|
focus: function (e, ui) {
|
||||||
textAdd.val(ui.item.Id);
|
textAdd.val(ui.item.Id);
|
||||||
@@ -120,6 +139,7 @@
|
|||||||
},
|
},
|
||||||
select: function (e, ui) {
|
select: function (e, ui) {
|
||||||
textAdd.val(ui.item.Id).blur();
|
textAdd.val(ui.item.Id).blur();
|
||||||
|
$('#Config_AuthRoles_Subjects_Update_Dialog_Add').trigger('click');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}).data('ui-autocomplete')._renderItem = function (ul, item) {
|
}).data('ui-autocomplete')._renderItem = function (ul, item) {
|
||||||
@@ -129,7 +149,7 @@
|
|||||||
.appendTo(ul);
|
.appendTo(ul);
|
||||||
};
|
};
|
||||||
|
|
||||||
$('#Config_AuthRoles_Subjects_Update_Dialog_Add').click(add);
|
$('#Config_AuthRoles_Subjects_Update_Dialog_Add').on('click', add);
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.dialog('open');
|
dialog.dialog('open');
|
||||||
@@ -138,106 +158,75 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel(){
|
async function add() {
|
||||||
$(this).dialog("close");
|
const id = textAdd.val();
|
||||||
|
|
||||||
list.find('li').each(function(){
|
try {
|
||||||
$this = $(this);
|
const body = new FormData();
|
||||||
if ($this.is('[data-subjectstatus="new"]')){
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
$this.remove();
|
body.append('id', id);
|
||||||
}else{
|
const response = await fetch(dialog.attr('data-subjecturl'), {
|
||||||
if ($this.is('[data-subjectstatus="removed"]')){
|
method: 'POST',
|
||||||
$this.show();
|
body: body
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
if (!data)
|
||||||
|
throw 'Unknown user id';
|
||||||
|
|
||||||
|
if (!data.IsGroup && !data.IsUserAccount)
|
||||||
|
throw data.Name + ' [' + data.Id + '] is a ' + data.Type + '. Only users and groups can be added.';
|
||||||
|
|
||||||
|
if (list.find('li[data-subjectid="' + data.Id.replace('\\', '\\\\') + '"]').length != 0) {
|
||||||
|
throw 'That subject has already been added';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const liIcon = $('<i>').addClass('fa fa-lg');
|
||||||
|
if (data.Type === 'user')
|
||||||
|
liIcon.addClass('fa-user');
|
||||||
|
else
|
||||||
|
liIcon.addClass('fa-users');
|
||||||
|
|
||||||
|
const li = $('<li>')
|
||||||
|
.append($('<input>').attr({ type: 'hidden', name: 'subjects', value: data.Id }))
|
||||||
|
.append(liIcon)
|
||||||
|
.append($('<span>').text(data.Id == data.Name ? data.Id : data.Name + ' [' + data.Id + ']'))
|
||||||
|
.append($('<i>').addClass('fa fa-times-circle remove'))
|
||||||
|
.addClass(data.Type)
|
||||||
|
.attr('data-subjectid', data.Id)
|
||||||
|
.attr('data-subjectstatus', 'new');
|
||||||
|
|
||||||
|
list.append(li);
|
||||||
|
textAdd.val('');
|
||||||
|
|
||||||
|
updateNoSubjects();
|
||||||
|
} else {
|
||||||
|
alert('Error: ' + response.statusText);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function remove(){
|
} catch (e) {
|
||||||
$this = $(this).closest('li');
|
alert('Error: ' + e);
|
||||||
|
|
||||||
if ($this.is('[data-subjectstatus="new"]')){
|
|
||||||
$this.remove();
|
|
||||||
}else{
|
|
||||||
$this.attr('data-subjectstatus', 'removed').hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateNoSubjects();
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function add(){
|
function updateNoSubjects() {
|
||||||
var id = textAdd.val();
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '@Url.Action(MVC.API.System.Subject())',
|
|
||||||
method: 'post',
|
|
||||||
data: { Id: id }
|
|
||||||
}).done(function(response){
|
|
||||||
if (response){
|
|
||||||
if (response.IsGroup || response.IsUserAccount) {
|
|
||||||
if (list.find('li[data-subjectid="'+response.Id.replace('\\', '\\\\')+'"]').length == 0){
|
|
||||||
|
|
||||||
var liIcon = $('<i>').addClass('fa fa-lg');
|
|
||||||
if (response.Type === 'user')
|
|
||||||
liIcon.addClass('fa-user');
|
|
||||||
else
|
|
||||||
liIcon.addClass('fa-users');
|
|
||||||
|
|
||||||
var li = $('<li>')
|
|
||||||
.append(liIcon)
|
|
||||||
.append($('<span>').text(response.Id == response.Name ? response.Id : response.Name + ' [' + response.Id + ']'))
|
|
||||||
.append($('<i>').addClass('fa fa-times-circle remove'))
|
|
||||||
.addClass(response.Type)
|
|
||||||
.attr('data-subjectid', response.Id)
|
|
||||||
.attr('data-subjectstatus', 'new');
|
|
||||||
|
|
||||||
list.append(li);
|
|
||||||
|
|
||||||
updateNoSubjects();
|
|
||||||
}else{
|
|
||||||
alert('That subject has already been added');
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
alert(response.Name + ' ['+response.Id+'] is a ' + response.Type + '. Only users and groups can be added.');
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
alert('Unknown Id');
|
|
||||||
}
|
|
||||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
|
||||||
alert('Error: ' + errorThrown);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateNoSubjects(){
|
|
||||||
if (list.find('li:visible').length > 0)
|
if (list.find('li:visible').length > 0)
|
||||||
noSubjects.hide();
|
noSubjects.hide();
|
||||||
else
|
else
|
||||||
noSubjects.show();
|
noSubjects.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveChanges(){
|
function saveChanges() {
|
||||||
var form = $('#Config_AuthRoles_Subjects_Update_Dialog_Form').empty();
|
dialog
|
||||||
|
.dialog("option", "buttons", null)
|
||||||
list.find('li[data-subjectstatus!="removed"]').each(function(){
|
.find('form').trigger('submit');
|
||||||
var subjectId = $(this).attr('data-subjectid');
|
|
||||||
|
|
||||||
form.append($('<input>').attr({
|
|
||||||
'name': 'Subjects',
|
|
||||||
'type': 'hidden'
|
|
||||||
}).val(subjectId));
|
|
||||||
|
|
||||||
}).get();
|
|
||||||
|
|
||||||
form.submit();
|
|
||||||
|
|
||||||
dialog.dialog("disable");
|
|
||||||
dialog.dialog("option", "buttons", null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function(){
|
$('#Config_AuthRoles_Subjects_Update').click(showDialog);
|
||||||
$('#Config_AuthRoles_Subjects_Update').click(showDialog);
|
|
||||||
});
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
@@ -248,13 +237,16 @@
|
|||||||
<div id="Config_AuthRoles_Claims_Tree">
|
<div id="Config_AuthRoles_Claims_Tree">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a href="#" id="Config_AuthRoles_Claims_SaveChanges" class="button small disabled">Save Changes</a>@AjaxHelpers.AjaxLoader()
|
<button type="button" id="Config_AuthRoles_Claims_SaveChanges" class="button small disabled" data-saveurl="@Url.Action(MVC.API.AuthorizationRole.UpdateClaims(Model.Token.Role.Id))">Save Changes</button>@AjaxHelpers.AjaxLoader()
|
||||||
</div>
|
</div>
|
||||||
|
<script id="Config_AuthRoles_Claims_NodesJson" type="application/json">
|
||||||
|
@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.ClaimNavigatorFancyTreeNodes))
|
||||||
|
</script>
|
||||||
<script>
|
<script>
|
||||||
(function(){
|
(function () {
|
||||||
var claimNodes = @(new HtmlString(Newtonsoft.Json.JsonConvert.SerializeObject(Model.ClaimNavigatorFancyTreeNodes)));
|
var claimNodes = JSON.parse($('#Config_AuthRoles_Claims_NodesJson').html());
|
||||||
|
|
||||||
$(function(){
|
$(function () {
|
||||||
var saveButton = $('#Config_AuthRoles_Claims_SaveChanges');
|
var saveButton = $('#Config_AuthRoles_Claims_SaveChanges');
|
||||||
var ajaxLoading = saveButton.next('.ajaxLoading');
|
var ajaxLoading = saveButton.next('.ajaxLoading');
|
||||||
|
|
||||||
@@ -262,43 +254,45 @@
|
|||||||
source: claimNodes,
|
source: claimNodes,
|
||||||
checkbox: true,
|
checkbox: true,
|
||||||
selectMode: 3,
|
selectMode: 3,
|
||||||
select: function(){
|
select: function () {
|
||||||
saveButton.removeClass('disabled');
|
saveButton.removeClass('disabled');
|
||||||
},
|
},
|
||||||
keyboard: false
|
keyboard: false
|
||||||
});
|
});
|
||||||
|
|
||||||
saveButton.click(function(){
|
saveButton.on('click', async function () {
|
||||||
if (!saveButton.is('.disabled')){
|
if (!saveButton.is('.disabled')) {
|
||||||
var selectedNodes = tree.fancytree('getTree').getSelectedNodes();
|
ajaxLoading.show();
|
||||||
|
|
||||||
var selectedKeys = [];
|
try {
|
||||||
for (var i = 0; i < selectedNodes.length; i++) {
|
const body = new FormData();
|
||||||
var node = selectedNodes[i];
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
if (!node.folder)
|
|
||||||
selectedKeys.push(node.key);
|
|
||||||
}
|
|
||||||
|
|
||||||
ajaxLoading.show()
|
var selectedNodes = tree.fancytree('getTree').getSelectedNodes();
|
||||||
|
|
||||||
$.ajax({
|
var selectedKeys = [];
|
||||||
url: '@Url.Action(MVC.API.AuthorizationRole.UpdateClaims(Model.Token.Role.Id))',
|
for (var i = 0; i < selectedNodes.length; i++) {
|
||||||
method: 'post',
|
var node = selectedNodes[i];
|
||||||
data: { ClaimKeys: selectedKeys },
|
if (!node.folder)
|
||||||
traditional: true
|
body.append('claimKeys', node.key);
|
||||||
}).done(function(response, result){
|
|
||||||
if (result != 'success' || response != 'OK') {
|
|
||||||
alert('Unable to save changes:\n' + response);
|
|
||||||
ajaxLoading.hide();
|
|
||||||
} else {
|
|
||||||
saveButton.addClass('disabled');
|
|
||||||
ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
|
||||||
}
|
}
|
||||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
|
||||||
alert('Error: ' + errorThrown);
|
const response = await fetch(saveButton.attr('data-saveurl'), {
|
||||||
});
|
method: 'POST',
|
||||||
|
body: body
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
saveButton.addClass('disabled');
|
||||||
|
ajaxLoading.next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||||
|
} else {
|
||||||
|
alert('Unable to save changes:\n' + response);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alert('Error: ' + e);
|
||||||
|
}
|
||||||
|
ajaxLoading.hide();
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
@@ -308,8 +302,12 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="actionBar">
|
<div class="actionBar">
|
||||||
@Html.ActionLinkButton("Delete", MVC.API.AuthorizationRole.Delete(Model.Token.Role.Id, true), "Config_AuthRoles_Actions_Delete_Button")
|
<button id="Config_AuthRoles_Actions_Delete_Button" type="button" class="button">Delete</button>
|
||||||
<div id="Config_AuthRoles_Actions_Delete_Dialog" title="Delete this Authorization Role?">
|
<div id="Config_AuthRoles_Actions_Delete_Dialog" class="dialog" title="Delete this Authorization Role?">
|
||||||
|
@using (Html.BeginForm(MVC.API.AuthorizationRole.Delete(Model.Token.Role.Id, true)))
|
||||||
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
|
}
|
||||||
<p>
|
<p>
|
||||||
<i class="fa fa-exclamation-triangle fa-lg warning"></i>
|
<i class="fa fa-exclamation-triangle fa-lg warning"></i>
|
||||||
This item will be permanently deleted and cannot be recovered.<br />
|
This item will be permanently deleted and cannot be recovered.<br />
|
||||||
@@ -319,30 +317,28 @@
|
|||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var button = $('#Config_AuthRoles_Actions_Delete_Button');
|
let buttonDialog = null;
|
||||||
var buttonDialog = $('#Config_AuthRoles_Actions_Delete_Dialog');
|
$('#Config_AuthRoles_Actions_Delete_Button').click(function () {
|
||||||
var buttonLink = button.attr('href');
|
if (!buttonDialog) {
|
||||||
button.attr('href', '#');
|
buttonDialog = $('#Config_AuthRoles_Actions_Delete_Dialog').dialog({
|
||||||
button.click(function () {
|
resizable: false,
|
||||||
buttonDialog.dialog('open');
|
modal: true,
|
||||||
return false;
|
autoOpen: false,
|
||||||
});
|
buttons: {
|
||||||
buttonDialog.dialog({
|
"Delete": function () {
|
||||||
resizable: false,
|
$(this)
|
||||||
modal: true,
|
.dialog("option", "buttons", null)
|
||||||
autoOpen: false,
|
.find('form').trigger('submit');
|
||||||
buttons: {
|
},
|
||||||
"Delete": function () {
|
Cancel: function () {
|
||||||
var $this = $(this);
|
$(this).dialog("close");
|
||||||
$this.dialog("disable");
|
}
|
||||||
$this.dialog("option", "buttons", null);
|
}
|
||||||
window.location.href = buttonLink;
|
});
|
||||||
},
|
|
||||||
Cancel: function () {
|
|
||||||
$(this).dialog("close");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
buttonDialog.dialog('open');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -4,20 +4,21 @@
|
|||||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Create");
|
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Create");
|
||||||
}
|
}
|
||||||
@using (Html.BeginForm())
|
@using (Html.BeginForm())
|
||||||
{
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
@Html.ValidationSummary(false)
|
@Html.ValidationSummary(false)
|
||||||
<div class="form" style="width: 450px">
|
<div class="form" style="width: 450px">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name:</th>
|
<th>Name:</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.EditorFor(model => model.DeviceBatch.Name)<br />@Html.ValidationMessageFor(model => model.DeviceBatch.Name)
|
@Html.EditorFor(model => model.Name)<br />@Html.ValidationMessageFor(model => model.Name)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Purchase Date:</th>
|
<th>Purchase Date:</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.EditorFor(model => model.DeviceBatch.PurchaseDate)<br />@Html.ValidationMessageFor(model => model.DeviceBatch.PurchaseDate)
|
@Html.EditorFor(model => model.PurchaseDate)<br />@Html.ValidationMessageFor(model => model.PurchaseDate)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -29,6 +30,7 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
$('#Name').focus().select();
|
$('#Name').focus().select();
|
||||||
$('#PurchaseDate').datepicker({
|
$('#PurchaseDate').datepicker({
|
||||||
|
minDate: new Date(1900, 1-1, 1),
|
||||||
changeYear: true,
|
changeYear: true,
|
||||||
changeMonth: true,
|
changeMonth: true,
|
||||||
dateFormat: 'yy/mm/dd'
|
dateFormat: 'yy/mm/dd'
|
||||||
|
|||||||
@@ -57,20 +57,34 @@ WriteLiteral("\r\n");
|
|||||||
|
|
||||||
#line 6 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
#line 6 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||||
using (Html.BeginForm())
|
using (Html.BeginForm())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 8 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
#line 8 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||||
Write(Html.ValidationSummary(false));
|
Write(Html.AntiForgeryToken());
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 8 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
#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 <table>\r\n <tr>\r\n <th>Na
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 14 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
#line 15 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||||
Write(Html.EditorFor(model => model.DeviceBatch.Name));
|
Write(Html.EditorFor(model => model.Name));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -97,8 +111,8 @@ WriteLiteral(" ");
|
|||||||
WriteLiteral("<br />");
|
WriteLiteral("<br />");
|
||||||
|
|
||||||
|
|
||||||
#line 14 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
#line 15 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.DeviceBatch.Name));
|
Write(Html.ValidationMessageFor(model => model.Name));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -109,8 +123,8 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 20 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
#line 21 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||||
Write(Html.EditorFor(model => model.DeviceBatch.PurchaseDate));
|
Write(Html.EditorFor(model => model.PurchaseDate));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -118,8 +132,8 @@ WriteLiteral(" ");
|
|||||||
WriteLiteral("<br />");
|
WriteLiteral("<br />");
|
||||||
|
|
||||||
|
|
||||||
#line 20 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
#line 21 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.DeviceBatch.PurchaseDate));
|
Write(Html.ValidationMessageFor(model => model.PurchaseDate));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -146,6 +160,7 @@ WriteLiteral(@">
|
|||||||
$(function () {
|
$(function () {
|
||||||
$('#Name').focus().select();
|
$('#Name').focus().select();
|
||||||
$('#PurchaseDate').datepicker({
|
$('#PurchaseDate').datepicker({
|
||||||
|
minDate: new Date(1900, 1-1, 1),
|
||||||
changeYear: true,
|
changeYear: true,
|
||||||
changeMonth: true,
|
changeMonth: true,
|
||||||
dateFormat: 'yy/mm/dd'
|
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"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -285,7 +285,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div id="DeviceBatch_PurchaseDetails_Container">
|
<div id="DeviceBatch_PurchaseDetails_Container" data-updateurl="@(Url.Action(MVC.API.DeviceBatch.UpdatePurchaseDetails(Model.DeviceBatch.Id)))">
|
||||||
<div>
|
<div>
|
||||||
Details @AjaxHelpers.AjaxLoader("ajaxPurchaseDetails")
|
Details @AjaxHelpers.AjaxLoader("ajaxPurchaseDetails")
|
||||||
</div>
|
</div>
|
||||||
@@ -294,50 +294,39 @@
|
|||||||
@Html.EditorFor(model => model.DeviceBatch.PurchaseDetails)
|
@Html.EditorFor(model => model.DeviceBatch.PurchaseDetails)
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var model = {
|
const $field = $('#DeviceBatch_PurchaseDetails');
|
||||||
$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: '@(Url.Action(MVC.API.DeviceBatch.UpdatePurchaseDetails(Model.DeviceBatch.Id)))',
|
|
||||||
dataType: 'json',
|
|
||||||
data: data,
|
|
||||||
traditional: true,
|
|
||||||
type: 'POST',
|
|
||||||
success: function (d) {
|
|
||||||
if (d == 'OK') {
|
|
||||||
model.$ajax_loading.hide();
|
|
||||||
model.$ajax_ok.show().delay('fast').fadeOut('slow');
|
|
||||||
} else {
|
|
||||||
model.$ajax_loading.hide();
|
|
||||||
alert('Unable to update purchase details: ' + d);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
|
||||||
alert('Unable to update purchase details: ' + errorThrown);
|
|
||||||
model.$ajax_loading.hide();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
model.$field.tinymce({
|
async function updated() {
|
||||||
|
$('#ajaxPurchaseDetails_loading').show();
|
||||||
|
try {
|
||||||
|
const body = new FormData();
|
||||||
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
|
body.append('purchaseDetails', $field.tinymce().getContent())
|
||||||
|
|
||||||
|
const response = await fetch($('#DeviceBatch_PurchaseDetails_Container').attr('data-updateurl'), {
|
||||||
|
method: 'POST',
|
||||||
|
body: body
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
$('#ajaxPurchaseDetails_ok').show().delay('fast').fadeOut('slow');
|
||||||
|
} else {
|
||||||
|
alert('Unable to update purchase details: ' + response.statusText);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alert('Unable to update purchase details: ' + e);
|
||||||
|
}
|
||||||
|
$('#ajaxPurchaseDetails_loading').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$field.tinymce({
|
||||||
theme: 'simple',
|
theme: 'simple',
|
||||||
add_unload_trigger: false,
|
add_unload_trigger: false,
|
||||||
schema: "html5",
|
schema: "html5",
|
||||||
statusbar: false,
|
statusbar: false,
|
||||||
setup: function (ed) {
|
setup: function (ed) {
|
||||||
ed.on('init', function () {
|
ed.on('init', function () {
|
||||||
$(ed.getWin()).blur(model.updated);
|
$(ed.getWin()).blur(function () { updated(); });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -390,7 +379,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div id="DeviceBatch_WarrantyDetails_Container">
|
<div id="DeviceBatch_WarrantyDetails_Container" data-updateurl="@(Url.Action(MVC.API.DeviceBatch.UpdateWarrantyDetails(Model.DeviceBatch.Id)))">
|
||||||
<div>
|
<div>
|
||||||
Details @AjaxHelpers.AjaxLoader("ajaxWarrantyDetails")
|
Details @AjaxHelpers.AjaxLoader("ajaxWarrantyDetails")
|
||||||
</div>
|
</div>
|
||||||
@@ -399,50 +388,39 @@
|
|||||||
@Html.EditorFor(model => model.DeviceBatch.WarrantyDetails)
|
@Html.EditorFor(model => model.DeviceBatch.WarrantyDetails)
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var model = {
|
const $field = $('#DeviceBatch_WarrantyDetails');
|
||||||
$field: $('#DeviceBatch_WarrantyDetails'),
|
|
||||||
fieldName: 'WarrantyDetails',
|
|
||||||
$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: '@(Url.Action(MVC.API.DeviceBatch.UpdateWarrantyDetails(Model.DeviceBatch.Id)))',
|
|
||||||
dataType: 'json',
|
|
||||||
data: data,
|
|
||||||
traditional: true,
|
|
||||||
type: 'POST',
|
|
||||||
success: function (d) {
|
|
||||||
if (d == 'OK') {
|
|
||||||
model.$ajax_loading.hide();
|
|
||||||
model.$ajax_ok.show().delay('fast').fadeOut('slow');
|
|
||||||
} else {
|
|
||||||
model.$ajax_loading.hide();
|
|
||||||
alert('Unable to update warranty details: ' + d);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
|
||||||
alert('Unable to update warranty details: ' + errorThrown);
|
|
||||||
model.$ajax_loading.hide();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
model.$field.tinymce({
|
async function updated() {
|
||||||
|
$('#ajaxWarrantyDetails_loading').show();
|
||||||
|
try {
|
||||||
|
const body = new FormData();
|
||||||
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
|
body.append('warrantyDetails', $field.tinymce().getContent())
|
||||||
|
|
||||||
|
const response = await fetch($('#DeviceBatch_WarrantyDetails_Container').attr('data-updateurl'), {
|
||||||
|
method: 'POST',
|
||||||
|
body: body
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
$('#ajaxWarrantyDetails_ok').show().delay('fast').fadeOut('slow');
|
||||||
|
} else {
|
||||||
|
alert('Unable to update warranty details: ' + response.statusText);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alert('Unable to update warranty details: ' + e);
|
||||||
|
}
|
||||||
|
$('#ajaxWarrantyDetails_loading').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$field.tinymce({
|
||||||
theme: 'simple',
|
theme: 'simple',
|
||||||
add_unload_trigger: false,
|
add_unload_trigger: false,
|
||||||
schema: "html5",
|
schema: "html5",
|
||||||
statusbar: false,
|
statusbar: false,
|
||||||
setup: function (ed) {
|
setup: function (ed) {
|
||||||
ed.on('init', function () {
|
ed.on('init', function () {
|
||||||
$(ed.getWin()).blur(model.updated);
|
$(ed.getWin()).blur(function () { updated(); });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -555,7 +533,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div id="DeviceBatch_InsuranceDetails_Container">
|
<div id="DeviceBatch_InsuranceDetails_Container" data-updateurl="@(Url.Action(MVC.API.DeviceBatch.UpdateInsuranceDetails(Model.DeviceBatch.Id)))">
|
||||||
<div>
|
<div>
|
||||||
Details @AjaxHelpers.AjaxLoader("ajaxInsuranceDetails")
|
Details @AjaxHelpers.AjaxLoader("ajaxInsuranceDetails")
|
||||||
</div>
|
</div>
|
||||||
@@ -564,48 +542,38 @@
|
|||||||
@Html.EditorFor(model => model.DeviceBatch.InsuranceDetails)
|
@Html.EditorFor(model => model.DeviceBatch.InsuranceDetails)
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var model = {
|
const $field = $('#DeviceBatch_InsuranceDetails');
|
||||||
$field: $('#DeviceBatch_InsuranceDetails'),
|
async function updated() {
|
||||||
$ajax_loading: null,
|
$('#ajaxInsuranceDetails_loading').show();
|
||||||
$ajax_ok: null,
|
try {
|
||||||
updated: function () {
|
const body = new FormData();
|
||||||
if (!model.$ajax_loading)
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
model.$ajax_loading = $('#ajaxInsuranceDetails_loading');
|
body.append('insuranceDetails', $field.tinymce().getContent())
|
||||||
if (!model.$ajax_ok)
|
|
||||||
model.$ajax_ok = $('#ajaxInsuranceDetails_ok');
|
|
||||||
model.$ajax_loading.show();
|
|
||||||
var data = { InsuranceDetails: model.$field.tinymce().getContent() };
|
|
||||||
$.ajax({
|
|
||||||
url: '@(Url.Action(MVC.API.DeviceBatch.UpdateInsuranceDetails(Model.DeviceBatch.Id)))',
|
|
||||||
dataType: 'json',
|
|
||||||
data: data,
|
|
||||||
traditional: true,
|
|
||||||
type: 'POST',
|
|
||||||
success: function (d) {
|
|
||||||
if (d == 'OK') {
|
|
||||||
model.$ajax_loading.hide();
|
|
||||||
model.$ajax_ok.show().delay('fast').fadeOut('slow');
|
|
||||||
} else {
|
|
||||||
model.$ajax_loading.hide();
|
|
||||||
alert('Unable to update insurance details: ' + d);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
|
||||||
alert('Unable to update insurance details: ' + errorThrown);
|
|
||||||
model.$ajax_loading.hide();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
model.$field.tinymce({
|
const response = await fetch($('#DeviceBatch_InsuranceDetails_Container').attr('data-updateurl'), {
|
||||||
|
method: 'POST',
|
||||||
|
body: body
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
$('#ajaxInsuranceDetails_ok').show().delay('fast').fadeOut('slow');
|
||||||
|
} else {
|
||||||
|
alert('Unable to update insurance details: ' + response.statusText);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alert('Unable to update insurance details: ' + e);
|
||||||
|
}
|
||||||
|
$('#ajaxInsuranceDetails_loading').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$field.tinymce({
|
||||||
theme: 'simple',
|
theme: 'simple',
|
||||||
add_unload_trigger: false,
|
add_unload_trigger: false,
|
||||||
schema: "html5",
|
schema: "html5",
|
||||||
statusbar: false,
|
statusbar: false,
|
||||||
setup: function (ed) {
|
setup: function (ed) {
|
||||||
ed.on('init', function () {
|
ed.on('init', function () {
|
||||||
$(ed.getWin()).blur(model.updated);
|
$(ed.getWin()).blur(function () { updated(); });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -622,7 +590,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr id="DeviceBatch_Comments_Container" data-updateurl="@(Url.Action(MVC.API.DeviceBatch.UpdateComments(Model.DeviceBatch.Id)))">
|
||||||
<th>
|
<th>
|
||||||
Comments:<br />
|
Comments:<br />
|
||||||
@AjaxHelpers.AjaxLoader("ajaxComments")
|
@AjaxHelpers.AjaxLoader("ajaxComments")
|
||||||
@@ -632,53 +600,43 @@
|
|||||||
{
|
{
|
||||||
@Html.EditorFor(model => model.DeviceBatch.Comments)
|
@Html.EditorFor(model => model.DeviceBatch.Comments)
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var model = {
|
const $field = $('#DeviceBatch_Comments');
|
||||||
$field: $('#DeviceBatch_Comments'),
|
async function updated() {
|
||||||
$ajax_loading: null,
|
$('#ajaxComments_loading').show();
|
||||||
$ajax_ok: null,
|
try {
|
||||||
updated: function () {
|
const body = new FormData();
|
||||||
if (!model.$ajax_loading)
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
model.$ajax_loading = $('#ajaxComments_loading');
|
body.append('comments', $field.tinymce().getContent())
|
||||||
if (!model.$ajax_ok)
|
|
||||||
model.$ajax_ok = $('#ajaxComments_ok');
|
|
||||||
model.$ajax_loading.show();
|
|
||||||
var data = { Comments: model.$field.tinymce().getContent() };
|
|
||||||
$.ajax({
|
|
||||||
url: '@(Url.Action(MVC.API.DeviceBatch.UpdateComments(Model.DeviceBatch.Id)))',
|
|
||||||
dataType: 'json',
|
|
||||||
data: data,
|
|
||||||
traditional: true,
|
|
||||||
type: 'POST',
|
|
||||||
success: function (d) {
|
|
||||||
if (d == 'OK') {
|
|
||||||
model.$ajax_loading.hide();
|
|
||||||
model.$ajax_ok.show().delay('fast').fadeOut('slow');
|
|
||||||
} else {
|
|
||||||
model.$ajax_loading.hide();
|
|
||||||
alert('Unable to update comments: ' + d);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
|
||||||
alert('Unable to update comments: ' + errorThrown);
|
|
||||||
model.$ajax_loading.hide();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
model.$field.tinymce({
|
const response = await fetch($('#DeviceBatch_Comments_Container').attr('data-updateurl'), {
|
||||||
theme: 'simple',
|
method: 'POST',
|
||||||
add_unload_trigger: false,
|
body: body
|
||||||
schema: "html5",
|
});
|
||||||
statusbar: false,
|
|
||||||
setup: function (ed) {
|
if (response.ok) {
|
||||||
ed.on('init', function () {
|
$('#ajaxComments_ok').show().delay('fast').fadeOut('slow');
|
||||||
$(ed.getWin()).blur(model.updated);
|
} else {
|
||||||
});
|
alert('Unable to update comments: ' + response.statusText);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alert('Unable to update comments: ' + e);
|
||||||
|
}
|
||||||
|
$('#ajaxComments_loading').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$field.tinymce({
|
||||||
|
theme: 'simple',
|
||||||
|
add_unload_trigger: false,
|
||||||
|
schema: "html5",
|
||||||
|
statusbar: false,
|
||||||
|
setup: function (ed) {
|
||||||
|
ed.on('init', function () {
|
||||||
|
$(ed.getWin()).blur(function () { updated(); });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -693,8 +651,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Attachments:</th>
|
<th>Attachments:</th>
|
||||||
<td>
|
<td>
|
||||||
<div id="DeviceBatch_Attachments" class="@(canConfig ? "canAddAttachments" : "cannotAddAttachments")" data-uploadurl="@(Url.Action(MVC.API.DeviceBatch.AttachmentUpload(Model.DeviceBatch.Id, null)))">
|
<div id="DeviceBatch_Attachments" class="@(canConfig ? "canAddAttachments" : "cannotAddAttachments")" data-uploadurl="@(Url.Action(MVC.API.DeviceBatch.AttachmentUpload(Model.DeviceBatch.Id, null)))" data-removeurl="@Url.Action(MVC.API.DeviceBatch.AttachmentRemove())">
|
||||||
@Html.AntiForgeryToken()
|
|
||||||
<div class="Disco-AttachmentUpload-DropTarget">
|
<div class="Disco-AttachmentUpload-DropTarget">
|
||||||
<h2>Drop Attachments Here</h2>
|
<h2>Drop Attachments Here</h2>
|
||||||
</div>
|
</div>
|
||||||
@@ -708,7 +665,7 @@
|
|||||||
<img alt="Attachment Thumbnail" src="@(Url.Action(MVC.API.DeviceBatch.AttachmentThumbnail(attachment.Id)))" />
|
<img alt="Attachment Thumbnail" src="@(Url.Action(MVC.API.DeviceBatch.AttachmentThumbnail(attachment.Id)))" />
|
||||||
</span>
|
</span>
|
||||||
<span class="comments" title="@attachment.Comments">
|
<span class="comments" title="@attachment.Comments">
|
||||||
@attachment.Comments
|
@(attachment.Comments ?? attachment.Filename)
|
||||||
</span><span class="author">@attachment.TechUser.ToString()</span>@if (canConfig)
|
</span><span class="author">@attachment.TechUser.ToString()</span>@if (canConfig)
|
||||||
{<text><span class="remove fa fa-times-circle"></span></text>}<span class="timestamp" title="@attachment.Timestamp.ToFullDateTime()" data-livestamp="@attachment.Timestamp.ToUnixEpoc()">@attachment.Timestamp.ToFullDateTime()</span>
|
{<text><span class="remove fa fa-times-circle"></span></text>}<span class="timestamp" title="@attachment.Timestamp.ToFullDateTime()" data-livestamp="@attachment.Timestamp.ToUnixEpoc()">@attachment.Timestamp.ToFullDateTime()</span>
|
||||||
</a>
|
</a>
|
||||||
@@ -926,12 +883,10 @@
|
|||||||
});
|
});
|
||||||
//#endregion
|
//#endregion
|
||||||
//#region Remove Attachments
|
//#region Remove Attachments
|
||||||
$attachmentOutput.find('span.remove').click(removeAttachment);
|
$attachmentOutput.find('span.remove').on('click', removeAttachment);
|
||||||
|
|
||||||
function removeAttachment() {
|
function removeAttachment() {
|
||||||
$this = $(this).closest('a');
|
const attachmentId = $(this).closest('a').attr('data-attachmentid');
|
||||||
|
|
||||||
var data = { id: $this.attr('data-attachmentid') };
|
|
||||||
|
|
||||||
if (!$dialogRemoveAttachment) {
|
if (!$dialogRemoveAttachment) {
|
||||||
$dialogRemoveAttachment = $('#dialogRemoveAttachment').dialog({
|
$dialogRemoveAttachment = $('#dialogRemoveAttachment').dialog({
|
||||||
@@ -942,31 +897,28 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$dialogRemoveAttachment.dialog("enable");
|
|
||||||
$dialogRemoveAttachment.dialog('option', 'buttons', {
|
$dialogRemoveAttachment.dialog('option', 'buttons', {
|
||||||
"Remove": function () {
|
"Remove": function () {
|
||||||
$dialogRemoveAttachment.dialog("disable");
|
|
||||||
$dialogRemoveAttachment.dialog("option", "buttons", null);
|
$dialogRemoveAttachment.dialog("option", "buttons", null);
|
||||||
$.ajax({
|
|
||||||
url: '@Url.Action(MVC.API.DeviceBatch.AttachmentRemove())',
|
const body = new FormData();
|
||||||
dataType: 'json',
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
data: data,
|
body.append('id', attachmentId);
|
||||||
success: function (d) {
|
fetch($Attachments.attr('data-removeurl'), {
|
||||||
if (d == 'OK') {
|
method: 'POST',
|
||||||
// Do nothing, await SignalR notification
|
body: body
|
||||||
} else {
|
}).then(r => {
|
||||||
alert('Unable to remove attachment: ' + d);
|
if (!r.ok) {
|
||||||
}
|
alert('Unable to remove attachment: ' + r.statusText);
|
||||||
$dialogRemoveAttachment.dialog("close");
|
|
||||||
},
|
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
|
||||||
alert('Unable to remove attachment: ' + textStatus);
|
|
||||||
$dialogRemoveAttachment.dialog("close");
|
|
||||||
}
|
}
|
||||||
|
$dialogRemoveAttachment.dialog('close');
|
||||||
|
}).catch(e => {
|
||||||
|
alert('Unable to remove attachment: ' + e);
|
||||||
|
$dialogRemoveAttachment.dialog('close');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
Cancel: function () {
|
Cancel: function () {
|
||||||
$dialogRemoveAttachment.dialog("close");
|
$(this).dialog("close");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1044,7 +996,7 @@
|
|||||||
{
|
{
|
||||||
<button id="DeviceBatch_Decommission" class="button">Decommission All Devices</button>
|
<button id="DeviceBatch_Decommission" class="button">Decommission All Devices</button>
|
||||||
<div id="DeviceBatch_Decommission_Dialog" class="dialog" title="Batch Device Decommission">
|
<div id="DeviceBatch_Decommission_Dialog" class="dialog" title="Batch Device Decommission">
|
||||||
@using (Html.BeginForm(MVC.API.Device.DeviceBatchDecommission(Model.DeviceBatch.Id), FormMethod.Post))
|
@using (Html.BeginForm(MVC.API.Device.DeviceBatchDecommission(Model.DeviceBatch.Id)))
|
||||||
{
|
{
|
||||||
@Html.AntiForgeryToken()
|
@Html.AntiForgeryToken()
|
||||||
<div class="clearfix" style="margin-bottom: 10px;">
|
<div class="clearfix" style="margin-bottom: 10px;">
|
||||||
@@ -1101,7 +1053,44 @@
|
|||||||
}
|
}
|
||||||
@if (Model.CanDelete)
|
@if (Model.CanDelete)
|
||||||
{
|
{
|
||||||
@Html.ActionLinkButton("Delete", MVC.API.DeviceBatch.Delete(Model.DeviceBatch.Id, true), "buttonDelete")
|
<button id="buttonDelete" type="button" class="button">Delete</button>
|
||||||
|
<div id="dialogConfirmDelete" class="dialog" title="Delete this Device Batch?">
|
||||||
|
@using (Html.BeginForm(MVC.API.DeviceBatch.Delete(Model.DeviceBatch.Id, true)))
|
||||||
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
|
}
|
||||||
|
<p>
|
||||||
|
<i class="fa fa-exclamation-triangle fa-lg warning"></i>
|
||||||
|
This item will be permanently deleted and cannot be recovered. Are you sure?
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(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');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
}
|
}
|
||||||
@if (Model.DeviceCount > 0)
|
@if (Model.DeviceCount > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,15 +1,14 @@
|
|||||||
@{
|
@{
|
||||||
Authorization.Require(Claims.Config.DeviceBatch.ShowTimeline);
|
Authorization.Require(Claims.Config.DeviceBatch.ShowTimeline);
|
||||||
|
|
||||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Timeline");
|
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Timeline");
|
||||||
Html.BundleDeferred("~/Style/Timeline");
|
Html.BundleDeferred("~/Style/Timeline");
|
||||||
Html.BundleDeferred("~/ClientScripts/Modules/Timeline");
|
Html.BundleDeferred("~/ClientScripts/Modules/Timeline");
|
||||||
}
|
}
|
||||||
<div id="deviceBatchesTimeline" style="height: 550px;">
|
<div id="deviceBatchesTimeline" style="height: 550px;" data-url="@(Url.Action(MVC.API.DeviceBatch.Timeline()))">
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function () {
|
(function () {
|
||||||
var dataUrl = '@(Url.Action(MVC.API.DeviceBatch.Timeline()))';
|
|
||||||
var tl;
|
var tl;
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
@@ -23,7 +22,7 @@
|
|||||||
var sixMonthsDate = new Date();
|
var sixMonthsDate = new Date();
|
||||||
sixMonthsDate.setDate(currentDate.getDate());
|
sixMonthsDate.setDate(currentDate.getDate());
|
||||||
sixMonthsDate.setMonth(currentDate.getMonth() + 6);
|
sixMonthsDate.setMonth(currentDate.getMonth() + 6);
|
||||||
|
|
||||||
var hotZoneStart1 = new Date(currentDate.getFullYear(), 0, 1, 10, 0, 0);
|
var hotZoneStart1 = new Date(currentDate.getFullYear(), 0, 1, 10, 0, 0);
|
||||||
var hotZoneEnd1 = new Date(currentDate.getFullYear(), 11, 31, 10, 0, 0);
|
var hotZoneEnd1 = new Date(currentDate.getFullYear(), 11, 31, 10, 0, 0);
|
||||||
var hotZoneStart2 = new Date(currentDate.getFullYear() + 1, 0, 1, 10, 0, 0);
|
var hotZoneStart2 = new Date(currentDate.getFullYear() + 1, 0, 1, 10, 0, 0);
|
||||||
@@ -37,18 +36,18 @@
|
|||||||
var bandInfos = [
|
var bandInfos = [
|
||||||
Timeline.createHotZoneBandInfo({
|
Timeline.createHotZoneBandInfo({
|
||||||
zones: [
|
zones: [
|
||||||
{
|
{
|
||||||
start: hotZoneStart1,
|
start: hotZoneStart1,
|
||||||
end: hotZoneEnd1,
|
end: hotZoneEnd1,
|
||||||
magnify: 4,
|
magnify: 4,
|
||||||
unit: Timeline.DateTime.MONTH
|
unit: Timeline.DateTime.MONTH
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
start: hotZoneStart2,
|
start: hotZoneStart2,
|
||||||
end: hotZoneEnd2,
|
end: hotZoneEnd2,
|
||||||
magnify: 4,
|
magnify: 4,
|
||||||
unit: Timeline.DateTime.MONTH
|
unit: Timeline.DateTime.MONTH
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
eventSource: eventSource,
|
eventSource: eventSource,
|
||||||
width: "85%",
|
width: "85%",
|
||||||
@@ -106,17 +105,26 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Load Events
|
// Load Events
|
||||||
$.ajax({
|
async function loadEventsAsync() {
|
||||||
url: dataUrl,
|
try {
|
||||||
dataType: 'json',
|
const dataUrl = $('#deviceBatchesTimeline').attr('data-url');
|
||||||
type: 'POST',
|
const body = new FormData();
|
||||||
success: function (data) {
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
eventSource.loadJSON(data, dataUrl);
|
const response = await fetch(dataUrl, {
|
||||||
},
|
method: 'POST',
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
body: body
|
||||||
alert('Unable to load Timeline Data: ' + errorThrown);
|
});
|
||||||
|
if (response.ok) {
|
||||||
|
const data = await response.json();
|
||||||
|
eventSource.loadJSON(data, dataUrl);
|
||||||
|
} else {
|
||||||
|
alert('Unable to load Timeline Data: ' + response.statusText);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alert('Unable to load Timeline Data: ' + e);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
loadEventsAsync();
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
|
|||||||
#line 1 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
|
#line 1 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
|
||||||
|
|
||||||
Authorization.Require(Claims.Config.DeviceBatch.ShowTimeline);
|
Authorization.Require(Claims.Config.DeviceBatch.ShowTimeline);
|
||||||
|
|
||||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Timeline");
|
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Timeline");
|
||||||
Html.BundleDeferred("~/Style/Timeline");
|
Html.BundleDeferred("~/Style/Timeline");
|
||||||
Html.BundleDeferred("~/ClientScripts/Modules/Timeline");
|
Html.BundleDeferred("~/ClientScripts/Modules/Timeline");
|
||||||
@@ -61,74 +61,83 @@ WriteLiteral(" id=\"deviceBatchesTimeline\"");
|
|||||||
|
|
||||||
WriteLiteral(" style=\"height: 550px;\"");
|
WriteLiteral(" style=\"height: 550px;\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n</div>\r\n<script");
|
WriteLiteral(" data-url=\"");
|
||||||
|
|
||||||
WriteLiteral(" type=\"text/javascript\"");
|
|
||||||
|
|
||||||
WriteLiteral(">\r\n (function () {\r\n var dataUrl = \'");
|
|
||||||
|
|
||||||
|
|
||||||
#line 12 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
|
#line 8 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
|
||||||
Write(Url.Action(MVC.API.DeviceBatch.Timeline()));
|
Write(Url.Action(MVC.API.DeviceBatch.Timeline()));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\';\r\n var tl;\r\n\r\n $(function () {\r\n\r\n var eventSource = n" +
|
WriteLiteral("\"");
|
||||||
"ew Timeline.DefaultEventSource();\r\n\r\n var currentDate = new Date();\r\n" +
|
|
||||||
" currentDate = new Date(currentDate.getFullYear(), currentDate.getMon" +
|
WriteLiteral(">\r\n</div>\r\n<script");
|
||||||
"th(), currentDate.getDay(), 10, 0, 0);\r\n var tomorrowDate = new Date(" +
|
|
||||||
");\r\n tomorrowDate.setDate(currentDate.getDate() + 1);\r\n va" +
|
WriteLiteral(" type=\"text/javascript\"");
|
||||||
"r sixMonthsDate = new Date();\r\n sixMonthsDate.setDate(currentDate.get" +
|
|
||||||
"Date());\r\n sixMonthsDate.setMonth(currentDate.getMonth() + 6);\r\n " +
|
WriteLiteral(">\r\n (function () {\r\n var tl;\r\n\r\n $(function () {\r\n\r\n " +
|
||||||
" \r\n var hotZoneStart1 = new Date(currentDate.getFullYear(), 0, " +
|
"var eventSource = new Timeline.DefaultEventSource();\r\n\r\n var currentD" +
|
||||||
"1, 10, 0, 0);\r\n var hotZoneEnd1 = new Date(currentDate.getFullYear()," +
|
"ate = new Date();\r\n currentDate = new Date(currentDate.getFullYear()," +
|
||||||
" 11, 31, 10, 0, 0);\r\n var hotZoneStart2 = new Date(currentDate.getFul" +
|
" currentDate.getMonth(), currentDate.getDay(), 10, 0, 0);\r\n var tomor" +
|
||||||
"lYear() + 1, 0, 1, 10, 0, 0);\r\n var hotZoneEnd2 = new Date(currentDat" +
|
"rowDate = new Date();\r\n tomorrowDate.setDate(currentDate.getDate() + " +
|
||||||
"e.getFullYear() + 1, 11, 31, 10, 0, 0);\r\n //hotZoneEnd.setDate(hotZon" +
|
"1);\r\n var sixMonthsDate = new Date();\r\n sixMonthsDate.setD" +
|
||||||
"eEnd.getDate() - 1);\r\n\r\n //hotZoneStart = hotZoneStart.toLocaleDateSt" +
|
"ate(currentDate.getDate());\r\n sixMonthsDate.setMonth(currentDate.getM" +
|
||||||
"ring();\r\n //hotZoneEnd = hotZoneEnd.toLocaleDateString();\r\n\r\n\r\n " +
|
"onth() + 6);\r\n\r\n var hotZoneStart1 = new Date(currentDate.getFullYear" +
|
||||||
" var bandInfos = [\r\n Timeline.createHotZoneBandInfo({\r\n " +
|
"(), 0, 1, 10, 0, 0);\r\n var hotZoneEnd1 = new Date(currentDate.getFull" +
|
||||||
" zones: [\r\n {\r\n start: h" +
|
"Year(), 11, 31, 10, 0, 0);\r\n var hotZoneStart2 = new Date(currentDate" +
|
||||||
"otZoneStart1,\r\n end: hotZoneEnd1,\r\n " +
|
".getFullYear() + 1, 0, 1, 10, 0, 0);\r\n var hotZoneEnd2 = new Date(cur" +
|
||||||
" magnify: 4,\r\n unit: Timeline.DateTime.MONTH\r\n " +
|
"rentDate.getFullYear() + 1, 11, 31, 10, 0, 0);\r\n //hotZoneEnd.setDate" +
|
||||||
" },\r\n {\r\n start: hotZoneStart" +
|
"(hotZoneEnd.getDate() - 1);\r\n\r\n //hotZoneStart = hotZoneStart.toLocal" +
|
||||||
"2,\r\n end: hotZoneEnd2,\r\n magnify: " +
|
"eDateString();\r\n //hotZoneEnd = hotZoneEnd.toLocaleDateString();\r\n\r\n\r" +
|
||||||
"4,\r\n unit: Timeline.DateTime.MONTH\r\n }" +
|
"\n var bandInfos = [\r\n Timeline.createHotZoneBandInfo({" +
|
||||||
"\r\n ],\r\n eventSource: eventSource,\r\n " +
|
"\r\n zones: [\r\n {\r\n " +
|
||||||
" width: \"85%\",\r\n intervalUnit: Timeline.DateTime." +
|
" start: hotZoneStart1,\r\n end: hotZoneEnd1,\r\n " +
|
||||||
"YEAR,\r\n intervalPixels: 150,\r\n timeZone: 1" +
|
" magnify: 4,\r\n unit: Timeline" +
|
||||||
"0,\r\n date: sixMonthsDate\r\n }),\r\n " +
|
".DateTime.MONTH\r\n },\r\n {\r\n " +
|
||||||
" Timeline.createBandInfo({\r\n eventSource: eventSource,\r\n " +
|
" start: hotZoneStart2,\r\n end: hotZ" +
|
||||||
" width: \"15%\",\r\n intervalUnit: Timeline.DateTi" +
|
"oneEnd2,\r\n magnify: 4,\r\n u" +
|
||||||
"me.YEAR,\r\n intervalPixels: 150,\r\n overview" +
|
"nit: Timeline.DateTime.MONTH\r\n }\r\n ],\r" +
|
||||||
": true,\r\n timeZone: 10,\r\n date: sixMonthsD" +
|
"\n eventSource: eventSource,\r\n width: \"85%\"" +
|
||||||
"ate\r\n })\r\n ];\r\n bandInfos[1].syncWith = 0;\r" +
|
",\r\n intervalUnit: Timeline.DateTime.YEAR,\r\n " +
|
||||||
"\n bandInfos[1].highlight = true;\r\n\r\n for (var i = 0; i < b" +
|
" intervalPixels: 150,\r\n timeZone: 10,\r\n d" +
|
||||||
"andInfos.length; i++) {\r\n bandInfos[i].decorators = [\r\n " +
|
"ate: sixMonthsDate\r\n }),\r\n Timeline.createBandInfo" +
|
||||||
" new Timeline.SpanHighlightDecorator({\r\n startDa" +
|
"({\r\n eventSource: eventSource,\r\n width: \"1" +
|
||||||
"te: currentDate,\r\n endDate: tomorrowDate,\r\n " +
|
"5%\",\r\n intervalUnit: Timeline.DateTime.YEAR,\r\n " +
|
||||||
" color: \"#CC2222\",\r\n opacity: 50\r\n " +
|
" intervalPixels: 150,\r\n overview: true,\r\n " +
|
||||||
" }),\r\n new Timeline.SpanHighlightDecorator({\r\n " +
|
" timeZone: 10,\r\n date: sixMonthsDate\r\n })\r\n" +
|
||||||
" startDate: hotZoneStart1,\r\n endDate: hotZon" +
|
" ];\r\n bandInfos[1].syncWith = 0;\r\n bandInfos[1]" +
|
||||||
"eEnd1,\r\n color: \"#CEA5A5\",\r\n opaci" +
|
".highlight = true;\r\n\r\n for (var i = 0; i < bandInfos.length; i++) {\r\n" +
|
||||||
"ty: 50\r\n }),\r\n new Timeline.SpanHighlightD" +
|
" bandInfos[i].decorators = [\r\n new Timeline.Sp" +
|
||||||
"ecorator({\r\n startDate: hotZoneStart2,\r\n " +
|
"anHighlightDecorator({\r\n startDate: currentDate,\r\n " +
|
||||||
" endDate: hotZoneEnd2,\r\n color: \"#CCB7B7\",\r\n " +
|
" endDate: tomorrowDate,\r\n color: \"#CC2222" +
|
||||||
" opacity: 50\r\n })\r\n ];\r\n " +
|
"\",\r\n opacity: 50\r\n }),\r\n " +
|
||||||
" }\r\n\r\n tl = Timeline.create($(\'#deviceBatchesTimeline\')[0], band" +
|
" new Timeline.SpanHighlightDecorator({\r\n startDate: " +
|
||||||
"Infos);\r\n\r\n var tlResizeLayoutHandle = null;\r\n $(window).r" +
|
"hotZoneStart1,\r\n endDate: hotZoneEnd1,\r\n " +
|
||||||
"esize(function () {\r\n if (tlResizeLayoutHandle)\r\n " +
|
" color: \"#CEA5A5\",\r\n opacity: 50\r\n " +
|
||||||
" window.clearTimeout(tlResizeLayoutHandle);\r\n tlResizeLayoutHa" +
|
" }),\r\n new Timeline.SpanHighlightDecorator({\r\n " +
|
||||||
"ndle = window.setTimeout(function () {\r\n tlResizeLayoutHandle" +
|
" startDate: hotZoneStart2,\r\n endDate: hotZoneEn" +
|
||||||
" = null;\r\n tl.layout();\r\n }, 500);\r\n " +
|
"d2,\r\n color: \"#CCB7B7\",\r\n opacity:" +
|
||||||
" });\r\n\r\n // Load Events\r\n $.ajax({\r\n url: " +
|
" 50\r\n })\r\n ];\r\n }\r\n\r\n tl" +
|
||||||
"dataUrl,\r\n dataType: \'json\',\r\n type: \'POST\',\r\n " +
|
" = Timeline.create($(\'#deviceBatchesTimeline\')[0], bandInfos);\r\n\r\n va" +
|
||||||
" success: function (data) {\r\n eventSource.loadJSON" +
|
"r tlResizeLayoutHandle = null;\r\n $(window).resize(function () {\r\n " +
|
||||||
"(data, dataUrl);\r\n },\r\n error: function (jqXHR, te" +
|
" if (tlResizeLayoutHandle)\r\n window.clearTimeout(t" +
|
||||||
"xtStatus, errorThrown) {\r\n alert(\'Unable to load Timeline Dat" +
|
"lResizeLayoutHandle);\r\n tlResizeLayoutHandle = window.setTimeout(" +
|
||||||
"a: \' + errorThrown);\r\n }\r\n });\r\n });\r\n\r\n })(" +
|
"function () {\r\n tlResizeLayoutHandle = null;\r\n " +
|
||||||
");\r\n\r\n</script>\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</script>\r\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,23 +4,24 @@
|
|||||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags", MVC.Config.DeviceFlag.Index(null), "Create");
|
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags", MVC.Config.DeviceFlag.Index(null), "Create");
|
||||||
}
|
}
|
||||||
@using (Html.BeginForm())
|
@using (Html.BeginForm())
|
||||||
{
|
{
|
||||||
@Html.HiddenFor(m => m.DeviceFlag.Icon)
|
@Html.AntiForgeryToken()
|
||||||
@Html.HiddenFor(m => m.DeviceFlag.IconColour)
|
|
||||||
<div class="form" style="width: 450px">
|
<div class="form" style="width: 450px">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name:
|
<th>
|
||||||
|
Name:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.EditorFor(model => model.DeviceFlag.Name)<br />@Html.ValidationMessageFor(model => model.DeviceFlag.Name)
|
@Html.EditorFor(model => model.Name)<br />@Html.ValidationMessageFor(model => model.Name)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Description:
|
<th>
|
||||||
|
Description:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.EditorFor(model => model.DeviceFlag.Description)<br />@Html.ValidationMessageFor(model => model.DeviceFlag.Description)
|
@Html.EditorFor(model => model.Description)<br />@Html.ValidationMessageFor(model => model.Description)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -30,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
$('#DeviceFlag_Name').focus().select();
|
$('#Name').focus().select();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,35 +57,21 @@ WriteLiteral("\r\n");
|
|||||||
|
|
||||||
#line 6 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
#line 6 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
||||||
using (Html.BeginForm())
|
using (Html.BeginForm())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 8 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
#line 8 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
||||||
Write(Html.HiddenFor(m => m.DeviceFlag.Icon));
|
Write(Html.AntiForgeryToken());
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 8 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
#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
|
#line default
|
||||||
@@ -96,14 +82,14 @@ WriteLiteral(" class=\"form\"");
|
|||||||
|
|
||||||
WriteLiteral(" style=\"width: 450px\"");
|
WriteLiteral(" style=\"width: 450px\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>Name:\r\n " +
|
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n N" +
|
||||||
"</th>\r\n <td>\r\n");
|
"ame:\r\n </th>\r\n <td>\r\n");
|
||||||
|
|
||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 16 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
#line 16 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
||||||
Write(Html.EditorFor(model => model.DeviceFlag.Name));
|
Write(Html.EditorFor(model => model.Name));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -112,19 +98,20 @@ WriteLiteral("<br />");
|
|||||||
|
|
||||||
|
|
||||||
#line 16 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
#line 16 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.DeviceFlag.Name));
|
Write(Html.ValidationMessageFor(model => model.Name));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
||||||
">Description:\r\n </th>\r\n <td>\r\n");
|
">\r\n Description:\r\n </th>\r\n <td>" +
|
||||||
|
"\r\n");
|
||||||
|
|
||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 23 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
#line 24 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
||||||
Write(Html.EditorFor(model => model.DeviceFlag.Description));
|
Write(Html.EditorFor(model => model.Description));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -132,8 +119,8 @@ WriteLiteral(" ");
|
|||||||
WriteLiteral("<br />");
|
WriteLiteral("<br />");
|
||||||
|
|
||||||
|
|
||||||
#line 23 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
#line 24 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.DeviceFlag.Description));
|
Write(Html.ValidationMessageFor(model => model.Description));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -156,11 +143,11 @@ WriteLiteral(" <script");
|
|||||||
|
|
||||||
WriteLiteral(" type=\"text/javascript\"");
|
WriteLiteral(" type=\"text/javascript\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n $(function () {\r\n $(\'#DeviceFlag_Name\').focus().select();\r\n" +
|
WriteLiteral(">\r\n $(function () {\r\n $(\'#Name\').focus().select();\r\n });" +
|
||||||
" });\r\n </script>\r\n");
|
"\r\n </script>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 36 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
#line 37 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,10 +38,10 @@
|
|||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@if (canConfig)
|
@if (canConfig)
|
||||||
{@Html.EditorFor(model => model.DeviceFlag.Name)
|
{@Html.EditorFor(model => model.DeviceFlag.Name)
|
||||||
@AjaxHelpers.AjaxSave()
|
@AjaxHelpers.AjaxSave()
|
||||||
@AjaxHelpers.AjaxLoader()
|
@AjaxHelpers.AjaxLoader()
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
document.DiscoFunctions.PropertyChangeHelper(
|
document.DiscoFunctions.PropertyChangeHelper(
|
||||||
$('#DeviceFlag_Name'),
|
$('#DeviceFlag_Name'),
|
||||||
@@ -50,12 +50,12 @@
|
|||||||
'FlagName'
|
'FlagName'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@Model.DeviceFlag.Name
|
@Model.DeviceFlag.Name
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -65,9 +65,9 @@
|
|||||||
<td>
|
<td>
|
||||||
@if (canConfig)
|
@if (canConfig)
|
||||||
{@Html.EditorFor(model => model.DeviceFlag.Description)
|
{@Html.EditorFor(model => model.DeviceFlag.Description)
|
||||||
@AjaxHelpers.AjaxSave()
|
@AjaxHelpers.AjaxSave()
|
||||||
@AjaxHelpers.AjaxLoader()
|
@AjaxHelpers.AjaxLoader()
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
document.DiscoFunctions.PropertyChangeHelper(
|
document.DiscoFunctions.PropertyChangeHelper(
|
||||||
$('#DeviceFlag_Description'),
|
$('#DeviceFlag_Description'),
|
||||||
@@ -76,11 +76,11 @@
|
|||||||
'Description'
|
'Description'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<pre>
|
<pre>
|
||||||
@if (string.IsNullOrEmpty(Model.DeviceFlag.Description))
|
@if (string.IsNullOrEmpty(Model.DeviceFlag.Description))
|
||||||
{
|
{
|
||||||
<text><None></text>
|
<text><None></text>
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
@Model.DeviceFlag.Description.ToHtmlComment()
|
@Model.DeviceFlag.Description.ToHtmlComment()
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -113,6 +113,12 @@
|
|||||||
<div>
|
<div>
|
||||||
<a id="Config_DeviceFlags_Icon_Update" href="#" class="button small">Update</a>
|
<a id="Config_DeviceFlags_Icon_Update" href="#" class="button small">Update</a>
|
||||||
<div id="Config_DeviceFlags_Icon_Update_Dialog" class="dialog" title="Device Flag Icon">
|
<div id="Config_DeviceFlags_Icon_Update_Dialog" class="dialog" title="Device Flag Icon">
|
||||||
|
@using (Html.BeginForm(MVC.API.DeviceFlag.UpdateIconAndColour(id: Model.DeviceFlag.Id, redirect: true)))
|
||||||
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
|
<input type="hidden" name="icon" />
|
||||||
|
<input type="hidden" name="iconColour" />
|
||||||
|
}
|
||||||
<div>
|
<div>
|
||||||
<div class="colours">
|
<div class="colours">
|
||||||
@foreach (var colour in Model.ThemeColours)
|
@foreach (var colour in Model.ThemeColours)
|
||||||
@@ -183,15 +189,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
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);
|
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() {
|
function cancel() {
|
||||||
@@ -391,7 +393,7 @@
|
|||||||
UpdateUrl = Url.Action(MVC.API.DeviceFlag.UpdateAssignedUserLinkedGroup(Model.DeviceFlag.Id, redirect: true))
|
UpdateUrl = Url.Action(MVC.API.DeviceFlag.UpdateAssignedUserLinkedGroup(Model.DeviceFlag.Id, redirect: true))
|
||||||
})
|
})
|
||||||
@if (canConfig)
|
@if (canConfig)
|
||||||
{
|
{
|
||||||
@Html.Partial(MVC.Config.Shared.Views.LinkedGroupShared)
|
@Html.Partial(MVC.Config.Shared.Views.LinkedGroupShared)
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -442,7 +444,8 @@
|
|||||||
<div class="loading">
|
<div class="loading">
|
||||||
<h4><i class="fa fa-lg fa-cog fa-spin" title="Please Wait"></i>Loading current assignments...</h4>
|
<h4><i class="fa fa-lg fa-cog fa-spin" title="Please Wait"></i>Loading current assignments...</h4>
|
||||||
</div>
|
</div>
|
||||||
<form action="#" method="post">
|
<form action="#" method="post" data-overrideaction="@(Url.Action(MVC.API.DeviceFlag.BulkAssignDevices(Model.DeviceFlag.Id, true)))" data-addaction="@(Url.Action(MVC.API.DeviceFlag.BulkAssignDevices(Model.DeviceFlag.Id, false)))">
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
<textarea id="Config_DeviceFlags_BulkAssign_AssignDialog_DeviceSerialNumbers" name="DeviceSerialNumbers"></textarea>
|
<textarea id="Config_DeviceFlags_BulkAssign_AssignDialog_DeviceSerialNumbers" name="DeviceSerialNumbers"></textarea>
|
||||||
<h4>Comments:</h4>
|
<h4>Comments:</h4>
|
||||||
<textarea id="Config_DeviceFlags_BulkAssign_AssignDialog_Comments" name="Comments"></textarea>
|
<textarea id="Config_DeviceFlags_BulkAssign_AssignDialog_Comments" name="Comments"></textarea>
|
||||||
@@ -502,8 +505,9 @@
|
|||||||
assignDialog.dialog('option', 'buttons', buttons);
|
assignDialog.dialog('option', 'buttons', buttons);
|
||||||
assignDialog.dialog('option', 'title', 'Bulk Assign Devices: ' + mode);
|
assignDialog.dialog('option', 'title', 'Bulk Assign Devices: ' + mode);
|
||||||
|
|
||||||
|
const $form = assignDeviceSerialNumbers.closest('form');
|
||||||
if (mode == "Override") {
|
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');
|
assignDialog.addClass('loading');
|
||||||
$.getJSON('@Url.Action(MVC.API.DeviceFlag.AssignedDevices(Model.DeviceFlag.Id))', function (response, result) {
|
$.getJSON('@Url.Action(MVC.API.DeviceFlag.AssignedDevices(Model.DeviceFlag.Id))', function (response, result) {
|
||||||
@@ -523,7 +527,7 @@
|
|||||||
}
|
}
|
||||||
else // Assume Add
|
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');
|
assignDialog.dialog('open');
|
||||||
@@ -538,8 +542,12 @@
|
|||||||
}
|
}
|
||||||
@if (canDelete)
|
@if (canDelete)
|
||||||
{
|
{
|
||||||
@Html.ActionLinkButton("Delete", MVC.API.DeviceFlag.Delete(Model.DeviceFlag.Id, true), "Config_DeviceFlags_Actions_Delete_Button")
|
<button id="Config_DeviceFlags_Actions_Delete_Button" type="button" class="button">Delete</button>
|
||||||
<div id="Config_DeviceFlags_Actions_Delete_Dialog" title="Delete this Device Flag?">
|
<div id="Config_DeviceFlags_Actions_Delete_Dialog" class="dialog" title="Delete this Device Flag?">
|
||||||
|
@using (Html.BeginForm(MVC.API.DeviceFlag.Delete(Model.DeviceFlag.Id, true)))
|
||||||
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
|
}
|
||||||
<p>
|
<p>
|
||||||
<i class="fa fa-exclamation-triangle fa-lg warning"></i>
|
<i class="fa fa-exclamation-triangle fa-lg warning"></i>
|
||||||
This item will be permanently deleted and cannot be recovered.<br />
|
This item will be permanently deleted and cannot be recovered.<br />
|
||||||
@@ -555,29 +563,27 @@
|
|||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var button = $('#Config_DeviceFlags_Actions_Delete_Button');
|
let buttonDialog = null;
|
||||||
var buttonDialog = $('#Config_DeviceFlags_Actions_Delete_Dialog');
|
$('#Config_DeviceFlags_Actions_Delete_Button').on('click', function () {
|
||||||
var buttonLink = button.attr('href');
|
const $button = $(this);
|
||||||
button.attr('href', '#');
|
if (!buttonDialog) {
|
||||||
button.click(function () {
|
buttonDialog = $('#Config_DeviceFlags_Actions_Delete_Dialog').dialog({
|
||||||
buttonDialog.dialog('open');
|
resizable: false,
|
||||||
return false;
|
modal: true,
|
||||||
});
|
autoOpen: false,
|
||||||
buttonDialog.dialog({
|
buttons: {
|
||||||
resizable: false,
|
"Delete": function () {
|
||||||
modal: true,
|
$(this)
|
||||||
autoOpen: false,
|
.dialog("option", "buttons", null)
|
||||||
buttons: {
|
.find('form').trigger('submit');
|
||||||
"Delete": function () {
|
},
|
||||||
var $this = $(this);
|
Cancel: function () {
|
||||||
$this.dialog("disable");
|
$(this).dialog("close");
|
||||||
$this.dialog("option", "buttons", null);
|
}
|
||||||
window.location.href = buttonLink;
|
}
|
||||||
},
|
});
|
||||||
Cancel: function () {
|
|
||||||
$(this).dialog("close");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
buttonDialog.dialog('open');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,11 @@
|
|||||||
@model Disco.Web.Areas.Config.Models.DeviceModel.CreateModel
|
@model Disco.Web.Areas.Config.Models.DeviceModel.CreateModel
|
||||||
@{
|
@{
|
||||||
Authorization.RequireAll(Claims.Config.DeviceModel.CreateCustom, Claims.Config.DeviceModel.Configure);
|
Authorization.RequireAll(Claims.Config.DeviceModel.CreateCustom, Claims.Config.DeviceModel.Configure);
|
||||||
|
|
||||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), "Create Custom");
|
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), "Create Custom");
|
||||||
}
|
}
|
||||||
@using (Html.BeginForm())
|
@using (Html.BeginForm())
|
||||||
{
|
{
|
||||||
@Html.AntiForgeryToken()
|
@Html.AntiForgeryToken()
|
||||||
<div class="form" style="width: 450px">
|
<div class="form" style="width: 450px">
|
||||||
<table>
|
<table>
|
||||||
@@ -14,21 +14,23 @@
|
|||||||
Name / Description:
|
Name / Description:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.TextBoxFor(model => model.Description)<br />@Html.ValidationMessageFor(model => model.Description)
|
@Html.TextBoxFor(model => model.Description)<br />@Html.ValidationMessageFor(model => model.Description)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
Manufacturer:
|
Manufacturer:
|
||||||
</th>
|
</th>
|
||||||
<td>@Html.TextBoxFor(model => model.Manufacturer)<br />@Html.ValidationMessageFor(model => model.Manufacturer)
|
<td>
|
||||||
|
@Html.TextBoxFor(model => model.Manufacturer)<br />@Html.ValidationMessageFor(model => model.Manufacturer)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
Model:
|
Model:
|
||||||
</th>
|
</th>
|
||||||
<td>@Html.TextBoxFor(model => model.ManufacturerModel)<br />@Html.ValidationMessageFor(model => model.ManufacturerModel)
|
<td>
|
||||||
|
@Html.TextBoxFor(model => model.ManufacturerModel)<br />@Html.ValidationMessageFor(model => model.ManufacturerModel)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
|
|||||||
#line 2 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
#line 2 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
||||||
|
|
||||||
Authorization.RequireAll(Claims.Config.DeviceModel.CreateCustom, Claims.Config.DeviceModel.Configure);
|
Authorization.RequireAll(Claims.Config.DeviceModel.CreateCustom, Claims.Config.DeviceModel.Configure);
|
||||||
|
|
||||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), "Create Custom");
|
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), "Create Custom");
|
||||||
|
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ WriteLiteral("\r\n");
|
|||||||
|
|
||||||
#line 7 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
#line 7 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
||||||
using (Html.BeginForm())
|
using (Html.BeginForm())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -86,11 +86,11 @@ WriteLiteral(" style=\"width: 450px\"");
|
|||||||
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n N" +
|
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n N" +
|
||||||
"ame / Description:\r\n </th>\r\n <td>\r\n");
|
"ame / Description:\r\n </th>\r\n <td>\r\n");
|
||||||
|
|
||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 17 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
#line 17 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
||||||
Write(Html.TextBoxFor(model => model.Description));
|
Write(Html.TextBoxFor(model => model.Description));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -99,17 +99,19 @@ WriteLiteral("<br />");
|
|||||||
|
|
||||||
|
|
||||||
#line 17 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
#line 17 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.Description));
|
Write(Html.ValidationMessageFor(model => model.Description));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
||||||
">\r\n Manufacturer:\r\n </th>\r\n <td" +
|
">\r\n Manufacturer:\r\n </th>\r\n <td" +
|
||||||
">");
|
">\r\n");
|
||||||
|
|
||||||
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 24 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
#line 25 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
||||||
Write(Html.TextBoxFor(model => model.Manufacturer));
|
Write(Html.TextBoxFor(model => model.Manufacturer));
|
||||||
|
|
||||||
|
|
||||||
@@ -118,17 +120,19 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
|||||||
WriteLiteral("<br />");
|
WriteLiteral("<br />");
|
||||||
|
|
||||||
|
|
||||||
#line 24 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
#line 25 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.Manufacturer));
|
Write(Html.ValidationMessageFor(model => model.Manufacturer));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
||||||
">\r\n Model:\r\n </th>\r\n <td>");
|
">\r\n Model:\r\n </th>\r\n <td>\r\n");
|
||||||
|
|
||||||
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 31 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
#line 33 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
||||||
Write(Html.TextBoxFor(model => model.ManufacturerModel));
|
Write(Html.TextBoxFor(model => model.ManufacturerModel));
|
||||||
|
|
||||||
|
|
||||||
@@ -137,7 +141,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
|||||||
WriteLiteral("<br />");
|
WriteLiteral("<br />");
|
||||||
|
|
||||||
|
|
||||||
#line 31 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
#line 33 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.ManufacturerModel));
|
Write(Html.ValidationMessageFor(model => model.ManufacturerModel));
|
||||||
|
|
||||||
|
|
||||||
@@ -165,7 +169,7 @@ WriteLiteral(">\r\n $(function () {\r\n $(\'#Description\').fo
|
|||||||
" });\r\n </script>\r\n");
|
" });\r\n </script>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 44 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
#line 46 "..\..\Areas\Config\Views\DeviceModel\Create.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -274,6 +274,7 @@
|
|||||||
<hr />
|
<hr />
|
||||||
using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||||||
{
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
<input type="file" name="Image" id="Image" style="width: 220px;" />
|
<input type="file" name="Image" id="Image" style="width: 220px;" />
|
||||||
<input class="button small" type="submit" value="Upload Image" />
|
<input class="button small" type="submit" value="Upload Image" />
|
||||||
}
|
}
|
||||||
@@ -290,7 +291,7 @@
|
|||||||
{
|
{
|
||||||
<button id="DeviceModel_Decommission" class="button">Decommission All Devices</button>
|
<button id="DeviceModel_Decommission" class="button">Decommission All Devices</button>
|
||||||
<div id="DeviceModel_Decommission_Dialog" class="dialog" title="Model Device Decommission">
|
<div id="DeviceModel_Decommission_Dialog" class="dialog" title="Model Device Decommission">
|
||||||
@using (Html.BeginForm(MVC.API.Device.DeviceModelDecommission(Model.DeviceModel.Id), FormMethod.Post))
|
@using (Html.BeginForm(MVC.API.Device.DeviceModelDecommission(Model.DeviceModel.Id)))
|
||||||
{
|
{
|
||||||
@Html.AntiForgeryToken()
|
@Html.AntiForgeryToken()
|
||||||
<div class="clearfix" style="margin-bottom: 10px;">
|
<div class="clearfix" style="margin-bottom: 10px;">
|
||||||
@@ -347,7 +348,44 @@
|
|||||||
}
|
}
|
||||||
@if (Model.CanDelete)
|
@if (Model.CanDelete)
|
||||||
{
|
{
|
||||||
@Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete")
|
<button id="buttonDelete" type="button" class="button">Delete</button>
|
||||||
|
<div id="dialogConfirmDelete" class="dialog" title="Delete this Device Model?">
|
||||||
|
@using (Html.BeginForm(MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true)))
|
||||||
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
|
}
|
||||||
|
<p>
|
||||||
|
<i class="fa fa-exclamation-triangle fa-lg warning"></i>
|
||||||
|
This item will be permanently deleted and cannot be recovered. Are you sure?
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(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');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
}
|
}
|
||||||
@if (Model.DeviceCount > 0)
|
@if (Model.DeviceCount > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -936,6 +936,20 @@ WriteLiteral(" <hr />\r\n");
|
|||||||
#line 275 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 275 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 277 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
|
Write(Html.AntiForgeryToken());
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 277 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -963,7 +977,7 @@ WriteLiteral(" value=\"Upload Image\"");
|
|||||||
WriteLiteral(" />\r\n");
|
WriteLiteral(" />\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 279 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 280 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -973,7 +987,7 @@ WriteLiteral(" />\r\n");
|
|||||||
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n</div>\r\n<h2>Components</h2>\r\n");
|
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n</div>\r\n<h2>Components</h2>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 286 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 287 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
Write(Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.DeviceComponentsModel));
|
Write(Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.DeviceComponentsModel));
|
||||||
|
|
||||||
|
|
||||||
@@ -982,7 +996,7 @@ Write(Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.De
|
|||||||
WriteLiteral("\r\n");
|
WriteLiteral("\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 287 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 288 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
Write(Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model));
|
Write(Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model));
|
||||||
|
|
||||||
|
|
||||||
@@ -995,13 +1009,13 @@ WriteLiteral(" class=\"actionBar\"");
|
|||||||
WriteLiteral(">\r\n");
|
WriteLiteral(">\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 289 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 290 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 289 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 290 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
if (Model.CanDecommission)
|
if (Model.CanDecommission)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1027,28 +1041,28 @@ WriteLiteral(" title=\"Model Device Decommission\"");
|
|||||||
WriteLiteral(">\r\n");
|
WriteLiteral(">\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 293 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 294 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 293 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 294 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
using (Html.BeginForm(MVC.API.Device.DeviceModelDecommission(Model.DeviceModel.Id), FormMethod.Post))
|
using (Html.BeginForm(MVC.API.Device.DeviceModelDecommission(Model.DeviceModel.Id)))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 295 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 296 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
Write(Html.AntiForgeryToken());
|
Write(Html.AntiForgeryToken());
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 295 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 296 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1073,13 +1087,13 @@ WriteLiteral(" class=\"none\"");
|
|||||||
WriteLiteral(">\r\n");
|
WriteLiteral(">\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 301 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 302 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 301 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 302 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast<DecommissionReasons>().OrderBy(r => r.ToString()))
|
foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast<DecommissionReasons>().OrderBy(r => r.ToString()))
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1090,33 +1104,33 @@ WriteLiteral(" <li>\r\n
|
|||||||
|
|
||||||
WriteLiteral(" type=\"radio\"");
|
WriteLiteral(" type=\"radio\"");
|
||||||
|
|
||||||
WriteAttribute("id", Tuple.Create(" id=\"", 12649), Tuple.Create("\"", 12719)
|
WriteAttribute("id", Tuple.Create(" id=\"", 12682), Tuple.Create("\"", 12752)
|
||||||
, Tuple.Create(Tuple.Create("", 12654), Tuple.Create("DeviceModel_Decommission_Dialog_Reason_", 12654), true)
|
, Tuple.Create(Tuple.Create("", 12687), Tuple.Create("DeviceModel_Decommission_Dialog_Reason_", 12687), true)
|
||||||
|
|
||||||
#line 304 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 305 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 12693), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
, Tuple.Create(Tuple.Create("", 12726), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 12693), false)
|
, 12726), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral("\r\n name=\"decommissionReason\"");
|
WriteLiteral("\r\n name=\"decommissionReason\"");
|
||||||
|
|
||||||
WriteAttribute("value", Tuple.Create(" value=\"", 12786), Tuple.Create("\"", 12820)
|
WriteAttribute("value", Tuple.Create(" value=\"", 12819), Tuple.Create("\"", 12853)
|
||||||
|
|
||||||
#line 305 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 306 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 12794), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
, Tuple.Create(Tuple.Create("", 12827), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 12794), false)
|
, 12827), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 305 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 306 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
Write((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty);
|
Write((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty);
|
||||||
|
|
||||||
|
|
||||||
@@ -1124,21 +1138,21 @@ WriteLiteral(" ");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" />\r\n <label");
|
WriteLiteral(" />\r\n <label");
|
||||||
|
|
||||||
WriteAttribute("for", Tuple.Create(" for=\"", 12960), Tuple.Create("\"", 13031)
|
WriteAttribute("for", Tuple.Create(" for=\"", 12993), Tuple.Create("\"", 13064)
|
||||||
, Tuple.Create(Tuple.Create("", 12966), Tuple.Create("DeviceModel_Decommission_Dialog_Reason_", 12966), true)
|
, Tuple.Create(Tuple.Create("", 12999), Tuple.Create("DeviceModel_Decommission_Dialog_Reason_", 12999), true)
|
||||||
|
|
||||||
#line 306 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 307 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 13005), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
, Tuple.Create(Tuple.Create("", 13038), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 13005), false)
|
, 13038), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">");
|
WriteLiteral(">");
|
||||||
|
|
||||||
|
|
||||||
#line 306 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 307 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
Write(decommissionReason.ReasonMessage());
|
Write(decommissionReason.ReasonMessage());
|
||||||
|
|
||||||
|
|
||||||
@@ -1147,7 +1161,7 @@ WriteLiteral(">");
|
|||||||
WriteLiteral("</label>\r\n </li>\r\n");
|
WriteLiteral("</label>\r\n </li>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 308 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 309 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1166,7 +1180,7 @@ WriteLiteral(" />\r\n Unassign devices users\r\n
|
|||||||
"\r\n </div>\r\n");
|
"\r\n </div>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 316 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 317 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1210,7 +1224,7 @@ WriteLiteral(@">
|
|||||||
");
|
");
|
||||||
|
|
||||||
|
|
||||||
#line 347 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 348 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1219,23 +1233,104 @@ WriteLiteral(@">
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 348 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 349 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
if (Model.CanDelete)
|
if (Model.CanDelete)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral(" <button");
|
||||||
|
|
||||||
|
WriteLiteral(" id=\"buttonDelete\"");
|
||||||
|
|
||||||
|
WriteLiteral(" type=\"button\"");
|
||||||
|
|
||||||
|
WriteLiteral(" class=\"button\"");
|
||||||
|
|
||||||
|
WriteLiteral(">Delete</button>\r\n");
|
||||||
|
|
||||||
|
WriteLiteral(" <div");
|
||||||
|
|
||||||
|
WriteLiteral(" id=\"dialogConfirmDelete\"");
|
||||||
|
|
||||||
|
WriteLiteral(" class=\"dialog\"");
|
||||||
|
|
||||||
|
WriteLiteral(" title=\"Delete this Device Model?\"");
|
||||||
|
|
||||||
|
WriteLiteral(">\r\n");
|
||||||
|
|
||||||
|
|
||||||
|
#line 353 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 350 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 353 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
Write(Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete"));
|
using (Html.BeginForm(MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true)))
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 355 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
|
Write(Html.AntiForgeryToken());
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 350 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 355 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral(" <p>\r\n <i");
|
||||||
|
|
||||||
|
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg warning\"");
|
||||||
|
|
||||||
|
WriteLiteral("></i>\r\n This item will be permanently deleted and cannot be recove" +
|
||||||
|
"red. Are you sure?\r\n </p>\r\n </div>\r\n");
|
||||||
|
|
||||||
|
WriteLiteral(" <script");
|
||||||
|
|
||||||
|
WriteLiteral(" type=\"text/javascript\"");
|
||||||
|
|
||||||
|
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');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
");
|
||||||
|
|
||||||
|
|
||||||
|
#line 389 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1244,7 +1339,7 @@ WriteLiteral(" ");
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 352 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 390 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
if (Model.DeviceCount > 0)
|
if (Model.DeviceCount > 0)
|
||||||
{
|
{
|
||||||
if (Authorization.Has(Claims.Device.Actions.Export))
|
if (Authorization.Has(Claims.Device.Actions.Export))
|
||||||
@@ -1254,14 +1349,14 @@ WriteLiteral(" ");
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 356 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 394 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.DeviceExportTypes.Model, Model.DeviceModel.Id)));
|
Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.DeviceExportTypes.Model, Model.DeviceModel.Id)));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 356 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 394 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
|
|
||||||
}
|
}
|
||||||
if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
|
if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
|
||||||
@@ -1271,14 +1366,14 @@ WriteLiteral(" ");
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 360 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 398 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
Write(Html.ActionLinkButton(string.Format("View {0} Device{1}", Model.DeviceCount, (Model.DeviceCount != 1 ? "s" : null)), MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel")));
|
Write(Html.ActionLinkButton(string.Format("View {0} Device{1}", Model.DeviceCount, (Model.DeviceCount != 1 ? "s" : null)), MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel")));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 360 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
#line 398 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,15 +8,19 @@
|
|||||||
}
|
}
|
||||||
@if (canConfig)
|
@if (canConfig)
|
||||||
{
|
{
|
||||||
<table id="deviceComponents" data-devicemodelid="@(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty)">
|
<table id="deviceComponents" data-devicemodelid="@(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty)" data-addurl="@Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null))" data-updateurl="@Url.Action(MVC.API.DeviceModel.ComponentUpdate())" data-removeurl="@Url.Action(MVC.API.DeviceModel.ComponentRemove())" data-geturl="@Url.Action(MVC.API.DeviceModel.Component())" data-updatejobsubtypesurl="@Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes())">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Description
|
<th>
|
||||||
|
Description
|
||||||
</th>
|
</th>
|
||||||
<th>Cost
|
<th>
|
||||||
|
Cost
|
||||||
</th>
|
</th>
|
||||||
<th>Job Types
|
<th>
|
||||||
|
Job Types
|
||||||
</th>
|
</th>
|
||||||
<th class="actions">
|
<th class="actions">
|
||||||
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
@foreach (var item in Model.DeviceComponents)
|
@foreach (var item in Model.DeviceComponents)
|
||||||
@@ -47,183 +51,179 @@
|
|||||||
</table>
|
</table>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var $deviceComponents = $('#deviceComponents');
|
const $deviceComponents = $('#deviceComponents');
|
||||||
|
|
||||||
$('#addDeviceComponent').click(function () {
|
$('#addDeviceComponent').click(function () {
|
||||||
var dc = $('<tr><td><input type="text" class="description" /></td><td><input type="text" class="cost" /></td><td><span class="fa-stack edit"><i class="fa fa-list-alt fa-stack-2x"></i><i class="fa fa-asterisk fa-stack-1x hidden"></i></span></td><td><i class="fa fa-times-circle remove"></i></td></tr>');
|
const dc = $('<tr><td><input type="text" class="description" /></td><td><input type="text" class="cost" /></td><td><span class="fa-stack edit"><i class="fa fa-list-alt fa-stack-2x"></i><i class="fa fa-asterisk fa-stack-1x hidden"></i></span></td><td><i class="fa fa-times-circle remove"></i></td></tr>');
|
||||||
dc.find('input').focus(function () { $(this).select() })
|
|
||||||
dc.insertBefore($deviceComponents.find('tr').last());
|
dc.insertBefore($deviceComponents.find('tr').last());
|
||||||
dc.find('input.description').focus();
|
dc.find('input.description').focus();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$deviceComponents.on('change', 'input', updateComponent);
|
$deviceComponents.on('change', 'input', function () { updateComponent(this); });
|
||||||
$deviceComponents.on('focus', 'input', function () { $(this).select(); });
|
$deviceComponents.on('focus', 'input', function () { $(this).select(); });
|
||||||
|
|
||||||
$deviceComponents.on('click', '.remove', removeComponent);
|
$deviceComponents.on('click', '.remove', removeComponent);
|
||||||
$deviceComponents.on('click', '.edit', editComponentJobTypes);
|
$deviceComponents.on('click', '.edit', function () { editComponentJobTypes(this); });
|
||||||
|
|
||||||
function removeComponentConfirmed(id, row) {
|
async function removeComponentConfirmed(id, row) {
|
||||||
var data = { id: id };
|
const body = new FormData();
|
||||||
$.ajax({
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentRemove())',
|
body.append('id', id);
|
||||||
dataType: 'json',
|
|
||||||
data: data,
|
try {
|
||||||
success: function (d) {
|
const response = await fetch($deviceComponents.attr('data-removeurl'), {
|
||||||
if (d == 'OK') {
|
method: 'POST',
|
||||||
row.remove();
|
body: body
|
||||||
} else {
|
});
|
||||||
alert('Unable to remove component: ' + d);
|
|
||||||
}
|
if (response.ok) {
|
||||||
},
|
row.remove();
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
} else {
|
||||||
alert('Unable to remove component: ' + textStatus);
|
alert('Unable to remove component: ' + response.statusText);
|
||||||
}
|
}
|
||||||
});
|
} catch (e) {
|
||||||
}
|
alert('Unable to remove component: ' + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
function removeComponent() {
|
function removeComponent() {
|
||||||
var componentRow = $(this).closest('tr');
|
const componentRow = $(this).closest('tr');
|
||||||
var id = componentRow.attr('data-devicecomponentid');
|
const id = componentRow.attr('data-devicecomponentid');
|
||||||
if (id) {
|
if (id) {
|
||||||
var dialog = $("#dialogConfirmRemove");
|
const dialog = $("#dialogConfirmRemove");
|
||||||
var buttons = dialog.dialog("option", "buttons");
|
const buttons = dialog.dialog("option", "buttons");
|
||||||
buttons['Remove'] = function () { removeComponentConfirmed(id, componentRow); $(this).dialog("close"); };
|
buttons['Remove'] = function () { removeComponentConfirmed(id, componentRow); $(this).dialog("close"); };
|
||||||
var buttons = dialog.dialog("option", "buttons", buttons);
|
dialog.dialog("option", "buttons", buttons);
|
||||||
dialog.dialog('open');
|
dialog.dialog('open');
|
||||||
} else {
|
} else {
|
||||||
// New - Remove
|
// New - Remove
|
||||||
componentRow.remove();
|
componentRow.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function updateComponent() {
|
async function updateComponent(input) {
|
||||||
var componentRow = $(this).closest('tr');
|
const componentRow = $(input).closest('tr');
|
||||||
componentRow.find('input').attr('disabled', true).addClass('updating');
|
componentRow.find('input').attr('disabled', true).addClass('updating');
|
||||||
|
|
||||||
var id = componentRow.attr('data-devicecomponentid');
|
const id = componentRow.attr('data-devicecomponentid');
|
||||||
if (id) {
|
if (id) {
|
||||||
// Update
|
// Update
|
||||||
var data = {
|
const body = new FormData();
|
||||||
id: id,
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
Description: componentRow.find('input.description').val(),
|
body.append('id', id);
|
||||||
Cost: componentRow.find('input.cost').val()
|
body.append('description', componentRow.find('input.description').val());
|
||||||
};
|
body.append('cost', componentRow.find('input.cost').val());
|
||||||
$.ajax({
|
|
||||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdate())',
|
try {
|
||||||
dataType: 'json',
|
const response = await fetch($deviceComponents.attr('data-updateurl'), {
|
||||||
type: 'POST',
|
method: 'POST',
|
||||||
data: data,
|
body: body
|
||||||
success: function (d) {
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
const result = await response.json();
|
||||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||||
if (d.Result == 'OK') {
|
componentRow.find('input.description').val(result.Description);
|
||||||
componentRow.find('input.description').val(d.Component.Description);
|
componentRow.find('input.cost').val(result.Cost);
|
||||||
componentRow.find('input.cost').val(d.Component.Cost);
|
} else {
|
||||||
} else {
|
alert('Unable to update component: ' + response.statusText);
|
||||||
alert('Unable to update component: ' + d.Result);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
|
||||||
alert('Unable to update component: ' + textStatus);
|
|
||||||
}
|
}
|
||||||
});
|
} catch (e) {
|
||||||
|
alert('Unable to update component: ' + e);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Add
|
// Add
|
||||||
id = componentRow.closest('table').attr('data-devicemodelid');
|
const modelId = componentRow.closest('table').attr('data-devicemodelid');
|
||||||
var data = {
|
const body = new FormData();
|
||||||
id: id,
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
Description: componentRow.find('input.description').val(),
|
body.append('id', modelId);
|
||||||
Cost: componentRow.find('input.cost').val()
|
body.append('description', componentRow.find('input.description').val());
|
||||||
};
|
body.append('cost', componentRow.find('input.cost').val());
|
||||||
$.ajax({
|
|
||||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null))',
|
try {
|
||||||
dataType: 'json',
|
const response = await fetch($deviceComponents.attr('data-addurl'), {
|
||||||
type: 'POST',
|
method: 'POST',
|
||||||
data: data,
|
body: body
|
||||||
success: function (d) {
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
const result = await response.json();
|
||||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||||
if (d.Result == 'OK') {
|
componentRow.attr('data-devicecomponentid', result.Id);
|
||||||
componentRow.attr('data-devicecomponentid', d.Component.Id);
|
componentRow.find('input.description').val(result.Description);
|
||||||
componentRow.find('input.description').val(d.Component.Description);
|
componentRow.find('input.cost').val(result.Cost);
|
||||||
componentRow.find('input.cost').val(d.Component.Cost);
|
} else {
|
||||||
} else {
|
alert('Unable to add component: ' + response.statusText);
|
||||||
alert('Unable to add component: ' + d.Result);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
|
||||||
alert('Unable to add component: ' + textStatus);
|
|
||||||
}
|
}
|
||||||
});
|
} catch (e) {
|
||||||
|
alert('Unable to add component: ' + e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function editComponentJobTypes() {
|
async function editComponentJobTypes(input) {
|
||||||
var edit$this = $(this);
|
const edit$this = $(input);
|
||||||
var componentRow = edit$this.closest('tr');
|
const componentRow = edit$this.closest('tr');
|
||||||
|
const id = componentRow.attr('data-devicecomponentid');
|
||||||
var id = componentRow.attr('data-devicecomponentid');
|
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
var data = {
|
try {
|
||||||
id: id
|
const body = new FormData();
|
||||||
};
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
$.ajax({
|
body.append('id', id);
|
||||||
url: '@Url.Action(MVC.API.DeviceModel.Component())',
|
const getResponse = await fetch($deviceComponents.attr('data-geturl'), {
|
||||||
dataType: 'json',
|
method: 'POST',
|
||||||
data: data,
|
body: body
|
||||||
success: function (d) {
|
})
|
||||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
|
||||||
if (d.Result == 'OK') {
|
|
||||||
$dialogUpdateJobTypes = $('#dialogUpdateJobTypes');
|
|
||||||
$dialogUpdateJobTypes.find('input:checked').each(function () { $(this).prop('checked', false) });
|
|
||||||
for (var i = 0; i < d.Component.JobSubTypes.length; i++) {
|
|
||||||
var sjt = d.Component.JobSubTypes[i];
|
|
||||||
$dialogUpdateJobTypes.find('#SubTypes_' + sjt).prop('checked', true);
|
|
||||||
}
|
|
||||||
$('#CheckboxBulkSelect_dialogUpdateJobTypes').checkboxBulkSelect('update');
|
|
||||||
var buttons = $dialogUpdateJobTypes.dialog("option", "buttons");
|
|
||||||
buttons['Save'] = function () {
|
|
||||||
$dialogUpdateJobTypes.dialog("disable");
|
|
||||||
var selectedSJTs = [];
|
|
||||||
$dialogUpdateJobTypes.find('input:checked').each(function () { selectedSJTs.push($(this).val()) });
|
|
||||||
|
|
||||||
var data = {
|
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
||||||
id: id,
|
if (getResponse.ok) {
|
||||||
JobSubTypes: selectedSJTs
|
const component = await getResponse.json();
|
||||||
};
|
$dialogUpdateJobTypes = $('#dialogUpdateJobTypes');
|
||||||
$.ajax({
|
$dialogUpdateJobTypes.find('input:checked').each(function () { $(this).prop('checked', false) });
|
||||||
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes())',
|
for (var i = 0; i < component.JobSubTypes.length; i++) {
|
||||||
dataType: 'json',
|
var sjt = component.JobSubTypes[i];
|
||||||
type: 'POST',
|
$dialogUpdateJobTypes.find('#SubTypes_' + sjt).prop('checked', true);
|
||||||
traditional: true,
|
|
||||||
data: data,
|
|
||||||
success: function (d) {
|
|
||||||
if (d.Result == 'OK') {
|
|
||||||
if (d.Component.JobSubTypes.length > 0) {
|
|
||||||
edit$this.find('.fa-asterisk').removeClass('hidden');
|
|
||||||
} else {
|
|
||||||
edit$this.find('.fa-asterisk').addClass('hidden');
|
|
||||||
}
|
|
||||||
$dialogUpdateJobTypes.dialog("enable");
|
|
||||||
$dialogUpdateJobTypes.dialog("close");
|
|
||||||
} else {
|
|
||||||
alert('Unable to update component sub types: ' + d.Result);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
|
||||||
alert('Unable to update component sub types: ' + textStatus);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var buttons = $dialogUpdateJobTypes.dialog("option", "buttons", buttons);
|
|
||||||
$dialogUpdateJobTypes.dialog('open');
|
|
||||||
} else {
|
|
||||||
alert('Unable to load component: ' + d.Result);
|
|
||||||
}
|
}
|
||||||
},
|
$('#CheckboxBulkSelect_dialogUpdateJobTypes').checkboxBulkSelect('update');
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
const buttons = $dialogUpdateJobTypes.dialog("option", "buttons");
|
||||||
alert('Unable to load component: ' + textStatus);
|
buttons['Save'] = function () {
|
||||||
}
|
async function saveAsync() {
|
||||||
});
|
const body = new FormData();
|
||||||
}
|
let jobSubTypeCount = 0;
|
||||||
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
|
body.append('id', id);
|
||||||
|
$dialogUpdateJobTypes.find('input:checked').each(function () { body.append('jobSubTypes', $(this).val()); jobSubTypeCount++; });
|
||||||
|
|
||||||
|
try {
|
||||||
|
const updateResponse = await fetch($deviceComponents.attr('data-updatejobsubtypesurl'), {
|
||||||
|
method: 'POST',
|
||||||
|
body: body
|
||||||
|
})
|
||||||
|
|
||||||
|
if (updateResponse.ok) {
|
||||||
|
if (jobSubTypeCount > 0) {
|
||||||
|
edit$this.find('.fa-asterisk').removeClass('hidden');
|
||||||
|
} else {
|
||||||
|
edit$this.find('.fa-asterisk').addClass('hidden');
|
||||||
|
}
|
||||||
|
$dialogUpdateJobTypes.dialog("close");
|
||||||
|
} else {
|
||||||
|
alert('Unable to update component sub types: ' + updateResponse.statusText);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alert('Unable to update component sub types: ' + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
saveAsync();
|
||||||
|
};
|
||||||
|
$dialogUpdateJobTypes.dialog("option", "buttons", buttons);
|
||||||
|
$dialogUpdateJobTypes.dialog('open');
|
||||||
|
} else {
|
||||||
|
alert('Unable to load component: ' + getResponse.statusText);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alert('Unable to load component: ' + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#dialogConfirmRemove").dialog({
|
$("#dialogConfirmRemove").dialog({
|
||||||
@@ -278,11 +278,14 @@ else
|
|||||||
{
|
{
|
||||||
<table id="deviceComponents" data-devicemodelid="@(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty)">
|
<table id="deviceComponents" data-devicemodelid="@(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty)">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Description
|
<th>
|
||||||
|
Description
|
||||||
</th>
|
</th>
|
||||||
<th>Cost
|
<th>
|
||||||
|
Cost
|
||||||
</th>
|
</th>
|
||||||
<th>Job Types
|
<th>
|
||||||
|
Job Types
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
@foreach (var item in Model.DeviceComponents)
|
@foreach (var item in Model.DeviceComponents)
|
||||||
|
|||||||
@@ -80,22 +80,77 @@ WriteLiteral(" data-devicemodelid=\"");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\"");
|
WriteLiteral("\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n <tr>\r\n <th>Description\r\n </th>\r\n <th>" +
|
WriteLiteral(" data-addurl=\"");
|
||||||
"Cost\r\n </th>\r\n <th>Job Types\r\n </th>\r\n " +
|
|
||||||
" <th");
|
|
||||||
|
#line 11 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
|
Write(Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null)));
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral("\"");
|
||||||
|
|
||||||
|
WriteLiteral(" data-updateurl=\"");
|
||||||
|
|
||||||
|
|
||||||
|
#line 11 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
|
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdate()));
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral("\"");
|
||||||
|
|
||||||
|
WriteLiteral(" data-removeurl=\"");
|
||||||
|
|
||||||
|
|
||||||
|
#line 11 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
|
Write(Url.Action(MVC.API.DeviceModel.ComponentRemove()));
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral("\"");
|
||||||
|
|
||||||
|
WriteLiteral(" data-geturl=\"");
|
||||||
|
|
||||||
|
|
||||||
|
#line 11 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
|
Write(Url.Action(MVC.API.DeviceModel.Component()));
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral("\"");
|
||||||
|
|
||||||
|
WriteLiteral(" data-updatejobsubtypesurl=\"");
|
||||||
|
|
||||||
|
|
||||||
|
#line 11 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
|
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes()));
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral("\"");
|
||||||
|
|
||||||
|
WriteLiteral(">\r\n <tr>\r\n <th>\r\n Description\r\n </th>" +
|
||||||
|
"\r\n <th>\r\n Cost\r\n </th>\r\n <th>\r\n " +
|
||||||
|
" Job Types\r\n </th>\r\n <th");
|
||||||
|
|
||||||
WriteLiteral(" class=\"actions\"");
|
WriteLiteral(" class=\"actions\"");
|
||||||
|
|
||||||
WriteLiteral("> \r\n </th>\r\n </tr>\r\n");
|
WriteLiteral(">\r\n \r\n </th>\r\n </tr>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 22 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 26 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 22 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 26 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
foreach (var item in Model.DeviceComponents)
|
foreach (var item in Model.DeviceComponents)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -107,7 +162,7 @@ WriteLiteral(" <tr");
|
|||||||
WriteLiteral(" data-devicecomponentid=\"");
|
WriteLiteral(" data-devicecomponentid=\"");
|
||||||
|
|
||||||
|
|
||||||
#line 24 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 28 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
Write(item.Id);
|
Write(item.Id);
|
||||||
|
|
||||||
|
|
||||||
@@ -121,14 +176,14 @@ WriteLiteral(" type=\"text\"");
|
|||||||
|
|
||||||
WriteLiteral(" class=\"description\"");
|
WriteLiteral(" class=\"description\"");
|
||||||
|
|
||||||
WriteAttribute("value", Tuple.Create(" value=\"", 883), Tuple.Create("\"", 908)
|
WriteAttribute("value", Tuple.Create(" value=\"", 1318), Tuple.Create("\"", 1343)
|
||||||
|
|
||||||
#line 26 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 30 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 891), Tuple.Create<System.Object, System.Int32>(item.Description
|
, Tuple.Create(Tuple.Create("", 1326), Tuple.Create<System.Object, System.Int32>(item.Description
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 891), false)
|
, 1326), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <input");
|
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <input");
|
||||||
@@ -137,14 +192,14 @@ WriteLiteral(" type=\"text\"");
|
|||||||
|
|
||||||
WriteLiteral(" class=\"cost\"");
|
WriteLiteral(" class=\"cost\"");
|
||||||
|
|
||||||
WriteAttribute("value", Tuple.Create(" value=\"", 1010), Tuple.Create("\"", 1042)
|
WriteAttribute("value", Tuple.Create(" value=\"", 1445), Tuple.Create("\"", 1477)
|
||||||
|
|
||||||
#line 29 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 33 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 1018), Tuple.Create<System.Object, System.Int32>(item.Cost.ToString("C")
|
, Tuple.Create(Tuple.Create("", 1453), Tuple.Create<System.Object, System.Int32>(item.Cost.ToString("C")
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 1018), false)
|
, 1453), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <span");
|
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <span");
|
||||||
@@ -157,17 +212,17 @@ WriteLiteral(" class=\"fa fa-list-alt fa-stack-2x\"");
|
|||||||
|
|
||||||
WriteLiteral("></i>\r\n <i");
|
WriteLiteral("></i>\r\n <i");
|
||||||
|
|
||||||
WriteAttribute("class", Tuple.Create(" class=\"", 1237), Tuple.Create("\"", 1328)
|
WriteAttribute("class", Tuple.Create(" class=\"", 1672), Tuple.Create("\"", 1763)
|
||||||
, Tuple.Create(Tuple.Create("", 1245), Tuple.Create("fa", 1245), true)
|
, Tuple.Create(Tuple.Create("", 1680), Tuple.Create("fa", 1680), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 1247), Tuple.Create("fa-asterisk", 1248), true)
|
, Tuple.Create(Tuple.Create(" ", 1682), Tuple.Create("fa-asterisk", 1683), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 1259), Tuple.Create("fa-stack-1x", 1260), true)
|
, Tuple.Create(Tuple.Create(" ", 1694), Tuple.Create("fa-stack-1x", 1695), true)
|
||||||
|
|
||||||
#line 34 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 38 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 1271), Tuple.Create<System.Object, System.Int32>(item.JobSubTypes.Count == 0 ? " hidden" : string.Empty
|
, Tuple.Create(Tuple.Create("", 1706), Tuple.Create<System.Object, System.Int32>(item.JobSubTypes.Count == 0 ? " hidden" : string.Empty
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 1271), false)
|
, 1706), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral("></i>\r\n </span>\r\n </td>\r\n <td>\r\n" +
|
WriteLiteral("></i>\r\n </span>\r\n </td>\r\n <td>\r\n" +
|
||||||
@@ -178,7 +233,7 @@ WriteLiteral(" class=\"fa fa-times-circle remove\"");
|
|||||||
WriteLiteral("></i>\r\n </td>\r\n </tr>\r\n");
|
WriteLiteral("></i>\r\n </td>\r\n </tr>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 41 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 45 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -200,213 +255,142 @@ WriteLiteral(" <script");
|
|||||||
|
|
||||||
WriteLiteral(" type=\"text/javascript\"");
|
WriteLiteral(" type=\"text/javascript\"");
|
||||||
|
|
||||||
WriteLiteral(@">
|
WriteLiteral(">\r\n $(function () {\r\n const $deviceComponents = $(\'#deviceCompo" +
|
||||||
$(function () {
|
"nents\');\r\n\r\n $(\'#addDeviceComponent\').click(function () {\r\n " +
|
||||||
var $deviceComponents = $('#deviceComponents');
|
" const dc = $(\'<tr><td><input type=\"text\" class=\"description\" /></td><td><i" +
|
||||||
|
"nput type=\"text\" class=\"cost\" /></td><td><span class=\"fa-stack edit\"><i class=\"f" +
|
||||||
$('#addDeviceComponent').click(function () {
|
"a fa-list-alt fa-stack-2x\"></i><i class=\"fa fa-asterisk fa-stack-1x hidden\"></i>" +
|
||||||
var dc = $('<tr><td><input type=""text"" class=""description"" /></td><td><input type=""text"" class=""cost"" /></td><td><span class=""fa-stack edit""><i class=""fa fa-list-alt fa-stack-2x""></i><i class=""fa fa-asterisk fa-stack-1x hidden""></i></span></td><td><i class=""fa fa-times-circle remove""></i></td></tr>');
|
"</span></td><td><i class=\"fa fa-times-circle remove\"></i></td></tr>\');\r\n " +
|
||||||
dc.find('input').focus(function () { $(this).select() })
|
" dc.insertBefore($deviceComponents.find(\'tr\').last());\r\n d" +
|
||||||
dc.insertBefore($deviceComponents.find('tr').last());
|
"c.find(\'input.description\').focus();\r\n return false;\r\n " +
|
||||||
dc.find('input.description').focus();
|
" });\r\n\r\n $deviceComponents.on(\'change\', \'input\', function () { update" +
|
||||||
return false;
|
"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" +
|
||||||
$deviceComponents.on('change', 'input', updateComponent);
|
"ion () { editComponentJobTypes(this); });\r\n\r\n async function removeCo" +
|
||||||
$deviceComponents.on('focus', 'input', function () { $(this).select(); });
|
"mponentConfirmed(id, row) {\r\n const body = new FormData();\r\n " +
|
||||||
|
" body.append(\'__RequestVerificationToken\', document.body.dataset.antif" +
|
||||||
$deviceComponents.on('click', '.remove', removeComponent);
|
"orgery);\r\n body.append(\'id\', id);\r\n\r\n try {\r\n " +
|
||||||
$deviceComponents.on('click', '.edit', editComponentJobTypes);
|
" const response = await fetch($deviceComponents.attr(\'data-removeu" +
|
||||||
|
"rl\'), {\r\n method: \'POST\',\r\n body: " +
|
||||||
function removeComponentConfirmed(id, row) {
|
"body\r\n });\r\n\r\n if (response.ok) {\r\n " +
|
||||||
var data = { id: id };
|
" row.remove();\r\n } else {\r\n " +
|
||||||
$.ajax({
|
" alert(\'Unable to remove component: \' + response.statusText);\r\n " +
|
||||||
url: '");
|
" }\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\')" +
|
||||||
#line 69 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
";\r\n const id = componentRow.attr(\'data-devicecomponentid\');\r\n " +
|
||||||
Write(Url.Action(MVC.API.DeviceModel.ComponentRemove()));
|
" if (id) {\r\n const dialog = $(\"#dialogConfirmRemov" +
|
||||||
|
"e\");\r\n const buttons = dialog.dialog(\"option\", \"buttons\");\r\n " +
|
||||||
|
" buttons[\'Remove\'] = function () { removeComponentConfirmed(id" +
|
||||||
#line default
|
", componentRow); $(this).dialog(\"close\"); };\r\n dialog.dialog(" +
|
||||||
#line hidden
|
"\"option\", \"buttons\", buttons);\r\n dialog.dialog(\'open\');\r\n " +
|
||||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: data,\r\n " +
|
" } else {\r\n // New - Remove\r\n c" +
|
||||||
" success: function (d) {\r\n if (d == \'OK\') {" +
|
"omponentRow.remove();\r\n }\r\n }\r\n async funct" +
|
||||||
"\r\n row.remove();\r\n } else {\r\n " +
|
"ion updateComponent(input) {\r\n const componentRow = $(input).clos" +
|
||||||
" alert(\'Unable to remove component: \' + d);\r\n " +
|
"est(\'tr\');\r\n componentRow.find(\'input\').attr(\'disabled\', true).ad" +
|
||||||
" }\r\n },\r\n error: function (j" +
|
"dClass(\'updating\');\r\n\r\n const id = componentRow.attr(\'data-device" +
|
||||||
"qXHR, textStatus, errorThrown) {\r\n alert(\'Unable to remov" +
|
"componentid\');\r\n if (id) {\r\n // Update\r\n " +
|
||||||
"e component: \' + textStatus);\r\n }\r\n });\r\n " +
|
" const body = new FormData();\r\n body.append(\'__R" +
|
||||||
" }\r\n function removeComponent() {\r\n var componentRow" +
|
"equestVerificationToken\', document.body.dataset.antiforgery);\r\n " +
|
||||||
" = $(this).closest(\'tr\');\r\n var id = componentRow.attr(\'data-devi" +
|
" body.append(\'id\', id);\r\n body.append(\'description\', compon" +
|
||||||
"cecomponentid\');\r\n if (id) {\r\n var dialog = $(" +
|
"entRow.find(\'input.description\').val());\r\n body.append(\'cost\'" +
|
||||||
"\"#dialogConfirmRemove\");\r\n var buttons = dialog.dialog(\"optio" +
|
", componentRow.find(\'input.cost\').val());\r\n\r\n try {\r\n " +
|
||||||
"n\", \"buttons\");\r\n buttons[\'Remove\'] = function () { removeCom" +
|
" const response = await fetch($deviceComponents.attr(\'data-update" +
|
||||||
"ponentConfirmed(id, componentRow); $(this).dialog(\"close\"); };\r\n " +
|
"url\'), {\r\n method: \'POST\',\r\n " +
|
||||||
" var buttons = dialog.dialog(\"option\", \"buttons\", buttons);\r\n " +
|
" body: body\r\n });\r\n\r\n if (respon" +
|
||||||
" dialog.dialog(\'open\');\r\n } else {\r\n // New" +
|
"se.ok) {\r\n const result = await response.json();\r\n " +
|
||||||
" - Remove\r\n componentRow.remove();\r\n }\r\n " +
|
" componentRow.find(\'input\').attr(\'disabled\', false).remo" +
|
||||||
" }\r\n function updateComponent() {\r\n var component" +
|
"veClass(\'updating\');\r\n componentRow.find(\'input.descr" +
|
||||||
"Row = $(this).closest(\'tr\');\r\n componentRow.find(\'input\').attr(\'d" +
|
"iption\').val(result.Description);\r\n componentRow.find" +
|
||||||
"isabled\', true).addClass(\'updating\');\r\n\r\n var id = componentRow.a" +
|
"(\'input.cost\').val(result.Cost);\r\n } else {\r\n " +
|
||||||
"ttr(\'data-devicecomponentid\');\r\n if (id) {\r\n /" +
|
" alert(\'Unable to update component: \' + response.statusText);\r\n " +
|
||||||
"/ Update\r\n var data = {\r\n id: id,\r\n " +
|
" }\r\n } catch (e) {\r\n " +
|
||||||
" Description: componentRow.find(\'input.description\').val(),\r" +
|
" alert(\'Unable to update component: \' + e);\r\n }\r\n " +
|
||||||
"\n Cost: componentRow.find(\'input.cost\').val()\r\n " +
|
" } else {\r\n // Add\r\n const modelId =" +
|
||||||
" };\r\n $.ajax({\r\n url: \'");
|
" 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" +
|
||||||
#line 111 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
"(\'id\', modelId);\r\n body.append(\'description\', componentRow.fi" +
|
||||||
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdate()));
|
"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 " +
|
||||||
#line default
|
" method: \'POST\',\r\n body: bod" +
|
||||||
#line hidden
|
"y\r\n });\r\n\r\n if (response.ok) {\r\n " +
|
||||||
WriteLiteral(@"',
|
" const result = await response.json();\r\n " +
|
||||||
dataType: 'json',
|
" componentRow.find(\'input\').attr(\'disabled\', false).removeClass(\'upd" +
|
||||||
type: 'POST',
|
"ating\');\r\n componentRow.attr(\'data-devicecomponentid\'" +
|
||||||
data: data,
|
", result.Id);\r\n componentRow.find(\'input.description\'" +
|
||||||
success: function (d) {
|
").val(result.Description);\r\n componentRow.find(\'input" +
|
||||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
".cost\').val(result.Cost);\r\n } else {\r\n " +
|
||||||
if (d.Result == 'OK') {
|
" alert(\'Unable to add component: \' + response.statusText);\r\n " +
|
||||||
componentRow.find('input.description').val(d.Component.Description);
|
" }\r\n } catch (e) {\r\n alert(" +
|
||||||
componentRow.find('input.cost').val(d.Component.Cost);
|
"\'Unable to add component: \' + e);\r\n }\r\n }\r\n " +
|
||||||
} else {
|
" }\r\n async function editComponentJobTypes(input) {\r\n " +
|
||||||
alert('Unable to update component: ' + d.Result);
|
" 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 " +
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
" const body = new FormData();\r\n body.append(\'_" +
|
||||||
alert('Unable to update component: ' + textStatus);
|
"_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" +
|
||||||
} else {
|
"ethod: \'POST\',\r\n body: body\r\n " +
|
||||||
// Add
|
"})\r\n\r\n componentRow.find(\'input\').attr(\'disabled\', false)" +
|
||||||
id = componentRow.closest('table').attr('data-devicemodelid');
|
".removeClass(\'updating\');\r\n if (getResponse.ok) {\r\n " +
|
||||||
var data = {
|
" const component = await getResponse.json();\r\n " +
|
||||||
id: id,
|
" $dialogUpdateJobTypes = $(\'#dialogUpdateJobTypes\');\r\n " +
|
||||||
Description: componentRow.find('input.description').val(),
|
" $dialogUpdateJobTypes.find(\'input:checked\').each(function () { $" +
|
||||||
Cost: componentRow.find('input.cost').val()
|
"(this).prop(\'checked\', false) });\r\n for (var i = 0; i" +
|
||||||
};
|
" < component.JobSubTypes.length; i++) {\r\n var sjt" +
|
||||||
$.ajax({
|
" = component.JobSubTypes[i];\r\n $dialogUpdateJobTy" +
|
||||||
url: '");
|
"pes.find(\'#SubTypes_\' + sjt).prop(\'checked\', true);\r\n " +
|
||||||
|
" }\r\n $(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').ch" +
|
||||||
|
"eckboxBulkSelect(\'update\');\r\n const buttons = $dialog" +
|
||||||
#line 137 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
"UpdateJobTypes.dialog(\"option\", \"buttons\");\r\n buttons" +
|
||||||
Write(Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null)));
|
"[\'Save\'] = function () {\r\n async function saveAsy" +
|
||||||
|
"nc() {\r\n const body = new FormData();\r\n " +
|
||||||
|
" let jobSubTypeCount = 0;\r\n " +
|
||||||
#line default
|
" body.append(\'__RequestVerificationToken\', document.body.dataset.anti" +
|
||||||
#line hidden
|
"forgery);\r\n body.append(\'id\', id);\r\n " +
|
||||||
WriteLiteral(@"',
|
" $dialogUpdateJobTypes.find(\'input:checked\').each(func" +
|
||||||
dataType: 'json',
|
"tion () { body.append(\'jobSubTypes\', $(this).val()); jobSubTypeCount++; });\r\n\r\n " +
|
||||||
type: 'POST',
|
" try {\r\n " +
|
||||||
data: data,
|
" const updateResponse = await fetch($deviceComponents.attr(\'data-updatejobsubty" +
|
||||||
success: function (d) {
|
"pesurl\'), {\r\n method: \'POST\',\r\n " +
|
||||||
componentRow.find('input').attr('disabled', false).removeClass('updating');
|
" body: body\r\n " +
|
||||||
if (d.Result == 'OK') {
|
" })\r\n\r\n if (updateResponse.ok) {" +
|
||||||
componentRow.attr('data-devicecomponentid', d.Component.Id);
|
"\r\n if (jobSubTypeCount > 0) {\r\n " +
|
||||||
componentRow.find('input.description').val(d.Component.Description);
|
" edit$this.find(\'.fa-asterisk\').removeC" +
|
||||||
componentRow.find('input.cost').val(d.Component.Cost);
|
"lass(\'hidden\');\r\n } else {\r\n " +
|
||||||
} else {
|
" edit$this.find(\'.fa-asterisk\').addClass(\'" +
|
||||||
alert('Unable to add component: ' + d.Result);
|
"hidden\');\r\n }\r\n " +
|
||||||
}
|
" $dialogUpdateJobTypes.dialog(\"close\");\r\n " +
|
||||||
},
|
" } else {\r\n aler" +
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
"t(\'Unable to update component sub types: \' + updateResponse.statusText);\r\n " +
|
||||||
alert('Unable to add component: ' + textStatus);
|
" }\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\"," +
|
||||||
function editComponentJobTypes() {
|
" \"buttons\", buttons);\r\n $dialogUpdateJobTypes.dialog(" +
|
||||||
var edit$this = $(this);
|
"\'open\');\r\n } else {\r\n alert(\'U" +
|
||||||
var componentRow = edit$this.closest('tr');
|
"nable to load component: \' + getResponse.statusText);\r\n }" +
|
||||||
|
"\r\n } catch (e) {\r\n alert(\'Unable to lo" +
|
||||||
var id = componentRow.attr('data-devicecomponentid');
|
"ad component: \' + e);\r\n }\r\n }\r\n }\r\n" +
|
||||||
|
"\r\n $(\"#dialogConfirmRemove\").dialog({\r\n resizable: fal" +
|
||||||
if (id) {
|
"se,\r\n height: 140,\r\n modal: true,\r\n " +
|
||||||
var data = {
|
" autoOpen: false,\r\n buttons: {\r\n \"Remove\": fun" +
|
||||||
id: id
|
"ction () {\r\n $(this).dialog(\"close\");\r\n " +
|
||||||
};
|
" },\r\n Cancel: function () {\r\n $(this)" +
|
||||||
$.ajax({
|
".dialog(\"close\");\r\n }\r\n }\r\n });\r\n\r\n" +
|
||||||
url: '");
|
" $(\'#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" +
|
||||||
#line 168 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
"n () {\r\n $(this).dialog(\"close\");\r\n }," +
|
||||||
Write(Url.Action(MVC.API.DeviceModel.Component()));
|
"\r\n Cancel: function () {\r\n $(this).dia" +
|
||||||
|
"log(\"close\");\r\n }\r\n }\r\n });\r\n\r\n " +
|
||||||
|
" $(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').checkboxBulkSelect({ paren" +
|
||||||
#line default
|
"tSelector: \'div\' });\r\n });\r\n </script>\r\n");
|
||||||
#line hidden
|
|
||||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: data" +
|
|
||||||
",\r\n success: function (d) {\r\n " +
|
|
||||||
"componentRow.find(\'input\').attr(\'disabled\', false).removeClass(\'updating\');\r\n " +
|
|
||||||
" if (d.Result == \'OK\') {\r\n " +
|
|
||||||
" $dialogUpdateJobTypes = $(\'#dialogUpdateJobTypes\');\r\n " +
|
|
||||||
" $dialogUpdateJobTypes.find(\'input:checked\').each(function () { $(this).pr" +
|
|
||||||
"op(\'checked\', false) });\r\n for (var i = 0; i < d." +
|
|
||||||
"Component.JobSubTypes.length; i++) {\r\n var sj" +
|
|
||||||
"t = d.Component.JobSubTypes[i];\r\n $dialogUpda" +
|
|
||||||
"teJobTypes.find(\'#SubTypes_\' + sjt).prop(\'checked\', true);\r\n " +
|
|
||||||
" }\r\n $(\'#CheckboxBulkSelect_dialogUpda" +
|
|
||||||
"teJobTypes\').checkboxBulkSelect(\'update\');\r\n var " +
|
|
||||||
"buttons = $dialogUpdateJobTypes.dialog(\"option\", \"buttons\");\r\n " +
|
|
||||||
" buttons[\'Save\'] = function () {\r\n " +
|
|
||||||
" $dialogUpdateJobTypes.dialog(\"disable\");\r\n " +
|
|
||||||
" var selectedSJTs = [];\r\n $dialogUpdateJobTyp" +
|
|
||||||
"es.find(\'input:checked\').each(function () { selectedSJTs.push($(this).val()) });" +
|
|
||||||
"\r\n\r\n var data = {\r\n " +
|
|
||||||
" id: id,\r\n JobSubTypes: sele" +
|
|
||||||
"ctedSJTs\r\n };\r\n " +
|
|
||||||
" $.ajax({\r\n url: \'");
|
|
||||||
|
|
||||||
|
|
||||||
#line 192 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
|
||||||
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes()));
|
|
||||||
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
|
|
||||||
" type: \'POST\',\r\n tra" +
|
|
||||||
"ditional: true,\r\n data: data,\r\n " +
|
|
||||||
" success: function (d) {\r\n " +
|
|
||||||
" if (d.Result == \'OK\') {\r\n " +
|
|
||||||
" if (d.Component.JobSubTypes.length > 0) {\r\n " +
|
|
||||||
" edit$this.find(\'.fa-asterisk\').removeClass(\'hidden\');" +
|
|
||||||
"\r\n } else {\r\n " +
|
|
||||||
" edit$this.find(\'.fa-asterisk\').addClass(\'hidden\'" +
|
|
||||||
");\r\n }\r\n " +
|
|
||||||
" $dialogUpdateJobTypes.dialog(\"enable\");\r\n " +
|
|
||||||
" $dialogUpdateJobTypes.dialog(\"close\");\r\n " +
|
|
||||||
" } else {\r\n " +
|
|
||||||
" alert(\'Unable to update component sub types: \' + d.Result);\r\n " +
|
|
||||||
" }\r\n " +
|
|
||||||
" },\r\n error: function (jqXHR, textStatus" +
|
|
||||||
", errorThrown) {\r\n alert(\'Unable to u" +
|
|
||||||
"pdate component sub types: \' + textStatus);\r\n " +
|
|
||||||
" }\r\n });\r\n " +
|
|
||||||
" };\r\n var buttons = $dialogUpdateJobTypes.dialog(" +
|
|
||||||
"\"option\", \"buttons\", buttons);\r\n $dialogUpdateJob" +
|
|
||||||
"Types.dialog(\'open\');\r\n } else {\r\n " +
|
|
||||||
" alert(\'Unable to load component: \' + d.Result);\r\n " +
|
|
||||||
" }\r\n },\r\n error: function" +
|
|
||||||
" (jqXHR, textStatus, errorThrown) {\r\n alert(\'Unable t" +
|
|
||||||
"o load component: \' + textStatus);\r\n }\r\n " +
|
|
||||||
" });\r\n }\r\n\r\n }\r\n\r\n $(\"#dialogConfirmRemov" +
|
|
||||||
"e\").dialog({\r\n resizable: false,\r\n height: 140,\r\n " +
|
|
||||||
" modal: true,\r\n autoOpen: false,\r\n b" +
|
|
||||||
"uttons: {\r\n \"Remove\": function () {\r\n " +
|
|
||||||
"$(this).dialog(\"close\");\r\n },\r\n Cancel: fu" +
|
|
||||||
"nction () {\r\n $(this).dialog(\"close\");\r\n " +
|
|
||||||
" }\r\n }\r\n });\r\n\r\n $(\'#dialogUpdateJobTypes" +
|
|
||||||
"\').dialog({\r\n resizable: false,\r\n modal: true,\r\n " +
|
|
||||||
" autoOpen: false,\r\n width: 550,\r\n but" +
|
|
||||||
"tons: {\r\n \"Save\": function () {\r\n $(th" +
|
|
||||||
"is).dialog(\"close\");\r\n },\r\n Cancel: functi" +
|
|
||||||
"on () {\r\n $(this).dialog(\"close\");\r\n }" +
|
|
||||||
"\r\n }\r\n });\r\n\r\n $(\'#CheckboxBulkSelect_dialo" +
|
|
||||||
"gUpdateJobTypes\').checkboxBulkSelect({ parentSelector: \'div\' });\r\n });\r\n " +
|
|
||||||
" </script>\r\n");
|
|
||||||
|
|
||||||
WriteLiteral(" <div");
|
WriteLiteral(" <div");
|
||||||
|
|
||||||
@@ -470,18 +454,18 @@ WriteLiteral(" data-devicemodelid=\"");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\"");
|
WriteLiteral("\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n <tr>\r\n <th>Description\r\n </th>\r\n <th>" +
|
WriteLiteral(">\r\n <tr>\r\n <th>\r\n Description\r\n </th>" +
|
||||||
"Cost\r\n </th>\r\n <th>Job Types\r\n </th>\r\n <" +
|
"\r\n <th>\r\n Cost\r\n </th>\r\n <th>\r\n " +
|
||||||
"/tr>\r\n");
|
" Job Types\r\n </th>\r\n </tr>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 288 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 291 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 288 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 291 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
foreach (var item in Model.DeviceComponents)
|
foreach (var item in Model.DeviceComponents)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -493,7 +477,7 @@ WriteLiteral(" <tr");
|
|||||||
WriteLiteral(" data-devicecomponentid=\"");
|
WriteLiteral(" data-devicecomponentid=\"");
|
||||||
|
|
||||||
|
|
||||||
#line 290 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 293 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
Write(item.Id);
|
Write(item.Id);
|
||||||
|
|
||||||
|
|
||||||
@@ -506,7 +490,7 @@ WriteLiteral(">\r\n <td>\r\n");
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 292 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 295 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
Write(item.Description);
|
Write(item.Description);
|
||||||
|
|
||||||
|
|
||||||
@@ -517,7 +501,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 295 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 298 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
Write(item.Cost.ToString("C"));
|
Write(item.Cost.ToString("C"));
|
||||||
|
|
||||||
|
|
||||||
@@ -526,13 +510,13 @@ WriteLiteral(" ");
|
|||||||
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 298 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 301 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 298 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 301 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
if (item.JobSubTypes.Count > 0)
|
if (item.JobSubTypes.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -542,13 +526,13 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
|||||||
WriteLiteral(" <ul>\r\n");
|
WriteLiteral(" <ul>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 301 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 304 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 301 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 304 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
foreach (var jst in item.JobSubTypes)
|
foreach (var jst in item.JobSubTypes)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -558,7 +542,7 @@ WriteLiteral(" <ul>\r\n");
|
|||||||
WriteLiteral(" <li>");
|
WriteLiteral(" <li>");
|
||||||
|
|
||||||
|
|
||||||
#line 303 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 306 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
Write(jst.Description);
|
Write(jst.Description);
|
||||||
|
|
||||||
|
|
||||||
@@ -567,7 +551,7 @@ WriteLiteral(" <li>");
|
|||||||
WriteLiteral("</li>\r\n");
|
WriteLiteral("</li>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 304 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 307 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -576,7 +560,7 @@ WriteLiteral("</li>\r\n");
|
|||||||
WriteLiteral(" </ul>\r\n");
|
WriteLiteral(" </ul>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 306 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 309 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -591,7 +575,7 @@ WriteLiteral(" class=\"smallMessage\"");
|
|||||||
WriteLiteral("><None Specified></span>\r\n");
|
WriteLiteral("><None Specified></span>\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></span>\r\n");
|
|||||||
WriteLiteral(" </td>\r\n </tr>\r\n");
|
WriteLiteral(" </td>\r\n </tr>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 313 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 316 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -609,7 +593,7 @@ WriteLiteral(" </td>\r\n </tr>\r\n");
|
|||||||
WriteLiteral(" </table>\r\n");
|
WriteLiteral(" </table>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 315 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
#line 318 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
@model Disco.Web.Areas.Config.Models.DeviceProfile.CreateModel
|
@model Disco.Web.Areas.Config.Models.DeviceProfile.CreateModel
|
||||||
@{
|
@{
|
||||||
Authorization.RequireAll(Claims.Config.DeviceProfile.Create, Claims.Config.DeviceProfile.Configure);
|
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");
|
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Create");
|
||||||
}
|
}
|
||||||
@using (Html.BeginForm())
|
@using (Html.BeginForm())
|
||||||
{
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
@Html.ValidationSummary(false)
|
@Html.ValidationSummary(false)
|
||||||
<div class="form" style="width: 450px">
|
<div class="form" style="width: 450px">
|
||||||
<table>
|
<table>
|
||||||
@@ -14,28 +15,26 @@
|
|||||||
Name:
|
Name:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.TextBoxFor(model => model.DeviceProfile.Name)<br />@Html.ValidationMessageFor(model => model.DeviceProfile.Name)
|
@Html.TextBoxFor(model => model.Name)<br />@Html.ValidationMessageFor(model => model.Name)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
Short Name:
|
Short Name:
|
||||||
</th>
|
</th>
|
||||||
<td>@Html.TextBoxFor(model => model.DeviceProfile.ShortName)<br />@Html.ValidationMessageFor(model => model.DeviceProfile.ShortName)
|
<td>
|
||||||
|
@Html.TextBoxFor(model => model.ShortName)<br />@Html.ValidationMessageFor(model => model.ShortName)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
Description:
|
Description:
|
||||||
</th>
|
</th>
|
||||||
<td>@Html.TextBoxFor(model => model.DeviceProfile.Description)<br />@Html.ValidationMessageFor(model => model.DeviceProfile.Description)
|
<td>
|
||||||
|
@Html.TextBoxFor(model => model.Description)<br />@Html.ValidationMessageFor(model => model.Description)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@Html.HiddenFor(model => model.DeviceProfile.ComputerNameTemplate)
|
|
||||||
@Html.HiddenFor(model => model.DeviceProfile.ProvisionADAccount)
|
|
||||||
@Html.HiddenFor(model => model.DeviceProfile.DistributionType)
|
|
||||||
@Html.HiddenFor(model => model.DeviceProfile.OrganisationalUnit)
|
|
||||||
<p class="actions">
|
<p class="actions">
|
||||||
<input type="submit" class="button" value="Create" />
|
<input type="submit" class="button" value="Create" />
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
|
|||||||
#line 2 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#line 2 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
|
|
||||||
Authorization.RequireAll(Claims.Config.DeviceProfile.Create, Claims.Config.DeviceProfile.Configure);
|
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");
|
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"
|
#line 7 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
using (Html.BeginForm())
|
using (Html.BeginForm())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 9 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#line 9 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
Write(Html.ValidationSummary(false));
|
Write(Html.AntiForgeryToken());
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 9 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#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 <table>\r\n <tr>\r\n <th>\r\n N" +
|
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n N" +
|
||||||
"ame:\r\n </th>\r\n <td>\r\n");
|
"ame:\r\n </th>\r\n <td>\r\n");
|
||||||
|
|
||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 17 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#line 18 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
Write(Html.TextBoxFor(model => model.DeviceProfile.Name));
|
Write(Html.TextBoxFor(model => model.Name));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -98,18 +112,21 @@ WriteLiteral(" ");
|
|||||||
WriteLiteral("<br />");
|
WriteLiteral("<br />");
|
||||||
|
|
||||||
|
|
||||||
#line 17 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#line 18 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.DeviceProfile.Name));
|
Write(Html.ValidationMessageFor(model => model.Name));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
||||||
">\r\n Short Name:\r\n </th>\r\n <td>");
|
">\r\n Short Name:\r\n </th>\r\n <td>\r" +
|
||||||
|
"\n");
|
||||||
|
|
||||||
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 24 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#line 26 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
Write(Html.TextBoxFor(model => model.DeviceProfile.ShortName));
|
Write(Html.TextBoxFor(model => model.ShortName));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -117,19 +134,21 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
|||||||
WriteLiteral("<br />");
|
WriteLiteral("<br />");
|
||||||
|
|
||||||
|
|
||||||
#line 24 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#line 26 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.DeviceProfile.ShortName));
|
Write(Html.ValidationMessageFor(model => model.ShortName));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
||||||
">\r\n Description:\r\n </th>\r\n <td>" +
|
">\r\n Description:\r\n </th>\r\n <td>" +
|
||||||
"");
|
"\r\n");
|
||||||
|
|
||||||
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 31 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#line 34 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
Write(Html.TextBoxFor(model => model.DeviceProfile.Description));
|
Write(Html.TextBoxFor(model => model.Description));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -137,57 +156,13 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
|||||||
WriteLiteral("<br />");
|
WriteLiteral("<br />");
|
||||||
|
|
||||||
|
|
||||||
#line 31 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#line 34 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.DeviceProfile.Description));
|
Write(Html.ValidationMessageFor(model => model.Description));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n");
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n <p");
|
||||||
|
|
||||||
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 <p");
|
|
||||||
|
|
||||||
WriteLiteral(" class=\"actions\"");
|
WriteLiteral(" class=\"actions\"");
|
||||||
|
|
||||||
@@ -209,7 +184,7 @@ WriteLiteral(">\r\n $(function () {\r\n $(\'#Name\').focus().s
|
|||||||
"\r\n </script>\r\n");
|
"\r\n </script>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 48 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
#line 47 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
@model Disco.Web.Areas.Config.Models.DeviceProfile.DefaultsModel
|
@model Disco.Web.Areas.Config.Models.DeviceProfile.DefaultsModel
|
||||||
@{
|
@{
|
||||||
Authorization.Require(Claims.Config.DeviceProfile.ConfigureDefaults);
|
Authorization.Require(Claims.Config.DeviceProfile.ConfigureDefaults);
|
||||||
|
|
||||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Defaults");
|
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Defaults");
|
||||||
|
|
||||||
|
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
|
||||||
}
|
}
|
||||||
<div class="form" style="width: 600px">
|
<div class="form" style="width: 600px">
|
||||||
<table>
|
<table>
|
||||||
@@ -15,19 +17,12 @@
|
|||||||
@AjaxHelpers.AjaxLoader()
|
@AjaxHelpers.AjaxLoader()
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
$('#Default').change(function () {
|
document.DiscoFunctions.PropertyChangeHelper(
|
||||||
$this = $(this);
|
$('#Default'),
|
||||||
$ajaxLoading = $this.next('.ajaxLoading').show();
|
'Default Profile',
|
||||||
var data = { id: $this.val() };
|
'@Url.Action(MVC.API.DeviceProfile.Default())',
|
||||||
$.getJSON('@(Url.Action(MVC.API.DeviceProfile.Default()))', data, function (response, result) {
|
'id'
|
||||||
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');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</td>
|
</td>
|
||||||
@@ -41,19 +36,12 @@
|
|||||||
@AjaxHelpers.AjaxLoader()
|
@AjaxHelpers.AjaxLoader()
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
$('#DefaultAddDeviceOffline').change(function () {
|
document.DiscoFunctions.PropertyChangeHelper(
|
||||||
$this = $(this);
|
$('#DefaultAddDeviceOffline'),
|
||||||
$ajaxLoading = $this.next('.ajaxLoading').show();
|
'Default Add Device Offline Profile',
|
||||||
var data = { id: $this.val() };
|
'@Url.Action(MVC.API.DeviceProfile.DefaultAddDeviceOffline())',
|
||||||
$.getJSON('@(Url.Action(MVC.API.DeviceProfile.DefaultAddDeviceOffline()))', data, function (response, result) {
|
'id'
|
||||||
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');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -47,9 +47,11 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
|
|||||||
#line 2 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
|
#line 2 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
|
||||||
|
|
||||||
Authorization.Require(Claims.Config.DeviceProfile.ConfigureDefaults);
|
Authorization.Require(Claims.Config.DeviceProfile.ConfigureDefaults);
|
||||||
|
|
||||||
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Defaults");
|
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 default
|
||||||
#line hidden
|
#line hidden
|
||||||
@@ -74,7 +76,7 @@ WriteLiteral(">\r\n");
|
|||||||
WriteLiteral(" ");
|
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)));
|
Write(Html.DropDownListFor(m => m.Default, Model.DeviceProfiles.ToSelectListItems(Model.Default)));
|
||||||
|
|
||||||
|
|
||||||
@@ -85,7 +87,7 @@ WriteLiteral("\r\n");
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 15 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
|
#line 17 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
|
||||||
Write(AjaxHelpers.AjaxLoader());
|
Write(AjaxHelpers.AjaxLoader());
|
||||||
|
|
||||||
|
|
||||||
@@ -95,36 +97,20 @@ WriteLiteral("\r\n <script");
|
|||||||
|
|
||||||
WriteLiteral(" type=\"text/javascript\"");
|
WriteLiteral(" type=\"text/javascript\"");
|
||||||
|
|
||||||
WriteLiteral(@">
|
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
|
||||||
$(function () {
|
"ctions.PropertyChangeHelper(\r\n $(\'#Default\'),\r\n " +
|
||||||
$('#Default').change(function () {
|
" \'Default Profile\',\r\n \'");
|
||||||
$this = $(this);
|
|
||||||
$ajaxLoading = $this.next('.ajaxLoading').show();
|
|
||||||
var data = { id: $this.val() };
|
|
||||||
$.getJSON('");
|
|
||||||
|
|
||||||
|
|
||||||
#line 22 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
|
#line 23 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
|
||||||
Write(Url.Action(MVC.API.DeviceProfile.Default()));
|
Write(Url.Action(MVC.API.DeviceProfile.Default()));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(@"', data, function (response, result) {
|
WriteLiteral("\',\r\n \'id\'\r\n );\r\n " +
|
||||||
if (result != 'success' || response != 'OK') {
|
" });\r\n </script>\r\n </td>\r\n </tr>\r\n <" +
|
||||||
alert('Unable to change Default Device Profile:\n' + response);
|
"tr>\r\n <th");
|
||||||
$ajaxLoading.hide();
|
|
||||||
} else {
|
|
||||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th");
|
|
||||||
|
|
||||||
WriteLiteral(" class=\"name\"");
|
WriteLiteral(" class=\"name\"");
|
||||||
|
|
||||||
@@ -138,7 +124,7 @@ WriteLiteral(">\r\n");
|
|||||||
WriteLiteral(" ");
|
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)));
|
Write(Html.DropDownListFor(m => m.DefaultAddDeviceOffline, Model.DeviceProfilesAndNone.ToSelectListItems(Model.DefaultAddDeviceOffline)));
|
||||||
|
|
||||||
|
|
||||||
@@ -149,7 +135,7 @@ WriteLiteral("\r\n");
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 41 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
|
#line 36 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
|
||||||
Write(AjaxHelpers.AjaxLoader());
|
Write(AjaxHelpers.AjaxLoader());
|
||||||
|
|
||||||
|
|
||||||
@@ -161,35 +147,21 @@ WriteLiteral(" type=\"text/javascript\"");
|
|||||||
|
|
||||||
WriteLiteral(@">
|
WriteLiteral(@">
|
||||||
$(function () {
|
$(function () {
|
||||||
$('#DefaultAddDeviceOffline').change(function () {
|
document.DiscoFunctions.PropertyChangeHelper(
|
||||||
$this = $(this);
|
$('#DefaultAddDeviceOffline'),
|
||||||
$ajaxLoading = $this.next('.ajaxLoading').show();
|
'Default Add Device Offline Profile',
|
||||||
var data = { id: $this.val() };
|
'");
|
||||||
$.getJSON('");
|
|
||||||
|
|
||||||
|
|
||||||
#line 48 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
|
#line 42 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
|
||||||
Write(Url.Action(MVC.API.DeviceProfile.DefaultAddDeviceOffline()));
|
Write(Url.Action(MVC.API.DeviceProfile.DefaultAddDeviceOffline()));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(@"', data, function (response, result) {
|
WriteLiteral("\',\r\n \'id\'\r\n );\r\n " +
|
||||||
if (result != 'success' || response != 'OK') {
|
" });\r\n </script>\r\n </td>\r\n </tr>\r\n </tab" +
|
||||||
alert('Unable to change Default Add Device Offline Device Profile:\n' + response);
|
"le>\r\n</div>\r\n");
|
||||||
$ajaxLoading.hide();
|
|
||||||
} else {
|
|
||||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -568,7 +568,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="treeOrganisationalUnit" class="organisationalUnitTree">
|
<div id="treeOrganisationalUnit" class="organisationalUnitTree">
|
||||||
</div>
|
</div>
|
||||||
@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();
|
@Html.AntiForgeryToken();
|
||||||
<input type="hidden" name="OrganisationalUnit" />
|
<input type="hidden" name="OrganisationalUnit" />
|
||||||
@@ -754,23 +754,30 @@
|
|||||||
{
|
{
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var $container = $('#DeviceProfile_CertificateProviders');
|
const $container = $('#DeviceProfile_CertificateProviders');
|
||||||
|
|
||||||
$container.on('change', 'input', function () {
|
$container.on('change', 'input', function () {
|
||||||
var $ajaxLoading = $('#DeviceProfile_CertificateProviders_loading').show();
|
const $ajaxLoading = $('#DeviceProfile_CertificateProviders_loading').show();
|
||||||
|
|
||||||
var data = {
|
const body = new FormData();
|
||||||
CertificateProviders: $('input:checked', $container).map(function () { return $(this).val() }).get().join(',')
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
};
|
body.append('certificateProviders', $container.find('input:checked',).map(function () { return $(this).val() }).get().join(','));
|
||||||
$.getJSON('@(Url.Action(MVC.API.DeviceProfile.UpdateCertificateProviders(Model.DeviceProfile.Id)))', data, function (response, result) {
|
|
||||||
if (result != 'success' || response != 'OK') {
|
fetch('@(Url.Action(MVC.API.DeviceProfile.UpdateCertificateProviders(Model.DeviceProfile.Id)))', {
|
||||||
alert('Unable to change property "CertificateProviders":\n' + response);
|
method: 'POST',
|
||||||
$ajaxLoading.hide();
|
body: body
|
||||||
} else {
|
}).then(r => {
|
||||||
|
if (r.ok) {
|
||||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
$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();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
@@ -783,18 +790,25 @@
|
|||||||
$container.on('change', 'input', function () {
|
$container.on('change', 'input', function () {
|
||||||
var $ajaxLoading = $('#DeviceProfile_CertificateProviders_loading').show();
|
var $ajaxLoading = $('#DeviceProfile_CertificateProviders_loading').show();
|
||||||
|
|
||||||
var data = {
|
const body = new FormData();
|
||||||
CertificateAuthorityProviders: $('input:checked', $container).map(function () { return $(this).val() }).get().join(',')
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
};
|
body.append('certificateAuthorityProviders', $container.find('input:checked',).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') {
|
fetch('@(Url.Action(MVC.API.DeviceProfile.UpdateCertificateAuthorityProviders(Model.DeviceProfile.Id)))', {
|
||||||
alert('Unable to change property "CertificateAuthorityProviders":\n' + response);
|
method: 'POST',
|
||||||
$ajaxLoading.hide();
|
body: body
|
||||||
} else {
|
}).then(r => {
|
||||||
|
if (r.ok) {
|
||||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
$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();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
@@ -870,18 +884,25 @@
|
|||||||
$container.on('change', 'input', function () {
|
$container.on('change', 'input', function () {
|
||||||
var $ajaxLoading = $('#DeviceProfile_WirelessProfileProviders_loading').show();
|
var $ajaxLoading = $('#DeviceProfile_WirelessProfileProviders_loading').show();
|
||||||
|
|
||||||
var data = {
|
const body = new FormData();
|
||||||
WirelessProfileProviders: $('input:checked', $container).map(function () { return $(this).val() }).get().join(',')
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
};
|
body.append('wirelessProfileProviders', $container.find('input:checked',).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') {
|
fetch('@(Url.Action(MVC.API.DeviceProfile.UpdateWirelessProfileProviders(Model.DeviceProfile.Id)))', {
|
||||||
alert('Unable to change property "WirelessProfileProviders":\n' + response);
|
method: 'POST',
|
||||||
$ajaxLoading.hide();
|
body: body
|
||||||
} else {
|
}).then(r => {
|
||||||
|
if (r.ok) {
|
||||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
$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();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
@@ -967,50 +988,13 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@if (canDelete)
|
|
||||||
{
|
|
||||||
<div id="dialogConfirmDelete" title="Delete this Device Profile?">
|
|
||||||
<p>
|
|
||||||
<i class="fa fa-exclamation-triangle fa-lg warning"></i>
|
|
||||||
This item will be permanently deleted and cannot be recovered. Are you sure?
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
}
|
|
||||||
@Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model)
|
@Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model)
|
||||||
<div class="actionBar">
|
<div class="actionBar">
|
||||||
@if (Model.CanDecommission)
|
@if (Model.CanDecommission)
|
||||||
{
|
{
|
||||||
<button id="DeviceProfile_Decommission" class="button">Decommission All Devices</button>
|
<button id="DeviceProfile_Decommission" class="button">Decommission All Devices</button>
|
||||||
<div id="DeviceProfile_Decommission_Dialog" class="dialog" title="Profile Device Decommission">
|
<div id="DeviceProfile_Decommission_Dialog" class="dialog" title="Profile Device Decommission">
|
||||||
@using (Html.BeginForm(MVC.API.Device.DeviceProfileDecommission(Model.DeviceProfile.Id), FormMethod.Post))
|
@using (Html.BeginForm(MVC.API.Device.DeviceProfileDecommission(Model.DeviceProfile.Id)))
|
||||||
{
|
{
|
||||||
@Html.AntiForgeryToken()
|
@Html.AntiForgeryToken()
|
||||||
<div class="clearfix" style="margin-bottom: 10px;">
|
<div class="clearfix" style="margin-bottom: 10px;">
|
||||||
@@ -1067,7 +1051,44 @@
|
|||||||
}
|
}
|
||||||
@if (canDelete)
|
@if (canDelete)
|
||||||
{
|
{
|
||||||
@Html.ActionLinkButton("Delete", MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true), "buttonDelete")
|
<button id="buttonDelete" type="button" class="button">Delete</button>
|
||||||
|
<div id="dialogConfirmDelete" class="dialog" title="Delete this Device Profile?">
|
||||||
|
@using (Html.BeginForm(MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true)))
|
||||||
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
|
}
|
||||||
|
<p>
|
||||||
|
<i class="fa fa-exclamation-triangle fa-lg warning"></i>
|
||||||
|
This item will be permanently deleted and cannot be recovered. Are you sure?
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(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');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
}
|
}
|
||||||
@if (Authorization.Has(Claims.Device.Actions.Export))
|
@if (Authorization.Has(Claims.Device.Actions.Export))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1825,7 +1825,7 @@ WriteLiteral(">\r\n </div>\r\n");
|
|||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 571 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#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(@">
|
WriteLiteral(@">
|
||||||
$(function () {
|
$(function () {
|
||||||
var $container = $('#DeviceProfile_CertificateProviders');
|
const $container = $('#DeviceProfile_CertificateProviders');
|
||||||
|
|
||||||
$container.on('change', 'input', function () {
|
$container.on('change', 'input', function () {
|
||||||
var $ajaxLoading = $('#DeviceProfile_CertificateProviders_loading').show();
|
const $ajaxLoading = $('#DeviceProfile_CertificateProviders_loading').show();
|
||||||
|
|
||||||
var data = {
|
const body = new FormData();
|
||||||
CertificateProviders: $('input:checked', $container).map(function () { return $(this).val() }).get().join(',')
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
};
|
body.append('certificateProviders', $container.find('input:checked',).map(function () { return $(this).val() }).get().join(','));
|
||||||
$.getJSON('");
|
|
||||||
|
fetch('");
|
||||||
|
|
||||||
|
|
||||||
#line 765 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 766 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
Write(Url.Action(MVC.API.DeviceProfile.UpdateCertificateProviders(Model.DeviceProfile.Id)));
|
Write(Url.Action(MVC.API.DeviceProfile.UpdateCertificateProviders(Model.DeviceProfile.Id)));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(@"', data, function (response, result) {
|
WriteLiteral(@"', {
|
||||||
if (result != 'success' || response != 'OK') {
|
method: 'POST',
|
||||||
alert('Unable to change property ""CertificateProviders"":\n' + response);
|
body: body
|
||||||
$ajaxLoading.hide();
|
}).then(r => {
|
||||||
} else {
|
if (r.ok) {
|
||||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
$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();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
");
|
");
|
||||||
|
|
||||||
|
|
||||||
#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(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 777 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 784 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
if (canConfig && Model.CertificateProviders.Count > 0)
|
if (canConfig && Model.CertificateProviders.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2288,33 +2295,40 @@ WriteLiteral(@">
|
|||||||
$container.on('change', 'input', function () {
|
$container.on('change', 'input', function () {
|
||||||
var $ajaxLoading = $('#DeviceProfile_CertificateProviders_loading').show();
|
var $ajaxLoading = $('#DeviceProfile_CertificateProviders_loading').show();
|
||||||
|
|
||||||
var data = {
|
const body = new FormData();
|
||||||
CertificateAuthorityProviders: $('input:checked', $container).map(function () { return $(this).val() }).get().join(',')
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
};
|
body.append('certificateAuthorityProviders', $container.find('input:checked',).map(function () { return $(this).val() }).get().join(','));
|
||||||
$.getJSON('");
|
|
||||||
|
fetch('");
|
||||||
|
|
||||||
|
|
||||||
#line 789 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 797 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
Write(Url.Action(MVC.API.DeviceProfile.UpdateCertificateAuthorityProviders(Model.DeviceProfile.Id)));
|
Write(Url.Action(MVC.API.DeviceProfile.UpdateCertificateAuthorityProviders(Model.DeviceProfile.Id)));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(@"', data, function (response, result) {
|
WriteLiteral(@"', {
|
||||||
if (result != 'success' || response != 'OK') {
|
method: 'POST',
|
||||||
alert('Unable to change property ""CertificateAuthorityProviders"":\n' + response);
|
body: body
|
||||||
$ajaxLoading.hide();
|
}).then(r => {
|
||||||
} else {
|
if (r.ok) {
|
||||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
$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();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
");
|
");
|
||||||
|
|
||||||
|
|
||||||
#line 800 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 814 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2324,13 +2338,13 @@ WriteLiteral(" </th>\r\n <td>\r\n <h4>Devic
|
|||||||
"tes</h4>\r\n");
|
"tes</h4>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 804 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 818 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 804 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 818 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
if (canConfig && Model.CertificateProviders.Count > 0)
|
if (canConfig && Model.CertificateProviders.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2338,14 +2352,14 @@ WriteLiteral(" </th>\r\n <td>\r\n <h4>Devic
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#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())));
|
Write(CommonHelpers.CheckBoxList("DeviceProfile_CertificateProviders", "DeviceProfile_CertificateProviders", Model.CertificateProviders.ToSelectListItems(Model.DeviceProfile.GetCertificateProviders())));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 806 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 820 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2365,7 +2379,7 @@ WriteLiteral(" class=\"smallMessage\"");
|
|||||||
WriteLiteral("><None Allocated></span>\r\n");
|
WriteLiteral("><None Allocated></span>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 815 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 829 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2376,13 +2390,13 @@ WriteLiteral("><None Allocated></span>\r\n");
|
|||||||
WriteLiteral(" <ul>\r\n");
|
WriteLiteral(" <ul>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 819 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 833 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 819 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 833 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
foreach (var certificateProvider in certificateProviders)
|
foreach (var certificateProvider in certificateProviders)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2392,7 +2406,7 @@ WriteLiteral(" <ul>\r\n");
|
|||||||
WriteLiteral(" <li>");
|
WriteLiteral(" <li>");
|
||||||
|
|
||||||
|
|
||||||
#line 821 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 835 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
Write(certificateProvider.Name);
|
Write(certificateProvider.Name);
|
||||||
|
|
||||||
|
|
||||||
@@ -2401,7 +2415,7 @@ WriteLiteral(" <li>");
|
|||||||
WriteLiteral("</li>\r\n");
|
WriteLiteral("</li>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 822 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 836 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2410,7 +2424,7 @@ WriteLiteral("</li>\r\n");
|
|||||||
WriteLiteral(" </ul>\r\n");
|
WriteLiteral(" </ul>\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</h4>\r\n");
|
WriteLiteral(">Authority Certificates</h4>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 827 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 841 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 827 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 841 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
if (canConfig && Model.CertificateAuthorityProviders.Count > 0)
|
if (canConfig && Model.CertificateAuthorityProviders.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2438,14 +2452,14 @@ WriteLiteral(">Authority Certificates</h4>\r\n");
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#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())));
|
Write(CommonHelpers.CheckBoxList("DeviceProfile_CertificateAuthorityProviders", "DeviceProfile_CertificateAuthorityProviders", Model.CertificateAuthorityProviders.ToSelectListItems(Model.DeviceProfile.GetCertificateAuthorityProviders())));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 829 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 843 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2465,7 +2479,7 @@ WriteLiteral(" class=\"smallMessage\"");
|
|||||||
WriteLiteral("><None Allocated></span>\r\n");
|
WriteLiteral("><None Allocated></span>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 838 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 852 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2476,13 +2490,13 @@ WriteLiteral("><None Allocated></span>\r\n");
|
|||||||
WriteLiteral(" <ul>\r\n");
|
WriteLiteral(" <ul>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 842 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 856 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 842 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 856 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
foreach (var certificateProvider in certificateProviders)
|
foreach (var certificateProvider in certificateProviders)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2492,7 +2506,7 @@ WriteLiteral(" <ul>\r\n");
|
|||||||
WriteLiteral(" <li>");
|
WriteLiteral(" <li>");
|
||||||
|
|
||||||
|
|
||||||
#line 844 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 858 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
Write(certificateProvider.Name);
|
Write(certificateProvider.Name);
|
||||||
|
|
||||||
|
|
||||||
@@ -2501,7 +2515,7 @@ WriteLiteral(" <li>");
|
|||||||
WriteLiteral("</li>\r\n");
|
WriteLiteral("</li>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 845 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 859 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2510,7 +2524,7 @@ WriteLiteral("</li>\r\n");
|
|||||||
WriteLiteral(" </ul>\r\n");
|
WriteLiteral(" </ul>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 847 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 861 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2520,7 +2534,7 @@ WriteLiteral(" </ul>\r\n");
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 849 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 863 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
if (canViewPlugins)
|
if (canViewPlugins)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2541,21 +2555,21 @@ WriteLiteral(" class=\"fa fa-info-circle\"");
|
|||||||
|
|
||||||
WriteLiteral("></i>View the <a");
|
WriteLiteral("></i>View the <a");
|
||||||
|
|
||||||
WriteAttribute("href", Tuple.Create(" href=\"", 48824), Tuple.Create("\"", 48874)
|
WriteAttribute("href", Tuple.Create(" href=\"", 49620), Tuple.Create("\"", 49670)
|
||||||
|
|
||||||
#line 853 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 867 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 48831), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.Plugins.Install())
|
, Tuple.Create(Tuple.Create("", 49627), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.Plugins.Install())
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 48831), false)
|
, 49627), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">Plugin Catalogue</a> to discover and install certificate provider plugins.\r\n " +
|
WriteLiteral(">Plugin Catalogue</a> to discover and install certificate provider plugins.\r\n " +
|
||||||
" </p>\r\n </div>\r\n");
|
" </p>\r\n </div>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 856 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 870 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2565,13 +2579,13 @@ WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n
|
|||||||
" Provision Wireless Profiles:\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 default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 862 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 876 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
if (canConfig && Model.WirelessProfileProviders.Count > 0)
|
if (canConfig && Model.WirelessProfileProviders.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2581,20 +2595,20 @@ WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n
|
|||||||
WriteLiteral(" <br />\r\n");
|
WriteLiteral(" <br />\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 865 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 879 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 865 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 879 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
Write(AjaxHelpers.AjaxLoader("DeviceProfile_WirelessProfileProviders"));
|
Write(AjaxHelpers.AjaxLoader("DeviceProfile_WirelessProfileProviders"));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#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 () {
|
$container.on('change', 'input', function () {
|
||||||
var $ajaxLoading = $('#DeviceProfile_WirelessProfileProviders_loading').show();
|
var $ajaxLoading = $('#DeviceProfile_WirelessProfileProviders_loading').show();
|
||||||
|
|
||||||
var data = {
|
const body = new FormData();
|
||||||
WirelessProfileProviders: $('input:checked', $container).map(function () { return $(this).val() }).get().join(',')
|
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||||
};
|
body.append('wirelessProfileProviders', $container.find('input:checked',).map(function () { return $(this).val() }).get().join(','));
|
||||||
$.getJSON('");
|
|
||||||
|
fetch('");
|
||||||
|
|
||||||
|
|
||||||
#line 876 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 891 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
Write(Url.Action(MVC.API.DeviceProfile.UpdateWirelessProfileProviders(Model.DeviceProfile.Id)));
|
Write(Url.Action(MVC.API.DeviceProfile.UpdateWirelessProfileProviders(Model.DeviceProfile.Id)));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(@"', data, function (response, result) {
|
WriteLiteral(@"', {
|
||||||
if (result != 'success' || response != 'OK') {
|
method: 'POST',
|
||||||
alert('Unable to change property ""WirelessProfileProviders"":\n' + response);
|
body: body
|
||||||
$ajaxLoading.hide();
|
}).then(r => {
|
||||||
} else {
|
if (r.ok) {
|
||||||
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
$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();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
");
|
");
|
||||||
|
|
||||||
|
|
||||||
#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(" </th>\r\n <td>\r\n");
|
WriteLiteral(" </th>\r\n <td>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 890 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 911 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 890 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 911 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
if (canConfig && Model.WirelessProfileProviders.Count > 0)
|
if (canConfig && Model.WirelessProfileProviders.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2660,14 +2681,14 @@ WriteLiteral(" </th>\r\n <td>\r\n");
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#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())));
|
Write(CommonHelpers.CheckBoxList("DeviceProfile_WirelessProfileProviders", "DeviceProfile_WirelessProfileProviders", Model.WirelessProfileProviders.ToSelectListItems(Model.DeviceProfile.GetWirelessProfileProviders())));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 892 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 913 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2687,7 +2708,7 @@ WriteLiteral(" class=\"smallMessage\"");
|
|||||||
WriteLiteral("><None Allocated></span>\r\n");
|
WriteLiteral("><None Allocated></span>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 901 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 922 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2698,13 +2719,13 @@ WriteLiteral("><None Allocated></span>\r\n");
|
|||||||
WriteLiteral(" <ul>\r\n");
|
WriteLiteral(" <ul>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 905 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 926 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 905 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 926 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
foreach (var wirelessProfileProvider in wirelessProfileProviders)
|
foreach (var wirelessProfileProvider in wirelessProfileProviders)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2714,7 +2735,7 @@ WriteLiteral(" <ul>\r\n");
|
|||||||
WriteLiteral(" <li>");
|
WriteLiteral(" <li>");
|
||||||
|
|
||||||
|
|
||||||
#line 907 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 928 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
Write(wirelessProfileProvider.Name);
|
Write(wirelessProfileProvider.Name);
|
||||||
|
|
||||||
|
|
||||||
@@ -2723,7 +2744,7 @@ WriteLiteral(" <li>");
|
|||||||
WriteLiteral("</li>\r\n");
|
WriteLiteral("</li>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 908 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 929 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2732,7 +2753,7 @@ WriteLiteral("</li>\r\n");
|
|||||||
WriteLiteral(" </ul>\r\n");
|
WriteLiteral(" </ul>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 910 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 931 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2742,7 +2763,7 @@ WriteLiteral(" </ul>\r\n");
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 912 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 933 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
if (canViewPlugins)
|
if (canViewPlugins)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2763,21 +2784,21 @@ WriteLiteral(" class=\"fa fa-info-circle\"");
|
|||||||
|
|
||||||
WriteLiteral("></i>View the <a");
|
WriteLiteral("></i>View the <a");
|
||||||
|
|
||||||
WriteAttribute("href", Tuple.Create(" href=\"", 52078), Tuple.Create("\"", 52128)
|
WriteAttribute("href", Tuple.Create(" href=\"", 53278), Tuple.Create("\"", 53328)
|
||||||
|
|
||||||
#line 916 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 937 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 52085), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.Plugins.Install())
|
, Tuple.Create(Tuple.Create("", 53285), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.Plugins.Install())
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 52085), false)
|
, 53285), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">Plugin Catalogue</a> to discover and install wireless profile provider plugins.\r" +
|
WriteLiteral(">Plugin Catalogue</a> to discover and install wireless profile provider plugins.\r" +
|
||||||
"\n </p>\r\n </div>\r\n");
|
"\n </p>\r\n </div>\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</a> to discover and install wireless profile pro
|
|||||||
WriteLiteral(" </td>\r\n </tr>\r\n");
|
WriteLiteral(" </td>\r\n </tr>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 922 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 943 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 922 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 943 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
if (hideAdvanced)
|
if (hideAdvanced)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2826,7 +2847,7 @@ WriteLiteral(@">Show Advanced Options</button>
|
|||||||
");
|
");
|
||||||
|
|
||||||
|
|
||||||
#line 938 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 959 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2842,7 +2863,7 @@ WriteLiteral(">\r\n <th>\r\n Linked Groups:\r\n
|
|||||||
WriteLiteral(" ");
|
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()
|
Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel()
|
||||||
{
|
{
|
||||||
CanConfigure = canConfig,
|
CanConfigure = canConfig,
|
||||||
@@ -2860,7 +2881,7 @@ WriteLiteral("\r\n");
|
|||||||
WriteLiteral(" ");
|
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()
|
Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel()
|
||||||
{
|
{
|
||||||
CanConfigure = canConfig,
|
CanConfigure = canConfig,
|
||||||
@@ -2876,13 +2897,13 @@ WriteLiteral(" ");
|
|||||||
WriteLiteral("\r\n");
|
WriteLiteral("\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 961 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 982 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 961 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 982 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
if (canConfig)
|
if (canConfig)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -2890,14 +2911,14 @@ WriteLiteral("\r\n");
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#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));
|
Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupShared));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#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(" </div>\r\n </td>\r\n </tr>\r\n </table>\r\n</div>\r\n");
|
WriteLiteral(" </div>\r\n </td>\r\n </tr>\r\n </table>\r\n</div>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 970 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 991 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
if (canDelete)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral(" <div");
|
|
||||||
|
|
||||||
WriteLiteral(" id=\"dialogConfirmDelete\"");
|
|
||||||
|
|
||||||
WriteLiteral(" title=\"Delete this Device Profile?\"");
|
|
||||||
|
|
||||||
WriteLiteral(">\r\n <p>\r\n <i");
|
|
||||||
|
|
||||||
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg warning\"");
|
|
||||||
|
|
||||||
WriteLiteral("></i>\r\n This item will be permanently deleted and cannot be recovered." +
|
|
||||||
" Are you sure?\r\n </p>\r\n </div>\r\n");
|
|
||||||
|
|
||||||
WriteLiteral(" <script");
|
|
||||||
|
|
||||||
WriteLiteral(" type=\"text/javascript\"");
|
|
||||||
|
|
||||||
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"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
");
|
|
||||||
|
|
||||||
|
|
||||||
#line 1006 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
|
|
||||||
#line 1007 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
|
||||||
Write(Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model));
|
Write(Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model));
|
||||||
|
|
||||||
|
|
||||||
@@ -2982,13 +2941,13 @@ WriteLiteral(" class=\"actionBar\"");
|
|||||||
WriteLiteral(">\r\n");
|
WriteLiteral(">\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 1009 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 993 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 1009 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 993 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
if (Model.CanDecommission)
|
if (Model.CanDecommission)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -3014,28 +2973,28 @@ WriteLiteral(" title=\"Profile Device Decommission\"");
|
|||||||
WriteLiteral(">\r\n");
|
WriteLiteral(">\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 1013 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 997 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 1013 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 997 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
using (Html.BeginForm(MVC.API.Device.DeviceProfileDecommission(Model.DeviceProfile.Id), FormMethod.Post))
|
using (Html.BeginForm(MVC.API.Device.DeviceProfileDecommission(Model.DeviceProfile.Id)))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 1015 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 999 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
Write(Html.AntiForgeryToken());
|
Write(Html.AntiForgeryToken());
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#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");
|
WriteLiteral(">\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 1021 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 1005 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#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<DecommissionReasons>().OrderBy(r => r.ToString()))
|
foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast<DecommissionReasons>().OrderBy(r => r.ToString()))
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -3077,33 +3036,33 @@ WriteLiteral(" <li>\r\n
|
|||||||
|
|
||||||
WriteLiteral(" type=\"radio\"");
|
WriteLiteral(" type=\"radio\"");
|
||||||
|
|
||||||
WriteAttribute("id", Tuple.Create(" id=\"", 56977), Tuple.Create("\"", 57049)
|
WriteAttribute("id", Tuple.Create(" id=\"", 56980), Tuple.Create("\"", 57052)
|
||||||
, Tuple.Create(Tuple.Create("", 56982), Tuple.Create("DeviceProfile_Decommission_Dialog_Reason_", 56982), true)
|
, Tuple.Create(Tuple.Create("", 56985), Tuple.Create("DeviceProfile_Decommission_Dialog_Reason_", 56985), true)
|
||||||
|
|
||||||
#line 1024 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 1008 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 57023), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
, Tuple.Create(Tuple.Create("", 57026), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 57023), false)
|
, 57026), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral("\r\n name=\"decommissionReason\"");
|
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"
|
#line 1009 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 57124), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
, Tuple.Create(Tuple.Create("", 57127), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 57124), false)
|
, 57127), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" ");
|
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);
|
Write((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty);
|
||||||
|
|
||||||
|
|
||||||
@@ -3111,21 +3070,21 @@ WriteLiteral(" ");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" />\r\n <label");
|
WriteLiteral(" />\r\n <label");
|
||||||
|
|
||||||
WriteAttribute("for", Tuple.Create(" for=\"", 57290), Tuple.Create("\"", 57363)
|
WriteAttribute("for", Tuple.Create(" for=\"", 57293), Tuple.Create("\"", 57366)
|
||||||
, Tuple.Create(Tuple.Create("", 57296), Tuple.Create("DeviceProfile_Decommission_Dialog_Reason_", 57296), true)
|
, Tuple.Create(Tuple.Create("", 57299), Tuple.Create("DeviceProfile_Decommission_Dialog_Reason_", 57299), true)
|
||||||
|
|
||||||
#line 1026 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 1010 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 57337), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
, Tuple.Create(Tuple.Create("", 57340), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 57337), false)
|
, 57340), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">");
|
WriteLiteral(">");
|
||||||
|
|
||||||
|
|
||||||
#line 1026 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 1010 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
Write(decommissionReason.ReasonMessage());
|
Write(decommissionReason.ReasonMessage());
|
||||||
|
|
||||||
|
|
||||||
@@ -3134,7 +3093,7 @@ WriteLiteral(">");
|
|||||||
WriteLiteral("</label>\r\n </li>\r\n");
|
WriteLiteral("</label>\r\n </li>\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 </div>\r\n");
|
"\r\n </div>\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(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 1068 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 1052 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
if (canDelete)
|
if (canDelete)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral(" <button");
|
||||||
|
|
||||||
|
WriteLiteral(" id=\"buttonDelete\"");
|
||||||
|
|
||||||
|
WriteLiteral(" type=\"button\"");
|
||||||
|
|
||||||
|
WriteLiteral(" class=\"button\"");
|
||||||
|
|
||||||
|
WriteLiteral(">Delete</button>\r\n");
|
||||||
|
|
||||||
|
WriteLiteral(" <div");
|
||||||
|
|
||||||
|
WriteLiteral(" id=\"dialogConfirmDelete\"");
|
||||||
|
|
||||||
|
WriteLiteral(" class=\"dialog\"");
|
||||||
|
|
||||||
|
WriteLiteral(" title=\"Delete this Device Profile?\"");
|
||||||
|
|
||||||
|
WriteLiteral(">\r\n");
|
||||||
|
|
||||||
|
|
||||||
|
#line 1056 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 1070 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 1056 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
Write(Html.ActionLinkButton("Delete", MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true), "buttonDelete"));
|
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 default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 1070 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 1058 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral(" <p>\r\n <i");
|
||||||
|
|
||||||
|
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg warning\"");
|
||||||
|
|
||||||
|
WriteLiteral("></i>\r\n This item will be permanently deleted and cannot be recove" +
|
||||||
|
"red. Are you sure?\r\n </p>\r\n </div>\r\n");
|
||||||
|
|
||||||
|
WriteLiteral(" <script");
|
||||||
|
|
||||||
|
WriteLiteral(" type=\"text/javascript\"");
|
||||||
|
|
||||||
|
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');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
");
|
||||||
|
|
||||||
|
|
||||||
|
#line 1092 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3231,7 +3271,7 @@ WriteLiteral(" ");
|
|||||||
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))
|
if (Authorization.Has(Claims.Device.Actions.Export))
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -3239,14 +3279,14 @@ WriteLiteral(" ");
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#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)));
|
Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.DeviceExportTypes.Profile, Model.DeviceProfile.Id)));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 1074 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 1095 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3256,7 +3296,7 @@ WriteLiteral(" ");
|
|||||||
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)
|
if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -3264,14 +3304,14 @@ WriteLiteral(" ");
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#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")));
|
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 default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 1078 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
#line 1099 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
}
|
}
|
||||||
<div id="DocumentTemplate_BulkGenerate">
|
<div id="DocumentTemplate_BulkGenerate">
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
@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)
|
if (Model.TemplatePageCount > 1 && Model.TemplatePageCount % 2 != 0)
|
||||||
{
|
{
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
<div class="example3 code">user6;smi0099;@(ActiveDirectory.Context.PrimaryDomain.NetBiosName)\rsmith;Domain Admins</div>
|
<div class="example3 code">user6;smi0099;@(ActiveDirectory.Context.PrimaryDomain.NetBiosName)\rsmith;Domain Admins</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUsers(), FormMethod.Post))
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUsers()))
|
||||||
{
|
{
|
||||||
<div class="field-validation-valid" data-valmsg-replace="true" data-valmsg-for="userIds"></div>
|
<div class="field-validation-valid" data-valmsg-replace="true" data-valmsg-for="userIds"></div>
|
||||||
<textarea id="inputBulkGenerateDataIds" name="userIds" data-val="true" data-val-required="Identifiers are required" required></textarea>
|
<textarea id="inputBulkGenerateDataIds" name="userIds" data-val="true" data-val-required="Identifiers are required" required></textarea>
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
Add all members of a group (including recursive members) to the bulk generation.
|
Add all members of a group (including recursive members) to the bulk generation.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddGroupMembers(), FormMethod.Post))
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddGroupMembers()))
|
||||||
{
|
{
|
||||||
<table class="input">
|
<table class="input">
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
Add all users associated with the flag to the bulk generation.
|
Add all users associated with the flag to the bulk generation.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUserFlag(), FormMethod.Post))
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUserFlag()))
|
||||||
{
|
{
|
||||||
<input name="flagId" type="hidden" required />
|
<input name="flagId" type="hidden" required />
|
||||||
<div class="dialog-item-picker">
|
<div class="dialog-item-picker">
|
||||||
@@ -144,7 +144,7 @@
|
|||||||
Add all users associated with a device in the selected profile to the bulk generation.
|
Add all users associated with a device in the selected profile to the bulk generation.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceProfile(), FormMethod.Post))
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceProfile()))
|
||||||
{
|
{
|
||||||
<input name="deviceProfileId" type="hidden" required />
|
<input name="deviceProfileId" type="hidden" required />
|
||||||
<div class="dialog-item-picker">
|
<div class="dialog-item-picker">
|
||||||
@@ -168,7 +168,7 @@
|
|||||||
Add all users associated with a device in the selected batch to the bulk generation.
|
Add all users associated with a device in the selected batch to the bulk generation.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceBatch(), FormMethod.Post))
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDeviceBatch()))
|
||||||
{
|
{
|
||||||
<input name="deviceBatchId" type="hidden" required />
|
<input name="deviceBatchId" type="hidden" required />
|
||||||
<div class="dialog-item-picker">
|
<div class="dialog-item-picker">
|
||||||
@@ -192,7 +192,7 @@
|
|||||||
Add all users associated with an attachment of the selected document template to the bulk generation.
|
Add all users associated with an attachment of the selected document template to the bulk generation.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDocumentAttachment(), FormMethod.Post))
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddDocumentAttachment()))
|
||||||
{
|
{
|
||||||
<input name="documentTemplateId" type="hidden" required />
|
<input name="documentTemplateId" type="hidden" required />
|
||||||
<div class="dialog-item-picker">
|
<div class="dialog-item-picker">
|
||||||
@@ -220,7 +220,7 @@
|
|||||||
Add all users with a matching user detail to the bulk generation.
|
Add all users with a matching user detail to the bulk generation.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUserDetail(), FormMethod.Post))
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateAddUserDetail()))
|
||||||
{
|
{
|
||||||
<input name="key" type="hidden" required />
|
<input name="key" type="hidden" required />
|
||||||
<input name="value" type="hidden" />
|
<input name="value" type="hidden" />
|
||||||
@@ -236,7 +236,7 @@
|
|||||||
|
|
||||||
@Html.AntiForgeryToken()
|
@Html.AntiForgeryToken()
|
||||||
}
|
}
|
||||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateGetUserDetailValues(), FormMethod.Post))
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateGetUserDetailValues()))
|
||||||
{
|
{
|
||||||
<input name="key" type="hidden" required />
|
<input name="key" type="hidden" required />
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ WriteLiteral(">\r\n");
|
|||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 11 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#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)
|
if (Model.TemplatePageCount > 1 && Model.TemplatePageCount % 2 != 0)
|
||||||
{
|
{
|
||||||
@@ -314,17 +314,17 @@ WriteLiteral(" id=\"DocumentTemplate_BulkGenerate_Dialog_AddUsers\"");
|
|||||||
|
|
||||||
WriteLiteral(" class=\"dialog dialog-bulk-generate\"");
|
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"
|
#line 62 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 2925), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
, Tuple.Create(Tuple.Create("", 2908), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 2925), false)
|
, 2908), false)
|
||||||
, Tuple.Create(Tuple.Create("", 2962), Tuple.Create(":", 2962), true)
|
, Tuple.Create(Tuple.Create("", 2945), Tuple.Create(":", 2945), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 2963), Tuple.Create("Add", 2964), true)
|
, Tuple.Create(Tuple.Create(" ", 2946), Tuple.Create("Add", 2947), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 2967), Tuple.Create("Users", 2968), true)
|
, Tuple.Create(Tuple.Create(" ", 2950), Tuple.Create("Users", 2951), true)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">\r\n <div");
|
WriteLiteral(">\r\n <div");
|
||||||
@@ -396,7 +396,7 @@ WriteLiteral("\\rsmith;Domain Admins</div>\r\n </div>\r\n </div>\r\n")
|
|||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 82 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#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\"");
|
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"
|
#line 90 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 4445), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
, Tuple.Create(Tuple.Create("", 4411), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 4445), false)
|
, 4411), false)
|
||||||
, Tuple.Create(Tuple.Create("", 4482), Tuple.Create(":", 4482), true)
|
, Tuple.Create(Tuple.Create("", 4448), Tuple.Create(":", 4448), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 4483), Tuple.Create("Add", 4484), true)
|
, Tuple.Create(Tuple.Create(" ", 4449), Tuple.Create("Add", 4450), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 4487), Tuple.Create("Group", 4488), true)
|
, Tuple.Create(Tuple.Create(" ", 4453), Tuple.Create("Group", 4454), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 4493), Tuple.Create("Members", 4494), true)
|
, Tuple.Create(Tuple.Create(" ", 4459), Tuple.Create("Members", 4460), true)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">\r\n <div");
|
WriteLiteral(">\r\n <div");
|
||||||
@@ -480,7 +480,7 @@ WriteLiteral(">\r\n <div>\r\n Add all members of a group (incl
|
|||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 96 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#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\"");
|
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"
|
#line 116 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 5547), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
, Tuple.Create(Tuple.Create("", 5496), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 5547), false)
|
, 5496), false)
|
||||||
, Tuple.Create(Tuple.Create("", 5584), Tuple.Create(":", 5584), true)
|
, Tuple.Create(Tuple.Create("", 5533), Tuple.Create(":", 5533), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 5585), Tuple.Create("Add", 5586), true)
|
, Tuple.Create(Tuple.Create(" ", 5534), Tuple.Create("Add", 5535), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 5589), Tuple.Create("User", 5590), true)
|
, Tuple.Create(Tuple.Create(" ", 5538), Tuple.Create("User", 5539), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 5594), Tuple.Create("Flag", 5595), true)
|
, Tuple.Create(Tuple.Create(" ", 5543), Tuple.Create("Flag", 5544), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 5599), Tuple.Create("Assignments", 5600), true)
|
, Tuple.Create(Tuple.Create(" ", 5548), Tuple.Create("Assignments", 5549), true)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">\r\n <div");
|
WriteLiteral(">\r\n <div");
|
||||||
@@ -585,7 +585,7 @@ WriteLiteral(">\r\n <div>\r\n Add all users associated
|
|||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 122 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#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
|
#line hidden
|
||||||
WriteLiteral(" <div");
|
WriteLiteral(" <div");
|
||||||
|
|
||||||
WriteAttribute("class", Tuple.Create(" class=\"", 6097), Tuple.Create("\"", 6148)
|
WriteAttribute("class", Tuple.Create(" class=\"", 6029), Tuple.Create("\"", 6080)
|
||||||
, Tuple.Create(Tuple.Create("", 6105), Tuple.Create("item", 6105), true)
|
, Tuple.Create(Tuple.Create("", 6037), Tuple.Create("item", 6037), true)
|
||||||
|
|
||||||
#line 128 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#line 128 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create(" ", 6109), Tuple.Create<System.Object, System.Int32>(flag.Count == 0 ? "disabled" : null
|
, Tuple.Create(Tuple.Create(" ", 6041), Tuple.Create<System.Object, System.Int32>(flag.Count == 0 ? "disabled" : null
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 6110), false)
|
, 6042), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" data-userflagid=\"");
|
WriteLiteral(" data-userflagid=\"");
|
||||||
@@ -645,26 +645,26 @@ WriteLiteral("\"");
|
|||||||
|
|
||||||
WriteLiteral(">\r\n <i");
|
WriteLiteral(">\r\n <i");
|
||||||
|
|
||||||
WriteAttribute("class", Tuple.Create(" class=\"", 6210), Tuple.Create("\"", 6279)
|
WriteAttribute("class", Tuple.Create(" class=\"", 6142), Tuple.Create("\"", 6211)
|
||||||
, Tuple.Create(Tuple.Create("", 6218), Tuple.Create("fa", 6218), true)
|
, Tuple.Create(Tuple.Create("", 6150), Tuple.Create("fa", 6150), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 6220), Tuple.Create("fa-", 6221), true)
|
, Tuple.Create(Tuple.Create(" ", 6152), Tuple.Create("fa-", 6153), true)
|
||||||
|
|
||||||
#line 129 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#line 129 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 6224), Tuple.Create<System.Object, System.Int32>(flag.Item.Icon
|
, Tuple.Create(Tuple.Create("", 6156), Tuple.Create<System.Object, System.Int32>(flag.Item.Icon
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 6224), false)
|
, 6156), false)
|
||||||
, Tuple.Create(Tuple.Create(" ", 6241), Tuple.Create("fa-fw", 6242), true)
|
, Tuple.Create(Tuple.Create(" ", 6173), Tuple.Create("fa-fw", 6174), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 6247), Tuple.Create("fa-lg", 6248), true)
|
, Tuple.Create(Tuple.Create(" ", 6179), Tuple.Create("fa-lg", 6180), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 6253), Tuple.Create("d-", 6254), true)
|
, Tuple.Create(Tuple.Create(" ", 6185), Tuple.Create("d-", 6186), true)
|
||||||
|
|
||||||
#line 129 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#line 129 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 6256), Tuple.Create<System.Object, System.Int32>(flag.Item.IconColour
|
, Tuple.Create(Tuple.Create("", 6188), Tuple.Create<System.Object, System.Int32>(flag.Item.IconColour
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 6256), false)
|
, 6188), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral("></i>");
|
WriteLiteral("></i>");
|
||||||
@@ -752,21 +752,21 @@ WriteLiteral(" id=\"DocumentTemplate_BulkGenerate_Dialog_AddDeviceProfile\"");
|
|||||||
|
|
||||||
WriteLiteral(" class=\"dialog dialog-bulk-generate\"");
|
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"
|
#line 141 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 6681), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
, Tuple.Create(Tuple.Create("", 6613), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 6681), false)
|
, 6613), false)
|
||||||
, Tuple.Create(Tuple.Create("", 6718), Tuple.Create(":", 6718), true)
|
, Tuple.Create(Tuple.Create("", 6650), Tuple.Create(":", 6650), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 6719), Tuple.Create("Add", 6720), true)
|
, Tuple.Create(Tuple.Create(" ", 6651), Tuple.Create("Add", 6652), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 6723), Tuple.Create("User", 6724), true)
|
, Tuple.Create(Tuple.Create(" ", 6655), Tuple.Create("User", 6656), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 6728), Tuple.Create("by", 6729), true)
|
, Tuple.Create(Tuple.Create(" ", 6660), Tuple.Create("by", 6661), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 6731), Tuple.Create("Assigned", 6732), true)
|
, Tuple.Create(Tuple.Create(" ", 6663), Tuple.Create("Assigned", 6664), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 6740), Tuple.Create("Device", 6741), true)
|
, Tuple.Create(Tuple.Create(" ", 6672), Tuple.Create("Device", 6673), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 6747), Tuple.Create("Profile", 6748), true)
|
, Tuple.Create(Tuple.Create(" ", 6679), Tuple.Create("Profile", 6680), true)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">\r\n <div");
|
WriteLiteral(">\r\n <div");
|
||||||
@@ -785,7 +785,7 @@ WriteLiteral(">\r\n <div>\r\n Add all users associated
|
|||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 147 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#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
|
#line hidden
|
||||||
WriteLiteral(" <div");
|
WriteLiteral(" <div");
|
||||||
|
|
||||||
WriteAttribute("class", Tuple.Create(" class=\"", 7287), Tuple.Create("\"", 7341)
|
WriteAttribute("class", Tuple.Create(" class=\"", 7202), Tuple.Create("\"", 7256)
|
||||||
, Tuple.Create(Tuple.Create("", 7295), Tuple.Create("item", 7295), true)
|
, Tuple.Create(Tuple.Create("", 7210), Tuple.Create("item", 7210), true)
|
||||||
|
|
||||||
#line 153 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#line 153 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create(" ", 7299), Tuple.Create<System.Object, System.Int32>(profile.Count == 0 ? "disabled" : null
|
, Tuple.Create(Tuple.Create(" ", 7214), Tuple.Create<System.Object, System.Int32>(profile.Count == 0 ? "disabled" : null
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 7300), false)
|
, 7215), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" data-id=\"");
|
WriteLiteral(" data-id=\"");
|
||||||
@@ -931,21 +931,21 @@ WriteLiteral(" id=\"DocumentTemplate_BulkGenerate_Dialog_AddDeviceBatch\"");
|
|||||||
|
|
||||||
WriteLiteral(" class=\"dialog dialog-bulk-generate\"");
|
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"
|
#line 165 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 7833), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
, Tuple.Create(Tuple.Create("", 7748), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 7833), false)
|
, 7748), false)
|
||||||
, Tuple.Create(Tuple.Create("", 7870), Tuple.Create(":", 7870), true)
|
, Tuple.Create(Tuple.Create("", 7785), Tuple.Create(":", 7785), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 7871), Tuple.Create("Add", 7872), true)
|
, Tuple.Create(Tuple.Create(" ", 7786), Tuple.Create("Add", 7787), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 7875), Tuple.Create("User", 7876), true)
|
, Tuple.Create(Tuple.Create(" ", 7790), Tuple.Create("User", 7791), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 7880), Tuple.Create("by", 7881), true)
|
, Tuple.Create(Tuple.Create(" ", 7795), Tuple.Create("by", 7796), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 7883), Tuple.Create("Assigned", 7884), true)
|
, Tuple.Create(Tuple.Create(" ", 7798), Tuple.Create("Assigned", 7799), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 7892), Tuple.Create("Device", 7893), true)
|
, Tuple.Create(Tuple.Create(" ", 7807), Tuple.Create("Device", 7808), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 7899), Tuple.Create("Batch", 7900), true)
|
, Tuple.Create(Tuple.Create(" ", 7814), Tuple.Create("Batch", 7815), true)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">\r\n <div");
|
WriteLiteral(">\r\n <div");
|
||||||
@@ -963,7 +963,7 @@ WriteLiteral(">\r\n <div>\r\n Add all users associated
|
|||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 171 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#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
|
#line hidden
|
||||||
WriteLiteral(" <div");
|
WriteLiteral(" <div");
|
||||||
|
|
||||||
WriteAttribute("class", Tuple.Create(" class=\"", 8428), Tuple.Create("\"", 8480)
|
WriteAttribute("class", Tuple.Create(" class=\"", 8326), Tuple.Create("\"", 8378)
|
||||||
, Tuple.Create(Tuple.Create("", 8436), Tuple.Create("item", 8436), true)
|
, Tuple.Create(Tuple.Create("", 8334), Tuple.Create("item", 8334), true)
|
||||||
|
|
||||||
#line 177 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#line 177 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create(" ", 8440), Tuple.Create<System.Object, System.Int32>(batch.Count == 0 ? "disabled" : null
|
, Tuple.Create(Tuple.Create(" ", 8338), Tuple.Create<System.Object, System.Int32>(batch.Count == 0 ? "disabled" : null
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 8441), false)
|
, 8339), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" data-id=\"");
|
WriteLiteral(" data-id=\"");
|
||||||
@@ -1109,21 +1109,21 @@ WriteLiteral(" id=\"DocumentTemplate_BulkGenerate_Dialog_AddDocumentAttachment\"
|
|||||||
|
|
||||||
WriteLiteral(" class=\"dialog dialog-bulk-generate\"");
|
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"
|
#line 189 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 8975), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
, Tuple.Create(Tuple.Create("", 8873), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 8975), false)
|
, 8873), false)
|
||||||
, Tuple.Create(Tuple.Create("", 9012), Tuple.Create(":", 9012), true)
|
, Tuple.Create(Tuple.Create("", 8910), Tuple.Create(":", 8910), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 9013), Tuple.Create("Add", 9014), true)
|
, Tuple.Create(Tuple.Create(" ", 8911), Tuple.Create("Add", 8912), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 9017), Tuple.Create("User", 9018), true)
|
, Tuple.Create(Tuple.Create(" ", 8915), Tuple.Create("User", 8916), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 9022), Tuple.Create("by", 9023), true)
|
, Tuple.Create(Tuple.Create(" ", 8920), Tuple.Create("by", 8921), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 9025), Tuple.Create("Assigned", 9026), true)
|
, Tuple.Create(Tuple.Create(" ", 8923), Tuple.Create("Assigned", 8924), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 9034), Tuple.Create("Device", 9035), true)
|
, Tuple.Create(Tuple.Create(" ", 8932), Tuple.Create("Device", 8933), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 9041), Tuple.Create("Batch", 9042), true)
|
, Tuple.Create(Tuple.Create(" ", 8939), Tuple.Create("Batch", 8940), true)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">\r\n <div");
|
WriteLiteral(">\r\n <div");
|
||||||
@@ -1142,7 +1142,7 @@ WriteLiteral(">\r\n <div>\r\n Add all users associated
|
|||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 195 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#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
|
#line hidden
|
||||||
WriteLiteral(" <div");
|
WriteLiteral(" <div");
|
||||||
|
|
||||||
WriteAttribute("class", Tuple.Create(" class=\"", 9606), Tuple.Create("\"", 9661)
|
WriteAttribute("class", Tuple.Create(" class=\"", 9487), Tuple.Create("\"", 9542)
|
||||||
, Tuple.Create(Tuple.Create("", 9614), Tuple.Create("item", 9614), true)
|
, Tuple.Create(Tuple.Create("", 9495), Tuple.Create("item", 9495), true)
|
||||||
|
|
||||||
#line 201 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#line 201 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create(" ", 9618), Tuple.Create<System.Object, System.Int32>(template.Count == 0 ? "disabled" : null
|
, Tuple.Create(Tuple.Create(" ", 9499), Tuple.Create<System.Object, System.Int32>(template.Count == 0 ? "disabled" : null
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 9619), false)
|
, 9500), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" data-id=\"");
|
WriteLiteral(" data-id=\"");
|
||||||
@@ -1316,19 +1316,19 @@ WriteLiteral(" id=\"DocumentTemplate_BulkGenerate_Dialog_AddUserDetail\"");
|
|||||||
|
|
||||||
WriteLiteral(" class=\"dialog dialog-bulk-generate\"");
|
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"
|
#line 217 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 10525), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
, Tuple.Create(Tuple.Create("", 10406), Tuple.Create<System.Object, System.Int32>(Model.DocumentTemplate.Description
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 10525), false)
|
, 10406), false)
|
||||||
, Tuple.Create(Tuple.Create("", 10562), Tuple.Create(":", 10562), true)
|
, Tuple.Create(Tuple.Create("", 10443), Tuple.Create(":", 10443), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 10563), Tuple.Create("Add", 10564), true)
|
, Tuple.Create(Tuple.Create(" ", 10444), Tuple.Create("Add", 10445), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 10567), Tuple.Create("User", 10568), true)
|
, Tuple.Create(Tuple.Create(" ", 10448), Tuple.Create("User", 10449), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 10572), Tuple.Create("by", 10573), true)
|
, Tuple.Create(Tuple.Create(" ", 10453), Tuple.Create("by", 10454), true)
|
||||||
, Tuple.Create(Tuple.Create(" ", 10575), Tuple.Create("Detail", 10576), true)
|
, Tuple.Create(Tuple.Create(" ", 10456), Tuple.Create("Detail", 10457), true)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">\r\n <div");
|
WriteLiteral(">\r\n <div");
|
||||||
@@ -1346,7 +1346,7 @@ WriteLiteral(">\r\n <div>\r\n Add all users with a mat
|
|||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 223 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#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
|
#line hidden
|
||||||
WriteLiteral(" <div");
|
WriteLiteral(" <div");
|
||||||
|
|
||||||
WriteAttribute("class", Tuple.Create(" class=\"", 11216), Tuple.Create("\"", 11266)
|
WriteAttribute("class", Tuple.Create(" class=\"", 11080), Tuple.Create("\"", 11130)
|
||||||
, Tuple.Create(Tuple.Create("", 11224), Tuple.Create("item", 11224), true)
|
, Tuple.Create(Tuple.Create("", 11088), Tuple.Create("item", 11088), true)
|
||||||
|
|
||||||
#line 231 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#line 231 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
, Tuple.Create(Tuple.Create(" ", 11228), Tuple.Create<System.Object, System.Int32>(key.Count == 0 ? "disabled" : null
|
, Tuple.Create(Tuple.Create(" ", 11092), Tuple.Create<System.Object, System.Int32>(key.Count == 0 ? "disabled" : null
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 11229), false)
|
, 11093), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" data-id=\"");
|
WriteLiteral(" data-id=\"");
|
||||||
@@ -1491,7 +1491,7 @@ WriteLiteral(" ");
|
|||||||
|
|
||||||
|
|
||||||
#line 239 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
#line 239 "..\..\Areas\Config\Views\DocumentTemplate\BulkGenerate.cshtml"
|
||||||
using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateGetUserDetailValues(), FormMethod.Post))
|
using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerateGetUserDetailValues()))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,28 @@
|
|||||||
@model Disco.Web.Areas.Config.Models.DocumentTemplate.CreateModel
|
@model Disco.Web.Areas.Config.Models.DocumentTemplate.CreateModel
|
||||||
@{
|
@{
|
||||||
Authorization.RequireAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure);
|
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");
|
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" }))
|
@using (Html.BeginForm(MVC.Config.DocumentTemplate.Create(), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||||||
{
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
<div class="form" style="width: 650px">
|
<div class="form" style="width: 650px">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
Id:
|
Id:
|
||||||
</th>
|
</th>
|
||||||
<td>@Html.TextBoxFor(model => model.DocumentTemplate.Id)<br />@Html.ValidationMessageFor(model => model.DocumentTemplate.Id)
|
<td>
|
||||||
|
@Html.TextBoxFor(model => model.Id)<br />@Html.ValidationMessageFor(model => model.Id)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
Description:
|
Description:
|
||||||
</th>
|
</th>
|
||||||
<td>@Html.TextBoxFor(model => model.DocumentTemplate.Description)<br />@Html.ValidationMessageFor(model => model.DocumentTemplate.Description)
|
<td>
|
||||||
|
@Html.TextBoxFor(model => model.Description)<br />@Html.ValidationMessageFor(model => model.Description)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -27,7 +30,7 @@
|
|||||||
Scope:
|
Scope:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.DropDownListFor(model => model.DocumentTemplate.Scope, Model.Scopes.ToSelectListItems(null))
|
@Html.DropDownListFor(model => model.Scope, Model.Scopes.ToSelectListItems(null))
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -52,12 +55,13 @@
|
|||||||
<th class="name">
|
<th class="name">
|
||||||
@jt.Description<br />
|
@jt.Description<br />
|
||||||
Sub Types<br />
|
Sub Types<br />
|
||||||
@CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id))
|
@CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id))
|
||||||
</th>
|
</th>
|
||||||
<td class="value">
|
<td class="value">
|
||||||
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.Where(jst => jst.JobTypeId == jt.Id).ToList().ToSelectListItems(Model.SubTypes), 2)
|
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.Where(jst => jst.JobTypeId == jt.Id).ToList().ToSelectListItems(Model.SubTypes), 2)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
}
|
}
|
||||||
</table>
|
</table>
|
||||||
<p class="actions">
|
<p class="actions">
|
||||||
@@ -68,7 +72,7 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
$('#Name').focus().select();
|
$('#Name').focus().select();
|
||||||
|
|
||||||
var $scope = $('#DocumentTemplate_Scope');
|
var $scope = $('#Scope');
|
||||||
var $trJobTypes = $('#trJobTypes');
|
var $trJobTypes = $('#trJobTypes');
|
||||||
var $jobTypes = $trJobTypes.find('input[type="checkbox"]');
|
var $jobTypes = $trJobTypes.find('input[type="checkbox"]');
|
||||||
$scope.change(scopeChange);
|
$scope.change(scopeChange);
|
||||||
@@ -89,10 +93,10 @@
|
|||||||
function jobTypesChange() {
|
function jobTypesChange() {
|
||||||
$('.jobSubTypes').hide();
|
$('.jobSubTypes').hide();
|
||||||
$jobTypes.filter(':checked').each(function () {
|
$jobTypes.filter(':checked').each(function () {
|
||||||
$('#trJobSubType' + $(this).val()).show();
|
$('#trJobSubType' + $(this).val()).show();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
|
|||||||
#line 2 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
#line 2 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
|
|
||||||
Authorization.RequireAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure);
|
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");
|
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"
|
#line 7 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
using (Html.BeginForm(MVC.Config.DocumentTemplate.Create(), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
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
|
#line default
|
||||||
@@ -70,11 +84,13 @@ WriteLiteral(" class=\"form\"");
|
|||||||
WriteLiteral(" style=\"width: 650px\"");
|
WriteLiteral(" style=\"width: 650px\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n I" +
|
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n I" +
|
||||||
"d:\r\n </th>\r\n <td>");
|
"d:\r\n </th>\r\n <td>\r\n");
|
||||||
|
|
||||||
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 15 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
#line 17 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
Write(Html.TextBoxFor(model => model.DocumentTemplate.Id));
|
Write(Html.TextBoxFor(model => model.Id));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -82,19 +98,21 @@ WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r
|
|||||||
WriteLiteral("<br />");
|
WriteLiteral("<br />");
|
||||||
|
|
||||||
|
|
||||||
#line 15 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
#line 17 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.DocumentTemplate.Id));
|
Write(Html.ValidationMessageFor(model => model.Id));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
||||||
">\r\n Description:\r\n </th>\r\n <td>" +
|
">\r\n Description:\r\n </th>\r\n <td>" +
|
||||||
"");
|
"\r\n");
|
||||||
|
|
||||||
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 22 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
#line 25 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
Write(Html.TextBoxFor(model => model.DocumentTemplate.Description));
|
Write(Html.TextBoxFor(model => model.Description));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -102,8 +120,8 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
|||||||
WriteLiteral("<br />");
|
WriteLiteral("<br />");
|
||||||
|
|
||||||
|
|
||||||
#line 22 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
#line 25 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.DocumentTemplate.Description));
|
Write(Html.ValidationMessageFor(model => model.Description));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -114,8 +132,8 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 30 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
#line 33 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
Write(Html.DropDownListFor(model => model.DocumentTemplate.Scope, Model.Scopes.ToSelectListItems(null)));
|
Write(Html.DropDownListFor(model => model.Scope, Model.Scopes.ToSelectListItems(null)));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -133,7 +151,7 @@ WriteLiteral(" accept=\".pdf\"");
|
|||||||
WriteLiteral(" /><br />");
|
WriteLiteral(" /><br />");
|
||||||
|
|
||||||
|
|
||||||
#line 38 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
#line 41 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
Write(Html.ValidationMessage("Template"));
|
Write(Html.ValidationMessage("Template"));
|
||||||
|
|
||||||
|
|
||||||
@@ -156,7 +174,7 @@ WriteLiteral(">\r\n");
|
|||||||
WriteLiteral(" ");
|
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));
|
Write(CommonHelpers.CheckBoxList("Types", Model.JobTypes.ToSelectListItems(Model.Types), 2));
|
||||||
|
|
||||||
|
|
||||||
@@ -165,13 +183,13 @@ WriteLiteral(" ");
|
|||||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 49 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
#line 52 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 49 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
#line 52 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
foreach (var jt in Model.JobTypes)
|
foreach (var jt in Model.JobTypes)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -180,15 +198,15 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" <tr");
|
WriteLiteral(" <tr");
|
||||||
|
|
||||||
WriteAttribute("id", Tuple.Create(" id=\"", 2046), Tuple.Create("\"", 2071)
|
WriteAttribute("id", Tuple.Create(" id=\"", 2030), Tuple.Create("\"", 2055)
|
||||||
, Tuple.Create(Tuple.Create("", 2051), Tuple.Create("trJobSubType", 2051), true)
|
, Tuple.Create(Tuple.Create("", 2035), Tuple.Create("trJobSubType", 2035), true)
|
||||||
|
|
||||||
#line 51 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
#line 54 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 2063), Tuple.Create<System.Object, System.Int32>(jt.Id
|
, Tuple.Create(Tuple.Create("", 2047), Tuple.Create<System.Object, System.Int32>(jt.Id
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 2063), false)
|
, 2047), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" class=\"jobSubTypes\"");
|
WriteLiteral(" class=\"jobSubTypes\"");
|
||||||
@@ -202,7 +220,7 @@ WriteLiteral(">\r\n");
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 53 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
#line 56 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
Write(jt.Description);
|
Write(jt.Description);
|
||||||
|
|
||||||
|
|
||||||
@@ -210,11 +228,11 @@ WriteLiteral(" ");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("<br />\r\n Sub Types<br />\r\n");
|
WriteLiteral("<br />\r\n Sub Types<br />\r\n");
|
||||||
|
|
||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 55 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
#line 58 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
Write(CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id)));
|
Write(CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id)));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -228,16 +246,17 @@ WriteLiteral(">\r\n");
|
|||||||
WriteLiteral(" ");
|
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));
|
Write(CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.Where(jst => jst.JobTypeId == jt.Id).ToList().ToSelectListItems(Model.SubTypes), 2));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n </td>\r\n </tr> \r\n");
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 61 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
#line 64 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -265,7 +284,7 @@ WriteLiteral(@">
|
|||||||
$(function () {
|
$(function () {
|
||||||
$('#Name').focus().select();
|
$('#Name').focus().select();
|
||||||
|
|
||||||
var $scope = $('#DocumentTemplate_Scope');
|
var $scope = $('#Scope');
|
||||||
var $trJobTypes = $('#trJobTypes');
|
var $trJobTypes = $('#trJobTypes');
|
||||||
var $jobTypes = $trJobTypes.find('input[type=""checkbox""]');
|
var $jobTypes = $trJobTypes.find('input[type=""checkbox""]');
|
||||||
$scope.change(scopeChange);
|
$scope.change(scopeChange);
|
||||||
@@ -286,7 +305,7 @@ WriteLiteral(@">
|
|||||||
function jobTypesChange() {
|
function jobTypesChange() {
|
||||||
$('.jobSubTypes').hide();
|
$('.jobSubTypes').hide();
|
||||||
$jobTypes.filter(':checked').each(function () {
|
$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 default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|||||||
@@ -1,25 +1,28 @@
|
|||||||
@model Disco.Web.Areas.Config.Models.DocumentTemplate.CreatePackageModel
|
@model Disco.Web.Areas.Config.Models.DocumentTemplate.CreatePackageModel
|
||||||
@{
|
@{
|
||||||
Authorization.RequireAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure);
|
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");
|
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()))
|
@using (Html.BeginForm(MVC.Config.DocumentTemplate.CreatePackage()))
|
||||||
{
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
<div class="form" style="width: 650px">
|
<div class="form" style="width: 650px">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
Id:
|
Id:
|
||||||
</th>
|
</th>
|
||||||
<td>@Html.TextBoxFor(model => model.Package.Id)<br />@Html.ValidationMessageFor(model => model.Package.Id)
|
<td>
|
||||||
|
@Html.TextBoxFor(model => model.Id)<br />@Html.ValidationMessageFor(model => model.Id)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>
|
<th>
|
||||||
Description:
|
Description:
|
||||||
</th>
|
</th>
|
||||||
<td>@Html.TextBoxFor(model => model.Package.Description)<br />@Html.ValidationMessageFor(model => model.Package.Description)
|
<td>
|
||||||
|
@Html.TextBoxFor(model => model.Description)<br />@Html.ValidationMessageFor(model => model.Description)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -27,7 +30,7 @@
|
|||||||
Scope:
|
Scope:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.DropDownListFor(model => model.Package.Scope, Model.Scopes.ToSelectListItems(null))
|
@Html.DropDownListFor(model => model.Scope, Model.Scopes.ToSelectListItems(null))
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
|
|||||||
#line 2 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
#line 2 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
||||||
|
|
||||||
Authorization.RequireAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure);
|
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");
|
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"
|
#line 7 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
||||||
using (Html.BeginForm(MVC.Config.DocumentTemplate.CreatePackage()))
|
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
|
#line default
|
||||||
@@ -70,11 +84,13 @@ WriteLiteral(" class=\"form\"");
|
|||||||
WriteLiteral(" style=\"width: 650px\"");
|
WriteLiteral(" style=\"width: 650px\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n I" +
|
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n I" +
|
||||||
"d:\r\n </th>\r\n <td>");
|
"d:\r\n </th>\r\n <td>\r\n");
|
||||||
|
|
||||||
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 15 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
#line 17 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
||||||
Write(Html.TextBoxFor(model => model.Package.Id));
|
Write(Html.TextBoxFor(model => model.Id));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -82,19 +98,21 @@ WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r
|
|||||||
WriteLiteral("<br />");
|
WriteLiteral("<br />");
|
||||||
|
|
||||||
|
|
||||||
#line 15 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
#line 17 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.Package.Id));
|
Write(Html.ValidationMessageFor(model => model.Id));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
|
||||||
">\r\n Description:\r\n </th>\r\n <td>" +
|
">\r\n Description:\r\n </th>\r\n <td>" +
|
||||||
"");
|
"\r\n");
|
||||||
|
|
||||||
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 22 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
#line 25 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
||||||
Write(Html.TextBoxFor(model => model.Package.Description));
|
Write(Html.TextBoxFor(model => model.Description));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -102,8 +120,8 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
|||||||
WriteLiteral("<br />");
|
WriteLiteral("<br />");
|
||||||
|
|
||||||
|
|
||||||
#line 22 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
#line 25 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
||||||
Write(Html.ValidationMessageFor(model => model.Package.Description));
|
Write(Html.ValidationMessageFor(model => model.Description));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -114,8 +132,8 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 30 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
#line 33 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
||||||
Write(Html.DropDownListFor(model => model.Package.Scope, Model.Scopes.ToSelectListItems(null)));
|
Write(Html.DropDownListFor(model => model.Scope, Model.Scopes.ToSelectListItems(null)));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -135,7 +153,7 @@ WriteLiteral(" value=\"Create\"");
|
|||||||
WriteLiteral(" />\r\n </p>\r\n </div>\r\n");
|
WriteLiteral(" />\r\n </p>\r\n </div>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 38 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
#line 41 "..\..\Areas\Config\Views\DocumentTemplate\CreatePackage.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
Documents Imported Today
|
Documents Imported Today
|
||||||
</h2>
|
</h2>
|
||||||
<div id="importStatus">
|
<div id="importStatus">
|
||||||
@Html.AntiForgeryToken()
|
|
||||||
<div id="noSessions" data-bind="visible: noSessions">
|
<div id="noSessions" data-bind="visible: noSessions">
|
||||||
<h3>No imported documents today</h3>
|
<h3>No imported documents today</h3>
|
||||||
</div>
|
</div>
|
||||||
@@ -285,7 +284,7 @@
|
|||||||
End: null,
|
End: null,
|
||||||
ModuleId: 40,
|
ModuleId: 40,
|
||||||
Take: 2000,
|
Take: 2000,
|
||||||
'__RequestVerificationToken': host.find('input[name="__RequestVerificationToken"]').val()
|
'__RequestVerificationToken': document.body.dataset.antiforgery
|
||||||
};
|
};
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '@(Url.Action(MVC.API.Logging.RetrieveEvents()))',
|
url: '@(Url.Action(MVC.API.Logging.RetrieveEvents()))',
|
||||||
|
|||||||
@@ -59,18 +59,7 @@ WriteLiteral("\r\n<h2>\r\n Documents Imported Today\r\n</h2>\r\n<div");
|
|||||||
|
|
||||||
WriteLiteral(" id=\"importStatus\"");
|
WriteLiteral(" id=\"importStatus\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n");
|
WriteLiteral(">\r\n <div");
|
||||||
|
|
||||||
WriteLiteral(" ");
|
|
||||||
|
|
||||||
|
|
||||||
#line 12 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
|
||||||
Write(Html.AntiForgeryToken());
|
|
||||||
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral("\r\n <div");
|
|
||||||
|
|
||||||
WriteLiteral(" id=\"noSessions\"");
|
WriteLiteral(" id=\"noSessions\"");
|
||||||
|
|
||||||
@@ -289,7 +278,7 @@ WriteLiteral(">\r\n $(function () {\r\n var vm;\r\n var host =
|
|||||||
"var urlDeviceShow = \'");
|
"var urlDeviceShow = \'");
|
||||||
|
|
||||||
|
|
||||||
#line 107 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
#line 106 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
|
||||||
Write(Url.Action(MVC.Device.Show()));
|
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 = \'");
|
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()));
|
Write(Url.Action(MVC.Job.Show()));
|
||||||
|
|
||||||
|
|
||||||
@@ -307,7 +296,7 @@ WriteLiteral("/\'\r\n var urlJobShow = \'");
|
|||||||
WriteLiteral("/\'\r\n var urlUserShow = \'");
|
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()));
|
Write(Url.Action(MVC.User.Show()));
|
||||||
|
|
||||||
|
|
||||||
@@ -316,7 +305,7 @@ WriteLiteral("/\'\r\n var urlUserShow = \'");
|
|||||||
WriteLiteral("/\'\r\n var urlPageThumbnail = \'");
|
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()));
|
Write(Url.Action(MVC.API.DocumentTemplate.ImporterThumbnail()));
|
||||||
|
|
||||||
|
|
||||||
@@ -325,7 +314,7 @@ WriteLiteral("/\'\r\n var urlPageThumbnail = \'");
|
|||||||
WriteLiteral("/\'\r\n var urlDocumentTemplate = \'");
|
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()));
|
Write(Url.Action(MVC.Config.DocumentTemplate.Index()));
|
||||||
|
|
||||||
|
|
||||||
@@ -334,7 +323,7 @@ WriteLiteral("/\'\r\n var urlDocumentTemplate = \'");
|
|||||||
WriteLiteral("/\';\r\n var urlManuallyAssign = \'");
|
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()));
|
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" +
|
"ar loadData = {\r\n Format: \"json\",\r\n Start: d.getFu" +
|
||||||
"llYear() + \'-\' + (d.getMonth() + 1) + \'-\' + d.getDate(),\r\n End: n" +
|
"llYear() + \'-\' + (d.getMonth() + 1) + \'-\' + d.getDate(),\r\n End: n" +
|
||||||
"ull,\r\n ModuleId: 40,\r\n Take: 2000,\r\n " +
|
"ull,\r\n ModuleId: 40,\r\n Take: 2000,\r\n " +
|
||||||
" \'__RequestVerificationToken\': host.find(\'input[name=\"__RequestVerificationToke" +
|
" \'__RequestVerificationToken\': document.body.dataset.antiforgery\r\n }" +
|
||||||
"n\"]\').val()\r\n };\r\n $.ajax({\r\n url: \'");
|
";\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()));
|
Write(Url.Action(MVC.API.Logging.RetrieveEvents()));
|
||||||
|
|
||||||
|
|
||||||
@@ -478,7 +467,7 @@ WriteLiteral(@"',
|
|||||||
$.connection.hub.qs = { LogModules: '");
|
$.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);
|
Write(Disco.Services.Documents.DocumentsLog.Current.LiveLogGroupName);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,7 @@
|
|||||||
<div id="Config_DocumentTemplates_Scope_Dialog" title="Change Document Template Scope" class="dialog">
|
<div id="Config_DocumentTemplates_Scope_Dialog" title="Change Document Template Scope" class="dialog">
|
||||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.UpdateScope(Model.DocumentTemplate.Id, redirect: true)))
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.UpdateScope(Model.DocumentTemplate.Id, redirect: true)))
|
||||||
{
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<label for="Config_DocumentTemplates_Scope_Scope">Scope: </label>
|
<label for="Config_DocumentTemplates_Scope_Scope">Scope: </label>
|
||||||
<select id="Config_DocumentTemplates_Scope_Scope" name="Scope">
|
<select id="Config_DocumentTemplates_Scope_Scope" name="Scope">
|
||||||
@@ -178,10 +179,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var dialog;
|
let dialog = null;
|
||||||
|
$('#Config_DocumentTemplates_Scope_Button').on('click', function () {
|
||||||
function showDialog() {
|
if (!dialog) {
|
||||||
if (dialog == null) {
|
|
||||||
dialog = $('#Config_DocumentTemplates_Scope_Dialog').dialog({
|
dialog = $('#Config_DocumentTemplates_Scope_Dialog').dialog({
|
||||||
width: 400,
|
width: 400,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
@@ -189,23 +189,19 @@
|
|||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
buttons: {
|
buttons: {
|
||||||
'Save Changes': function () {
|
'Save Changes': function () {
|
||||||
dialog.dialog('option', 'buttons', null);
|
$(this)
|
||||||
dialog.dialog('disable');
|
.dialog('option', 'buttons', null)
|
||||||
$('#Config_DocumentTemplates_Scope_Scope').closest('form').submit();
|
.find('form').submit();
|
||||||
},
|
},
|
||||||
'Cancel': function () {
|
'Cancel': function () {
|
||||||
dialog.dialog('close');
|
$(this).dialog('close');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog.dialog('open');
|
dialog.dialog('open');
|
||||||
|
});
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#Config_DocumentTemplates_Scope_Button').click(showDialog);
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
@@ -250,6 +246,7 @@
|
|||||||
<div id="Config_DocumentTemplates_JobSubTypes_Update_Dialog" class="dialog" title="Job Type Filter">
|
<div id="Config_DocumentTemplates_JobSubTypes_Update_Dialog" class="dialog" title="Job Type Filter">
|
||||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.UpdateJobSubTypes(Model.DocumentTemplate.Id, null, true)))
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.UpdateJobSubTypes(Model.DocumentTemplate.Id, null, true)))
|
||||||
{
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
var selectedTypes = Model.DocumentTemplate.JobSubTypes.Select(jst => jst.JobType).Distinct().ToList();
|
var selectedTypes = Model.DocumentTemplate.JobSubTypes.Select(jst => jst.JobType).Distinct().ToList();
|
||||||
foreach (var jt in Model.JobTypes)
|
foreach (var jt in Model.JobTypes)
|
||||||
{
|
{
|
||||||
@@ -266,10 +263,9 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
$(function () {
|
||||||
var dialog;
|
let dialog = null;
|
||||||
|
$('#Config_DocumentTemplates_JobSubTypes_Update').on('click', function () {
|
||||||
function showDialog() {
|
|
||||||
if (!dialog) {
|
if (!dialog) {
|
||||||
dialog = $('#Config_DocumentTemplates_JobSubTypes_Update_Dialog').dialog({
|
dialog = $('#Config_DocumentTemplates_JobSubTypes_Update_Dialog').dialog({
|
||||||
resizable: false,
|
resizable: false,
|
||||||
@@ -278,8 +274,19 @@
|
|||||||
width: 750,
|
width: 750,
|
||||||
height: 580,
|
height: 580,
|
||||||
buttons: {
|
buttons: {
|
||||||
"Save Changes": saveChanges,
|
"Save Changes": function () {
|
||||||
Cancel: cancel
|
var form = dialog.find('form');
|
||||||
|
$('input.jobType:unchecked').each(function () {
|
||||||
|
$('#SubTypes_' + $(this).val()).find('input').prop('checked', false);
|
||||||
|
});
|
||||||
|
form.trigger('submit');
|
||||||
|
dialog.dialog("option", "buttons", null);
|
||||||
|
},
|
||||||
|
Cancel: function () {
|
||||||
|
dialog.dialog("option", "buttons", null);
|
||||||
|
// refresh Page
|
||||||
|
window.location.reload(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -296,36 +303,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
dialog.dialog('open');
|
dialog.dialog('open');
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancel() {
|
|
||||||
dialog.dialog("disable");
|
|
||||||
dialog.dialog("option", "buttons", null);
|
|
||||||
|
|
||||||
// Refresh Page
|
|
||||||
window.location.reload(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveChanges() {
|
|
||||||
var form = dialog.find('form');
|
|
||||||
|
|
||||||
$('input.jobType:unchecked').each(function () {
|
|
||||||
$('#SubTypes_' + $(this).val()).find('input').prop('checked', false);
|
|
||||||
});
|
|
||||||
|
|
||||||
form.submit();
|
|
||||||
|
|
||||||
dialog.dialog("disable");
|
|
||||||
dialog.dialog("option", "buttons", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
$(function () {
|
|
||||||
$('#Config_DocumentTemplates_JobSubTypes_Update').click(showDialog);
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
})();
|
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -413,6 +392,7 @@
|
|||||||
<div>
|
<div>
|
||||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.Template(Model.DocumentTemplate.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.Template(Model.DocumentTemplate.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
|
||||||
{
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
<input type="file" name="Template" id="Config_DocumentTemplates_TemplatePdf_Template" accept=".pdf" style="width: 250px;" />
|
<input type="file" name="Template" id="Config_DocumentTemplates_TemplatePdf_Template" accept=".pdf" style="width: 250px;" />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -737,7 +717,7 @@
|
|||||||
@Html.Hidden("ruleId", "")
|
@Html.Hidden("ruleId", "")
|
||||||
}
|
}
|
||||||
<a id="DocumentTemplate_OnImportUserFlagRules_AddButton" href="#" class="button small">Add User Flag Rule</a>
|
<a id="DocumentTemplate_OnImportUserFlagRules_AddButton" href="#" class="button small">Add User Flag Rule</a>
|
||||||
<div id="DocumentTemplate_OnImportUserFlagRules_AddDialog" class="hiddenDialog" title="On Import User Flag Rule: @(Model.DocumentTemplate.Id)">
|
<div id="DocumentTemplate_OnImportUserFlagRules_AddDialog" class="dialog" title="On Import User Flag Rule: @(Model.DocumentTemplate.Id)">
|
||||||
<div class="brief">
|
<div class="brief">
|
||||||
@switch (Model.DocumentTemplate.Scope)
|
@switch (Model.DocumentTemplate.Scope)
|
||||||
{
|
{
|
||||||
@@ -758,7 +738,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.AddOnImportUserFlagRule(Model.DocumentTemplate.Id), FormMethod.Post))
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.AddOnImportUserFlagRule(Model.DocumentTemplate.Id)))
|
||||||
{
|
{
|
||||||
@Html.AntiForgeryToken()
|
@Html.AntiForgeryToken()
|
||||||
<div class="distribute-evenly">
|
<div class="distribute-evenly">
|
||||||
@@ -878,7 +858,7 @@
|
|||||||
rulesTable.find('tbody').append(row);
|
rulesTable.find('tbody').append(row);
|
||||||
|
|
||||||
rulesTable.find('tbody').find('tr').first().addClass('hidden');
|
rulesTable.find('tbody').find('tr').first().addClass('hidden');
|
||||||
|
|
||||||
dialog.dialog("close");
|
dialog.dialog("close");
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
@@ -997,6 +977,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="dialogConfirmDelete" title="Delete this Document Template?" class="dialog">
|
<div id="dialogConfirmDelete" title="Delete this Document Template?" class="dialog">
|
||||||
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.Delete(Model.DocumentTemplate.Id, true)))
|
||||||
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
|
}
|
||||||
<p>
|
<p>
|
||||||
<i class="fa fa-exclamation-triangle fa-lg warning"></i>This item will be permanently deleted and cannot be recovered.<br />
|
<i class="fa fa-exclamation-triangle fa-lg warning"></i>This item will be permanently deleted and cannot be recovered.<br />
|
||||||
<em>
|
<em>
|
||||||
@@ -1008,31 +992,28 @@
|
|||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var button = $('#buttonDelete');
|
const button = $('#buttonDelete');
|
||||||
var buttonDialog = $("#dialogConfirmDelete");
|
let buttonDialog = null;
|
||||||
var buttonLink = button.attr('href');
|
|
||||||
button.attr('href', '#');
|
|
||||||
button.click(function () {
|
button.click(function () {
|
||||||
buttonDialog.dialog('open');
|
if (!buttonDialog) {
|
||||||
return false;
|
buttonDialog = $("#dialogConfirmDelete").dialog({
|
||||||
});
|
resizable: false,
|
||||||
buttonDialog.dialog({
|
modal: true,
|
||||||
resizable: false,
|
autoOpen: false,
|
||||||
modal: true,
|
buttons: {
|
||||||
autoOpen: false,
|
"Delete": function () {
|
||||||
buttons: {
|
$(this)
|
||||||
"Delete": function () {
|
.dialog("option", "buttons", null)
|
||||||
$this = $(this);
|
.find('form').trigger('submit');
|
||||||
$this.dialog('disable');
|
},
|
||||||
$this.dialog("option", "buttons", null);
|
Cancel: function () {
|
||||||
window.location.href = buttonLink;
|
$(this).dialog("close");
|
||||||
},
|
}
|
||||||
Cancel: function () {
|
}
|
||||||
$(this).dialog("close");
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
buttonDialog.dialog('open');
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<div class="actionBar">
|
<div class="actionBar">
|
||||||
@@ -1065,7 +1046,7 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
<a id="buttonBulkGenerate" href="#" class="button">Bulk Generate</a>
|
<a id="buttonBulkGenerate" href="#" class="button">Bulk Generate</a>
|
||||||
<div id="dialogBulkGenerate" class="hiddenDialog dialog-bulk-generate" title="Bulk Generate: @(Model.DocumentTemplate.Id)">
|
<div id="dialogBulkGenerate" class="dialog dialog-bulk-generate" title="Bulk Generate: @(Model.DocumentTemplate.Id)">
|
||||||
<div class="brief">
|
<div class="brief">
|
||||||
@switch (Model.DocumentTemplate.Scope)
|
@switch (Model.DocumentTemplate.Scope)
|
||||||
{
|
{
|
||||||
@@ -1101,8 +1082,9 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id), FormMethod.Post))
|
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id)))
|
||||||
{
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
<div class="field-validation-valid" data-valmsg-replace="true" data-valmsg-for="DataIds"></div>
|
<div class="field-validation-valid" data-valmsg-replace="true" data-valmsg-for="DataIds"></div>
|
||||||
<textarea id="inputBulkGenerateDataIds" name="DataIds" data-val="true" data-val-required="Identifiers are required"></textarea>
|
<textarea id="inputBulkGenerateDataIds" name="DataIds" data-val="true" data-val-required="Identifiers are required"></textarea>
|
||||||
if (Model.TemplatePageCount > 1 && Model.TemplatePageCount % 2 != 0)
|
if (Model.TemplatePageCount > 1 && Model.TemplatePageCount % 2 != 0)
|
||||||
@@ -1127,8 +1109,7 @@
|
|||||||
width: 460,
|
width: 460,
|
||||||
buttons: {
|
buttons: {
|
||||||
"Bulk Generate": function () {
|
"Bulk Generate": function () {
|
||||||
dialog.find('form').submit();
|
$(this).find('form').trigger('submit');
|
||||||
dialog.dialog("disable");
|
|
||||||
},
|
},
|
||||||
Close: function () {
|
Close: function () {
|
||||||
$(this).dialog("close");
|
$(this).dialog("close");
|
||||||
@@ -1148,13 +1129,13 @@
|
|||||||
}
|
}
|
||||||
@if (Authorization.Has(Claims.Config.DocumentTemplate.Delete))
|
@if (Authorization.Has(Claims.Config.DocumentTemplate.Delete))
|
||||||
{
|
{
|
||||||
@Html.ActionLinkButton("Delete", MVC.API.DocumentTemplate.Delete(Model.DocumentTemplate.Id, true), "buttonDelete")
|
<button id="buttonDelete" type="button" class="button">Delete</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@if (!string.IsNullOrWhiteSpace(Model.BulkGenerateDownloadId))
|
@if (Model.BulkGenerateDownloadId.HasValue)
|
||||||
{
|
{
|
||||||
<div id="Config_DocumentTemplates_Show_DownloadBulk_Dialog" class="dialog" title="Download Bulk Documents">
|
<div id="Config_DocumentTemplates_Show_DownloadBulk_Dialog" class="dialog" title="Download Bulk Documents">
|
||||||
<a href="@Url.Action(MVC.API.DocumentTemplate.BulkGenerateDownload(Model.BulkGenerateDownloadId, Model.BulkGenerateDownloadFilename))" class="button"><i class="fa fa-download fa-lg"></i>Download Bulk Documents</a>
|
<a href="@Url.Action(MVC.API.DocumentTemplate.BulkGenerateDownload(Model.BulkGenerateDownloadId.Value, Model.BulkGenerateDownloadFilename))" class="button"><i class="fa fa-download fa-lg"></i>Download Bulk Documents</a>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user