#180: bulk download device/job/user attachments

This commit is contained in:
Gary Sharp
2026-01-26 15:04:04 +11:00
parent e809c63e37
commit f807d75162
21 changed files with 903 additions and 296 deletions
@@ -16,6 +16,8 @@ using Disco.Web.Models.Device;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
@@ -26,15 +28,15 @@ namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceController : AuthorizedDatabaseController
{
const string pDeviceProfileId = "deviceprofileid";
const string pDeviceBatchId = "devicebatchid";
const string pAssetNumber = "assetnumber";
const string pAssignedUserId = "assigneduserid";
const string pLocation = "location";
const string pAllowUnauthenticatedEnrol = "allowunauthenticatedenrol";
const string pDetailACAdapter = "detailacadapter";
const string pDetailBattery = "detailbattery";
const string pDetailKeyboard = "detailkeyboard";
private const string pDeviceProfileId = "deviceprofileid";
private const string pDeviceBatchId = "devicebatchid";
private const string pAssetNumber = "assetnumber";
private const string pAssignedUserId = "assigneduserid";
private const string pLocation = "location";
private const string pAllowUnauthenticatedEnrol = "allowunauthenticatedenrol";
private const string pDetailACAdapter = "detailacadapter";
private const string pDetailBattery = "detailbattery";
private const string pDetailKeyboard = "detailkeyboard";
[HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult Update(string id, string key, string value = null, bool redirect = false)
@@ -563,6 +565,44 @@ namespace Disco.Web.Areas.API.Controllers
return HttpNotFound("Invalid Attachment Number");
}
[DiscoAuthorize(Claims.Device.ShowAttachments)]
[HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult AttachmentDownloadAll(string id)
{
var device = Database.Devices
.Include(u => u.DeviceAttachments)
.Where(u => u.SerialNumber == id)
.FirstOrDefault();
if (device == null || device.DeviceAttachments.Count == 0)
return NotFound();
var responseStream = new MemoryStream();
using (var archive = new ZipArchive(responseStream, ZipArchiveMode.Create, true))
{
foreach (var attachment in device.DeviceAttachments)
{
var repoFileName = attachment.RepositoryFilename(Database);
if (System.IO.File.Exists(repoFileName))
{
var fileName = $"{Path.GetFileNameWithoutExtension(attachment.Filename)}-{attachment.Timestamp:yyyyMMdd-HHmmss}{Path.GetExtension(attachment.Filename)}";
var entry = archive.CreateEntry(fileName, CompressionLevel.Fastest);
entry.LastWriteTime = attachment.Timestamp;
using (var entryStream = entry.Open())
{
using (var attachmentStream = System.IO.File.OpenRead(repoFileName))
{
attachmentStream.CopyTo(entryStream);
}
}
}
}
}
responseStream.Position = 0;
return File(responseStream, "application/zip", $"{device.SerialNumber}_DeviceAttachments_{DateTime.Now:yyyyMMdd-HHmmss}.zip");
}
[DiscoAuthorize(Claims.Device.ShowAttachments), OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentThumbnail(int id)
{
@@ -16,6 +16,8 @@ using Disco.Web.Models.Job;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Caching;
@@ -1943,6 +1945,44 @@ namespace Disco.Web.Areas.API.Controllers
return HttpNotFound("Invalid Attachment Number");
}
[DiscoAuthorize(Claims.Job.ShowAttachments)]
[HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult AttachmentDownloadAll(int id)
{
var job = Database.Jobs
.Include(u => u.JobAttachments)
.Where(u => u.Id == id)
.FirstOrDefault();
if (job == null || job.JobAttachments.Count == 0)
return NotFound();
var responseStream = new MemoryStream();
using (var archive = new ZipArchive(responseStream, ZipArchiveMode.Create, true))
{
foreach (var attachment in job.JobAttachments)
{
var repoFileName = attachment.RepositoryFilename(Database);
if (System.IO.File.Exists(repoFileName))
{
var fileName = $"{Path.GetFileNameWithoutExtension(attachment.Filename)}-{attachment.Timestamp:yyyyMMdd-HHmmss}{Path.GetExtension(attachment.Filename)}";
var entry = archive.CreateEntry(fileName, CompressionLevel.Fastest);
entry.LastWriteTime = attachment.Timestamp;
using (var entryStream = entry.Open())
{
using (var attachmentStream = System.IO.File.OpenRead(repoFileName))
{
attachmentStream.CopyTo(entryStream);
}
}
}
}
}
responseStream.Position = 0;
return File(responseStream, "application/zip", $"{job.Id}_JobAttachments_{DateTime.Now:yyyyMMdd-HHmmss}.zip");
}
[DiscoAuthorize(Claims.Job.ShowAttachments), OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentThumbnail(int id)
{
@@ -9,6 +9,8 @@ using Disco.Services.Users;
using Disco.Services.Web;
using System;
using System.Data.Entity;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Mvc;
@@ -124,6 +126,46 @@ namespace Disco.Web.Areas.API.Controllers
return HttpNotFound("Invalid Attachment Number");
}
[DiscoAuthorize(Claims.User.ShowAttachments)]
[HttpPost, ValidateAntiForgeryToken]
public virtual ActionResult AttachmentDownloadAll(string id)
{
id = ActiveDirectory.ParseDomainAccountId(id);
var user = Database.Users
.Include(u => u.UserAttachments)
.Where(u => u.UserId == id)
.FirstOrDefault();
if (user == null || user.UserAttachments.Count == 0)
return NotFound();
var responseStream = new MemoryStream();
using (var archive = new ZipArchive(responseStream, ZipArchiveMode.Create, true))
{
foreach (var attachment in user.UserAttachments)
{
var repoFileName = attachment.RepositoryFilename(Database);
if (System.IO.File.Exists(repoFileName))
{
var fileName = $"{Path.GetFileNameWithoutExtension(attachment.Filename)}-{attachment.Timestamp:yyyyMMdd-HHmmss}{Path.GetExtension(attachment.Filename)}";
var entry = archive.CreateEntry(fileName, CompressionLevel.Fastest);
entry.LastWriteTime = attachment.Timestamp;
using (var entryStream = entry.Open())
{
using (var attachmentStream = System.IO.File.OpenRead(repoFileName))
{
attachmentStream.CopyTo(entryStream);
}
}
}
}
}
responseStream.Position = 0;
return File(responseStream, "application/zip", $"{user.UserId.Replace('\\', '_')}_UserAttachments_{DateTime.Now:yyyyMMdd-HHmmss}.zip");
}
[DiscoAuthorize(Claims.User.ShowAttachments)]
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentThumbnail(int id)
+5 -1
View File
@@ -534,7 +534,7 @@
}
#deviceShowResources #Attachments div.attachmentInput span.action {
display: block;
margin: 0 4px 0 0;
margin: 1px 2px 1px 0;
font-size: 1.5em;
cursor: pointer;
float: right;
@@ -558,6 +558,10 @@
background-color: inherit;
border: 1px solid #fff;
}
#deviceShowResources #Attachments div.attachmentInput span.action.download-all {
margin-left: 2px;
float: left;
}
#Device_Show_Details_Actions_AddFlag_Dialog {
height: 400px;
}
+6 -1
View File
@@ -547,7 +547,7 @@
span.action {
display: block;
margin: 0 4px 0 0;
margin: 1px 2px 1px 0;
font-size: 1.5em;
cursor: pointer;
float: right;
@@ -574,6 +574,11 @@
}
}
}
&.download-all {
margin-left: 2px;
float: left;
}
}
}
}
File diff suppressed because one or more lines are too long
+5 -1
View File
@@ -504,7 +504,7 @@
}
#jobShowResources #Attachments div.attachmentInput span.action {
display: block;
margin: 0 4px 0 0;
margin: 1px 2px 1px 0;
font-size: 1.5em;
cursor: pointer;
float: right;
@@ -528,6 +528,10 @@
background-color: inherit;
border: 1px solid #fff;
}
#jobShowResources #Attachments div.attachmentInput span.action.download-all {
margin-left: 2px;
float: left;
}
#Job_Show_Job_Actions_AddQueue_Dialog {
height: 400px;
}
+6 -1
View File
@@ -525,7 +525,7 @@
span.action {
display: block;
margin: 0 4px 0 0;
margin: 1px 2px 1px 0;
font-size: 1.5em;
cursor: pointer;
float: right;
@@ -553,6 +553,11 @@
}
}
}
&.download-all {
margin-left: 2px;
float: left;
}
}
}
}
File diff suppressed because one or more lines are too long
+5 -1
View File
@@ -602,7 +602,7 @@
}
#userShowResources #Attachments div.attachmentInput span.action {
display: block;
margin: 0 4px 0 0;
margin: 1px 2px 1px 0;
font-size: 1.5em;
cursor: pointer;
float: right;
@@ -626,6 +626,10 @@
background-color: inherit;
border: 1px solid #fff;
}
#userShowResources #Attachments div.attachmentInput span.action.download-all {
margin-left: 2px;
float: left;
}
#User_Show_Details_Actions_CreateJob_Dialog #CreateJob_Assignments {
margin-top: 6px;
background-color: #fff;
+6 -1
View File
@@ -657,7 +657,7 @@
span.action {
display: block;
margin: 0 4px 0 0;
margin: 1px 2px 1px 0;
font-size: 1.5em;
cursor: pointer;
float: right;
@@ -684,6 +684,11 @@
}
}
}
&.download-all {
margin-left: 2px;
float: left;
}
}
}
}
File diff suppressed because one or more lines are too long
@@ -175,6 +175,12 @@ namespace Disco.Web.Areas.API.Controllers
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult AttachmentDownloadAll()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentDownloadAll);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult AttachmentThumbnail()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentThumbnail);
@@ -299,6 +305,7 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string CommentAdd = "CommentAdd";
public readonly string CommentRemove = "CommentRemove";
public readonly string AttachmentDownload = "AttachmentDownload";
public readonly string AttachmentDownloadAll = "AttachmentDownloadAll";
public readonly string AttachmentThumbnail = "AttachmentThumbnail";
public readonly string AttachmentUpload = "AttachmentUpload";
public readonly string Attachment = "Attachment";
@@ -339,6 +346,7 @@ namespace Disco.Web.Areas.API.Controllers
public const string CommentAdd = "CommentAdd";
public const string CommentRemove = "CommentRemove";
public const string AttachmentDownload = "AttachmentDownload";
public const string AttachmentDownloadAll = "AttachmentDownloadAll";
public const string AttachmentThumbnail = "AttachmentThumbnail";
public const string AttachmentUpload = "AttachmentUpload";
public const string Attachment = "Attachment";
@@ -537,6 +545,14 @@ namespace Disco.Web.Areas.API.Controllers
{
public readonly string id = "id";
}
static readonly ActionParamsClass_AttachmentDownloadAll s_params_AttachmentDownloadAll = new ActionParamsClass_AttachmentDownloadAll();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_AttachmentDownloadAll AttachmentDownloadAllParams { get { return s_params_AttachmentDownloadAll; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_AttachmentDownloadAll
{
public readonly string id = "id";
}
static readonly ActionParamsClass_AttachmentThumbnail s_params_AttachmentThumbnail = new ActionParamsClass_AttachmentThumbnail();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_AttachmentThumbnail AttachmentThumbnailParams { get { return s_params_AttachmentThumbnail; } }
@@ -940,6 +956,18 @@ namespace Disco.Web.Areas.API.Controllers
return callInfo;
}
[NonAction]
partial void AttachmentDownloadAllOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string id);
[NonAction]
public override System.Web.Mvc.ActionResult AttachmentDownloadAll(string id)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentDownloadAll);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
AttachmentDownloadAllOverride(callInfo, id);
return callInfo;
}
[NonAction]
partial void AttachmentThumbnailOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id);
@@ -397,6 +397,12 @@ namespace Disco.Web.Areas.API.Controllers
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult AttachmentDownloadAll()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentDownloadAll);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult AttachmentThumbnail()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentThumbnail);
@@ -540,6 +546,7 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string CommentAdd = "CommentAdd";
public readonly string CommentRemove = "CommentRemove";
public readonly string AttachmentDownload = "AttachmentDownload";
public readonly string AttachmentDownloadAll = "AttachmentDownloadAll";
public readonly string AttachmentThumbnail = "AttachmentThumbnail";
public readonly string AttachmentUpload = "AttachmentUpload";
public readonly string Attachment = "Attachment";
@@ -615,6 +622,7 @@ namespace Disco.Web.Areas.API.Controllers
public const string CommentAdd = "CommentAdd";
public const string CommentRemove = "CommentRemove";
public const string AttachmentDownload = "AttachmentDownload";
public const string AttachmentDownloadAll = "AttachmentDownloadAll";
public const string AttachmentThumbnail = "AttachmentThumbnail";
public const string AttachmentUpload = "AttachmentUpload";
public const string Attachment = "Attachment";
@@ -1177,6 +1185,14 @@ namespace Disco.Web.Areas.API.Controllers
{
public readonly string id = "id";
}
static readonly ActionParamsClass_AttachmentDownloadAll s_params_AttachmentDownloadAll = new ActionParamsClass_AttachmentDownloadAll();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_AttachmentDownloadAll AttachmentDownloadAllParams { get { return s_params_AttachmentDownloadAll; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_AttachmentDownloadAll
{
public readonly string id = "id";
}
static readonly ActionParamsClass_AttachmentThumbnail s_params_AttachmentThumbnail = new ActionParamsClass_AttachmentThumbnail();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_AttachmentThumbnail AttachmentThumbnailParams { get { return s_params_AttachmentThumbnail; } }
@@ -2066,6 +2082,18 @@ namespace Disco.Web.Areas.API.Controllers
return callInfo;
}
[NonAction]
partial void AttachmentDownloadAllOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id);
[NonAction]
public override System.Web.Mvc.ActionResult AttachmentDownloadAll(int id)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentDownloadAll);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
AttachmentDownloadAllOverride(callInfo, id);
return callInfo;
}
[NonAction]
partial void AttachmentThumbnailOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id);
@@ -91,6 +91,12 @@ namespace Disco.Web.Areas.API.Controllers
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult AttachmentDownloadAll()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentDownloadAll);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult AttachmentThumbnail()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentThumbnail);
@@ -153,6 +159,7 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string CommentAdd = "CommentAdd";
public readonly string CommentRemove = "CommentRemove";
public readonly string AttachmentDownload = "AttachmentDownload";
public readonly string AttachmentDownloadAll = "AttachmentDownloadAll";
public readonly string AttachmentThumbnail = "AttachmentThumbnail";
public readonly string AttachmentUpload = "AttachmentUpload";
public readonly string Attachment = "Attachment";
@@ -170,6 +177,7 @@ namespace Disco.Web.Areas.API.Controllers
public const string CommentAdd = "CommentAdd";
public const string CommentRemove = "CommentRemove";
public const string AttachmentDownload = "AttachmentDownload";
public const string AttachmentDownloadAll = "AttachmentDownloadAll";
public const string AttachmentThumbnail = "AttachmentThumbnail";
public const string AttachmentUpload = "AttachmentUpload";
public const string Attachment = "Attachment";
@@ -223,6 +231,14 @@ namespace Disco.Web.Areas.API.Controllers
{
public readonly string id = "id";
}
static readonly ActionParamsClass_AttachmentDownloadAll s_params_AttachmentDownloadAll = new ActionParamsClass_AttachmentDownloadAll();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_AttachmentDownloadAll AttachmentDownloadAllParams { get { return s_params_AttachmentDownloadAll; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_AttachmentDownloadAll
{
public readonly string id = "id";
}
static readonly ActionParamsClass_AttachmentThumbnail s_params_AttachmentThumbnail = new ActionParamsClass_AttachmentThumbnail();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_AttachmentThumbnail AttachmentThumbnailParams { get { return s_params_AttachmentThumbnail; } }
@@ -365,6 +381,18 @@ namespace Disco.Web.Areas.API.Controllers
return callInfo;
}
[NonAction]
partial void AttachmentDownloadAllOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string id);
[NonAction]
public override System.Web.Mvc.ActionResult AttachmentDownloadAll(string id)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentDownloadAll);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
AttachmentDownloadAllOverride(callInfo, id);
return callInfo;
}
[NonAction]
partial void AttachmentThumbnailOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id);
@@ -18,7 +18,7 @@
<table id="deviceShowResources">
<tr>
<td id="AttachmentsContainer">
<div id="Attachments" class="@(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments") @(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments") @(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments")" data-userid="@CurrentUser.UserId" data-uploadurl="@(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)))" data-onlineuploadurl="@(Url.Action(MVC.API.Device.AttachmentOnlineUploadSession(Model.Device.SerialNumber)))" data-qrcodeurl="@Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js")" data-removeurl="@Url.Action(MVC.API.Device.AttachmentRemove())">
<div id="Attachments" class="@(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments") @(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments") @(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments")" data-id="@Model.Device.SerialNumber" data-userid="@CurrentUser.UserId" data-uploadurl="@(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)))" data-onlineuploadurl="@(Url.Action(MVC.API.Device.AttachmentOnlineUploadSession(Model.Device.SerialNumber)))" data-qrcodeurl="@Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js")" data-removeurl="@Url.Action(MVC.API.Device.AttachmentRemove())" data-downloadallurl="@Url.Action(MVC.API.Device.AttachmentDownloadAll(Model.Device.SerialNumber))">
<div class="Disco-AttachmentUpload-DropTarget">
<h2>Drop Attachments Here</h2>
</div>
@@ -42,13 +42,17 @@
}
}
</div>
@if (canAddAttachments)
{
<div class="Disco-AttachmentUpload-Progress"></div>
<div class="attachmentInput clearfix">
<div class="Disco-AttachmentUpload-Progress"></div>
<div class="attachmentInput clearfix">
@if (canAddAttachments)
{
<span class="action enabled upload fa fa-upload disabled" title="Attach File"></span><span class="action enabled photo fa fa-camera disabled" title="Capture Image"></span><span class="action enabled online-upload fa fa-qrcode disabled" title="Upload with Online Services"></span>
</div>
}
}
@if (Model.Device.DeviceAttachments != null && Model.Device.DeviceAttachments.Count > 0)
{
<span class="action enabled download-all fa fa-download" title="Download All"></span>
}
</div>
<script type="text/javascript">
Shadowbox.init({
skipSetup: true,
@@ -150,7 +154,7 @@
// use iFrame
if (!$attachmentDownloadHost) {
$attachmentDownloadHost = $('<iframe>')
.attr({ 'src': url, 'title': 'Attachment Download Host' })
.attr({ 'id': 'AttachmentsDownloadHost', 'name': 'AttachmentsDownloadHost', 'src': url, 'title': 'Attachment Download Host' })
.addClass('hidden')
.appendTo('body')
.contents();
@@ -181,6 +185,50 @@
$('#DeviceDetailTab-ResourcesLink').text(tabHeading);
}
$Attachments
.find('.attachmentInput span.download-all')
.on('click', function (event) {
const downloadAllUrl = $Attachments.attr('data-downloadallurl');
const id = $Attachments.attr('data-id');
const $this = $(this);
if ($this.hasClass('fa-spinner'))
return;
$this
.removeClass('fa-download')
.addClass('fa-spinner fa-spin');
if (!$attachmentDownloadHost) {
$attachmentDownloadHost = $('<iframe>')
.attr({ 'id': 'AttachmentsDownloadHost', 'name': 'AttachmentsDownloadHost', 'title': 'Attachment Download Host' })
.addClass('hidden')
.appendTo('body')
.contents();
}
const $form = $('<form>')
.attr({
method: 'POST',
action: downloadAllUrl,
target: 'AttachmentsDownloadHost'
})
.append($('<input>')
.attr({ type: 'hidden', name: '__RequestVerificationToken' })
.val(document.body.dataset.antiforgery))
.append($('<input>')
.attr({ type: 'hidden', name: 'id' })
.val(id))
.appendTo(document.body)
.trigger('submit');
window.setTimeout(function () {
$this
.removeClass('fa-spinner fa-spin')
.addClass('fa-download');
$form.remove();
}, 2000);
});
document.DiscoFunctions.onAttachmentAdded = onAttachmentAdded;
document.DiscoFunctions.onAttachmentRemoved = onAttachmentRemoved;
@@ -105,11 +105,22 @@ WriteAttribute("class", Tuple.Create(" class=\"", 820), Tuple.Create("\"", 1067)
, 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);
Write(CurrentUser.UserId);
#line default
@@ -120,7 +131,7 @@ WriteLiteral(" data-uploadurl=\"");
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)));
Write(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)));
#line default
@@ -131,7 +142,7 @@ WriteLiteral(" data-onlineuploadurl=\"");
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentOnlineUploadSession(Model.Device.SerialNumber)));
Write(Url.Action(MVC.API.Device.AttachmentOnlineUploadSession(Model.Device.SerialNumber)));
#line default
@@ -142,7 +153,7 @@ WriteLiteral(" data-qrcodeurl=\"");
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js"));
Write(Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js"));
#line default
@@ -153,7 +164,18 @@ WriteLiteral(" data-removeurl=\"");
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentRemove()));
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
@@ -189,14 +211,14 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 1930), Tuple.Create("\"", 1990)
WriteAttribute("href", Tuple.Create(" href=\"", 2066), Tuple.Create("\"", 2126)
#line 30 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1937), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentDownload(da.Id))
, Tuple.Create(Tuple.Create("", 2073), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentDownload(da.Id))
#line default
#line hidden
, 1937), false)
, 2073), false)
);
WriteLiteral(" data-attachmentid=\"");
@@ -225,28 +247,28 @@ WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"icon\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2104), Tuple.Create("\"", 2124)
WriteAttribute("title", Tuple.Create(" title=\"", 2240), Tuple.Create("\"", 2260)
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2112), Tuple.Create<System.Object, System.Int32>(da.Filename
, Tuple.Create(Tuple.Create("", 2248), Tuple.Create<System.Object, System.Int32>(da.Filename
#line default
#line hidden
, 2112), false)
, 2248), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 2199), Tuple.Create("\"", 2261)
WriteAttribute("src", Tuple.Create(" src=\"", 2335), Tuple.Create("\"", 2397)
#line 32 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2205), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id))
, Tuple.Create(Tuple.Create("", 2341), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id))
#line default
#line hidden
, 2205), false)
, 2341), false)
);
WriteLiteral(" />\r\n </span>\r\n " +
@@ -254,14 +276,14 @@ WriteLiteral(" />\r\n </span>\r\n
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2370), Tuple.Create("\"", 2407)
WriteAttribute("title", Tuple.Create(" title=\"", 2506), Tuple.Create("\"", 2543)
#line 34 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2378), Tuple.Create<System.Object, System.Int32>(da.Comments ?? da.Filename
, Tuple.Create(Tuple.Create("", 2514), Tuple.Create<System.Object, System.Int32>(da.Comments ?? da.Filename
#line default
#line hidden
, 2378), false)
, 2514), false)
);
WriteLiteral(">\r\n");
@@ -345,14 +367,14 @@ WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\"");
WriteAttribute("title", Tuple.Create(" title=\"", 3062), Tuple.Create("\"", 3100)
WriteAttribute("title", Tuple.Create(" title=\"", 3198), Tuple.Create("\"", 3236)
#line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3070), Tuple.Create<System.Object, System.Int32>(da.Timestamp.ToFullDateTime()
, Tuple.Create(Tuple.Create("", 3206), Tuple.Create<System.Object, System.Int32>(da.Timestamp.ToFullDateTime()
#line default
#line hidden
, 3070), false)
, 3206), false)
);
WriteLiteral(" data-livestamp=\"");
@@ -385,60 +407,87 @@ WriteLiteral("</span>\r\n </a>\r\n");
#line default
#line hidden
WriteLiteral(" </div>\r\n");
#line 45 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line default
#line hidden
#line 45 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" </div>\r\n <div");
WriteLiteral(" class=\"Disco-AttachmentUpload-Progress\"");
WriteLiteral("></div>\r\n");
WriteLiteral(" <div");
WriteLiteral("></div>\r\n <div");
WriteLiteral(" class=\"attachmentInput clearfix\"");
WriteLiteral(">\r\n <span");
WriteLiteral(">\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(" <span");
WriteLiteral(" class=\"action enabled upload fa fa-upload disabled\"");
WriteLiteral(" title=\"Attach File\"");
WriteLiteral("></span><span");
WriteLiteral("></span>");
WriteLiteral("<span");
WriteLiteral(" class=\"action enabled photo fa fa-camera disabled\"");
WriteLiteral(" title=\"Capture Image\"");
WriteLiteral("></span><span");
WriteLiteral("></span>");
WriteLiteral("<span");
WriteLiteral(" class=\"action enabled online-upload fa fa-qrcode disabled\"");
WriteLiteral(" title=\"Upload with Online Services\"");
WriteLiteral("></span>\r\n </div>\r\n");
WriteLiteral("></span>\r\n");
#line 51 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
#line 50 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" <script");
WriteLiteral(" ");
#line 51 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (Model.Device.DeviceAttachments != null && Model.Device.DeviceAttachments.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\Device\DeviceParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n <script");
WriteLiteral(" type=\"text/javascript\"");
@@ -460,7 +509,7 @@ WriteLiteral(@">
url: '");
#line 67 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 71 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.Attachment()));
@@ -497,7 +546,7 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
"href\', \'");
#line 102 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 106 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentDownload()));
@@ -529,7 +578,7 @@ WriteLiteral(@"/' + a.Id);
img.attr('src', '");
#line 125 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 129 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentThumbnail()));
@@ -556,39 +605,73 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n
"atus=no,toolbar=no\');\r\n } else {\r\n " +
" // use iFrame\r\n if (!$at" +
"tachmentDownloadHost) {\r\n $attachmentDown" +
"loadHost = $(\'<iframe>\')\r\n .attr({ \'s" +
"rc\': 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 r" +
"eturn false;\r\n }\r\n\r\n funct" +
"ion onAttachmentRemoved(id) {\r\n var a = $attachme" +
"ntOutput.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.attr(\'d" +
"ata-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\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 attachmentCou" +
"nt = $attachmentOutput.children(\'a\').length;\r\n va" +
"r tabHeading = \'Attachments [\' + attachmentCount + \']\';\r\n " +
" $(\'#DeviceDetailTab-ResourcesLink\').text(tabHeading);\r\n " +
" }\r\n\r\n document.DiscoFunctions.onAttachmen" +
"tAdded = onAttachmentAdded;\r\n document.DiscoFunctions" +
".onAttachmentRemoved = onAttachmentRemoved;\r\n\r\n");
"loadHost = $(\'<iframe>\')\r\n .attr({ \'i" +
"d\': \'AttachmentsDownloadHost\', \'name\': \'AttachmentsDownloadHost\', \'src\': url, \'t" +
"itle\': \'Attachment Download Host\' })\r\n " +
" .addClass(\'hidden\')\r\n .appendTo(\'bo" +
"dy\')\r\n .contents();\r\n " +
" } else {\r\n $attachmen" +
"tDownloadHost[0].location.href = url;\r\n }\r\n " +
" }\r\n\r\n return false;" +
"\r\n }\r\n\r\n function onAttach" +
"mentRemoved(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 onUpdate() {\r\n var attachmentCount = $attach" +
"mentOutput.children(\'a\').length;\r\n var tabHeading" +
" = \'Attachments [\' + attachmentCount + \']\';\r\n $(\'" +
"#DeviceDetailTab-ResourcesLink\').text(tabHeading);\r\n " +
"}\r\n\r\n $Attachments\r\n ." +
"find(\'.attachmentInput span.download-all\')\r\n .on(" +
"\'click\', function (event) {\r\n const downloadA" +
"llUrl = $Attachments.attr(\'data-downloadallurl\');\r\n " +
" const id = $Attachments.attr(\'data-id\');\r\n " +
" const $this = $(this);\r\n\r\n if ($this.has" +
"Class(\'fa-spinner\'))\r\n return;\r\n\r\n " +
" $this\r\n .rem" +
"oveClass(\'fa-download\')\r\n .addClass(\'fa-s" +
"pinner fa-spin\');\r\n\r\n if (!$attachmentDownloa" +
"dHost) {\r\n $attachmentDownloadHost = $(\'<" +
"iframe>\')\r\n .attr({ \'id\': \'Attachment" +
"sDownloadHost\', \'name\': \'AttachmentsDownloadHost\', \'title\': \'Attachment Download" +
" Host\' })\r\n .addClass(\'hidden\')\r\n " +
" .appendTo(\'body\')\r\n " +
" .contents();\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: \'__RequestVerificationToken\' })\r\n " +
" .val(document.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 " +
" window.setTimeout(function () {\r\n " +
" $this\r\n .removeClass(\'f" +
"a-spinner fa-spin\')\r\n .addClass(\'fa-d" +
"ownload\');\r\n $form.remove();\r\n " +
" }, 2000);\r\n });\r\n\r\n " +
" document.DiscoFunctions.onAttachmentAdded = onAttachmentA" +
"dded;\r\n document.DiscoFunctions.onAttachmentRemoved =" +
" onAttachmentRemoved;\r\n\r\n");
#line 187 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 235 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line default
#line hidden
#line 187 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 235 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canAddAttachments)
{
@@ -635,7 +718,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
" //#endregion\r\n ");
#line 234 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 282 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
@@ -644,7 +727,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
WriteLiteral(" ");
#line 235 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 283 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -687,7 +770,7 @@ WriteLiteral("\r\n //#region Remove Attachments\r\n
" }\r\n //#endregion\r\n ");
#line 286 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 334 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
@@ -724,7 +807,7 @@ WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n <scr
"etailTab-ResourcesLink\">Attachments [");
#line 307 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 355 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Model.Device.DeviceAttachments == null ? 0 : Model.Device.DeviceAttachments.Count);
+53 -8
View File
@@ -53,7 +53,7 @@
@if (canShowAttachments)
{
<td id="AttachmentsContainer">
<div id="Attachments" class="@(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments") @(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments") @(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments")" data-userid="@CurrentUser.UserId" data-uploadurl="@(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)))" data-onlineuploadurl="@(Url.Action(MVC.API.Job.AttachmentOnlineUploadSession(Model.Job.Id)))" data-qrcodeurl="@Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js")" data-removeurl="@Url.Action(MVC.API.Job.AttachmentRemove())">
<div id="Attachments" class="@(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments") @(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments") @(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments")" data-userid="@CurrentUser.UserId" data-uploadurl="@(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)))" data-onlineuploadurl="@(Url.Action(MVC.API.Job.AttachmentOnlineUploadSession(Model.Job.Id)))" data-qrcodeurl="@Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js")" data-removeurl="@Url.Action(MVC.API.Job.AttachmentRemove())" data-downloadallurl="@Url.Action(MVC.API.Job.AttachmentDownloadAll(Model.Job.Id))">
<div class="Disco-AttachmentUpload-DropTarget">
<h2>Drop Attachments Here</h2>
</div>
@@ -74,13 +74,17 @@
</a>
}
</div>
@if (canAddAttachments)
{
<div class="Disco-AttachmentUpload-Progress"></div>
<div class="attachmentInput clearfix">
<div class="Disco-AttachmentUpload-Progress"></div>
<div class="attachmentInput clearfix">
@if (canAddAttachments)
{
<span class="action enabled upload fa fa-upload disabled" title="Attach File"></span><span class="action enabled photo fa fa-camera disabled" title="Capture Image"></span><span class="action enabled online-upload fa fa-qrcode disabled" title="Upload with Online Services"></span>
</div>
}
}
@if (Model.Job.JobAttachments != null && Model.Job.JobAttachments.Count > 0)
{
<span class="action enabled download-all fa fa-download" title="Download All"></span>
}
</div>
</div>
</td>
}
@@ -298,6 +302,7 @@
//#region Attachments
var $Attachments = $('#Attachments');
var $attachmentOutput = $Attachments.find('.attachmentOutput');
let $attachmentDownloadHost = null;
let attachmentUploader = null;
@if (canAddAttachments)
@@ -499,7 +504,7 @@
// use iFrame
if (!$attachmentDownloadHost) {
$attachmentDownloadHost = $('<iframe>')
.attr({ 'src': url, 'title': 'Attachment Download Host' })
.attr({ 'id': 'AttachmentsDownloadHost', 'name': 'AttachmentsDownloadHost', 'src': url, 'title': 'Attachment Download Host' })
.addClass('hidden')
.appendTo('body')
.contents();
@@ -531,6 +536,46 @@
$this.click(onDownload);
});
$Attachments
.find('.attachmentInput span.download-all')
.on('click', function (event) {
const downloadAllUrl = $Attachments.attr('data-downloadallurl');
const $this = $(this);
if ($this.hasClass('fa-spinner'))
return;
$this
.removeClass('fa-download')
.addClass('fa-spinner fa-spin');
if (!$attachmentDownloadHost) {
$attachmentDownloadHost = $('<iframe>')
.attr({ 'id': 'AttachmentsDownloadHost', 'name': 'AttachmentsDownloadHost', 'title': 'Attachment Download Host' })
.addClass('hidden')
.appendTo('body')
.contents();
}
const $form = $('<form>')
.attr({
method: 'POST',
action: downloadAllUrl,
target: 'AttachmentsDownloadHost'
})
.append($('<input>')
.attr({ type: 'hidden', name: '__RequestVerificationToken' })
.val(document.body.dataset.antiforgery))
.appendTo(document.body)
.trigger('submit');
window.setTimeout(function () {
$this
.removeClass('fa-spinner fa-spin')
.addClass('fa-download');
$form.remove();
}, 2000);
});
// Add Globally Available Functions
document.DiscoFunctions.liveAddAttachment = addAttachment;
document.DiscoFunctions.liveRemoveAttachment = removeAttachment;
@@ -471,6 +471,17 @@ WriteLiteral(" data-removeurl=\"");
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-downloadallurl=\"");
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentDownloadAll(Model.Job.Id)));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" class=\"Disco-AttachmentUpload-DropTarget\"");
@@ -498,14 +509,14 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 4250), Tuple.Create("\"", 4307)
WriteAttribute("href", Tuple.Create(" href=\"", 4333), Tuple.Create("\"", 4390)
#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))
, Tuple.Create(Tuple.Create("", 4340), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
#line default
#line hidden
, 4257), false)
, 4340), false)
);
WriteLiteral(" data-attachmentid=\"");
@@ -534,28 +545,28 @@ WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"icon\"");
WriteAttribute("title", Tuple.Create(" title=\"", 4417), Tuple.Create("\"", 4437)
WriteAttribute("title", Tuple.Create(" title=\"", 4500), Tuple.Create("\"", 4520)
#line 64 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4425), Tuple.Create<System.Object, System.Int32>(ja.Filename
, Tuple.Create(Tuple.Create("", 4508), Tuple.Create<System.Object, System.Int32>(ja.Filename
#line default
#line hidden
, 4425), false)
, 4508), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 4508), Tuple.Create("\"", 4567)
WriteAttribute("src", Tuple.Create(" src=\"", 4591), Tuple.Create("\"", 4650)
#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))
, Tuple.Create(Tuple.Create("", 4597), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
#line default
#line hidden
, 4514), false)
, 4597), false)
);
WriteLiteral(" />\r\n </span>\r\n <sp" +
@@ -563,14 +574,14 @@ WriteLiteral(" />\r\n </span>\r\n
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 4668), Tuple.Create("\"", 4688)
WriteAttribute("title", Tuple.Create(" title=\"", 4751), Tuple.Create("\"", 4771)
#line 67 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4676), Tuple.Create<System.Object, System.Int32>(ja.Comments
, Tuple.Create(Tuple.Create("", 4759), Tuple.Create<System.Object, System.Int32>(ja.Comments
#line default
#line hidden
, 4676), false)
, 4759), false)
);
WriteLiteral(">\r\n");
@@ -665,14 +676,14 @@ WriteLiteral(" data-livestamp=\"");
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 5373), Tuple.Create("\"", 5411)
WriteAttribute("title", Tuple.Create(" title=\"", 5456), Tuple.Create("\"", 5494)
#line 73 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 5381), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime()
, Tuple.Create(Tuple.Create("", 5464), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime()
#line default
#line hidden
, 5381), false)
, 5464), false)
);
WriteLiteral(">");
@@ -693,63 +704,90 @@ WriteLiteral("</span>\r\n </a>\r\n");
#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(" </div>\r\n <div");
WriteLiteral(" class=\"Disco-AttachmentUpload-Progress\"");
WriteLiteral("></div>\r\n");
WriteLiteral(" <div");
WriteLiteral("></div>\r\n <div");
WriteLiteral(" class=\"attachmentInput clearfix\"");
WriteLiteral(">\r\n <span");
WriteLiteral(">\r\n");
#line 79 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 79 "..\..\Views\Job\JobParts\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><span");
WriteLiteral("></span>");
WriteLiteral("<span");
WriteLiteral(" class=\"action enabled photo fa fa-camera disabled\"");
WriteLiteral(" title=\"Capture Image\"");
WriteLiteral("></span><span");
WriteLiteral("></span>");
WriteLiteral("<span");
WriteLiteral(" class=\"action enabled online-upload fa fa-qrcode disabled\"");
WriteLiteral(" title=\"Upload with Online Services\"");
WriteLiteral("></span>\r\n </div>\r\n");
WriteLiteral("></span>\r\n");
#line 83 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line 82 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n </td>\r\n");
WriteLiteral(" ");
#line 83 "..\..\Views\Job\JobParts\Resources.cshtml"
if (Model.Job.JobAttachments != null && Model.Job.JobAttachments.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 86 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n </div>\r\n </td>\r\n");
#line 90 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -758,7 +796,7 @@ WriteLiteral(" </div>\r\n </td>\r\n");
WriteLiteral(" </tr>\r\n</table>\r\n");
#line 89 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 93 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs)
{
@@ -790,13 +828,13 @@ WriteLiteral(@" <script>
");
#line 113 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 117 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 113 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 117 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddLogs)
{
@@ -827,7 +865,7 @@ WriteLiteral("\r\n //#region Add Logs\r\n\r\n const $Comme
" ");
#line 161 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 165 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -836,7 +874,7 @@ WriteLiteral("\r\n //#region Add Logs\r\n\r\n const $Comme
WriteLiteral(" ");
#line 162 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 166 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs || canRemoveOwnLogs)
{
@@ -909,7 +947,7 @@ WriteLiteral(@"></i>&nbsp;Are you sure?</p></div>')
");
#line 217 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 221 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -953,14 +991,14 @@ WriteLiteral("\r\n async function loadLiveComment(id) {\r\n\r\n
"region\r\n });\r\n </script>\r\n");
#line 282 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 286 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 283 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 287 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments)
{
@@ -981,24 +1019,30 @@ WriteLiteral(@" <script>
var jobId = parseInt('");
#line 296 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 300 "..\..\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");
WriteLiteral(@"');
//#region Attachments
var $Attachments = $('#Attachments');
var $attachmentOutput = $Attachments.find('.attachmentOutput');
let $attachmentDownloadHost = null;
let attachmentUploader = null;
");
#line 303 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 308 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 303 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 308 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddAttachments)
{
@@ -1036,7 +1080,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n attachmen
"Tab.resourcesIndex);\r\n });\r\n //#endregion\r\n ");
#line 350 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 355 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -1045,13 +1089,13 @@ WriteLiteral("\r\n //#region Add Attachments\r\n attachmen
WriteLiteral("\r\n");
#line 352 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 357 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 352 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 357 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -1104,7 +1148,7 @@ WriteLiteral("></i>&nbsp;Are you sure?</p></div>\')\r\n .
" }\r\n\r\n //#endregion\r\n\r\n ");
#line 410 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 415 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -1114,7 +1158,7 @@ WriteLiteral("\r\n function addAttachment(key, quick) {\r\n
"id: key };\r\n $.ajax({\r\n url: \'");
#line 415 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 420 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.Attachment()));
@@ -1146,7 +1190,7 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
"\', \'");
#line 450 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 455 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentDownload()));
@@ -1178,7 +1222,7 @@ WriteLiteral(@"/' + a.Id);
img.attr('src', '");
#line 473 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 478 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentThumbnail()));
@@ -1201,38 +1245,61 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n };\
"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");
"entDownloadHost = $(\'<iframe>\')\r\n .attr({ \'id\': \'Atta" +
"chmentsDownloadHost\', \'name\': \'AttachmentsDownloadHost\', \'src\': url, \'title\': \'A" +
"ttachment Download Host\' })\r\n .addClass(\'hidden\')\r\n " +
" .appendTo(\'body\')\r\n .conten" +
"ts();\r\n } else {\r\n $attachmentDownload" +
"Host[0].location.href = url;\r\n }\r\n }\r\n\r\n " +
" return false;\r\n }\r\n\r\n function removeAttachment(" +
"key) {\r\n var $element = $attachmentOutput.find(\'a[data-attachment" +
"id=\"\' + 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 $el" +
"ement.remove();\r\n document.DiscoFunctions.liveAfterUpdate" +
"();\r\n });\r\n }\r\n }\r\n\r\n $a" +
"ttachmentOutput.children(\'a\').each(function () {\r\n $this = $(this" +
");\r\n if ($this.attr(\'data-mimetype\').toLowerCase().indexOf(\'image" +
"/\') == 0)\r\n $this.shadowbox({ gallery: \'attachments\', player:" +
" \'img\', title: $this.find(\'.comments\').text() });\r\n else\r\n " +
" $this.click(onDownload);\r\n });\r\n\r\n $Attachmen" +
"ts\r\n .find(\'.attachmentInput span.download-all\')\r\n " +
" .on(\'click\', function (event) {\r\n const downloadAllUrl = $At" +
"tachments.attr(\'data-downloadallurl\');\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 $attach" +
"mentDownloadHost = $(\'<iframe>\')\r\n .attr({ \'id\': \'Att" +
"achmentsDownloadHost\', \'name\': \'AttachmentsDownloadHost\', \'title\': \'Attachment D" +
"ownload Host\' })\r\n .addClass(\'hidden\')\r\n " +
" .appendTo(\'body\')\r\n .contents();\r\n " +
" }\r\n const $form = $(\'<form>\')\r\n " +
" .attr({\r\n method: \'POST\',\r\n " +
" action: downloadAllUrl,\r\n target: \'Attach" +
"mentsDownloadHost\'\r\n })\r\n .append(" +
"$(\'<input>\')\r\n .attr({ type: \'hidden\', name: \'__Reque" +
"stVerificationToken\' })\r\n .val(document.body.dataset." +
"antiforgery))\r\n .appendTo(document.body)\r\n " +
" .trigger(\'submit\');\r\n\r\n window.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 // Add Globally Available Functions\r\n document." +
"DiscoFunctions.liveAddAttachment = addAttachment;\r\n document.DiscoFun" +
"ctions.liveRemoveAttachment = 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 588 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 544 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 589 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs || canShowAttachments)
{
@@ -1242,7 +1309,7 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n };\
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
#line 548 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 593 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id);
@@ -1252,7 +1319,7 @@ WriteLiteral("\');\r\n\r\n //#region LiveEvents\r\n var hu
"dates;\r\n\r\n // Map Functions\r\n");
#line 554 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 599 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs)
{
@@ -1263,14 +1330,14 @@ WriteLiteral("\r\n hub.client.addLog = document.DiscoFunctions.liveLo
" ");
#line 558 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 603 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 559 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 604 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments)
{
@@ -1291,7 +1358,7 @@ WriteLiteral(@"
");
#line 572 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 617 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -1329,7 +1396,7 @@ WriteLiteral(@"
");
#line 602 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 647 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
@@ -18,7 +18,7 @@
<table id="userShowResources">
<tr>
<td id="AttachmentsContainer">
<div id="Attachments" class="@(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments") @(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments") @(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments")" data-userid="@CurrentUser.UserId" data-uploadurl="@(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)))" data-onlineuploadurl="@(Url.Action(MVC.API.User.AttachmentOnlineUploadSession(Model.User.UserId)))" data-qrcodeurl="@Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js")" data-removeurl="@Url.Action(MVC.API.User.AttachmentRemove())">
<div id="Attachments" class="@(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments") @(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments") @(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments")" data-id="@Model.User.UserId" data-userid="@CurrentUser.UserId" data-uploadurl="@(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)))" data-onlineuploadurl="@(Url.Action(MVC.API.User.AttachmentOnlineUploadSession(Model.User.UserId)))" data-qrcodeurl="@Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js")" data-removeurl="@Url.Action(MVC.API.User.AttachmentRemove())" data-downloadallurl="@Url.Action(MVC.API.User.AttachmentDownloadAll())">
<div class="Disco-AttachmentUpload-DropTarget">
<h2>Drop Attachments Here</h2>
</div>
@@ -42,13 +42,17 @@
}
}
</div>
@if (canAddAttachments)
{
<div class="Disco-AttachmentUpload-Progress"></div>
<div class="attachmentInput clearfix">
<div class="Disco-AttachmentUpload-Progress"></div>
<div class="attachmentInput clearfix">
@if (canAddAttachments)
{
<span class="action enabled upload fa fa-upload disabled" title="Attach File"></span><span class="action enabled photo fa fa-camera disabled" title="Capture Image"></span><span class="action enabled online-upload fa fa-qrcode disabled" title="Upload with Online Services"></span>
</div>
}
}
@if (Model.User.UserAttachments != null && Model.User.UserAttachments.Count > 0)
{
<span class="action enabled download-all fa fa-download" title="Download All"></span>
}
</div>
<script type="text/javascript">
Shadowbox.init({
skipSetup: true,
@@ -149,7 +153,7 @@
// use iFrame
if (!$attachmentDownloadHost) {
$attachmentDownloadHost = $('<iframe>')
.attr({ 'src': url, 'title': 'Attachment Download Host' })
.attr({ 'id': 'AttachmentsDownloadHost', 'name': 'AttachmentsDownloadHost', 'src': url, 'title': 'Attachment Download Host' })
.addClass('hidden')
.appendTo('body')
.contents();
@@ -180,6 +184,50 @@
$('#UserDetailTab-ResourcesLink').text(tabHeading);
}
$Attachments
.find('.attachmentInput span.download-all')
.on('click', function (event) {
const downloadAllUrl = $Attachments.attr('data-downloadallurl');
const id = $Attachments.attr('data-id');
const $this = $(this);
if ($this.hasClass('fa-spinner'))
return;
$this
.removeClass('fa-download')
.addClass('fa-spinner fa-spin');
if (!$attachmentDownloadHost) {
$attachmentDownloadHost = $('<iframe>')
.attr({ 'id': 'AttachmentsDownloadHost', 'name': 'AttachmentsDownloadHost', 'title': 'Attachment Download Host' })
.addClass('hidden')
.appendTo('body')
.contents();
}
const $form = $('<form>')
.attr({
method: 'POST',
action: downloadAllUrl,
target: 'AttachmentsDownloadHost'
})
.append($('<input>')
.attr({ type: 'hidden', name: '__RequestVerificationToken' })
.val(document.body.dataset.antiforgery))
.append($('<input>')
.attr({ type: 'hidden', name: 'id' })
.val(id))
.appendTo(document.body)
.trigger('submit');
window.setTimeout(function () {
$this
.removeClass('fa-spinner fa-spin')
.addClass('fa-download');
$form.remove();
}, 2000);
});
document.DiscoFunctions.onAttachmentAdded = onAttachmentAdded;
document.DiscoFunctions.onAttachmentRemoved = onAttachmentRemoved;
@@ -105,11 +105,22 @@ WriteAttribute("class", Tuple.Create(" class=\"", 804), Tuple.Create("\"", 1051)
, 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);
Write(CurrentUser.UserId);
#line default
@@ -120,7 +131,7 @@ WriteLiteral(" data-uploadurl=\"");
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)));
Write(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)));
#line default
@@ -131,7 +142,7 @@ WriteLiteral(" data-onlineuploadurl=\"");
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentOnlineUploadSession(Model.User.UserId)));
Write(Url.Action(MVC.API.User.AttachmentOnlineUploadSession(Model.User.UserId)));
#line default
@@ -142,7 +153,7 @@ WriteLiteral(" data-qrcodeurl=\"");
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js"));
Write(Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js"));
#line default
@@ -153,7 +164,18 @@ WriteLiteral(" data-removeurl=\"");
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentRemove()));
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
@@ -189,14 +211,14 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 1884), Tuple.Create("\"", 1942)
WriteAttribute("href", Tuple.Create(" href=\"", 1985), Tuple.Create("\"", 2043)
#line 30 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1891), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentDownload(ua.Id))
, Tuple.Create(Tuple.Create("", 1992), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentDownload(ua.Id))
#line default
#line hidden
, 1891), false)
, 1992), false)
);
WriteLiteral(" data-attachmentid=\"");
@@ -225,28 +247,28 @@ WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"icon\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2056), Tuple.Create("\"", 2076)
WriteAttribute("title", Tuple.Create(" title=\"", 2157), Tuple.Create("\"", 2177)
#line 31 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2064), Tuple.Create<System.Object, System.Int32>(ua.Filename
, Tuple.Create(Tuple.Create("", 2165), Tuple.Create<System.Object, System.Int32>(ua.Filename
#line default
#line hidden
, 2064), false)
, 2165), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 2151), Tuple.Create("\"", 2211)
WriteAttribute("src", Tuple.Create(" src=\"", 2252), Tuple.Create("\"", 2312)
#line 32 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2157), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentThumbnail(ua.Id))
, Tuple.Create(Tuple.Create("", 2258), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentThumbnail(ua.Id))
#line default
#line hidden
, 2157), false)
, 2258), false)
);
WriteLiteral(" />\r\n </span>\r\n " +
@@ -254,14 +276,14 @@ WriteLiteral(" />\r\n </span>\r\n
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2320), Tuple.Create("\"", 2340)
WriteAttribute("title", Tuple.Create(" title=\"", 2421), Tuple.Create("\"", 2441)
#line 34 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2328), Tuple.Create<System.Object, System.Int32>(ua.Comments
, Tuple.Create(Tuple.Create("", 2429), Tuple.Create<System.Object, System.Int32>(ua.Comments
#line default
#line hidden
, 2328), false)
, 2429), false)
);
WriteLiteral(">\r\n");
@@ -356,14 +378,14 @@ WriteLiteral(" data-livestamp=\"");
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 3049), Tuple.Create("\"", 3087)
WriteAttribute("title", Tuple.Create(" title=\"", 3150), Tuple.Create("\"", 3188)
#line 40 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3057), Tuple.Create<System.Object, System.Int32>(ua.Timestamp.ToFullDateTime()
, Tuple.Create(Tuple.Create("", 3158), Tuple.Create<System.Object, System.Int32>(ua.Timestamp.ToFullDateTime()
#line default
#line hidden
, 3057), false)
, 3158), false)
);
WriteLiteral(">");
@@ -385,60 +407,87 @@ WriteLiteral("</span>\r\n </a>\r\n");
#line default
#line hidden
WriteLiteral(" </div>\r\n");
#line 45 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 45 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" </div>\r\n <div");
WriteLiteral(" class=\"Disco-AttachmentUpload-Progress\"");
WriteLiteral("></div>\r\n");
WriteLiteral(" <div");
WriteLiteral("></div>\r\n <div");
WriteLiteral(" class=\"attachmentInput clearfix\"");
WriteLiteral(">\r\n <span");
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><span");
WriteLiteral("></span>");
WriteLiteral("<span");
WriteLiteral(" class=\"action enabled photo fa fa-camera disabled\"");
WriteLiteral(" title=\"Capture Image\"");
WriteLiteral("></span><span");
WriteLiteral("></span>");
WriteLiteral("<span");
WriteLiteral(" class=\"action enabled online-upload fa fa-qrcode disabled\"");
WriteLiteral(" title=\"Upload with Online Services\"");
WriteLiteral("></span>\r\n </div>\r\n");
WriteLiteral("></span>\r\n");
#line 51 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line 50 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" <script");
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\"");
@@ -460,7 +509,7 @@ WriteLiteral(@">
url: '");
#line 67 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 71 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.Attachment()));
@@ -497,7 +546,7 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
"ef\', \'");
#line 101 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 105 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentDownload()));
@@ -529,7 +578,7 @@ WriteLiteral(@"/' + a.Id);
img.attr('src', '");
#line 124 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 128 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentThumbnail()));
@@ -557,38 +606,72 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n
"\n // use iFrame\r\n " +
" if (!$attachmentDownloadHost) {\r\n " +
" $attachmentDownloadHost = $(\'<iframe>\')\r\n " +
" .attr({ \'src\': url, \'title\': \'Attachment Download Host\' })\r\n " +
" .addClass(\'hidden\')\r\n " +
" .appendTo(\'body\')\r\n .c" +
"ontents();\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 " +
" function onAttachmentRemoved(id) {\r\n v" +
"ar a = $attachmentOutput.find(\'a[data-attachmentid=\' + id + \']\');\r\n\r\n " +
" a.hide(300).delay(300).queue(function () {\r\n " +
" var $this = $(this);\r\n i" +
"f ($this.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
" Shadowbox.removeCache(this);\r\n " +
" $this.find(\'.timestamp\').livestamp(\'destroy\');\r\n " +
" $this.remove();\r\n onUpdat" +
"e();\r\n });\r\n }\r\n\r\n " +
" function onUpdate() {\r\n v" +
"ar attachmentCount = $attachmentOutput.children(\'a\').length;\r\n " +
" var tabHeading = \'Attachments [\' + attachmentCount + \']\';\r\n " +
" $(\'#UserDetailTab-ResourcesLink\').text(tabHeading);\r\n " +
" }\r\n\r\n document.DiscoFunctio" +
"ns.onAttachmentAdded = onAttachmentAdded;\r\n document." +
"DiscoFunctions.onAttachmentRemoved = onAttachmentRemoved;\r\n\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.att" +
"r(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\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 attachmen" +
"tCount = $attachmentOutput.children(\'a\').length;\r\n " +
" var tabHeading = \'Attachments [\' + attachmentCount + \']\';\r\n " +
" $(\'#UserDetailTab-ResourcesLink\').text(tabHeading);\r\n " +
" }\r\n\r\n $Attachments\r\n " +
" .find(\'.attachmentInput span.download-all\')\r\n " +
" .on(\'click\', function (event) {\r\n c" +
"onst downloadAllUrl = $Attachments.attr(\'data-downloadallurl\');\r\n " +
" const id = $Attachments.attr(\'data-id\');\r\n " +
" const $this = $(this);\r\n\r\n " +
" if ($this.hasClass(\'fa-spinner\'))\r\n retu" +
"rn;\r\n\r\n $this\r\n " +
" .removeClass(\'fa-download\')\r\n ." +
"addClass(\'fa-spinner fa-spin\');\r\n\r\n if (!$att" +
"achmentDownloadHost) {\r\n $attachmentDownl" +
"oadHost = $(\'<iframe>\')\r\n .attr({ \'id" +
"\': \'AttachmentsDownloadHost\', \'name\': \'AttachmentsDownloadHost\', \'title\': \'Attac" +
"hment Download Host\' })\r\n .addClass(\'" +
"hidden\')\r\n .appendTo(\'body\')\r\n " +
" .contents();\r\n " +
" }\r\n const $form = $(\'<form>\')\r\n " +
" .attr({\r\n " +
" method: \'POST\',\r\n action: downl" +
"oadAllUrl,\r\n target: \'AttachmentsDown" +
"loadHost\'\r\n })\r\n " +
" .append($(\'<input>\')\r\n " +
" .attr({ type: \'hidden\', name: \'__RequestVerificationToken\' })\r\n " +
" .val(document.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 " +
" window.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 document.DiscoFunctions.onAttachmentAdded =" +
" onAttachmentAdded;\r\n document.DiscoFunctions.onAttac" +
"hmentRemoved = onAttachmentRemoved;\r\n\r\n");
#line 186 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 234 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 186 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 234 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
@@ -635,7 +718,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
" //#endregion\r\n ");
#line 233 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 281 "..\..\Views\User\UserParts\_Resources.cshtml"
}
@@ -644,7 +727,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
WriteLiteral(" ");
#line 234 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 282 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -688,7 +771,7 @@ WriteLiteral("\r\n //#region Remove Attachments\r\n\r
"");
#line 287 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 335 "..\..\Views\User\UserParts\_Resources.cshtml"
}
@@ -712,7 +795,7 @@ WriteLiteral(@"
$('#UserDetailTabItems').append('<li><a href=""#UserDetailTab-Resources"" id=""UserDetailTab-ResourcesLink"">Attachments [");
#line 303 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 351 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Model.User.UserAttachments == null ? 0 : Model.User.UserAttachments.Count);
@@ -721,7 +804,7 @@ WriteLiteral(@"
WriteLiteral("]</a></li>\');\r\n </script>\r\n</div>\r\n");
#line 306 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 354 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -743,7 +826,7 @@ WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n");
#line 313 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 361 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default