#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"); Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR"); 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 , 896), false) ); WriteLiteral(" data-uploadurl=\""); #line 22 "..\..\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 22 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Url.Action(MVC.API.Device.AttachmentOnlineUploadSession(Model.Device.SerialNumber))); #line default #line hidden WriteLiteral("\""); WriteLiteral(" data-qrcodeurl=\""); #line 22 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js")); #line default #line hidden WriteLiteral("\""); WriteLiteral(">\r\n"); WriteLiteral(" "); #line 23 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Html.AntiForgeryToken()); #line default #line hidden WriteLiteral("\r\n \r\n

Drop Attachments Here

\r\n \r\n \r\n"); #line 28 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line default #line hidden #line 28 "..\..\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 , 1777), false) ); WriteLiteral(" data-attachmentid=\""); #line 32 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.Id); #line default #line hidden WriteLiteral("\""); WriteLiteral(" data-mimetype=\""); #line 32 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.MimeType); #line default #line hidden WriteLiteral("\""); WriteLiteral(">\r\n (da.Filename #line default #line hidden , 1948), false) ); WriteLiteral(">\r\n (Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id)) #line default #line hidden , 2037), false) ); WriteLiteral(" />\r\n (da.Comments ?? da.Filename #line default #line hidden , 2168), false) ); WriteLiteral(">\r\n"); #line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line default #line hidden #line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml" if (!string.IsNullOrEmpty(da.DocumentTemplateId)) { #line default #line hidden #line 37 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.DocumentTemplate.Description); #line default #line hidden #line 37 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } else { #line default #line hidden #line 39 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.Comments ?? da.Filename); #line default #line hidden #line 39 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } #line default #line hidden WriteLiteral("\r\n "); #line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.TechUser.ToString()); #line default #line hidden WriteLiteral(""); #line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml" if (canRemoveAnyAttachments || (canRemoveOwnAttachments && da.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase))) { #line default #line hidden WriteLiteral(""); #line 41 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } #line default #line hidden WriteLiteral("(da.Timestamp.ToFullDateTime() #line default #line hidden , 2896), false) ); WriteLiteral(" data-livestamp=\""); #line 41 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.Timestamp.ToUnixEpoc()); #line default #line hidden WriteLiteral("\""); WriteLiteral(">"); #line 41 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(da.Timestamp.ToFullDateTime()); #line default #line hidden WriteLiteral("\r\n \r\n"); #line 43 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } } #line default #line hidden WriteLiteral(" \r\n"); #line 46 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line default #line hidden #line 46 "..\..\Views\Device\DeviceParts\_Resources.cshtml" if (canAddAttachments) { #line default #line hidden WriteLiteral(" \r\n"); WriteLiteral(" \r\n \r\n \r\n"); #line 52 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } #line default #line hidden WriteLiteral(" Shadowbox.init({ skipSetup: true, modal: true }); $(function () { var $Attachments = $('#Attachments'); var $attachmentOutput = $Attachments.find('.attachmentOutput'); var $attachmentDownloadHost; var $dialogRemoveAttachment = null; // Connect to Hub var hub = $.connection.deviceUpdates; // Map Functions hub.client.addAttachment = onAddAttachment; hub.client.removeAttachment = onRemoveAttachment; $.connection.hub.qs = { DeviceSerialNumber: '"); #line 72 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Model.Device.SerialNumber); #line default #line hidden WriteLiteral("\' };\r\n $.connection.hub.error(onHubFailed);\r\n " + " $.connection.hub.disconnected(onHubFailed);\r\n\r\n " + " $.connection.hub.reconnecting(function () {\r\n " + " $(\'#AttachmentsContainer\').find(\'span.action.enabled\').addClass(\'disa" + "bled\');\r\n });\r\n $.connecti" + "on.hub.reconnected(function () {\r\n $(\'#Attachment" + "sContainer\').find(\'span.action.enabled\').removeClass(\'disabled\');\r\n " + " });\r\n\r\n // Start Connection\r\n " + " $.connection.hub.start(function () {\r\n " + " $(\'#AttachmentsContainer\').find(\'span.action.enabled\').removeClass(\'dis" + "abled\');\r\n }).fail(onHubFailed);\r\n\r\n " + " function onHubFailed(error) {\r\n // Dis" + "able UI\r\n $(\'#AttachmentsContainer\').find(\'span.a" + "ction.enabled\').addClass(\'disabled\');\r\n\r\n // Show" + " Dialog Message\r\n if ($(\'.disconnected-dialog\').l" + "ength == 0) {\r\n $(\'
\')\r\n " + " .addClass(\'dialog disconnected-dialog\')\r\n " + " .html(\'

