Permissions & Authorization for Users #24

Initial Release; Includes Database and MVC refactoring
This commit is contained in:
Gary Sharp
2013-10-10 19:13:16 +11:00
parent 172ce5524a
commit a099d68915
458 changed files with 40221 additions and 12130 deletions
@@ -0,0 +1,233 @@
using Disco.BI.Extensions;
using Disco.BI.Interop.ActiveDirectory;
using Disco.Models.Interop.ActiveDirectory;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Users;
using Disco.Services.Web;
using System;
using System.Linq;
using System.Web.Mvc;
namespace Disco.Web.Areas.API.Controllers
{
[DiscoAuthorize(Claims.DiscoAdminAccount)]
public partial class AuthorizationRoleController : AuthorizedDatabaseController
{
#region Properties
const string pName = "name";
public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false)
{
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var authorizationRole = Database.AuthorizationRoles.Find(id);
if (authorizationRole != null)
{
switch (key.ToLower())
{
case pName:
UpdateName(authorizationRole, value);
break;
default:
throw new Exception("Invalid Update Key");
}
}
else
{
return Json("Invalid Authorization Role Id", JsonRequestBehavior.AllowGet);
}
if (redirect)
return RedirectToAction(MVC.Config.AuthorizationRole.Index(authorizationRole.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
private void UpdateName(AuthorizationRole AuthorizationRole, string Name)
{
if (string.IsNullOrWhiteSpace(Name))
throw new ArgumentNullException("Name", "Authorization Role Name is required");
else
{
if (AuthorizationRole.Name != Name)
{
// Check for Duplicates
var d = Database.AuthorizationRoles.Where(db => db.Id != AuthorizationRole.Id && db.Name == Name).Count();
if (d > 0)
{
throw new Exception("An Authorization Role with that name already exists");
}
AuthorizationRole.Name = Name;
UserService.UpdateAuthorizationRole(Database, AuthorizationRole);
}
}
}
private void UpdateClaims(AuthorizationRole AuthorizationRole, string[] ClaimKeys)
{
var claims = Claims.BuildClaims(ClaimKeys);
AuthorizationRole.SetClaims(claims);
UserService.UpdateAuthorizationRole(Database, AuthorizationRole);
}
private void UpdateSubjects(AuthorizationRole AuthorizationRole, string[] Subjects)
{
string subjectIds = null;
// Validate Subjects
if (Subjects != null && Subjects.Length > 0)
{
var subjects = Subjects.Where(s => !string.IsNullOrWhiteSpace(s)).Select(s => s.Trim()).Select(s => new Tuple<string, IActiveDirectoryObject>(s, ActiveDirectory.GetObject(s))).ToList();
var invalidSubjects = subjects.Where(s => s.Item2 == null).ToList();
if (invalidSubjects.Count > 0)
throw new ArgumentException(string.Format("Subjects not found: {0}", string.Join(", ", invalidSubjects)), "Subjects");
subjectIds = string.Join(",", subjects.Select(s => s.Item2.SamAccountName).OrderBy(s => s));
if (string.IsNullOrEmpty(subjectIds))
subjectIds = null;
}
if (AuthorizationRole.SubjectIds != subjectIds)
{
AuthorizationRole.SubjectIds = subjectIds;
UserService.UpdateAuthorizationRole(Database, AuthorizationRole);
}
}
public virtual ActionResult UpdateName(int id, string RoleName = null, bool redirect = false)
{
return Update(id, pName, RoleName, redirect);
}
public virtual ActionResult UpdateClaims(int id, string[] ClaimKeys = null, bool redirect = false)
{
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
var authorizationRole = Database.AuthorizationRoles.Find(id);
if (authorizationRole != null)
{
UpdateClaims(authorizationRole, ClaimKeys);
}
else
{
return Json("Invalid Authorization Role Id", JsonRequestBehavior.AllowGet);
}
if (redirect)
return RedirectToAction(MVC.Config.AuthorizationRole.Index(authorizationRole.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
public virtual ActionResult UpdateSubjects(int id, string[] Subjects = null, bool redirect = false)
{
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
var authorizationRole = Database.AuthorizationRoles.Find(id);
if (authorizationRole != null)
{
UpdateSubjects(authorizationRole, Subjects);
}
else
{
return Json("Invalid Authorization Role Id", JsonRequestBehavior.AllowGet);
}
if (redirect)
return RedirectToAction(MVC.Config.AuthorizationRole.Index(authorizationRole.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Actions
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
{
try
{
var ar = Database.AuthorizationRoles.Find(id);
if (ar != null)
{
ar.Delete(Database);
Database.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.AuthorizationRole.Index(null));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
throw new Exception("Invalid Authorization Role Id");
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
public virtual ActionResult SearchSubjects(string term)
{
var groupResults = BI.Interop.ActiveDirectory.ActiveDirectory.SearchGroups(term).Cast<IActiveDirectoryObject>();
var userResults = BI.Interop.ActiveDirectory.ActiveDirectory.SearchUsers(term).Cast<IActiveDirectoryObject>();
var results = groupResults.Concat(userResults).OrderBy(r => r.SamAccountName)
.Select(r => Models.AuthorizationRole.SubjectItem.FromActiveDirectoryObject(r)).ToList();
return Json(results, JsonRequestBehavior.AllowGet);
}
public virtual ActionResult Subject(string Id)
{
var subject = ActiveDirectory.GetObject(Id);
if (subject == null || !(subject is ActiveDirectoryUserAccount || subject is ActiveDirectoryGroup))
return Json(null, JsonRequestBehavior.AllowGet);
else
return Json(Models.AuthorizationRole.SubjectItem.FromActiveDirectoryObject(subject), JsonRequestBehavior.AllowGet);
}
}
}
@@ -1,23 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Authorization;
using Disco.Services.Web;
using System;
using System.Web.Mvc;
using Disco.BI.Extensions;
namespace Disco.Web.Areas.API.Controllers
{
public partial class BootstrapperController : dbAdminController
[DiscoAuthorize(Claims.Config.Enrolment.Configure)]
public partial class BootstrapperController : AuthorizedDatabaseController
{
public virtual ActionResult MacSshUsername(string MacSshUsername)
{
try
{
if (!string.IsNullOrWhiteSpace(MacSshUsername))
{
dbContext.DiscoConfiguration.Bootstrapper.MacSshUsername = MacSshUsername;
dbContext.SaveChanges();
Database.DiscoConfiguration.Bootstrapper.MacSshUsername = MacSshUsername;
Database.SaveChanges();
return Json("OK", JsonRequestBehavior.AllowGet);
}
else
@@ -36,8 +34,8 @@ namespace Disco.Web.Areas.API.Controllers
{
if (!string.IsNullOrWhiteSpace(MacSshPassword))
{
dbContext.DiscoConfiguration.Bootstrapper.MacSshPassword = MacSshPassword;
dbContext.SaveChanges();
Database.DiscoConfiguration.Bootstrapper.MacSshPassword = MacSshPassword;
Database.SaveChanges();
return Json("OK", JsonRequestBehavior.AllowGet);
}
else
@@ -1,19 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.BI.Extensions;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web.Extensions;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web.Mvc;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceBatchController : dbAdminController
public partial class DeviceBatchController : AuthorizedDatabaseController
{
const string pName = "name";
const string pPurchaseDate = "purchasedate";
const string pSupplier = "supplier";
@@ -29,15 +28,18 @@ namespace Disco.Web.Areas.API.Controllers
const string pInsuranceDetails = "insurancedetails";
const string pComments = "comments";
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false)
{
Authorization.Require(Claims.Config.DeviceBatch.Configure);
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var deviceBatch = dbContext.DeviceBatches.Find(id);
var deviceBatch = Database.DeviceBatches.Find(id);
if (deviceBatch != null)
{
switch (key.ToLower())
@@ -107,62 +109,86 @@ namespace Disco.Web.Areas.API.Controllers
}
#region Update Shortcut Methods
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
public virtual ActionResult UpdateName(int id, string BatchName = null, bool redirect = false)
{
return Update(id, pName, BatchName, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
public virtual ActionResult UpdatePurchaseDate(int id, string PurchaseDate = null, bool redirect = false)
{
return Update(id, pPurchaseDate, PurchaseDate, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
public virtual ActionResult UpdateSupplier(int id, string Supplier = null, bool redirect = false)
{
return Update(id, pSupplier, Supplier, redirect);
}
[ValidateInput(false)]
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)]
public virtual ActionResult UpdatePurchaseDetails(int id, string PurchaseDetails = null, bool redirect = false)
{
return Update(id, pPurchaseDetails, PurchaseDetails, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
public virtual ActionResult UpdateUnitCost(int id, string UnitCost = null, bool redirect = false)
{
return Update(id, pUnitCost, UnitCost, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
public virtual ActionResult UpdateUnitQuantity(int id, string UnitQuantity = null, bool redirect = false)
{
return Update(id, pUnitQuantity, UnitQuantity, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
public virtual ActionResult UpdateDefaultDeviceModelId(int id, string DefaultDeviceModelId = null, bool redirect = false)
{
return Update(id, pDefaultDeviceModelId, DefaultDeviceModelId, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
public virtual ActionResult UpdateWarrantyValidUntil(int id, string WarrantyValidUntil = null, bool redirect = false)
{
return Update(id, pWarrantyValidUntil, WarrantyValidUntil, redirect);
}
[ValidateInput(false)]
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)]
public virtual ActionResult UpdateWarrantyDetails(int id, string WarrantyDetails = null, bool redirect = false)
{
return Update(id, pWarrantyDetails, WarrantyDetails, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
public virtual ActionResult UpdateInsuredDate(int id, string InsuredDate = null, bool redirect = false)
{
return Update(id, pInsuredDate, InsuredDate, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
public virtual ActionResult UpdateInsuranceSupplier(int id, string InsuranceSupplier = null, bool redirect = false)
{
return Update(id, pInsuranceSupplier, InsuranceSupplier, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
public virtual ActionResult UpdateInsuredUntil(int id, string InsuredUntil = null, bool redirect = false)
{
return Update(id, pInsuredUntil, InsuredUntil, redirect);
}
[ValidateInput(false)]
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)]
public virtual ActionResult UpdateInsuranceDetails(int id, string InsuranceDetails = null, bool redirect = false)
{
return Update(id, pInsuranceDetails, InsuranceDetails, redirect);
}
[ValidateInput(false)]
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)]
public virtual ActionResult UpdateComments(int id, string Comments = null, bool redirect = false)
{
return Update(id, pComments, Comments, redirect);
@@ -177,14 +203,14 @@ namespace Disco.Web.Areas.API.Controllers
else
{
// Check for Duplicates
var d = dbContext.DeviceBatches.Where(db => db.Id != deviceBatch.Id && db.Name == Name).Count();
var d = Database.DeviceBatches.Where(db => db.Id != deviceBatch.Id && db.Name == Name).Count();
if (d > 0)
{
throw new Exception("A Device Batch with that name already exists");
}
deviceBatch.Name = Name;
}
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdatePurchaseDate(DeviceBatch deviceBatch, string PurchaseDate)
{
@@ -202,7 +228,7 @@ namespace Disco.Web.Areas.API.Controllers
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateSupplier(DeviceBatch deviceBatch, string Supplier)
{
@@ -210,7 +236,7 @@ namespace Disco.Web.Areas.API.Controllers
deviceBatch.Supplier = null;
else
deviceBatch.Supplier = Supplier;
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdatePurchaseDetails(DeviceBatch deviceBatch, string PurchaseDetails)
{
@@ -218,7 +244,7 @@ namespace Disco.Web.Areas.API.Controllers
deviceBatch.PurchaseDetails = null;
else
deviceBatch.PurchaseDetails = PurchaseDetails;
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateUnitCost(DeviceBatch deviceBatch, string UnitCost)
{
@@ -236,7 +262,7 @@ namespace Disco.Web.Areas.API.Controllers
throw new Exception("Invalid Currency Format");
}
}
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateUnitQuantity(DeviceBatch deviceBatch, string UnitQuantity)
{
@@ -254,7 +280,7 @@ namespace Disco.Web.Areas.API.Controllers
throw new Exception("Invalid Number");
}
}
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateDefaultDeviceModelId(DeviceBatch deviceBatch, string DefaultDeviceModelId)
{
@@ -263,13 +289,13 @@ namespace Disco.Web.Areas.API.Controllers
int bId;
if (int.TryParse(DefaultDeviceModelId, out bId))
{
var dm = dbContext.DeviceModels.Find(bId);
var dm = Database.DeviceModels.Find(bId);
if (dm != null)
{
deviceBatch.DefaultDeviceModelId = dm.Id;
deviceBatch.DefaultDeviceModel = dm;
dbContext.SaveChanges();
Database.SaveChanges();
return;
}
}
@@ -280,7 +306,7 @@ namespace Disco.Web.Areas.API.Controllers
deviceBatch.DefaultDeviceModelId = null;
deviceBatch.DefaultDeviceModel = null;
dbContext.SaveChanges();
Database.SaveChanges();
return;
}
throw new Exception("Invalid Device Model Id");
@@ -301,7 +327,7 @@ namespace Disco.Web.Areas.API.Controllers
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateWarrantyDetails(DeviceBatch deviceBatch, string WarrantyDetails)
{
@@ -309,7 +335,7 @@ namespace Disco.Web.Areas.API.Controllers
deviceBatch.WarrantyDetails = null;
else
deviceBatch.WarrantyDetails = WarrantyDetails;
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateInsuredDate(DeviceBatch deviceBatch, string InsuredDate)
{
@@ -327,7 +353,7 @@ namespace Disco.Web.Areas.API.Controllers
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateInsuranceSupplier(DeviceBatch deviceBatch, string InsuranceSupplier)
{
@@ -335,7 +361,7 @@ namespace Disco.Web.Areas.API.Controllers
deviceBatch.InsuranceSupplier = null;
else
deviceBatch.InsuranceSupplier = InsuranceSupplier;
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateInsuredUntil(DeviceBatch deviceBatch, string InsuredUntil)
{
@@ -353,7 +379,7 @@ namespace Disco.Web.Areas.API.Controllers
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateInsuranceDetails(DeviceBatch deviceBatch, string InsuranceDetails)
{
@@ -361,7 +387,7 @@ namespace Disco.Web.Areas.API.Controllers
deviceBatch.InsuranceDetails = null;
else
deviceBatch.InsuranceDetails = InsuranceDetails;
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateComments(DeviceBatch deviceBatch, string Comments)
{
@@ -369,21 +395,22 @@ namespace Disco.Web.Areas.API.Controllers
deviceBatch.Comments = null;
else
deviceBatch.Comments = Comments;
dbContext.SaveChanges();
Database.SaveChanges();
}
#endregion
#region Actions
[DiscoAuthorize(Claims.Config.DeviceBatch.Delete)]
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
{
try
{
var db = dbContext.DeviceBatches.Find(id);
var db = Database.DeviceBatches.Find(id);
if (db != null)
{
db.Delete(dbContext);
dbContext.SaveChanges();
db.Delete(Database);
Database.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceBatch.Index(null));
else
@@ -403,27 +430,32 @@ namespace Disco.Web.Areas.API.Controllers
#endregion
#region Index
[DiscoAuthorize(Claims.Config.DeviceBatch.Show)]
public virtual ActionResult Index(int? id)
{
if (id.HasValue)
{
dbContext.Configuration.ProxyCreationEnabled = false;
DeviceBatch deviceBatch = dbContext.DeviceBatches.FirstOrDefault(db => db.Id == id);
Database.Configuration.ProxyCreationEnabled = false;
DeviceBatch deviceBatch = Database.DeviceBatches.FirstOrDefault(db => db.Id == id);
return Json(deviceBatch, JsonRequestBehavior.AllowGet);
}
else
{
var deviceBatches = dbContext.DeviceBatches.ToArray();
var deviceBatches = Database.DeviceBatches.ToArray();
return Json(deviceBatches, JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Timeline
[DiscoAuthorizeAll(Claims.Config.DeviceBatch.Show, Claims.Config.DeviceBatch.ShowTimeline)]
public virtual ActionResult Timeline()
{
var batchesInformation = dbContext.DeviceBatches.Select(db => new
var batchesInformation = Database.DeviceBatches.Select(db => new
{
Name = db.Name,
Comments = db.Comments,
@@ -466,13 +498,15 @@ namespace Disco.Web.Areas.API.Controllers
#endregion
#region Exporting
[DiscoAuthorizeAll(Claims.Config.DeviceBatch.Show, Claims.Device.Actions.Export)]
public virtual ActionResult ExportDevices(int id)
{
DeviceBatch db = dbContext.DeviceBatches.Find(id);
DeviceBatch db = Database.DeviceBatches.Find(id);
if (db == null)
throw new ArgumentNullException("id", "Invalid Device Batch Id");
var devices = dbContext.Devices.Where(d => !d.DecommissionedDate.HasValue && d.DeviceBatchId == db.Id);
var devices = Database.Devices.Where(d => !d.DecommissionedDate.HasValue && d.DeviceBatchId == db.Id);
var export = BI.DeviceBI.Importing.Export.GenerateExport(devices);
@@ -480,6 +514,7 @@ namespace Disco.Web.Areas.API.Controllers
return File(export, "text/csv", filename);
}
#endregion
}
@@ -1,17 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Authorization;
using Disco.Services.Web;
using System;
using System.Web.Mvc;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceCertificateController : dbAdminController
public partial class DeviceCertificateController : AuthorizedDatabaseController
{
[DiscoAuthorize(Claims.Config.DeviceCertificate.DownloadCertificates)]
public virtual ActionResult Download(int id)
{
var wc = dbContext.DeviceCertificates.Find(id);
var wc = Database.DeviceCertificates.Find(id);
if (wc == null)
{
throw new Exception("Invalid Device Certificate Id");
@@ -1,16 +1,17 @@
using System;
using System.Collections.Generic;
using Disco.BI.Extensions;
using Disco.BI.Interop.ActiveDirectory;
using Disco.Services.Authorization;
using Disco.Services.Users;
using Disco.Services.Web;
using System;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI.Extensions;
using Disco.BI;
using Disco.BI.Interop.ActiveDirectory;
using System.IO;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceController : dbAdminController
public partial class DeviceController : AuthorizedDatabaseController
{
const string pDeviceProfileId = "deviceprofileid";
@@ -22,7 +23,7 @@ namespace Disco.Web.Areas.API.Controllers
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
{
dbContext.Configuration.LazyLoadingEnabled = true;
Database.Configuration.LazyLoadingEnabled = true;
try
{
@@ -30,27 +31,33 @@ namespace Disco.Web.Areas.API.Controllers
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var device = dbContext.Devices.Find(id);
var device = Database.Devices.Find(id);
if (device != null)
{
switch (key.ToLower())
{
case pDeviceProfileId:
Authorization.Require(Claims.Device.Properties.DeviceProfile);
UpdateDeviceProfileId(device, value);
break;
case pDeviceBatchId:
Authorization.Require(Claims.Device.Properties.DeviceBatch);
UpdateDeviceBatchId(device, value);
break;
case pAssetNumber:
Authorization.Require(Claims.Device.Properties.AssetNumber);
UpdateAssetNumber(device, value);
break;
case pAssignedUserId:
Authorization.Require(Claims.Device.Actions.AssignUser);
UpdateAssignedUserId(device, value);
break;
case pLocation:
Authorization.Require(Claims.Device.Properties.Location);
UpdateLocation(device, value);
break;
case pAllowUnauthenticatedEnrol:
Authorization.Require(Claims.Device.Actions.AllowUnauthenticatedEnrol);
UpdateAllowUnauthenticatedEnrol(device, value);
break;
default:
@@ -76,30 +83,43 @@ namespace Disco.Web.Areas.API.Controllers
}
#region Update Shortcut Methods
[DiscoAuthorize(Claims.Device.Properties.DeviceProfile)]
public virtual ActionResult UpdateDeviceProfileId(string id, string DeviceProfileId = null, bool redirect = false)
{
return Update(id, pDeviceProfileId, DeviceProfileId, redirect);
}
[DiscoAuthorize(Claims.Device.Properties.DeviceBatch)]
public virtual ActionResult UpdateDeviceBatchId(string id, string DeviceBatchId = null, bool redirect = false)
{
return Update(id, pDeviceBatchId, DeviceBatchId, redirect);
}
[DiscoAuthorize(Claims.Device.Properties.AssetNumber)]
public virtual ActionResult UpdateAssetNumber(string id, string AssetNumber = null, bool redirect = false)
{
return Update(id, pAssetNumber, AssetNumber, redirect);
}
[DiscoAuthorize(Claims.Device.Properties.Location)]
public virtual ActionResult UpdateLocation(string id, string Location = null, bool redirect = false)
{
return Update(id, pLocation, Location, redirect);
}
[DiscoAuthorize(Claims.Device.Actions.AssignUser)]
public virtual ActionResult UpdateAssignedUserId(string id, string AssignedUserId = null, bool redirect = false)
{
return Update(id, pAssignedUserId, AssignedUserId, redirect);
}
[DiscoAuthorize(Claims.Device.Actions.AllowUnauthenticatedEnrol)]
public virtual ActionResult UpdateAllowUnauthenticatedEnrol(string id, string AllowUnauthenticatedEnrol = null, bool redirect = false)
{
return Update(id, pAllowUnauthenticatedEnrol, AllowUnauthenticatedEnrol, redirect);
}
#endregion
#region Update Properties
@@ -110,7 +130,7 @@ namespace Disco.Web.Areas.API.Controllers
int pId;
if (int.TryParse(DeviceProfileId, out pId))
{
var p = dbContext.DeviceProfiles.Find(pId);
var p = Database.DeviceProfiles.Find(pId);
if (p != null)
{
device.DeviceProfileId = p.Id;
@@ -124,7 +144,7 @@ namespace Disco.Web.Areas.API.Controllers
adMachineAccount.SetDescription(device);
}
dbContext.SaveChanges();
Database.SaveChanges();
return;
}
}
@@ -138,13 +158,13 @@ namespace Disco.Web.Areas.API.Controllers
int bId;
if (int.TryParse(DeviceBatchId, out bId))
{
var b = dbContext.DeviceBatches.Find(bId);
var b = Database.DeviceBatches.Find(bId);
if (b != null)
{
device.DeviceBatchId = b.Id;
device.DeviceBatch = b;
dbContext.SaveChanges();
Database.SaveChanges();
return;
}
}
@@ -155,7 +175,7 @@ namespace Disco.Web.Areas.API.Controllers
device.DeviceBatchId = null;
device.DeviceBatch = null;
dbContext.SaveChanges();
Database.SaveChanges();
return;
}
throw new Exception("Invalid Device Batch Id");
@@ -166,7 +186,7 @@ namespace Disco.Web.Areas.API.Controllers
device.AssetNumber = null;
else
device.AssetNumber = AssetNumber.Trim();
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateLocation(Disco.Models.Repository.Device device, string Location)
{
@@ -174,27 +194,24 @@ namespace Disco.Web.Areas.API.Controllers
device.Location = null;
else
device.Location = Location.Trim();
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateAssignedUserId(Disco.Models.Repository.Device device, string UserId)
{
var daus = dbContext.DeviceUserAssignments.Where(m => m.DeviceSerialNumber == device.SerialNumber && m.UnassignedDate == null);
var daus = Database.DeviceUserAssignments.Where(m => m.DeviceSerialNumber == device.SerialNumber && m.UnassignedDate == null);
Disco.Models.Repository.User u = null;
if (!string.IsNullOrEmpty(UserId))
{
// Changed 2012-12-13 G# - Stop error when assigning user - Force Refresh
// http://www.discoict.com.au/forum/support/2012/11/error-when-assigning-multiple-devices-to-single-user.aspx
//u = BI.UserBI.UserCache.GetUser(UserId, dbContext);
u = BI.UserBI.UserCache.GetUser(UserId, dbContext, true);
// End Changed 2012-12-13 G#
UserService.GetUser(UserId, Database, true);
if (u == null)
{
throw new Exception("Invalid Username");
}
}
device.AssignDevice(dbContext, u);
dbContext.SaveChanges();
device.AssignDevice(Database, u);
Database.SaveChanges();
}
private void UpdateAllowUnauthenticatedEnrol(Disco.Models.Repository.Device device, string AllowUnauthenticatedEnrol)
{
@@ -207,23 +224,25 @@ namespace Disco.Web.Areas.API.Controllers
if (device.AllowUnauthenticatedEnrol != bAllowUnauthenticatedEnrol)
{
device.AllowUnauthenticatedEnrol = bAllowUnauthenticatedEnrol;
dbContext.SaveChanges();
Database.SaveChanges();
}
}
#endregion
#region Device Actions
[DiscoAuthorize(Claims.Device.Actions.Decommission)]
public virtual ActionResult Decommission(string id, int Reason, bool redirect)
{
var d = dbContext.Devices.Find(id);
dbContext.Configuration.LazyLoadingEnabled = true;
var d = Database.Devices.Find(id);
Database.Configuration.LazyLoadingEnabled = true;
if (d != null)
{
if (d.CanDecommission())
{
d.OnDecommission((Disco.Models.Repository.Device.DecommissionReasons)Reason);
dbContext.SaveChanges();
Database.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Device.Show(id));
else
@@ -236,17 +255,19 @@ namespace Disco.Web.Areas.API.Controllers
}
return Json("Invalid Device Serial Number", JsonRequestBehavior.AllowGet);
}
[DiscoAuthorize(Claims.Device.Actions.Recommission)]
public virtual ActionResult Recommission(string id, bool redirect)
{
var d = dbContext.Devices.Find(id);
dbContext.Configuration.LazyLoadingEnabled = true;
var d = Database.Devices.Find(id);
Database.Configuration.LazyLoadingEnabled = true;
if (d != null)
{
if (d.CanRecommission())
{
d.OnRecommission();
dbContext.SaveChanges();
Database.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Device.Show(id));
else
@@ -259,17 +280,19 @@ namespace Disco.Web.Areas.API.Controllers
}
return Json("Invalid Device Serial Number", JsonRequestBehavior.AllowGet);
}
[DiscoAuthorize(Claims.Device.Actions.Delete)]
public virtual ActionResult Delete(string id, bool redirect)
{
var j = dbContext.Devices.Find(id);
dbContext.Configuration.LazyLoadingEnabled = true;
var j = Database.Devices.Find(id);
Database.Configuration.LazyLoadingEnabled = true;
if (j != null)
{
if (j.CanDelete())
{
j.OnDelete(dbContext);
j.OnDelete(Database);
dbContext.SaveChanges();
Database.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Device.Index());
else
@@ -282,26 +305,28 @@ namespace Disco.Web.Areas.API.Controllers
}
return Json("Invalid Device Serial Number", JsonRequestBehavior.AllowGet);
}
#endregion
[DiscoAuthorize(Claims.Device.Actions.GenerateDocuments)]
public virtual ActionResult GeneratePdf(string id, string DocumentTemplateId)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(DocumentTemplateId))
throw new ArgumentNullException("AttachmentTypeId");
var device = dbContext.Devices.Find(id);
var device = Database.Devices.Find(id);
if (device != null)
{
var documentTemplate = dbContext.DocumentTemplates.Find(DocumentTemplateId);
var documentTemplate = Database.DocumentTemplates.Find(DocumentTemplateId);
if (documentTemplate != null)
{
var timeStamp = DateTime.Now;
Stream pdf;
using (var generationState = Disco.Models.BI.DocumentTemplates.DocumentState.DefaultState()){
pdf = documentTemplate.GeneratePdf(dbContext, device, DiscoApplication.CurrentUser, timeStamp, generationState);
pdf = documentTemplate.GeneratePdf(Database, device, UserService.CurrentUser, timeStamp, generationState);
}
dbContext.SaveChanges();
Database.SaveChanges();
return File(pdf, "application/pdf", string.Format("{0}_{1}_{2:yyyyMMdd-HHmmss}.pdf", documentTemplate.Id, device.SerialNumber, timeStamp));
}
else
@@ -315,16 +340,17 @@ namespace Disco.Web.Areas.API.Controllers
}
}
[DiscoAuthorize(Claims.Device.Show)]
public virtual ActionResult LastNetworkLogonDate(string id)
{
var device = dbContext.Devices.Find(id);
var device = Database.Devices.Find(id);
if (device == null)
{
return HttpNotFound("Invalid Device Serial Number");
}
if (device.UpdateLastNetworkLogonDate())
dbContext.SaveChanges();
Database.SaveChanges();
var result = new
{
@@ -337,13 +363,14 @@ namespace Disco.Web.Areas.API.Controllers
}
#region Device Attachements
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
[DiscoAuthorize(Claims.Device.ShowAttachments), OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentDownload(int id)
{
var da = dbContext.DeviceAttachments.Find(id);
var da = Database.DeviceAttachments.Find(id);
if (da != null)
{
var filePath = da.RepositoryFilename(dbContext);
var filePath = da.RepositoryFilename(Database);
if (System.IO.File.Exists(filePath))
{
return File(filePath, da.MimeType, da.Filename);
@@ -355,13 +382,14 @@ namespace Disco.Web.Areas.API.Controllers
}
return HttpNotFound("Invalid Attachment Number");
}
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
[DiscoAuthorize(Claims.Device.ShowAttachments), OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentThumbnail(int id)
{
var da = dbContext.DeviceAttachments.Find(id);
var da = Database.DeviceAttachments.Find(id);
if (da != null)
{
var thumbPath = da.RepositoryThumbnailFilename(dbContext);
var thumbPath = da.RepositoryThumbnailFilename(Database);
if (System.IO.File.Exists(thumbPath))
{
if (thumbPath.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
@@ -374,9 +402,11 @@ namespace Disco.Web.Areas.API.Controllers
}
return HttpNotFound("Invalid Attachment Number");
}
[DiscoAuthorize(Claims.Device.Actions.AddAttachments)]
public virtual ActionResult AttachmentUpload(string id, string Comments)
{
var d = dbContext.Devices.Find(id);
var d = Database.Devices.Find(id);
if (d != null)
{
if (Request.Files.Count > 0)
@@ -391,18 +421,18 @@ namespace Disco.Web.Areas.API.Controllers
var da = new Disco.Models.Repository.DeviceAttachment()
{
DeviceSerialNumber = d.SerialNumber,
TechUserId = DiscoApplication.CurrentUser.Id,
TechUserId = UserService.CurrentUserId,
Filename = file.FileName,
MimeType = contentType,
Timestamp = DateTime.Now,
Comments = Comments
};
dbContext.DeviceAttachments.Add(da);
dbContext.SaveChanges();
Database.DeviceAttachments.Add(da);
Database.SaveChanges();
da.SaveAttachment(dbContext, file.InputStream);
da.SaveAttachment(Database, file.InputStream);
da.GenerateThumbnail(dbContext);
da.GenerateThumbnail(Database);
return Json(da.Id, JsonRequestBehavior.AllowGet);
}
@@ -411,9 +441,11 @@ namespace Disco.Web.Areas.API.Controllers
}
throw new Exception("Invalid Device Serial Number");
}
[DiscoAuthorize(Claims.Device.ShowAttachments)]
public virtual ActionResult Attachment(int id)
{
var da = dbContext.DeviceAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
var da = Database.DeviceAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
if (da != null)
{
@@ -427,9 +459,11 @@ namespace Disco.Web.Areas.API.Controllers
}
return Json(new Models.Attachment.AttachmentModel() { Result = "Invalid Attachment Number" }, JsonRequestBehavior.AllowGet);
}
[DiscoAuthorize(Claims.Device.ShowAttachments)]
public virtual ActionResult Attachments(string id)
{
var d = dbContext.Devices.Include("DeviceAttachments.TechUser").Where(m => m.SerialNumber == id).FirstOrDefault();
var d = Database.Devices.Include("DeviceAttachments.TechUser").Where(m => m.SerialNumber == id).FirstOrDefault();
if (d != null)
{
var m = new Models.Attachment.AttachmentsModel()
@@ -442,22 +476,21 @@ namespace Disco.Web.Areas.API.Controllers
}
return Json(new Models.Attachment.AttachmentsModel() { Result = "Invalid Device Serial Number" }, JsonRequestBehavior.AllowGet);
}
[DiscoAuthorizeAny(Claims.Job.Actions.RemoveAnyAttachments, Claims.Job.Actions.RemoveOwnAttachments)]
public virtual ActionResult AttachmentRemove(int id)
{
var da = dbContext.DeviceAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
var da = Database.DeviceAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
if (da != null)
{
// 2012-02-17 G# Remove - 'Delete Own Comments' policy
//if (da.TechUserId == DiscoApplication.CurrentUser.Id)
//{
da.OnDelete(dbContext);
dbContext.SaveChanges();
if (da.TechUserId.Equals(CurrentUser.Id, StringComparison.InvariantCultureIgnoreCase))
Authorization.RequireAny(Claims.Device.Actions.RemoveAnyAttachments, Claims.Device.Actions.RemoveOwnAttachments);
else
Authorization.Require(Claims.Device.Actions.RemoveAnyAttachments);
da.OnDelete(Database);
Database.SaveChanges();
return Json("OK", JsonRequestBehavior.AllowGet);
//}
//else
//{
// return Json("You can only delete your own attachments.", JsonRequestBehavior.AllowGet);
//}
}
return Json("Invalid Attachment Number", JsonRequestBehavior.AllowGet);
}
@@ -465,6 +498,8 @@ namespace Disco.Web.Areas.API.Controllers
#endregion
#region Importing / Exporting
[DiscoAuthorize(Claims.Device.Actions.Import)]
public virtual ActionResult ImportParse(HttpPostedFileBase ImportFile)
{
if (ImportFile == null || ImportFile.ContentLength == 0)
@@ -481,6 +516,7 @@ namespace Disco.Web.Areas.API.Controllers
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
}
[DiscoAuthorize(Claims.Device.Actions.Import)]
public virtual ActionResult ImportProcess(string ParseTaskSessionKey)
{
if (string.IsNullOrWhiteSpace(ParseTaskSessionKey))
@@ -493,10 +529,11 @@ namespace Disco.Web.Areas.API.Controllers
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
}
[DiscoAuthorize(Claims.Device.Actions.Export)]
public virtual ActionResult ExportAllDevices()
{
// Non-Decommissioned Devices
var devices = dbContext.Devices.Where(d => !d.DecommissionedDate.HasValue);
var devices = Database.Devices.Where(d => !d.DecommissionedDate.HasValue);
var export = BI.DeviceBI.Importing.Export.GenerateExport(devices);
@@ -504,13 +541,14 @@ namespace Disco.Web.Areas.API.Controllers
return File(export, "text/csv", filename);
}
#endregion
[DiscoAuthorize(Claims.DiscoAdminAccount)]
public virtual ActionResult MigrateDeviceMacAddressesFromLog()
{
var taskStatus = Disco.BI.DeviceBI.Migration.LogMacAddressImporting.ScheduleImmediately();
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskStatus.SessionId));
}
}
}
@@ -1,32 +1,36 @@
using System;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Plugins;
using Disco.Services.Plugins.Features.WarrantyProvider;
using Disco.Services.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Plugins;
using Disco.Services.Plugins.Features.WarrantyProvider;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceModelController : dbAdminController
public partial class DeviceModelController : AuthorizedDatabaseController
{
const string pDescription = "description";
const string pDefaultPurchaseDate = "defaultpurchasedate";
const string pDefaultWarrantyProvider = "defaultwarrantyprovider";
[DiscoAuthorize(Claims.Config.DeviceModel.Configure)]
public virtual ActionResult Update(int id, string key, string value = null, bool redirect = false)
{
Authorization.Require(Claims.Config.DeviceModel.Configure);
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var deviceModel = dbContext.DeviceModels.Find(id);
var deviceModel = Database.DeviceModels.Find(id);
if (deviceModel != null)
{
switch (key.ToLower())
@@ -63,18 +67,25 @@ namespace Disco.Web.Areas.API.Controllers
}
#region Update Shortcut Methods
[DiscoAuthorize(Claims.Config.DeviceModel.Configure)]
public virtual ActionResult UpdateDescription(int id, string Description = null, bool redirect = false)
{
return Update(id, pDescription, Description, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceModel.Configure)]
public virtual ActionResult UpdateDefaultPurchaseDate(int id, string DefaultPurchaseDate = null, bool redirect = false)
{
return Update(id, pDefaultPurchaseDate, DefaultPurchaseDate, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceModel.Configure)]
public virtual ActionResult UpdateDefaultWarrantyProvider(int id, string DefaultWarrantyProvider = null, bool redirect = false)
{
return Update(id, pDefaultWarrantyProvider, DefaultWarrantyProvider, redirect);
}
#endregion
#region Update Properties
@@ -84,7 +95,7 @@ namespace Disco.Web.Areas.API.Controllers
deviceModel.Description = null;
else
deviceModel.Description = Description;
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateDefaultPurchaseDate(Disco.Models.Repository.DeviceModel deviceModel, string DefaultPurchaseDate)
{
@@ -104,7 +115,7 @@ namespace Disco.Web.Areas.API.Controllers
throw new Exception("Invalid Date Format");
}
}
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateDefaultWarrantyProvider(Disco.Models.Repository.DeviceModel deviceModel, string DefaultWarrantyProvider)
{
@@ -118,7 +129,7 @@ namespace Disco.Web.Areas.API.Controllers
var WarrantyProvider = Plugins.GetPluginFeature(DefaultWarrantyProvider, typeof(WarrantyProviderFeature));
deviceModel.DefaultWarrantyProvider = WarrantyProvider.Id;
}
dbContext.SaveChanges();
Database.SaveChanges();
}
#endregion
@@ -128,7 +139,7 @@ namespace Disco.Web.Areas.API.Controllers
{
if (id.HasValue)
{
var m = dbContext.DeviceModels.Find(id.Value);
var m = Database.DeviceModels.Find(id.Value);
if (m != null)
{
// Try From DataStore
@@ -156,17 +167,18 @@ namespace Disco.Web.Areas.API.Controllers
}
return File(Links.ClientSource.Style.Images.DeviceTypes.Unknown_png, "image/png");
}
[HttpPost]
[DiscoAuthorize(Claims.Config.DeviceModel.Configure), HttpPost]
public virtual ActionResult Image(int id, bool redirect, HttpPostedFileBase Image)
{
if (Image != null && Image.ContentLength > 0)
{
var dm = dbContext.DeviceModels.Find(id);
var dm = Database.DeviceModels.Find(id);
if (dm != null)
{
if (dm.ImageImport(Image.InputStream))
{
dbContext.SaveChanges();
Database.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Config.DeviceModel.Index(dm.Id));
else
@@ -194,15 +206,16 @@ namespace Disco.Web.Areas.API.Controllers
#region Actions
[DiscoAuthorize(Claims.Config.DeviceModel.Delete)]
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
{
try
{
var dm = dbContext.DeviceModels.Find(id);
var dm = Database.DeviceModels.Find(id);
if (dm != null)
{
dm.Delete(dbContext);
dbContext.SaveChanges();
dm.Delete(Database);
Database.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceModel.Index(null));
else
@@ -223,9 +236,10 @@ namespace Disco.Web.Areas.API.Controllers
#region Device Model Components
[DiscoAuthorize(Claims.Config.DeviceModel.Show)]
public virtual ActionResult Component(int id)
{
var dc = dbContext.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
var dc = Database.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
if (dc != null)
{
return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet);
@@ -233,12 +247,13 @@ namespace Disco.Web.Areas.API.Controllers
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet);
}
[DiscoAuthorize(Claims.Config.DeviceModel.ConfigureComponents)]
public virtual ActionResult ComponentAdd(int? id, string Description, string Cost)
{
DeviceModel dm = null;
if (id.HasValue)
{
dm = dbContext.DeviceModels.Find(id.Value);
dm = Database.DeviceModels.Find(id.Value);
if (dm == null)
{
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Model Id" }, JsonRequestBehavior.AllowGet);
@@ -263,36 +278,40 @@ namespace Disco.Web.Areas.API.Controllers
}
dc.JobSubTypes = new List<JobSubType>();
dbContext.DeviceComponents.Add(dc);
dbContext.SaveChanges();
Database.DeviceComponents.Add(dc);
Database.SaveChanges();
return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet);
}
[DiscoAuthorize(Claims.Config.DeviceModel.ConfigureComponents)]
public virtual ActionResult ComponentUpdateJobSubTypes(int id, List<string> JobSubTypes)
{
var dc = dbContext.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
var dc = Database.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
if (dc != null)
{
dc.JobSubTypes.Clear();
if (JobSubTypes != null)
{
var jsts = dbContext.JobSubTypes.Where(jst => JobSubTypes.Contains(jst.JobTypeId + "_" + jst.Id));
var jsts = Database.JobSubTypes.Where(jst => JobSubTypes.Contains(jst.JobTypeId + "_" + jst.Id));
foreach (var jst in jsts)
{
dc.JobSubTypes.Add(jst);
}
}
dbContext.SaveChanges();
Database.SaveChanges();
return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet);
}
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet);
}
[DiscoAuthorize(Claims.Config.DeviceModel.ConfigureComponents)]
public virtual ActionResult ComponentUpdate(int id, string Description, string Cost)
{
var dc = dbContext.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
var dc = Database.DeviceComponents.Include("JobSubTypes").Where(i => i.Id == id).FirstOrDefault();
if (dc != null)
{
decimal cost = 0;
@@ -306,20 +325,22 @@ namespace Disco.Web.Areas.API.Controllers
dc.Description = Description;
dc.Cost = cost;
dbContext.SaveChanges();
Database.SaveChanges();
return Json(new Models.DeviceModel.ComponentModel { Result = "OK", Component = Models.DeviceModel._ComponentModel.FromDeviceComponent(dc) }, JsonRequestBehavior.AllowGet);
}
return Json(new Models.DeviceModel.ComponentModel { Result = "Invalid Device Component Id" }, JsonRequestBehavior.AllowGet);
}
[DiscoAuthorize(Claims.Config.DeviceModel.ConfigureComponents)]
public virtual ActionResult ComponentRemove(int id)
{
var dc = dbContext.DeviceComponents.Include("JobSubTypes").Where(c => c.Id == id).FirstOrDefault();
var dc = Database.DeviceComponents.Include("JobSubTypes").Where(c => c.Id == id).FirstOrDefault();
if (dc != null)
{
dc.JobSubTypes.Clear();
dbContext.DeviceComponents.Remove(dc);
dbContext.SaveChanges();
Database.DeviceComponents.Remove(dc);
Database.SaveChanges();
return Json("OK", JsonRequestBehavior.AllowGet);
}
return Json("Invalid Device Component Id", JsonRequestBehavior.AllowGet);
@@ -327,21 +348,23 @@ namespace Disco.Web.Areas.API.Controllers
#endregion
#region Index
[DiscoAuthorize(Claims.Config.DeviceModel.Show)]
public virtual ActionResult Index()
{
var deviceModels = dbContext.DeviceModels.ToArray().Select(dm => Models.DeviceModel._DeviceModel.FromDeviceModel(dm)).ToArray();
var deviceModels = Database.DeviceModels.ToArray().Select(dm => Models.DeviceModel._DeviceModel.FromDeviceModel(dm)).ToArray();
return Json(deviceModels, JsonRequestBehavior.AllowGet);
}
#endregion
#region Exporting
[DiscoAuthorizeAll(Claims.Config.DeviceModel.Show, Claims.Device.Actions.Export)]
public virtual ActionResult ExportDevices(int id)
{
DeviceModel dm = dbContext.DeviceModels.Find(id);
DeviceModel dm = Database.DeviceModels.Find(id);
if (dm == null)
throw new ArgumentNullException("id", "Invalid Device Model Id");
var devices = dbContext.Devices.Where(d => !d.DecommissionedDate.HasValue && d.DeviceModelId == dm.Id);
var devices = Database.Devices.Where(d => !d.DecommissionedDate.HasValue && d.DeviceModelId == dm.Id);
var export = BI.DeviceBI.Importing.Export.GenerateExport(devices);
@@ -1,16 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.BI.Extensions;
using Disco.Data.Configuration.Modules;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using System;
using System.Linq;
using System.Web.Mvc;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceProfileController : dbAdminController
public partial class DeviceProfileController : AuthorizedDatabaseController
{
const string pDescription = "description";
@@ -25,15 +23,18 @@ namespace Disco.Web.Areas.API.Controllers
const string pEnforceOrganisationalUnit = "enforceorganisationalunit";
const string pProvisionADAccount = "provisionadaccount";
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
public virtual ActionResult Update(int id, string key, string value = null, Nullable<bool> redirect = null)
{
Authorization.Require(Claims.Config.DeviceProfile.Configure);
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var deviceProfile = dbContext.DeviceProfiles.Find(id);
var deviceProfile = Database.DeviceProfiles.Find(id);
if (deviceProfile != null)
{
switch (key.ToLower())
@@ -60,6 +61,7 @@ namespace Disco.Web.Areas.API.Controllers
UpdateDefaultOrganisationAddress(deviceProfile, value);
break;
case pComputerNameTemplate:
Authorization.Require(Claims.Config.DeviceProfile.ConfigureComputerNameTemplate);
UpdateComputerNameTemplate(deviceProfile, value);
break;
case pEnforceComputerNameConvention:
@@ -92,54 +94,75 @@ namespace Disco.Web.Areas.API.Controllers
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#region Update Shortcut Methods
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
public virtual ActionResult UpdateDescription(int id, string Description = null, Nullable<bool> redirect = null)
{
return Update(id, pDescription, Description, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
public virtual ActionResult UpdateName(int id, string ProfileName = null, Nullable<bool> redirect = null)
{
return Update(id, pName, ProfileName, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
public virtual ActionResult UpdateShortName(int id, string ShortName = null, Nullable<bool> redirect = null)
{
return Update(id, pShortName, ShortName, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
public virtual ActionResult UpdateDistributionType(int id, string DistributionType = null, Nullable<bool> redirect = null)
{
return Update(id, pDistributionType, DistributionType, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
public virtual ActionResult UpdateCertificateProviderId(int id, string CertificateProviderId = null, Nullable<bool> redirect = null)
{
return Update(id, pCertificateProviderId, CertificateProviderId, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
public virtual ActionResult UpdateOrganisationalUnit(int id, string OrganisationalUnit = null, Nullable<bool> redirect = null)
{
return Update(id, pOrganisationalUnit, OrganisationalUnit, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
public virtual ActionResult UpdateDefaultOrganisationAddress(int id, string DefaultOrganisationAddress = null, Nullable<bool> redirect = null)
{
return Update(id, pDefaultOrganisationAddress, DefaultOrganisationAddress, redirect);
}
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Configure, Claims.Config.DeviceProfile.ConfigureComputerNameTemplate)]
public virtual ActionResult UpdateComputerNameTemplate(int id, string ComputerNameTemplate = null, Nullable<bool> redirect = null)
{
return Update(id, pComputerNameTemplate, ComputerNameTemplate, redirect);
}
// Added 2012-06-14 G#
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
public virtual ActionResult UpdateEnforceComputerNameConvention(int id, string EnforceComputerNameConvention = null, Nullable<bool> redirect = null)
{
return Update(id, pEnforceComputerNameConvention, EnforceComputerNameConvention, redirect);
}
// Added 2012-06-14 G#
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
public virtual ActionResult UpdateEnforceOrganisationalUnit(int id, string EnforceOrganisationalUnit = null, Nullable<bool> redirect = null)
{
return Update(id, pEnforceOrganisationalUnit, EnforceOrganisationalUnit, redirect);
}
// Added 2012-06-28 G#
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
public virtual ActionResult UpdateProvisionADAccount(int id, string ProvisionADAccount = null, Nullable<bool> redirect = null)
{
return Update(id, pProvisionADAccount, ProvisionADAccount, redirect);
}
#endregion
#region Update Properties
@@ -149,7 +172,7 @@ namespace Disco.Web.Areas.API.Controllers
deviceProfile.Description = null;
else
deviceProfile.Description = Description;
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateName(Disco.Models.Repository.DeviceProfile deviceProfile, string Name)
@@ -158,7 +181,7 @@ namespace Disco.Web.Areas.API.Controllers
throw new Exception("Profile name cannot be empty");
else
deviceProfile.Name = Name;
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateShortName(Disco.Models.Repository.DeviceProfile deviceProfile, string ShortName)
@@ -167,7 +190,7 @@ namespace Disco.Web.Areas.API.Controllers
throw new Exception("Profile short name cannot be empty");
else
deviceProfile.ShortName = ShortName;
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateDistributionType(Disco.Models.Repository.DeviceProfile deviceProfile, string DistributionType)
@@ -175,10 +198,8 @@ namespace Disco.Web.Areas.API.Controllers
int iDt;
if (int.TryParse(DistributionType, out iDt))
{
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//deviceProfile.Configuration(dbContext).DistributionType = (DeviceProfileConfiguration.DeviceProfileDistributionTypes)iDt;
deviceProfile.DistributionType = (Disco.Models.Repository.DeviceProfile.DistributionTypes)iDt;
dbContext.SaveChanges();
Database.SaveChanges();
return;
}
throw new Exception("Invalid Distribution Type Number");
@@ -199,28 +220,29 @@ namespace Disco.Web.Areas.API.Controllers
else
deviceProfile.CertificateProviderId = featureManifest.Id;
}
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateOrganisationalUnit(Disco.Models.Repository.DeviceProfile deviceProfile, string OrganisationalUnit)
{
if (string.IsNullOrWhiteSpace(OrganisationalUnit))
OrganisationalUnit = null;
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//deviceProfile.Configuration(dbContext).OrganisationalUnit = OrganisationalUnit;
deviceProfile.OrganisationalUnit = OrganisationalUnit;
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateComputerNameTemplate(Disco.Models.Repository.DeviceProfile deviceProfile, string ComputerNameTemplate)
{
Authorization.Require(Claims.Config.DeviceProfile.ConfigureComputerNameTemplate);
if (string.IsNullOrWhiteSpace(ComputerNameTemplate))
throw new Exception("ComputerNameTemplate is Required");
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//deviceProfile.Configuration(dbContext).ComputerNameTemplate = ComputerNameTemplate;
deviceProfile.ComputerNameTemplate = ComputerNameTemplate;
dbContext.SaveChanges();
Database.SaveChanges();
deviceProfile.ComputerNameInvalidateCache();
}
@@ -237,7 +259,7 @@ namespace Disco.Web.Areas.API.Controllers
int daoId;
if (int.TryParse(DefaultOrganisationAddress, out daoId))
{
var oa = dbContext.DiscoConfiguration.OrganisationAddresses.GetAddress(daoId);
var oa = Database.DiscoConfiguration.OrganisationAddresses.GetAddress(daoId);
if (oa != null)
{
deviceProfile.DefaultOrganisationAddress = oa.Id;
@@ -254,10 +276,9 @@ namespace Disco.Web.Areas.API.Controllers
}
dbContext.SaveChanges();
Database.SaveChanges();
}
// Added 2012-06-14 G#
private void UpdateEnforceComputerNameConvention(Disco.Models.Repository.DeviceProfile deviceProfile, string EnforceComputerNameConvention)
{
bool bValue;
@@ -265,12 +286,12 @@ namespace Disco.Web.Areas.API.Controllers
{
deviceProfile.EnforceComputerNameConvention = bValue;
dbContext.SaveChanges();
Database.SaveChanges();
return;
}
throw new Exception("Invalid Boolean Value");
}
// Added 2012-06-14 G#
private void UpdateEnforceOrganisationalUnit(Disco.Models.Repository.DeviceProfile deviceProfile, string EnforceOrganisationalUnit)
{
bool bValue;
@@ -278,12 +299,12 @@ namespace Disco.Web.Areas.API.Controllers
{
deviceProfile.EnforceOrganisationalUnit = bValue;
dbContext.SaveChanges();
Database.SaveChanges();
return;
}
throw new Exception("Invalid Boolean Value");
}
// Added 2012-06-28 G#
private void UpdateProvisionADAccount(Disco.Models.Repository.DeviceProfile deviceProfile, string ProvisionADAccount)
{
bool bValue;
@@ -291,13 +312,14 @@ namespace Disco.Web.Areas.API.Controllers
{
deviceProfile.ProvisionADAccount = bValue;
dbContext.SaveChanges();
Database.SaveChanges();
return;
}
throw new Exception("Invalid Boolean Value");
}
#endregion
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
public virtual ActionResult OrganisationalUnits()
{
var OUs = BI.Interop.ActiveDirectory.ActiveDirectory.GetOrganisationalUnitStructure();
@@ -306,15 +328,16 @@ namespace Disco.Web.Areas.API.Controllers
#region Actions
[DiscoAuthorize(Claims.Config.DeviceProfile.Delete)]
public virtual ActionResult Delete(int id, Nullable<bool> redirect = false)
{
try
{
var dp = dbContext.DeviceProfiles.Find(id);
var dp = Database.DeviceProfiles.Find(id);
if (dp != null)
{
dp.Delete(dbContext);
dbContext.SaveChanges();
dp.Delete(Database);
Database.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceProfile.Index(null));
else
@@ -334,15 +357,17 @@ namespace Disco.Web.Areas.API.Controllers
#endregion
#region Defaults
[DiscoAuthorize(Claims.Config.DeviceProfile.ConfigureDefaults)]
public virtual ActionResult Default(int id, Nullable<bool> redirect = null)
{
try
{
var dp = dbContext.DeviceProfiles.Find(id);
var dp = Database.DeviceProfiles.Find(id);
if (dp != null)
{
dbContext.DiscoConfiguration.DeviceProfiles.DefaultDeviceProfileId = dp.Id;
dbContext.SaveChanges();
Database.DiscoConfiguration.DeviceProfiles.DefaultDeviceProfileId = dp.Id;
Database.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceProfile.Index(id));
else
@@ -358,6 +383,8 @@ namespace Disco.Web.Areas.API.Controllers
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
[DiscoAuthorize(Claims.Config.DeviceProfile.ConfigureDefaults)]
public virtual ActionResult DefaultAddDeviceOffline(int id, Nullable<bool> redirect = false)
{
try
@@ -365,7 +392,7 @@ namespace Disco.Web.Areas.API.Controllers
int defaultValue = 0;
if (id > 0)
{
var dp = dbContext.DeviceProfiles.Find(id);
var dp = Database.DeviceProfiles.Find(id);
if (dp != null)
{
defaultValue = dp.Id;
@@ -375,8 +402,8 @@ namespace Disco.Web.Areas.API.Controllers
throw new Exception("Invalid Device Profile Number");
}
}
dbContext.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId = defaultValue;
dbContext.SaveChanges();
Database.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId = defaultValue;
Database.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceProfile.Index(id));
else
@@ -390,16 +417,18 @@ namespace Disco.Web.Areas.API.Controllers
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Exporting
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Show, Claims.Device.Actions.Export)]
public virtual ActionResult ExportDevices(int id)
{
DeviceProfile dp = dbContext.DeviceProfiles.Find(id);
DeviceProfile dp = Database.DeviceProfiles.Find(id);
if (dp == null)
throw new ArgumentNullException("id", "Invalid Device Profile Id");
var devices = dbContext.Devices.Where(d => !d.DecommissionedDate.HasValue && d.DeviceProfileId == dp.Id);
var devices = Database.Devices.Where(d => !d.DecommissionedDate.HasValue && d.DeviceProfileId == dp.Id);
var export = BI.DeviceBI.Importing.Export.GenerateExport(devices);
@@ -1,15 +1,18 @@
using System;
using Disco.BI;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Users;
using Disco.Services.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.BI.Extensions;
using Disco.Models.Repository;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DocumentTemplateController : dbAdminController
public partial class DocumentTemplateController : AuthorizedDatabaseController
{
const string pDescription = "description";
@@ -17,6 +20,7 @@ namespace Disco.Web.Areas.API.Controllers
const string pFilterExpression = "filterexpression";
const string pFlattenForm = "flattenform";
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
{
try
@@ -25,7 +29,7 @@ namespace Disco.Web.Areas.API.Controllers
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
var documentTemplate = Database.DocumentTemplates.Find(id);
if (documentTemplate != null)
{
switch (key.ToLower())
@@ -37,6 +41,7 @@ namespace Disco.Web.Areas.API.Controllers
UpdateScope(documentTemplate, value);
break;
case pFilterExpression:
Authorization.Require(Claims.Config.DocumentTemplate.ConfigureFilterExpression);
UpdateFilterExpression(documentTemplate, value);
break;
case pFlattenForm:
@@ -64,16 +69,16 @@ namespace Disco.Web.Areas.API.Controllers
}
}
[HttpGet]
[DiscoAuthorize(Claims.Config.DocumentTemplate.Upload), HttpGet]
public virtual ActionResult Template(string id)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
var documentTemplate = Database.DocumentTemplates.Find(id);
if (documentTemplate == null)
throw new ArgumentException("Invalid Document Template Id", "id");
var filename = documentTemplate.RepositoryFilename(dbContext);
var filename = documentTemplate.RepositoryFilename(Database);
if (System.IO.File.Exists(filename))
{
return File(filename, DocumentTemplate.PdfMimeType, string.Format("{0}.pdf", documentTemplate.Id));
@@ -83,18 +88,19 @@ namespace Disco.Web.Areas.API.Controllers
throw new InvalidOperationException("Template not found");
}
}
[HttpPost]
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Upload, Claims.Config.DocumentTemplate.Configure), HttpPost]
public virtual ActionResult Template(string id, bool redirect, HttpPostedFileBase Template)
{
try
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
var documentTemplate = Database.DocumentTemplates.Find(id);
if (documentTemplate == null)
throw new ArgumentException("Invalid Document Template Id", "id");
documentTemplate.SavePdfTemplate(dbContext, Template.InputStream);
documentTemplate.SavePdfTemplate(Database, Template.InputStream);
if (redirect)
return RedirectToAction(MVC.Config.DocumentTemplate.Index(documentTemplate.Id));
@@ -111,29 +117,34 @@ namespace Disco.Web.Areas.API.Controllers
}
#region Update Shortcut Methods
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
public virtual ActionResult UpdateDescription(string id, string Description = null, bool redirect = false)
{
return Update(id, pDescription, Description, redirect);
}
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Configure, Claims.Config.DocumentTemplate.ConfigureFilterExpression)]
public virtual ActionResult UpdateFilterExpression(string id, string FilterExpression = null, bool redirect = false)
{
return Update(id, pFilterExpression, FilterExpression, redirect);
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
public virtual ActionResult UpdateFlattenForm(string id, string FlattenForm = null, bool redirect = false)
{
return Update(id, pFlattenForm, FlattenForm, redirect);
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
public virtual ActionResult UpdateScope(string id, string Scope = null, bool redirect = false)
{
return Update(id, pScope, Scope, redirect);
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.Configure)]
public virtual ActionResult UpdateSubTypes(string id, List<string> SubTypes = null)
{
try
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
var documentTemplate = Database.DocumentTemplates.Find(id);
UpdateSubTypes(documentTemplate, SubTypes);
@@ -153,7 +164,7 @@ namespace Disco.Web.Areas.API.Controllers
if (!string.IsNullOrWhiteSpace(Description))
{
documentTemplate.Description = Description.Trim();
dbContext.SaveChanges();
Database.SaveChanges();
return;
}
throw new Exception("Invalid Description");
@@ -164,7 +175,7 @@ namespace Disco.Web.Areas.API.Controllers
{
if (Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.ToList().Contains(Scope))
{
dbContext.Configuration.LazyLoadingEnabled = true;
Database.Configuration.LazyLoadingEnabled = true;
documentTemplate.Scope = Scope;
@@ -175,7 +186,7 @@ namespace Disco.Web.Areas.API.Controllers
documentTemplate.JobSubTypes.Remove(st);
}
dbContext.SaveChanges();
Database.SaveChanges();
return;
}
}
@@ -194,7 +205,7 @@ namespace Disco.Web.Areas.API.Controllers
// Invalidate Cache
documentTemplate.FilterExpressionInvalidateCache();
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateFlattenForm(Disco.Models.Repository.DocumentTemplate documentTemplate, string FlattenForm)
{
@@ -211,11 +222,11 @@ namespace Disco.Web.Areas.API.Controllers
throw new Exception("Invalid Boolean Format");
}
dbContext.SaveChanges();
Database.SaveChanges();
}
private void UpdateSubTypes(Disco.Models.Repository.DocumentTemplate documentTemplate, List<string> SubTypes)
{
dbContext.Configuration.LazyLoadingEnabled = true;
Database.Configuration.LazyLoadingEnabled = true;
// Remove All Existing
if (documentTemplate.JobSubTypes != null)
@@ -232,35 +243,21 @@ namespace Disco.Web.Areas.API.Controllers
{
var typeId = stId.Substring(0, stId.IndexOf("_"));
var subTypeId = stId.Substring(stId.IndexOf("_") + 1);
var subType = dbContext.JobSubTypes.FirstOrDefault(jst => jst.JobTypeId == typeId && jst.Id == subTypeId);
var subType = Database.JobSubTypes.FirstOrDefault(jst => jst.JobTypeId == typeId && jst.Id == subTypeId);
subTypes.Add(subType);
}
documentTemplate.JobSubTypes = subTypes;
}
dbContext.SaveChanges();
Database.SaveChanges();
}
#endregion
#region Actions
[OutputCache(NoStore = true, Duration = 0)]
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages), OutputCache(NoStore = true, Duration = 0)]
public virtual ActionResult ImporterThumbnail(string SessionId, int PageNumber)
{
// Load from Cache
//var cacheKey = string.Format("Disco.BI.DocumentImporter-{0}-{1}", SessionId, PageNumber);
//var cacheValue = HttpContext.Cache.Get(cacheKey);
//if (cacheValue != null)
//{
// var cacheFile = cacheValue as byte[];
// if (cacheFile != null)
// {
// return File(cacheFile, "image/png");
// }
//}
var dataStoreSessionPagesCacheLocation = DataStore.CreateLocation(dbContext, "Cache\\DocumentDropBox_SessionPages");
var dataStoreSessionPagesCacheLocation = DataStore.CreateLocation(Database, "Cache\\DocumentDropBox_SessionPages");
var filename = System.IO.Path.Combine(dataStoreSessionPagesCacheLocation, string.Format("{0}-{1}", SessionId, PageNumber));
if (System.IO.File.Exists(filename))
return File(filename, "image/png");
@@ -268,9 +265,10 @@ namespace Disco.Web.Areas.API.Controllers
return File("~/ClientSource/Style/Images/Status/fileBroken256.png", "image/png");
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)]
public virtual ActionResult ImporterUndetectedFiles()
{
var undetectedLocation = DataStore.CreateLocation(dbContext, "DocumentDropBox_Unassigned");
var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned");
var undetectedDirectory = new System.IO.DirectoryInfo(undetectedLocation);
var m = undetectedDirectory.GetFiles("*.pdf").Select(f => new Models.DocumentTemplate.ImporterUndetectedFilesModel()
{
@@ -281,6 +279,8 @@ namespace Disco.Web.Areas.API.Controllers
return Json(m);
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)]
public virtual ActionResult ImporterUndetectedDataIdLookup(string id, string term, int limitCount = 20)
{
if (!string.IsNullOrEmpty(id) && !string.IsNullOrWhiteSpace(term))
@@ -306,7 +306,7 @@ namespace Disco.Web.Areas.API.Controllers
}
else
{
var documentTemplate = dbContext.DocumentTemplates.Find(id);
var documentTemplate = Database.DocumentTemplates.Find(id);
if (documentTemplate != null)
searchScope = documentTemplate.Scope;
else
@@ -318,13 +318,13 @@ namespace Disco.Web.Areas.API.Controllers
switch (searchScope)
{
case DocumentTemplate.DocumentTemplateScopes.Device:
results = BI.DeviceBI.Searching.Search(dbContext, term, limitCount).Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray();
results = BI.DeviceBI.Searching.Search(Database, term, limitCount).Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray();
break;
case DocumentTemplate.DocumentTemplateScopes.Job:
results = BI.JobBI.Searching.Search(dbContext, term, limitCount, false).Items.Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray();
results = BI.JobBI.Searching.Search(Database, term, limitCount, false).Items.Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray();
break;
case DocumentTemplate.DocumentTemplateScopes.User:
results = BI.UserBI.Searching.Search(dbContext, term, limitCount).Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray();
results = BI.UserBI.Searching.Search(Database, term, limitCount).Select(sr => Models.DocumentTemplate.ImporterUndetectedDataIdLookupModel.FromSearchResultItem(sr)).ToArray();
break;
default:
results = null;
@@ -337,11 +337,13 @@ namespace Disco.Web.Areas.API.Controllers
}
return Json(null, JsonRequestBehavior.AllowGet);
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)]
public virtual ActionResult ImporterUndetectedFile(string id, Nullable<bool> Source, Nullable<bool> Thumbnail)
{
if (!string.IsNullOrEmpty(id))
{
var undetectedLocation = DataStore.CreateLocation(dbContext, "DocumentDropBox_Unassigned");
var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned");
if (Source.HasValue && Source.Value)
{
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".pdf"));
@@ -372,11 +374,13 @@ namespace Disco.Web.Areas.API.Controllers
}
return HttpNotFound();
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)]
public virtual ActionResult ImporterUndetectedAssign(string id, string DocumentTemplateId, string DataId)
{
var undetectedLocation = DataStore.CreateLocation(dbContext, "DocumentDropBox_Unassigned");
var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned");
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".pdf"));
if (BI.Interop.Pdf.PdfImporter.ProcessPdfAttachment(filename, dbContext, DocumentTemplateId, DataId, DiscoApplication.CurrentUser.Id, DateTime.Now))
if (BI.Interop.Pdf.PdfImporter.ProcessPdfAttachment(filename, Database, DocumentTemplateId, DataId, UserService.CurrentUserId, DateTime.Now))
{
// Delete File
System.IO.File.Delete(filename);
@@ -396,9 +400,11 @@ namespace Disco.Web.Areas.API.Controllers
return Json("Unable to Import File with the supplied parameters");
}
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)]
public virtual ActionResult ImporterUndetectedDelete(string id)
{
var undetectedLocation = DataStore.CreateLocation(dbContext, "DocumentDropBox_Unassigned");
var undetectedLocation = DataStore.CreateLocation(Database, "DocumentDropBox_Unassigned");
var filename = System.IO.Path.Combine(undetectedLocation, string.Concat(id, ".pdf"));
if (System.IO.File.Exists(filename))
{
@@ -421,32 +427,49 @@ namespace Disco.Web.Areas.API.Controllers
}
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.BulkGenerate)]
public virtual ActionResult BulkGenerate(string id, string DataIds = null)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(DataIds))
throw new ArgumentNullException("DataIds");
var documentTemplate = dbContext.DocumentTemplates.Find(id);
var documentTemplate = Database.DocumentTemplates.Find(id);
if (documentTemplate == null)
throw new ArgumentException("Invalid Document Template Id", "id");
switch (documentTemplate.Scope)
{
case DocumentTemplate.DocumentTemplateScopes.Device:
Authorization.Require(Claims.Device.Actions.GenerateDocuments);
break;
case DocumentTemplate.DocumentTemplateScopes.Job:
Authorization.Require(Claims.Job.Actions.GenerateDocuments);
break;
case DocumentTemplate.DocumentTemplateScopes.User:
Authorization.Require(Claims.User.Actions.GenerateDocuments);
break;
default:
throw new InvalidOperationException("Unknown DocumentType Scope");
}
var dataIds = DataIds.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
var timeStamp = DateTime.Now;
var pdf = documentTemplate.GeneratePdfBulk(dbContext, DiscoApplication.CurrentUser, timeStamp, dataIds);
var pdf = documentTemplate.GeneratePdfBulk(Database, UserService.CurrentUser, timeStamp, dataIds);
return File(pdf, "application/pdf", string.Format("{0}_Bulk_{1:yyyyMMdd-HHmmss}.pdf", documentTemplate.Id, timeStamp));
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.Delete)]
public virtual ActionResult Delete(string id, Nullable<bool> redirect = false)
{
try
{
var at = dbContext.DocumentTemplates.Include("JobSubTypes").FirstOrDefault(a => a.Id == id);
var at = Database.DocumentTemplates.Include("JobSubTypes").FirstOrDefault(a => a.Id == id);
if (at != null)
{
at.Delete(dbContext);
dbContext.SaveChanges();
at.Delete(Database);
Database.SaveChanges();
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DocumentTemplate.Index(null));
else
@@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Authorization;
using Disco.Services.Web;
using System.Web.Mvc;
namespace Disco.Web.Areas.API.Controllers
{
public partial class ExpressionsController : dbAdminController
[DiscoAuthorize(Claims.DiscoAdminAccount)]
public partial class ExpressionsController : AuthorizedDatabaseController
{
public virtual ActionResult ValidateExpression(string Expression)
{
File diff suppressed because it is too large Load Diff
@@ -1,22 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI.Extensions;
using Disco.Services.Authorization;
using Disco.Services.Logging;
using Disco.Services.Tasks;
using Disco.Services.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
namespace Disco.Web.Areas.API.Controllers
{
public partial class LoggingController : dbAdminController
public partial class LoggingController : AuthorizedDatabaseController
{
[DiscoAuthorize(Claims.Config.Logging.Show)]
public virtual ActionResult Modules()
{
var m = LogContext.LogModules.Values.Select(lm => Models.Logs.LogModuleModel.FromLogModule(lm)).ToList();
return Json(m, JsonRequestBehavior.AllowGet);
}
[DiscoAuthorize(Claims.Config.Logging.Show)]
public virtual ActionResult RetrieveEvents(string Format, DateTime? Start = null, DateTime? End = null, int? ModuleId = null, List<int> EventTypeIds = null, int? Take = null)
{
var logRetriever = new ReadLogContext()
@@ -27,7 +30,7 @@ namespace Disco.Web.Areas.API.Controllers
EventTypes = EventTypeIds,
Take = Take
};
var results = logRetriever.Query(dbContext);
var results = logRetriever.Query(Database);
switch (Format.ToLower())
{
@@ -46,6 +49,7 @@ namespace Disco.Web.Areas.API.Controllers
}
}
public virtual ActionResult ScheduledTaskStatus(string id)
{
if (string.IsNullOrEmpty(id))
@@ -1,16 +1,18 @@
using System;
using System.Collections.Generic;
using Disco.Services.Authorization;
using Disco.Services.Plugins;
using Disco.Services.Plugins.CommunityInterop;
using Disco.Services.Web;
using System;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.Services.Plugins;
using Disco.Services.Plugins.CommunityInterop;
namespace Disco.Web.Areas.API.Controllers
{
public partial class PluginController : dbAdminController
public partial class PluginController : AuthorizedDatabaseController
{
[DiscoAuthorize(Claims.Config.Plugin.Install)]
public virtual ActionResult UpdateLibraryCatalogue()
{
var status = PluginLibraryUpdateTask.ScheduleNow();
@@ -20,6 +22,7 @@ namespace Disco.Web.Areas.API.Controllers
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
}
[DiscoAuthorize(Claims.Config.Plugin.Install)]
public virtual ActionResult UpdateAll()
{
var status = UpdatePluginTask.UpdateAllPlugins();
@@ -27,6 +30,7 @@ namespace Disco.Web.Areas.API.Controllers
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
}
[DiscoAuthorize(Claims.Config.Plugin.Install)]
public virtual ActionResult Update(string PluginId)
{
if (string.IsNullOrEmpty(PluginId))
@@ -37,6 +41,7 @@ namespace Disco.Web.Areas.API.Controllers
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
}
[DiscoAuthorizeAll(Claims.Config.Plugin.Install, Claims.Config.Plugin.InstallLocal)]
public virtual ActionResult UpdateLocal(string PluginId, HttpPostedFileBase Plugin)
{
if (string.IsNullOrEmpty(PluginId))
@@ -45,10 +50,10 @@ namespace Disco.Web.Areas.API.Controllers
if (Plugin == null || Plugin.ContentLength <= 0 || string.IsNullOrWhiteSpace(Plugin.FileName))
throw new ArgumentException("A discoPlugin file must be uploaded", "Plugin");
var tempPluginLocation = Path.Combine(dbContext.DiscoConfiguration.PluginPackagesLocation, Path.GetFileName(Plugin.FileName));
var tempPluginLocation = Path.Combine(Database.DiscoConfiguration.PluginPackagesLocation, Path.GetFileName(Plugin.FileName));
if (!Directory.Exists(dbContext.DiscoConfiguration.PluginPackagesLocation))
Directory.CreateDirectory(dbContext.DiscoConfiguration.PluginPackagesLocation);
if (!Directory.Exists(Database.DiscoConfiguration.PluginPackagesLocation))
Directory.CreateDirectory(Database.DiscoConfiguration.PluginPackagesLocation);
if (System.IO.File.Exists(tempPluginLocation))
System.IO.File.Delete(tempPluginLocation);
@@ -60,6 +65,7 @@ namespace Disco.Web.Areas.API.Controllers
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
}
[DiscoAuthorize(Claims.Config.Plugin.Uninstall)]
public virtual ActionResult Uninstall(string id, bool UninstallData)
{
if (string.IsNullOrEmpty(id))
@@ -72,12 +78,13 @@ namespace Disco.Web.Areas.API.Controllers
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
}
[DiscoAuthorize(Claims.Config.Plugin.Install)]
public virtual ActionResult Install(string PluginId)
{
if (string.IsNullOrEmpty(PluginId))
throw new ArgumentNullException("PluginId", "A PluginId must be supplied");
var catalogue = Plugins.LoadCatalogue(dbContext);
var catalogue = Plugins.LoadCatalogue(Database);
var plugin = catalogue.Plugins.FirstOrDefault(p => p.Id.Equals(PluginId));
if (plugin == null)
@@ -87,22 +94,23 @@ namespace Disco.Web.Areas.API.Controllers
if (Plugins.PluginInstalled(plugin.Id))
throw new InvalidOperationException("This plugin is already installed");
var tempPluginLocation = Path.Combine(dbContext.DiscoConfiguration.PluginPackagesLocation, string.Format("{0}.discoPlugin", plugin.Id));
var tempPluginLocation = Path.Combine(Database.DiscoConfiguration.PluginPackagesLocation, string.Format("{0}.discoPlugin", plugin.Id));
var status = InstallPluginTask.InstallPlugin(plugin.LatestDownloadUrl, tempPluginLocation, true);
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
}
[DiscoAuthorizeAll(Claims.Config.Plugin.Install, Claims.Config.Plugin.InstallLocal)]
public virtual ActionResult InstallLocal(HttpPostedFileBase Plugin)
{
if (Plugin == null || Plugin.ContentLength <= 0 || string.IsNullOrWhiteSpace(Plugin.FileName))
throw new ArgumentException("A discoPlugin file must be uploaded", "Plugin");
var tempPluginLocation = Path.Combine(dbContext.DiscoConfiguration.PluginPackagesLocation, Path.GetFileName(Plugin.FileName));
var tempPluginLocation = Path.Combine(Database.DiscoConfiguration.PluginPackagesLocation, Path.GetFileName(Plugin.FileName));
if (!Directory.Exists(dbContext.DiscoConfiguration.PluginPackagesLocation))
Directory.CreateDirectory(dbContext.DiscoConfiguration.PluginPackagesLocation);
if (!Directory.Exists(Database.DiscoConfiguration.PluginPackagesLocation))
Directory.CreateDirectory(Database.DiscoConfiguration.PluginPackagesLocation);
if (System.IO.File.Exists(tempPluginLocation))
System.IO.File.Delete(tempPluginLocation);
@@ -1,22 +1,20 @@
using System;
using System.Collections.Generic;
using Disco.BI.Extensions;
using Disco.BI.Interop.ActiveDirectory;
using Disco.Services.Authorization;
using Disco.Services.Web;
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.BI.Extensions;
using System.IO;
using System.Drawing;
using System.Text;
using Disco.Services.Tasks;
using Disco.BI.Interop.ActiveDirectory;
using Disco.Models.Repository;
namespace Disco.Web.Areas.API.Controllers
{
public partial class SystemController : dbAdminController
public partial class SystemController : AuthorizedDatabaseController
{
[DiscoAuthorize(Claims.Config.System.Show)]
public virtual ActionResult UpdateLastNetworkLogonDates()
{
var taskStatus = ActiveDirectoryUpdateLastNetworkLogonDateJob.ScheduleImmediately();
@@ -24,44 +22,46 @@ namespace Disco.Web.Areas.API.Controllers
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskStatus.SessionId));
}
[DiscoAuthorize(Claims.DiscoAdminAccount)]
public virtual ActionResult UpdateAttachmentThumbnails()
{
// Device Attachments
var das = dbContext.DeviceAttachments.Where(da => da.MimeType == "application/pdf");
var das = Database.DeviceAttachments.Where(da => da.MimeType == "application/pdf");
foreach (var da in das)
{
var fileName = da.RepositoryThumbnailFilename(dbContext);
var fileName = da.RepositoryThumbnailFilename(Database);
if (!System.IO.File.Exists(fileName))
{
da.GenerateThumbnail(dbContext);
da.GenerateThumbnail(Database);
}
}
// User Attachments
var uas = dbContext.UserAttachments.Where(ua => ua.MimeType == "application/pdf");
var uas = Database.UserAttachments.Where(ua => ua.MimeType == "application/pdf");
foreach (var ua in uas)
{
var fileName = ua.RepositoryThumbnailFilename(dbContext);
var fileName = ua.RepositoryThumbnailFilename(Database);
if (!System.IO.File.Exists(fileName))
{
ua.GenerateThumbnail(dbContext);
ua.GenerateThumbnail(Database);
}
}
// Job Attachments
var jas = dbContext.JobAttachments.Where(ja => ja.MimeType == "application/pdf");
var jas = Database.JobAttachments.Where(ja => ja.MimeType == "application/pdf");
foreach (var ja in jas)
{
var fileName = ja.RepositoryThumbnailFilename(dbContext);
var fileName = ja.RepositoryThumbnailFilename(Database);
if (!System.IO.File.Exists(fileName))
{
ja.GenerateThumbnail(dbContext);
ja.GenerateThumbnail(Database);
}
}
return Content("Done", "text/text");
}
[DiscoAuthorize(Claims.Config.System.Show)]
public virtual ActionResult UpdateCheck()
{
var ts = Disco.BI.Interop.Community.UpdateCheckTask.ScheduleNow();
@@ -72,16 +72,17 @@ namespace Disco.Web.Areas.API.Controllers
#region Organisation
#region Organisation Name
[DiscoAuthorize(Claims.Config.Organisation.ConfigureName)]
public virtual ActionResult UpdateOrganisationName(string OrganisationName, bool redirect = false)
{
if (string.IsNullOrWhiteSpace(OrganisationName))
dbContext.DiscoConfiguration.OrganisationName = null;
Database.DiscoConfiguration.OrganisationName = null;
else
dbContext.DiscoConfiguration.OrganisationName = OrganisationName;
Database.DiscoConfiguration.OrganisationName = OrganisationName;
dbContext.SaveChanges();
Database.SaveChanges();
DiscoApplication.OrganisationName = dbContext.DiscoConfiguration.OrganisationName;
DiscoApplication.OrganisationName = Database.DiscoConfiguration.OrganisationName;
if (redirect)
return RedirectToAction(MVC.Config.Organisation.Index());
@@ -99,7 +100,7 @@ namespace Disco.Web.Areas.API.Controllers
if (Height < 1)
throw new ArgumentOutOfRangeException("Height");
using (Stream logoStream = dbContext.DiscoConfiguration.OrganisationLogo)
using (Stream logoStream = Database.DiscoConfiguration.OrganisationLogo)
{
using (Image logoBitmap = Bitmap.FromStream(logoStream))
{
@@ -107,12 +108,12 @@ namespace Disco.Web.Areas.API.Controllers
}
}
}
[HttpPost]
[DiscoAuthorize(Claims.Config.Organisation.ConfigureLogo), HttpPost]
public virtual ActionResult OrganisationLogo(bool redirect, HttpPostedFileBase Image, bool? ResetLogo = null)
{
if (ResetLogo.HasValue && ResetLogo.Value)
{
dbContext.DiscoConfiguration.OrganisationLogo = null;
Database.DiscoConfiguration.OrganisationLogo = null;
if (redirect)
return RedirectToAction(MVC.Config.Organisation.Index());
@@ -124,7 +125,7 @@ namespace Disco.Web.Areas.API.Controllers
{
if (Image.ContentType.StartsWith("image/", StringComparison.InvariantCultureIgnoreCase))
{
dbContext.DiscoConfiguration.OrganisationLogo = Image.InputStream;
Database.DiscoConfiguration.OrganisationLogo = Image.InputStream;
if (redirect)
return RedirectToAction(MVC.Config.Organisation.Index());
@@ -147,7 +148,7 @@ namespace Disco.Web.Areas.API.Controllers
#endregion
#region Organisation Addresses
[DiscoAuthorize(Claims.Config.Organisation.ConfigureAddresses)]
public virtual ActionResult UpdateOrganisationAddress(Disco.Models.BI.Config.OrganisationAddress organisationAddress, bool redirect = false)
{
if (organisationAddress == null)
@@ -156,8 +157,8 @@ namespace Disco.Web.Areas.API.Controllers
}
if (ModelState.IsValid)
{
dbContext.DiscoConfiguration.OrganisationAddresses.SetAddress(organisationAddress);
dbContext.SaveChanges();
Database.DiscoConfiguration.OrganisationAddresses.SetAddress(organisationAddress);
Database.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Config.Organisation.Index());
else
@@ -183,10 +184,11 @@ namespace Disco.Web.Areas.API.Controllers
return Json(em.ToString(), JsonRequestBehavior.AllowGet);
}
}
[DiscoAuthorize(Claims.Config.Organisation.ConfigureAddresses)]
public virtual ActionResult DeleteOrganisationAddress(int Id, bool redirect = false)
{
dbContext.DiscoConfiguration.OrganisationAddresses.RemoveAddress(Id);
dbContext.SaveChanges();
Database.DiscoConfiguration.OrganisationAddresses.RemoveAddress(Id);
Database.SaveChanges();
if (redirect)
return RedirectToAction(MVC.Config.Organisation.Index());
@@ -198,13 +200,14 @@ namespace Disco.Web.Areas.API.Controllers
#region MultiSiteMode
[DiscoAuthorize(Claims.Config.Organisation.ConfigureMultiSiteMode)]
public virtual ActionResult UpdateMultiSiteMode(bool MultiSiteMode, bool redirect = false)
{
dbContext.DiscoConfiguration.MultiSiteMode = MultiSiteMode;
Database.DiscoConfiguration.MultiSiteMode = MultiSiteMode;
dbContext.SaveChanges();
Database.SaveChanges();
DiscoApplication.MultiSiteMode = dbContext.DiscoConfiguration.MultiSiteMode;
DiscoApplication.MultiSiteMode = Database.DiscoConfiguration.MultiSiteMode;
if (redirect)
return RedirectToAction(MVC.Config.Organisation.Index());
@@ -1,29 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.BI.Extensions;
using Disco.BI.Extensions;
using Disco.Services.Authorization;
using Disco.Services.Users;
using Disco.Services.Web;
using System;
using System.IO;
using System.Linq;
using System.Web.Mvc;
namespace Disco.Web.Areas.API.Controllers
{
public partial class UserController : dbAdminController
public partial class UserController : AuthorizedDatabaseController
{
[DiscoAuthorize(Claims.User.Search)]
public virtual ActionResult UpstreamUsers(string term)
{
return Json(BI.UserBI.Searching.SearchUpstream(term), JsonRequestBehavior.AllowGet);
}
#region User Attachements
[DiscoAuthorize(Claims.User.ShowAttachments)]
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentDownload(int id)
{
var ua = dbContext.UserAttachments.Find(id);
var ua = Database.UserAttachments.Find(id);
if (ua != null)
{
var filePath = ua.RepositoryFilename(dbContext);
var filePath = ua.RepositoryFilename(Database);
if (System.IO.File.Exists(filePath))
{
return File(filePath, ua.MimeType, ua.Filename);
@@ -35,13 +38,15 @@ namespace Disco.Web.Areas.API.Controllers
}
return HttpNotFound("Invalid Attachment Number");
}
[DiscoAuthorize(Claims.User.ShowAttachments)]
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentThumbnail(int id)
{
var ua = dbContext.UserAttachments.Find(id);
var ua = Database.UserAttachments.Find(id);
if (ua != null)
{
var thumbPath = ua.RepositoryThumbnailFilename(dbContext);
var thumbPath = ua.RepositoryThumbnailFilename(Database);
if (System.IO.File.Exists(thumbPath))
{
if (thumbPath.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
@@ -54,9 +59,11 @@ namespace Disco.Web.Areas.API.Controllers
}
return HttpNotFound("Invalid Attachment Number");
}
[DiscoAuthorize(Claims.User.Actions.AddAttachments)]
public virtual ActionResult AttachmentUpload(string id, string Comments)
{
var u = dbContext.Users.Find(id);
var u = Database.Users.Find(id);
if (u != null)
{
if (Request.Files.Count > 0)
@@ -71,18 +78,18 @@ namespace Disco.Web.Areas.API.Controllers
var ua = new Disco.Models.Repository.UserAttachment()
{
UserId = u.Id,
TechUserId = DiscoApplication.CurrentUser.Id,
TechUserId = UserService.CurrentUserId,
Filename = file.FileName,
MimeType = contentType,
Timestamp = DateTime.Now,
Comments = Comments
};
dbContext.UserAttachments.Add(ua);
dbContext.SaveChanges();
Database.UserAttachments.Add(ua);
Database.SaveChanges();
ua.SaveAttachment(dbContext, file.InputStream);
ua.SaveAttachment(Database, file.InputStream);
ua.GenerateThumbnail(dbContext);
ua.GenerateThumbnail(Database);
return Json(ua.Id, JsonRequestBehavior.AllowGet);
}
@@ -91,9 +98,11 @@ namespace Disco.Web.Areas.API.Controllers
}
throw new Exception("Invalid User Id");
}
[DiscoAuthorize(Claims.User.ShowAttachments)]
public virtual ActionResult Attachment(int id)
{
var ua = dbContext.UserAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
var ua = Database.UserAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
if (ua != null)
{
@@ -107,9 +116,11 @@ namespace Disco.Web.Areas.API.Controllers
}
return Json(new Models.Attachment.AttachmentModel() { Result = "Invalid Attachment Number" }, JsonRequestBehavior.AllowGet);
}
[DiscoAuthorize(Claims.User.ShowAttachments)]
public virtual ActionResult Attachments(string id)
{
var u = dbContext.Users.Include("UserAttachments.TechUser").Where(m => m.Id == id).FirstOrDefault();
var u = Database.Users.Include("UserAttachments.TechUser").Where(m => m.Id == id).FirstOrDefault();
if (u != null)
{
var m = new Models.Attachment.AttachmentsModel()
@@ -122,47 +133,47 @@ namespace Disco.Web.Areas.API.Controllers
}
return Json(new Models.Attachment.AttachmentsModel() { Result = "Invalid User Id" }, JsonRequestBehavior.AllowGet);
}
[DiscoAuthorizeAny(Claims.User.Actions.RemoveAnyAttachments, Claims.User.Actions.RemoveOwnAttachments)]
public virtual ActionResult AttachmentRemove(int id)
{
var ua = dbContext.UserAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
var ua = Database.UserAttachments.Include("TechUser").Where(m => m.Id == id).FirstOrDefault();
if (ua != null)
{
// 2012-02-17 G# Remove - 'Delete Own Comments' policy
//if (ua.TechUserId == DiscoApplication.CurrentUser.Id)
//{
ua.OnDelete(dbContext);
dbContext.SaveChanges();
if (ua.TechUserId.Equals(CurrentUser.Id, StringComparison.InvariantCultureIgnoreCase))
Authorization.RequireAny(Claims.User.Actions.RemoveAnyAttachments, Claims.User.Actions.RemoveOwnAttachments);
else
Authorization.Require(Claims.User.Actions.RemoveAnyAttachments);
ua.OnDelete(Database);
Database.SaveChanges();
return Json("OK", JsonRequestBehavior.AllowGet);
//}
//else
//{
// return Json("You can only delete your own attachments.", JsonRequestBehavior.AllowGet);
//}
}
return Json("Invalid Attachment Number", JsonRequestBehavior.AllowGet);
}
#endregion
[DiscoAuthorize(Claims.User.Actions.GenerateDocuments)]
public virtual ActionResult GeneratePdf(string id, string DocumentTemplateId)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id");
if (string.IsNullOrEmpty(DocumentTemplateId))
throw new ArgumentNullException("AttachmentTypeId");
var user = dbContext.Users.Find(id);
var user = Database.Users.Find(id);
if (user != null)
{
var documentTemplate = dbContext.DocumentTemplates.Find(DocumentTemplateId);
var documentTemplate = Database.DocumentTemplates.Find(DocumentTemplateId);
if (documentTemplate != null)
{
var timeStamp = DateTime.Now;
Stream pdf;
using (var generationState = Disco.Models.BI.DocumentTemplates.DocumentState.DefaultState())
{
pdf = documentTemplate.GeneratePdf(dbContext, user, DiscoApplication.CurrentUser, timeStamp, generationState);
pdf = documentTemplate.GeneratePdf(Database, user, UserService.CurrentUser, timeStamp, generationState);
}
dbContext.SaveChanges();
Database.SaveChanges();
return File(pdf, "application/pdf", string.Format("{0}_{1}_{2:yyyyMMdd-HHmmss}.pdf", documentTemplate.Id, user.Id, timeStamp));
}
else
@@ -12,6 +12,7 @@ namespace Disco.Web.Areas.API.Models.Attachment
public string ParentId { get; set; }
public int Id { get; set; }
public string Author { get; set; }
public string AuthorId { get; set; }
public DateTime Timestamp { get; set; }
public string Comments { get; set; }
public string Filename { get; set; }
@@ -45,6 +46,7 @@ namespace Disco.Web.Areas.API.Models.Attachment
{
ParentId = ua.UserId,
Id = ua.Id,
AuthorId = ua.TechUserId,
Author = ua.TechUser.ToString(),
Timestamp = ua.Timestamp,
Comments = ua.Comments,
@@ -58,6 +60,7 @@ namespace Disco.Web.Areas.API.Models.Attachment
{
ParentId = ja.JobId.ToString(),
Id = ja.Id,
AuthorId = ja.TechUserId,
Author = ja.TechUser.ToString(),
Timestamp = ja.Timestamp,
Comments = ja.Comments,
@@ -71,6 +74,7 @@ namespace Disco.Web.Areas.API.Models.Attachment
{
ParentId = da.DeviceSerialNumber,
Id = da.Id,
AuthorId = da.TechUserId,
Author = da.TechUser.ToString(),
Timestamp = da.Timestamp,
Comments = da.Comments,
@@ -0,0 +1,25 @@
using Disco.Models.Interop.ActiveDirectory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.API.Models.AuthorizationRole
{
public class SubjectItem
{
public string Id { get; set; }
public string Name { get; set; }
public string Type { get; set; }
public static SubjectItem FromActiveDirectoryObject(IActiveDirectoryObject ADObject)
{
return new Models.AuthorizationRole.SubjectItem()
{
Id = ADObject.SamAccountName,
Name = ADObject.Name,
Type = ADObject is ActiveDirectoryGroup ? "group" : "user"
};
}
}
}
@@ -11,6 +11,7 @@ namespace Disco.Web.Areas.API.Models.Job
{
public int Id { get; set; }
public int JobId { get; set; }
public string AuthorId { get; set; }
public string Author { get; set; }
public DateTime Timestamp { get; set; }
public string Comments { get; set; }
@@ -43,6 +44,7 @@ namespace Disco.Web.Areas.API.Models.Job
{
Id = jl.Id,
JobId = jl.JobId,
AuthorId = jl.TechUserId,
Author = jl.TechUser.ToString(),
Timestamp = jl.Timestamp,
Comments = jl.Comments
@@ -94,11 +94,15 @@ namespace Disco.Web.Areas.Config
"Config/DocumentTemplate/{id}",
new { controller = "DocumentTemplate", action = "Index", id = UrlParameter.Optional }
);
context.MapRoute(
"Config_Warranty",
"Config/Warranty/{id}",
new { controller = "Warranty", action = "Index", id = UrlParameter.Optional }
"Config_AuthorizationRole_Create",
"Config/AuthorizationRole/Create",
new { controller = "AuthorizationRole", action = "Create", id = UrlParameter.Optional }
);
context.MapRoute(
"Config_AuthorizationRole",
"Config/AuthorizationRole/{id}",
new { controller = "AuthorizationRole", action = "Index", id = UrlParameter.Optional }
);
context.MapRoute(
@@ -0,0 +1,105 @@
using Disco.Models.Authorization;
using Disco.Models.UI.Config.AuthorizationRole;
using Disco.Services.Authorization;
using Disco.Services.Authorization.Roles;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Users;
using Disco.Services.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Controllers
{
[DiscoAuthorize(Claims.DiscoAdminAccount)]
public partial class AuthorizationRoleController : AuthorizedDatabaseController
{
public virtual ActionResult Index(int? id)
{
if (id.HasValue)
{
// Show
var ar = Database.AuthorizationRoles.Find(id.Value);
if (ar == null)
throw new ArgumentException("Invalid Authorization Role Id");
var token = RoleToken.FromAuthorizationRole(ar);
var subjects = token.SubjectIds == null ? new List<Models.AuthorizationRole.ShowModel.SubjectDescriptor>() :
token.SubjectIds.Select(subjectId => Disco.BI.Interop.ActiveDirectory.ActiveDirectory.GetObject(subjectId))
.Where(item => item != null)
.Select(item => Models.AuthorizationRole.ShowModel.SubjectDescriptor.FromActiveDirectoryObject(item))
.OrderBy(item => item.Name).ToList();
var m = new Models.AuthorizationRole.ShowModel()
{
Token = token,
Subjects = subjects,
ClaimNavigator = Claims.RoleClaimNavigator.BuildClaimTree(token.Claims)
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleShowModel>(this.ControllerContext, m);
return View(MVC.Config.AuthorizationRole.Views.Show, m);
}
else
{
// List Index
var ars = Database.AuthorizationRoles.ToList()
.Select(ar => RoleToken.FromAuthorizationRole(ar)).Cast<IRoleToken>().ToList();
var m = new Models.AuthorizationRole.IndexModel()
{
Tokens = ars
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleIndexModel>(this.ControllerContext, m);
return View(m);
}
}
public virtual ActionResult Create()
{
// Default Role
var m = new Models.AuthorizationRole.CreateModel()
{
AuthorizationRole = new Disco.Models.Repository.AuthorizationRole()
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleCreateModel>(this.ControllerContext, m);
return View(m);
}
[HttpPost]
public virtual ActionResult Create(Models.AuthorizationRole.CreateModel model)
{
if (ModelState.IsValid)
{
// Check for Existing
var existing = Database.AuthorizationRoles.Where(m => m.Name == model.AuthorizationRole.Name).FirstOrDefault();
if (existing == null)
{
var roleId = UserService.CreateAuthorizationRole(Database, model.AuthorizationRole);
return RedirectToAction(MVC.Config.AuthorizationRole.Index(roleId));
}
else
{
ModelState.AddModelError("Name", "Am Authorization Role with this name already exists.");
}
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigAuthorizationRoleCreateModel>(this.ControllerContext, model);
return View(model);
}
}
}
@@ -1,22 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Authorization;
using Disco.Services.Web;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class ConfigController : dbAdminController
public partial class ConfigController : AuthorizedDatabaseController
{
//
// GET: /Config/Config/
[DiscoAuthorize(Claims.Config.Show)]
public virtual ActionResult Index()
{
var m = new Models.Config.IndexModel()
{
UpdateResponse = dbContext.DiscoConfiguration.UpdateLastCheck
UpdateResponse = Database.DiscoConfiguration.UpdateLastCheck
};
return View(m);
@@ -1,26 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.BI.Extensions;
using Disco.Web.Extensions;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.BI.Extensions;
using Disco.Models.UI.Config.DeviceBatch;
using Disco.Services.Authorization;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Web;
using System;
using System.Linq;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class DeviceBatchController : dbAdminController
public partial class DeviceBatchController : AuthorizedDatabaseController
{
[DiscoAuthorize(Claims.Config.DeviceBatch.Show)]
public virtual ActionResult Index(int? id)
{
dbContext.Configuration.LazyLoadingEnabled = true;
Database.Configuration.LazyLoadingEnabled = true;
if (id.HasValue)
{
var m = dbContext.DeviceBatches.Where(db => db.Id == id.Value)
var m = Database.DeviceBatches.Where(db => db.Id == id.Value)
.Select(db => new Models.DeviceBatch.ShowModel()
{
DeviceBatch = db,
@@ -38,9 +36,18 @@ namespace Disco.Web.Areas.Config.Controllers
DeviceDecommissionedCount = dG.Count(d => d.DecommissionedDate.HasValue)
}).ToArray().Cast<ConfigDeviceBatchShowModelMembership>().ToList();
m.CanDelete = m.DeviceBatch.CanDelete(dbContext);
if (Authorization.Has(Claims.Config.DeviceBatch.Delete))
m.CanDelete = m.DeviceBatch.CanDelete(Database);
m.DeviceModels = dbContext.DeviceModels.ToList();
if (Authorization.Has(Claims.Config.DeviceBatch.Configure))
{
m.DeviceModels = Database.DeviceModels.ToList();
m.DefaultDeviceModel = m.DeviceBatch.DefaultDeviceModelId.HasValue ? m.DeviceModels.FirstOrDefault(dm => dm.Id == m.DeviceBatch.DefaultDeviceModelId.Value) : null;
}
else
{
m.DefaultDeviceModel = m.DeviceBatch.DefaultDeviceModelId.HasValue ? Database.DeviceModels.Find(m.DeviceBatch.DefaultDeviceModelId.Value) : null;
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceBatchShowModel>(this.ControllerContext, m);
@@ -49,7 +56,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
else
{
var m = Models.DeviceBatch.IndexModel.Build(dbContext);
var m = Models.DeviceBatch.IndexModel.Build(Database);
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceBatchIndexModel>(this.ControllerContext, m);
@@ -58,12 +65,13 @@ namespace Disco.Web.Areas.Config.Controllers
}
}
[DiscoAuthorizeAll(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.Configure)]
public virtual ActionResult Create()
{
// Default Batch
var m = new Models.DeviceBatch.CreateModel()
{
DeviceBatch = BI.DeviceBI.BatchUtilities.DefaultNewDeviceBatch(dbContext)
DeviceBatch = BI.DeviceBI.BatchUtilities.DefaultNewDeviceBatch(Database)
};
// UI Extensions
@@ -72,17 +80,17 @@ namespace Disco.Web.Areas.Config.Controllers
return View(m);
}
[HttpPost]
[DiscoAuthorizeAll(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.Configure), HttpPost]
public virtual ActionResult Create(Models.DeviceBatch.CreateModel model)
{
if (ModelState.IsValid)
{
// Check for Existing
var existing = dbContext.DeviceBatches.Where(m => m.Name == model.DeviceBatch.Name).FirstOrDefault();
var existing = Database.DeviceBatches.Where(m => m.Name == model.DeviceBatch.Name).FirstOrDefault();
if (existing == null)
{
dbContext.DeviceBatches.Add(model.DeviceBatch);
dbContext.SaveChanges();
Database.DeviceBatches.Add(model.DeviceBatch);
Database.SaveChanges();
return RedirectToAction(MVC.Config.DeviceBatch.Index(model.DeviceBatch.Id));
}
else
@@ -97,6 +105,7 @@ namespace Disco.Web.Areas.Config.Controllers
return View(model);
}
[DiscoAuthorize(Claims.Config.DeviceBatch.ShowTimeline)]
public virtual ActionResult Timeline()
{
var m = new Models.DeviceBatch.TimelineModel();
@@ -1,23 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.Services.Plugins.Features.WarrantyProvider;
using Disco.Services.Plugins;
using Disco.BI.Extensions;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.BI.Extensions;
using Disco.Models.UI.Config.DeviceModel;
using Disco.Services.Authorization;
using Disco.Services.Plugins;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Plugins.Features.WarrantyProvider;
using Disco.Services.Web;
using System;
using System.Linq;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class DeviceModelController : dbAdminController
public partial class DeviceModelController : AuthorizedDatabaseController
{
[DiscoAuthorize(Claims.Config.DeviceModel.Show)]
public virtual ActionResult Index(int? id)
{
if (id.HasValue)
{
var m = dbContext.DeviceModels.Include("DeviceComponents").Where(dm => dm.Id == id.Value).Select(dm => new Models.DeviceModel.ShowModel()
var m = Database.DeviceModels.Include("DeviceComponents").Where(dm => dm.Id == id.Value).Select(dm => new Models.DeviceModel.ShowModel()
{
DeviceModel = dm,
DeviceCount = dm.Devices.Count(),
@@ -32,16 +33,11 @@ namespace Disco.Web.Areas.Config.Controllers
m.DeviceComponentsModel = new Models.DeviceModel.ComponentsModel()
{
DeviceModelId = m.DeviceModel.Id,
DeviceComponents = dbContext.DeviceComponents.Include("JobSubTypes").Where(dc => dc.DeviceModelId == m.DeviceModel.Id).ToList(),
JobSubTypes = dbContext.JobSubTypes.Where(jst => jst.JobTypeId == Disco.Models.Repository.JobType.JobTypeIds.HNWar).ToList()
DeviceComponents = Database.DeviceComponents.Include("JobSubTypes").Where(dc => dc.DeviceModelId == m.DeviceModel.Id).ToList(),
JobSubTypes = Database.JobSubTypes.Where(jst => jst.JobTypeId == Disco.Models.Repository.JobType.JobTypeIds.HNWar).ToList()
};
m.CanDelete = m.DeviceModel.CanDelete(dbContext);
//m.Devices = BI.DeviceBI.SelectDeviceSearchResultItem(dbContext.Devices.Where(d => d.DeviceModelId == m.DeviceModel.Id));
//m.Devices = dbContext.Devices.Include("DeviceModel").Include("DeviceProfile").Include("AssignedUser")
// .Where(d => d.DeviceModelId == m.DeviceModel.Id).ToList();
m.CanDelete = m.DeviceModel.CanDelete(Database);
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceModelShowModel>(this.ControllerContext, m);
@@ -50,7 +46,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
else
{
var m = Models.DeviceModel.IndexModel.Build(dbContext);
var m = Models.DeviceModel.IndexModel.Build(Database);
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceModelIndexModel>(this.ControllerContext, m);
@@ -59,12 +55,13 @@ namespace Disco.Web.Areas.Config.Controllers
}
}
[DiscoAuthorize(Claims.Config.DeviceModel.Show)]
public virtual ActionResult GenericComponents()
{
var m = new Models.DeviceModel.ComponentsModel()
{
DeviceComponents = dbContext.DeviceComponents.Include("JobSubTypes").Where(dc => !dc.DeviceModelId.HasValue).ToList(),
JobSubTypes = dbContext.JobSubTypes.Where(jst => jst.JobTypeId == Disco.Models.Repository.JobType.JobTypeIds.HNWar).ToList()
DeviceComponents = Database.DeviceComponents.Include("JobSubTypes").Where(dc => !dc.DeviceModelId.HasValue).ToList(),
JobSubTypes = Database.JobSubTypes.Where(jst => jst.JobTypeId == Disco.Models.Repository.JobType.JobTypeIds.HNWar).ToList()
};
// UI Extensions
@@ -1,26 +1,26 @@
using System;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Models.UI.Config.DeviceProfile;
using Disco.Services.Authorization;
using Disco.Services.Plugins;
using Disco.Services.Plugins.Features.CertificateProvider;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.Data.Configuration;
using Disco.BI;
using Disco.BI.Extensions;
using Disco.Services.Plugins.Features.CertificateProvider;
using Disco.Services.Plugins;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Models.UI.Config.DeviceProfile;
using Disco.Models.Repository;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class DeviceProfileController : dbAdminController
public partial class DeviceProfileController : AuthorizedDatabaseController
{
[DiscoAuthorize(Claims.Config.DeviceProfile.Show)]
public virtual ActionResult Index(int? id)
{
if (id.HasValue)
{
var m = dbContext.DeviceProfiles.Where(dp => dp.Id == id.Value).Select(dp => new Models.DeviceProfile.ShowModel()
var m = Database.DeviceProfiles.Where(dp => dp.Id == id.Value).Select(dp => new Models.DeviceProfile.ShowModel()
{
DeviceProfile = dp,
DeviceCount = dp.Devices.Count(),
@@ -30,7 +30,11 @@ namespace Disco.Web.Areas.Config.Controllers
if (m == null || m.DeviceProfile == null)
throw new ArgumentException("Invalid Device Profile Id", "id");
m.OrganisationAddresses = dbContext.DiscoConfiguration.OrganisationAddresses.Addresses;
m.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses;
if (m.DeviceProfile.DefaultOrganisationAddress.HasValue)
m.DefaultOrganisationAddress = Database.DiscoConfiguration.OrganisationAddresses.GetAddress(m.DeviceProfile.DefaultOrganisationAddress.Value);
m.CertificateProviders = Plugins.GetPluginFeatures(typeof(CertificateProviderFeature));
var DistributionValues = Enum.GetValues(typeof(Disco.Models.Repository.DeviceProfile.DistributionTypes));
@@ -44,13 +48,7 @@ namespace Disco.Web.Areas.Config.Controllers
Selected = ((int)m.DeviceProfile.DistributionType == value)
});
}
m.CanDelete = m.DeviceProfile.CanDelete(dbContext);
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//var config = m.DeviceProfile.Configuration(dbContext);
//m.AllocateWirelessCertificate = m.DeviceProfile.AllocateWirelessCertificate;
//m.OrganisationalUnit = m.DeviceProfile.OrganisationalUnit;
//m.ComputerNameTemplate = m.DeviceProfile.ComputerNameTemplate;
m.CanDelete = m.DeviceProfile.CanDelete(Database);
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceProfileShowModel>(this.ControllerContext, m);
@@ -59,7 +57,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
else
{
var m = Models.DeviceProfile.IndexModel.Build(dbContext);
var m = Models.DeviceProfile.IndexModel.Build(Database);
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceProfileIndexModel>(this.ControllerContext, m);
@@ -68,6 +66,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
}
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Create, Claims.Config.DeviceProfile.Configure)]
public virtual ActionResult Create()
{
var m = new Models.DeviceProfile.CreateModel()
@@ -86,19 +85,19 @@ namespace Disco.Web.Areas.Config.Controllers
return View(m);
}
[HttpPost]
[DiscoAuthorizeAll(Claims.Config.DeviceProfile.Create, Claims.Config.DeviceProfile.Configure), HttpPost]
public virtual ActionResult Create(Models.DeviceProfile.CreateModel model)
{
if (ModelState.IsValid)
{
// Check for Existing
var existing = dbContext.DeviceProfiles.Where(m => m.Name == model.DeviceProfile.Name).FirstOrDefault();
var existing = Database.DeviceProfiles.Where(m => m.Name == model.DeviceProfile.Name).FirstOrDefault();
if (existing == null)
{
model.DeviceProfile.ProvisionADAccount = true;
dbContext.DeviceProfiles.Add(model.DeviceProfile);
dbContext.SaveChanges();
Database.DeviceProfiles.Add(model.DeviceProfile);
Database.SaveChanges();
return RedirectToAction(MVC.Config.DeviceProfile.Index(model.DeviceProfile.Id));
}
else
@@ -113,13 +112,14 @@ namespace Disco.Web.Areas.Config.Controllers
return View(model);
}
[DiscoAuthorize(Claims.Config.DeviceProfile.ConfigureDefaults)]
public virtual ActionResult Defaults()
{
var m = new Models.DeviceProfile.DefaultsModel()
{
DeviceProfiles = dbContext.DeviceProfiles.ToList(),
Default = dbContext.DiscoConfiguration.DeviceProfiles.DefaultDeviceProfileId,
DefaultAddDeviceOffline = dbContext.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId
DeviceProfiles = Database.DeviceProfiles.ToList(),
Default = Database.DiscoConfiguration.DeviceProfiles.DefaultDeviceProfileId,
DefaultAddDeviceOffline = Database.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId
};
m.DeviceProfilesAndNone = m.DeviceProfiles.ToList();
m.DeviceProfilesAndNone.Insert(0, new Disco.Models.Repository.DeviceProfile() { Id = 0, Name = "<No Default>" });
@@ -1,23 +1,23 @@
using System;
using Disco.BI.Extensions;
using Disco.Models.UI.Config.DocumentTemplate;
using Disco.Services.Authorization;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.BI.Extensions;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Models.UI.Config.DocumentTemplate;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class DocumentTemplateController : dbAdminController
public partial class DocumentTemplateController : AuthorizedDatabaseController
{
[DiscoAuthorize(Claims.Config.DocumentTemplate.Show)]
public virtual ActionResult Index(string id)
{
if (string.IsNullOrEmpty(id))
{
var m = new Models.DocumentTemplate.IndexModel() { DocumentTemplates = dbContext.DocumentTemplates.ToList() };
var m = new Models.DocumentTemplate.IndexModel() { DocumentTemplates = Database.DocumentTemplates.ToList() };
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateIndexModel>(this.ControllerContext, m);
@@ -28,10 +28,10 @@ namespace Disco.Web.Areas.Config.Controllers
{
var m = new Models.DocumentTemplate.ShowModel()
{
DocumentTemplate = dbContext.DocumentTemplates.Include("JobSubTypes").Where(at => at.Id == id).FirstOrDefault()
DocumentTemplate = Database.DocumentTemplates.Include("JobSubTypes").Where(at => at.Id == id).FirstOrDefault()
};
m.TemplateExpressions = m.DocumentTemplate.ExtractPdfExpressions(dbContext);
m.UpdateModel(dbContext);
m.TemplateExpressions = m.DocumentTemplate.ExtractPdfExpressions(Database);
m.UpdateModel(Database);
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateShowModel>(this.ControllerContext, m);
@@ -40,6 +40,7 @@ namespace Disco.Web.Areas.Config.Controllers
}
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.ShowStatus)]
public virtual ActionResult ImportStatus()
{
var m = new Models.DocumentTemplate.ImportStatusModel();
@@ -49,11 +50,13 @@ namespace Disco.Web.Areas.Config.Controllers
return View();
}
[DiscoAuthorize(Claims.Config.DocumentTemplate.UndetectedPages)]
public virtual ActionResult UndetectedPages()
{
var m = new Models.DocumentTemplate.UndetectedPagesModel()
{
DocumentTemplates = dbContext.DocumentTemplates.ToList()
DocumentTemplates = Database.DocumentTemplates.ToList()
};
// UI Extensions
@@ -62,10 +65,11 @@ namespace Disco.Web.Areas.Config.Controllers
return View(m);
}
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure)]
public virtual ActionResult Create()
{
var m = new Models.DocumentTemplate.CreateModel();
m.UpdateModel(dbContext);
m.UpdateModel(Database);
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDocumentTemplateCreateModel>(this.ControllerContext, m);
@@ -73,19 +77,19 @@ namespace Disco.Web.Areas.Config.Controllers
return View(m);
}
[HttpPost]
[DiscoAuthorizeAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure), HttpPost]
public virtual ActionResult Create(Models.DocumentTemplate.CreateModel model)
{
model.UpdateModel(dbContext);
model.UpdateModel(Database);
if (ModelState.IsValid)
{
// Check for Existing
var existing = dbContext.DocumentTemplates.Where(m => m.Id == model.DocumentTemplate.Id).FirstOrDefault();
var existing = Database.DocumentTemplates.Where(m => m.Id == model.DocumentTemplate.Id).FirstOrDefault();
if (existing == null)
{
dbContext.DocumentTemplates.Add(model.DocumentTemplate);
Database.DocumentTemplates.Add(model.DocumentTemplate);
if (model.DocumentTemplate.Scope == Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Job)
{
@@ -96,10 +100,10 @@ namespace Disco.Web.Areas.Config.Controllers
// model.AttachmentType.JobSubTypes.Add(jobSubType);
}
dbContext.SaveChanges();
Database.SaveChanges();
// Save Template
model.DocumentTemplate.SavePdfTemplate(dbContext, model.Template.InputStream);
model.DocumentTemplate.SavePdfTemplate(Database, model.Template.InputStream);
return RedirectToAction(MVC.Config.DocumentTemplate.Index(model.DocumentTemplate.Id));
}
@@ -115,6 +119,7 @@ namespace Disco.Web.Areas.Config.Controllers
return View(model);
}
[DiscoAuthorize(Claims.Config.Show)]
public virtual ActionResult ExpressionBrowser(string type, bool StaticDeclaredMembersOnly = false)
{
if (string.IsNullOrWhiteSpace(type))
@@ -1,23 +1,19 @@
using Disco.Models.UI.Config.Enrolment;
using Disco.Services.Authorization;
using Disco.Services.Plugins.Features.UIExtension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Web;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class EnrolmentController : dbAdminController
public partial class EnrolmentController : AuthorizedDatabaseController
{
//
// GET: /Config/Bootstrapper/
[DiscoAuthorize(Claims.Config.Enrolment.Show)]
public virtual ActionResult Index()
{
var m = new Models.Enrolment.IndexModel()
{
MacSshUsername = dbContext.DiscoConfiguration.Bootstrapper.MacSshUsername
MacSshUsername = Database.DiscoConfiguration.Bootstrapper.MacSshUsername
};
// UI Extensions
@@ -25,6 +21,8 @@ namespace Disco.Web.Areas.Config.Controllers
return View(m);
}
[DiscoAuthorize(Claims.Config.Enrolment.ShowStatus)]
public virtual ActionResult Status()
{
var m = new Models.Enrolment.StatusModel();
@@ -1,22 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Authorization;
using Disco.Services.Web;
using System;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class ExpressionsController : Controller
[DiscoAuthorize(Claims.DiscoAdminAccount)]
public partial class ExpressionsController : AuthorizedDatabaseController
{
//
// GET: /Config/Expressions/
// Under Construction - Not In Production
public virtual ActionResult Index()
{
return View(Views.Editor, new Models.Expressions.EditorModel()
{
Expression = @"JobComponentsTotalCost() < 100 ? JobComponentsTotalCost().ToString('c') : '$100.00'"
});
throw new NotImplementedException();
//return View(Views.Editor, new Models.Expressions.EditorModel()
//{
// Expression = @"JobComponentsTotalCost() < 100 ? JobComponentsTotalCost().ToString('c') : '$100.00'"
//});
}
}
@@ -1,20 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.Models.UI.Config.Logging;
using Disco.Services.Authorization;
using Disco.Services.Logging;
using Disco.Services.Logging.Models;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Models.UI.Config.Logging;
using Disco.Services.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class LoggingController : dbAdminController
public partial class LoggingController : AuthorizedDatabaseController
{
//
// GET: /Config/Logs/
[DiscoAuthorize(Claims.Config.Logging.Show)]
public virtual ActionResult Index()
{
var m = new Models.Logging.IndexModel()
@@ -1,25 +1,24 @@
using Disco.Models.UI.Config.Organisation;
using Disco.Services.Authorization;
using Disco.Services.Plugins.Features.UIExtension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Web;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class OrganisationController : dbAdminController
public partial class OrganisationController : AuthorizedDatabaseController
{
//
// GET: /Config/Organisation/
[DiscoAuthorize(Claims.Config.Organisation.Show)]
public virtual ActionResult Index()
{
var viewModel = new Models.Organisation.IndexModel();
viewModel.OrganisationName = dbContext.DiscoConfiguration.OrganisationName;
viewModel.MultiSiteMode = dbContext.DiscoConfiguration.MultiSiteMode;
viewModel.OrganisationAddresses = dbContext.DiscoConfiguration.OrganisationAddresses.Addresses;
viewModel.OrganisationName = Database.DiscoConfiguration.OrganisationName;
viewModel.MultiSiteMode = Database.DiscoConfiguration.MultiSiteMode;
viewModel.OrganisationAddresses = Database.DiscoConfiguration.OrganisationAddresses.Addresses;
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigOrganisationIndexModel>(this.ControllerContext, viewModel);
@@ -1,30 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.Models.BI.Interop.Community;
using Disco.Services.Authorization;
using Disco.Services.Plugins;
using Disco.Services.Tasks;
using Disco.Services.Users;
using Disco.Services.Web;
using Disco.Web.Areas.Config.Models.Plugins;
using System;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class PluginsController : dbAdminController
public partial class PluginsController : AuthorizedDatabaseController
{
[HttpGet]
[DiscoAuthorize(Claims.Config.Plugin.Show), HttpGet]
public virtual ActionResult Index()
{
Models.Plugins.IndexViewModel vm = new Models.Plugins.IndexViewModel()
{
PluginManifests = Plugins.GetPlugins(),
Catalogue = Plugins.LoadCatalogue(dbContext)
Catalogue = Plugins.LoadCatalogue(Database)
};
return View(vm);
}
#region Plugin Configuration
[HttpPost]
[DiscoAuthorize(Claims.Config.Plugin.Configure), HttpPost]
public virtual ActionResult Configure(string PluginId, FormCollection form)
{
if (string.IsNullOrEmpty(PluginId))
@@ -34,24 +32,24 @@ namespace Disco.Web.Areas.Config.Controllers
using (PluginConfigurationHandler configHandler = manifest.CreateConfigurationHandler())
{
if (configHandler.Post(dbContext, form, this))
if (configHandler.Post(Database, form, this))
{
dbContext.SaveChanges();
Database.SaveChanges();
PluginsLog.LogPluginConfigurationSaved(manifest.Id, DiscoApplication.CurrentUser.Id);
PluginsLog.LogPluginConfigurationSaved(manifest.Id, UserService.CurrentUserId);
return RedirectToAction(MVC.Config.Plugins.Index());
}
else
{
// Config Errors
PluginConfigurationViewModel vm = new PluginConfigurationViewModel(configHandler.Get(dbContext, this));
PluginConfigurationViewModel vm = new PluginConfigurationViewModel(configHandler.Get(Database, this));
return View(Views.Configure, vm);
}
}
}
[HttpGet]
[DiscoAuthorize(Claims.Config.Plugin.Configure), HttpGet]
public virtual ActionResult Configure(string PluginId)
{
if (string.IsNullOrEmpty(PluginId))
@@ -61,18 +59,18 @@ namespace Disco.Web.Areas.Config.Controllers
using (PluginConfigurationHandler configHandler = manifest.CreateConfigurationHandler())
{
PluginConfigurationViewModel vm = new PluginConfigurationViewModel(configHandler.Get(dbContext, this));
PluginsLog.LogPluginConfigurationLoaded(manifest.Id, DiscoApplication.CurrentUser.Id);
PluginConfigurationViewModel vm = new PluginConfigurationViewModel(configHandler.Get(Database, this));
PluginsLog.LogPluginConfigurationLoaded(manifest.Id, UserService.CurrentUserId);
return View(Views.Configure, vm);
}
}
#endregion
[DiscoAuthorize(Claims.Config.Plugin.Install)]
public virtual ActionResult Install()
{
// Check for recent catalogue
var catalogue = Plugins.LoadCatalogue(dbContext);
var catalogue = Plugins.LoadCatalogue(Database);
if (catalogue == null || catalogue.ResponseTimestamp < DateTime.Now.AddHours(-1))
{
@@ -1,25 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Services.Authorization;
using Disco.Services.Web;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class SystemConfigController : dbAdminController
public partial class SystemConfigController : AuthorizedDatabaseController
{
[HttpGet]
[DiscoAuthorize(Claims.Config.System.Show), HttpGet]
public virtual ActionResult Index()
{
var m = Models.SystemConfig.IndexModel.FromConfiguration(dbContext.DiscoConfiguration);
var m = Models.SystemConfig.IndexModel.FromConfiguration(Database.DiscoConfiguration);
return View(m);
}
[HttpPost]
[DiscoAuthorizeAll(Claims.Config.System.Show, Claims.Config.System.ConfigureProxy), HttpPost]
public virtual ActionResult Index(Models.SystemConfig.IndexModel config)
{
if (ModelState.IsValid)
{
config.ToConfiguration(dbContext);
config.ToConfiguration(Database);
return RedirectToAction(MVC.Config.Config.Index());
}
else
@@ -0,0 +1,13 @@
using Disco.Models.UI.Config.AuthorizationRole;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.AuthorizationRole
{
public class CreateModel : ConfigAuthorizationRoleCreateModel
{
public Disco.Models.Repository.AuthorizationRole AuthorizationRole { get; set; }
}
}
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Disco.Data.Repository;
using Disco.Models.UI.Config.AuthorizationRole;
using Disco.Models.Authorization;
namespace Disco.Web.Areas.Config.Models.AuthorizationRole
{
public class IndexModel : ConfigAuthorizationRoleIndexModel
{
public List<IRoleToken> Tokens { get; set; }
}
}
@@ -0,0 +1,54 @@
using Disco.Models.Authorization;
using Disco.Models.Interop.ActiveDirectory;
using Disco.Models.UI.Config.AuthorizationRole;
using Disco.Web.Models.Shared;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Disco.Web.Areas.Config.Models.AuthorizationRole
{
public class ShowModel : ConfigAuthorizationRoleShowModel
{
public IRoleToken Token { get; set; }
public List<SubjectDescriptor> Subjects { get; set; }
public IClaimNavigatorItem ClaimNavigator { get; set; }
public FancyTreeNode[] ClaimNavigatorFancyTreeNodes
{
get
{
var rootNode = FancyTreeNode.FromClaimNavigatorItem(this.ClaimNavigator, false);
rootNode.expanded = true;
return new FancyTreeNode[] {
rootNode
};
}
}
public class SubjectDescriptor
{
public bool IsGroup { get; set; }
public string Name { get; set; }
public string Id { get; set; }
public static SubjectDescriptor FromActiveDirectoryObject(IActiveDirectoryObject ADObject)
{
var item = new SubjectDescriptor()
{
Id = ADObject.SamAccountName,
Name = ADObject.Name
};
if (ADObject is ActiveDirectoryGroup)
item.IsGroup = true;
return item;
}
}
}
}
@@ -11,10 +11,10 @@ namespace Disco.Web.Areas.Config.Models.DeviceBatch
{
public List<ConfigDeviceBatchIndexModelItem> DeviceBatches { get; set; }
public static IndexModel Build(DiscoDataContext dbContext)
public static IndexModel Build(DiscoDataContext Database)
{
var m = new IndexModel();
m.DeviceBatches = dbContext.DeviceBatches.OrderBy(db => db.Name).Select(db => new _IndexModelItem()
m.DeviceBatches = Database.DeviceBatches.OrderBy(db => db.Name).Select(db => new _IndexModelItem()
{
Id = db.Id,
Name = db.Name,
@@ -28,6 +28,9 @@ namespace Disco.Web.Areas.Config.Models.DeviceBatch
InsuredUntil = db.InsuredUntil
}).ToArray().Cast<ConfigDeviceBatchIndexModelItem>().ToList();
foreach (var item in m.DeviceBatches.Where(db => db.DefaultDeviceModel == null))
item.DefaultDeviceModel = "<None Specified>";
return m;
}
@@ -10,6 +10,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceBatch
public class ShowModel : ConfigDeviceBatchShowModel
{
public Disco.Models.Repository.DeviceBatch DeviceBatch { get; set; }
public Disco.Models.Repository.DeviceModel DefaultDeviceModel { get; set; }
public List<Disco.Models.Repository.DeviceModel> DeviceModels { get; set; }
public List<ConfigDeviceBatchShowModelMembership> DeviceModelMembers { get; set; }
public int DeviceCount { get; set; }
@@ -11,10 +11,10 @@ namespace Disco.Web.Areas.Config.Models.DeviceModel
{
public List<ConfigDeviceModelIndexModelItem> DeviceModels { get; set; }
public static IndexModel Build(DiscoDataContext dbContext)
public static IndexModel Build(DiscoDataContext Database)
{
var m = new IndexModel();
m.DeviceModels = dbContext.DeviceModels.OrderBy(dm => dm.Description).Select(dm => new _IndexModelItem()
m.DeviceModels = Database.DeviceModels.OrderBy(dm => dm.Description).Select(dm => new _IndexModelItem()
{
Id = dm.Id,
Name = dm.Description,
@@ -12,10 +12,10 @@ namespace Disco.Web.Areas.Config.Models.DeviceProfile
{
public List<ConfigDeviceProfileIndexModelItem> DeviceProfiles { get; set; }
public static IndexModel Build(DiscoDataContext dbContext)
public static IndexModel Build(DiscoDataContext Database)
{
var m = new IndexModel();
m.DeviceProfiles = dbContext.DeviceProfiles.OrderBy(dp => dp.Name).Select(dp => new _IndexModelItem()
m.DeviceProfiles = Database.DeviceProfiles.OrderBy(dp => dp.Name).Select(dp => new _IndexModelItem()
{
Id = dp.Id,
Name = dp.Name,
@@ -31,7 +31,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceProfile
{
foreach (var dp in m.DeviceProfiles)
if (dp.Address.HasValue)
dp.AddressName = dbContext.DiscoConfiguration.OrganisationAddresses.GetAddress(dp.Address.Value).Name;
dp.AddressName = Database.DiscoConfiguration.OrganisationAddresses.GetAddress(dp.Address.Value).Name;
}
return m;
@@ -12,6 +12,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceProfile
{
public Disco.Models.Repository.DeviceProfile DeviceProfile { get; set; }
public List<SelectListItem> DeviceProfileDistributionTypes { get; set; }
public Disco.Models.BI.Config.OrganisationAddress DefaultOrganisationAddress { get; set; }
public List<Disco.Models.BI.Config.OrganisationAddress> OrganisationAddresses { get; set; }
public List<PluginFeatureManifest> CertificateProviders { get; set; }
@@ -55,12 +55,12 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
}
}
public void UpdateModel(DiscoDataContext dbContext)
public void UpdateModel(DiscoDataContext Database)
{
if (this.JobTypes == null)
JobTypes = dbContext.JobTypes.ToList();
JobTypes = Database.JobTypes.ToList();
if (this.JobSubTypes == null)
JobSubTypes = dbContext.JobSubTypes.ToList();
JobSubTypes = Database.JobSubTypes.ToList();
}
}
@@ -36,26 +36,26 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
}
}
public void UpdateModel(DiscoDataContext dbContext)
public void UpdateModel(DiscoDataContext Database)
{
switch (this.DocumentTemplate.Scope)
{
case Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Device:
this.StoredInstanceCount = dbContext.DeviceAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
this.StoredInstanceCount = Database.DeviceAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
break;
case Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.Job:
this.StoredInstanceCount = dbContext.JobAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
this.StoredInstanceCount = Database.JobAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
break;
case Disco.Models.Repository.DocumentTemplate.DocumentTemplateScopes.User:
this.StoredInstanceCount = dbContext.UserAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
this.StoredInstanceCount = Database.UserAttachments.Count(a => a.DocumentTemplateId == this.DocumentTemplate.Id);
break;
}
if (this.JobTypes == null)
JobTypes = dbContext.JobTypes.ToList();
JobTypes = Database.JobTypes.ToList();
if (this.JobSubTypes == null)
JobSubTypes = dbContext.JobSubTypes.ToList();
JobSubTypes = Database.JobSubTypes.ToList();
if (DocumentTemplate != null)
{
@@ -102,9 +102,9 @@ namespace Disco.Web.Areas.Config.Models.SystemConfig
};
}
public void ToConfiguration(DiscoDataContext db)
public void ToConfiguration(DiscoDataContext Database)
{
SystemConfiguration config = db.DiscoConfiguration;
SystemConfiguration config = Database.DiscoConfiguration;
//config.DataStoreLocation = DataStoreLocation;
config.ProxyAddress = ProxyAddress;
config.ProxyPort = ProxyPort;
@@ -112,11 +112,11 @@ namespace Disco.Web.Areas.Config.Models.SystemConfig
config.ProxyPassword = ProxyPassword;
DiscoApplication.SetGlobalProxy(ProxyAddress, ProxyPort, ProxyUsername, ProxyPassword);
db.SaveChanges();
Database.SaveChanges();
// Try and check for updates if needed - After Proxy Changed
if (db.DiscoConfiguration.UpdateLastCheck == null
|| db.DiscoConfiguration.UpdateLastCheck.ResponseTimestamp < DateTime.Now.AddDays(-1))
if (Database.DiscoConfiguration.UpdateLastCheck == null
|| Database.DiscoConfiguration.UpdateLastCheck.ResponseTimestamp < DateTime.Now.AddDays(-1))
{
Disco.BI.Interop.Community.UpdateCheckTask.ScheduleNow();
}
@@ -0,0 +1,28 @@
@model Disco.Web.Areas.Config.Models.AuthorizationRole.CreateModel
@{
Authorization.Require(Claims.DiscoAdminAccount);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles", MVC.Config.AuthorizationRole.Index(null), "Create");
}
@using (Html.BeginForm())
{
<div class="form" style="width: 450px">
<table>
<tr>
<th>
Name:
</th>
<td>
@Html.EditorFor(model => model.AuthorizationRole.Name)<br />@Html.ValidationMessageFor(model => model.AuthorizationRole.Name)
</td>
</tr>
</table>
<p class="actions">
<input type="submit" class="button" value="Create" />
</p>
</div>
<script type="text/javascript">
$(function () {
$('#AuthorizationRole_Name').focus().select();
});
</script>
}
@@ -0,0 +1,122 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.AuthorizationRole
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/AuthorizationRole/Create.cshtml")]
public partial class Create : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.AuthorizationRole.CreateModel>
{
public Create()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
Authorization.Require(Claims.DiscoAdminAccount);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles", MVC.Config.AuthorizationRole.Index(null), "Create");
#line default
#line hidden
WriteLiteral("\r\n");
#line 6 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
using (Html.BeginForm())
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 450px\"");
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r\n N" +
"ame:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 15 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
Write(Html.EditorFor(model => model.AuthorizationRole.Name));
#line default
#line hidden
WriteLiteral("<br />");
#line 15 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.AuthorizationRole.Name));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n <p");
WriteLiteral(" class=\"actions\"");
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"submit\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(" value=\"Create\"");
WriteLiteral(" />\r\n </p>\r\n </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n $(\'#AuthorizationRole_Name\').focus().sele" +
"ct();\r\n });\r\n </script>\r\n");
#line 28 "..\..\Areas\Config\Views\AuthorizationRole\Create.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
@@ -0,0 +1,43 @@
@model Disco.Web.Areas.Config.Models.AuthorizationRole.IndexModel
@{
Authorization.Require(Claims.DiscoAdminAccount);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles");
}
@if (Model.Tokens.Count == 0)
{
<div class="form" style="width: 450px; padding: 100px 0;">
<h2>No authorization roles are configured</h2>
</div>
}
else
{
<table class="tableData">
<tr>
<th>Name
</th>
<th>Linked Groups/Users
</th>
</tr>
@foreach (var item in Model.Tokens)
{
<tr>
<td>
@Html.ActionLink(item.Role.Name, MVC.Config.AuthorizationRole.Index(item.Role.Id))
</td>
<td>
@if (item.SubjectIds.Count == 0)
{
<span class="smallMessage">&lt;None&gt;</span>
}
else
{
@(string.Join(", ", item.SubjectIds.OrderBy(i => i)))
}
</td>
</tr>
}
</table>
}
<div class="actionBar">
@Html.ActionLinkButton("Create Authorization Role", MVC.Config.AuthorizationRole.Create())
</div>
@@ -0,0 +1,197 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.AuthorizationRole
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/AuthorizationRole/Index.cshtml")]
public partial class Index : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.AuthorizationRole.IndexModel>
{
public Index()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
Authorization.Require(Claims.DiscoAdminAccount);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles");
#line default
#line hidden
WriteLiteral("\r\n");
#line 6 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
if (Model.Tokens.Count == 0)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 450px; padding: 100px 0;\"");
WriteLiteral(">\r\n <h2>No authorization roles are configured</h2>\r\n </div> \r\n");
#line 11 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <table");
WriteLiteral(" class=\"tableData\"");
WriteLiteral(">\r\n <tr>\r\n <th>Name\r\n </th>\r\n <th>Linked " +
"Groups/Users\r\n </th>\r\n </tr>\r\n");
#line 21 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
#line default
#line hidden
#line 21 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
foreach (var item in Model.Tokens)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
#line 25 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
Write(Html.ActionLink(item.Role.Name, MVC.Config.AuthorizationRole.Index(item.Role.Id)));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
#line 28 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
#line default
#line hidden
#line 28 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
if (item.SubjectIds.Count == 0)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">&lt;None&gt;</span>\r\n");
#line 31 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
}
else
{
#line default
#line hidden
#line 34 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
Write(string.Join(", ", item.SubjectIds.OrderBy(i => i)));
#line default
#line hidden
#line 34 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 38 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </table>\r\n");
#line 40 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 42 "..\..\Areas\Config\Views\AuthorizationRole\Index.cshtml"
Write(Html.ActionLinkButton("Create Authorization Role", MVC.Config.AuthorizationRole.Create()));
#line default
#line hidden
WriteLiteral("\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
@@ -0,0 +1,320 @@
@model Disco.Web.Areas.Config.Models.AuthorizationRole.ShowModel
@using Disco.Models.Authorization;
@{
Authorization.Require(Claims.DiscoAdminAccount);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles", MVC.Config.AuthorizationRole.Index(null), Model.Token.Role.Name);
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
Html.BundleDeferred("~/Style/Fancytree");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-Fancytree");
}
<div id="Config_AuthRoles_Show" class="form" style="width: 550px">
<table>
<tr>
<th style="width: 150px">Id:
</th>
<td>
@Html.DisplayFor(model => model.Token.Role.Id)
</td>
</tr>
<tr>
<th>Name:
</th>
<td>@Html.EditorFor(model => model.Token.Role.Name)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#Token_Role_Name'),
'Invalid Name',
'@(Url.Action(MVC.API.AuthorizationRole.UpdateName(Model.Token.Role.Id)))',
'RoleName'
);
});
</script>
</td>
</tr>
<tr>
<th>Linked Groups/Users:</th>
<td>
@if (Model.Token.SubjectIds.Count == 0)
{
<span class="smallMessage">None Associated</span>
}
else
{
<ul id="Config_AuthRoles_Subjects" class="none">
@foreach (var sg in Model.Subjects)
{
<li class="@(sg.IsGroup ? "group" : "user")">@(sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id))</li>
}
</ul>
}
<div>
<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_ListContainer">
<span id="Config_AuthRoles_Subjects_Update_Dialog_None" class="smallMessage">None Associated</span>
<ul id="Config_AuthRoles_Subjects_Update_Dialog_List" class="none">
@foreach (var sg in Model.Subjects)
{
<li class="@(sg.IsGroup ? "group" : "user")" data-subjectid="@sg.Id">@(sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id)) <span class="remove"></span></li>
}
</ul>
</div>
<div id="Config_AuthRoles_Subjects_Update_Dialog_AddContainer">
<input type="text" id="Config_AuthRoles_Subjects_Update_Dialog_TextAdd" />
<a id="Config_AuthRoles_Subjects_Update_Dialog_Add" href="#" class="button small">Add</a>
</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>
<script>
(function(){
var dialog, textAdd, list, noSubjects, form;
function showDialog(){
if (!dialog){
dialog = $('#Config_AuthRoles_Subjects_Update_Dialog').dialog({
resizable: false,
modal: true,
autoOpen: false,
width: 350,
height: 420,
buttons: {
"Save Changes": saveChanges,
Cancel: cancel
}
});
dialog.on('click', '.remove', remove);
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')
.autocomplete({
source: '@(Url.Action(MVC.API.AuthorizationRole.SearchSubjects()))',
minLength: 2,
focus: function (e, ui) {
textAdd.val(ui.item.Id);
return false;
},
select: function (e, ui) {
textAdd.val(ui.item.Id).blur();
return false;
}
}).data('ui-autocomplete')._renderItem = function (ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a><strong>" + item.Name + "</strong><br>" + item.Id + " (" + item.Type + ")</a>")
.appendTo(ul);
};
$('#Config_AuthRoles_Subjects_Update_Dialog_Add').click(add);
}
dialog.dialog('open');
updateNoSubjects();
return false;
}
function cancel(){
$(this).dialog("close");
list.find('li').each(function(){
$this = $(this);
if ($this.is('[data-subjectstatus="new"]')){
$this.remove();
}else{
if ($this.is('[data-subjectstatus="removed"]')){
$this.show();
}
}
});
}
function remove(){
$this = $(this).closest('li');
if ($this.is('[data-subjectstatus="new"]')){
$this.remove();
}else{
$this.attr('data-subjectstatus', 'removed').hide();
}
updateNoSubjects();
}
function add(){
var id = textAdd.val();
$.ajax({
url: '@Url.Action(MVC.API.AuthorizationRole.Subject())',
method: 'get',
data: { Id: id }
}).done(function(response){
if (response){
if (list.find('li[data-subjectid="'+response.Id+'"]').length == 0){
var li = $('<li>')
.append($('<span>').text(response.Id == response.Name ? response.Id : response.Name + ' [' + response.Id + ']'))
.append($('<span>').addClass('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('Unknown Id');
}
}).fail(function(jqXHR, textStatus, errorThrown){
alert('Error: ' + errorThrown);
});
}
function updateNoSubjects(){
if (list.find('li:visible').length > 0)
noSubjects.hide();
else
noSubjects.show();
}
function saveChanges(){
var form = $('#Config_AuthRoles_Subjects_Update_Dialog_Form').empty();
list.find('li[data-subjectstatus!="removed"]').each(function(){
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);
});
})();
</script>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div id="Config_AuthRoles_Claims_Tree">
</div>
<div>
<a href="#" id="Config_AuthRoles_Claims_SaveChanges" class="button small disabled">Save Changes</a>@AjaxHelpers.AjaxLoader()
</div>
<script>
(function(){
var claimNodes = @(new HtmlString(Newtonsoft.Json.JsonConvert.SerializeObject(Model.ClaimNavigatorFancyTreeNodes)));
$(function(){
var saveButton = $('#Config_AuthRoles_Claims_SaveChanges');
var ajaxLoading = saveButton.next('.ajaxLoading');
var tree = $('#Config_AuthRoles_Claims_Tree').fancytree({
source: claimNodes,
checkbox: true,
selectMode: 3,
select: function(){
saveButton.removeClass('disabled');
}
});
saveButton.click(function(){
if (!saveButton.is('.disabled')){
var selectedNodes = tree.fancytree('getTree').getSelectedNodes();
var selectedKeys = [];
for (var i = 0; i < selectedNodes.length; i++) {
var node = selectedNodes[i];
if (!node.folder)
selectedKeys.push(node.key);
}
ajaxLoading.show()
$.ajax({
url: '@Url.Action(MVC.API.AuthorizationRole.UpdateClaims(Model.Token.Role.Id))',
method: 'post',
data: { ClaimKeys: selectedKeys },
traditional: true
}).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);
});
}
return false;
});
});
})();
</script>
</td>
</tr>
</table>
</div>
<div class="actionBar">
@Html.ActionLinkButton("Delete", MVC.API.AuthorizationRole.Delete(Model.Token.Role.Id, true), "Config_AuthRoles_Actions_Delete_Button")
<div id="Config_AuthRoles_Actions_Delete_Dialog" title="Delete this Authorization Role?">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
This item will be permanently deleted and cannot be recovered.<br />
<br />
Are you sure?
</p>
</div>
<script type="text/javascript">
$(function () {
var button = $('#Config_AuthRoles_Actions_Delete_Button');
var buttonDialog = $('#Config_AuthRoles_Actions_Delete_Dialog');
var buttonLink = button.attr('href');
button.attr('href', '#');
button.click(function () {
buttonDialog.dialog('open');
return false;
});
buttonDialog.dialog({
resizable: false,
modal: true,
autoOpen: false,
buttons: {
"Delete": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
window.location.href = buttonLink;
},
Cancel: function () {
$(this).dialog("close");
}
}
});
});
</script>
</div>
@@ -0,0 +1,632 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.AuthorizationRole
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco.BI.Extensions;
#line 2 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
using Disco.Models.Authorization;
#line default
#line hidden
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/AuthorizationRole/Show.cshtml")]
public partial class Show : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.AuthorizationRole.ShowModel>
{
public Show()
{
}
public override void Execute()
{
#line 3 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Authorization.Require(Claims.DiscoAdminAccount);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Authorization Roles", MVC.Config.AuthorizationRole.Index(null), Model.Token.Role.Name);
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
Html.BundleDeferred("~/Style/Fancytree");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-Fancytree");
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"Config_AuthRoles_Show\"");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 550px\"");
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 150px\"");
WriteLiteral(">Id:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 17 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(Html.DisplayFor(model => model.Token.Role.Id));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>Name:\r\n " +
" </th>\r\n <td>");
#line 23 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(Html.EditorFor(model => model.Token.Role.Name));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 24 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 25 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n document.DiscoFun" +
"ctions.PropertyChangeHelper(\r\n $(\'#Token_Role_Name\')," +
"\r\n \'Invalid Name\',\r\n \'");
#line 31 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(Url.Action(MVC.API.AuthorizationRole.UpdateName(Model.Token.Role.Id)));
#line default
#line hidden
WriteLiteral("\',\r\n \'RoleName\'\r\n );\r\n " +
" });\r\n </script>\r\n </td>\r\n </tr>\r\n " +
" <tr>\r\n <th>Linked Groups/Users:</th>\r\n <td>\r\n");
#line 41 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
#line default
#line hidden
#line 41 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
if (Model.Token.SubjectIds.Count == 0)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">None Associated</span>\r\n");
#line 44 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <ul");
WriteLiteral(" id=\"Config_AuthRoles_Subjects\"");
WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n");
#line 48 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
#line default
#line hidden
#line 48 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
foreach (var sg in Model.Subjects)
{
#line default
#line hidden
WriteLiteral(" <li");
WriteAttribute("class", Tuple.Create(" class=\"", 2069), Tuple.Create("\"", 2109)
#line 50 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
, Tuple.Create(Tuple.Create("", 2077), Tuple.Create<System.Object, System.Int32>(sg.IsGroup ? "group" : "user"
#line default
#line hidden
, 2077), false)
);
WriteLiteral(">");
#line 50 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id));
#line default
#line hidden
WriteLiteral("</li>\r\n");
#line 51 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </ul>\r\n");
#line 53 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" <div>\r\n <a");
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(" class=\"button small\"");
WriteLiteral(">Update</a>\r\n <div");
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Authorization Role Linked Groups/Users\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_ListContainer\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_None\"");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">None Associated</span>\r\n <ul");
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_List\"");
WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n");
#line 60 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
#line default
#line hidden
#line 60 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
foreach (var sg in Model.Subjects)
{
#line default
#line hidden
WriteLiteral(" <li");
WriteAttribute("class", Tuple.Create(" class=\"", 2982), Tuple.Create("\"", 3022)
#line 62 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
, Tuple.Create(Tuple.Create("", 2990), Tuple.Create<System.Object, System.Int32>(sg.IsGroup ? "group" : "user"
#line default
#line hidden
, 2990), false)
);
WriteLiteral(" data-subjectid=\"");
#line 62 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(sg.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">");
#line 62 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id));
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"remove\"");
WriteLiteral("></span></li>\r\n");
#line 63 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </ul>\r\n </div>\r\n " +
" <div");
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_AddContainer\"");
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"text\"");
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_TextAdd\"");
WriteLiteral(" />\r\n <a");
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_Add\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(" class=\"button small\"");
WriteLiteral(">Add</a>\r\n </div>\r\n <form");
WriteLiteral(" id=\"Config_AuthRoles_Subjects_Update_Dialog_Form\"");
WriteAttribute("action", Tuple.Create(" action=\"", 3681), Tuple.Create("\"", 3778)
#line 70 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
, Tuple.Create(Tuple.Create("", 3690), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.AuthorizationRole.UpdateSubjects(Model.Token.Role.Id, null, true))
#line default
#line hidden
, 3690), false)
);
WriteLiteral(" method=\"post\"");
WriteLiteral("></form>\r\n </div>\r\n <script>\r\n " +
" (function(){\r\n var dialog, textAdd, list, " +
"noSubjects, form;\r\n \r\n fun" +
"ction showDialog(){\r\n if (!dialog){\r\n " +
" dialog = $(\'#Config_AuthRoles_Subjects_Update_Dialog\').d" +
"ialog({\r\n resizable: false,\r\n " +
" modal: true,\r\n " +
" autoOpen: false,\r\n width: 350,\r\n " +
" height: 420,\r\n " +
" buttons: {\r\n \"Save Changes\": s" +
"aveChanges,\r\n Cancel: cancel\r\n " +
" }\r\n });\r\n\r\n " +
" dialog.on(\'click\', \'.remove\', remove);\r\n\r\n " +
" list = $(\'#Config_AuthRoles_Subjects_Update_Dia" +
"log_List\');\r\n noSubjects = $(\'#Config_AuthRol" +
"es_Subjects_Update_Dialog_None\');\r\n\r\n textAdd" +
" = $(\'#Config_AuthRoles_Subjects_Update_Dialog_TextAdd\');\r\n\r\n " +
" textAdd.watermark(\'Search Subjects\')\r\n " +
" .autocomplete({\r\n sour" +
"ce: \'");
#line 99 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(Url.Action(MVC.API.AuthorizationRole.SearchSubjects()));
#line default
#line hidden
WriteLiteral("\',\r\n minLength: 2,\r\n " +
" focus: function (e, ui) {\r\n " +
" textAdd.val(ui.item.Id);\r\n " +
" return false;\r\n },\r\n " +
" select: function (e, ui) {\r\n " +
" textAdd.val(ui.item.Id).blur();\r\n " +
" return false;\r\n " +
" }\r\n }).data(\'ui-autocom" +
"plete\')._renderItem = function (ul, item) {\r\n " +
" return $(\"<li></li>\")\r\n " +
".data(\"item.autocomplete\", item)\r\n " +
" .append(\"<a><strong>\" + item.Name + \"</strong><br>\" + item.Id + \" (\" + item.Ty" +
"pe + \")</a>\")\r\n .appendTo(ul);\r\n " +
" };\r\n\r\n " +
" $(\'#Config_AuthRoles_Subjects_Update_Dialog_Add\').click(add);\r\n " +
" }\r\n\r\n dialog.dialog(\'open\');\r\n\r\n " +
" updateNoSubjects();\r\n " +
" return false;\r\n }\r\n\r\n " +
"function cancel(){\r\n $(this).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-subjectstatus\', \'r" +
"emoved\').hide();\r\n }\r\n\r\n " +
" updateNoSubjects();\r\n }\r\n\r\n " +
" function add(){\r\n \r\n " +
" var id = textAdd.val();\r\n\r\n $.ajax({\r" +
"\n url: \'");
#line 157 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(Url.Action(MVC.API.AuthorizationRole.Subject()));
#line default
#line hidden
WriteLiteral("\',\r\n method: \'get\',\r\n " +
" data: { Id: id }\r\n }).done(function(re" +
"sponse){\r\n if (response){\r\n " +
" if (list.find(\'li[data-subjectid=\"\'+response.Id+\'\"]\').leng" +
"th == 0){\r\n var li = $(\'<li>\')\r\n " +
" .append($(\'<span>\').text(response.Id " +
"== response.Name ? response.Id : response.Name + \' [\' + response.Id + \']\'))\r\n " +
" .append($(\'<span>\').addClass(\'remo" +
"ve\'))\r\n .addClass(response.Type)\r" +
"\n .attr(\'data-subjectid\', respons" +
"e.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 added\');" +
"\r\n }\r\n " +
" }else{\r\n alert(\'Unknown Id\');\r\n " +
" }\r\n }).fail(function(j" +
"qXHR, textStatus, errorThrown){\r\n alert(\'Erro" +
"r: \' + errorThrown);\r\n });\r\n " +
" }\r\n\r\n function updateNoSubjects(){\r\n " +
" if (list.find(\'li:visible\').length > 0)\r\n " +
" noSubjects.hide();\r\n else\r" +
"\n noSubjects.show();\r\n " +
" }\r\n\r\n function saveChanges(){\r\n " +
" var form = $(\'#Config_AuthRoles_Subjects_Update_Dialog_Form\').emp" +
"ty();\r\n\r\n list.find(\'li[data-subjectstatus!=\"remo" +
"ved\"]\').each(function(){\r\n var subjectId = $(" +
"this).attr(\'data-subjectid\');\r\n \r\n " +
" form.append($(\'<input>\').attr({\r\n " +
" \'name\': \'Subjects\',\r\n \'" +
"type\': \'hidden\'\r\n }).val(subjectId));\r\n\r\n " +
" }).get();\r\n\r\n form.su" +
"bmit();\r\n\r\n dialog.dialog(\"disable\");\r\n " +
" dialog.dialog(\"option\", \"buttons\", null);\r\n " +
" }\r\n\r\n $(function(){\r\n " +
" $(\'#Config_AuthRoles_Subjects_Update\').click(showDialog);\r\n " +
" });\r\n\r\n })();\r\n </" +
"script>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r" +
"\n <td");
WriteLiteral(" colspan=\"2\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"Config_AuthRoles_Claims_Tree\"");
WriteLiteral(">\r\n </div>\r\n <div>\r\n <a");
WriteLiteral(" href=\"#\"");
WriteLiteral(" id=\"Config_AuthRoles_Claims_SaveChanges\"");
WriteLiteral(" class=\"button small disabled\"");
WriteLiteral(">Save Changes</a>");
#line 224 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n </div>\r\n <script>\r\n (function" +
"(){\r\n var claimNodes = ");
#line 228 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(new HtmlString(Newtonsoft.Json.JsonConvert.SerializeObject(Model.ClaimNavigatorFancyTreeNodes)));
#line default
#line hidden
WriteLiteral(@";
$(function(){
var saveButton = $('#Config_AuthRoles_Claims_SaveChanges');
var ajaxLoading = saveButton.next('.ajaxLoading');
var tree = $('#Config_AuthRoles_Claims_Tree').fancytree({
source: claimNodes,
checkbox: true,
selectMode: 3,
select: function(){
saveButton.removeClass('disabled');
}
});
saveButton.click(function(){
if (!saveButton.is('.disabled')){
var selectedNodes = tree.fancytree('getTree').getSelectedNodes();
var selectedKeys = [];
for (var i = 0; i < selectedNodes.length; i++) {
var node = selectedNodes[i];
if (!node.folder)
selectedKeys.push(node.key);
}
ajaxLoading.show()
$.ajax({
url: '");
#line 257 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(Url.Action(MVC.API.AuthorizationRole.UpdateClaims(Model.Token.Role.Id)));
#line default
#line hidden
WriteLiteral(@"',
method: 'post',
data: { ClaimKeys: selectedKeys },
traditional: true
}).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);
});
}
return false;
});
});
})();
</script>
</td>
</tr>
</table>
</div>
<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 283 "..\..\Areas\Config\Views\AuthorizationRole\Show.cshtml"
Write(Html.ActionLinkButton("Delete", MVC.API.AuthorizationRole.Delete(Model.Token.Role.Id, true), "Config_AuthRoles_Actions_Delete_Button"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" id=\"Config_AuthRoles_Actions_Delete_Dialog\"");
WriteLiteral(" title=\"Delete this Authorization Role?\"");
WriteLiteral(">\r\n <p>\r\n <span");
WriteLiteral(" class=\"ui-icon ui-icon-alert\"");
WriteLiteral(" style=\"float: left; margin: 0 7px 20px 0;\"");
WriteLiteral("></span>\r\n This item will be permanently deleted and cannot be recover" +
"ed.<br />\r\n <br />\r\n Are you sure?\r\n </p>\r\n </di" +
"v>\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
var button = $('#Config_AuthRoles_Actions_Delete_Button');
var buttonDialog = $('#Config_AuthRoles_Actions_Delete_Dialog');
var buttonLink = button.attr('href');
button.attr('href', '#');
button.click(function () {
buttonDialog.dialog('open');
return false;
});
buttonDialog.dialog({
resizable: false,
modal: true,
autoOpen: false,
buttons: {
""Delete"": function () {
var $this = $(this);
$this.dialog(""disable"");
$this.dialog(""option"", ""buttons"", null);
window.location.href = buttonLink;
},
Cancel: function () {
$(this).dialog(""close"");
}
}
});
});
</script>
</div>
");
}
}
}
#pragma warning restore 1591
@@ -1,62 +1,106 @@
@model Disco.Web.Areas.Config.Models.Config.IndexModel
@{
Authorization.Require(Claims.Config.Show);
ViewBag.Title = "Configuration";
}
<table id="pageMenu">
<tr>
<td>
<div class="pageMenuArea">
<h2>Hosting</h2>
@Html.ActionLinkClass("System", MVC.Config.SystemConfig.Index(), "config")
<div class="pageMenuBlurb">
Update system configuration, such as the Data Storage Location and Proxy settings.
@if (Authorization.HasAny(Claims.Config.System.Show, Claims.Config.Organisation.Show, Claims.DiscoAdminAccount, Claims.Config.Logging.Show))
{
<td>
<div class="pageMenuArea">
<h2>Hosting</h2>
@if (Authorization.Has(Claims.Config.System.Show))
{
@Html.ActionLinkClass("System", MVC.Config.SystemConfig.Index(), "config")
<div class="pageMenuBlurb">
Update system configuration, such as the Data Storage Location and Proxy settings.
</div>
}
@if (Authorization.Has(Claims.Config.Organisation.Show))
{
@Html.ActionLinkClass("Organisation Details", MVC.Config.Organisation.Index(), "config")
<div class="pageMenuBlurb">
Update the Organisation Name, Logo and Addresses associated with this organisation.
</div>
}
@if (Authorization.Has(Claims.DiscoAdminAccount))
{
@Html.ActionLinkClass("Authorization Roles", MVC.Config.AuthorizationRole.Index(), "config")
<div class="pageMenuBlurb">
Configure roles and permissions for users.
</div>
}
@if (Authorization.Has(Claims.Config.Logging.Show))
{
@Html.ActionLinkClass("Logging", MVC.Config.Logging.Index(), "config")
<div class="pageMenuBlurb">
Export Log files from various Disco Modules and view Live Logging.
</div>
}
</div>
@Html.ActionLinkClass("Organisation Details", MVC.Config.Organisation.Index(), "config")
<div class="pageMenuBlurb">
Update the Organisation Name, Logo and Addresses associated with this organisation.
</div>
@Html.ActionLinkClass("Logging", MVC.Config.Logging.Index(), "config")
<div class="pageMenuBlurb">
Export Log files from various Disco Modules and view Live Logging.
</div>
</div>
</td>
<td>
<div class="pageMenuArea">
<h2>Devices</h2>
@Html.ActionLinkClass("Models", MVC.Config.DeviceModel.Index(), "config")
<div class="pageMenuBlurb">
Configure Components, Product Images and default settings for Device Models.
</div>
@Html.ActionLinkClass("Batches", MVC.Config.DeviceBatch.Index(), "config")
<div class="pageMenuBlurb">
Create and Configure Device Batches.
</div>
@Html.ActionLinkClass("Profiles", MVC.Config.DeviceProfile.Index(), "config")
<div class="pageMenuBlurb">
Configure Device Profiles including computer name generation, distribution and Active
</td>
}
@if (Authorization.HasAny(Claims.Config.DeviceModel.Show, Claims.Config.DeviceBatch.Show, Claims.Config.DeviceProfile.Show, Claims.Config.Enrolment.Show))
{
<td>
<div class="pageMenuArea">
<h2>Devices</h2>
@if (Authorization.Has(Claims.Config.DeviceModel.Show))
{
@Html.ActionLinkClass("Models", MVC.Config.DeviceModel.Index(), "config")
<div class="pageMenuBlurb">
Configure Components, Product Images and default settings for Device Models.
</div>
}
@if (Authorization.Has(Claims.Config.DeviceBatch.Show))
{
@Html.ActionLinkClass("Batches", MVC.Config.DeviceBatch.Index(), "config")
<div class="pageMenuBlurb">
Create and Configure Device Batches.
</div>
}
@if (Authorization.Has(Claims.Config.DeviceProfile.Show))
{
@Html.ActionLinkClass("Profiles", MVC.Config.DeviceProfile.Index(), "config")
<div class="pageMenuBlurb">
Configure Device Profiles including computer name generation, distribution and Active
Directory OU layout.
</div>
}
@if (Authorization.Has(Claims.Config.Enrolment.Show))
{
@Html.ActionLinkClass("Enrolment", MVC.Config.Enrolment.Index(), "config")
<div class="pageMenuBlurb">
Configure Enrolment settings including secure credentials.
</div>
}
</div>
@Html.ActionLinkClass("Enrolment", MVC.Config.Enrolment.Index(), "config")
<div class="pageMenuBlurb">
Configure Enrolment settings including secure credentials.
</div>
</div>
</td>
<td>
<div class="pageMenuArea">
<h2>Features</h2>
@Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config")
<div class="pageMenuBlurb">
Create, Update and Bulk Generate documents based on PDF Templates for Jobs, Devices
</td>
}
@if (Authorization.HasAny(Claims.Config.DocumentTemplate.Show, Claims.Config.Plugin.Show))
{
<td>
<div class="pageMenuArea">
<h2>Features</h2>
@if (Authorization.Has(Claims.Config.DocumentTemplate.Show))
{
@Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config")
<div class="pageMenuBlurb">
Create, Update and Bulk Generate documents based on PDF Templates for Jobs, Devices
and Users.
</div>
}
@if (Authorization.Has(Claims.Config.Plugin.Show))
{
@Html.ActionLinkClass("Plugins", MVC.Config.Plugins.Index(), "config")
<div class="pageMenuBlurb">
Manage extensions to the Disco platform.
</div>
}
</div>
@Html.ActionLinkClass("Plugins", MVC.Config.Plugins.Index(), "config")
<div class="pageMenuBlurb">
Manage extensions to the Disco platform.
</div>
</div>
</td>
</td>
}
</tr>
</table>
@{
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.Config
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Config/Index.cshtml")]
public partial class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Config.IndexModel>
public partial class Index : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.Config.IndexModel>
{
public Index()
{
@@ -43,6 +45,7 @@ namespace Disco.Web.Areas.Config.Views.Config
#line 2 "..\..\Areas\Config\Views\Config\Index.cshtml"
Authorization.Require(Claims.Config.Show);
ViewBag.Title = "Configuration";
@@ -52,170 +55,485 @@ WriteLiteral("\r\n<table");
WriteLiteral(" id=\"pageMenu\"");
WriteLiteral(">\r\n <tr>\r\n <td>\r\n <div");
WriteLiteral(">\r\n <tr>\r\n");
#line 8 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 8 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.HasAny(Claims.Config.System.Show, Claims.Config.Organisation.Show, Claims.DiscoAdminAccount, Claims.Config.Logging.Show))
{
#line default
#line hidden
WriteLiteral(" <td>\r\n <div");
WriteLiteral(" class=\"pageMenuArea\"");
WriteLiteral(">\r\n <h2>Hosting</h2>\r\n");
WriteLiteral(" ");
WriteLiteral(">\r\n <h2>Hosting</h2>\r\n");
#line 10 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("System", MVC.Config.SystemConfig.Index(), "config"));
#line 13 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 13 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.System.Show))
{
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("System", MVC.Config.SystemConfig.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Update system configuration, such as the Data Storage Loca" +
"tion and Proxy settings.\r\n </div>\r\n");
WriteLiteral(" ");
#line 14 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Organisation Details", MVC.Config.Organisation.Index(), "config"));
#line 15 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Update the Organisation Name, Logo and Addresses associate" +
"d with this organisation.\r\n </div>\r\n");
WriteLiteral(" ");
WriteLiteral(">\r\n Update system configuration, such as the Data Stor" +
"age Location and Proxy settings.\r\n </div>\r\n");
#line 18 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Logging", MVC.Config.Logging.Index(), "config"));
#line 19 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" ");
#line 20 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.Organisation.Show))
{
#line default
#line hidden
#line 22 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Organisation Details", MVC.Config.Organisation.Index(), "config"));
#line default
#line hidden
#line 22 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Export Log files from various Disco Modules and view Live " +
"Logging.\r\n </div>\r\n </div>\r\n </td>\r\n <td" +
">\r\n <div");
WriteLiteral(">\r\n Update the Organisation Name, Logo and Addresses a" +
"ssociated with this organisation.\r\n </div>\r\n");
WriteLiteral(" class=\"pageMenuArea\"");
#line 26 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
WriteLiteral(">\r\n <h2>Devices</h2>\r\n");
WriteLiteral(" ");
#line default
#line hidden
WriteLiteral(" ");
#line 27 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Models", MVC.Config.DeviceModel.Index(), "config"));
if (Authorization.Has(Claims.DiscoAdminAccount))
{
#line default
#line hidden
#line 29 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Authorization Roles", MVC.Config.AuthorizationRole.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Configure Components, Product Images and default settings " +
"for Device Models.\r\n </div>\r\n");
WriteLiteral(" ");
#line 31 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Batches", MVC.Config.DeviceBatch.Index(), "config"));
#line 29 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Create and Configure Device Batches.\r\n </di" +
"v>\r\n");
WriteLiteral(" ");
WriteLiteral(">\r\n Configure roles and permissions for users.\r\n " +
" </div>\r\n");
#line 35 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Profiles", MVC.Config.DeviceProfile.Index(), "config"));
#line 33 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" ");
#line 34 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.Logging.Show))
{
#line default
#line hidden
#line 36 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Logging", MVC.Config.Logging.Index(), "config"));
#line default
#line hidden
#line 36 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Configure Device Profiles including computer name generati" +
"on, distribution and Active\r\n Directory OU layout.\r\n " +
" </div>\r\n");
WriteLiteral(" ");
WriteLiteral(">\r\n Export Log files from various Disco Modules and vi" +
"ew Live Logging.\r\n </div>\r\n");
#line 40 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Enrolment", MVC.Config.Enrolment.Index(), "config"));
}
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" </div>\r\n </td>\r\n");
WriteLiteral(" class=\"pageMenuBlurb\"");
#line 43 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
WriteLiteral(">\r\n Configure Enrolment settings including secure credentials." +
"\r\n </div>\r\n </div>\r\n </td>\r\n <td>\r\n " +
" <div");
#line default
#line hidden
WriteLiteral(" ");
#line 44 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.HasAny(Claims.Config.DeviceModel.Show, Claims.Config.DeviceBatch.Show, Claims.Config.DeviceProfile.Show, Claims.Config.Enrolment.Show))
{
#line default
#line hidden
WriteLiteral(" <td>\r\n <div");
WriteLiteral(" class=\"pageMenuArea\"");
WriteLiteral(">\r\n <h2>Features</h2>\r\n");
WriteLiteral(" ");
WriteLiteral(">\r\n <h2>Devices</h2>\r\n");
#line 49 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config"));
#line default
#line hidden
#line 49 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.DeviceModel.Show))
{
#line default
#line hidden
#line 51 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Models", MVC.Config.DeviceModel.Index(), "config"));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Create, Update and Bulk Generate documents based on PDF Te" +
"mplates for Jobs, Devices\r\n and Users.\r\n </div" +
">\r\n");
WriteLiteral(" ");
#line 54 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Plugins", MVC.Config.Plugins.Index(), "config"));
#line 51 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Manage extensions to the Disco platform.\r\n " +
"</div>\r\n </div>\r\n </td>\r\n </tr>\r\n</table>\r\n");
WriteLiteral(">\r\n Configure Components, Product Images and default s" +
"ettings for Device Models.\r\n </div>\r\n");
#line 55 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 56 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.DeviceBatch.Show))
{
#line default
#line hidden
#line 58 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Batches", MVC.Config.DeviceBatch.Index(), "config"));
#line default
#line hidden
#line 58 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Create and Configure Device Batches.\r\n " +
" </div>\r\n");
#line 62 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 63 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.DeviceProfile.Show))
{
#line default
#line hidden
#line 65 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Profiles", MVC.Config.DeviceProfile.Index(), "config"));
#line default
#line hidden
#line 65 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Configure Device Profiles including computer name " +
"generation, distribution and Active\r\n Directory OU layout.\r\n " +
" </div>\r\n");
#line 70 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 71 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.Enrolment.Show))
{
#line default
#line hidden
#line 73 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Enrolment", MVC.Config.Enrolment.Index(), "config"));
#line default
#line hidden
#line 73 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Configure Enrolment settings including secure cred" +
"entials.\r\n </div>\r\n");
#line 77 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n </td>\r\n");
#line 80 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 81 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.HasAny(Claims.Config.DocumentTemplate.Show, Claims.Config.Plugin.Show))
{
#line default
#line hidden
WriteLiteral(" <td>\r\n <div");
WriteLiteral(" class=\"pageMenuArea\"");
WriteLiteral(">\r\n <h2>Features</h2>\r\n");
#line 86 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 86 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.DocumentTemplate.Show))
{
#line default
#line hidden
#line 88 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config"));
#line default
#line hidden
#line 88 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Create, Update and Bulk Generate documents based o" +
"n PDF Templates for Jobs, Devices\r\n and Users.\r\n " +
" </div>\r\n");
#line 93 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 94 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.Plugin.Show))
{
#line default
#line hidden
#line 96 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Plugins", MVC.Config.Plugins.Index(), "config"));
#line default
#line hidden
#line 96 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Manage extensions to the Disco platform.\r\n " +
" </div>\r\n");
#line 100 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n </td>\r\n");
#line 103 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </tr>\r\n</table>\r\n");
#line 106 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Model.UpdateAvailable)
{
@@ -229,14 +547,14 @@ WriteLiteral(" id=\"updateAvailableContainer\"");
WriteLiteral(">\r\n <div>An updated version of Disco is available</div>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 3034), Tuple.Create("\"", 3070)
WriteAttribute("href", Tuple.Create(" href=\"", 5401), Tuple.Create("\"", 5437)
#line 67 "..\..\Areas\Config\Views\Config\Index.cshtml"
, Tuple.Create(Tuple.Create("", 3041), Tuple.Create<System.Object, System.Int32>(Model.UpdateResponse.UrlLink
#line 111 "..\..\Areas\Config\Views\Config\Index.cshtml"
, Tuple.Create(Tuple.Create("", 5408), Tuple.Create<System.Object, System.Int32>(Model.UpdateResponse.UrlLink
#line default
#line hidden
, 3041), false)
, 5408), false)
);
WriteLiteral(" target=\"_blank\"");
@@ -244,7 +562,7 @@ WriteLiteral(" target=\"_blank\"");
WriteLiteral(">Download Disco v");
#line 67 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 111 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Model.UpdateResponse.Version);
@@ -261,13 +579,13 @@ WriteLiteral(@" <script>
");
#line 75 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 119 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 75 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 119 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Model.UpdateResponse.VersionReleasedTimestamp < DateTime.Now.AddDays(-7))
{
@@ -283,7 +601,7 @@ WriteLiteral("\r\n updateAvailableContainer.effect(\"shake\", { t
WriteLiteral("\r\n");
#line 81 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 125 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -292,7 +610,7 @@ WriteLiteral("\r\n");
WriteLiteral("\r\n });\r\n })();\r\n </script>\r\n");
#line 86 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 130 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -1,5 +1,6 @@
@model Disco.Web.Areas.Config.Models.DeviceBatch.CreateModel
@{
Authorization.Require(Claims.Config.DeviceBatch.Create);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Create");
}
@using (Html.BeginForm())
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceBatch/Create.cshtml")]
public partial class Create : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceBatch.CreateModel>
public partial class Create : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceBatch.CreateModel>
{
public Create()
{
@@ -43,6 +45,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
#line 2 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
Authorization.Require(Claims.Config.DeviceBatch.Create);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Create");
@@ -51,7 +54,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
WriteLiteral("\r\n");
#line 5 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
#line 6 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
using (Html.BeginForm())
{
@@ -70,7 +73,7 @@ WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r
WriteLiteral(" ");
#line 14 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
#line 15 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
Write(Html.EditorFor(model => model.DeviceBatch.Name));
@@ -79,7 +82,7 @@ WriteLiteral(" ");
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));
@@ -90,7 +93,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
"d>");
#line 21 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
#line 22 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
Write(Html.EditorFor(model => model.DeviceBatch.PurchaseDate));
@@ -99,7 +102,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
WriteLiteral("<br />");
#line 21 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
#line 22 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.DeviceBatch.PurchaseDate));
@@ -136,7 +139,7 @@ WriteLiteral(@">
");
#line 39 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
#line 40 "..\..\Areas\Config\Views\DeviceBatch\Create.cshtml"
}
@@ -1,69 +1,78 @@
@model Disco.Web.Areas.Config.Models.DeviceBatch.IndexModel
@{
Authorization.Require(Claims.Config.DeviceBatch.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches");
}
<table class="tableData">
<tr>
<th>
Name
</th>
<th>
Default Model
</th>
<th>
Purchase Date
</th>
<th>
Warranty Expires
</th>
<th>
Insurance Expires
</th>
<th>
Device Count
</th>
</tr>
@foreach (var item in Model.DeviceBatches)
{
@if (Model.DeviceBatches.Count == 0)
{
<div class="form" style="width: 450px; padding: 100px 0;">
<h2>No device batches are configured</h2>
</div>
}
else
{
<table class="tableData">
<tr>
<td>
@Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id))
</td>
<td>
@item.DefaultDeviceModel
</td>
<td>
@CommonHelpers.FriendlyDate(item.PurchaseDate)
</td>
<td>
@CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown")
</td>
<td>
@CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown")
@(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier))
</td>
<td>
@if (item.PurchaseUnitQuantity.HasValue)
{
<span>@item.DeviceCount.ToString("n0")/@(item.PurchaseUnitQuantity.Value.ToString("n0"))</span>
}
else
{
@item.DeviceCount.ToString("n0")
}
@if (item.DeviceDecommissionedCount > 0)
{
<span class="smallMessage" title="@(item.DeviceDecommissionedCount.ToString("n0")) Decommissioned">
(@(item.DeviceDecommissionedCount.ToString("n0")))</span>
}
</td>
<th>Name
</th>
<th>Default Model
</th>
<th>Purchase Date
</th>
<th>Warranty Expires
</th>
<th>Insurance Expires
</th>
<th>Device Count
</th>
</tr>
}
</table>
<div class="actionBar">
@if (Model.DeviceBatches.Count > 0)
{
@Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline())
}
@Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create())
</div>
@foreach (var item in Model.DeviceBatches)
{
<tr>
<td>
@Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id))
</td>
<td>
@item.DefaultDeviceModel
</td>
<td>
@CommonHelpers.FriendlyDate(item.PurchaseDate)
</td>
<td>
@CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown")
</td>
<td>
@CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown")
@(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier))
</td>
<td>
@if (item.PurchaseUnitQuantity.HasValue)
{
<span>@item.DeviceCount.ToString("n0")/@(item.PurchaseUnitQuantity.Value.ToString("n0"))</span>
}
else
{
@item.DeviceCount.ToString("n0")
}
@if (item.DeviceDecommissionedCount > 0)
{
<span class="smallMessage" title="@(item.DeviceDecommissionedCount.ToString("n0")) Decommissioned">(@(item.DeviceDecommissionedCount.ToString("n0")))</span>
}
</td>
</tr>
}
</table>
}
@if (Authorization.HasAny(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.ShowTimeline))
{
<div class="actionBar">
@if (Authorization.Has(Claims.Config.DeviceBatch.ShowTimeline) && Model.DeviceBatches.Count > 0)
{
@Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline())
}
@if (Authorization.HasAll(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.Configure))
{
@Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create())
}
</div>
}
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceBatch/Index.cshtml")]
public partial class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceBatch.IndexModel>
public partial class Index : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceBatch.IndexModel>
{
public Index()
{
@@ -43,139 +45,161 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
#line 2 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Authorization.Require(Claims.Config.DeviceBatch.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches");
#line default
#line hidden
WriteLiteral("\r\n<table");
WriteLiteral(" class=\"tableData\"");
WriteLiteral(@">
<tr>
<th>
Name
</th>
<th>
Default Model
</th>
<th>
Purchase Date
</th>
<th>
Warranty Expires
</th>
<th>
Insurance Expires
</th>
<th>
Device Count
</th>
</tr>
");
#line 26 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 26 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
foreach (var item in Model.DeviceBatches)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
#line 30 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 33 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DefaultDeviceModel);
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 36 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.PurchaseDate));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 39 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown"));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 42 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown"));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 43 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier));
#line 6 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (Model.DeviceBatches.Count == 0)
{
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" <div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 450px; padding: 100px 0;\"");
WriteLiteral(">\r\n <h2>No device batches are configured</h2>\r\n </div> \r\n");
#line 11 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <table");
WriteLiteral(" class=\"tableData\"");
WriteLiteral(@">
<tr>
<th>Name
</th>
<th>Default Model
</th>
<th>Purchase Date
</th>
<th>Warranty Expires
</th>
<th>Insurance Expires
</th>
<th>Device Count
</th>
</tr>
");
#line 29 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 29 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
foreach (var item in Model.DeviceBatches)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
#line 33 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLink(item.Name, MVC.Config.DeviceBatch.Index(item.Id)));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 36 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DefaultDeviceModel);
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 39 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.PurchaseDate));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 42 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.WarrantyExpires, "Unknown"));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 45 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(CommonHelpers.FriendlyDate(item.InsuredUntil, item.InsuranceSupplier == null ? "N/A" : "Unknown"));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 46 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 46 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (item.PurchaseUnitQuantity.HasValue)
{
Write(item.InsuranceSupplier == null ? string.Empty : string.Format("[{0}]", item.InsuranceSupplier));
#line default
#line hidden
WriteLiteral(" <span>");
WriteLiteral("\r\n </td>\r\n <td>\r\n");
#line 48 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line 49 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 49 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (item.PurchaseUnitQuantity.HasValue)
{
#line default
#line hidden
WriteLiteral(" <span>");
#line 51 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
@@ -183,8 +207,8 @@ WriteLiteral(" <span>");
WriteLiteral("/");
#line 48 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.PurchaseUnitQuantity.Value.ToString("n0"));
#line 51 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.PurchaseUnitQuantity.Value.ToString("n0"));
#line default
@@ -192,59 +216,59 @@ WriteLiteral("/");
WriteLiteral("</span>\r\n");
#line 49 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
else
{
#line default
#line hidden
#line 52 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
}
else
{
#line default
#line hidden
#line 55 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
#line default
#line hidden
#line 52 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line 55 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 54 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (item.DeviceDecommissionedCount > 0)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1775), Tuple.Create("\"", 1846)
#line 56 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1783), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount.ToString("n0")
#line default
#line hidden
, 1783), false)
, Tuple.Create(Tuple.Create(" ", 1831), Tuple.Create("Decommissioned", 1832), true)
);
WriteLiteral(">\r\n (");
WriteLiteral(" ");
#line 57 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceDecommissionedCount.ToString("n0"));
if (item.DeviceDecommissionedCount > 0)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2117), Tuple.Create("\"", 2188)
#line 59 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
, Tuple.Create(Tuple.Create("", 2125), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount.ToString("n0")
#line default
#line hidden
, 2125), false)
, Tuple.Create(Tuple.Create(" ", 2173), Tuple.Create("Decommissioned", 2174), true)
);
WriteLiteral(">(");
#line 59 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(item.DeviceDecommissionedCount.ToString("n0"));
#line default
@@ -252,67 +276,106 @@ WriteLiteral(">\r\n (");
WriteLiteral(")</span>\r\n");
#line 58 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line 60 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n");
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 61 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line 63 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("</table>\r\n<div");
WriteLiteral(" </table>\r\n");
#line 65 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
#line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (Authorization.HasAny(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.ShowTimeline))
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
#line 64 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 64 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (Model.DeviceBatches.Count > 0)
{
#line 69 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
#line default
#line hidden
#line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline()));
#line 69 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (Authorization.Has(Claims.Config.DeviceBatch.ShowTimeline) && Model.DeviceBatches.Count > 0)
{
#line default
#line hidden
#line 71 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLinkButton("Timeline", MVC.Config.DeviceBatch.Timeline()));
#line default
#line hidden
#line 66 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line 71 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral(" ");
#line 68 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create()));
#line 73 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
if (Authorization.HasAll(Claims.Config.DeviceBatch.Create, Claims.Config.DeviceBatch.Configure))
{
#line default
#line hidden
#line 75 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
Write(Html.ActionLinkButton("Create Device Batch", MVC.Config.DeviceBatch.Create()));
#line default
#line hidden
WriteLiteral("\r\n</div>\r\n");
#line 75 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
#line 78 "..\..\Areas\Config\Views\DeviceBatch\Index.cshtml"
}
#line default
#line hidden
}
}
}
@@ -1,9 +1,18 @@
@model Disco.Web.Areas.Config.Models.DeviceBatch.ShowModel
@{
Authorization.Require(Claims.Config.DeviceBatch.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), Model.DeviceBatch.ToString());
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
Html.BundleDeferred("~/ClientScripts/Modules/tinymce");
var canConfig = Authorization.Has(Claims.Config.DeviceBatch.Configure);
var canDeviceModelShow = Authorization.Has(Claims.Config.DeviceModel.Show);
if (canConfig)
{
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AjaxHelperIcons");
Html.BundleDeferred("~/ClientScripts/Modules/tinymce");
}
}
<div class="form deviceBatches" style="width: 730px">
<table>
@@ -17,26 +26,35 @@
<tr>
<th>Name:
</th>
<td>@Html.EditorFor(model => model.DeviceBatch.Name)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#DeviceBatch_Name'),
'Invalid Name',
'@(Url.Action(MVC.API.DeviceBatch.UpdateName(Model.DeviceBatch.Id)))',
<td>
@if (canConfig)
{
@Html.EditorFor(model => model.DeviceBatch.Name)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#DeviceBatch_Name'),
'Invalid Name',
'@(Url.Action(MVC.API.DeviceBatch.UpdateName(Model.DeviceBatch.Id)))',
'BatchName'
);
});
</script>
});
</script>
}
else
{
@Model.DeviceBatch.Name
}
</td>
</tr>
<tr>
<th>Default Device Model:
</th>
<td>
@Html.DropDownListFor(model => model.DeviceBatch.DefaultDeviceModelId, Model.DeviceModels.ToSelectListItems())
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.DeviceBatch.DefaultDeviceModelId, Model.DeviceModels.ToSelectListItems(null, true))
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
@@ -49,6 +67,15 @@
);
});
</script>
}
else
{
if (Model.DefaultDeviceModel == null)
{<span class="smallMessage">&lt;None Specified&gt;</span>}
else
{@Model.DefaultDeviceModel.ToString();
}
}
<br />
<span class="smallMessage">Devices added offline will default to this Device Model.
Once a device enrols the Device Model will be accurately represented.</span>
@@ -72,7 +99,14 @@
{
<tr>
<td>
@Html.ActionLink(membership.DeviceModel.ToString(), MVC.Config.DeviceModel.Index(membership.DeviceModel.Id))
@if (canDeviceModelShow)
{
@Html.ActionLink(membership.DeviceModel.ToString(), MVC.Config.DeviceModel.Index(membership.DeviceModel.Id))
}
else
{
@membership.DeviceModel.ToString()
}
</td>
<td>
@membership.DeviceCount.ToString("n0")
@@ -115,27 +149,35 @@
<th class="name" style="width: 100px">Purchase Date:
</th>
<td>
@Html.EditorFor(model => model.DeviceBatch.PurchaseDate)
@AjaxHelpers.AjaxLoader()
<script>
$(function () {
var dateField = $('#DeviceBatch_PurchaseDate');
document.DiscoFunctions.DateChangeHelper(
dateField,
'Invalid Date',
'@(Url.Action(MVC.API.DeviceBatch.UpdatePurchaseDate(Model.DeviceBatch.Id)))',
@if (canConfig)
{
@Html.EditorFor(model => model.DeviceBatch.PurchaseDate)
@AjaxHelpers.AjaxLoader()
<script>
$(function () {
var dateField = $('#DeviceBatch_PurchaseDate');
document.DiscoFunctions.DateChangeHelper(
dateField,
'Invalid Date',
'@(Url.Action(MVC.API.DeviceBatch.UpdatePurchaseDate(Model.DeviceBatch.Id)))',
'PurchaseDate',
null,
true
);
});
</script>
});
</script>
}
else
{
@CommonHelpers.FriendlyDate(Model.DeviceBatch.PurchaseDate)
}
</td>
</tr>
<tr>
<th>Supplier:
</th>
<td>
<td>@if (canConfig)
{
@Html.EditorFor(model => model.DeviceBatch.Supplier)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
@@ -149,12 +191,21 @@
);
});
</script>
}
else
{
if (string.IsNullOrEmpty(Model.DeviceBatch.Supplier))
{<span class="smallMessage">&lt;None Specified&gt;</span>}
else
{@Model.DeviceBatch.Supplier}
}
</td>
</tr>
<tr>
<th>Unit Cost:
</th>
<td>
<td>@if (canConfig)
{
@Html.EditorFor(model => model.DeviceBatch.UnitCost)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
@@ -168,12 +219,21 @@
);
});
</script>
}
else
{
if (!Model.DeviceBatch.UnitCost.HasValue)
{<span class="smallMessage">&lt;None Specified&gt;</span>}
else
{@Model.DeviceBatch.UnitCost.Value.ToString("C")}
}
</td>
</tr>
<tr>
<th>Quantity:
</th>
<td>
<td>@if (canConfig)
{
@Html.EditorFor(model => model.DeviceBatch.UnitQuantity)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
@@ -187,6 +247,14 @@
);
});
</script>
}
else
{
if (!Model.DeviceBatch.UnitQuantity.HasValue)
{<span class="smallMessage">&lt;None Specified&gt;</span>}
else
{@Model.DeviceBatch.UnitQuantity.Value.ToString("n0")}
}
</td>
</tr>
</table>
@@ -194,55 +262,65 @@
<div>
Details @AjaxHelpers.AjaxLoader("ajaxPurchaseDetails")
</div>
@Html.EditorFor(model => model.DeviceBatch.PurchaseDetails)
<script type="text/javascript">
$(function () {
var model = {
$field: $('#DeviceBatch_PurchaseDetails'),
fieldName: 'PurchaseDetails',
$ajax_loading: null,
$ajax_ok: null,
updated: function () {
if (!model.$ajax_loading)
model.$ajax_loading = $('#ajax' + model.fieldName + '_loading');
if (!model.$ajax_ok)
model.$ajax_ok = $('#ajax' + model.fieldName + '_ok');
model.$ajax_loading.show();
var data = {};
data[model.fieldName] = model.$field.tinymce().getContent();
$.ajax({
url: '@(Url.Action(MVC.API.DeviceBatch.UpdatePurchaseDetails(Model.DeviceBatch.Id)))',
dataType: 'json',
data: data,
traditional: true,
type: 'POST',
success: function (d) {
if (d == 'OK') {
@if (canConfig)
{
@Html.EditorFor(model => model.DeviceBatch.PurchaseDetails)
<script type="text/javascript">
$(function () {
var model = {
$field: $('#DeviceBatch_PurchaseDetails'),
fieldName: 'PurchaseDetails',
$ajax_loading: null,
$ajax_ok: null,
updated: function () {
if (!model.$ajax_loading)
model.$ajax_loading = $('#ajax' + model.fieldName + '_loading');
if (!model.$ajax_ok)
model.$ajax_ok = $('#ajax' + model.fieldName + '_ok');
model.$ajax_loading.show();
var data = {};
data[model.fieldName] = model.$field.tinymce().getContent();
$.ajax({
url: '@(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.$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({
theme: 'simple',
setup: function (ed) {
ed.onInit.add(function (ed) {
$(ed.getWin()).blur(model.updated);
});
}
model.$field.tinymce({
theme: 'simple',
setup: function (ed) {
ed.onInit.add(function (ed) {
$(ed.getWin()).blur(model.updated);
});
}
});
});
});
</script>
</script>
}
else
{
if (string.IsNullOrEmpty(Model.DeviceBatch.PurchaseDetails))
{<span class="smallMessage">&lt;None Specified&gt;</span>}
else
{@(new HtmlString(Model.DeviceBatch.PurchaseDetails))}
}
</div>
</td>
</tr>
@@ -255,21 +333,28 @@
<th class="name" style="width: 100px">Valid Until:
</th>
<td>
@Html.EditorFor(model => model.DeviceBatch.WarrantyValidUntil)
@AjaxHelpers.AjaxLoader()
<script>
$(function () {
var dateField = $('#DeviceBatch_WarrantyValidUntil');
document.DiscoFunctions.DateChangeHelper(
dateField,
'Warranty Valid Until',
'@(Url.Action(MVC.API.DeviceBatch.UpdateWarrantyValidUntil(Model.DeviceBatch.Id)))',
@if (canConfig)
{
@Html.EditorFor(model => model.DeviceBatch.WarrantyValidUntil)
@AjaxHelpers.AjaxLoader()
<script>
$(function () {
var dateField = $('#DeviceBatch_WarrantyValidUntil');
document.DiscoFunctions.DateChangeHelper(
dateField,
'Warranty Valid Until',
'@(Url.Action(MVC.API.DeviceBatch.UpdateWarrantyValidUntil(Model.DeviceBatch.Id)))',
'WarrantyValidUntil',
null,
true
);
});
</script>
});
</script>
}
else
{
@CommonHelpers.FriendlyDate(Model.DeviceBatch.WarrantyValidUntil, "Unknown")
}
</td>
</tr>
</table>
@@ -277,55 +362,65 @@
<div>
Details @AjaxHelpers.AjaxLoader("ajaxWarrantyDetails")
</div>
@Html.EditorFor(model => model.DeviceBatch.WarrantyDetails)
<script type="text/javascript">
$(function () {
var model = {
$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') {
@if (canConfig)
{
@Html.EditorFor(model => model.DeviceBatch.WarrantyDetails)
<script type="text/javascript">
$(function () {
var model = {
$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.$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({
theme: 'simple',
setup: function (ed) {
ed.onInit.add(function (ed) {
$(ed.getWin()).blur(model.updated);
});
}
model.$field.tinymce({
theme: 'simple',
setup: function (ed) {
ed.onInit.add(function (ed) {
$(ed.getWin()).blur(model.updated);
});
}
});
});
});
</script>
</script>
}
else
{
if (string.IsNullOrEmpty(Model.DeviceBatch.WarrantyDetails))
{<span class="smallMessage">&lt;None Specified&gt;</span>}
else
{@(new HtmlString(Model.DeviceBatch.WarrantyDetails))}
}
</div>
</td>
</tr>
@@ -337,7 +432,8 @@
<tr>
<th class="name" style="width: 100px">Supplier:
</th>
<td>
<td>@if (canConfig)
{
@Html.EditorFor(model => model.DeviceBatch.InsuranceSupplier)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
@@ -351,12 +447,22 @@
);
});
</script>
}
else
{
if (string.IsNullOrEmpty(Model.DeviceBatch.InsuranceSupplier))
{<span class="smallMessage">&lt;None Specified&gt;</span>}
else
{@Model.DeviceBatch.InsuranceSupplier;
}
}
</td>
</tr>
<tr>
<th class="name">Insured Date:
</th>
<td>
<td>@if (canConfig)
{
@Html.EditorFor(model => model.DeviceBatch.InsuredDate)
@AjaxHelpers.AjaxLoader()
<script>
@@ -372,12 +478,18 @@
);
});
</script>
}
else
{
@CommonHelpers.FriendlyDate(Model.DeviceBatch.InsuredDate, "Unknown")
}
</td>
</tr>
<tr>
<th class="name">Insured Until:
</th>
<td>
<td>@if (canConfig)
{
@Html.EditorFor(model => model.DeviceBatch.InsuredUntil)
@AjaxHelpers.AjaxLoader()
<script>
@@ -393,6 +505,11 @@
);
});
</script>
}
else
{
@CommonHelpers.FriendlyDate(Model.DeviceBatch.InsuredUntil, "Unknown")
}
</td>
</tr>
</table>
@@ -400,54 +517,64 @@
<div>
Details @AjaxHelpers.AjaxLoader("ajaxInsuranceDetails")
</div>
@Html.EditorFor(model => model.DeviceBatch.InsuranceDetails)
<script type="text/javascript">
$(function () {
var model = {
$DeviceBatch_Comments: $('#DeviceBatch_InsuranceDetails'),
$ajax_loading: null,
$ajax_ok: null,
updated: function () {
if (!model.$ajax_loading)
model.$ajax_loading = $('#ajaxInsuranceDetails_loading');
if (!model.$ajax_ok)
model.$ajax_ok = $('#ajaxInsuranceDetails_ok');
model.$ajax_loading.show();
var data = { InsuranceDetails: model.$DeviceBatch_Comments.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') {
@if (canConfig)
{
@Html.EditorFor(model => model.DeviceBatch.InsuranceDetails)
<script type="text/javascript">
$(function () {
var model = {
$DeviceBatch_Comments: $('#DeviceBatch_InsuranceDetails'),
$ajax_loading: null,
$ajax_ok: null,
updated: function () {
if (!model.$ajax_loading)
model.$ajax_loading = $('#ajaxInsuranceDetails_loading');
if (!model.$ajax_ok)
model.$ajax_ok = $('#ajaxInsuranceDetails_ok');
model.$ajax_loading.show();
var data = { InsuranceDetails: model.$DeviceBatch_Comments.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.$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.$DeviceBatch_Comments.tinymce({
theme: 'simple',
setup: function (ed) {
//ed.onChange.add(model.updatedThrottle);
ed.onInit.add(function (ed) {
$(ed.getWin()).blur(model.updated);
});
}
model.$DeviceBatch_Comments.tinymce({
theme: 'simple',
setup: function (ed) {
//ed.onChange.add(model.updatedThrottle);
ed.onInit.add(function (ed) {
$(ed.getWin()).blur(model.updated);
});
}
});
});
});
</script>
</script>
}
else
{
if (string.IsNullOrEmpty(Model.DeviceBatch.InsuranceDetails))
{<span class="smallMessage">&lt;None Specified&gt;</span>}
else
{@(new HtmlString(Model.DeviceBatch.InsuranceDetails))}
}
</div>
</td>
</tr>
@@ -455,7 +582,8 @@
<th>Comments:<br />
@AjaxHelpers.AjaxLoader("ajaxComments")
</th>
<td>
<td>@if (canConfig)
{
@Html.EditorFor(model => model.DeviceBatch.Comments)
<script type="text/javascript">
$(function () {
@@ -504,6 +632,14 @@
});
});
</script>
}
else
{
if (string.IsNullOrEmpty(Model.DeviceBatch.Comments))
{<span class="smallMessage">&lt;None Specified&gt;</span>}
else
{@(new HtmlString(Model.DeviceBatch.Comments))}
}
</td>
</tr>
</table>
@@ -514,8 +650,14 @@
@Html.ActionLinkButton("Delete", MVC.API.DeviceBatch.Delete(Model.DeviceBatch.Id, true), "buttonDelete")
}
@if (Model.DeviceCount > 0)
{
{
if (Authorization.Has(Claims.Device.Actions.Export))
{
@Html.ActionLinkButton("Export Devices", MVC.API.DeviceBatch.ExportDevices(Model.DeviceBatch.Id))
}
if (Authorization.Has(Claims.Device.Search))
{
@Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceBatch.Id.ToString(), "DeviceBatch"))
}
}
</div>
File diff suppressed because it is too large Load Diff
@@ -1,4 +1,6 @@
@{
Authorization.Require(Claims.Config.DeviceBatch.ShowTimeline);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Timeline");
Html.BundleDeferred("~/Style/Timeline");
Html.BundleDeferred("~/ClientScripts/Modules/Timeline");
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceBatch/Timeline.cshtml")]
public partial class Timeline : System.Web.Mvc.WebViewPage<dynamic>
public partial class Timeline : Disco.Services.Web.WebViewPage<dynamic>
{
public Timeline()
{
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.DeviceBatch
#line 1 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
Authorization.Require(Claims.Config.DeviceBatch.ShowTimeline);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Batches", MVC.Config.DeviceBatch.Index(null), "Timeline");
Html.BundleDeferred("~/Style/Timeline");
Html.BundleDeferred("~/ClientScripts/Modules/Timeline");
@@ -63,7 +67,7 @@ WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n (function () {\r\n var dataUrl = \'");
#line 10 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
#line 12 "..\..\Areas\Config\Views\DeviceBatch\Timeline.cshtml"
Write(Url.Action(MVC.API.DeviceBatch.Timeline()));
@@ -1,5 +1,7 @@
@model Disco.Web.Areas.Config.Models.DeviceModel.ComponentsModel
@{
Authorization.Require(Claims.Config.DeviceModel.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), "Generic Components");
}
@Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model)
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceModel/GenericComponents.cshtml")]
public partial class GenericComponents : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ComponentsModel>
public partial class GenericComponents : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ComponentsModel>
{
public GenericComponents()
{
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
#line 2 "..\..\Areas\Config\Views\DeviceModel\GenericComponents.cshtml"
Authorization.Require(Claims.Config.DeviceModel.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), "Generic Components");
@@ -51,7 +55,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
WriteLiteral("\r\n");
#line 5 "..\..\Areas\Config\Views\DeviceModel\GenericComponents.cshtml"
#line 7 "..\..\Areas\Config\Views\DeviceModel\GenericComponents.cshtml"
Write(Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model));
@@ -1,5 +1,7 @@
@model Disco.Web.Areas.Config.Models.DeviceModel.IndexModel
@{
Authorization.Require(Claims.Config.DeviceModel.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models");
}
<table class="tableData">
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceModel/Index.cshtml")]
public partial class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.IndexModel>
public partial class Index : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.IndexModel>
{
public Index()
{
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
#line 2 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Authorization.Require(Claims.Config.DeviceModel.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models");
@@ -73,13 +77,13 @@ WriteLiteral(@">
");
#line 23 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 25 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line default
#line hidden
#line 23 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 25 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
foreach (var item in Model.DeviceModels)
{
@@ -91,7 +95,7 @@ WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
#line 27 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 29 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.ActionLink(item.ToString(), MVC.Config.DeviceModel.Index(item.Id)));
@@ -102,7 +106,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 30 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 32 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.DisplayFor(modelItem => item.Manufacturer));
@@ -113,7 +117,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 33 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 35 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.DisplayFor(modelItem => item.Model));
@@ -124,7 +128,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 36 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 38 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.DisplayFor(modelItem => item.ModelType));
@@ -135,7 +139,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 39 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 41 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(item.DeviceCount.ToString("n0"));
@@ -144,13 +148,13 @@ WriteLiteral(" ");
WriteLiteral("\r\n");
#line 40 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 42 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line default
#line hidden
#line 40 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 42 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
if (item.DeviceDecommissionedCount > 0)
{
@@ -161,21 +165,21 @@ WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1167), Tuple.Create("\"", 1223)
WriteAttribute("title", Tuple.Create(" title=\"", 1233), Tuple.Create("\"", 1289)
#line 42 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1175), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount
#line 44 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1241), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount
#line default
#line hidden
, 1175), false)
, Tuple.Create(Tuple.Create(" ", 1208), Tuple.Create("Decommissioned", 1209), true)
, 1241), false)
, Tuple.Create(Tuple.Create(" ", 1274), Tuple.Create("Decommissioned", 1275), true)
);
WriteLiteral(">\r\n (");
#line 43 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 45 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(item.DeviceDecommissionedCount.ToString("n0"));
@@ -184,7 +188,7 @@ WriteLiteral(">\r\n (");
WriteLiteral(")</span>\r\n");
#line 44 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 46 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
}
@@ -193,7 +197,7 @@ WriteLiteral(")</span>\r\n");
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 47 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 49 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
}
@@ -208,7 +212,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 50 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
#line 52 "..\..\Areas\Config\Views\DeviceModel\Index.cshtml"
Write(Html.ActionLinkButton("Generic Components", MVC.Config.DeviceModel.GenericComponents()));
@@ -1,37 +1,44 @@
@model Disco.Web.Areas.Config.Models.DeviceModel.ShowModel
@{
Authorization.Require(Claims.Config.DeviceModel.Show);
var canConfig = Authorization.Has(Claims.Config.DeviceModel.Configure);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), Model.DeviceModel.ToString());
}
<div class="form" style="width: 530px">
<table>
<tr>
<th style="width: 150px">
Id:
<th style="width: 150px">Id:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Id)
</td>
</tr>
<tr>
<th>
Description:
<th>Description:
</th>
<td>@Html.EditorFor(model => model.DeviceModel.Description)
<td>@if (canConfig)
{
@Html.EditorFor(model => model.DeviceModel.Description)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
}
else
{
@Html.DisplayFor(model => model.DeviceModel.Description)
}
</td>
</tr>
<tr>
<th>
Manufacturer:
<th>Manufacturer:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Manufacturer)
</td>
</tr>
<tr>
<th>
Model:
<th>Model:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.Model)
@@ -48,169 +55,206 @@
</td>
</tr>
<tr>
<th>
Default Purchase Date:
<th>Default Purchase Date:
</th>
<td>
<td>@if (canConfig)
{
@Html.EditorFor(model => model.DeviceModel.DefaultPurchaseDate)
@AjaxHelpers.AjaxLoader()
}
else
{
@CommonHelpers.FriendlyDate(Model.DeviceModel.DefaultPurchaseDate, "Unknown")
}
</td>
</tr>
<tr>
<th>
Default Warranty Provider:
<th>Default Warranty Provider:
</th>
<td>
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.DeviceModel.DefaultWarrantyProvider, Model.WarrantyProviders.ToSelectListItems(Model.DeviceModel.DefaultWarrantyProvider, true, "None"))
@AjaxHelpers.AjaxLoader()
}
else
{
if (Model.DeviceModel.DefaultWarrantyProvider == null)
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
var provider = Model.WarrantyProviders.FirstOrDefault(wp => wp.Id == Model.DeviceModel.DefaultWarrantyProvider);
if (provider == null)
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
@provider.Name
}
}
}
</td>
</tr>
<tr>
<th>
Type:
<th>Type:
</th>
<td>
@Html.DisplayFor(model => model.DeviceModel.ModelType)
</td>
</tr>
<tr>
<th>
Image:
<th>Image:
</th>
<td>
<img alt="Model Image" src="@Url.Action(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, Model.DeviceModel.ImageHash()))" />
</td>
</tr>
<tr>
<th>
<label for="DeviceModel_Image">
Update Image:
</label>
</th>
<td>
@using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="Image" id="Image" style="width: 250px;" />
<input class="button" type="submit" value="Update" />
}
</td>
</tr>
@if (canConfig)
{
<tr>
<th>
<label for="DeviceModel_Image">
Update Image:
</label>
</th>
<td>
@using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="Image" id="Image" style="width: 250px;" />
<input class="button" type="submit" value="Update" />
}
</td>
</tr>
}
</table>
<script type="text/javascript">
$(function () {
var $Description = $('#DeviceModel_Description');
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
$Description
.watermark('Model Description')
.focus(function () { $Description.select() })
.keydown(function (e) {
$DescriptionAjaxSave.show();
if (e.which == 13) {
$(this).blur();
}
}).blur(function () {
$DescriptionAjaxSave.hide();
@if (canConfig)
{
<script type="text/javascript">
$(function () {
var $Description = $('#DeviceModel_Description');
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
$Description
.watermark('Model Description')
.focus(function () { $Description.select() })
.keydown(function (e) {
$DescriptionAjaxSave.show();
if (e.which == 13) {
$(this).blur();
}
}).blur(function () {
$DescriptionAjaxSave.hide();
})
.change(function () {
$DescriptionAjaxSave.hide();
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
var data = { Description: $Description.val() };
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.UpdateDescription(Model.DeviceModel.Id))',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to update description: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update description: ' + textStatus);
$ajaxLoading.hide();
}
});
});
});
</script>
<script type="text/javascript">
$(function () {
var $dataField = $('#DeviceModel_DefaultPurchaseDate');
var $ajaxLoading = $dataField.next('.ajaxLoading');
var dateFieldValue = $dataField.val();
var dateFieldChangeToken = null;
$dataField
.watermark('None')
.datepicker({
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd'
})
.change(function () {
$DescriptionAjaxSave.hide();
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
var data = { Description: $Description.val() };
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.UpdateDescription(Model.DeviceModel.Id))',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to update description: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update description: ' + textStatus);
$ajaxLoading.hide();
}
});
var dateText = $dataField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function () {
$ajaxLoading.show();
var data = {};
data['DefaultPurchaseDate'] = dateFieldValue;
$.getJSON('@(Url.Action(MVC.API.DeviceModel.UpdateDefaultPurchaseDate(Model.DeviceModel.Id)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function () {
$(this).select();
});
});
</script>
<script type="text/javascript">
$(function () {
var $dataField = $('#DeviceModel_DefaultPurchaseDate');
var $ajaxLoading = $dataField.next('.ajaxLoading');
var dateFieldValue = $dataField.val();
var dateFieldChangeToken = null;
$dataField
.watermark('None')
.datepicker({
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd'
})
.change(function () {
var dateText = $dataField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function () {
});
</script>
<script type="text/javascript">
$(function () {
var $DefaultWarrantyProvider = $('#DeviceModel_DefaultWarrantyProvider');
var $ajaxLoading = $DefaultWarrantyProvider.next('.ajaxLoading');
$DefaultWarrantyProvider
.change(function () {
$ajaxLoading.show();
var data = {};
data['DefaultPurchaseDate'] = dateFieldValue;
$.getJSON('@(Url.Action(MVC.API.DeviceModel.UpdateDefaultPurchaseDate(Model.DeviceModel.Id)))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Date:\n' + response);
var data = { DefaultWarrantyProvider: $DefaultWarrantyProvider.val() };
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.UpdateDefaultWarrantyProvider(Model.DeviceModel.Id))',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to default warranty provider: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to default warranty provider: ' + textStatus);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function () {
$(this).select();
});
});
</script>
<script type="text/javascript">
$(function () {
var $DefaultWarrantyProvider = $('#DeviceModel_DefaultWarrantyProvider');
var $ajaxLoading = $DefaultWarrantyProvider.next('.ajaxLoading');
$DefaultWarrantyProvider
.change(function () {
$ajaxLoading.show();
var data = { DefaultWarrantyProvider: $DefaultWarrantyProvider.val() };
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.UpdateDefaultWarrantyProvider(Model.DeviceModel.Id))',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to default warranty provider: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to default warranty provider: ' + textStatus);
$ajaxLoading.hide();
}
});
});
});
});
</script>
});
</script>
}
</div>
<h2>
Components</h2>
<h2>Components</h2>
@Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.DeviceComponentsModel)
<div class="actionBar">
@if (Model.CanDelete)
@if (Model.CanDelete)
{
@Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete")
}
@Html.ActionLinkButton("Export Devices", MVC.API.DeviceModel.ExportDevices(Model.DeviceModel.Id))
@Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel"))
@if (Model.DeviceCount > 0)
{
if (Authorization.Has(Claims.Device.Actions.Export))
{
@Html.ActionLinkButton("Export Devices", MVC.API.DeviceModel.ExportDevices(Model.DeviceModel.Id))
}
if (Authorization.Has(Claims.Device.Search))
{
@Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel"))
}
}
</div>
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceModel/Show.cshtml")]
public partial class Show : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ShowModel>
public partial class Show : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ShowModel>
{
public Show()
{
@@ -43,6 +45,10 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
#line 2 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Authorization.Require(Claims.Config.DeviceModel.Show);
var canConfig = Authorization.Has(Claims.Config.DeviceModel.Configure);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), Model.DeviceModel.ToString());
@@ -58,68 +64,107 @@ WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th");
WriteLiteral(" style=\"width: 150px\"");
WriteLiteral(">\r\n Id:\r\n </th>\r\n <td>\r\n");
WriteLiteral(">Id:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 12 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 15 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.Id));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Description:\r\n </th>\r\n <td>");
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>Description:\r\n " +
" </th>\r\n <td>");
#line 19 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 21 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 23 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.EditorFor(model => model.DeviceModel.Description));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 20 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 23 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line default
#line hidden
#line 24 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 21 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 24 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line default
#line hidden
#line 25 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Manufacturer:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 25 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
else
{
#line default
#line hidden
#line 29 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.Manufacturer));
Write(Html.DisplayFor(model => model.DeviceModel.Description));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Model:\r\n </th>\r\n <td>\r\n");
#line 29 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>Manufacturer:\r\n " +
" </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 37 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.Manufacturer));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>Model:\r\n " +
" </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 44 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.Model));
@@ -129,7 +174,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n
"\r\n <td>\r\n <div><strong>");
#line 43 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 50 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Model.DeviceCount.ToString("n0"));
@@ -138,7 +183,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n
WriteLiteral("</strong> ");
#line 43 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 50 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Model.DeviceCount == 1 ? "devices is" : "devices are");
@@ -147,13 +192,13 @@ WriteLiteral("</strong> ");
WriteLiteral(" of this model type.</div>\r\n");
#line 44 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 51 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line default
#line hidden
#line 44 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 51 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
if (Model.DeviceDecommissionedCount > 0)
{
@@ -167,7 +212,7 @@ WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">");
#line 46 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 53 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Model.DeviceDecommissionedCount.ToString("n0"));
@@ -176,7 +221,7 @@ WriteLiteral(">");
WriteLiteral(" ");
#line 46 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 53 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Model.DeviceDecommissionedCount == 1 ? "device is" : "devices are");
@@ -185,108 +230,228 @@ WriteLiteral(" ");
WriteLiteral(" decommissioned.</div>\r\n");
#line 47 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 54 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Default Purchase Date:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>Default Purchase " +
"Date:\r\n </th>\r\n <td>");
#line 55 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.EditorFor(model => model.DeviceModel.DefaultPurchaseDate));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 56 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Default Warranty Provider:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 64 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DropDownListFor(model => model.DeviceModel.DefaultWarrantyProvider, Model.WarrantyProviders.ToSelectListItems(Model.DeviceModel.DefaultWarrantyProvider, true, "None")));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 65 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Type:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 73 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.ModelType));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" Image:\r\n </th>\r\n <td>\r\n <img");
WriteLiteral(" alt=\"Model Image\"");
WriteAttribute("src", Tuple.Create(" src=\"", 2690), Tuple.Create("\"", 2787)
#line 81 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
, Tuple.Create(Tuple.Create("", 2696), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, Model.DeviceModel.ImageHash()))
#line default
#line hidden
, 2696), false)
);
WriteLiteral(" />\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>\r\n " +
" <label");
WriteLiteral(" for=\"DeviceModel_Image\"");
WriteLiteral(">\r\n Update Image:\r\n </label>\r\n </th>" +
"\r\n <td>\r\n");
#line 91 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 60 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 91 "..\..\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" }))
{
#line 62 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.EditorFor(model => model.DeviceModel.DefaultPurchaseDate));
#line default
#line hidden
WriteLiteral(" <input");
#line 62 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line default
#line hidden
#line 63 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 63 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
else
{
#line default
#line hidden
#line 67 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(CommonHelpers.FriendlyDate(Model.DeviceModel.DefaultPurchaseDate, "Unknown"));
#line default
#line hidden
#line 67 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>Default Warranty " +
"Provider:\r\n </th>\r\n <td>");
#line 74 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 76 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DropDownListFor(model => model.DeviceModel.DefaultWarrantyProvider, Model.WarrantyProviders.ToSelectListItems(Model.DeviceModel.DefaultWarrantyProvider, true, "None")));
#line default
#line hidden
#line 76 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line default
#line hidden
#line 77 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
#line 77 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
else
{
if (Model.DeviceModel.DefaultWarrantyProvider == null)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">&lt;None Specified&gt;</span>\r\n");
#line 84 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
else
{
var provider = Model.WarrantyProviders.FirstOrDefault(wp => wp.Id == Model.DeviceModel.DefaultWarrantyProvider);
if (provider == null)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">&lt;None Specified&gt;</span>\r\n");
#line 91 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
else
{
#line default
#line hidden
#line 94 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(provider.Name);
#line default
#line hidden
#line 94 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
}
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>Type:\r\n " +
" </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 104 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.DisplayFor(model => model.DeviceModel.ModelType));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th>Image:\r\n " +
" </th>\r\n <td>\r\n <img");
WriteLiteral(" alt=\"Model Image\"");
WriteAttribute("src", Tuple.Create(" src=\"", 3910), Tuple.Create("\"", 4007)
#line 111 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
, Tuple.Create(Tuple.Create("", 3916), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, Model.DeviceModel.ImageHash()))
#line default
#line hidden
, 3916), false)
);
WriteLiteral(" />\r\n </td>\r\n </tr>\r\n");
#line 114 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line default
#line hidden
#line 114 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
if (canConfig)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <th>\r\n <label");
WriteLiteral(" for=\"DeviceModel_Image\"");
WriteLiteral(">\r\n Update Image:\r\n </label>\r\n " +
" </th>\r\n <td>\r\n");
#line 123 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line default
#line hidden
#line 123 "..\..\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" }))
{
#line default
#line hidden
WriteLiteral(" <input");
WriteLiteral(" type=\"file\"");
@@ -298,7 +463,7 @@ WriteLiteral(" style=\"width: 250px;\"");
WriteLiteral(" />\r\n");
WriteLiteral(" <input");
WriteLiteral(" <input");
WriteLiteral(" class=\"button\"");
@@ -309,164 +474,199 @@ WriteLiteral(" value=\"Update\"");
WriteLiteral(" />\r\n");
#line 95 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
#line 127 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n </table>\r\n <script");
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 130 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </table>\r\n");
#line 132 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line default
#line hidden
#line 132 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
if (canConfig)
{
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
var $Description = $('#DeviceModel_Description');
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
$Description
.watermark('Model Description')
.focus(function () { $Description.select() })
.keydown(function (e) {
$DescriptionAjaxSave.show();
if (e.which == 13) {
$(this).blur();
}
}).blur(function () {
$DescriptionAjaxSave.hide();
})
.change(function () {
$DescriptionAjaxSave.hide();
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
var data = { Description: $Description.val() };
$.ajax({
url: '");
$(function () {
var $Description = $('#DeviceModel_Description');
var $DescriptionAjaxSave = $Description.next('.ajaxSave');
$Description
.watermark('Model Description')
.focus(function () { $Description.select() })
.keydown(function (e) {
$DescriptionAjaxSave.show();
if (e.which == 13) {
$(this).blur();
}
}).blur(function () {
$DescriptionAjaxSave.hide();
})
.change(function () {
$DescriptionAjaxSave.hide();
var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
var data = { Description: $Description.val() };
$.ajax({
url: '");
#line 119 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Url.Action(MVC.API.DeviceModel.UpdateDescription(Model.DeviceModel.Id)));
#line 154 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Url.Action(MVC.API.DeviceModel.UpdateDescription(Model.DeviceModel.Id)));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to update description: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update description: ' + textStatus);
$ajaxLoading.hide();
alert('Unable to update description: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update description: ' + textStatus);
$ajaxLoading.hide();
}
});
});
});
});
</script>
<script");
});
</script>
");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
var $dataField = $('#DeviceModel_DefaultPurchaseDate');
var $ajaxLoading = $dataField.next('.ajaxLoading');
var dateFieldValue = $dataField.val();
var dateFieldChangeToken = null;
$dataField
.watermark('None')
.datepicker({
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd'
})
.change(function () {
var dateText = $dataField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function () {
$ajaxLoading.show();
var data = {};
data['DefaultPurchaseDate'] = dateFieldValue;
$.getJSON('");
$(function () {
var $dataField = $('#DeviceModel_DefaultPurchaseDate');
var $ajaxLoading = $dataField.next('.ajaxLoading');
var dateFieldValue = $dataField.val();
var dateFieldChangeToken = null;
$dataField
.watermark('None')
.datepicker({
changeYear: true,
changeMonth: true,
dateFormat: 'yy/mm/dd'
})
.change(function () {
var dateText = $dataField.val();
if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
dateFieldValue = dateText;
if (dateFieldChangeToken)
window.clearTimeout(dateFieldChangeToken);
dateFieldChangeToken = window.setTimeout(function () {
$ajaxLoading.show();
var data = {};
data['DefaultPurchaseDate'] = dateFieldValue;
$.getJSON('");
#line 161 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultPurchaseDate(Model.DeviceModel.Id)));
#line 196 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultPurchaseDate(Model.DeviceModel.Id)));
#line default
#line hidden
WriteLiteral(@"', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function () {
$(this).select();
});
});
</script>
<script");
if (result != 'success' || response != 'OK') {
alert('Unable to change Date:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
})
dateFieldChangeToken = null;
}, 500);
}
}).focus(function () {
$(this).select();
});
});
</script>
");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
var $DefaultWarrantyProvider = $('#DeviceModel_DefaultWarrantyProvider');
var $ajaxLoading = $DefaultWarrantyProvider.next('.ajaxLoading');
$DefaultWarrantyProvider
.change(function () {
$ajaxLoading.show();
var data = { DefaultWarrantyProvider: $DefaultWarrantyProvider.val() };
$.ajax({
url: '");
$(function () {
var $DefaultWarrantyProvider = $('#DeviceModel_DefaultWarrantyProvider');
var $ajaxLoading = $DefaultWarrantyProvider.next('.ajaxLoading');
$DefaultWarrantyProvider
.change(function () {
$ajaxLoading.show();
var data = { DefaultWarrantyProvider: $DefaultWarrantyProvider.val() };
$.ajax({
url: '");
#line 186 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultWarrantyProvider(Model.DeviceModel.Id)));
#line 221 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultWarrantyProvider(Model.DeviceModel.Id)));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
} else {
$ajaxLoading.hide();
alert('Unable to default warranty provider: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to default warranty provider: ' + textStatus);
$ajaxLoading.hide();
alert('Unable to default warranty provider: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to default warranty provider: ' + textStatus);
$ajaxLoading.hide();
}
});
});
});
});
</script>
</div>
<h2>
Components</h2>
});
</script>
");
#line 208 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 240 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
#line default
#line hidden
WriteLiteral("</div>\r\n<h2>Components</h2>\r\n");
#line 243 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.DeviceComponentsModel));
@@ -479,28 +679,28 @@ WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
#line 210 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 245 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line default
#line hidden
#line 210 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
if (Model.CanDelete)
#line 245 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
if (Model.CanDelete)
{
#line default
#line hidden
#line 212 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 247 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete"));
#line default
#line hidden
#line 212 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
#line 247 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
@@ -510,24 +710,49 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 214 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.ActionLinkButton("Export Devices", MVC.API.DeviceModel.ExportDevices(Model.DeviceModel.Id)));
#line 249 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
if (Model.DeviceCount > 0)
{
if (Authorization.Has(Claims.Device.Actions.Export))
{
#line default
#line hidden
#line 253 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.ActionLinkButton("Export Devices", MVC.API.DeviceModel.ExportDevices(Model.DeviceModel.Id)));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 215 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel")));
#line 253 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
if (Authorization.Has(Claims.Device.Search))
{
#line default
#line hidden
#line 257 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel")));
#line default
#line hidden
WriteLiteral("\r\n</div>\r\n");
#line 257 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
}
}
#line default
#line hidden
WriteLiteral("</div>\r\n");
}
}
@@ -1,271 +1,312 @@
@model Disco.Web.Areas.Config.Models.DeviceModel.ComponentsModel
@{
Authorization.Require(Claims.Config.DeviceModel.Show);
var canConfig = Authorization.Has(Claims.Config.DeviceModel.ConfigureComponents);
Html.BundleDeferred("~/ClientScripts/Modules/Disco-jQueryExtensions");
}
<table id="deviceComponents" data-devicemodelid="@(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty)">
<tr>
<th>
Description
</th>
<th>
Cost
</th>
<th>
Job Types
</th>
<th class="actions">
&nbsp;
</th>
</tr>
@foreach (var item in Model.DeviceComponents)
{
<tr data-devicecomponentid="@item.Id">
<td>
<input type="text" class="description" value="@item.Description" />
</td>
<td>
<input type="text" class="cost" value="@item.Cost.ToString("C")" />
</td>
<td>
<span class="edit@(item.JobSubTypes.Count > 0 ? " editAlert" : string.Empty)"></span>
</td>
<td>
<span class="remove"></span>
@if (canConfig)
{
<table id="deviceComponents" data-devicemodelid="@(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty)">
<tr>
<th>Description
</th>
<th>Cost
</th>
<th>Job Types
</th>
<th class="actions">&nbsp;
</th>
</tr>
@foreach (var item in Model.DeviceComponents)
{
<tr data-devicecomponentid="@item.Id">
<td>
<input type="text" class="description" value="@item.Description" />
</td>
<td>
<input type="text" class="cost" value="@item.Cost.ToString("C")" />
</td>
<td>
<span class="edit@(item.JobSubTypes.Count > 0 ? " editAlert" : string.Empty)"></span>
</td>
<td>
<span class="remove"></span>
</td>
</tr>
}
<tr>
<td colspan="4">
<a href="#" id="addDeviceComponent">Add Component</a>
</td>
</tr>
}
<tr>
<td colspan="4">
<a href="#" id="addDeviceComponent">Add Component</a>
</td>
</tr>
</table>
<script type="text/javascript">
$(function () {
var $deviceComponents = $('#deviceComponents');
</table>
<script type="text/javascript">
$(function () {
var $deviceComponents = $('#deviceComponents');
$('#addDeviceComponent').click(function () {
var dc = $('<tr><td><input type="text" class="description" /></td><td><input type="text" class="cost" /></td><td><span class="edit"></span></td><td><span class="remove"></span></td></tr>');
dc.find('input').focus(function () { $(this).select() })
dc.insertBefore($deviceComponents.find('tr').last());
dc.find('input.description').focus();
return false;
});
$('#addDeviceComponent').click(function () {
var dc = $('<tr><td><input type="text" class="description" /></td><td><input type="text" class="cost" /></td><td><span class="edit"></span></td><td><span class="remove"></span></td></tr>');
dc.find('input').focus(function () { $(this).select() })
dc.insertBefore($deviceComponents.find('tr').last());
dc.find('input.description').focus();
return false;
});
$deviceComponents.on('change', 'input', updateComponent);
$deviceComponents.on('focus', 'input', function () { $(this).select(); });
$deviceComponents.on('change', 'input', updateComponent);
$deviceComponents.on('focus', 'input', function () { $(this).select(); });
$deviceComponents.on('click', 'span.remove', removeComponent);
$deviceComponents.on('click', 'span.edit', editComponentJobTypes);
$deviceComponents.on('click', 'span.remove', removeComponent);
$deviceComponents.on('click', 'span.edit', editComponentJobTypes);
function removeComponentConfirmed(id, row) {
var data = { id: id };
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.ComponentRemove())',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
row.remove();
} else {
alert('Unable to remove component: ' + d);
function removeComponentConfirmed(id, row) {
var data = { id: id };
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.ComponentRemove())',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
row.remove();
} else {
alert('Unable to remove component: ' + d);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to remove component: ' + textStatus);
}
});
}
function removeComponent() {
var componentRow = $(this).closest('tr');
var id = componentRow.attr('data-devicecomponentid');
if (id) {
var dialog = $("#dialogConfirmRemove");
var buttons = dialog.dialog("option", "buttons");
buttons['Remove'] = function () { removeComponentConfirmed(id, componentRow); $(this).dialog("close"); };
var buttons = dialog.dialog("option", "buttons", buttons);
dialog.dialog('open');
} else {
// New - Remove
componentRow.remove();
}
}
function updateComponent() {
var componentRow = $(this).closest('tr');
componentRow.find('input').attr('disabled', true).addClass('updating');
var id = componentRow.attr('data-devicecomponentid');
if (id) {
// Update
var data = {
id: id,
Description: componentRow.find('input.description').val(),
Cost: componentRow.find('input.cost').val()
};
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdate())',
dataType: 'json',
type: 'POST',
data: data,
success: function (d) {
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (d.Result == 'OK') {
componentRow.find('input.description').val(d.Component.Description);
componentRow.find('input.cost').val(d.Component.Cost);
} else {
alert('Unable to update component: ' + d.Result);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update component: ' + textStatus);
}
});
} else {
// Add
id = componentRow.closest('table').attr('data-devicemodelid');
var data = {
id: id,
Description: componentRow.find('input.description').val(),
Cost: componentRow.find('input.cost').val()
};
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null))',
dataType: 'json',
type: 'POST',
data: data,
success: function (d) {
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (d.Result == 'OK') {
componentRow.attr('data-devicecomponentid', d.Component.Id);
componentRow.find('input.description').val(d.Component.Description);
componentRow.find('input.cost').val(d.Component.Cost);
} else {
alert('Unable to add component: ' + d.Result);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to add component: ' + textStatus);
}
});
}
}
function editComponentJobTypes() {
var edit$this = $(this);
var componentRow = edit$this.closest('tr');
var id = componentRow.attr('data-devicecomponentid');
if (id) {
var data = {
id: id
};
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.Component())',
dataType: 'json',
data: data,
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 = {
id: id,
JobSubTypes: selectedSJTs
};
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes())',
dataType: 'json',
type: 'POST',
traditional: true,
data: data,
success: function (d) {
if (d.Result == 'OK') {
if (d.Component.JobSubTypes.length > 0) {
edit$this.addClass('editAlert');
} else {
edit$this.removeClass('editAlert');
}
$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);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to load component: ' + textStatus);
}
});
}
}
$("#dialogConfirmRemove").dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false,
buttons: {
"Remove": function () {
$(this).dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to remove component: ' + textStatus);
}
});
}
function removeComponent() {
var componentRow = $(this).closest('tr');
var id = componentRow.attr('data-devicecomponentid');
if (id) {
var dialog = $("#dialogConfirmRemove");
var buttons = dialog.dialog("option", "buttons");
buttons['Remove'] = function () { removeComponentConfirmed(id, componentRow); $(this).dialog("close"); };
var buttons = dialog.dialog("option", "buttons", buttons);
dialog.dialog('open');
} else {
// New - Remove
componentRow.remove();
}
}
function updateComponent() {
var componentRow = $(this).closest('tr');
componentRow.find('input').attr('disabled', true).addClass('updating');
var id = componentRow.attr('data-devicecomponentid');
if (id) {
// Update
var data = {
id: id,
Description: componentRow.find('input.description').val(),
Cost: componentRow.find('input.cost').val()
};
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdate())',
dataType: 'json',
type: 'POST',
data: data,
success: function (d) {
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (d.Result == 'OK') {
componentRow.find('input.description').val(d.Component.Description);
componentRow.find('input.cost').val(d.Component.Cost);
} else {
alert('Unable to update component: ' + d.Result);
}
$('#dialogUpdateJobTypes').dialog({
resizable: false,
modal: true,
autoOpen: false,
width: 550,
buttons: {
"Save": function () {
$(this).dialog("close");
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update component: ' + textStatus);
Cancel: function () {
$(this).dialog("close");
}
});
} else {
// Add
id = componentRow.closest('table').attr('data-devicemodelid');
var data = {
id: id,
Description: componentRow.find('input.description').val(),
Cost: componentRow.find('input.cost').val()
};
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null))',
dataType: 'json',
type: 'POST',
data: data,
success: function (d) {
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (d.Result == 'OK') {
componentRow.attr('data-devicecomponentid', d.Component.Id);
componentRow.find('input.description').val(d.Component.Description);
componentRow.find('input.cost').val(d.Component.Cost);
} else {
alert('Unable to add component: ' + d.Result);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to add component: ' + textStatus);
}
});
}
}
function editComponentJobTypes() {
var edit$this = $(this);
var componentRow = edit$this.closest('tr');
var id = componentRow.attr('data-devicecomponentid');
if (id) {
var data = {
id: id
};
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.Component())',
dataType: 'json',
data: data,
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 = {
id: id,
JobSubTypes: selectedSJTs
};
$.ajax({
url: '@Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes())',
dataType: 'json',
type: 'POST',
traditional: true,
data: data,
success: function (d) {
if (d.Result == 'OK') {
if (d.Component.JobSubTypes.length > 0) {
edit$this.addClass('editAlert');
} else {
edit$this.removeClass('editAlert');
}
$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);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to load component: ' + textStatus);
}
});
}
}
$("#dialogConfirmRemove").dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false,
buttons: {
"Remove": function () {
$(this).dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});
});
$('#dialogUpdateJobTypes').dialog({
resizable: false,
modal: true,
autoOpen: false,
width: 550,
buttons: {
"Save": function () {
$(this).dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
$('#CheckboxBulkSelect_dialogUpdateJobTypes').checkboxBulkSelect({ parentSelector: 'div' });
});
$('#CheckboxBulkSelect_dialogUpdateJobTypes').checkboxBulkSelect({ parentSelector: 'div' });
});
</script>
<div id="dialogUpdateJobTypes" title="Update Job Types">
<div>
<h2>
Hardware Non-Warranty Job Types</h2>
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.ToSelectListItems(), 2)
<br />
<span id="CheckboxBulkSelect_dialogUpdateJobTypes" class="checkboxBulkSelectContainer">
</span>
</script>
<div id="dialogUpdateJobTypes" title="Update Job Types">
<div>
<h2>Hardware Non-Warranty Job Types</h2>
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.ToSelectListItems(), 2)
<br />
<span id="CheckboxBulkSelect_dialogUpdateJobTypes" class="checkboxBulkSelectContainer"></span>
</div>
</div>
</div>
<div id="dialogConfirmRemove" title="Delete this Component?">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
This item will be permanently deleted and cannot be recovered. Are you sure?</p>
</div>
<div id="dialogConfirmRemove" title="Delete this Component?">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
This item will be permanently deleted and cannot be recovered. Are you sure?
</p>
</div>
}
else
{
<table id="deviceComponents" data-devicemodelid="@(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty)">
<tr>
<th>Description
</th>
<th>Cost
</th>
<th>Job Types
</th>
</tr>
@foreach (var item in Model.DeviceComponents)
{
<tr data-devicecomponentid="@item.Id">
<td>
@item.Description
</td>
<td>
@item.Cost.ToString("C")
</td>
<td>
@if (item.JobSubTypes.Count > 0)
{
<ul>
@foreach (var jst in item.JobSubTypes)
{
<li>@jst.Description</li>
}
</ul>
}
else
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
</td>
</tr>
}
</table>
}
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceModel/_DeviceComponentsTable.cshtml")]
public partial class DeviceComponentsTable : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ComponentsModel>
public partial class DeviceComponentsTable : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ComponentsModel>
{
public DeviceComponentsTable()
{
@@ -43,370 +45,564 @@ namespace Disco.Web.Areas.Config.Views.DeviceModel
#line 2 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Authorization.Require(Claims.Config.DeviceModel.Show);
var canConfig = Authorization.Has(Claims.Config.DeviceModel.ConfigureComponents);
Html.BundleDeferred("~/ClientScripts/Modules/Disco-jQueryExtensions");
#line default
#line hidden
WriteLiteral("\r\n<table");
WriteLiteral("\r\n");
#line 9 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
if (canConfig)
{
#line default
#line hidden
WriteLiteral(" <table");
WriteLiteral(" id=\"deviceComponents\"");
WriteLiteral(" data-devicemodelid=\"");
#line 5 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty);
#line 11 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty);
#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(">\r\n <tr>\r\n <th>Description\r\n </th>\r\n <th>" +
"Cost\r\n </th>\r\n <th>Job Types\r\n </th>\r\n " +
" <th");
WriteLiteral(" class=\"actions\"");
WriteLiteral(">\r\n &nbsp;\r\n </th>\r\n </tr>\r\n");
WriteLiteral(">&nbsp;\r\n </th>\r\n </tr>\r\n");
#line 20 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
#line 22 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
#line default
#line hidden
#line 20 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
foreach (var item in Model.DeviceComponents)
{
#line 22 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
foreach (var item in Model.DeviceComponents)
{
#line default
#line hidden
WriteLiteral(" <tr");
WriteLiteral(" <tr");
WriteLiteral(" data-devicecomponentid=\"");
#line 22 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(item.Id);
#line 24 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(item.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <td>\r\n <input");
WriteLiteral(">\r\n <td>\r\n <input");
WriteLiteral(" type=\"text\"");
WriteLiteral(" class=\"description\"");
WriteAttribute("value", Tuple.Create(" value=\"", 704), Tuple.Create("\"", 729)
WriteAttribute("value", Tuple.Create(" value=\"", 883), Tuple.Create("\"", 908)
#line 24 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
, Tuple.Create(Tuple.Create("", 712), Tuple.Create<System.Object, System.Int32>(item.Description
#line 26 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
, Tuple.Create(Tuple.Create("", 891), Tuple.Create<System.Object, System.Int32>(item.Description
#line default
#line hidden
, 712), false)
, 891), false)
);
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <input");
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <input");
WriteLiteral(" type=\"text\"");
WriteLiteral(" class=\"cost\"");
WriteAttribute("value", Tuple.Create(" value=\"", 819), Tuple.Create("\"", 851)
WriteAttribute("value", Tuple.Create(" value=\"", 1010), Tuple.Create("\"", 1042)
#line 27 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
, Tuple.Create(Tuple.Create("", 827), Tuple.Create<System.Object, System.Int32>(item.Cost.ToString("C")
#line 29 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
, Tuple.Create(Tuple.Create("", 1018), Tuple.Create<System.Object, System.Int32>(item.Cost.ToString("C")
#line default
#line hidden
, 827), false)
, 1018), false)
);
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <span");
WriteLiteral(" />\r\n </td>\r\n <td>\r\n <span");
WriteAttribute("class", Tuple.Create(" class=\"", 915), Tuple.Create("\"", 986)
, Tuple.Create(Tuple.Create("", 923), Tuple.Create("edit", 923), true)
WriteAttribute("class", Tuple.Create(" class=\"", 1118), Tuple.Create("\"", 1189)
, Tuple.Create(Tuple.Create("", 1126), Tuple.Create("edit", 1126), true)
#line 30 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
, Tuple.Create(Tuple.Create("", 927), Tuple.Create<System.Object, System.Int32>(item.JobSubTypes.Count > 0 ? " editAlert" : string.Empty
#line 32 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
, Tuple.Create(Tuple.Create("", 1130), Tuple.Create<System.Object, System.Int32>(item.JobSubTypes.Count > 0 ? " editAlert" : string.Empty
#line default
#line hidden
, 927), false)
, 1130), false)
);
WriteLiteral("></span>\r\n </td>\r\n <td>\r\n <span");
WriteLiteral("></span>\r\n </td>\r\n <td>\r\n <span");
WriteLiteral(" class=\"remove\"");
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n");
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n");
#line 36 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
}
#line 38 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
}
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td");
WriteLiteral(" <tr>\r\n <td");
WriteLiteral(" colspan=\"4\"");
WriteLiteral(">\r\n <a");
WriteLiteral(">\r\n <a");
WriteLiteral(" href=\"#\"");
WriteLiteral(" id=\"addDeviceComponent\"");
WriteLiteral(">Add Component</a>\r\n </td>\r\n </tr>\r\n</table>\r\n<script");
WriteLiteral(">Add Component</a>\r\n </td>\r\n </tr>\r\n </table>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
var $deviceComponents = $('#deviceComponents');
$(function () {
var $deviceComponents = $('#deviceComponents');
$('#addDeviceComponent').click(function () {
var dc = $('<tr><td><input type=""text"" class=""description"" /></td><td><input type=""text"" class=""cost"" /></td><td><span class=""edit""></span></td><td><span class=""remove""></span></td></tr>');
dc.find('input').focus(function () { $(this).select() })
dc.insertBefore($deviceComponents.find('tr').last());
dc.find('input.description').focus();
return false;
});
$('#addDeviceComponent').click(function () {
var dc = $('<tr><td><input type=""text"" class=""description"" /></td><td><input type=""text"" class=""cost"" /></td><td><span class=""edit""></span></td><td><span class=""remove""></span></td></tr>');
dc.find('input').focus(function () { $(this).select() })
dc.insertBefore($deviceComponents.find('tr').last());
dc.find('input.description').focus();
return false;
});
$deviceComponents.on('change', 'input', updateComponent);
$deviceComponents.on('focus', 'input', function () { $(this).select(); });
$deviceComponents.on('change', 'input', updateComponent);
$deviceComponents.on('focus', 'input', function () { $(this).select(); });
$deviceComponents.on('click', 'span.remove', removeComponent);
$deviceComponents.on('click', 'span.edit', editComponentJobTypes);
$deviceComponents.on('click', 'span.remove', removeComponent);
$deviceComponents.on('click', 'span.edit', editComponentJobTypes);
function removeComponentConfirmed(id, row) {
var data = { id: id };
$.ajax({
url: '");
#line 64 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.ComponentRemove()));
#line default
#line hidden
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: data,\r\n " +
" success: function (d) {\r\n if (d == \'OK\') {\r\n " +
" row.remove();\r\n } else {\r\n a" +
"lert(\'Unable to remove component: \' + d);\r\n }\r\n " +
" },\r\n error: function (jqXHR, textStatus, errorThrown) {\r\n " +
" alert(\'Unable to remove component: \' + textStatus);\r\n " +
" }\r\n });\r\n }\r\n function removeComponent() {\r\n " +
" var componentRow = $(this).closest(\'tr\');\r\n var id = componentRow" +
".attr(\'data-devicecomponentid\');\r\n if (id) {\r\n var dia" +
"log = $(\"#dialogConfirmRemove\");\r\n var buttons = dialog.dialog(\"o" +
"ption\", \"buttons\");\r\n buttons[\'Remove\'] = function () { removeCom" +
"ponentConfirmed(id, componentRow); $(this).dialog(\"close\"); };\r\n " +
"var buttons = dialog.dialog(\"option\", \"buttons\", buttons);\r\n dial" +
"og.dialog(\'open\');\r\n } else {\r\n // New - Remove\r\n " +
" componentRow.remove();\r\n }\r\n }\r\n function up" +
"dateComponent() {\r\n var componentRow = $(this).closest(\'tr\');\r\n " +
" componentRow.find(\'input\').attr(\'disabled\', true).addClass(\'updating\');\r\n\r" +
"\n var id = componentRow.attr(\'data-devicecomponentid\');\r\n " +
"if (id) {\r\n // Update\r\n var data = {\r\n " +
" id: id,\r\n Description: componentRow.find(\'input.descr" +
"iption\').val(),\r\n Cost: componentRow.find(\'input.cost\').val()" +
"\r\n };\r\n $.ajax({\r\n url: \'");
#line 106 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdate()));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
type: 'POST',
data: data,
success: function (d) {
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (d.Result == 'OK') {
componentRow.find('input.description').val(d.Component.Description);
componentRow.find('input.cost').val(d.Component.Cost);
} else {
alert('Unable to update component: ' + d.Result);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update component: ' + textStatus);
}
});
} else {
// Add
id = componentRow.closest('table').attr('data-devicemodelid');
var data = {
id: id,
Description: componentRow.find('input.description').val(),
Cost: componentRow.find('input.cost').val()
};
function removeComponentConfirmed(id, row) {
var data = { id: id };
$.ajax({
url: '");
#line 132 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null)));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
type: 'POST',
data: data,
success: function (d) {
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (d.Result == 'OK') {
componentRow.attr('data-devicecomponentid', d.Component.Id);
componentRow.find('input.description').val(d.Component.Description);
componentRow.find('input.cost').val(d.Component.Cost);
} else {
alert('Unable to add component: ' + d.Result);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to add component: ' + textStatus);
}
});
}
}
function editComponentJobTypes() {
var edit$this = $(this);
var componentRow = edit$this.closest('tr');
var id = componentRow.attr('data-devicecomponentid');
if (id) {
var data = {
id: id
};
$.ajax({
url: '");
#line 163 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.Component()));
#line 66 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.ComponentRemove()));
#line default
#line hidden
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: data,\r\n " +
" success: function (d) {\r\n componentRow.fin" +
"d(\'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).prop(\'checked\', false) });\r\n " +
" for (var i = 0; i < d.Component.JobSubTypes.length; i+" +
"+) {\r\n var sjt = d.Component.JobSubTypes[i];\r\n " +
" $dialogUpdateJobTypes.find(\'#SubTypes_\' + sjt).prop" +
"(\'checked\', true);\r\n }\r\n $" +
"(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').checkboxBulkSelect(\'update\');\r\n " +
" var buttons = $dialogUpdateJobTypes.dialog(\"option\", \"bu" +
"ttons\");\r\n buttons[\'Save\'] = function () {\r\n " +
" $dialogUpdateJobTypes.dialog(\"disable\");\r\n " +
" var selectedSJTs = [];\r\n $dialog" +
"UpdateJobTypes.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: \'");
" success: function (d) {\r\n if (d == \'OK\') {" +
"\r\n row.remove();\r\n } else {\r\n " +
" alert(\'Unable to remove component: \' + d);\r\n " +
" }\r\n },\r\n error: function (j" +
"qXHR, textStatus, errorThrown) {\r\n alert(\'Unable to remov" +
"e component: \' + textStatus);\r\n }\r\n });\r\n " +
" }\r\n function removeComponent() {\r\n var componentRow" +
" = $(this).closest(\'tr\');\r\n var id = componentRow.attr(\'data-devi" +
"cecomponentid\');\r\n if (id) {\r\n var dialog = $(" +
"\"#dialogConfirmRemove\");\r\n var buttons = dialog.dialog(\"optio" +
"n\", \"buttons\");\r\n buttons[\'Remove\'] = function () { removeCom" +
"ponentConfirmed(id, componentRow); $(this).dialog(\"close\"); };\r\n " +
" var buttons = dialog.dialog(\"option\", \"buttons\", buttons);\r\n " +
" dialog.dialog(\'open\');\r\n } else {\r\n // New" +
" - Remove\r\n componentRow.remove();\r\n }\r\n " +
" }\r\n function updateComponent() {\r\n var component" +
"Row = $(this).closest(\'tr\');\r\n componentRow.find(\'input\').attr(\'d" +
"isabled\', true).addClass(\'updating\');\r\n\r\n var id = componentRow.a" +
"ttr(\'data-devicecomponentid\');\r\n if (id) {\r\n /" +
"/ Update\r\n var data = {\r\n id: id,\r\n " +
" Description: componentRow.find(\'input.description\').val(),\r" +
"\n Cost: componentRow.find(\'input.cost\').val()\r\n " +
" };\r\n $.ajax({\r\n url: \'");
#line 187 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdateJobSubTypes()));
#line 108 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.ComponentUpdate()));
#line default
#line hidden
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
" type: \'POST\',\r\n traditional: tr" +
"ue,\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.addClass(\'editAlert\');\r\n } else " +
"{\r\n edit$this.removeClass(\'editAl" +
"ert\');\r\n }\r\n " +
" $dialogUpdateJobTypes.dialog(\"enable\");\r\n " +
" $dialogUpdateJobTypes.dialog(\"close\");\r\n " +
" } else {\r\n al" +
"ert(\'Unable to update component sub types: \' + d.Result);\r\n " +
" }\r\n },\r\n " +
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
" alert(\'Unable to update component sub types: \' + t" +
"extStatus);\r\n }\r\n " +
" });\r\n };\r\n var buttons" +
" = $dialogUpdateJobTypes.dialog(\"option\", \"buttons\", buttons);\r\n " +
" $dialogUpdateJobTypes.dialog(\'open\');\r\n } els" +
"e {\r\n alert(\'Unable to load component: \' + d.Result);" +
"\r\n }\r\n },\r\n error: " +
"function (jqXHR, textStatus, errorThrown) {\r\n alert(\'Unab" +
"le to load component: \' + textStatus);\r\n }\r\n }" +
");\r\n }\r\n\r\n }\r\n\r\n $(\"#dialogConfirmRemove\").dialog({\r\n " +
" resizable: false,\r\n height: 140,\r\n modal: true,\r" +
"\n autoOpen: false,\r\n buttons: {\r\n \"Remove\":" +
" function () {\r\n $(this).dialog(\"close\");\r\n }," +
"\r\n Cancel: function () {\r\n $(this).dialog(\"clo" +
"se\");\r\n }\r\n }\r\n });\r\n\r\n $(\'#dialogUpdate" +
"JobTypes\').dialog({\r\n resizable: false,\r\n modal: true,\r\n " +
" autoOpen: false,\r\n width: 550,\r\n buttons: {\r\n " +
" \"Save\": function () {\r\n $(this).dialog(\"close\");" +
"\r\n },\r\n Cancel: function () {\r\n " +
" $(this).dialog(\"close\");\r\n }\r\n }\r\n });\r\n\r\n " +
" $(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').checkboxBulkSelect({ parentSel" +
"ector: \'div\' });\r\n });\r\n</script>\r\n<div");
WriteLiteral(@"',
dataType: 'json',
type: 'POST',
data: data,
success: function (d) {
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (d.Result == 'OK') {
componentRow.find('input.description').val(d.Component.Description);
componentRow.find('input.cost').val(d.Component.Cost);
} else {
alert('Unable to update component: ' + d.Result);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to update component: ' + textStatus);
}
});
} else {
// Add
id = componentRow.closest('table').attr('data-devicemodelid');
var data = {
id: id,
Description: componentRow.find('input.description').val(),
Cost: componentRow.find('input.cost').val()
};
$.ajax({
url: '");
#line 134 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.ComponentAdd(null, null, null)));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
type: 'POST',
data: data,
success: function (d) {
componentRow.find('input').attr('disabled', false).removeClass('updating');
if (d.Result == 'OK') {
componentRow.attr('data-devicecomponentid', d.Component.Id);
componentRow.find('input.description').val(d.Component.Description);
componentRow.find('input.cost').val(d.Component.Cost);
} else {
alert('Unable to add component: ' + d.Result);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to add component: ' + textStatus);
}
});
}
}
function editComponentJobTypes() {
var edit$this = $(this);
var componentRow = edit$this.closest('tr');
var id = componentRow.attr('data-devicecomponentid');
if (id) {
var data = {
id: id
};
$.ajax({
url: '");
#line 165 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Url.Action(MVC.API.DeviceModel.Component()));
#line default
#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 189 "..\..\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.addClass(\'editAlert\');\r\n " +
" } else {\r\n " +
" edit$this.removeClass(\'editAlert\');\r\n " +
" }\r\n $dialogUpdate" +
"JobTypes.dialog(\"enable\");\r\n $dia" +
"logUpdateJobTypes.dialog(\"close\");\r\n " +
"} else {\r\n alert(\'Unable to updat" +
"e component sub types: \' + d.Result);\r\n " +
" }\r\n },\r\n " +
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
" alert(\'Unable to update component sub types: \' + textS" +
"tatus);\r\n }\r\n " +
" });\r\n };\r\n " +
" var buttons = $dialogUpdateJobTypes.dialog(\"option\", \"buttons\", buttons);\r\n " +
" $dialogUpdateJobTypes.dialog(\'open\');\r\n " +
" } else {\r\n alert(\'Unable to load c" +
"omponent: \' + d.Result);\r\n }\r\n " +
" },\r\n error: function (jqXHR, textStatus, errorThrown) {\r" +
"\n alert(\'Unable to load component: \' + textStatus);\r\n" +
" }\r\n });\r\n }\r\n\r\n " +
" }\r\n\r\n $(\"#dialogConfirmRemove\").dialog({\r\n resiza" +
"ble: false,\r\n height: 140,\r\n modal: true,\r\n " +
" autoOpen: false,\r\n buttons: {\r\n \"Remo" +
"ve\": function () {\r\n $(this).dialog(\"close\");\r\n " +
" },\r\n Cancel: function () {\r\n " +
" $(this).dialog(\"close\");\r\n }\r\n }\r\n " +
" });\r\n\r\n $(\'#dialogUpdateJobTypes\').dialog({\r\n resizab" +
"le: false,\r\n modal: true,\r\n autoOpen: false,\r\n " +
" width: 550,\r\n buttons: {\r\n \"Save\":" +
" function () {\r\n $(this).dialog(\"close\");\r\n " +
" },\r\n Cancel: function () {\r\n $(t" +
"his).dialog(\"close\");\r\n }\r\n }\r\n });" +
"\r\n\r\n $(\'#CheckboxBulkSelect_dialogUpdateJobTypes\').checkboxBulkSelect" +
"({ parentSelector: \'div\' });\r\n });\r\n </script>\r\n");
WriteLiteral(" <div");
WriteLiteral(" id=\"dialogUpdateJobTypes\"");
WriteLiteral(" title=\"Update Job Types\"");
WriteLiteral(">\r\n <div>\r\n <h2>\r\n Hardware Non-Warranty Job Types</h2>\r\n");
WriteLiteral(">\r\n <div>\r\n <h2>Hardware Non-Warranty Job Types</h2>\r\n");
WriteLiteral(" ");
WriteLiteral(" ");
#line 261 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.ToSelectListItems(), 2));
#line 262 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.ToSelectListItems(), 2));
#line default
#line hidden
WriteLiteral("\r\n <br />\r\n <span");
WriteLiteral("\r\n <br />\r\n <span");
WriteLiteral(" id=\"CheckboxBulkSelect_dialogUpdateJobTypes\"");
WriteLiteral(" class=\"checkboxBulkSelectContainer\"");
WriteLiteral(">\r\n </span>\r\n </div>\r\n</div>\r\n<div");
WriteLiteral("></span>\r\n </div>\r\n </div>\r\n");
WriteLiteral(" <div");
WriteLiteral(" id=\"dialogConfirmRemove\"");
WriteLiteral(" title=\"Delete this Component?\"");
WriteLiteral(">\r\n <p>\r\n <span");
WriteLiteral(">\r\n <p>\r\n <span");
WriteLiteral(" class=\"ui-icon ui-icon-alert\"");
WriteLiteral(" style=\"float: left; margin: 0 7px 20px 0;\"");
WriteLiteral("></span>\r\n This item will be permanently deleted and cannot be recovered. " +
"Are you sure?</p>\r\n</div>\r\n");
WriteLiteral("></span>\r\n This item will be permanently deleted and cannot be recover" +
"ed. Are you sure?\r\n </p>\r\n </div>\r\n");
#line 273 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <table");
WriteLiteral(" id=\"deviceComponents\"");
WriteLiteral(" data-devicemodelid=\"");
#line 276 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(Model.DeviceModelId.HasValue ? Model.DeviceModelId.Value.ToString() : string.Empty);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <tr>\r\n <th>Description\r\n </th>\r\n <th>" +
"Cost\r\n </th>\r\n <th>Job Types\r\n </th>\r\n <" +
"/tr>\r\n");
#line 285 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
#line default
#line hidden
#line 285 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
foreach (var item in Model.DeviceComponents)
{
#line default
#line hidden
WriteLiteral(" <tr");
WriteLiteral(" data-devicecomponentid=\"");
#line 287 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(item.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <td>\r\n");
WriteLiteral(" ");
#line 289 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(item.Description);
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 292 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(item.Cost.ToString("C"));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
#line 295 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
#line default
#line hidden
#line 295 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
if (item.JobSubTypes.Count > 0)
{
#line default
#line hidden
WriteLiteral(" <ul>\r\n");
#line 298 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
#line default
#line hidden
#line 298 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
foreach (var jst in item.JobSubTypes)
{
#line default
#line hidden
WriteLiteral(" <li>");
#line 300 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
Write(jst.Description);
#line default
#line hidden
WriteLiteral("</li>\r\n");
#line 301 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
}
#line default
#line hidden
WriteLiteral(" </ul>\r\n");
#line 303 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">&lt;None Specified&gt;</span>\r\n");
#line 307 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 310 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
}
#line default
#line hidden
WriteLiteral(" </table>\r\n");
#line 312 "..\..\Areas\Config\Views\DeviceModel\_DeviceComponentsTable.cshtml"
}
#line default
#line hidden
}
}
}
@@ -1,5 +1,7 @@
@model Disco.Web.Areas.Config.Models.DeviceProfile.CreateModel
@{
Authorization.RequireAll(Claims.Config.DeviceProfile.Create, Claims.Config.DeviceProfile.Configure);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Create");
}
@using (Html.BeginForm())
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceProfile/Create.cshtml")]
public partial class Create : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.CreateModel>
public partial class Create : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.CreateModel>
{
public Create()
{
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
#line 2 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Authorization.RequireAll(Claims.Config.DeviceProfile.Create, Claims.Config.DeviceProfile.Configure);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Create");
@@ -51,7 +55,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
WriteLiteral("\r\n");
#line 5 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 7 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
using (Html.BeginForm())
{
@@ -59,14 +63,14 @@ WriteLiteral("\r\n");
#line default
#line hidden
#line 7 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 9 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.ValidationSummary(false));
#line default
#line hidden
#line 7 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 9 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
@@ -84,7 +88,7 @@ WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r
WriteLiteral(" ");
#line 15 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 17 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.TextBoxFor(model => model.DeviceProfile.Name));
@@ -93,7 +97,7 @@ WriteLiteral(" ");
WriteLiteral("<br />");
#line 15 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 17 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.DeviceProfile.Name));
@@ -103,7 +107,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
">\r\n Short Name:\r\n </th>\r\n <td>");
#line 22 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 24 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.TextBoxFor(model => model.DeviceProfile.ShortName));
@@ -112,7 +116,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
WriteLiteral("<br />");
#line 22 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 24 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.DeviceProfile.ShortName));
@@ -123,7 +127,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
"");
#line 29 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 31 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.TextBoxFor(model => model.DeviceProfile.Description));
@@ -132,7 +136,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
WriteLiteral("<br />");
#line 29 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 31 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.DeviceProfile.Description));
@@ -143,7 +147,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>
WriteLiteral(" ");
#line 33 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 35 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.HiddenFor(model => model.DeviceProfile.ComputerNameTemplate));
@@ -154,7 +158,7 @@ WriteLiteral("\r\n");
WriteLiteral(" ");
#line 34 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 36 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.HiddenFor(model => model.DeviceProfile.ProvisionADAccount));
@@ -165,7 +169,7 @@ WriteLiteral("\r\n");
WriteLiteral(" ");
#line 35 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 37 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
Write(Html.HiddenFor(model => model.DeviceProfile.DistributionType));
@@ -193,7 +197,7 @@ WriteLiteral(">\r\n $(function () {\r\n $(\'#Name\').focus().s
"\r\n </script>\r\n");
#line 45 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
#line 47 "..\..\Areas\Config\Views\DeviceProfile\Create.cshtml"
}
@@ -1,5 +1,7 @@
@model Disco.Web.Areas.Config.Models.DeviceProfile.DefaultsModel
@{
Authorization.Require(Claims.Config.DeviceProfile.ConfigureDefaults);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Defaults");
}
<div class="form" style="width: 600px">
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceProfile/Defaults.cshtml")]
public partial class Defaults : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.DefaultsModel>
public partial class Defaults : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.DefaultsModel>
{
public Defaults()
{
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
#line 2 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Authorization.Require(Claims.Config.DeviceProfile.ConfigureDefaults);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), "Defaults");
@@ -69,7 +73,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 12 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
#line 14 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(Html.DropDownListFor(m => m.Default, Model.DeviceProfiles.ToSelectListItems(Model.Default)));
@@ -80,7 +84,7 @@ WriteLiteral("\r\n");
WriteLiteral(" ");
#line 13 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
#line 15 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(AjaxHelpers.AjaxLoader());
@@ -99,7 +103,7 @@ WriteLiteral(@">
$.getJSON('");
#line 20 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
#line 22 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.Default()));
@@ -133,7 +137,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 38 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
#line 40 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(Html.DropDownListFor(m => m.DefaultAddDeviceOffline, Model.DeviceProfilesAndNone.ToSelectListItems(Model.DefaultAddDeviceOffline)));
@@ -144,7 +148,7 @@ WriteLiteral("\r\n");
WriteLiteral(" ");
#line 39 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
#line 41 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(AjaxHelpers.AjaxLoader());
@@ -163,7 +167,7 @@ WriteLiteral(@">
$.getJSON('");
#line 46 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
#line 48 "..\..\Areas\Config\Views\DeviceProfile\Defaults.cshtml"
Write(Url.Action(MVC.API.DeviceProfile.DefaultAddDeviceOffline()));
@@ -1,9 +1,17 @@
@model Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel
@{
Authorization.Require(Claims.Config.DeviceProfile.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles");
}
@Html.Partial(MVC.Config.DeviceProfile.Views._Table, Model, new ViewDataDictionary())
<div class="actionBar">
@Html.ActionLinkButton("Modify Default Profiles", MVC.Config.DeviceProfile.Defaults())
@Html.ActionLinkButton("Create Device Profile", MVC.Config.DeviceProfile.Create())
@if (Authorization.Has(Claims.Config.DeviceProfile.ConfigureDefaults))
{
@Html.ActionLinkButton("Modify Default Profiles", MVC.Config.DeviceProfile.Defaults())
}
@if (Authorization.HasAll(Claims.Config.DeviceProfile.Configure, Claims.Config.DeviceProfile.Create))
{
@Html.ActionLinkButton("Create Device Profile", MVC.Config.DeviceProfile.Create())
}
</div>
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceProfile/Index.cshtml")]
public partial class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel>
public partial class Index : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel>
{
public Index()
{
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
#line 2 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
Authorization.Require(Claims.Config.DeviceProfile.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles");
@@ -51,7 +55,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
WriteLiteral("\r\n");
#line 5 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
#line 7 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
Write(Html.Partial(MVC.Config.DeviceProfile.Views._Table, Model, new ViewDataDictionary()));
@@ -63,27 +67,61 @@ WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 7 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
Write(Html.ActionLinkButton("Modify Default Profiles", MVC.Config.DeviceProfile.Defaults()));
#line 9 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
#line default
#line hidden
#line 9 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
if (Authorization.Has(Claims.Config.DeviceProfile.ConfigureDefaults))
{
#line default
#line hidden
#line 11 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
Write(Html.ActionLinkButton("Modify Default Profiles", MVC.Config.DeviceProfile.Defaults()));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 8 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
Write(Html.ActionLinkButton("Create Device Profile", MVC.Config.DeviceProfile.Create()));
#line 11 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n</div>\r\n");
WriteLiteral(" ");
#line 13 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
if (Authorization.HasAll(Claims.Config.DeviceProfile.Configure, Claims.Config.DeviceProfile.Create))
{
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
Write(Html.ActionLinkButton("Create Device Profile", MVC.Config.DeviceProfile.Create()));
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\DeviceProfile\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("</div>\r\n");
}
}
@@ -1,8 +1,18 @@
@model Disco.Web.Areas.Config.Models.DeviceProfile.ShowModel
@{
Authorization.Require(Claims.Config.DeviceProfile.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), Model.DeviceProfile.ToString());
Html.BundleDeferred("~/Style/jQueryUI/dynatree");
Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-DynaTree");
var canConfig = Authorization.Has(Claims.Config.DeviceProfile.Configure);
var canConfigExpression = Authorization.Has(Claims.Config.DeviceProfile.ConfigureComputerNameTemplate);
var canDelete = (Authorization.Has(Claims.Config.DeviceProfile.Delete) && Model.CanDelete);
if (canConfig)
{
Html.BundleDeferred("~/Style/jQueryUI/dynatree");
Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-DynaTree");
}
}
<div id="configurationDeviceProfileShow" class="form" style="width: 600px">
<table>
@@ -16,7 +26,9 @@
<tr>
<th>Name:
</th>
<td>@Html.TextBoxFor(model => model.DeviceProfile.Name)
<td>@if (canConfig)
{
@Html.TextBoxFor(model => model.DeviceProfile.Name)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
@@ -58,12 +70,19 @@
});
});
</script>
}
else
{
@Model.DeviceProfile.Name
}
</td>
</tr>
<tr>
<th>Short Name:
</th>
<td>@Html.TextBoxFor(model => model.DeviceProfile.ShortName)
<td>@if (canConfig)
{
@Html.TextBoxFor(model => model.DeviceProfile.ShortName)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
@@ -105,12 +124,19 @@
});
});
</script>
}
else
{
@Model.DeviceProfile.ShortName
}
</td>
</tr>
<tr>
<th>Description:
</th>
<td>@Html.TextBoxFor(model => model.DeviceProfile.Description)
<td>@if (canConfig)
{
@Html.TextBoxFor(model => model.DeviceProfile.Description)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
@@ -152,6 +178,11 @@
});
});
</script>
}
else
{
@Model.DeviceProfile.Description
}
</td>
</tr>
<tr>
@@ -167,7 +198,8 @@
<tr>
<th>Distribution Type:
</th>
<td>
<td>@if (canConfig)
{
@Html.DropDownList("DeviceProfile_DistributionType", Model.DeviceProfileDistributionTypes)
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
@@ -187,12 +219,18 @@
});
});
</script>
}
else
{
@Model.DeviceProfile.DistributionType.ToString()
}
</td>
</tr>
<tr>
<th>Address:
</th>
<td>
<td>@if (canConfig)
{
@Html.DropDownListFor(m => m.DeviceProfile.DefaultOrganisationAddress, Model.OrganisationAddresses.ToSelectListItems(Model.DeviceProfile.DefaultOrganisationAddress, true, "None"))
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
@@ -212,12 +250,25 @@
});
});
</script>
}
else
{
if (Model.DefaultOrganisationAddress == null)
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
@Model.DefaultOrganisationAddress.ToString()
}
}
</td>
</tr>
<tr>
<th>Allocate Certificates:
</th>
<td>
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.DeviceProfile.CertificateProviderId, Model.CertificateProviders.ToSelectListItems(null, true, "Not Allocated"))
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
@@ -248,12 +299,34 @@
});
});
</script>
}
else
{
if (string.IsNullOrEmpty(Model.DeviceProfile.CertificateProviderId))
{
<span class="smallMessage">&lt;None Allocated&gt;</span>
}
else
{
var cp = Model.CertificateProviders.FirstOrDefault(p => p.Id == Model.DeviceProfile.CertificateProviderId);
if (cp == null)
{
<span class="smallMessage">&lt;None Allocated&gt;</span>
}
else
{
@cp.Name
}
}
}
</td>
</tr>
<tr>
<th>Computer Name Template Expression:
</th>
<td>@Html.TextBoxFor(model => model.DeviceProfile.ComputerNameTemplate)
<td>@if (canConfig && canConfigExpression)
{
@Html.TextBoxFor(model => model.DeviceProfile.ComputerNameTemplate)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<a id="expressionBrowserAnchor" href="@(Url.Action(MVC.Config.DocumentTemplate.ExpressionBrowser()))">&nbsp;</a>
@@ -295,60 +368,89 @@
});
});
</script>
}
else
{
if (string.IsNullOrWhiteSpace(Model.DeviceProfile.ComputerNameTemplate))
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
<div class="code">
@Model.DeviceProfile.ComputerNameTemplate
</div>
}
}
<div style="margin-top: 8px;">
<label for="DeviceProfile_ProvisionADAccount">
Provision Active Directory Account:
</label>
<input id="DeviceProfile_ProvisionADAccount" type="checkbox" @(Model.DeviceProfile.ProvisionADAccount ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty))/>
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
$('#DeviceProfile_ProvisionADAccount').click(function () {
var $this = $(this);
var $ajaxLoading = $this.next('.ajaxLoading').show();
var data = { ProvisionADAccount: $this.is(':checked') };
$.getJSON('@Url.Action(MVC.API.DeviceProfile.UpdateProvisionADAccount(Model.DeviceProfile.Id))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Provision AD Account:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
@if (canConfig)
{
<input id="DeviceProfile_ProvisionADAccount" type="checkbox" @(Model.DeviceProfile.ProvisionADAccount ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty))/>
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
$('#DeviceProfile_ProvisionADAccount').click(function () {
var $this = $(this);
var $ajaxLoading = $this.next('.ajaxLoading').show();
var data = { ProvisionADAccount: $this.is(':checked') };
$.getJSON('@Url.Action(MVC.API.DeviceProfile.UpdateProvisionADAccount(Model.DeviceProfile.Id))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Provision AD Account:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
});
});
});
</script>
</script>
}
else
{
<input id="DeviceProfile_ProvisionADAccount" type="checkbox" @(Model.DeviceProfile.ProvisionADAccount ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty)) disabled="disabled" />
}
</div>
<div style="margin-top: 8px;">
<label for="DeviceProfile_EnforceComputerNameConvention">
Enforce Naming Convention:
</label>
<input id="DeviceProfile_EnforceComputerNameConvention" type="checkbox" @(Model.DeviceProfile.EnforceComputerNameConvention ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty))/>
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
$('#DeviceProfile_EnforceComputerNameConvention').click(function () {
var $this = $(this);
var $ajaxLoading = $this.next('.ajaxLoading').show();
var data = { EnforceComputerNameConvention: $this.is(':checked') };
$.getJSON('@Url.Action(MVC.API.DeviceProfile.UpdateEnforceComputerNameConvention(Model.DeviceProfile.Id))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Enforce Computer Name Convention:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
@if (canConfig)
{
<input id="DeviceProfile_EnforceComputerNameConvention" type="checkbox" @(Model.DeviceProfile.EnforceComputerNameConvention ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty))/>
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
$('#DeviceProfile_EnforceComputerNameConvention').click(function () {
var $this = $(this);
var $ajaxLoading = $this.next('.ajaxLoading').show();
var data = { EnforceComputerNameConvention: $this.is(':checked') };
$.getJSON('@Url.Action(MVC.API.DeviceProfile.UpdateEnforceComputerNameConvention(Model.DeviceProfile.Id))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Enforce Computer Name Convention:\n' + response);
$ajaxLoading.hide();
} else {
$ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
}
});
});
});
});
</script>
</script>
}
else
{
<input id="DeviceProfile_EnforceComputerNameConvention" type="checkbox" @(Model.DeviceProfile.EnforceComputerNameConvention ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty)) disabled="disabled" />
}
</div>
</td>
</tr>
<tr>
<th>Default Organisational Unit:
</th>
<td>
<td>@if (canConfig)
{
@Html.HiddenFor(model => model.DeviceProfile.OrganisationalUnit)
<div id="displayOrganisationalUnit">
</div>
@@ -466,19 +568,35 @@
updateDisplayOrganisationalUnit();
});
</script>
}
else
{
if (string.IsNullOrEmpty(Model.DeviceProfile.OrganisationalUnit))
{
<span>{Default Computers Container}</span>
}
else
{
<span>
@string.Join(" > ", Model.DeviceProfile.OrganisationalUnit.Split(',').Select(s => s.Substring(3)).Reverse())
</span>
}
}
<div style="margin-top: 8px;">
<label for="DeviceProfile_EnforceOrganisationalUnit">
Enforce:
</label>
<input id="DeviceProfile_EnforceOrganisationalUnit" type="checkbox" @(Model.DeviceProfile.EnforceOrganisationalUnit ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty))/>
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
$('#DeviceProfile_EnforceOrganisationalUnit').click(function () {
var $this = $(this);
var $ajaxLoading = $this.next('.ajaxLoading').show();
var data = { EnforceOrganisationalUnit: $this.is(':checked') };
$.getJSON('@Url.Action(MVC.API.DeviceProfile.UpdateEnforceOrganisationalUnit(Model.DeviceProfile.Id))', data, function (response, result) {
@if (canConfig)
{
<input id="DeviceProfile_EnforceOrganisationalUnit" type="checkbox" @(Model.DeviceProfile.EnforceOrganisationalUnit ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty))/>
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
$('#DeviceProfile_EnforceOrganisationalUnit').click(function () {
var $this = $(this);
var $ajaxLoading = $this.next('.ajaxLoading').show();
var data = { EnforceOrganisationalUnit: $this.is(':checked') };
$.getJSON('@Url.Action(MVC.API.DeviceProfile.UpdateEnforceOrganisationalUnit(Model.DeviceProfile.Id))', data, function (response, result) {
if (result != 'success' || response != 'OK') {
alert('Unable to change Enforce Organisation Unit:\n' + response);
$ajaxLoading.hide();
@@ -488,51 +606,65 @@
});
});
});
</script>
</script>
}
else
{
<input id="DeviceProfile_EnforceOrganisationalUnit" type="checkbox" @(Model.DeviceProfile.EnforceOrganisationalUnit ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty)) disabled="disabled" />
}
</div>
</td>
</tr>
</table>
</div>
<div id="dialogConfirmDelete" title="Delete this Device Profile?">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
This item will be permanently deleted and cannot be recovered. Are you sure?
</p>
</div>
<script type="text/javascript">
$(function () {
@if (canDelete)
{
<div id="dialogConfirmDelete" title="Delete this Device Profile?">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
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');
});
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");
$("#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>
});
</script>
}
<div class="actionBar">
@if (Model.CanDelete)
@if (canDelete)
{
@Html.ActionLinkButton("Delete", MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true), "buttonDelete")
}
@Html.ActionLinkButton("Export Devices", MVC.API.DeviceProfile.ExportDevices(Model.DeviceProfile.Id))
@Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceProfile.Id.ToString(), "DeviceProfile"))
@if (Authorization.Has(Claims.Device.Actions.Export))
{
@Html.ActionLinkButton("Export Devices", MVC.API.DeviceProfile.ExportDevices(Model.DeviceProfile.Id))
}
@if (Authorization.Has(Claims.Device.Search))
{
@Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceProfile.Id.ToString(), "DeviceProfile"))
}
</div>
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,8 @@
@model Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel
@using Disco.Web.Areas.Config.Models.DeviceProfile
@{
Authorization.Require(Claims.Config.DeviceProfile.Show);
}
@if (DiscoApplication.MultiSiteMode)
{
var deviceProfilesGrouped = Model.DeviceProfiles.OrderBy(i => i.AddressName).GroupBy(i => i.AddressName);
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,6 +28,8 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
#line 2 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
@@ -39,7 +41,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceProfile/_Table.cshtml")]
public partial class Table : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel>
public partial class Table : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.IndexModel>
{
public Table()
{
@@ -48,6 +50,16 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
{
#line 3 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
Authorization.Require(Claims.Config.DeviceProfile.Show);
#line default
#line hidden
WriteLiteral("\r\n");
#line 6 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
if (DiscoApplication.MultiSiteMode)
{
var deviceProfilesGrouped = Model.DeviceProfiles.OrderBy(i => i.AddressName).GroupBy(i => i.AddressName);
@@ -61,7 +73,7 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
WriteLiteral(" <h2>");
#line 9 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
#line 12 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
Write(deviceProfilesGroup.Key);
@@ -70,21 +82,21 @@ WriteLiteral(" <h2>");
WriteLiteral("</h2> ");
#line 9 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
#line 12 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
}
#line default
#line hidden
#line 10 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
#line 13 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
Write(Html.Partial(MVC.Config.DeviceProfile.Views._TableRender, deviceProfilesGroup.Cast<_IndexModelItem>(), new ViewDataDictionary()));
#line default
#line hidden
#line 10 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
#line 13 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
}
}
@@ -95,14 +107,14 @@ else
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
#line 18 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
Write(Html.Partial(MVC.Config.DeviceProfile.Views._TableRender, Model.DeviceProfiles.Cast<_IndexModelItem>(), new ViewDataDictionary()));
#line default
#line hidden
#line 15 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
#line 18 "..\..\Areas\Config\Views\DeviceProfile\_Table.cshtml"
}
@@ -1,4 +1,7 @@
@model IEnumerable<Disco.Web.Areas.Config.Models.DeviceProfile._IndexModelItem>
@{
Authorization.Require(Claims.Config.DeviceProfile.Show);
}
<table class="tableData deviceProfileTable">
<tr>
<th class="name">
@@ -28,19 +28,29 @@ namespace Disco.Web.Areas.Config.Views.DeviceProfile
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceProfile/_TableRender.cshtml")]
public partial class TableRender : System.Web.Mvc.WebViewPage<IEnumerable<Disco.Web.Areas.Config.Models.DeviceProfile._IndexModelItem>>
public partial class TableRender : Disco.Services.Web.WebViewPage<IEnumerable<Disco.Web.Areas.Config.Models.DeviceProfile._IndexModelItem>>
{
public TableRender()
{
}
public override void Execute()
{
WriteLiteral("<table");
#line 2 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Authorization.Require(Claims.Config.DeviceProfile.Show);
#line default
#line hidden
WriteLiteral("\r\n<table");
WriteLiteral(" class=\"tableData deviceProfileTable\"");
@@ -63,13 +73,13 @@ WriteLiteral(" class=\"deviceCount\"");
WriteLiteral(">\r\n Device Count\r\n </th>\r\n </tr>\r\n");
#line 17 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 20 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 20 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
foreach (var item in Model)
{
@@ -81,7 +91,7 @@ WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
#line 21 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 24 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(Html.ActionLink(item.Name, MVC.Config.DeviceProfile.Index(item.Id)));
@@ -92,7 +102,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 24 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 27 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(Html.DisplayFor(modelItem => item.Description));
@@ -103,7 +113,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 27 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 30 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(Html.DisplayFor(modelItem => item.DistributionType));
@@ -114,7 +124,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 30 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 33 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(item.DeviceCount.ToString("n0"));
@@ -123,13 +133,13 @@ WriteLiteral(" ");
WriteLiteral("\r\n");
#line 31 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 34 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line default
#line hidden
#line 31 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 34 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
if (item.DeviceDecommissionedCount > 0)
{
@@ -140,21 +150,21 @@ WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteAttribute("title", Tuple.Create(" title=\"", 996), Tuple.Create("\"", 1067)
WriteAttribute("title", Tuple.Create(" title=\"", 1065), Tuple.Create("\"", 1136)
#line 33 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
, Tuple.Create(Tuple.Create("", 1004), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount.ToString("n0")
#line 36 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
, Tuple.Create(Tuple.Create("", 1073), Tuple.Create<System.Object, System.Int32>(item.DeviceDecommissionedCount.ToString("n0")
#line default
#line hidden
, 1004), false)
, Tuple.Create(Tuple.Create(" ", 1052), Tuple.Create("Decommissioned", 1053), true)
, 1073), false)
, Tuple.Create(Tuple.Create(" ", 1121), Tuple.Create("Decommissioned", 1122), true)
);
WriteLiteral(">\r\n (");
#line 34 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 37 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
Write(item.DeviceDecommissionedCount.ToString("n0"));
@@ -163,7 +173,7 @@ WriteLiteral(">\r\n (");
WriteLiteral(")</span>\r\n");
#line 35 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 38 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
}
@@ -172,7 +182,7 @@ WriteLiteral(")</span>\r\n");
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 38 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
#line 41 "..\..\Areas\Config\Views\DeviceProfile\_TableRender.cshtml"
}
@@ -1,5 +1,7 @@
@model Disco.Web.Areas.Config.Models.DocumentTemplate.CreateModel
@{
Authorization.RequireAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), "Create");
}
@using (Html.BeginForm(MVC.Config.DocumentTemplate.Create(), FormMethod.Post, new { enctype = "multipart/form-data" }))
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DocumentTemplate/Create.cshtml")]
public partial class Create : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DocumentTemplate.CreateModel>
public partial class Create : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DocumentTemplate.CreateModel>
{
public Create()
{
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
#line 2 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
Authorization.RequireAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), "Create");
@@ -51,7 +55,7 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
WriteLiteral("\r\n");
#line 5 "..\..\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" }))
{
@@ -68,7 +72,7 @@ WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r
"d:\r\n </th>\r\n <td>");
#line 13 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 15 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
Write(Html.TextBoxFor(model => model.DocumentTemplate.Id));
@@ -77,7 +81,7 @@ WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>\r
WriteLiteral("<br />");
#line 13 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 15 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.DocumentTemplate.Id));
@@ -88,7 +92,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
"");
#line 20 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 22 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
Write(Html.TextBoxFor(model => model.DocumentTemplate.Description));
@@ -97,7 +101,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
WriteLiteral("<br />");
#line 20 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 22 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.DocumentTemplate.Description));
@@ -109,7 +113,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>
WriteLiteral(" ");
#line 28 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 30 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
Write(Html.DropDownListFor(model => model.DocumentTemplate.Scope, Model.Scopes.ToSelectListItems(null)));
@@ -126,7 +130,7 @@ WriteLiteral(" name=\"Template\"");
WriteLiteral(" /><br />");
#line 36 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 38 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
Write(Html.ValidationMessage("Template"));
@@ -149,7 +153,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 44 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 46 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
Write(CommonHelpers.CheckBoxList("Types", Model.JobTypes.ToSelectListItems(Model.Types), 2));
@@ -158,13 +162,13 @@ WriteLiteral(" ");
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
#line 47 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 49 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line default
#line hidden
#line 47 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 49 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
foreach (var jt in Model.JobTypes)
{
@@ -173,15 +177,15 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n");
#line hidden
WriteLiteral(" <tr");
WriteAttribute("id", Tuple.Create(" id=\"", 1914), Tuple.Create("\"", 1939)
, Tuple.Create(Tuple.Create("", 1919), Tuple.Create("trJobSubType", 1919), true)
WriteAttribute("id", Tuple.Create(" id=\"", 2032), Tuple.Create("\"", 2057)
, Tuple.Create(Tuple.Create("", 2037), Tuple.Create("trJobSubType", 2037), true)
#line 49 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
, Tuple.Create(Tuple.Create("", 1931), Tuple.Create<System.Object, System.Int32>(jt.Id
#line 51 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
, Tuple.Create(Tuple.Create("", 2049), Tuple.Create<System.Object, System.Int32>(jt.Id
#line default
#line hidden
, 1931), false)
, 2049), false)
);
WriteLiteral(" class=\"jobSubTypes\"");
@@ -195,7 +199,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 51 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 53 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
Write(jt.Description);
@@ -206,7 +210,7 @@ WriteLiteral("<br />\r\n Sub Types<br />\r\n");
WriteLiteral(" ");
#line 53 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 55 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
Write(CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id)));
@@ -221,7 +225,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 56 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 58 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
Write(CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.Where(jst => jst.JobTypeId == jt.Id).ToList().ToSelectListItems(Model.SubTypes), 2));
@@ -230,7 +234,7 @@ WriteLiteral(" ");
WriteLiteral("\r\n </td>\r\n </tr> \r\n");
#line 59 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 61 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
}
@@ -288,7 +292,7 @@ WriteLiteral(@">
");
#line 96 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
#line 98 "..\..\Areas\Config\Views\DocumentTemplate\Create.cshtml"
}
#line default
@@ -1,5 +1,7 @@
@model Disco.Web.Areas.Config.Models.DocumentTemplate.ExpressionBrowserModel
@{
Authorization.Require(Claims.Config.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), "Expression Browser");
Html.BundleDeferred("~/Style/jQueryUI/dynatree");
Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-DynaTree");
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DocumentTemplate/ExpressionBrowser.cshtml")]
public partial class ExpressionBrowser : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DocumentTemplate.ExpressionBrowserModel>
public partial class ExpressionBrowser : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DocumentTemplate.ExpressionBrowserModel>
{
public ExpressionBrowser()
{
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
#line 2 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
Authorization.Require(Claims.Config.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), "Expression Browser");
Html.BundleDeferred("~/Style/jQueryUI/dynatree");
Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-DynaTree");
@@ -107,7 +111,7 @@ WriteLiteral(">\r\n $(function () {\r\n if (!document.DiscoFunctions)
"oadTypeUrl = \'");
#line 40 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
#line 42 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
Write(Url.Action(MVC.Config.DocumentTemplate.ExpressionBrowser()));
@@ -160,7 +164,7 @@ WriteLiteral("\';\r\n var deviceScopeTree = $(\'#deviceScopeTree\');\r\n
" loadType(deviceScopeTree.dynatree(\'getRoot\'), \'");
#line 104 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
#line 106 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
Write(Model.DeviceType);
@@ -170,7 +174,7 @@ WriteLiteral("\');\r\n\r\n jobScopeTree.dynatree({ onLazyRead: lazyLoadNo
"Type(jobScopeTree.dynatree(\'getRoot\'), \'");
#line 107 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
#line 109 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
Write(Model.JobType);
@@ -180,7 +184,7 @@ WriteLiteral("\');\r\n\r\n userScopeTree.dynatree({ onLazyRead: lazyLoadN
"dType(userScopeTree.dynatree(\'getRoot\'), \'");
#line 110 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
#line 112 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
Write(Model.UserType);
@@ -202,7 +206,7 @@ WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n");
#line 121 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
#line 123 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
foreach (var variable in Model.Variables)
{
@@ -215,7 +219,7 @@ WriteLiteral(" ");
WriteLiteral("document.DiscoFunctions.expressionInitVariable(\'");
#line 124 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
#line 126 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
Write(variable.Key);
@@ -224,7 +228,7 @@ WriteLiteral("document.DiscoFunctions.expressionInitVariable(\'");
WriteLiteral("\', \'");
#line 124 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
#line 126 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
Write(variable.Value);
@@ -235,7 +239,7 @@ WriteLiteral("\');");
WriteLiteral("\r\n");
#line 125 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
#line 127 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
}
foreach (var variable in Model.ExtensionLibraries)
{
@@ -248,7 +252,7 @@ WriteLiteral(" ");
WriteLiteral("document.DiscoFunctions.expressionInitExpressionLibrary(\'");
#line 128 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
#line 130 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
Write(variable.Key);
@@ -257,7 +261,7 @@ WriteLiteral("document.DiscoFunctions.expressionInitExpressionLibrary(\'");
WriteLiteral("\', \'");
#line 128 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
#line 130 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
Write(variable.Value);
@@ -268,7 +272,7 @@ WriteLiteral("\');");
WriteLiteral("\r\n");
#line 129 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
#line 131 "..\..\Areas\Config\Views\DocumentTemplate\ExpressionBrowser.cshtml"
}
@@ -1,4 +1,6 @@
@{
Authorization.Require(Claims.Config.DocumentTemplate.ShowStatus);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(), "Import Status");
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DocumentTemplate/ImportStatus.cshtml")]
public partial class ImportStatus : System.Web.Mvc.WebViewPage<dynamic>
public partial class ImportStatus : Disco.Services.Web.WebViewPage<dynamic>
{
public ImportStatus()
{
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
#line 1 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Authorization.Require(Claims.Config.DocumentTemplate.ShowStatus);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(), "Import Status");
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
@@ -261,7 +265,7 @@ WriteLiteral(">\r\n $(function () {\r\n var vm;\r\n var host =
" var urlDeviceShow = \'");
#line 102 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 104 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.Device.Show()));
@@ -270,7 +274,7 @@ WriteLiteral(">\r\n $(function () {\r\n var vm;\r\n var host =
WriteLiteral("/\'\r\n var urlJobShow = \'");
#line 103 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 105 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.Job.Show()));
@@ -279,7 +283,7 @@ WriteLiteral("/\'\r\n var urlJobShow = \'");
WriteLiteral("/\'\r\n var urlUserShow = \'");
#line 104 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 106 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.User.Show()));
@@ -288,7 +292,7 @@ WriteLiteral("/\'\r\n var urlUserShow = \'");
WriteLiteral("/\'\r\n var urlPageThumbnail = \'");
#line 105 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 107 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.API.DocumentTemplate.ImporterThumbnail()));
@@ -297,7 +301,7 @@ WriteLiteral("/\'\r\n var urlPageThumbnail = \'");
WriteLiteral("/\'\r\n var urlDocumentTemplate = \'");
#line 106 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 108 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.Config.DocumentTemplate.Index()));
@@ -306,7 +310,7 @@ WriteLiteral("/\'\r\n var urlDocumentTemplate = \'");
WriteLiteral("/\';\r\n var urlManuallyAssign = \'");
#line 107 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 109 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.Config.DocumentTemplate.UndetectedPages()));
@@ -315,7 +319,7 @@ WriteLiteral("/\';\r\n var urlManuallyAssign = \'");
WriteLiteral("\';\r\n var iconErrorUrl = \'url(");
#line 108 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 110 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Links.ClientSource.Style.Images.Status.fail32_png);
@@ -423,7 +427,7 @@ WriteLiteral(")\';\r\n var isLive = false;\r\n\r\n function pageVi
" url: \'");
#line 283 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 285 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Action(MVC.API.Logging.RetrieveEvents()));
@@ -452,7 +456,7 @@ WriteLiteral(@"',
liveConnection = $.connection('");
#line 303 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 305 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Url.Content("~/API/Logging/Notifications"));
@@ -461,7 +465,7 @@ WriteLiteral(@"',
WriteLiteral("\', { addToGroups: \'");
#line 303 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
#line 305 "..\..\Areas\Config\Views\DocumentTemplate\ImportStatus.cshtml"
Write(Disco.BI.DocumentTemplateBI.Importer.DocumentImporterLog.Current.LiveLogGroupName);
@@ -1,37 +1,57 @@
@model Disco.Web.Areas.Config.Models.DocumentTemplate.IndexModel
@{
Authorization.Require(Claims.Config.DocumentTemplate.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates");
}
<table class="tableData">
<tr>
<th>
Id
</th>
<th>
Description
</th>
<th>
Scope
</th>
</tr>
@foreach (var item in Model.DocumentTemplates)
{
@if (Model.DocumentTemplates.Count == 0)
{
<div class="form" style="width: 450px; padding: 100px 0;">
<h2>No document templates are configured</h2>
</div>
}
else
{
<table class="tableData">
<tr>
<td>
@Html.ActionLink(item.Id.ToString(), MVC.Config.DocumentTemplate.Index(item.Id))
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
<td>
@Html.DisplayFor(modelItem => item.Scope)
</td>
<th>Id
</th>
<th>Description
</th>
<th>Scope
</th>
</tr>
}
</table>
@foreach (var item in Model.DocumentTemplates)
{
<tr>
<td>
@Html.ActionLink(item.Id.ToString(), MVC.Config.DocumentTemplate.Index(item.Id))
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
<td>
@Html.DisplayFor(modelItem => item.Scope)
</td>
</tr>
}
</table>
}
<div class="actionBar">
@Html.ActionLinkButton("Undetected Pages", MVC.Config.DocumentTemplate.UndetectedPages())
@Html.ActionLinkButton("Import Status", MVC.Config.DocumentTemplate.ImportStatus())
@Html.ActionLinkButton("Expression Browser", MVC.Config.DocumentTemplate.ExpressionBrowser())
@Html.ActionLinkButton("Create Document Template", MVC.Config.DocumentTemplate.Create())
</div>
@if (Authorization.Has(Claims.Config.DocumentTemplate.UndetectedPages))
{
@Html.ActionLinkButton("Undetected Pages", MVC.Config.DocumentTemplate.UndetectedPages())
}
@if (Authorization.Has(Claims.Config.DocumentTemplate.ShowStatus))
{
@Html.ActionLinkButton("Import Status", MVC.Config.DocumentTemplate.ImportStatus())
}
@if (Authorization.Has(Claims.Config.Show))
{
@Html.ActionLinkButton("Expression Browser", MVC.Config.DocumentTemplate.ExpressionBrowser())
}
@if (Authorization.HasAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure))
{
@Html.ActionLinkButton("Create Document Template", MVC.Config.DocumentTemplate.Create())
}
</div>
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DocumentTemplate/Index.cshtml")]
public partial class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DocumentTemplate.IndexModel>
public partial class Index : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DocumentTemplate.IndexModel>
{
public Index()
{
@@ -43,124 +45,224 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
#line 2 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Authorization.Require(Claims.Config.DocumentTemplate.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates");
#line default
#line hidden
WriteLiteral("\r\n<table");
WriteLiteral("\r\n");
#line 7 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
if (Model.DocumentTemplates.Count == 0)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 450px; padding: 100px 0;\"");
WriteLiteral(">\r\n <h2>No document templates are configured</h2>\r\n </div> \r\n");
#line 12 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <table");
WriteLiteral(" class=\"tableData\"");
WriteLiteral(">\r\n <tr>\r\n <th>\r\n Id\r\n </th>\r\n <th>\r\n " +
" Description\r\n </th>\r\n <th>\r\n Scope\r\n </th>\r\n " +
" </tr>\r\n");
#line 17 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
foreach (var item in Model.DocumentTemplates)
{
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
#line 21 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.ActionLink(item.Id.ToString(), MVC.Config.DocumentTemplate.Index(item.Id)));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
WriteLiteral(">\r\n <tr>\r\n <th>Id\r\n </th>\r\n <th>Descripti" +
"on\r\n </th>\r\n <th>Scope\r\n </th>\r\n </tr>\r\n" +
"");
#line 24 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.DisplayFor(modelItem => item.Description));
#line default
#line hidden
#line 24 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
foreach (var item in Model.DocumentTemplates)
{
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
WriteLiteral(" ");
#line 27 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.DisplayFor(modelItem => item.Scope));
#line 28 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.ActionLink(item.Id.ToString(), MVC.Config.DocumentTemplate.Index(item.Id)));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 30 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
}
#line 31 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.DisplayFor(modelItem => item.Description));
#line default
#line hidden
WriteLiteral("</table>\r\n<div");
WriteLiteral("\r\n </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 34 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.DisplayFor(modelItem => item.Scope));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
#line 37 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </table>\r\n");
#line 39 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 33 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.ActionLinkButton("Undetected Pages", MVC.Config.DocumentTemplate.UndetectedPages()));
#line 41 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
#line default
#line hidden
#line 41 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
if (Authorization.Has(Claims.Config.DocumentTemplate.UndetectedPages))
{
#line default
#line hidden
#line 43 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.ActionLinkButton("Undetected Pages", MVC.Config.DocumentTemplate.UndetectedPages()));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 34 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.ActionLinkButton("Import Status", MVC.Config.DocumentTemplate.ImportStatus()));
#line 43 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 35 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.ActionLinkButton("Expression Browser", MVC.Config.DocumentTemplate.ExpressionBrowser()));
#line 45 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
if (Authorization.Has(Claims.Config.DocumentTemplate.ShowStatus))
{
#line default
#line hidden
#line 47 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.ActionLinkButton("Import Status", MVC.Config.DocumentTemplate.ImportStatus()));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 36 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.ActionLinkButton("Create Document Template", MVC.Config.DocumentTemplate.Create()));
#line 47 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n</div>");
WriteLiteral(" ");
#line 49 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
if (Authorization.Has(Claims.Config.Show))
{
#line default
#line hidden
#line 51 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.ActionLinkButton("Expression Browser", MVC.Config.DocumentTemplate.ExpressionBrowser()));
#line default
#line hidden
#line 51 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 53 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
if (Authorization.HasAll(Claims.Config.DocumentTemplate.Create, Claims.Config.DocumentTemplate.Configure))
{
#line default
#line hidden
#line 55 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
Write(Html.ActionLinkButton("Create Document Template", MVC.Config.DocumentTemplate.Create()));
#line default
#line hidden
#line 55 "..\..\Areas\Config\Views\DocumentTemplate\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("</div>\r\n");
}
}
@@ -1,28 +1,52 @@
@model Disco.Web.Areas.Config.Models.DocumentTemplate.ShowModel
@{
Authorization.Require(Claims.Config.DocumentTemplate.Show);
var canConfig = Authorization.Has(Claims.Config.DocumentTemplate.Configure);
#region Can Bulk Generate
var canBulkGenerate = Authorization.Has(Claims.Config.DocumentTemplate.BulkGenerate);
if (canBulkGenerate)
{
switch (Model.DocumentTemplate.Scope)
{
case DocumentTemplate.DocumentTemplateScopes.Device:
canBulkGenerate = Authorization.Has(Claims.Device.Actions.GenerateDocuments);
break;
case DocumentTemplate.DocumentTemplateScopes.Job:
canBulkGenerate = Authorization.Has(Claims.Job.Actions.GenerateDocuments);
break;
case DocumentTemplate.DocumentTemplateScopes.User:
canBulkGenerate = Authorization.Has(Claims.User.Actions.GenerateDocuments);
break;
default:
throw new InvalidOperationException("Invalid DocumentType Scope");
}
}
#endregion
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), Model.DocumentTemplate.Description);
}
<div class="form" style="width: 650px">
<table>
<tr>
<th>
Id:
<th>Id:
</th>
<td>@Html.DisplayFor(model => model.DocumentTemplate.Id)
</td>
</tr>
<tr>
<th>
Stored Instances:
<th>Stored Instances:
</th>
<td>@Html.DisplayFor(model => model.StoredInstanceCount)
</td>
</tr>
<tr>
<th>
Description:
<th>Description:
</th>
<td>@Html.TextBoxFor(model => model.DocumentTemplate.Description)
<td>@if (canConfig)
{
@Html.TextBoxFor(model => model.DocumentTemplate.Description)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
@@ -64,13 +88,25 @@
});
});
</script>
}
else
{
if (string.IsNullOrEmpty(Model.DocumentTemplate.Description))
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
@Model.DocumentTemplate.Description
}
}
</td>
</tr>
<tr>
<th>
Always Flatten Form:
<th>Always Flatten Form:
</th>
<td>
<td>@if (canConfig)
{
<input id="DocumentTemplate_FlattenForm" type="checkbox" @(Model.DocumentTemplate.FlattenForm ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty))/>
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
@@ -90,13 +126,18 @@
});
});
</script>
}
else
{
<input id="DocumentTemplate_FlattenForm" type="checkbox" @(Model.DocumentTemplate.FlattenForm ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty)) disabled="disabled" />
}
</td>
</tr>
<tr>
<th>
Scope:
<th>Scope:
</th>
<td>
<td>@if (canConfig)
{
@Html.DropDownListFor(model => model.DocumentTemplate.Scope, Model.Scopes.ToSelectListItems(null))
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
@@ -191,66 +232,92 @@
scopeChange();
});
</script>
}
else
{
@Model.DocumentTemplate.Scope
}
</td>
</tr>
<tr id="trJobTypes">
<th class="name">
Types:
</th>
<td class="value">
@CommonHelpers.CheckBoxList("Types", Model.JobTypes.ToSelectListItems(Model.Types), 2)
</td>
</tr>
@foreach (var jt in Model.JobTypes)
@if (canConfig || (Model.DocumentTemplate.Scope == DocumentTemplate.DocumentTemplateScopes.Job))
{
<tr id="trJobTypes">
<th class="name">Types:
</th>
<td class="value">
@CommonHelpers.CheckBoxList("Types", Model.JobTypes.ToSelectListItems(Model.Types), 2)
</td>
</tr>
foreach (var jt in Model.JobTypes)
{
<tr id="trJobSubType@(jt.Id)" class="jobSubTypes">
<th class="name">
@jt.Description<br />
Sub Types<br />
@CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id))
@if (canConfig)
{
@CommonHelpers.CheckboxBulkSelect(string.Format("CheckboxBulkSelect_{0}", jt.Id))
}
</th>
<td class="value">
@CommonHelpers.CheckBoxList("SubTypes", Model.JobSubTypes.Where(jst => jst.JobTypeId == jt.Id).ToList().ToSelectListItems(Model.SubTypes), 2)
</td>
</tr>
}
if (canConfig)
{
<tr id="trJobTypeActions">
<th class="name"></th>
<td class="value">
<a id="TypeAction_Save" href="#" class="button">Save Job Types</a>@AjaxHelpers.AjaxLoader()
</td>
</tr>
}
else if (Model.DocumentTemplate.Scope == DocumentTemplate.DocumentTemplateScopes.Job)
{
<script>
$(function () {
$('.jobSubTypes').hide().find('input[type="checkbox"]').prop('disabled', true);
$('#trJobTypes').find('input[type="checkbox"]').prop('disabled', true).filter(':checked').each(function () {
$('#trJobSubType' + $(this).val()).show();
});
});
</script>
}
}
<tr id="trJobTypeActions">
<th class="name">
</th>
<td class="value">
<a id="TypeAction_Save" href="#" class="button">Save Job Types</a>@AjaxHelpers.AjaxLoader()
</td>
</tr>
<tr>
<th>
Template PDF
<th>Template PDF
</th>
<td>
@Html.ActionLink("Download Template", MVC.API.DocumentTemplate.Template(Model.DocumentTemplate.Id))
<br />
@using (Html.BeginForm(MVC.API.DocumentTemplate.Template(Model.DocumentTemplate.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
@if (canConfig && Authorization.Has(Claims.Config.DocumentTemplate.Upload))
{
<br />
using (Html.BeginForm(MVC.API.DocumentTemplate.Template(Model.DocumentTemplate.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="Template" id="Template" style="width: 250px;" />
<input class="button" type="submit" value="Upload" />
}
<script type="text/javascript">
$(function () {
var $template = $('#Template');
$template.closest('form').submit(function () {
if ($template.val() == '') {
alert('A template file is required to upload.');
return false;
}
}
<script type="text/javascript">
$(function () {
var $template = $('#Template');
$template.closest('form').submit(function () {
if ($template.val() == '') {
alert('A template file is required to upload.');
return false;
}
});
});
});
</script>
</script>
}
</td>
</tr>
<tr>
<th>
Filter Expression:
<th>Filter Expression:
</th>
<td>@Html.TextBoxFor(model => model.DocumentTemplate.FilterExpression)
<td>@if (canConfig && Authorization.Has(Claims.Config.DocumentTemplate.ConfigureFilterExpression))
{
@Html.TextBoxFor(model => model.DocumentTemplate.FilterExpression)
@AjaxHelpers.AjaxRemove()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
@@ -300,32 +367,47 @@
};
});
</script>
</td>
</tr>
<tr>
<th>
Bulk Generate
</th>
<td>
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id), FormMethod.Post))
}
else
{
<textarea name="DataIds"></textarea>
<input class="button" type="submit" value="Generate" />
if (string.IsNullOrWhiteSpace(Model.DocumentTemplate.FilterExpression))
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
<div class="code">
@Model.DocumentTemplate.FilterExpression
</div>
}
}
</td>
</tr>
@if (canBulkGenerate)
{
<tr>
<th>Bulk Generate
</th>
<td>
@using (Html.BeginForm(MVC.API.DocumentTemplate.BulkGenerate(Model.DocumentTemplate.Id), FormMethod.Post))
{
<textarea name="DataIds"></textarea>
<input class="button" type="submit" value="Generate" />
}
</td>
</tr>
}
</table>
</div>
<h2>
Template Expressions</h2>
<h2>Template Expressions</h2>
@Html.Partial(MVC.Config.DocumentTemplate.Views._ExpressionsTable, Model.TemplateExpressions)
<div id="dialogConfirmDelete" title="Delete this Document Template?">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 100px 0;">
</span>This item will be permanently deleted and cannot be recovered.<br />
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 100px 0;"></span>This item will be permanently deleted and cannot be recovered.<br />
<em>This <strong>will not delete attachments</strong> which have already been imported,
but any generated documents will no longer be automatically imported.</em><br />
Are you sure?</p>
Are you sure?
</p>
</div>
<script type="text/javascript">
$(function () {
@@ -357,6 +439,12 @@
});
</script>
<div class="actionBar">
@Html.ActionLinkButton("Expression Browser", MVC.Config.DocumentTemplate.ExpressionBrowser())
@Html.ActionLinkButton("Delete", MVC.API.DocumentTemplate.Delete(Model.DocumentTemplate.Id, true), "buttonDelete")
@if (Authorization.Has(Claims.Config.Show))
{
@Html.ActionLinkButton("Expression Browser", MVC.Config.DocumentTemplate.ExpressionBrowser())
}
@if (Authorization.Has(Claims.Config.DocumentTemplate.Delete))
{
@Html.ActionLinkButton("Delete", MVC.API.DocumentTemplate.Delete(Model.DocumentTemplate.Id, true), "buttonDelete")
}
</div>
File diff suppressed because it is too large Load Diff
@@ -1,39 +1,41 @@
@model Disco.Web.Areas.Config.Models.DocumentTemplate.UndetectedPagesModel
@{
Authorization.Require(Claims.Config.DocumentTemplate.UndetectedPages);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(), "Undetected Pages");
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
}
<div id="undetectedPagesContainer">
<div id="noUndetectedPages" data-bind="visible: noUndetectedPages">
<h3>
No Undetected Pages</h3>
<h3>No Undetected Pages</h3>
</div>
<ul id="undetectedPages" class="clearfix" data-bind="visible: !noUndetectedPages(), foreach: {data: undetectedPages}">
<li class="undetectedPage" data-bind="style: {backgroundImage: thumbnailUrl}, click: select">
<div class="pageDetails" data-bind="text: timestampFuzzy, attr: {title: timestamp}">
<ul id="undetectedPages" class="clearfix" data-bind="visible: !noUndetectedPages(), foreach: { data: undetectedPages }">
<li class="undetectedPage" data-bind="style: { backgroundImage: thumbnailUrl }, click: select">
<div class="pageDetails" data-bind="text: timestampFuzzy, attr: { title: timestamp }">
</div>
</li>
</ul>
</div>
<div id="undetectedPageDialog" data-bind="with: selectedUndetectedPage">
<div class="pagePreview" data-bind="style: {backgroundImage: previewUrl}">
<div class="pagePreview" data-bind="style: { backgroundImage: previewUrl }">
</div>
<div class="actions">
<a href="#" class="button" target="_blank" data-bind="attr: {href: sourceUrl}">Download</a>
<a href="#" class="button" target="_blank" data-bind="attr: { href: sourceUrl }">Download</a>
<a href="#" class="button" id="dialogDeleteButton" data-bind="click: deletePage">Delete</a>
</div>
<div class="actions">
Type: @Html.DropDownList("dialogDocumentTemplateId", Model.DocumentTemplatesSelectListItems, new Dictionary<string, object> { { "data-bind", "value: dialogTemplateId" } })
Data:
<input id="dialogDataId" type="text" data-bind="value: dialogDataId, autocomplete: {source: dialogDataIdService, minLength: 3, position: {my: 'left bottom', at: 'left top'}}" />
<input id="dialogDataId" type="text" data-bind="value: dialogDataId, autocomplete: { source: dialogDataIdService, minLength: 3, position: { my: 'left bottom', at: 'left top' } }" />
<a href="#" class="button" id="dialogAssignButton" data-bind="click: assignPage">Assign</a>
</div>
</div>
<div id="dialogRemove" title="Delete this Page?">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
Are you sure?</p>
Are you sure?
</p>
</div>
<script type="text/javascript">
ko.bindingHandlers.autocomplete = {
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DocumentTemplate/UndetectedPages.cshtml")]
public partial class UndetectedPages : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DocumentTemplate.UndetectedPagesModel>
public partial class UndetectedPages : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DocumentTemplate.UndetectedPagesModel>
{
public UndetectedPages()
{
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
#line 2 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
Authorization.Require(Claims.Config.DocumentTemplate.UndetectedPages);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(), "Undetected Pages");
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
@@ -60,25 +64,25 @@ WriteLiteral(" id=\"noUndetectedPages\"");
WriteLiteral(" data-bind=\"visible: noUndetectedPages\"");
WriteLiteral(">\r\n <h3>\r\n No Undetected Pages</h3>\r\n </div>\r\n <ul");
WriteLiteral(">\r\n <h3>No Undetected Pages</h3>\r\n </div>\r\n <ul");
WriteLiteral(" id=\"undetectedPages\"");
WriteLiteral(" class=\"clearfix\"");
WriteLiteral(" data-bind=\"visible: !noUndetectedPages(), foreach: {data: undetectedPages}\"");
WriteLiteral(" data-bind=\"visible: !noUndetectedPages(), foreach: { data: undetectedPages }\"");
WriteLiteral(">\r\n <li");
WriteLiteral(" class=\"undetectedPage\"");
WriteLiteral(" data-bind=\"style: {backgroundImage: thumbnailUrl}, click: select\"");
WriteLiteral(" data-bind=\"style: { backgroundImage: thumbnailUrl }, click: select\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" class=\"pageDetails\"");
WriteLiteral(" data-bind=\"text: timestampFuzzy, attr: {title: timestamp}\"");
WriteLiteral(" data-bind=\"text: timestampFuzzy, attr: { title: timestamp }\"");
WriteLiteral(">\r\n </div>\r\n </li>\r\n </ul>\r\n</div>\r\n<div");
@@ -90,7 +94,7 @@ WriteLiteral(">\r\n <div");
WriteLiteral(" class=\"pagePreview\"");
WriteLiteral(" data-bind=\"style: {backgroundImage: previewUrl}\"");
WriteLiteral(" data-bind=\"style: { backgroundImage: previewUrl }\"");
WriteLiteral(">\r\n </div>\r\n <div");
@@ -104,7 +108,7 @@ WriteLiteral(" class=\"button\"");
WriteLiteral(" target=\"_blank\"");
WriteLiteral(" data-bind=\"attr: {href: sourceUrl}\"");
WriteLiteral(" data-bind=\"attr: { href: sourceUrl }\"");
WriteLiteral(">Download</a>\r\n <a");
@@ -123,7 +127,7 @@ WriteLiteral(" class=\"actions\"");
WriteLiteral(">\r\n Type: ");
#line 27 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
#line 28 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
Write(Html.DropDownList("dialogDocumentTemplateId", Model.DocumentTemplatesSelectListItems, new Dictionary<string, object> { { "data-bind", "value: dialogTemplateId" } }));
@@ -135,8 +139,8 @@ WriteLiteral(" id=\"dialogDataId\"");
WriteLiteral(" type=\"text\"");
WriteLiteral(" data-bind=\"value: dialogDataId, autocomplete: {source: dialogDataIdService, minL" +
"ength: 3, position: {my: \'left bottom\', at: \'left top\'}}\"");
WriteLiteral(" data-bind=\"value: dialogDataId, autocomplete: { source: dialogDataIdService, min" +
"Length: 3, position: { my: \'left bottom\', at: \'left top\' } }\"");
WriteLiteral(" />\r\n <a");
@@ -160,7 +164,7 @@ WriteLiteral(" class=\"ui-icon ui-icon-alert\"");
WriteLiteral(" style=\"float: left; margin: 0 7px 20px 0;\"");
WriteLiteral("></span>\r\n Are you sure?</p>\r\n</div>\r\n<script");
WriteLiteral("></span>\r\n Are you sure?\r\n </p>\r\n</div>\r\n<script");
WriteLiteral(" type=\"text/javascript\"");
@@ -193,7 +197,7 @@ WriteLiteral(">\r\n $(function () {\r\n\r\n var vm;\r\n var url
" = \'");
#line 63 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
#line 65 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
Write(new HtmlString(Url.Action(MVC.API.DocumentTemplate.ImporterUndetectedFile(null, false, true))));
@@ -202,7 +206,7 @@ WriteLiteral(">\r\n $(function () {\r\n\r\n var vm;\r\n var url
WriteLiteral("\';\r\n var urlUndetectedPagePreview = \'");
#line 64 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
#line 66 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
Write(new HtmlString(Url.Action(MVC.API.DocumentTemplate.ImporterUndetectedFile(null, false, false))));
@@ -211,7 +215,7 @@ WriteLiteral("\';\r\n var urlUndetectedPagePreview = \'");
WriteLiteral("\';\r\n var urlUndetectedPageSource = \'");
#line 65 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
#line 67 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
Write(new HtmlString(Url.Action(MVC.API.DocumentTemplate.ImporterUndetectedFile(null, true, false))));
@@ -220,7 +224,7 @@ WriteLiteral("\';\r\n var urlUndetectedPageSource = \'");
WriteLiteral("\';\r\n var urlDataIdLookupService = \'");
#line 66 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
#line 68 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
Write(Url.Action(MVC.API.DocumentTemplate.ImporterUndetectedDataIdLookup()));
@@ -229,7 +233,7 @@ WriteLiteral("\';\r\n var urlDataIdLookupService = \'");
WriteLiteral("/\';\r\n var urlImporterUndetectedAssign = \'");
#line 67 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
#line 69 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
Write(Url.Action(MVC.API.DocumentTemplate.ImporterUndetectedAssign()));
@@ -238,7 +242,7 @@ WriteLiteral("/\';\r\n var urlImporterUndetectedAssign = \'");
WriteLiteral("/\';\r\n var urlImporterUndetectedDelete = \'");
#line 68 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
#line 70 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
Write(Url.Action(MVC.API.DocumentTemplate.ImporterUndetectedDelete()));
@@ -318,7 +322,7 @@ WriteLiteral("/\';\r\n var $undetectedPageDialog = $(\'#undetectedPageDia
"m = new pageViewModel();\r\n\r\n $.ajax({\r\n url: \'");
#line 202 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
#line 204 "..\..\Areas\Config\Views\DocumentTemplate\UndetectedPages.cshtml"
Write(Url.Action(MVC.API.DocumentTemplate.ImporterUndetectedFiles()));
@@ -1,4 +1,7 @@
@model IEnumerable<Disco.BI.Expressions.Expression>
@{
Authorization.Require(Claims.Config.DocumentTemplate.Show);
}
<div class="expressionsTable">
@if (Model.Count() > 0)
{
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,32 +28,42 @@ namespace Disco.Web.Areas.Config.Views.DocumentTemplate
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DocumentTemplate/_ExpressionsTable.cshtml")]
public partial class ExpressionsTable : System.Web.Mvc.WebViewPage<IEnumerable<Disco.BI.Expressions.Expression>>
public partial class ExpressionsTable : Disco.Services.Web.WebViewPage<IEnumerable<Disco.BI.Expressions.Expression>>
{
public ExpressionsTable()
{
}
public override void Execute()
{
WriteLiteral("<div");
#line 2 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
Authorization.Require(Claims.Config.DocumentTemplate.Show);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" class=\"expressionsTable\"");
WriteLiteral(">\r\n");
#line 3 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 6 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line default
#line hidden
#line 3 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 6 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
if (Model.Count() > 0)
{
@@ -79,13 +89,13 @@ WriteLiteral(@">
");
#line 17 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 20 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line default
#line hidden
#line 17 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 20 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
foreach (var expression in Model.Where(m => m.IsDynamic))
{
var expressionParts = expression.Where(e => e.IsDynamic).ToArray();
@@ -95,14 +105,14 @@ WriteLiteral(@">
#line hidden
WriteLiteral(" <tr>\r\n <td");
WriteAttribute("rowspan", Tuple.Create(" rowspan=\"", 647), Tuple.Create("\"", 682)
WriteAttribute("rowspan", Tuple.Create(" rowspan=\"", 719), Tuple.Create("\"", 754)
#line 21 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
, Tuple.Create(Tuple.Create("", 657), Tuple.Create<System.Object, System.Int32>(expressionParts.Length
#line 24 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
, Tuple.Create(Tuple.Create("", 729), Tuple.Create<System.Object, System.Int32>(expressionParts.Length
#line default
#line hidden
, 657), false)
, 729), false)
);
WriteLiteral(">\r\n");
@@ -110,7 +120,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 22 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 25 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
Write(expression.Name);
@@ -119,13 +129,13 @@ WriteLiteral(" ");
WriteLiteral("\r\n </td>\r\n");
#line 24 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 27 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line default
#line hidden
#line 24 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 27 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
if (expressionParts[0].ParseError)
{
@@ -141,7 +151,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 27 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 30 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
Write(expressionParts[0].Source.ToMultilineString());
@@ -157,7 +167,7 @@ WriteLiteral(">\r\n <strong>Expression Compilatio
WriteLiteral(" ");
#line 30 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 33 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
Write(expressionParts[0].ParseErrorMessage);
@@ -166,7 +176,7 @@ WriteLiteral(" ");
WriteLiteral("\r\n </div>\r\n </td>\r\n");
#line 33 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 36 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
}
else
{
@@ -179,7 +189,7 @@ WriteLiteral(" <td>\r\n");
WriteLiteral(" ");
#line 37 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 40 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
Write(expressionParts[0].Source.ToMultilineString());
@@ -188,7 +198,7 @@ WriteLiteral(" ");
WriteLiteral("\r\n </td>\r\n");
#line 39 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 42 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
}
@@ -199,7 +209,7 @@ WriteLiteral(" <td>\r\n");
WriteLiteral(" ");
#line 41 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 44 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
Write(expressionParts[0].ErrorsAllowed ? "Yes" : "No");
@@ -208,7 +218,7 @@ WriteLiteral(" ");
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
#line 44 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 47 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
for (int expressionIndex = 1; expressionIndex < expressionParts.Length; expressionIndex++)
{
@@ -218,13 +228,13 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n");
WriteLiteral(" <tr>\r\n");
#line 47 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 50 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line default
#line hidden
#line 47 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 50 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
if (expressionParts[expressionIndex].ParseError)
{
@@ -240,7 +250,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 50 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 53 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
Write(expressionParts[expressionIndex].Source.ToMultilineString());
@@ -256,7 +266,7 @@ WriteLiteral(">\r\n <strong>Expression Compilatio
WriteLiteral(" ");
#line 53 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 56 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
Write(expressionParts[expressionIndex].ParseErrorMessage);
@@ -265,7 +275,7 @@ WriteLiteral(" ");
WriteLiteral("\r\n </div>\r\n </td>\r\n");
#line 56 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 59 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
}
else
{
@@ -278,7 +288,7 @@ WriteLiteral(" <td>\r\n");
WriteLiteral(" ");
#line 60 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 63 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
Write(expressionParts[expressionIndex].Source.ToMultilineString());
@@ -287,7 +297,7 @@ WriteLiteral(" ");
WriteLiteral("\r\n </td>\r\n");
#line 62 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 65 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
}
@@ -298,7 +308,7 @@ WriteLiteral(" <td>\r\n");
WriteLiteral(" ");
#line 64 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 67 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
Write(expressionParts[expressionIndex].ErrorsAllowed ? "Yes" : "No");
@@ -307,7 +317,7 @@ WriteLiteral(" ");
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
#line 67 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 70 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
}
}
@@ -317,7 +327,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n");
WriteLiteral(" </table>\r\n");
#line 70 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 73 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
}
else
{
@@ -332,7 +342,7 @@ WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">No Expressions Found</span>\r\n");
#line 74 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
#line 77 "..\..\Areas\Config\Views\DocumentTemplate\_ExpressionsTable.cshtml"
}
@@ -1,5 +1,10 @@
@model Disco.Web.Areas.Config.Models.Enrolment.IndexModel
@{
Authorization.Require(Claims.Config.Enrolment.Show);
var canConfig = Authorization.Has(Claims.Config.Enrolment.Configure);
var canShowStatus = Authorization.Has(Claims.Config.Enrolment.ShowStatus);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Enrolment");
}
<div class="form" style="width: 530px;">
@@ -8,7 +13,9 @@
<tr>
<th>Username:
</th>
<td>@Html.TextBoxFor(model => model.MacSshUsername)
<td>@if (canConfig)
{
@Html.TextBoxFor(model => model.MacSshUsername)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
@@ -50,12 +57,26 @@
});
});
</script>
}
else
{
if (string.IsNullOrEmpty(Model.MacSshUsername))
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
@Model.MacSshUsername
}
}
</td>
</tr>
<tr>
<th>Password:
</th>
<td>
<td>@if (canConfig)
{
<input id="MacSshPassword" type="password" />
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
@@ -98,6 +119,11 @@
});
});
</script>
}
else
{
<text>********</text>
}
</td>
</tr>
<tr>
@@ -115,8 +141,10 @@
</tr>
</table>
</div>
<h2>Live Enrolment Logging</h2>
@Html.Partial(MVC.Config.Shared.Views.LogEvents, new Disco.Web.Areas.Config.Models.Shared.LogEventsModel()
@if (canShowStatus && Authorization.Has(Claims.Config.Logging.Show))
{
<h2>Live Enrolment Logging</h2>
@Html.Partial(MVC.Config.Shared.Views.LogEvents, new Disco.Web.Areas.Config.Models.Shared.LogEventsModel()
{
IsLive = true,
TakeFilter = 100,
@@ -124,7 +152,14 @@
ModuleFilter = Disco.BI.DeviceBI.EnrolmentLog.Current,
ViewPortHeight = 250
})
}
<div class="actionBar">
@Html.ActionLinkButton("Download Bootstrapper", MVC.Services.Client.Bootstrapper())
@Html.ActionLinkButton("Enrolment Status", MVC.Config.Enrolment.Status())
@if (Authorization.Has(Claims.Config.Enrolment.DownloadBootstrapper))
{
@Html.ActionLinkButton("Download Bootstrapper", MVC.Services.Client.Bootstrapper())
}
@if (canShowStatus)
{
@Html.ActionLinkButton("Enrolment Status", MVC.Config.Enrolment.Status())
}
</div>
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.Enrolment
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Enrolment/Index.cshtml")]
public partial class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Enrolment.IndexModel>
public partial class Index : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.Enrolment.IndexModel>
{
public Index()
{
@@ -43,6 +45,11 @@ namespace Disco.Web.Areas.Config.Views.Enrolment
#line 2 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Authorization.Require(Claims.Config.Enrolment.Show);
var canConfig = Authorization.Has(Claims.Config.Enrolment.Configure);
var canShowStatus = Authorization.Has(Claims.Config.Enrolment.ShowStatus);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Enrolment");
@@ -58,35 +65,56 @@ WriteLiteral(">\r\n <h2>Apple Mac Secure Enrol</h2>\r\n <table>\r\n
"h>Username:\r\n </th>\r\n <td>");
#line 11 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line 16 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
if (canConfig)
{
#line default
#line hidden
#line 18 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Write(Html.TextBoxFor(model => model.MacSshUsername));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 12 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line 18 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line default
#line hidden
#line 19 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 13 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line 19 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line default
#line hidden
#line 20 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n <script");
#line 20 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
@@ -113,7 +141,7 @@ WriteLiteral(@">
url: '");
#line 34 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line 41 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Write(Url.Action(MVC.API.Bootstrapper.MacSshUsername()));
@@ -138,13 +166,62 @@ WriteLiteral(@"',
});
});
</script>
</td>
</tr>
<tr>
<th>Password:
</th>
<td>
<input");
");
#line 60 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
}
else
{
if (string.IsNullOrEmpty(Model.MacSshUsername))
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">&lt;None Specified&gt;</span>\r\n");
#line 66 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
}
else
{
#line default
#line hidden
#line 69 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Write(Model.MacSshUsername);
#line default
#line hidden
#line 69 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
}
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n\r\n <tr>\r\n <th>Password:\r\n " +
" </th>\r\n <td>");
#line 78 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
if (canConfig)
{
#line default
#line hidden
WriteLiteral(" <input");
WriteLiteral(" id=\"MacSshPassword\"");
@@ -152,27 +229,41 @@ WriteLiteral(" type=\"password\"");
WriteLiteral(" />\r\n");
WriteLiteral(" ");
#line 60 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line 81 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line default
#line hidden
#line 81 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Write(AjaxHelpers.AjaxSave());
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 61 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line 81 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line default
#line hidden
#line 82 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Write(AjaxHelpers.AjaxLoader());
#line default
#line hidden
WriteLiteral("\r\n <script");
#line 82 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
@@ -199,7 +290,7 @@ WriteLiteral(@">
url: '");
#line 82 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line 103 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Write(Url.Action(MVC.API.Bootstrapper.MacSshPassword()));
@@ -224,10 +315,31 @@ WriteLiteral(@"',
});
});
</script>
</td>
</tr>
<tr>
<td");
");
#line 122 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("********");
WriteLiteral("\r\n");
#line 126 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <td");
WriteLiteral(" colspan=\"2\"");
@@ -284,11 +396,26 @@ WriteLiteral(">&lt;a&gt;</span>) or <span");
WriteLiteral(" class=\"code\"");
WriteLiteral(">&lt;script&gt;</span>\r\n tag embedded on the organisation\'s in" +
"tranet.</span>\r\n </td>\r\n </tr>\r\n </table>\r\n</div>\r\n<h2>Live" +
" Enrolment Logging</h2>\r\n");
"tranet.</span>\r\n </td>\r\n </tr>\r\n </table>\r\n</div>\r\n");
#line 119 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line 144 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
if (canShowStatus && Authorization.Has(Claims.Config.Logging.Show))
{
#line default
#line hidden
WriteLiteral(" <h2>Live Enrolment Logging</h2>\r\n");
#line 147 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line default
#line hidden
#line 147 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Write(Html.Partial(MVC.Config.Shared.Views.LogEvents, new Disco.Web.Areas.Config.Models.Shared.LogEventsModel()
{
IsLive = true,
@@ -301,33 +428,75 @@ Write(Html.Partial(MVC.Config.Shared.Views.LogEvents, new Disco.Web.Areas.Config
#line default
#line hidden
WriteLiteral("\r\n<div");
#line 154 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 128 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Write(Html.ActionLinkButton("Download Bootstrapper", MVC.Services.Client.Bootstrapper()));
#line 157 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
#line default
#line hidden
#line 157 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
if (Authorization.Has(Claims.Config.Enrolment.DownloadBootstrapper))
{
#line default
#line hidden
#line 159 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Write(Html.ActionLinkButton("Download Bootstrapper", MVC.Services.Client.Bootstrapper()));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 129 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Write(Html.ActionLinkButton("Enrolment Status", MVC.Config.Enrolment.Status()));
#line 159 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n</div>\r\n");
WriteLiteral(" ");
#line 161 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
if (canShowStatus)
{
#line default
#line hidden
#line 163 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
Write(Html.ActionLinkButton("Enrolment Status", MVC.Config.Enrolment.Status()));
#line default
#line hidden
#line 163 "..\..\Areas\Config\Views\Enrolment\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("</div>\r\n");
}
}
@@ -1,4 +1,6 @@
@{
Authorization.Require(Claims.Config.Enrolment.ShowStatus);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Enrolment", MVC.Config.Enrolment.Index(), "Status");
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.Enrolment
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Enrolment/Status.cshtml")]
public partial class Status : System.Web.Mvc.WebViewPage<dynamic>
public partial class Status : Disco.Services.Web.WebViewPage<dynamic>
{
public Status()
{
@@ -43,6 +45,8 @@ namespace Disco.Web.Areas.Config.Views.Enrolment
#line 1 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
Authorization.Require(Claims.Config.Enrolment.ShowStatus);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Enrolment", MVC.Config.Enrolment.Index(), "Status");
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
@@ -313,7 +317,7 @@ WriteLiteral(@">
var deviceBaseUrl = '");
#line 141 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
#line 143 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
Write(Url.Action(MVC.Device.Show()));
@@ -322,7 +326,7 @@ WriteLiteral(@">
WriteLiteral("/\'\r\n var deviceModelImageUrl = \'");
#line 142 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
#line 144 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
Write(Url.Action(MVC.API.DeviceModel.Image()));
@@ -331,7 +335,7 @@ WriteLiteral("/\'\r\n var deviceModelImageUrl = \'");
WriteLiteral("/\'\r\n var iconWarningUrl = \'url(");
#line 143 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
#line 145 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
Write(Links.ClientSource.Style.Images.Status.warning32_png);
@@ -340,7 +344,7 @@ WriteLiteral("/\'\r\n var iconWarningUrl = \'url(");
WriteLiteral(")\';\r\n var iconErrorUrl = \'url(");
#line 144 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
#line 146 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
Write(Links.ClientSource.Style.Images.Status.fail32_png);
@@ -443,7 +447,7 @@ WriteLiteral(")\';\r\n\r\n function pageViewModel() {\r\n var
" vm = new pageViewModel();\r\n $.ajax({\r\n url: \'");
#line 308 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
#line 310 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
Write(Url.Action(MVC.API.DeviceModel.Index()));
@@ -477,7 +481,7 @@ WriteLiteral(@"',
url: '");
#line 333 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
#line 335 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
Write(Url.Action(MVC.API.Logging.RetrieveEvents()));
@@ -513,7 +517,7 @@ WriteLiteral(@"',
liveConnection = $.connection('");
#line 360 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
#line 362 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
Write(Url.Content("~/API/Logging/Notifications"));
@@ -522,7 +526,7 @@ WriteLiteral(@"',
WriteLiteral("\', { addToGroups: \'");
#line 360 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
#line 362 "..\..\Areas\Config\Views\Enrolment\Status.cshtml"
Write(Disco.BI.DeviceBI.EnrolmentLog.Current.LiveLogGroupName);
@@ -1,5 +1,9 @@
@model Disco.Web.Areas.Config.Models.Expressions.EditorModel
@{
// Under Construction - Not In Production
Authorization.Require(Claims.DiscoAdminAccount);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Expressions");
Html.BundleDeferred("~/ClientScripts/Modules/Disco-ExpressionEditor");
}
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.Expressions
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Expressions/Editor.cshtml")]
public partial class Editor : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Expressions.EditorModel>
public partial class Editor : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.Expressions.EditorModel>
{
public Editor()
{
@@ -43,6 +45,10 @@ namespace Disco.Web.Areas.Config.Views.Expressions
#line 2 "..\..\Areas\Config\Views\Expressions\Editor.cshtml"
// Under Construction - Not In Production
Authorization.Require(Claims.DiscoAdminAccount);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Expressions");
Html.BundleDeferred("~/ClientScripts/Modules/Disco-ExpressionEditor");
@@ -78,7 +84,7 @@ WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n var initExpression = \'");
#line 21 "..\..\Areas\Config\Views\Expressions\Editor.cshtml"
#line 25 "..\..\Areas\Config\Views\Expressions\Editor.cshtml"
Write(Model.Expression);
@@ -87,7 +93,7 @@ WriteLiteral(">\r\n $(function () {\r\n var initExpression = \
WriteLiteral("\';\r\n var hostSrcUrl = \'");
#line 22 "..\..\Areas\Config\Views\Expressions\Editor.cshtml"
#line 26 "..\..\Areas\Config\Views\Expressions\Editor.cshtml"
Write(Links.ClientSource.Style.ExpressionEditor_htm);
@@ -103,7 +109,7 @@ WriteLiteral(@"';
var editor = new DiscoExpressionEditor(host, '");
#line 29 "..\..\Areas\Config\Views\Expressions\Editor.cshtml"
#line 33 "..\..\Areas\Config\Views\Expressions\Editor.cshtml"
Write(Url.Action(MVC.API.Expressions.ValidateExpression()));
@@ -1,18 +1,18 @@
@model Disco.Web.Areas.Config.Models.Logging.IndexModel
@using Disco.Services.Logging
@{
Authorization.Require(Claims.Config.Logging.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Logging");
Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-TimePicker");
}
@using (Html.BeginForm(MVC.API.Logging.RetrieveEvents()))
{
<div class="form" style="width: 520px;">
<h2>
Export Logs</h2>
<h2>Export Logs</h2>
<table>
<tr>
<th style="width: 105px;">
Start Filter
<th style="width: 105px;">Start Filter
</th>
<td>
<input id="filterStart" type="text" name="Start" />
@@ -20,8 +20,7 @@
</td>
</tr>
<tr>
<th>
End Filter
<th>End Filter
</th>
<td>
<input id="filterEnd" type="text" name="End" />
@@ -29,8 +28,7 @@
</td>
</tr>
<tr>
<th>
Limit Filter
<th>Limit Filter
</th>
<td>
<select name="Take">
@@ -44,8 +42,7 @@
</td>
</tr>
<tr>
<th>
Module Filter
<th>Module Filter
</th>
<td>
<select id="moduleId" name="ModuleId">
@@ -58,10 +55,8 @@
</td>
</tr>
<tr id="trLogModuleEventTypes" style="display: none">
<th>
Event Type Filter <span style="display: block;" class="checkboxBulkSelectContainer">
Select: <a id="eventTypesSelectAll" href="#">ALL</a> | <a id="eventTypesSelectNone"
href="#">NONE</a></span>
<th>Event Type Filter <span style="display: block;" class="checkboxBulkSelectContainer">Select: <a id="eventTypesSelectAll" href="#">ALL</a> | <a id="eventTypesSelectNone"
href="#">NONE</a></span>
</th>
<td>
@{int uniqueIdSeed = 0;
@@ -76,8 +71,7 @@
</td>
</tr>
<tr>
<th>
</th>
<th></th>
<td>
@Html.Hidden("Format", "CSV")
<input type="submit" class="button" value="Download CSV" />
@@ -153,8 +147,7 @@
</script>
</div>
}
<h2>
Live Logging</h2>
<h2>Live Logging</h2>
@Html.Partial(MVC.Config.Shared.Views.LogEvents, new Disco.Web.Areas.Config.Models.Shared.LogEventsModel()
{
IsLive = true,
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,18 +28,20 @@ namespace Disco.Web.Areas.Config.Views.Logging
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
#line 2 "..\..\Areas\Config\Views\Logging\Index.cshtml"
using Disco.Services.Logging;
#line default
#line hidden
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Logging/Index.cshtml")]
public partial class Index : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Logging.IndexModel>
public partial class Index : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.Logging.IndexModel>
{
public Index()
{
@@ -49,6 +51,8 @@ namespace Disco.Web.Areas.Config.Views.Logging
#line 3 "..\..\Areas\Config\Views\Logging\Index.cshtml"
Authorization.Require(Claims.Config.Logging.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Logging");
Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-TimePicker");
@@ -58,7 +62,7 @@ namespace Disco.Web.Areas.Config.Views.Logging
WriteLiteral("\r\n");
#line 7 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 9 "..\..\Areas\Config\Views\Logging\Index.cshtml"
using (Html.BeginForm(MVC.API.Logging.RetrieveEvents()))
{
@@ -71,13 +75,13 @@ WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 520px;\"");
WriteLiteral(">\r\n <h2>\r\n Export Logs</h2>\r\n <table>\r\n <tr>\r" +
"\n <th");
WriteLiteral(">\r\n <h2>Export Logs</h2>\r\n <table>\r\n <tr>\r\n " +
" <th");
WriteLiteral(" style=\"width: 105px;\"");
WriteLiteral(">\r\n Start Filter\r\n </th>\r\n <td>\r" +
"\n <input");
WriteLiteral(">Start Filter\r\n </th>\r\n <td>\r\n <" +
"input");
WriteLiteral(" id=\"filterStart\"");
@@ -90,8 +94,8 @@ WriteLiteral(" />\r\n <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">* Optional</span>\r\n </td>\r\n </tr>\r\n <tr>\r\n " +
" <th>\r\n End Filter\r\n </th>\r\n " +
" <td>\r\n <input");
" <th>End Filter\r\n </th>\r\n <td>\r\n " +
" <input");
WriteLiteral(" id=\"filterEnd\"");
@@ -104,8 +108,8 @@ WriteLiteral(" />\r\n <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">* Optional</span>\r\n </td>\r\n </tr>\r\n <tr>\r\n " +
" <th>\r\n Limit Filter\r\n </th>\r\n " +
" <td>\r\n <select");
" <th>Limit Filter\r\n </th>\r\n <td>\r\n " +
" <select");
WriteLiteral(" name=\"Take\"");
@@ -136,9 +140,8 @@ WriteLiteral(">50 Events</option>\r\n <option");
WriteLiteral(" value=\"10\"");
WriteLiteral(">10 Events</option>\r\n </select>\r\n </td>\r\n " +
" </tr>\r\n <tr>\r\n <th>\r\n Module " +
"Filter\r\n </th>\r\n <td>\r\n <select" +
"");
" </tr>\r\n <tr>\r\n <th>Module Filter\r\n " +
" </th>\r\n <td>\r\n <select");
WriteLiteral(" id=\"moduleId\"");
@@ -153,13 +156,13 @@ WriteLiteral(" selected=\"selected\"");
WriteLiteral(">- All Modules -</option>\r\n");
#line 53 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 50 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line default
#line hidden
#line 53 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 50 "..\..\Areas\Config\Views\Logging\Index.cshtml"
foreach (var lm in Model.LogModules.Keys.OrderBy(lm => lm.ModuleDescription))
{
@@ -168,20 +171,20 @@ WriteLiteral(">- All Modules -</option>\r\n");
#line hidden
WriteLiteral(" <option");
WriteAttribute("value", Tuple.Create(" value=\"", 2126), Tuple.Create("\"", 2146)
WriteAttribute("value", Tuple.Create(" value=\"", 2082), Tuple.Create("\"", 2102)
#line 55 "..\..\Areas\Config\Views\Logging\Index.cshtml"
, Tuple.Create(Tuple.Create("", 2134), Tuple.Create<System.Object, System.Int32>(lm.ModuleId
#line 52 "..\..\Areas\Config\Views\Logging\Index.cshtml"
, Tuple.Create(Tuple.Create("", 2090), Tuple.Create<System.Object, System.Int32>(lm.ModuleId
#line default
#line hidden
, 2134), false)
, 2090), false)
);
WriteLiteral(">");
#line 55 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 52 "..\..\Areas\Config\Views\Logging\Index.cshtml"
Write(lm.ModuleDescription);
@@ -190,7 +193,7 @@ WriteLiteral(">");
WriteLiteral("</option> \r\n");
#line 56 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 53 "..\..\Areas\Config\Views\Logging\Index.cshtml"
}
@@ -203,13 +206,13 @@ WriteLiteral(" id=\"trLogModuleEventTypes\"");
WriteLiteral(" style=\"display: none\"");
WriteLiteral(">\r\n <th>\r\n Event Type Filter <span");
WriteLiteral(">\r\n <th>Event Type Filter <span");
WriteLiteral(" style=\"display: block;\"");
WriteLiteral(" class=\"checkboxBulkSelectContainer\"");
WriteLiteral(">\r\n Select: <a");
WriteLiteral(">Select: <a");
WriteLiteral(" id=\"eventTypesSelectAll\"");
@@ -219,18 +222,18 @@ WriteLiteral(">ALL</a> | <a");
WriteLiteral(" id=\"eventTypesSelectNone\"");
WriteLiteral("\r\n href=\"#\"");
WriteLiteral("\r\n href=\"#\"");
WriteLiteral(">NONE</a></span>\r\n </th>\r\n <td>\r\n");
#line 67 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 62 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line default
#line hidden
#line 67 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 62 "..\..\Areas\Config\Views\Logging\Index.cshtml"
int uniqueIdSeed = 0;
@@ -239,13 +242,13 @@ WriteLiteral(">NONE</a></span>\r\n </th>\r\n <td>\
WriteLiteral("\r\n");
#line 69 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 64 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line default
#line hidden
#line 69 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 64 "..\..\Areas\Config\Views\Logging\Index.cshtml"
foreach (var lm in Model.LogModules)
{
@@ -257,7 +260,7 @@ WriteLiteral(" <div");
WriteLiteral(" data-logmoduleid=\"");
#line 71 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 66 "..\..\Areas\Config\Views\Logging\Index.cshtml"
Write(lm.Key.ModuleId);
@@ -272,7 +275,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 72 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 67 "..\..\Areas\Config\Views\Logging\Index.cshtml"
Write(CommonHelpers.CheckBoxList("EventTypeIds", lm.Value.ToSelectListItems(), 2, false, uniqueIdSeed));
@@ -281,20 +284,20 @@ WriteLiteral(" ");
WriteLiteral("\r\n </div>\r\n");
#line 74 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 69 "..\..\Areas\Config\Views\Logging\Index.cshtml"
uniqueIdSeed += lm.Value.Count;
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th>\r" +
"\n </th>\r\n <td>\r\n");
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n <th><" +
"/th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 82 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 76 "..\..\Areas\Config\Views\Logging\Index.cshtml"
Write(Html.Hidden("Format", "CSV"));
@@ -359,16 +362,16 @@ WriteLiteral(">\r\n $(function () {\r\n var filterStar
" </script>\r\n </div>\r\n");
#line 155 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 149 "..\..\Areas\Config\Views\Logging\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("<h2>\r\n Live Logging</h2>\r\n");
WriteLiteral("<h2>Live Logging</h2>\r\n");
#line 158 "..\..\Areas\Config\Views\Logging\Index.cshtml"
#line 151 "..\..\Areas\Config\Views\Logging\Index.cshtml"
Write(Html.Partial(MVC.Config.Shared.Views.LogEvents, new Disco.Web.Areas.Config.Models.Shared.LogEventsModel()
{
IsLive = true,
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -28,12 +28,14 @@ namespace Disco.Web.Areas.Config.Views.Logging
using System.Web.WebPages;
using Disco.BI.Extensions;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Logging/TaskStatus.cshtml")]
public partial class TaskStatus : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Logging.TaskStatusModel>
public partial class TaskStatus : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.Logging.TaskStatusModel>
{
public TaskStatus()
{

Some files were not shown because too many files have changed in this diff Show More