feature: display pdf attachments inline

This commit is contained in:
Gary Sharp
2026-01-26 16:34:26 +11:00
parent f807d75162
commit 204d57a4a5
15 changed files with 6285 additions and 274 deletions
@@ -547,7 +547,7 @@ namespace Disco.Web.Areas.API.Controllers
#region Device Attachments #region Device Attachments
[DiscoAuthorize(Claims.Device.ShowAttachments), OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)] [DiscoAuthorize(Claims.Device.ShowAttachments), OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentDownload(int id) public virtual ActionResult AttachmentDownload(int id, bool? inline = null)
{ {
var da = Database.DeviceAttachments.Find(id); var da = Database.DeviceAttachments.Find(id);
if (da != null) if (da != null)
@@ -555,7 +555,7 @@ namespace Disco.Web.Areas.API.Controllers
var filePath = da.RepositoryFilename(Database); var filePath = da.RepositoryFilename(Database);
if (System.IO.File.Exists(filePath)) if (System.IO.File.Exists(filePath))
{ {
return File(filePath, da.MimeType, da.Filename); return File(filePath, da.MimeType, (inline ?? false) ? null : da.Filename);
} }
else else
{ {
@@ -1927,7 +1927,7 @@ namespace Disco.Web.Areas.API.Controllers
#region Job Attachments #region Job Attachments
[DiscoAuthorize(Claims.Job.ShowAttachments), OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)] [DiscoAuthorize(Claims.Job.ShowAttachments), OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentDownload(int id) public virtual ActionResult AttachmentDownload(int id, bool? inline = null)
{ {
var ja = Database.JobAttachments.Find(id); var ja = Database.JobAttachments.Find(id);
if (ja != null) if (ja != null)
@@ -1935,7 +1935,7 @@ namespace Disco.Web.Areas.API.Controllers
var filePath = ja.RepositoryFilename(Database); var filePath = ja.RepositoryFilename(Database);
if (System.IO.File.Exists(filePath)) if (System.IO.File.Exists(filePath))
{ {
return File(filePath, ja.MimeType, ja.Filename); return File(filePath, ja.MimeType, (inline ?? false) ? null : ja.Filename);
} }
else else
{ {
@@ -108,7 +108,7 @@ namespace Disco.Web.Areas.API.Controllers
[DiscoAuthorize(Claims.User.ShowAttachments)] [DiscoAuthorize(Claims.User.ShowAttachments)]
[OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)] [OutputCache(Location = System.Web.UI.OutputCacheLocation.Client, Duration = 172800)]
public virtual ActionResult AttachmentDownload(int id) public virtual ActionResult AttachmentDownload(int id, bool? inline = null)
{ {
var ua = Database.UserAttachments.Find(id); var ua = Database.UserAttachments.Find(id);
if (ua != null) if (ua != null)
@@ -116,7 +116,7 @@ namespace Disco.Web.Areas.API.Controllers
var filePath = ua.RepositoryFilename(Database); var filePath = ua.RepositoryFilename(Database);
if (System.IO.File.Exists(filePath)) if (System.IO.File.Exists(filePath))
{ {
return File(filePath, ua.MimeType, ua.Filename); return File(filePath, ua.MimeType, (inline ?? false) ? null : ua.Filename);
} }
else else
{ {
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -544,6 +544,7 @@ namespace Disco.Web.Areas.API.Controllers
public class ActionParamsClass_AttachmentDownload public class ActionParamsClass_AttachmentDownload
{ {
public readonly string id = "id"; public readonly string id = "id";
public readonly string inline = "inline";
} }
static readonly ActionParamsClass_AttachmentDownloadAll s_params_AttachmentDownloadAll = new ActionParamsClass_AttachmentDownloadAll(); static readonly ActionParamsClass_AttachmentDownloadAll s_params_AttachmentDownloadAll = new ActionParamsClass_AttachmentDownloadAll();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -945,14 +946,15 @@ namespace Disco.Web.Areas.API.Controllers
} }
[NonAction] [NonAction]
partial void AttachmentDownloadOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id); partial void AttachmentDownloadOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, bool? inline);
[NonAction] [NonAction]
public override System.Web.Mvc.ActionResult AttachmentDownload(int id) public override System.Web.Mvc.ActionResult AttachmentDownload(int id, bool? inline)
{ {
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentDownload); var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentDownload);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
AttachmentDownloadOverride(callInfo, id); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "inline", inline);
AttachmentDownloadOverride(callInfo, id, inline);
return callInfo; return callInfo;
} }
@@ -1184,6 +1184,7 @@ namespace Disco.Web.Areas.API.Controllers
public class ActionParamsClass_AttachmentDownload public class ActionParamsClass_AttachmentDownload
{ {
public readonly string id = "id"; public readonly string id = "id";
public readonly string inline = "inline";
} }
static readonly ActionParamsClass_AttachmentDownloadAll s_params_AttachmentDownloadAll = new ActionParamsClass_AttachmentDownloadAll(); static readonly ActionParamsClass_AttachmentDownloadAll s_params_AttachmentDownloadAll = new ActionParamsClass_AttachmentDownloadAll();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -2071,14 +2072,15 @@ namespace Disco.Web.Areas.API.Controllers
} }
[NonAction] [NonAction]
partial void AttachmentDownloadOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id); partial void AttachmentDownloadOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, bool? inline);
[NonAction] [NonAction]
public override System.Web.Mvc.ActionResult AttachmentDownload(int id) public override System.Web.Mvc.ActionResult AttachmentDownload(int id, bool? inline)
{ {
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentDownload); var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentDownload);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
AttachmentDownloadOverride(callInfo, id); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "inline", inline);
AttachmentDownloadOverride(callInfo, id, inline);
return callInfo; return callInfo;
} }
@@ -230,6 +230,7 @@ namespace Disco.Web.Areas.API.Controllers
public class ActionParamsClass_AttachmentDownload public class ActionParamsClass_AttachmentDownload
{ {
public readonly string id = "id"; public readonly string id = "id";
public readonly string inline = "inline";
} }
static readonly ActionParamsClass_AttachmentDownloadAll s_params_AttachmentDownloadAll = new ActionParamsClass_AttachmentDownloadAll(); static readonly ActionParamsClass_AttachmentDownloadAll s_params_AttachmentDownloadAll = new ActionParamsClass_AttachmentDownloadAll();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -370,14 +371,15 @@ namespace Disco.Web.Areas.API.Controllers
} }
[NonAction] [NonAction]
partial void AttachmentDownloadOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id); partial void AttachmentDownloadOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, bool? inline);
[NonAction] [NonAction]
public override System.Web.Mvc.ActionResult AttachmentDownload(int id) public override System.Web.Mvc.ActionResult AttachmentDownload(int id, bool? inline)
{ {
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentDownload); var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AttachmentDownload);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
AttachmentDownloadOverride(callInfo, id); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "inline", inline);
AttachmentDownloadOverride(callInfo, id, inline);
return callInfo; return callInfo;
} }
@@ -56,7 +56,19 @@
<script type="text/javascript"> <script type="text/javascript">
Shadowbox.init({ Shadowbox.init({
skipSetup: true, skipSetup: true,
modal: true modal: true,
onOpen: function (obj) {
if (obj.player === 'iframe' && obj.content.indexOf('inline=True') === -1) {
obj.content += (obj.content.indexOf('?') === -1 ? '?' : '&') + 'inline=True';
}
return true;
},
onChange: function (obj) {
if (obj.player === 'iframe' && obj.content.indexOf('inline=True') === -1) {
obj.content += (obj.content.indexOf('?') === -1 ? '?' : '&') + 'inline=True';
}
return true;
}
}); });
$(function () { $(function () {
const $Attachments = $('#Attachments'); const $Attachments = $('#Attachments');
@@ -117,6 +129,8 @@
e.show('slow'); e.show('slow');
if (a.MimeType.toLowerCase().indexOf('image/') == 0) if (a.MimeType.toLowerCase().indexOf('image/') == 0)
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description }); e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description });
else if (a.MimeType.toLowerCase().indexOf('application/pdf') == 0 && navigator.pdfViewerEnabled)
e.shadowbox({ gallery: 'attachments', player: 'iframe', title: a.Description });
else else
e.click(onDownload); e.click(onDownload);
@@ -171,7 +185,7 @@
a.hide(300).delay(300).queue(function () { a.hide(300).delay(300).queue(function () {
var $this = $(this); var $this = $(this);
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0) if (this['shadowboxCacheKey'])
Shadowbox.removeCache(this); Shadowbox.removeCache(this);
$this.find('.timestamp').livestamp('destroy'); $this.find('.timestamp').livestamp('destroy');
$this.remove(); $this.remove();
@@ -337,6 +351,8 @@
$this = $(this); $this = $(this);
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0) if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
$this.shadowbox({ gallery: 'attachments', player: 'img', title: $this.find('.comments').text() }); $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 else
$this.click(onDownload); $this.click(onDownload);
}); });
@@ -491,25 +491,29 @@ WriteLiteral(" </div>\r\n <script");
WriteLiteral(" type=\"text/javascript\""); WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@"> WriteLiteral(">\r\n Shadowbox.init({\r\n skipSetu" +
Shadowbox.init({ "p: true,\r\n modal: true,\r\n " +
skipSetup: true, "onOpen: function (obj) {\r\n if (obj.player === \'if" +
modal: true "rame\' && obj.content.indexOf(\'inline=True\') === -1) {\r\n " +
}); " obj.content += (obj.content.indexOf(\'?\') === -1 ? \'?\' : \'&\') + \'inlin" +
$(function () { "e=True\';\r\n }\r\n ret" +
const $Attachments = $('#Attachments'); "urn true;\r\n },\r\n onChange:" +
const $attachmentOutput = $Attachments.find('.attachmentOutput'); " function (obj) {\r\n if (obj.player === \'iframe\' &" +
let $attachmentDownloadHost = null; "& obj.content.indexOf(\'inline=True\') === -1) {\r\n " +
let $dialogRemoveAttachment = null; " obj.content += (obj.content.indexOf(\'?\') === -1 ? \'?\' : \'&\') + \'inline=True\'" +
let attachmentUploader = null; ";\r\n }\r\n return tru" +
"e;\r\n }\r\n });\r\n " +
function onAttachmentAdded(id, quick) { " $(function () {\r\n const $Attachments = $(\'#At" +
var data = { id: id }; "tachments\');\r\n const $attachmentOutput = $Attachments" +
$.ajax({ ".find(\'.attachmentOutput\');\r\n let $attachmentDownload" +
url: '"); "Host = null;\r\n let $dialogRemoveAttachment = null;\r\n " +
" let attachmentUploader = null;\r\n\r\n " +
" function onAttachmentAdded(id, quick) {\r\n " +
" var data = { id: id };\r\n $.ajax({\r\n " +
" url: \'");
#line 71 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 83 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.Attachment())); Write(Url.Action(MVC.API.Device.Attachment()));
@@ -546,39 +550,36 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
"href\', \'"); "href\', \'");
#line 106 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 118 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentDownload())); Write(Url.Action(MVC.API.Device.AttachmentDownload()));
#line default #line default
#line hidden #line hidden
WriteLiteral(@"/' + a.Id); WriteLiteral("/\' + a.Id);\r\n e.find(\'.comments\').text(a.Descripti" +
e.find('.comments').text(a.Description); "on);\r\n e.find(\'.author\').text(a.Author);\r\n " +
e.find('.author').text(a.Author); " e.find(\'.timestamp\').text(a.TimestampFull).attr(\'title\'" +
e.find('.timestamp').text(a.TimestampFull).attr('title', a.TimestampFull).livestamp(a.TimestampUnixEpoc); ", a.TimestampFull).livestamp(a.TimestampUnixEpoc);\r\n " +
if (canRemove) " if (canRemove)\r\n e.find(\'.remove\').click(" +
e.find('.remove').click(removeAttachment); "removeAttachment);\r\n if (!quick)\r\n " +
if (!quick) " e.hide();\r\n $attachmentOutpu" +
e.hide(); "t.prepend(e);\r\n onUpdate();\r\n " +
$attachmentOutput.prepend(e); " if (!quick)\r\n e.show(\'slow\');\r\n " +
onUpdate(); " if (a.MimeType.toLowerCase().indexOf(\'image/\') == " +
if (!quick) "0)\r\n e.shadowbox({ gallery: \'attachments\', pl" +
e.show('slow'); "ayer: \'img\', title: a.Description });\r\n else if (" +
if (a.MimeType.toLowerCase().indexOf('image/') == 0) "a.MimeType.toLowerCase().indexOf(\'application/pdf\') == 0 && navigator.pdfViewerE" +
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description }); "nabled)\r\n e.shadowbox({ gallery: \'attachments" +
else "\', player: \'iframe\', title: a.Description });\r\n e" +
e.click(onDownload); "lse\r\n e.click(onDownload);\r\n\r\n " +
" // Add Thumbnail\r\n var buildThum" +
// Add Thumbnail "bnail = function () {\r\n var retryCount = 0;\r\n" +
var buildThumbnail = function () { " var img = e.find(\'.icon img\');\r\n\r\n " +
var retryCount = 0; " var setThumbnailUrl = function () {\r\n " +
var img = e.find('.icon img'); " img.attr(\'src\', \'");
var setThumbnailUrl = function () {
img.attr('src', '");
#line 129 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 143 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentThumbnail())); Write(Url.Action(MVC.API.Device.AttachmentThumbnail()));
@@ -617,61 +618,60 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n
"mentRemoved(id) {\r\n var a = $attachmentOutput.fin" + "mentRemoved(id) {\r\n var a = $attachmentOutput.fin" +
"d(\'a[data-attachmentid=\' + id + \']\');\r\n\r\n a.hide(" + "d(\'a[data-attachmentid=\' + id + \']\');\r\n\r\n a.hide(" +
"300).delay(300).queue(function () {\r\n var $th" + "300).delay(300).queue(function () {\r\n var $th" +
"is = $(this);\r\n if ($this.attr(\'data-mimetype" + "is = $(this);\r\n if (this[\'shadowboxCacheKey\']" +
"\').toLowerCase().indexOf(\'image/\') == 0)\r\n " + ")\r\n Shadowbox.removeCache(this);\r\n " +
" Shadowbox.removeCache(this);\r\n $this.find(\'" + " $this.find(\'.timestamp\').livestamp(\'destroy\');\r\n " +
".timestamp\').livestamp(\'destroy\');\r\n $this.re" + " $this.remove();\r\n " +
"move();\r\n onUpdate();\r\n " + " onUpdate();\r\n });\r\n " +
" });\r\n }\r\n\r\n func" + " }\r\n\r\n function onUpdate() {\r\n " +
"tion onUpdate() {\r\n var attachmentCount = $attach" + " var attachmentCount = $attachmentOutput.children(\'a\').length;\r\n " +
"mentOutput.children(\'a\').length;\r\n var tabHeading" + " var tabHeading = \'Attachments [\' + attachmentCount + " +
" = \'Attachments [\' + attachmentCount + \']\';\r\n $(\'" + "\']\';\r\n $(\'#DeviceDetailTab-ResourcesLink\').text(t" +
"#DeviceDetailTab-ResourcesLink\').text(tabHeading);\r\n " + "abHeading);\r\n }\r\n\r\n $Attac" +
"}\r\n\r\n $Attachments\r\n ." + "hments\r\n .find(\'.attachmentInput span.download-al" +
"find(\'.attachmentInput span.download-all\')\r\n .on(" + "l\')\r\n .on(\'click\', function (event) {\r\n " +
"\'click\', function (event) {\r\n const downloadA" + " const downloadAllUrl = $Attachments.attr(\'data-downloa" +
"llUrl = $Attachments.attr(\'data-downloadallurl\');\r\n " + "dallurl\');\r\n const id = $Attachments.attr(\'da" +
" const id = $Attachments.attr(\'data-id\');\r\n " + "ta-id\');\r\n const $this = $(this);\r\n\r\n " +
" const $this = $(this);\r\n\r\n if ($this.has" + " if ($this.hasClass(\'fa-spinner\'))\r\n " +
"Class(\'fa-spinner\'))\r\n return;\r\n\r\n " + " return;\r\n\r\n $this\r\n " +
" $this\r\n .rem" + " .removeClass(\'fa-download\')\r\n " +
"oveClass(\'fa-download\')\r\n .addClass(\'fa-s" + " .addClass(\'fa-spinner fa-spin\');\r\n\r\n " +
"pinner fa-spin\');\r\n\r\n if (!$attachmentDownloa" + " if (!$attachmentDownloadHost) {\r\n " +
"dHost) {\r\n $attachmentDownloadHost = $(\'<" + " $attachmentDownloadHost = $(\'<iframe>\')\r\n " +
"iframe>\')\r\n .attr({ \'id\': \'Attachment" + " .attr({ \'id\': \'AttachmentsDownloadHost\', \'name\': \'AttachmentsDow" +
"sDownloadHost\', \'name\': \'AttachmentsDownloadHost\', \'title\': \'Attachment Download" + "nloadHost\', \'title\': \'Attachment Download Host\' })\r\n " +
" Host\' })\r\n .addClass(\'hidden\')\r\n " + " .addClass(\'hidden\')\r\n " +
" .appendTo(\'body\')\r\n " + " .appendTo(\'body\')\r\n .contents();\r\n " +
" .contents();\r\n }\r\n " + " }\r\n const $" +
" const $form = $(\'<form>\')\r\n " + "form = $(\'<form>\')\r\n .attr({\r\n " +
" .attr({\r\n method: " + " method: \'POST\',\r\n " +
"\'POST\',\r\n action: downloadAllUrl,\r\n " + " action: downloadAllUrl,\r\n " +
" target: \'AttachmentsDownloadHost\'\r\n " + " target: \'AttachmentsDownloadHost\'\r\n })" +
" })\r\n " + "\r\n .append($(\'<input>\')\r\n " +
" .append($(\'<input>\')\r\n .attr({ type:" + " .attr({ type: \'hidden\', name: \'__RequestVerification" +
" \'hidden\', name: \'__RequestVerificationToken\' })\r\n " + "Token\' })\r\n .val(document.body.datase" +
" .val(document.body.dataset.antiforgery))\r\n " + "t.antiforgery))\r\n .append($(\'<input>\')\r\n " +
" .append($(\'<input>\')\r\n " + " .attr({ type: \'hidden\', name: \'id\' })" +
" .attr({ type: \'hidden\', name: \'id\' })\r\n " + "\r\n .val(id))\r\n " +
" .val(id))\r\n .appendTo(document.body)" + " .appendTo(document.body)\r\n " +
"\r\n .trigger(\'submit\');\r\n\r\n " + " .trigger(\'submit\');\r\n\r\n window.setTimeout(" +
" window.setTimeout(function () {\r\n " + "function () {\r\n $this\r\n " +
" $this\r\n .removeClass(\'f" + " .removeClass(\'fa-spinner fa-spin\')\r\n " +
"a-spinner fa-spin\')\r\n .addClass(\'fa-d" + " .addClass(\'fa-download\');\r\n " +
"ownload\');\r\n $form.remove();\r\n " + " $form.remove();\r\n }, 2000);\r\n " +
" }, 2000);\r\n });\r\n\r\n " + " });\r\n\r\n document.DiscoFu" +
" document.DiscoFunctions.onAttachmentAdded = onAttachmentA" + "nctions.onAttachmentAdded = onAttachmentAdded;\r\n docu" +
"dded;\r\n document.DiscoFunctions.onAttachmentRemoved =" + "ment.DiscoFunctions.onAttachmentRemoved = onAttachmentRemoved;\r\n\r\n");
" onAttachmentRemoved;\r\n\r\n");
#line 235 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 249 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line default #line default
#line hidden #line hidden
#line 235 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 249 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canAddAttachments) if (canAddAttachments)
{ {
@@ -718,7 +718,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
" //#endregion\r\n "); " //#endregion\r\n ");
#line 282 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 296 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
} }
@@ -727,7 +727,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
WriteLiteral(" "); WriteLiteral(" ");
#line 283 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 297 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments) if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{ {
@@ -770,7 +770,7 @@ WriteLiteral("\r\n //#region Remove Attachments\r\n
" }\r\n //#endregion\r\n "); " }\r\n //#endregion\r\n ");
#line 334 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 348 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
} }
@@ -781,6 +781,8 @@ WriteLiteral(@"
$this = $(this); $this = $(this);
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0) if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
$this.shadowbox({ gallery: 'attachments', player: 'img', title: $this.find('.comments').text() }); $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 else
$this.click(onDownload); $this.click(onDownload);
}); });
@@ -807,7 +809,7 @@ WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n <scr
"etailTab-ResourcesLink\">Attachments ["); "etailTab-ResourcesLink\">Attachments [");
#line 355 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 371 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Model.Device.DeviceAttachments == null ? 0 : Model.Device.DeviceAttachments.Count); Write(Model.Device.DeviceAttachments == null ? 0 : Model.Device.DeviceAttachments.Count);
+18 -2
View File
@@ -289,7 +289,19 @@
<script> <script>
Shadowbox.init({ Shadowbox.init({
skipSetup: true, skipSetup: true,
modal: true modal: true,
onOpen: function (obj) {
if (obj.player === 'iframe' && obj.content.indexOf('inline=True') === -1) {
obj.content += (obj.content.indexOf('?') === -1 ? '?' : '&') + 'inline=True';
}
return true;
},
onChange: function (obj) {
if (obj.player === 'iframe' && obj.content.indexOf('inline=True') === -1) {
obj.content += (obj.content.indexOf('?') === -1 ? '?' : '&') + 'inline=True';
}
return true;
}
}); });
if (!document.DiscoFunctions) { if (!document.DiscoFunctions) {
@@ -466,6 +478,8 @@
e.show('slow'); e.show('slow');
if (a.MimeType.toLowerCase().indexOf('image/') == 0) if (a.MimeType.toLowerCase().indexOf('image/') == 0)
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description }); e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description });
else if (a.MimeType.toLowerCase().indexOf('application/pdf') == 0 && navigator.pdfViewerEnabled)
e.shadowbox({ gallery: 'attachments', player: 'iframe', title: a.Description });
else else
e.click(onDownload); e.click(onDownload);
@@ -520,7 +534,7 @@
var $element = $attachmentOutput.find('a[data-attachmentid="' + key + '"]'); var $element = $attachmentOutput.find('a[data-attachmentid="' + key + '"]');
if ($element.length > 0) { if ($element.length > 0) {
$element.hide(300).delay(300).queue(function () { $element.hide(300).delay(300).queue(function () {
if ($element.attr('data-mimetype').toLowerCase().indexOf('image/') == 0) if (this['shadowboxCacheKey'])
Shadowbox.removeCache(this); Shadowbox.removeCache(this);
$element.remove(); $element.remove();
document.DiscoFunctions.liveAfterUpdate(); document.DiscoFunctions.liveAfterUpdate();
@@ -532,6 +546,8 @@
$this = $(this); $this = $(this);
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0) if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
$this.shadowbox({ gallery: 'attachments', player: 'img', title: $this.find('.comments').text() }); $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 else
$this.click(onDownload); $this.click(onDownload);
}); });
@@ -1008,7 +1008,19 @@ WriteLiteral("\r\n async function loadLiveComment(id) {\r\n\r\n
WriteLiteral(@" <script> WriteLiteral(@" <script>
Shadowbox.init({ Shadowbox.init({
skipSetup: true, skipSetup: true,
modal: true modal: true,
onOpen: function (obj) {
if (obj.player === 'iframe' && obj.content.indexOf('inline=True') === -1) {
obj.content += (obj.content.indexOf('?') === -1 ? '?' : '&') + 'inline=True';
}
return true;
},
onChange: function (obj) {
if (obj.player === 'iframe' && obj.content.indexOf('inline=True') === -1) {
obj.content += (obj.content.indexOf('?') === -1 ? '?' : '&') + 'inline=True';
}
return true;
}
}); });
if (!document.DiscoFunctions) { if (!document.DiscoFunctions) {
@@ -1019,7 +1031,7 @@ WriteLiteral(@" <script>
var jobId = parseInt('"); var jobId = parseInt('");
#line 300 "..\..\Views\Job\JobParts\Resources.cshtml" #line 312 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id); Write(Model.Job.Id);
@@ -1036,13 +1048,13 @@ WriteLiteral(@"');
"); ");
#line 308 "..\..\Views\Job\JobParts\Resources.cshtml" #line 320 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default #line default
#line hidden #line hidden
#line 308 "..\..\Views\Job\JobParts\Resources.cshtml" #line 320 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddAttachments) if (canAddAttachments)
{ {
@@ -1080,7 +1092,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n attachmen
"Tab.resourcesIndex);\r\n });\r\n //#endregion\r\n "); "Tab.resourcesIndex);\r\n });\r\n //#endregion\r\n ");
#line 355 "..\..\Views\Job\JobParts\Resources.cshtml" #line 367 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
@@ -1089,13 +1101,13 @@ WriteLiteral("\r\n //#region Add Attachments\r\n attachmen
WriteLiteral("\r\n"); WriteLiteral("\r\n");
#line 357 "..\..\Views\Job\JobParts\Resources.cshtml" #line 369 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default #line default
#line hidden #line hidden
#line 357 "..\..\Views\Job\JobParts\Resources.cshtml" #line 369 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments) if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{ {
@@ -1148,7 +1160,7 @@ WriteLiteral("></i>&nbsp;Are you sure?</p></div>\')\r\n .
" }\r\n\r\n //#endregion\r\n\r\n "); " }\r\n\r\n //#endregion\r\n\r\n ");
#line 415 "..\..\Views\Job\JobParts\Resources.cshtml" #line 427 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
@@ -1158,7 +1170,7 @@ WriteLiteral("\r\n function addAttachment(key, quick) {\r\n
"id: key };\r\n $.ajax({\r\n url: \'"); "id: key };\r\n $.ajax({\r\n url: \'");
#line 420 "..\..\Views\Job\JobParts\Resources.cshtml" #line 432 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.Attachment())); Write(Url.Action(MVC.API.Job.Attachment()));
@@ -1190,7 +1202,7 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
"\', \'"); "\', \'");
#line 455 "..\..\Views\Job\JobParts\Resources.cshtml" #line 467 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentDownload())); Write(Url.Action(MVC.API.Job.AttachmentDownload()));
@@ -1210,6 +1222,8 @@ WriteLiteral(@"/' + a.Id);
e.show('slow'); e.show('slow');
if (a.MimeType.toLowerCase().indexOf('image/') == 0) if (a.MimeType.toLowerCase().indexOf('image/') == 0)
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description }); e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description });
else if (a.MimeType.toLowerCase().indexOf('application/pdf') == 0 && navigator.pdfViewerEnabled)
e.shadowbox({ gallery: 'attachments', player: 'iframe', title: a.Description });
else else
e.click(onDownload); e.click(onDownload);
@@ -1222,7 +1236,7 @@ WriteLiteral(@"/' + a.Id);
img.attr('src', '"); img.attr('src', '");
#line 478 "..\..\Views\Job\JobParts\Resources.cshtml" #line 492 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentThumbnail())); Write(Url.Action(MVC.API.Job.AttachmentThumbnail()));
@@ -1255,51 +1269,54 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n };\
"key) {\r\n var $element = $attachmentOutput.find(\'a[data-attachment" + "key) {\r\n var $element = $attachmentOutput.find(\'a[data-attachment" +
"id=\"\' + key + \'\"]\');\r\n if ($element.length > 0) {\r\n " + "id=\"\' + key + \'\"]\');\r\n if ($element.length > 0) {\r\n " +
" $element.hide(300).delay(300).queue(function () {\r\n " + " $element.hide(300).delay(300).queue(function () {\r\n " +
" if ($element.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " + " if (this[\'shadowboxCacheKey\'])\r\n Shadowbox.removeCac" +
" Shadowbox.removeCache(this);\r\n $el" + "he(this);\r\n $element.remove();\r\n d" +
"ement.remove();\r\n document.DiscoFunctions.liveAfterUpdate" + "ocument.DiscoFunctions.liveAfterUpdate();\r\n });\r\n " +
"();\r\n });\r\n }\r\n }\r\n\r\n $a" + " }\r\n }\r\n\r\n $attachmentOutput.children(\'a\').each(functio" +
"ttachmentOutput.children(\'a\').each(function () {\r\n $this = $(this" + "n () {\r\n $this = $(this);\r\n if ($this.attr(\'data-m" +
");\r\n if ($this.attr(\'data-mimetype\').toLowerCase().indexOf(\'image" + "imetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n $this.shado" +
"/\') == 0)\r\n $this.shadowbox({ gallery: \'attachments\', player:" + "wbox({ gallery: \'attachments\', player: \'img\', title: $this.find(\'.comments\').tex" +
" \'img\', title: $this.find(\'.comments\').text() });\r\n else\r\n " + "t() });\r\n else if ($this.attr(\'data-mimetype\').toLowerCase().inde" +
" $this.click(onDownload);\r\n });\r\n\r\n $Attachmen" + "xOf(\'application/pdf\') == 0 && navigator.pdfViewerEnabled)\r\n " +
"ts\r\n .find(\'.attachmentInput span.download-all\')\r\n " + "$this.shadowbox({ gallery: \'attachments\', player: \'iframe\', title: $this.find(\'." +
" .on(\'click\', function (event) {\r\n const downloadAllUrl = $At" + "comments\').text() });\r\n else\r\n $this.click(onD" +
"tachments.attr(\'data-downloadallurl\');\r\n const $this = $(this" + "ownload);\r\n });\r\n\r\n $Attachments\r\n .find(\'." +
");\r\n\r\n if ($this.hasClass(\'fa-spinner\'))\r\n " + "attachmentInput span.download-all\')\r\n .on(\'click\', function (even" +
" return;\r\n\r\n $this\r\n .removeClass(" + "t) {\r\n const downloadAllUrl = $Attachments.attr(\'data-downloa" +
"\'fa-download\')\r\n .addClass(\'fa-spinner fa-spin\');\r\n\r\n " + "dallurl\');\r\n const $this = $(this);\r\n\r\n if" +
" if (!$attachmentDownloadHost) {\r\n $attach" + " ($this.hasClass(\'fa-spinner\'))\r\n return;\r\n\r\n " +
"mentDownloadHost = $(\'<iframe>\')\r\n .attr({ \'id\': \'Att" + " $this\r\n .removeClass(\'fa-download\')\r\n " +
"achmentsDownloadHost\', \'name\': \'AttachmentsDownloadHost\', \'title\': \'Attachment D" + " .addClass(\'fa-spinner fa-spin\');\r\n\r\n if (!$attach" +
"ownload Host\' })\r\n .addClass(\'hidden\')\r\n " + "mentDownloadHost) {\r\n $attachmentDownloadHost = $(\'<ifram" +
" .appendTo(\'body\')\r\n .contents();\r\n " + "e>\')\r\n .attr({ \'id\': \'AttachmentsDownloadHost\', \'name" +
" }\r\n const $form = $(\'<form>\')\r\n " + "\': \'AttachmentsDownloadHost\', \'title\': \'Attachment Download Host\' })\r\n " +
" .attr({\r\n method: \'POST\',\r\n " + " .addClass(\'hidden\')\r\n .appendTo(\'bo" +
" action: downloadAllUrl,\r\n target: \'Attach" + "dy\')\r\n .contents();\r\n }\r\n " +
"mentsDownloadHost\'\r\n })\r\n .append(" + " const $form = $(\'<form>\')\r\n .attr({\r\n " +
"$(\'<input>\')\r\n .attr({ type: \'hidden\', name: \'__Reque" + " method: \'POST\',\r\n action: download" +
"stVerificationToken\' })\r\n .val(document.body.dataset." + "AllUrl,\r\n target: \'AttachmentsDownloadHost\'\r\n " +
"antiforgery))\r\n .appendTo(document.body)\r\n " + " })\r\n .append($(\'<input>\')\r\n " +
" .trigger(\'submit\');\r\n\r\n window.setTimeout(function (" + " .attr({ type: \'hidden\', name: \'__RequestVerificationToken\' })\r\n " +
") {\r\n $this\r\n .removeClass(\'fa" + " .val(document.body.dataset.antiforgery))\r\n " +
"-spinner fa-spin\')\r\n .addClass(\'fa-download\');\r\n " + " .appendTo(document.body)\r\n .trigger(\'submit\');" +
" $form.remove();\r\n }, 2000);\r\n " + "\r\n\r\n window.setTimeout(function () {\r\n " +
" });\r\n\r\n // Add Globally Available Functions\r\n document." + " $this\r\n .removeClass(\'fa-spinner fa-spin\')\r\n " +
"DiscoFunctions.liveAddAttachment = addAttachment;\r\n document.DiscoFun" + " .addClass(\'fa-download\');\r\n $form.rem" +
"ctions.liveRemoveAttachment = removeAttachment;\r\n\r\n //#endregion\r\n " + "ove();\r\n }, 2000);\r\n });\r\n\r\n // Add" +
" });\r\n\r\n\r\n </script>\r\n"); " Globally Available Functions\r\n document.DiscoFunctions.liveAddAttach" +
"ment = addAttachment;\r\n document.DiscoFunctions.liveRemoveAttachment " +
"= removeAttachment;\r\n\r\n //#endregion\r\n });\r\n\r\n\r\n </script>\r" +
"\n");
#line 588 "..\..\Views\Job\JobParts\Resources.cshtml" #line 604 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
#line default #line default
#line hidden #line hidden
#line 589 "..\..\Views\Job\JobParts\Resources.cshtml" #line 605 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs || canShowAttachments) if (canShowLogs || canShowAttachments)
{ {
@@ -1309,7 +1326,7 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n };\
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'"); WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
#line 593 "..\..\Views\Job\JobParts\Resources.cshtml" #line 609 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id); Write(Model.Job.Id);
@@ -1319,7 +1336,7 @@ WriteLiteral("\');\r\n\r\n //#region LiveEvents\r\n var hu
"dates;\r\n\r\n // Map Functions\r\n"); "dates;\r\n\r\n // Map Functions\r\n");
#line 599 "..\..\Views\Job\JobParts\Resources.cshtml" #line 615 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs) if (canShowLogs)
{ {
@@ -1330,14 +1347,14 @@ WriteLiteral("\r\n hub.client.addLog = document.DiscoFunctions.liveLo
" "); " ");
#line 603 "..\..\Views\Job\JobParts\Resources.cshtml" #line 619 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
#line default #line default
#line hidden #line hidden
#line 604 "..\..\Views\Job\JobParts\Resources.cshtml" #line 620 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments) if (canShowAttachments)
{ {
@@ -1358,7 +1375,7 @@ WriteLiteral(@"
"); ");
#line 617 "..\..\Views\Job\JobParts\Resources.cshtml" #line 633 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
@@ -1396,7 +1413,7 @@ WriteLiteral(@"
"); ");
#line 647 "..\..\Views\Job\JobParts\Resources.cshtml" #line 663 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
#line default #line default
@@ -56,7 +56,19 @@
<script type="text/javascript"> <script type="text/javascript">
Shadowbox.init({ Shadowbox.init({
skipSetup: true, skipSetup: true,
modal: true modal: true,
onOpen: function (obj) {
if (obj.player === 'iframe' && obj.content.indexOf('inline=True') === -1) {
obj.content += (obj.content.indexOf('?') === -1 ? '?' : '&') + 'inline=True';
}
return true;
},
onChange: function (obj) {
if (obj.player === 'iframe' && obj.content.indexOf('inline=True') === -1) {
obj.content += (obj.content.indexOf('?') === -1 ? '?' : '&') + 'inline=True';
}
return true;
}
}); });
$(function () { $(function () {
var $Attachments = $('#Attachments'); var $Attachments = $('#Attachments');
@@ -116,6 +128,8 @@
e.show('slow'); e.show('slow');
if (a.MimeType.toLowerCase().indexOf('image/') == 0) if (a.MimeType.toLowerCase().indexOf('image/') == 0)
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description }); e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description });
else if (a.MimeType.toLowerCase().indexOf('application/pdf') == 0 && navigator.pdfViewerEnabled)
e.shadowbox({ gallery: 'attachments', player: 'iframe', title: a.Description });
else else
e.click(onDownload); e.click(onDownload);
@@ -170,7 +184,7 @@
a.hide(300).delay(300).queue(function () { a.hide(300).delay(300).queue(function () {
var $this = $(this); var $this = $(this);
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0) if (this['shadowboxCacheKey'])
Shadowbox.removeCache(this); Shadowbox.removeCache(this);
$this.find('.timestamp').livestamp('destroy'); $this.find('.timestamp').livestamp('destroy');
$this.remove(); $this.remove();
@@ -338,6 +352,8 @@
$this = $(this); $this = $(this);
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0) if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
$this.shadowbox({ gallery: 'attachments', player: 'img', title: $this.find('.comments').text() }); $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 else
$this.click(onDownload); $this.click(onDownload);
}); });
@@ -491,25 +491,29 @@ WriteLiteral(" </div>\r\n <script");
WriteLiteral(" type=\"text/javascript\""); WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@"> WriteLiteral(">\r\n Shadowbox.init({\r\n skipSetu" +
Shadowbox.init({ "p: true,\r\n modal: true,\r\n " +
skipSetup: true, "onOpen: function (obj) {\r\n if (obj.player === \'if" +
modal: true "rame\' && obj.content.indexOf(\'inline=True\') === -1) {\r\n " +
}); " obj.content += (obj.content.indexOf(\'?\') === -1 ? \'?\' : \'&\') + \'inlin" +
$(function () { "e=True\';\r\n }\r\n ret" +
var $Attachments = $('#Attachments'); "urn true;\r\n },\r\n onChange:" +
var $attachmentOutput = $Attachments.find('.attachmentOutput'); " function (obj) {\r\n if (obj.player === \'iframe\' &" +
var $dialogRemoveAttachment = null; "& obj.content.indexOf(\'inline=True\') === -1) {\r\n " +
let $attachmentDownloadHost = null; " obj.content += (obj.content.indexOf(\'?\') === -1 ? \'?\' : \'&\') + \'inline=True\'" +
let attachmentUploader = null; ";\r\n }\r\n return tru" +
"e;\r\n }\r\n });\r\n " +
function onAttachmentAdded(id, quick) { " $(function () {\r\n var $Attachments = $(\'#Atta" +
var data = { id: id }; "chments\');\r\n var $attachmentOutput = $Attachments.fin" +
$.ajax({ "d(\'.attachmentOutput\');\r\n var $dialogRemoveAttachment" +
url: '"); " = 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 71 "..\..\Views\User\UserParts\_Resources.cshtml" #line 83 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.Attachment())); Write(Url.Action(MVC.API.User.Attachment()));
@@ -546,39 +550,36 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
"ef\', \'"); "ef\', \'");
#line 105 "..\..\Views\User\UserParts\_Resources.cshtml" #line 117 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentDownload())); Write(Url.Action(MVC.API.User.AttachmentDownload()));
#line default #line default
#line hidden #line hidden
WriteLiteral(@"/' + a.Id); WriteLiteral("/\' + a.Id);\r\n e.find(\'.comments\').text(a.Descripti" +
e.find('.comments').text(a.Description); "on);\r\n e.find(\'.author\').text(a.Author);\r\n " +
e.find('.author').text(a.Author); " e.find(\'.timestamp\').text(a.TimestampFull).attr(\'title\'" +
e.find('.timestamp').text(a.TimestampFull).attr('title', a.TimestampFull).livestamp(a.TimestampUnixEpoc); ", a.TimestampFull).livestamp(a.TimestampUnixEpoc);\r\n " +
if (canRemove) " if (canRemove)\r\n e.find(\'.remove\').click(" +
e.find('.remove').click(removeAttachment); "removeAttachment);\r\n if (!quick)\r\n " +
if (!quick) " e.hide();\r\n $attachmentOutpu" +
e.hide(); "t.prepend(e);\r\n onUpdate();\r\n " +
$attachmentOutput.prepend(e); " if (!quick)\r\n e.show(\'slow\');\r\n " +
onUpdate(); " if (a.MimeType.toLowerCase().indexOf(\'image/\') == " +
if (!quick) "0)\r\n e.shadowbox({ gallery: \'attachments\', pl" +
e.show('slow'); "ayer: \'img\', title: a.Description });\r\n else if (" +
if (a.MimeType.toLowerCase().indexOf('image/') == 0) "a.MimeType.toLowerCase().indexOf(\'application/pdf\') == 0 && navigator.pdfViewerE" +
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description }); "nabled)\r\n e.shadowbox({ gallery: \'attachments" +
else "\', player: \'iframe\', title: a.Description });\r\n e" +
e.click(onDownload); "lse\r\n e.click(onDownload);\r\n\r\n " +
" // Add Thumbnail\r\n var buildThum" +
// Add Thumbnail "bnail = function () {\r\n var retryCount = 0;\r\n" +
var buildThumbnail = function () { " var img = e.find(\'.icon img\');\r\n\r\n " +
var retryCount = 0; " var setThumbnailUrl = function () {\r\n " +
var img = e.find('.icon img'); " img.attr(\'src\', \'");
var setThumbnailUrl = function () {
img.attr('src', '");
#line 128 "..\..\Views\User\UserParts\_Resources.cshtml" #line 142 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentThumbnail())); Write(Url.Action(MVC.API.User.AttachmentThumbnail()));
@@ -617,61 +618,61 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n
"unction onAttachmentRemoved(id) {\r\n var a = $atta" + "unction onAttachmentRemoved(id) {\r\n var a = $atta" +
"chmentOutput.find(\'a[data-attachmentid=\' + id + \']\');\r\n\r\n " + "chmentOutput.find(\'a[data-attachmentid=\' + id + \']\');\r\n\r\n " +
" a.hide(300).delay(300).queue(function () {\r\n " + " a.hide(300).delay(300).queue(function () {\r\n " +
" var $this = $(this);\r\n if ($this.att" + " var $this = $(this);\r\n if (this[\'sha" +
"r(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " + "dowboxCacheKey\'])\r\n Shadowbox.removeCache" +
" Shadowbox.removeCache(this);\r\n " + "(this);\r\n $this.find(\'.timestamp\').livestamp(" +
" $this.find(\'.timestamp\').livestamp(\'destroy\');\r\n " + "\'destroy\');\r\n $this.remove();\r\n " +
" $this.remove();\r\n onUpdate();\r\n " + " onUpdate();\r\n });\r\n " +
" });\r\n }\r\n\r\n " + " }\r\n\r\n function onUpdate() {\r\n " +
" function onUpdate() {\r\n var attachmen" + " var attachmentCount = $attachmentOutput.children(\'a\'" +
"tCount = $attachmentOutput.children(\'a\').length;\r\n " + ").length;\r\n var tabHeading = \'Attachments [\' + at" +
" var tabHeading = \'Attachments [\' + attachmentCount + \']\';\r\n " + "tachmentCount + \']\';\r\n $(\'#UserDetailTab-Resource" +
" $(\'#UserDetailTab-ResourcesLink\').text(tabHeading);\r\n " + "sLink\').text(tabHeading);\r\n }\r\n\r\n " +
" }\r\n\r\n $Attachments\r\n " + " $Attachments\r\n .find(\'.attachmentInput sp" +
" .find(\'.attachmentInput span.download-all\')\r\n " + "an.download-all\')\r\n .on(\'click\', function (event)" +
" .on(\'click\', function (event) {\r\n c" + " {\r\n const downloadAllUrl = $Attachments.attr" +
"onst downloadAllUrl = $Attachments.attr(\'data-downloadallurl\');\r\n " + "(\'data-downloadallurl\');\r\n const id = $Attach" +
" const id = $Attachments.attr(\'data-id\');\r\n " + "ments.attr(\'data-id\');\r\n const $this = $(this" +
" const $this = $(this);\r\n\r\n " + ");\r\n\r\n if ($this.hasClass(\'fa-spinner\'))\r\n " +
" if ($this.hasClass(\'fa-spinner\'))\r\n retu" + " return;\r\n\r\n " +
"rn;\r\n\r\n $this\r\n " + " $this\r\n .removeClass(\'fa-download\')\r\n" +
" .removeClass(\'fa-download\')\r\n ." + " .addClass(\'fa-spinner fa-spin\');\r\n\r\n " +
"addClass(\'fa-spinner fa-spin\');\r\n\r\n if (!$att" + " if (!$attachmentDownloadHost) {\r\n " +
"achmentDownloadHost) {\r\n $attachmentDownl" + " $attachmentDownloadHost = $(\'<iframe>\')\r\n " +
"oadHost = $(\'<iframe>\')\r\n .attr({ \'id" + " .attr({ \'id\': \'AttachmentsDownloadHost\', \'name\': \'" +
"\': \'AttachmentsDownloadHost\', \'name\': \'AttachmentsDownloadHost\', \'title\': \'Attac" + "AttachmentsDownloadHost\', \'title\': \'Attachment Download Host\' })\r\n " +
"hment Download Host\' })\r\n .addClass(\'" + " .addClass(\'hidden\')\r\n " +
"hidden\')\r\n .appendTo(\'body\')\r\n " + " .appendTo(\'body\')\r\n .c" +
" .contents();\r\n " + "ontents();\r\n }\r\n " +
" }\r\n const $form = $(\'<form>\')\r\n " + " const $form = $(\'<form>\')\r\n .attr(" +
" .attr({\r\n " + "{\r\n method: \'POST\',\r\n " +
" method: \'POST\',\r\n action: downl" + " action: downloadAllUrl,\r\n " +
"oadAllUrl,\r\n target: \'AttachmentsDown" + " target: \'AttachmentsDownloadHost\'\r\n " +
"loadHost\'\r\n })\r\n " + " })\r\n .append($(\'<input>\')\r\n " +
" .append($(\'<input>\')\r\n " + " .attr({ type: \'hidden\', name: \'__Reque" +
" .attr({ type: \'hidden\', name: \'__RequestVerificationToken\' })\r\n " + "stVerificationToken\' })\r\n .val(docume" +
" .val(document.body.dataset.antiforgery))\r\n " + "nt.body.dataset.antiforgery))\r\n .append($" +
" .append($(\'<input>\')\r\n " + "(\'<input>\')\r\n .attr({ type: \'hidden\'," +
" .attr({ type: \'hidden\', name: \'id\' })\r\n " + " name: \'id\' })\r\n .val(id))\r\n " +
" .val(id))\r\n .appendTo(" + " .appendTo(document.body)\r\n " +
"document.body)\r\n .trigger(\'submit\');\r\n\r\n " + " .trigger(\'submit\');\r\n\r\n wind" +
" window.setTimeout(function () {\r\n " + "ow.setTimeout(function () {\r\n $this\r\n " +
" $this\r\n ." + " .removeClass(\'fa-spinner fa-spin\')\r\n " +
"removeClass(\'fa-spinner fa-spin\')\r\n ." + " .addClass(\'fa-download\');\r\n " +
"addClass(\'fa-download\');\r\n $form.remove()" + " $form.remove();\r\n " +
";\r\n }, 2000);\r\n " + "}, 2000);\r\n });\r\n\r\n do" +
" });\r\n\r\n document.DiscoFunctions.onAttachmentAdded =" + "cument.DiscoFunctions.onAttachmentAdded = onAttachmentAdded;\r\n " +
" onAttachmentAdded;\r\n document.DiscoFunctions.onAttac" + " document.DiscoFunctions.onAttachmentRemoved = onAttachmentRemoved;\r\n\r\n" +
"hmentRemoved = onAttachmentRemoved;\r\n\r\n"); "");
#line 234 "..\..\Views\User\UserParts\_Resources.cshtml" #line 248 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default #line default
#line hidden #line hidden
#line 234 "..\..\Views\User\UserParts\_Resources.cshtml" #line 248 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments) if (canAddAttachments)
{ {
@@ -718,7 +719,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
" //#endregion\r\n "); " //#endregion\r\n ");
#line 281 "..\..\Views\User\UserParts\_Resources.cshtml" #line 295 "..\..\Views\User\UserParts\_Resources.cshtml"
} }
@@ -727,7 +728,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
WriteLiteral(" "); WriteLiteral(" ");
#line 282 "..\..\Views\User\UserParts\_Resources.cshtml" #line 296 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments) if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{ {
@@ -771,7 +772,7 @@ WriteLiteral("\r\n //#region Remove Attachments\r\n\r
""); "");
#line 335 "..\..\Views\User\UserParts\_Resources.cshtml" #line 349 "..\..\Views\User\UserParts\_Resources.cshtml"
} }
@@ -782,6 +783,8 @@ WriteLiteral(@"
$this = $(this); $this = $(this);
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0) if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
$this.shadowbox({ gallery: 'attachments', player: 'img', title: $this.find('.comments').text() }); $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 else
$this.click(onDownload); $this.click(onDownload);
}); });
@@ -795,7 +798,7 @@ WriteLiteral(@"
$('#UserDetailTabItems').append('<li><a href=""#UserDetailTab-Resources"" id=""UserDetailTab-ResourcesLink"">Attachments ["); $('#UserDetailTabItems').append('<li><a href=""#UserDetailTab-Resources"" id=""UserDetailTab-ResourcesLink"">Attachments [");
#line 351 "..\..\Views\User\UserParts\_Resources.cshtml" #line 367 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Model.User.UserAttachments == null ? 0 : Model.User.UserAttachments.Count); Write(Model.User.UserAttachments == null ? 0 : Model.User.UserAttachments.Count);
@@ -804,7 +807,7 @@ WriteLiteral(@"
WriteLiteral("]</a></li>\');\r\n </script>\r\n</div>\r\n"); WriteLiteral("]</a></li>\');\r\n </script>\r\n</div>\r\n");
#line 354 "..\..\Views\User\UserParts\_Resources.cshtml" #line 370 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments) if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{ {
@@ -826,7 +829,7 @@ WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n"); WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n");
#line 361 "..\..\Views\User\UserParts\_Resources.cshtml" #line 377 "..\..\Views\User\UserParts\_Resources.cshtml"
} }
#line default #line default