GIT: perform LF normalization

This commit is contained in:
Gary Sharp
2013-02-28 17:15:46 +11:00
parent 989f08a24d
commit 7d9be5620d
729 changed files with 300734 additions and 300712 deletions
@@ -1,54 +1,54 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.Services.Plugins;
namespace Disco.Web.Controllers
{
public partial class PluginWebHandlerController : Controller
{
[Authorize(Roles = "Admin")]
[OutputCache(Duration = 0, Location = System.Web.UI.OutputCacheLocation.None)]
public virtual ActionResult Index(string PluginId, string PluginAction)
{
var manifest = Plugins.GetPlugin(PluginId);
if (manifest.HasWebHandler)
{
using (var pluginWebHandler = manifest.CreateWebHandler(this))
{
return pluginWebHandler.ExecuteAction(PluginAction);
}
}
return HttpNotFound("Plugin has no Web Handler");
}
[OutputCache(Duration = 2592000, Location = System.Web.UI.OutputCacheLocation.Any, VaryByParam = "*")]
public virtual ActionResult Resource(string PluginId, string res, bool? Download)
{
var manifest = Plugins.GetPlugin(PluginId);
Tuple<string, string> pluginResource;
try
{
pluginResource = manifest.WebResourcePath(res);
}
catch (FileNotFoundException)
{
return HttpNotFound("Plugin Resource Not Found");
}
var pluginResourcePath = pluginResource.Item1;
var mimeType = Disco.BI.Interop.MimeTypes.ResolveMimeType(pluginResourcePath);
if (Download.HasValue && Download.Value)
return File(pluginResourcePath, mimeType, Path.GetFileName(pluginResourcePath));
else
return File(pluginResourcePath, mimeType);
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.Services.Plugins;
namespace Disco.Web.Controllers
{
public partial class PluginWebHandlerController : Controller
{
[Authorize(Roles = "Admin")]
[OutputCache(Duration = 0, Location = System.Web.UI.OutputCacheLocation.None)]
public virtual ActionResult Index(string PluginId, string PluginAction)
{
var manifest = Plugins.GetPlugin(PluginId);
if (manifest.HasWebHandler)
{
using (var pluginWebHandler = manifest.CreateWebHandler(this))
{
return pluginWebHandler.ExecuteAction(PluginAction);
}
}
return HttpNotFound("Plugin has no Web Handler");
}
[OutputCache(Duration = 2592000, Location = System.Web.UI.OutputCacheLocation.Any, VaryByParam = "*")]
public virtual ActionResult Resource(string PluginId, string res, bool? Download)
{
var manifest = Plugins.GetPlugin(PluginId);
Tuple<string, string> pluginResource;
try
{
pluginResource = manifest.WebResourcePath(res);
}
catch (FileNotFoundException)
{
return HttpNotFound("Plugin Resource Not Found");
}
var pluginResourcePath = pluginResource.Item1;
var mimeType = Disco.BI.Interop.MimeTypes.ResolveMimeType(pluginResourcePath);
if (Download.HasValue && Download.Value)
return File(pluginResourcePath, mimeType, Path.GetFileName(pluginResourcePath));
else
return File(pluginResourcePath, mimeType);
}
}
}
+149 -149
View File
@@ -1,149 +1,149 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.Data.Repository;
using Disco.Models.Repository;
namespace Disco.Web.Controllers
{
public partial class SearchController : dbAdminController
{
#region Query
public virtual ActionResult Query(string term, string limit = null, bool searchDetails = false)
{
term = term.Trim();
int termInt;
if (!int.TryParse(term, out termInt))
termInt = -1;
var m = new Models.Search.QueryModel() { Term = term };
if (string.IsNullOrEmpty(term))
{
m.Success = false;
m.ErrorMessage = "A search term is required";
return View(m);
}
m.Success = true;
using (dbContext = new DiscoDataContext())
{
if (limit == null)
{
if (term.Length < 2 && termInt < 0) // < 2 Characters && Not a Number
{
m.Success = false;
m.ErrorMessage = "A search term of at least two characters is required";
return View(m);
}
m.Devices = BI.DeviceBI.Searching.Search(dbContext, term);
m.Jobs = BI.JobBI.Searching.Search(dbContext, term, null, true, searchDetails);
m.Users = BI.UserBI.Searching.Search(dbContext, term);
}
else
{
switch (limit.ToLower())
{
case "devicemodel":
int deviceModelId;
if (int.TryParse(term, out deviceModelId))
{
var vm = dbContext.DeviceModels.Find(deviceModelId);
if (vm != null)
{
m.FriendlyTerm = string.Format("Device Model: {0}", vm.ToString());
m.Devices = BI.DeviceBI.Searching.SearchDeviceModel(dbContext, vm.Id);
break;
}
}
m.FriendlyTerm = string.Format("Device Model: {0}", term);
m.Success = false;
m.ErrorMessage = "Invalid Device Model Id";
break;
case "deviceprofile":
int deviceProfileId;
if (int.TryParse(term, out deviceProfileId))
{
var dp = dbContext.DeviceProfiles.Find(deviceProfileId);
if (dp != null)
{
m.FriendlyTerm = string.Format("Device Profile: {0}", dp.ToString());
m.Devices = BI.DeviceBI.Searching.SearchDeviceProfile(dbContext, dp.Id);
break;
}
}
m.FriendlyTerm = string.Format("Device Profile: {0}", term);
m.Success = false;
m.ErrorMessage = "Invalid Device Profile Id";
break;
case "devicebatch":
int deviceBatchId;
if (int.TryParse(term, out deviceBatchId))
{
var db = dbContext.DeviceBatches.Find(deviceBatchId);
if (db != null)
{
m.FriendlyTerm = string.Format("Device Batch: {0}", db.ToString());
m.Devices = BI.DeviceBI.Searching.SearchDeviceBatch(dbContext, db.Id);
break;
}
}
m.FriendlyTerm = string.Format("Device Batch: {0}", term);
m.Success = false;
m.ErrorMessage = "Invalid Device Batch Id";
break;
case "devices":
if (term.Length < 2)
{
m.Success = false;
m.ErrorMessage = "A search term of at least two characters is required";
return View(m);
}
m.Devices = BI.DeviceBI.Searching.Search(dbContext, term);
if (m.Devices.Count == 1)
{
return RedirectToAction(MVC.Device.Show(m.Devices[0].SerialNumber));
}
break;
case "jobs":
if (term.Length < 2 && termInt < 0)
{
m.Success = false;
m.ErrorMessage = "A search term of at least two characters is required";
return View(m);
}
if (termInt >= 0)
{ // Term is a Number - Check for JobId
if (dbContext.Jobs.Count(j => j.Id == termInt) == 1)
{
return RedirectToAction(MVC.Job.Show(termInt));
}
}
m.Jobs = BI.JobBI.Searching.Search(dbContext, term, null, true, searchDetails);
break;
case "users":
if (term.Length < 2)
{
m.Success = false;
m.ErrorMessage = "A search term of at least two characters is required";
return View(m);
}
m.Users = BI.UserBI.Searching.Search(dbContext, term);
if (m.Users.Count == 1)
{
return RedirectToAction(MVC.User.Show(m.Users[0].Id));
}
break;
}
}
}
return View(m);
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.BI;
using Disco.Data.Repository;
using Disco.Models.Repository;
namespace Disco.Web.Controllers
{
public partial class SearchController : dbAdminController
{
#region Query
public virtual ActionResult Query(string term, string limit = null, bool searchDetails = false)
{
term = term.Trim();
int termInt;
if (!int.TryParse(term, out termInt))
termInt = -1;
var m = new Models.Search.QueryModel() { Term = term };
if (string.IsNullOrEmpty(term))
{
m.Success = false;
m.ErrorMessage = "A search term is required";
return View(m);
}
m.Success = true;
using (dbContext = new DiscoDataContext())
{
if (limit == null)
{
if (term.Length < 2 && termInt < 0) // < 2 Characters && Not a Number
{
m.Success = false;
m.ErrorMessage = "A search term of at least two characters is required";
return View(m);
}
m.Devices = BI.DeviceBI.Searching.Search(dbContext, term);
m.Jobs = BI.JobBI.Searching.Search(dbContext, term, null, true, searchDetails);
m.Users = BI.UserBI.Searching.Search(dbContext, term);
}
else
{
switch (limit.ToLower())
{
case "devicemodel":
int deviceModelId;
if (int.TryParse(term, out deviceModelId))
{
var vm = dbContext.DeviceModels.Find(deviceModelId);
if (vm != null)
{
m.FriendlyTerm = string.Format("Device Model: {0}", vm.ToString());
m.Devices = BI.DeviceBI.Searching.SearchDeviceModel(dbContext, vm.Id);
break;
}
}
m.FriendlyTerm = string.Format("Device Model: {0}", term);
m.Success = false;
m.ErrorMessage = "Invalid Device Model Id";
break;
case "deviceprofile":
int deviceProfileId;
if (int.TryParse(term, out deviceProfileId))
{
var dp = dbContext.DeviceProfiles.Find(deviceProfileId);
if (dp != null)
{
m.FriendlyTerm = string.Format("Device Profile: {0}", dp.ToString());
m.Devices = BI.DeviceBI.Searching.SearchDeviceProfile(dbContext, dp.Id);
break;
}
}
m.FriendlyTerm = string.Format("Device Profile: {0}", term);
m.Success = false;
m.ErrorMessage = "Invalid Device Profile Id";
break;
case "devicebatch":
int deviceBatchId;
if (int.TryParse(term, out deviceBatchId))
{
var db = dbContext.DeviceBatches.Find(deviceBatchId);
if (db != null)
{
m.FriendlyTerm = string.Format("Device Batch: {0}", db.ToString());
m.Devices = BI.DeviceBI.Searching.SearchDeviceBatch(dbContext, db.Id);
break;
}
}
m.FriendlyTerm = string.Format("Device Batch: {0}", term);
m.Success = false;
m.ErrorMessage = "Invalid Device Batch Id";
break;
case "devices":
if (term.Length < 2)
{
m.Success = false;
m.ErrorMessage = "A search term of at least two characters is required";
return View(m);
}
m.Devices = BI.DeviceBI.Searching.Search(dbContext, term);
if (m.Devices.Count == 1)
{
return RedirectToAction(MVC.Device.Show(m.Devices[0].SerialNumber));
}
break;
case "jobs":
if (term.Length < 2 && termInt < 0)
{
m.Success = false;
m.ErrorMessage = "A search term of at least two characters is required";
return View(m);
}
if (termInt >= 0)
{ // Term is a Number - Check for JobId
if (dbContext.Jobs.Count(j => j.Id == termInt) == 1)
{
return RedirectToAction(MVC.Job.Show(termInt));
}
}
m.Jobs = BI.JobBI.Searching.Search(dbContext, term, null, true, searchDetails);
break;
case "users":
if (term.Length < 2)
{
m.Success = false;
m.ErrorMessage = "A search term of at least two characters is required";
return View(m);
}
m.Users = BI.UserBI.Searching.Search(dbContext, term);
if (m.Users.Count == 1)
{
return RedirectToAction(MVC.User.Show(m.Users[0].Id));
}
break;
}
}
}
return View(m);
}
#endregion
}
}