Disconne" + "cted from the Disco ICT Server

This page is not receiving live updates." + " Please ensure you are connected to the server, then refresh this page to enable" + " features.
\')\r\n .dialog({\r\n " + " resizable: false,\r\n " + " title: \'Disconnected\',\r\n " + " width: 400,\r\n modal: true,\r\n " + " buttons: {\r\n " + " \'Refresh Now\': function () {\r\n " + " $(this).dialog(\'option\', \'buttons\', null);\r\n " + " window.location.reload(true);\r\n " + " },\r\n " + " \'Close\': function () {\r\n " + " $(this).dialog(\'destroy\');\r\n " + " }\r\n }\r\n " + " });\r\n }\r\n " + "}\r\n\r\n function onAddAttachment(id, quick) {\r\n " + " var data = { id: id };\r\n " + "$.ajax({\r\n url: \'"); #line 118 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Url.Action(MVC.API.Device.Attachment())); #line default #line hidden WriteLiteral(@"', dataType: 'json', data: data, success: function (d) { if (d.Result == 'OK') { var a = d.Attachment; "); #line 124 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line default #line hidden #line 124 "..\..\Views\Device\DeviceParts\_Resources.cshtml" if (canRemoveAnyAttachments) { #line default #line hidden WriteLiteral(" "); WriteLiteral("buildAttachment(a, true, quick);"); WriteLiteral("\r\n"); #line 127 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } else if (canRemoveOwnAttachments) { #line default #line hidden WriteLiteral(" "); WriteLiteral("buildAttachment(a, (a.AuthorId === \'"); #line 130 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(CurrentUser.UserId); #line default #line hidden WriteLiteral("\'), quick);"); WriteLiteral("\r\n"); #line 131 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } else { #line default #line hidden WriteLiteral(" "); WriteLiteral("buildAttachment(a, false, quick);"); WriteLiteral("\r\n"); #line 135 "..\..\Views\Device\DeviceParts\_Resources.cshtml" } #line default #line hidden WriteLiteral(@" } else { alert('Unable to add attachment: ' + d.Result); } }, error: function (jqXHR, textStatus, errorThrown) { alert('Unable to add attachment: ' + textStatus); } }); } function buildAttachment(a, canRemove, quick) { var t = ''; if (canRemove) t += ''; t += ''; var e = $(t); e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '"); #line 154 "..\..\Views\Device\DeviceParts\_Resources.cshtml" Write(Url.Action(MVC.API.Device.AttachmentDownload())); #line default #line hidden WriteLiteral(@"/' + a.Id); e.find('.comments').text(a.Description); e.find('.author').text(a.Author); e.find('.timestamp').text(a.TimestampFull).attr('title', a.TimestampFull).livestamp(a.TimestampUnixEpoc); if (canRemove) e.find('.remove').click(removeAttachment); if (!quick) e.hide(); $attachmentOutput.prepend(e); onUpdate(); if (!quick) e.show('slow'); if (a.MimeType.toLowerCase().indexOf('image/') == 0) e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description }); else e.click(onDownload); // Add Thumbnail var buildThumbnail = function () { var retryCount = 0; var img = e.find('.icon img'); var setThumbnailUrl = function () { img.attr('src', '"); #line 177 "..\..\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 onRemov" + "eAttachment(id) {\r\n var a = $attachmentOutput.fin" + "d(\'a[data-attachmentid=\' + id + \']\');\r\n\r\n a.hide(" + "300).delay(300).queue(function () {\r\n var $th" + "is = $(this);\r\n if ($this.attr(\'data-mimetype" + "\').toLowerCase().indexOf(\'image/\') == 0)\r\n " + " Shadowbox.removeCache(this);\r\n $this.find(\'" + ".timestamp\').livestamp(\'destroy\');\r\n $this.re" + "move();\r\n onUpdate();\r\n " + " });\r\n }\r\n\r\n func" + "tion onDownload() {\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.transpor" + "t.name == \'foreverFrame\') {\r\n // SignalR acti" + "ve with foreverFrame transport - use popup window\r\n " + " window.open(url, \'_blank\', \'height=150,width=250,location=no,menubar=no,r" + "esizable=no,scrollbars=no,status=no,toolbar=no\');\r\n " + " } else {\r\n // use iFrame\r\n " + " if (!$attachmentDownloadHost) {\r\n " + " $attachmentDownloadHost = $(\'