#pragma warning disable 1591 //------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Disco.Web.Views.Device.DeviceParts { using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Web; using System.Web.Helpers; using System.Web.Mvc; using System.Web.Mvc.Ajax; using System.Web.Mvc.Html; using System.Web.Routing; using System.Web.Security; using System.Web.UI; using System.Web.WebPages; using Disco; using Disco.Models.Repository; using Disco.Services; using Disco.Services.Authorization; using Disco.Services.Web; using Disco.Web; using Disco.Web.Extensions; [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")] [System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/DeviceParts/_Resources.cshtml")] public partial class _Resources : Disco.Services.Web.WebViewPage { public _Resources() { } public override void Execute() { #line 2 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Authorization.Require(Claims.Device.ShowAttachments); var canAddAttachments = Authorization.Has(Claims.Device.Actions.AddAttachments); var canRemoveAnyAttachments = Authorization.Has(Claims.Device.Actions.RemoveAnyAttachments); var canRemoveOwnAttachments = Authorization.Has(Claims.Device.Actions.RemoveOwnAttachments); Html.BundleDeferred("~/Style/Shadowbox"); Html.BundleDeferred("~/ClientScripts/Modules/Shadowbox"); if (canAddAttachments) { Html.BundleDeferred("~/ClientScripts/Modules/Disco-AttachmentUploader"); } #line default #line hidden WriteLiteral("\r\n\r\n \r\n \r\n \r\n (canAddAttachments ? "canAddAttachments" : "cannotAddAttachments" #line default #line hidden , 828), false) #line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml" , Tuple.Create(Tuple.Create(" ", 895), Tuple.Create(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments" #line default #line hidden , 896), false) #line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml" , Tuple.Create(Tuple.Create(" ", 981), Tuple.Create(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments" #line default #line hidden , 982), false) ); WriteLiteral(" data-id=\""); #line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Model.Device.SerialNumber); #line default #line hidden WriteLiteral("\""); WriteLiteral(" data-userid=\""); #line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(CurrentUser.UserId); #line default #line hidden WriteLiteral("\""); WriteLiteral(" data-uploadurl=\""); #line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null))); #line default #line hidden WriteLiteral("\""); WriteLiteral(" data-onlineuploadurl=\""); #line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Url.Action(MVC.API.Device.AttachmentOnlineUploadSession(Model.Device.SerialNumber))); #line default #line hidden WriteLiteral("\""); WriteLiteral(" data-qrcodeurl=\""); #line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js")); #line default #line hidden WriteLiteral("\""); WriteLiteral(" data-removeurl=\""); #line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Url.Action(MVC.API.Device.AttachmentRemove())); #line default #line hidden WriteLiteral("\""); WriteLiteral(" data-downloadallurl=\""); #line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Url.Action(MVC.API.Device.AttachmentDownloadAll(Model.Device.SerialNumber))); #line default #line hidden WriteLiteral("\""); WriteLiteral(">\r\n \r\n

Drop Attachments Here

