Files
2026-01-26 16:34:26 +11:00

841 lines
41 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.User.UserParts
{
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/User/UserParts/_Resources.cshtml")]
public partial class _Resources : Disco.Services.Web.WebViewPage<Disco.Web.Models.User.ShowModel>
{
public _Resources()
{
}
public override void Execute()
{
#line 2 "..\..\Views\User\UserParts\_Resources.cshtml"
Authorization.Require(Claims.User.ShowAttachments);
var canAddAttachments = Authorization.Has(Claims.User.Actions.AddAttachments);
var canRemoveAnyAttachments = Authorization.Has(Claims.User.Actions.RemoveAnyAttachments);
var canRemoveOwnAttachments = Authorization.Has(Claims.User.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<div");
WriteLiteral(" id=\"UserDetailTab-Resources\"");
WriteLiteral(" class=\"UserPart\"");
WriteLiteral(">\r\n <table");
WriteLiteral(" id=\"userShowResources\"");
WriteLiteral(">\r\n <tr>\r\n <td");
WriteLiteral(" id=\"AttachmentsContainer\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"Attachments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 804), Tuple.Create("\"", 1051)
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 812), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line default
#line hidden
, 812), false)
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 879), Tuple.Create<System.Object, System.Int32>(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments"
#line default
#line hidden
, 880), false)
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 965), Tuple.Create<System.Object, System.Int32>(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments"
#line default
#line hidden
, 966), false)
);
WriteLiteral(" data-id=\"");
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Model.User.UserId);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-userid=\"");
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(CurrentUser.UserId);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-uploadurl=\"");
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-onlineuploadurl=\"");
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentOnlineUploadSession(Model.User.UserId)));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-qrcodeurl=\"");
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js"));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-removeurl=\"");
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentRemove()));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-downloadallurl=\"");
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentDownloadAll()));
#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 26 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 26 "..\..\Views\User\UserParts\_Resources.cshtml"
if (Model.User.UserAttachments != null)
{
foreach (var ua in Model.User.UserAttachments.OrderByDescending(a => a.Id))
{
#line default
#line hidden
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 1985), Tuple.Create("\"", 2043)
#line 30 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1992), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentDownload(ua.Id))
#line default
#line hidden
, 1992), false)
);
WriteLiteral(" data-attachmentid=\"");
#line 30 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-mimetype=\"");
#line 30 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.MimeType);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"icon\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2157), Tuple.Create("\"", 2177)
#line 31 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2165), Tuple.Create<System.Object, System.Int32>(ua.Filename
#line default
#line hidden
, 2165), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 2252), Tuple.Create("\"", 2312)
#line 32 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2258), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentThumbnail(ua.Id))
#line default
#line hidden
, 2258), false)
);
WriteLiteral(" />\r\n </span>\r\n " +
" <span");
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2421), Tuple.Create("\"", 2441)
#line 34 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2429), Tuple.Create<System.Object, System.Int32>(ua.Comments
#line default
#line hidden
, 2429), false)
);
WriteLiteral(">\r\n");
#line 35 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 35 "..\..\Views\User\UserParts\_Resources.cshtml"
if (!string.IsNullOrEmpty(ua.DocumentTemplateId))
{
#line default
#line hidden
#line 36 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.DocumentTemplate.Description);
#line default
#line hidden
#line 36 "..\..\Views\User\UserParts\_Resources.cshtml"
}
else
{
#line default
#line hidden
#line 38 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Comments ?? ua.Filename);
#line default
#line hidden
#line 38 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n </span><span");
WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 39 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.TechUser.ToStringFriendly());
#line default
#line hidden
WriteLiteral("</span>");
#line 39 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ua.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>");
#line 40 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\"");
WriteLiteral(" data-livestamp=\"");
#line 40 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Timestamp.ToUnixEpoc());
#line default
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 3150), Tuple.Create("\"", 3188)
#line 40 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3158), Tuple.Create<System.Object, System.Int32>(ua.Timestamp.ToFullDateTime()
#line default
#line hidden
, 3158), false)
);
WriteLiteral(">");
#line 40 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Timestamp.ToFullDateTime());
#line default
#line hidden
WriteLiteral("</span>\r\n </a>\r\n");
#line 42 "..\..\Views\User\UserParts\_Resources.cshtml"
}
}
#line default
#line hidden
WriteLiteral(" </div>\r\n <div");
WriteLiteral(" class=\"Disco-AttachmentUpload-Progress\"");
WriteLiteral("></div>\r\n <div");
WriteLiteral(" class=\"attachmentInput clearfix\"");
WriteLiteral(">\r\n");
#line 47 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 47 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"action enabled upload fa fa-upload disabled\"");
WriteLiteral(" title=\"Attach File\"");
WriteLiteral("></span>");
WriteLiteral("<span");
WriteLiteral(" class=\"action enabled photo fa fa-camera disabled\"");
WriteLiteral(" title=\"Capture Image\"");
WriteLiteral("></span>");
WriteLiteral("<span");
WriteLiteral(" class=\"action enabled online-upload fa fa-qrcode disabled\"");
WriteLiteral(" title=\"Upload with Online Services\"");
WriteLiteral("></span>\r\n");
#line 50 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 51 "..\..\Views\User\UserParts\_Resources.cshtml"
if (Model.User.UserAttachments != null && Model.User.UserAttachments.Count > 0)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"action enabled download-all fa fa-download\"");
WriteLiteral(" title=\"Download All\"");
WriteLiteral("></span>\r\n");
#line 54 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\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 var $Attachments = $(\'#Atta" +
"chments\');\r\n var $attachmentOutput = $Attachments.fin" +
"d(\'.attachmentOutput\');\r\n var $dialogRemoveAttachment" +
" = null;\r\n let $attachmentDownloadHost = null;\r\n " +
" let attachmentUploader = null;\r\n\r\n " +
" function onAttachmentAdded(id, quick) {\r\n va" +
"r data = { id: id };\r\n $.ajax({\r\n " +
" url: \'");
#line 83 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.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 function buildAttachment(a, canR" +
"emove, quick) {\r\n var t = \'<a><span class=\"icon\">" +
"<img alt=\"Attachment Thumbnail\" /></span><span class=\"comments\"></span><span cla" +
"ss=\"author\"></span>\';\r\n if (canRemove)\r\n " +
" t += \'<span class=\"remove fa fa-times-circle\"></span>" +
"\';\r\n t += \'<span class=\"timestamp\"></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(\'hr" +
"ef\', \'");
#line 117 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.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 142 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.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 == \'f" +
"oreverFrame\') {\r\n // SignalR active with fore" +
"verFrame transport - use popup window\r\n windo" +
"w.open(url, \'_blank\', \'height=150,width=250,location=no,menubar=no,resizable=no," +
"scrollbars=no,status=no,toolbar=no\');\r\n } else {\r" +
"\n // use iFrame\r\n " +
" if (!$attachmentDownloadHost) {\r\n " +
" $attachmentDownloadHost = $(\'<iframe>\')\r\n " +
" .attr({ \'id\': \'AttachmentsDownloadHost\', \'name\': \'AttachmentsDownloadHost\'" +
", \'src\': url, \'title\': \'Attachment Download Host\' })\r\n " +
" .addClass(\'hidden\')\r\n " +
" .appendTo(\'body\')\r\n .contents();\r\n" +
" } else {\r\n " +
" $attachmentDownloadHost[0].location.href = url;\r\n " +
" }\r\n }\r\n\r\n " +
" return false;\r\n }\r\n\r\n f" +
"unction onAttachmentRemoved(id) {\r\n var a = $atta" +
"chmentOutput.find(\'a[data-attachmentid=\' + id + \']\');\r\n\r\n " +
" a.hide(300).delay(300).queue(function () {\r\n " +
" var $this = $(this);\r\n if (this[\'sha" +
"dowboxCacheKey\'])\r\n Shadowbox.removeCache" +
"(this);\r\n $this.find(\'.timestamp\').livestamp(" +
"\'destroy\');\r\n $this.remove();\r\n " +
" onUpdate();\r\n });\r\n " +
" }\r\n\r\n function onUpdate() {\r\n " +
" var attachmentCount = $attachmentOutput.children(\'a\'" +
").length;\r\n var tabHeading = \'Attachments [\' + at" +
"tachmentCount + \']\';\r\n $(\'#UserDetailTab-Resource" +
"sLink\').text(tabHeading);\r\n }\r\n\r\n " +
" $Attachments\r\n .find(\'.attachmentInput sp" +
"an.download-all\')\r\n .on(\'click\', function (event)" +
" {\r\n const downloadAllUrl = $Attachments.attr" +
"(\'data-downloadallurl\');\r\n const id = $Attach" +
"ments.attr(\'data-id\');\r\n const $this = $(this" +
");\r\n\r\n if ($this.hasClass(\'fa-spinner\'))\r\n " +
" return;\r\n\r\n " +
" $this\r\n .removeClass(\'fa-download\')\r\n" +
" .addClass(\'fa-spinner fa-spin\');\r\n\r\n " +
" if (!$attachmentDownloadHost) {\r\n " +
" $attachmentDownloadHost = $(\'<iframe>\')\r\n " +
" .attr({ \'id\': \'AttachmentsDownloadHost\', \'name\': \'" +
"AttachmentsDownloadHost\', \'title\': \'Attachment Download Host\' })\r\n " +
" .addClass(\'hidden\')\r\n " +
" .appendTo(\'body\')\r\n .c" +
"ontents();\r\n }\r\n " +
" const $form = $(\'<form>\')\r\n .attr(" +
"{\r\n method: \'POST\',\r\n " +
" action: downloadAllUrl,\r\n " +
" target: \'AttachmentsDownloadHost\'\r\n " +
" })\r\n .append($(\'<input>\')\r\n " +
" .attr({ type: \'hidden\', name: \'__Reque" +
"stVerificationToken\' })\r\n .val(docume" +
"nt.body.dataset.antiforgery))\r\n .append($" +
"(\'<input>\')\r\n .attr({ type: \'hidden\'," +
" name: \'id\' })\r\n .val(id))\r\n " +
" .appendTo(document.body)\r\n " +
" .trigger(\'submit\');\r\n\r\n wind" +
"ow.setTimeout(function () {\r\n $this\r\n " +
" .removeClass(\'fa-spinner fa-spin\')\r\n " +
" .addClass(\'fa-download\');\r\n " +
" $form.remove();\r\n " +
"}, 2000);\r\n });\r\n\r\n do" +
"cument.DiscoFunctions.onAttachmentAdded = onAttachmentAdded;\r\n " +
" document.DiscoFunctions.onAttachmentRemoved = onAttachmentRemoved;\r\n\r\n" +
"");
#line 248 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 248 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral("\r\n //#region Add Attachments\r\n " +
" attachmentUploader = new document.Disco.AttachmentUploader($Attachments);\r\n\r" +
"\n var $attachmentInput = $Attachments.find(\'.attachme" +
"ntInput\');\r\n $attachmentInput.find(\'.online-upload\')." +
"on(\'click\', function () {\r\n if ($(this).hasClass(" +
"\'disabled\'))\r\n alert(\'Disconnected from the D" +
"isco ICT Server, please refresh this page and try again\');\r\n " +
" else\r\n attachmentUploader.onlineU" +
"pload();\r\n });\r\n if (windo" +
"w.location.protocol != \'https:\') {\r\n $attachmentI" +
"nput.find(\'.photo\')\r\n .removeClass(\'enabled\')" +
"\r\n .addClass(\'disabled\')\r\n " +
" .attr(\'title\', \'Capture Image: this functionality is only avail" +
"able over a HTTPS connection\');\r\n }\r\n " +
" $attachmentInput.find(\'.photo\').click(function () {\r\n " +
" if (!$(this).hasClass(\'enabled\'))\r\n " +
" alert(\'This functionality is only available over a HTTPS connection\');\r\n" +
" else if ($(this).hasClass(\'disabled\'))\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, please 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[href=\"#UserDetailTab-Resources\"]\').closest(\'li\').index()\r\n " +
" };\r\n }\r\n " +
" var selectedIndex = resourcesTab.tabs.tabs(\'option\', \'active" +
"\');\r\n if (resourcesTab.resourcesIndex !== selecte" +
"dIndex)\r\n resourcesTab.tabs.tabs(\'option\', \'a" +
"ctive\', resourcesTab.resourcesIndex);\r\n });\r\n " +
" //#endregion\r\n ");
#line 295 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 296 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral("\r\n //#region Remove Attachments\r\n\r\n " +
" $attachmentOutput.find(\'span.remove\').click(removeAttachment);\r\n\r\n " +
" function removeAttachment() {\r\n " +
" $this = $(this).closest(\'a\');\r\n\r\n if (!$dia" +
"logRemoveAttachment) {\r\n $dialogRemoveAttachm" +
"ent = $(\'#dialogRemoveAttachment\').dialog({\r\n " +
" resizable: false,\r\n height: 140,\r\n " +
" modal: true,\r\n " +
" autoOpen: false\r\n });\r\n " +
" }\r\n\r\n async function remove" +
"AttachmentAsync(id) {\r\n const body = new Form" +
"Data();\r\n body.append(\'__RequestVerificationT" +
"oken\', document.body.dataset.antiforgery);\r\n " +
"body.append(\'id\', id);\r\n\r\n try {\r\n " +
" const response = await fetch($Attachments.attr(\'dat" +
"a-removeurl\'), {\r\n body: body,\r\n " +
" method: \'POST\'\r\n " +
" });\r\n if (!response.ok) {\r" +
"\n alert(\'Unable to remove attachment:" +
" \' + response.statusText);\r\n }\r\n " +
" $dialogRemoveAttachment.dialog(\"close\");\r\n " +
" } catch (e) {\r\n " +
" alert(\'Unable to remove attachment: \' + e);\r\n " +
" $dialogRemoveAttachment.dialog(\"close\");\r\n " +
" }\r\n }\r\n\r\n c" +
"onst attachmentId = $this.attr(\'data-attachmentid\');\r\n " +
" $dialogRemoveAttachment.dialog(\'option\', \'buttons\', {\r\n " +
" \"Remove\": function () {\r\n " +
" $dialogRemoveAttachment.dialog(\"option\", \"buttons\", null);\r\n " +
" removeAttachmentAsync(attachmentId);\r\n " +
" },\r\n Cancel: function () {\r\n " +
" $dialogRemoveAttachment.dialog(\"close\");\r" +
"\n }\r\n }).dialo" +
"g(\'open\');\r\n\r\n return false;\r\n " +
" }\r\n\r\n //#endregion\r\n " +
"");
#line 349 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(@"
$attachmentOutput.children('a').each(function () {
$this = $(this);
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
$this.shadowbox({ gallery: 'attachments', player: 'img', title: $this.find('.comments').text() });
else if ($this.attr('data-mimetype').toLowerCase().indexOf('application/pdf') == 0 && navigator.pdfViewerEnabled)
$this.shadowbox({ gallery: 'attachments', player: 'iframe', title: $this.find('.comments').text() });
else
$this.click(onDownload);
});
});
</script>
</div>
</td>
</tr>
</table>
<script>
$('#UserDetailTabItems').append('<li><a href=""#UserDetailTab-Resources"" id=""UserDetailTab-ResourcesLink"">Attachments [");
#line 367 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Model.User.UserAttachments == null ? 0 : Model.User.UserAttachments.Count);
#line default
#line hidden
WriteLiteral("]</a></li>\');\r\n </script>\r\n</div>\r\n");
#line 370 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"dialogRemoveAttachment\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Remove this Attachment?\"");
WriteLiteral(">\r\n <p>\r\n <i");
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n");
#line 377 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591