Files
Disco/Disco.Web/Views/Job/JobParts/Resources.generated.cs
T

1345 lines
56 KiB
C#

#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.Job.JobParts
{
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/Job/JobParts/Resources.cshtml")]
public partial class Resources : Disco.Services.Web.WebViewPage<Disco.Web.Models.Job.ShowModel>
{
public Resources()
{
}
public override void Execute()
{
#line 2 "..\..\Views\Job\JobParts\Resources.cshtml"
Authorization.RequireAny(Claims.Job.ShowLogs, Claims.Job.ShowAttachments);
var canShowLogs = Authorization.Has(Claims.Job.ShowLogs);
var canShowAttachments = Authorization.Has(Claims.Job.ShowAttachments);
var canAddLogs = Authorization.Has(Claims.Job.Actions.AddLogs);
var canRemoveAnyLogs = Authorization.Has(Claims.Job.Actions.RemoveAnyLogs);
var canRemoveOwnLogs = Authorization.Has(Claims.Job.Actions.RemoveOwnLogs);
var canAddAttachments = Authorization.Has(Claims.Job.Actions.AddAttachments);
var canRemoveAnyAttachments = Authorization.Has(Claims.Job.Actions.RemoveAnyAttachments);
var canRemoveOwnAttachments = Authorization.Has(Claims.Job.Actions.RemoveOwnAttachments);
if (canShowAttachments)
{
Html.BundleDeferred("~/Style/Shadowbox");
Html.BundleDeferred("~/ClientScripts/Modules/Shadowbox");
}
if (canAddAttachments)
{
Html.BundleDeferred("~/ClientScripts/Modules/Disco-AttachmentUploader");
}
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
#line default
#line hidden
WriteLiteral("\r\n<table");
WriteLiteral(" id=\"jobShowResources\"");
WriteLiteral(">\r\n <tr");
WriteAttribute("class", Tuple.Create(" class=\"", 1169), Tuple.Create("\"", 1297)
#line 28 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1177), Tuple.Create<System.Object, System.Int32>(canShowLogs ? "canShowLogs" : "cannotShowLogs"
#line default
#line hidden
, 1177), false)
#line 28 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 1226), Tuple.Create<System.Object, System.Int32>(canShowAttachments ? "canShowAttachments" : "cannotShowAttachments"
#line default
#line hidden
, 1227), false)
);
WriteLiteral(">\r\n");
#line 29 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 29 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs)
{
#line default
#line hidden
WriteLiteral(" <td");
WriteLiteral(" id=\"CommentsContainer\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"Comments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 1414), Tuple.Create("\"", 1598)
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1422), Tuple.Create<System.Object, System.Int32>(canAddLogs ? "canAddLogs" : "cannotAddLogs"
#line default
#line hidden
, 1422), false)
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 1468), Tuple.Create<System.Object, System.Int32>(canRemoveAnyLogs ? "canRemoveAnyLogs" : "cannotRemoveAnyLogs"
#line default
#line hidden
, 1469), false)
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 1533), Tuple.Create<System.Object, System.Int32>(canRemoveOwnLogs ? "canRemoveOwnLogs" : "cannotRemoveOwnLogs"
#line default
#line hidden
, 1534), false)
);
WriteLiteral(" data-jobid=\"");
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-addurl=\"");
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.CommentAdd(Model.Job.Id)));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-removeurl=\"");
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.CommentRemove()));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-geturl=\"");
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.Comment()));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-userid=\"");
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(CurrentUser.UserId);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" class=\"commentOutput\"");
WriteLiteral(">\r\n");
#line 34 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 34 "..\..\Views\Job\JobParts\Resources.cshtml"
foreach (var jl in Model.Job.JobLogs.OrderBy(m => m.Timestamp))
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" data-logid=\"");
#line 36 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 37 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.TechUser.ToStringFriendly());
#line default
#line hidden
WriteLiteral("</span>");
#line 37 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>");
#line 38 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\"");
WriteLiteral(" data-livestamp=\"");
#line 38 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Timestamp.ToUnixEpoc());
#line default
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2435), Tuple.Create("\"", 2473)
#line 38 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2443), Tuple.Create<System.Object, System.Int32>(jl.Timestamp.ToFullDateTime()
#line default
#line hidden
, 2443), false)
);
WriteLiteral(">");
#line 38 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Timestamp.ToFullDateTime());
#line default
#line hidden
WriteLiteral("</span>\r\n <div");
WriteLiteral(" class=\"comment\"");
WriteLiteral(">");
#line 39 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Comments.ToHtmlComment());
#line default
#line hidden
WriteLiteral("</div>\r\n </div>\r\n");
#line 41 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
#line 43 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 43 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddLogs)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"commentInput clearfix\"");
WriteLiteral(">\r\n <textarea");
WriteLiteral(" class=\"commentInput\"");
WriteLiteral(" placeholder=\"add comment...\"");
WriteLiteral(" accesskey=\"l\"");
WriteLiteral("></textarea>\r\n <span");
WriteLiteral(" class=\"action post commentInputPost fa fa-comment disabled\"");
WriteLiteral(" title=\"Add Comment\"");
WriteLiteral("></span>\r\n </div>\r\n");
#line 49 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n </td>\r\n");
#line 52 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 53 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments)
{
#line default
#line hidden
WriteLiteral(" <td");
WriteLiteral(" id=\"AttachmentsContainer\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"Attachments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 3289), Tuple.Create("\"", 3536)
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3297), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line default
#line hidden
, 3297), false)
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 3364), Tuple.Create<System.Object, System.Int32>(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments"
#line default
#line hidden
, 3365), false)
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 3450), Tuple.Create<System.Object, System.Int32>(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments"
#line default
#line hidden
, 3451), false)
);
WriteLiteral(" data-userid=\"");
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(CurrentUser.UserId);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-uploadurl=\"");
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-onlineuploadurl=\"");
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentOnlineUploadSession(Model.Job.Id)));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-qrcodeurl=\"");
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js"));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-removeurl=\"");
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentRemove()));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" class=\"Disco-AttachmentUpload-DropTarget\"");
WriteLiteral(">\r\n <h2>Drop Attachments Here</h2>\r\n </" +
"div>\r\n <div");
WriteLiteral(" class=\"attachmentOutput\"");
WriteLiteral(">\r\n");
#line 61 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 61 "..\..\Views\Job\JobParts\Resources.cshtml"
foreach (var ja in Model.Job.JobAttachments.OrderByDescending(a => a.Id))
{
#line default
#line hidden
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 4250), Tuple.Create("\"", 4307)
#line 63 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4257), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
#line default
#line hidden
, 4257), false)
);
WriteLiteral(" data-attachmentid=\"");
#line 63 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-mimetype=\"");
#line 63 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.MimeType);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"icon\"");
WriteAttribute("title", Tuple.Create(" title=\"", 4417), Tuple.Create("\"", 4437)
#line 64 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4425), Tuple.Create<System.Object, System.Int32>(ja.Filename
#line default
#line hidden
, 4425), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 4508), Tuple.Create("\"", 4567)
#line 65 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4514), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
#line default
#line hidden
, 4514), false)
);
WriteLiteral(" />\r\n </span>\r\n <sp" +
"an");
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 4668), Tuple.Create("\"", 4688)
#line 67 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4676), Tuple.Create<System.Object, System.Int32>(ja.Comments
#line default
#line hidden
, 4676), false)
);
WriteLiteral(">\r\n");
#line 68 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 68 "..\..\Views\Job\JobParts\Resources.cshtml"
if (!string.IsNullOrEmpty(ja.DocumentTemplateId))
{
#line default
#line hidden
#line 69 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.DocumentTemplate.Description);
#line default
#line hidden
#line 69 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else
{
#line default
#line hidden
#line 71 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.Comments ?? ja.Filename);
#line default
#line hidden
#line 71 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n </span><span");
WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 72 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.TechUser.ToStringFriendly());
#line default
#line hidden
WriteLiteral("</span>");
#line 72 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ja.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>");
#line 73 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\"");
WriteLiteral(" data-livestamp=\"");
#line 73 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.Timestamp.ToUnixEpoc());
#line default
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 5373), Tuple.Create("\"", 5411)
#line 73 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 5381), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime()
#line default
#line hidden
, 5381), false)
);
WriteLiteral(">");
#line 73 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(ja.Timestamp.ToFullDateTime());
#line default
#line hidden
WriteLiteral("</span>\r\n </a>\r\n");
#line 75 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
#line 77 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 77 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"Disco-AttachmentUpload-Progress\"");
WriteLiteral("></div>\r\n");
WriteLiteral(" <div");
WriteLiteral(" class=\"attachmentInput clearfix\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"action enabled upload fa fa-upload disabled\"");
WriteLiteral(" title=\"Attach File\"");
WriteLiteral("></span><span");
WriteLiteral(" class=\"action enabled photo fa fa-camera disabled\"");
WriteLiteral(" title=\"Capture Image\"");
WriteLiteral("></span><span");
WriteLiteral(" class=\"action enabled online-upload fa fa-qrcode disabled\"");
WriteLiteral(" title=\"Upload with Online Services\"");
WriteLiteral("></span>\r\n </div>\r\n");
#line 83 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n </td>\r\n");
#line 86 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </tr>\r\n</table>\r\n");
#line 89 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs)
{
#line default
#line hidden
WriteLiteral(@" <script>
if (!document.DiscoFunctions) {
document.DiscoFunctions = {};
}
$(function () {
//#region Comments
const $Comments = $('#Comments');
const jobId = parseInt($Comments.attr('data-jobid'));
const $CommentOutput = $Comments.find('.commentOutput');
const $CommentOutputContainer = $Comments.find('.commentOutputContainer');
window.setTimeout(function () {
$CommentOutput[0].scrollTop = $CommentOutput[0].scrollHeight; // Scroll to Bottom
}, 0);
$('#jobDetailTabs').on('tabsactivate', function (event, ui) {
if (ui.newPanel && ui.newPanel.is('#jobDetailTab-Resources')) {
$CommentOutput[0].scrollTop = $CommentOutput[0].scrollHeight; // Scroll to Bottom
}
});
");
#line 113 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 113 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddLogs)
{
#line default
#line hidden
WriteLiteral("\r\n //#region Add Logs\r\n\r\n const $CommentInput = $Comments.f" +
"ind(\'textarea.commentInput\');\r\n const $CommentInputPost = $Comments.f" +
"ind(\'.commentInputPost\');\r\n $CommentInputPost.on(\'click\', postComment" +
");\r\n $CommentInput.on(\'keypress\', function (e) {\r\n if " +
"(e.which == 13 && !e.shiftKey) {\r\n postComment();\r\n " +
" return false;\r\n }\r\n });\r\n\r\n async" +
" function postComment() {\r\n if ($CommentInputPost.hasClass(\'disab" +
"led\')) {\r\n alert(\'Disconnected from the Disco ICT Server, ple" +
"ase refresh this page and try again\');\r\n return;\r\n " +
" }\r\n\r\n const comment = $CommentInput.val();\r\n\r\n " +
" if (comment == \'\') {\r\n alert(\'Enter a comment to post\');\r\n " +
" $CommentInput.focus();\r\n return;\r\n " +
" }\r\n\r\n $CommentInput.prop(\'disabled\', true);\r\n\r\n " +
" const formData = new FormData();\r\n formData.append(\'__Reque" +
"stVerificationToken\', document.body.dataset.antiforgery);\r\n formD" +
"ata.append(\'comment\', comment);\r\n\r\n const response = await fetch(" +
"$Comments.attr(\'data-addurl\'), {\r\n method: \'POST\',\r\n " +
" body: formData\r\n });\r\n\r\n if (response.o" +
"k) {\r\n $CommentInput.val(\'\').prop(\'disabled\', false).focus();" +
"\r\n } else {\r\n alert(\'Unable to add comment: \' " +
"+ response.statusText);\r\n $CommentInput.prop(\'disabled\', fals" +
"e).focus();\r\n }\r\n }\r\n\r\n //#endregion\r\n " +
" ");
#line 161 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 162 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs || canRemoveOwnLogs)
{
#line default
#line hidden
WriteLiteral(@"
//#region Remove Logs
let $dialogRemoveLog = null;
$CommentOutput.on('click', 'span.remove', removePost);
async function removeComment(commentId) {
const formData = new FormData();
formData.append('__RequestVerificationToken', document.body.dataset.antiforgery);
formData.append('id', commentId);
const response = await fetch($Comments.attr('data-removeurl'), {
method: 'POST',
body: formData
});
if (!response.ok) {
alert('Unable to remove comment: ' + response.statusText);
}
$dialogRemoveLog.dialog(""close"");
}
function removePost(e) {
e.preventDefault();
$this = $(this);
const commentId = $this.closest('div').attr('data-logid');
if (!$dialogRemoveLog) {
$dialogRemoveLog = $('<div");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Remove this Comment?\"");
WriteLiteral("><p><i");
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral(@"></i>&nbsp;Are you sure?</p></div>')
.appendTo(document.body)
.dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
}
$dialogRemoveLog.dialog(""enable"").dialog('option', 'buttons', {
""Remove"": function () {
$dialogRemoveLog.dialog(""disable"");
$dialogRemoveLog.dialog(""option"", ""buttons"", null);
removeComment(commentId);
},
""Cancel"": function () {
$dialogRemoveLog.dialog(""close"");
}
}).dialog('open');
}
//#endregion
");
#line 217 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n async function loadLiveComment(id) {\r\n\r\n const formD" +
"ata = new FormData();\r\n formData.append(\'__RequestVerificationTok" +
"en\', document.body.dataset.antiforgery);\r\n formData.append(\'id\', " +
"id);\r\n\r\n const response = await fetch($Comments.attr(\'data-geturl" +
"\'), {\r\n method: \'POST\',\r\n body: formData\r\n" +
" });\r\n\r\n if (!response.ok) {\r\n " +
"alert(\'Unable to load live comment \' + id + \': \' + response.statusText);\r\n " +
" } else {\r\n const comment = await response.json();\r\n" +
"\r\n if ($Comments.hasClass(\'canRemoveAnyLogs\'))\r\n " +
" addComment(comment, false, true);\r\n else if ($Comm" +
"ents.hasClass(\'canRemoveOwnLogs\'))\r\n addComment(comment, " +
"false, (comment.AuthorId === $Comments.attr(\'data-userid\')));\r\n " +
" else\r\n addComment(comment, false, false);\r\n " +
" }\r\n }\r\n function liveRemoveComment(id) {\r\n " +
" $CommentOutput.children(\'div[data-logid=\"\' + id + \'\"]\').slideUp(300).delay(" +
"300).queue(function () {\r\n const $this = $(this);\r\n " +
" $this.find(\'.timestamp\').livestamp(\'destroy\');\r\n $t" +
"his.remove();\r\n });\r\n }\r\n function addComme" +
"nt(c, quick, canRemove) {\r\n let t = \'<div><span class=\"author\" />" +
"\';\r\n if (canRemove)\r\n t += \'<span class=\"remov" +
"e fa fa-times-circle\" />\';\r\n t += \'<span class=\"timestamp\" /><div" +
" class=\"comment\" /></div>\';\r\n\r\n const e = $(t);\r\n " +
"e.attr(\'data-logid\', c.Id);\r\n e.find(\'.author\').text(c.Author);\r\n" +
" e.find(\'.timestamp\').text(c.TimestampFull).attr(\'title\', c.Times" +
"tampFull).livestamp(c.TimestampUnixEpoc);\r\n e.find(\'.comment\').ht" +
"ml(c.HtmlComments);\r\n\r\n $CommentOutput.append(e);\r\n\r\n " +
" if (!quick) {\r\n e.animate({ backgroundColor: \'#ffff99\' }," +
" 500, function () {\r\n e.animate({ backgroundColor: \'#fafa" +
"fa\' }, 500, function () {\r\n e.css(\'background-color\'," +
" \'\');\r\n });\r\n });\r\n " +
" $CommentOutput.animate({ scrollTop: $CommentOutput[0].scrollHeight }, 250)\r\n " +
" }\r\n }\r\n\r\n // Add Globally Available Functions" +
"\r\n document.DiscoFunctions.liveLoadComment = function (id) {\r\n " +
" loadLiveComment(id);\r\n };\r\n document.DiscoFunctio" +
"ns.liveRemoveComment = liveRemoveComment;\r\n //#endregion\r\n });" +
"\r\n </script>\r\n");
#line 282 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 283 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments)
{
#line default
#line hidden
WriteLiteral(@" <script>
Shadowbox.init({
skipSetup: true,
modal: true
});
if (!document.DiscoFunctions) {
document.DiscoFunctions = {};
}
$(function () {
var jobId = parseInt('");
#line 296 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id);
#line default
#line hidden
WriteLiteral("\');\r\n\r\n //#region Attachments\r\n var $Attachments = $(\'#Atta" +
"chments\');\r\n var $attachmentOutput = $Attachments.find(\'.attachmentOu" +
"tput\');\r\n let attachmentUploader = null;\r\n\r\n");
#line 303 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 303 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral("\r\n //#region Add Attachments\r\n attachmentUploader = new doc" +
"ument.Disco.AttachmentUploader($Attachments);\r\n\r\n var $attachmentInpu" +
"t = $Attachments.find(\'.attachmentInput\');\r\n $attachmentInput.find(\'." +
"online-upload\').on(\'click\', function () {\r\n if ($(this).hasClass(" +
"\'disabled\'))\r\n alert(\'Disconnected from the Disco ICT Server," +
" please refresh this page and try again\');\r\n else\r\n " +
" attachmentUploader.onlineUpload();\r\n });\r\n if (windo" +
"w.location.protocol != \'https:\') {\r\n $attachmentInput.find(\'.phot" +
"o\')\r\n .removeClass(\'enabled\')\r\n .addClass(" +
"\'disabled\')\r\n .attr(\'title\', \'Capture Image: this functionali" +
"ty is only available over a HTTPS connection\');\r\n }\r\n $att" +
"achmentInput.find(\'.photo\').click(function () {\r\n if (!$(this).ha" +
"sClass(\'enabled\'))\r\n alert(\'This functionality is only availa" +
"ble over a HTTPS connection\');\r\n else if ($(this).hasClass(\'disab" +
"led\'))\r\n alert(\'Disconnected from the Disco ICT Server, pleas" +
"e refresh this page and try again\');\r\n else\r\n " +
"attachmentUploader.uploadImage();\r\n });\r\n $attachmentInput" +
".find(\'.upload\').click(function () {\r\n if ($(this).hasClass(\'disa" +
"bled\'))\r\n alert(\'Disconnected from the Disco ICT Server, plea" +
"se refresh this page and try again\');\r\n else\r\n " +
" attachmentUploader.uploadFiles();\r\n });\r\n\r\n var resources" +
"Tab;\r\n $(document).on(\'dragover\', function () {\r\n if (" +
"!resourcesTab) {\r\n var tabs = $Attachments.closest(\'.ui-tabs\'" +
");\r\n resourcesTab = {\r\n tabs: tabs,\r\n " +
" resourcesIndex: tabs.children(\'ul.ui-tabs-nav\').find(\'a[h" +
"ref=\"#jobDetailTab-Resources\"]\').closest(\'li\').index()\r\n };\r\n" +
" }\r\n var selectedIndex = resourcesTab.tabs.tabs(\'o" +
"ption\', \'active\');\r\n if (resourcesTab.resourcesIndex !== selected" +
"Index)\r\n resourcesTab.tabs.tabs(\'option\', \'active\', resources" +
"Tab.resourcesIndex);\r\n });\r\n //#endregion\r\n ");
#line 350 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n");
#line 352 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 352 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral(@"
//#region Remove Attachments
var $dialogRemoveAttachment;
$attachmentOutput.find('span.remove').click(removeLocalAttachment);
function removeLocalAttachment() {
$this = $(this).closest('a');
if (!$dialogRemoveAttachment) {
$dialogRemoveAttachment = $('<div");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Remove this Attachment?\"");
WriteLiteral("><p><i");
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?</p></div>\')\r\n .appendTo(document." +
"body)\r\n .dialog({\r\n resizable:" +
" false,\r\n height: 140,\r\n m" +
"odal: true,\r\n autoOpen: false\r\n " +
" });\r\n }\r\n\r\n async function removeAttachmentAsync" +
"(id) {\r\n const body = new FormData();\r\n bo" +
"dy.append(\'__RequestVerificationToken\', document.body.dataset.antiforgery);\r\n " +
" body.append(\'id\', id);\r\n\r\n try {\r\n " +
" const response = await fetch($Attachments.attr(\'data-removeurl\'), " +
"{\r\n body: body,\r\n method: " +
"\'POST\'\r\n });\r\n if (!response.ok) {" +
"\r\n alert(\'Unable to remove attachment: \' + response.s" +
"tatusText);\r\n }\r\n $dialogRemoveAtt" +
"achment.dialog(\"close\");\r\n } catch (e) {\r\n " +
" alert(\'Unable to remove attachment: \' + e);\r\n $dialo" +
"gRemoveAttachment.dialog(\"close\");\r\n }\r\n }\r\n\r\n" +
" const attachmentId = $this.attr(\'data-attachmentid\');\r\n " +
" $dialogRemoveAttachment.dialog(\'option\', \'buttons\', {\r\n " +
" \"Remove\": function () {\r\n $dialogRemoveAttachment.dialo" +
"g(\"option\", \"buttons\", null);\r\n removeAttachmentAsync(att" +
"achmentId);\r\n },\r\n Cancel: function () {\r\n" +
" $dialogRemoveAttachment.dialog(\"close\");\r\n " +
" }\r\n }).dialog(\'open\');\r\n\r\n return false;\r\n " +
" }\r\n\r\n //#endregion\r\n\r\n ");
#line 410 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n function addAttachment(key, quick) {\r\n var data = { " +
"id: key };\r\n $.ajax({\r\n url: \'");
#line 415 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.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 e" +
"lse if ($Attachments.hasClass(\'canRemoveOwnAttachments\'))\r\n " +
" buildAttachment(a, (a.AuthorId === $Attachments.attr(\'data-userid\'))," +
" quick);\r\n else\r\n buil" +
"dAttachment(a, false, quick);\r\n\r\n if (attachmentUploa" +
"der && attachmentUploader.onlineUploadCloseDialog) {\r\n " +
" attachmentUploader.onlineUploadCloseDialog();\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 function buildAt" +
"tachment(a, canRemove, quick) {\r\n if (parseInt(a.ParentId) == job" +
"Id) {\r\n var t = \'<a><span class=\"icon\"><img alt=\"Attachment T" +
"humbnail\" /></span><span class=\"comments\"></span><span class=\"author\"></span>\';\r" +
"\n if (canRemove)\r\n t += \'<span class=\"" +
"remove fa fa-times-circle\"></span>\';\r\n t += \'<span class=\"tim" +
"estamp\"></span></a>\';\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 450 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.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(removeLocalAttachment);
if (!quick)
e.hide();
$attachmentOutput.prepend(e);
document.DiscoFunctions.liveAfterUpdate();
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 473 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentThumbnail()));
#line default
#line hidden
WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n };\r\n " +
" img.on(\'error\', function () {\r\n img.addClass(\'lo" +
"ading\');\r\n retryCount++;\r\n " +
" if (retryCount < 6)\r\n window.setTimeout(setThumb" +
"nailUrl, retryCount * 250);\r\n });\r\n " +
" img.on(\'load\', function () {\r\n img.removeClass(\'loa" +
"ding\');\r\n });\r\n window.setTimeout(" +
"setThumbnailUrl, 100);\r\n };\r\n buildThumbna" +
"il();\r\n }\r\n }\r\n\r\n function 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.transport.nam" +
"e == \'foreverFrame\') {\r\n // SignalR active with foreverFrame " +
"transport - use popup window\r\n window.open(url, \'_blank\', \'he" +
"ight=150,width=250,location=no,menubar=no,resizable=no,scrollbars=no,status=no,t" +
"oolbar=no\');\r\n } else {\r\n // use iFrame\r\n " +
" if (!$attachmentDownloadHost) {\r\n $attachm" +
"entDownloadHost = $(\'<iframe>\')\r\n .attr({ \'src\': url," +
" \'title\': \'Attachment Download Host\' })\r\n .addClass(\'" +
"hidden\')\r\n .appendTo(\'body\')\r\n " +
" .contents();\r\n } else {\r\n $attach" +
"mentDownloadHost[0].location.href = url;\r\n }\r\n " +
" }\r\n\r\n return false;\r\n }\r\n\r\n function remov" +
"eAttachment(key) {\r\n var $element = $attachmentOutput.find(\'a[dat" +
"a-attachmentid=\"\' + key + \'\"]\');\r\n if ($element.length > 0) {\r\n " +
" $element.hide(300).delay(300).queue(function () {\r\n " +
" if ($element.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') " +
"== 0)\r\n Shadowbox.removeCache(this);\r\n " +
" $element.remove();\r\n document.DiscoFunctions.liv" +
"eAfterUpdate();\r\n });\r\n }\r\n }\r\n\r\n " +
" $attachmentOutput.children(\'a\').each(function () {\r\n $t" +
"his = $(this);\r\n if ($this.attr(\'data-mimetype\').toLowerCase().in" +
"dexOf(\'image/\') == 0)\r\n $this.shadowbox({ gallery: \'attachmen" +
"ts\', player: \'img\', title: $this.find(\'.comments\').text() });\r\n e" +
"lse\r\n $this.click(onDownload);\r\n });\r\n\r\n " +
" // Add Globally Available Functions\r\n document.DiscoFunctions.liveA" +
"ddAttachment = addAttachment;\r\n document.DiscoFunctions.liveRemoveAtt" +
"achment = removeAttachment;\r\n\r\n //#endregion\r\n });\r\n\r\n\r\n </" +
"script>\r\n");
#line 543 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 544 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs || canShowAttachments)
{
#line default
#line hidden
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
#line 548 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id);
#line default
#line hidden
WriteLiteral("\');\r\n\r\n //#region LiveEvents\r\n var hub = $.connection.jobUp" +
"dates;\r\n\r\n // Map Functions\r\n");
#line 554 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs)
{
#line default
#line hidden
WriteLiteral("\r\n hub.client.addLog = document.DiscoFunctions.liveLoadComment;\r\n " +
" hub.client.removeLog = document.DiscoFunctions.liveRemoveComment;\r\n " +
" ");
#line 558 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 559 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments)
{
#line default
#line hidden
WriteLiteral(@"
hub.client.addAttachment = document.DiscoFunctions.liveAddAttachment;
hub.client.removeAttachment = document.DiscoFunctions.liveRemoveAttachment;
document.DiscoFunctions.liveAfterUpdate = function () {
var tabLink = $('#jobDetailTab-ResourcesLink');
var attachmentCount = $('#Attachments').find('.attachmentOutput').children('a').length;
var tabHeading = tabLink.text();
tabHeading = tabHeading.substr(0, tabHeading.indexOf('[') + 1) + attachmentCount + ']';
tabLink.text(tabHeading);
}
");
#line 572 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n $.connection.hub.qs = { JobId: jobId };\r\n $.connection.h" +
"ub.reconnecting(function () {\r\n $(\'#CommentsContainer\').find(\'spa" +
"n.action\').addClass(\'disabled\');\r\n $(\'#AttachmentsContainer\').fin" +
"d(\'span.action.enabled\').addClass(\'disabled\');\r\n });\r\n $.c" +
"onnection.hub.reconnected(function () {\r\n $(\'#CommentsContainer\')" +
".find(\'span.action\').removeClass(\'disabled\');\r\n $(\'#AttachmentsCo" +
"ntainer\').find(\'span.action.enabled\').removeClass(\'disabled\');\r\n });\r" +
"\n $.connection.hub.error(function (error) {\r\n console." +
"log(\'Server connection error: \' + error);\r\n });\r\n $.connec" +
"tion.hub.disconnected(function () {\r\n // Disable UI\r\n " +
" $(\'#CommentsContainer\').find(\'textarea.commentInput\').attr(\'readonly\', \'read" +
"only\');\r\n $(\'#CommentsContainer\').find(\'span.action\').addClass(\'d" +
"isabled\');\r\n $(\'#AttachmentsContainer\').find(\'span.action.enabled" +
"\').addClass(\'disabled\');\r\n\r\n // Show Dialog Message\r\n " +
" if ($(\'.disconnected-dialog\').length == 0) {\r\n $(\'<div>\')" +
"\r\n .addClass(\'dialog disconnected-dialog\')\r\n " +
" .html(\'<h3><span class=\"fa-stack fa-lg\"><i class=\"fa fa-wifi fa-stack" +
"-1x\"></i><i class=\"fa fa-ban fa-stack-2x error\"></i></span>Disconnected from the" +
" Disco ICT Server</h3><div>This page is not receiving live updates. Please ensur" +
"e you are connected to the server, then refresh this page to enable features.</d" +
"iv>\')\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\', nu" +
"ll);\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 // Start Connection\r\n " +
" $.connection.hub.start(function () {\r\n $(\'#CommentsContain" +
"er\').find(\'span.action\').removeClass(\'disabled\');\r\n $(\'#Attachmen" +
"tsContainer\').find(\'span.action.enabled\').removeClass(\'disabled\');\r\n " +
"});\r\n\r\n //#endregion\r\n });\r\n </script>\r\n");
#line 624 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591