\r\n \r\n \r\n"); #line 26 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line default #line hidden #line 26 "..\..\Views\Device\DeviceParts\_Resources.cshtml" if (Model.Device.DeviceAttachments != null) { foreach (var da in Model.Device.DeviceAttachments.OrderByDescending(a => a.Id)) { #line default #line hidden WriteLiteral(" (Url.Action(MVC.API.Device.AttachmentDownload(da.Id)) #line default #line hidden , 2073), false) ); WriteLiteral(" data-attachmentid=\""); #line 30 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.Id); #line default #line hidden WriteLiteral("\""); WriteLiteral(" data-mimetype=\""); #line 30 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.MimeType); #line default #line hidden WriteLiteral("\""); WriteLiteral(">\r\n (da.Filename #line default #line hidden , 2248), false) ); WriteLiteral(">\r\n (Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id)) #line default #line hidden , 2341), false) ); WriteLiteral(" />\r\n \r\n " + " (da.Comments ?? da.Filename #line default #line hidden , 2514), false) ); WriteLiteral(">\r\n"); #line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line default #line hidden #line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml" if (!string.IsNullOrEmpty(da.DocumentTemplateId)) { #line default #line hidden #line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.DocumentTemplate.Description); #line default #line hidden #line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } else { #line default #line hidden #line 38 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.Comments ?? da.Filename); #line default #line hidden #line 38 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } #line default #line hidden WriteLiteral("\r\n "); #line 39 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.TechUser.ToString()); #line default #line hidden WriteLiteral(""); #line 39 "..\..\Views\Device\DeviceParts\_Resources.cshtml" if (canRemoveAnyAttachments || (canRemoveOwnAttachments && da.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase))) { #line default #line hidden WriteLiteral(""); #line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } #line default #line hidden WriteLiteral("(da.Timestamp.ToFullDateTime() #line default #line hidden , 3206), false) ); WriteLiteral(" data-livestamp=\""); #line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.Timestamp.ToUnixEpoc()); #line default #line hidden WriteLiteral("\""); WriteLiteral(">"); #line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.Timestamp.ToFullDateTime()); #line default #line hidden WriteLiteral("\r\n \r\n"); #line 42 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } } #line default #line hidden WriteLiteral(" \r\n \r\n \r\n"); #line 47 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line default #line hidden #line 47 "..\..\Views\Device\DeviceParts\_Resources.cshtml" if (canAddAttachments) { #line default #line hidden WriteLiteral(" "); WriteLiteral(""); WriteLiteral("\r\n"); #line 50 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } #line default #line hidden WriteLiteral(" "); #line 51 "..\..\Views\Device\DeviceParts\_Resources.cshtml" if (Model.Device.DeviceAttachments != null && Model.Device.DeviceAttachments.Count > 0) { #line default #line hidden WriteLiteral(" \r\n"); #line 54 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } #line default #line hidden WriteLiteral(" \r\n \r\n Shadowbox.init({\r\n skipSetu" + "p: true,\r\n modal: true,\r\n " + "onOpen: function (obj) {\r\n if (obj.player === \'if" + "rame\' && obj.content.indexOf(\'inline=True\') === -1) {\r\n " + " obj.content += (obj.content.indexOf(\'?\') === -1 ? \'?\' : \'&\') + \'inlin" + "e=True\';\r\n }\r\n ret" + "urn true;\r\n },\r\n onChange:" + " function (obj) {\r\n if (obj.player === \'iframe\' &" + "& obj.content.indexOf(\'inline=True\') === -1) {\r\n " + " obj.content += (obj.content.indexOf(\'?\') === -1 ? \'?\' : \'&\') + \'inline=True\'" + ";\r\n }\r\n return tru" + "e;\r\n }\r\n });\r\n " + " $(function () {\r\n const $Attachments = $(\'#At" + "tachments\');\r\n const $attachmentOutput = $Attachments" + ".find(\'.attachmentOutput\');\r\n let $attachmentDownload" + "Host = null;\r\n let $dialogRemoveAttachment = null;\r\n " + " let attachmentUploader = null;\r\n\r\n " + " function onAttachmentAdded(id, quick) {\r\n " + " var data = { id: id };\r\n $.ajax({\r\n " + " url: \'"); #line 83 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Url.Action(MVC.API.Device.Attachment())); #line default #line hidden WriteLiteral("\',\r\n dataType: \'json\',\r\n " + " data: data,\r\n success: function" + " (d) {\r\n if (d.Result == \'OK\') {\r\n " + " var a = d.Attachment;\r\n\r\n " + " if ($Attachments.hasClass(\'canRemoveAnyAttachments\'))\r" + "\n buildAttachment(a, true, quick)" + ";\r\n else if ($Attachments.hasClass(\'c" + "anRemoveOwnAttachments\'))\r\n build" + "Attachment(a, (a.AuthorId === $Attachments.attr(\'data-userid\')), quick);\r\n " + " else\r\n " + " buildAttachment(a, false, quick);\r\n\r\n " + " if (attachmentUploader && attachmentUploader.onlineUploadCloseDialo" + "g) {\r\n attachmentUploader.onlineU" + "ploadCloseDialog();\r\n }\r\n " + " } else {\r\n " + " alert(\'Unable to add attachment: \' + d.Result);\r\n " + " }\r\n },\r\n " + " error: function (jqXHR, textStatus, errorThrown) {\r\n " + " alert(\'Unable to add attachment: \' + textStatus);\r\n " + " }\r\n });\r\n " + " }\r\n\r\n function buildAttachment(a, ca" + "nRemove, quick) {\r\n var t = \'\"Attachment\';\r\n if (canRemove)\r\n " + " t += \'\';\r\n t += \'\'" + ";\r\n\r\n var e = $(t);\r\n\r\n " + " e.attr(\'data-attachmentid\', a.Id).attr(\'data-mimetype\', a.MimeType).attr(\'" + "href\', \'"); #line 118 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Url.Action(MVC.API.Device.AttachmentDownload())); #line default #line hidden WriteLiteral("/\' + a.Id);\r\n e.find(\'.comments\').text(a.Descripti" + "on);\r\n e.find(\'.author\').text(a.Author);\r\n " + " e.find(\'.timestamp\').text(a.TimestampFull).attr(\'title\'" + ", a.TimestampFull).livestamp(a.TimestampUnixEpoc);\r\n " + " if (canRemove)\r\n e.find(\'.remove\').click(" + "removeAttachment);\r\n if (!quick)\r\n " + " e.hide();\r\n $attachmentOutpu" + "t.prepend(e);\r\n onUpdate();\r\n " + " if (!quick)\r\n e.show(\'slow\');\r\n " + " if (a.MimeType.toLowerCase().indexOf(\'image/\') == " + "0)\r\n e.shadowbox({ gallery: \'attachments\', pl" + "ayer: \'img\', title: a.Description });\r\n else if (" + "a.MimeType.toLowerCase().indexOf(\'application/pdf\') == 0 && navigator.pdfViewerE" + "nabled)\r\n e.shadowbox({ gallery: \'attachments" + "\', player: \'iframe\', title: a.Description });\r\n e" + "lse\r\n e.click(onDownload);\r\n\r\n " + " // Add Thumbnail\r\n var buildThum" + "bnail = function () {\r\n var retryCount = 0;\r\n" + " var img = e.find(\'.icon img\');\r\n\r\n " + " var setThumbnailUrl = function () {\r\n " + " img.attr(\'src\', \'"); #line 143 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Url.Action(MVC.API.Device.AttachmentThumbnail())); #line default #line hidden WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n };\r\n " + " img.on(\'error\', function () {\r\n " + " img.addClass(\'loading\');\r\n " + " retryCount++;\r\n if (retryCount < 6)" + "\r\n window.setTimeout(setThumbnailUrl," + " retryCount * 250);\r\n });\r\n " + " img.on(\'load\', function () {\r\n " + " img.removeClass(\'loading\');\r\n });\r\n " + " window.setTimeout(setThumbnailUrl, 100);\r\n " + " };\r\n buildThumbnail()" + ";\r\n }\r\n\r\n function onDownl" + "oad() {\r\n var $this = $(this);\r\n " + " var url = $this.attr(\'href\');\r\n\r\n " + "if ($.connection && $.connection.hub && $.connection.hub.transport &&\r\n " + " $.connection.hub.transport.name == \'foreverFrame\') {\r" + "\n // SignalR active with foreverFrame transpo" + "rt - use popup window\r\n window.open(url, \'_bl" + "ank\', \'height=150,width=250,location=no,menubar=no,resizable=no,scrollbars=no,st" + "atus=no,toolbar=no\');\r\n } else {\r\n " + " // use iFrame\r\n if (!$at" + "tachmentDownloadHost) {\r\n $attachmentDown" + "loadHost = $(\'