#145 add comments for devices

This commit is contained in:
Gary Sharp
2025-07-17 11:40:50 +10:00
parent 2184c9e22e
commit f8fd1a58a3
35 changed files with 2047 additions and 614 deletions
@@ -0,0 +1,212 @@
@model Disco.Web.Models.Device.ShowModel
@{
Authorization.Require(Claims.Device.ShowComments);
var canAddComments = Authorization.Has(Claims.Device.Actions.AddComments);
var canRemoveAnyComments = Authorization.Has(Claims.Device.Actions.RemoveAnyComments);
var canRemoveOwnComments = Authorization.Has(Claims.Device.Actions.RemoveOwnComments);
}
<div id="Comments" class="@(canAddComments ? "canAddComments" : "cannotAddComments") @(canRemoveAnyComments ? "canRemoveAnyComments" : "cannotRemoveAnyComments") @(canRemoveOwnComments ? "canRemoveOwnComments" : "cannotRemoveOwnComments")" data-id="@Model.Device.SerialNumber" data-userid="@CurrentUser.UserId" data-addurl="@Url.Action(MVC.API.Device.CommentAdd(Model.Device.SerialNumber))" data-removeurl="@Url.Action(MVC.API.Device.CommentRemove())" data-geturl="@Url.Action(MVC.API.Device.Comment())">
@Html.AntiForgeryToken()
@if (canAddComments)
{
<div class="commentInput">
<textarea class="commentInput" placeholder="add comment..." accesskey="l"></textarea>
<button type="button" title="Add Comment" disabled><i class="fa fa-comment"></i></button>
</div>
}
<div class="commentOutput">
@foreach (var c in Model.Device.DeviceComments.OrderBy(m => m.Timestamp))
{
<div class="comment" data-commentid="@c.Id">
<span class="author">@c.TechUser.ToStringFriendly()</span>@if (canRemoveAnyComments || (canRemoveOwnComments && c.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{<text><span class="remove fa fa-times-circle"></span></text>}<span class="timestamp" data-livestamp="@(c.Timestamp.ToUnixEpoc())" title="@c.Timestamp.ToFullDateTime()">@c.Timestamp.ToFullDateTime()</span>
<div class="comment">@c.Comments.ToHtmlComment()</div>
</div>
}
</div>
</div>
<script>
if (!document.DiscoFunctions) {
document.DiscoFunctions = {};
}
$(function () {
const $comments = $('#Comments');
const $commentOutput = $comments.find('.commentOutput');
window.setTimeout(function () {
$commentOutput[0].scrollTop = $commentOutput[0].scrollHeight; // Scroll to Bottom
}, 0);
$('#DeviceDetailTabs').on('tabsactivate', function (event, ui) {
if (ui.newPanel && ui.newPanel.is('#DeviceDetailTab-CommentsAndJobs')) {
$commentOutput[0].scrollTop = $commentOutput[0].scrollHeight; // Scroll to Bottom
}
});
function onCommentAdded(id) {
onCommentAddedAsync(id);
}
async function onCommentAddedAsync(id) {
const formData = new FormData();
formData.append('__RequestVerificationToken', $comments.find('input[name="__RequestVerificationToken"]').val());
formData.append('id', id);
const response = await fetch($comments.attr('data-geturl'), {
method: 'POST',
body: formData
});
if (!response.ok) {
alert('Unable to load live comment ' + id + ': ' + response.statusText);
} else {
const comment = await response.json();
if ($comments.hasClass('canRemoveAnyComments'))
renderComment(comment, false, true);
else if ($comments.hasClass('canRemoveOwnComments'))
renderComment(comment, false, (comment.AuthorId === $comments.attr('data-userid')));
else
renderComment(comment, false, false);
}
}
function onCommentRemoved(id) {
$commentOutput.children('div[data-commentid="' + id + '"]').slideUp(300).delay(300).queue(function () {
const $this = $(this);
$this.find('.timestamp').livestamp('destroy');
$this.remove();
});
}
function renderComment(c, quick, canRemove) {
let t = '<div><span class="author" />';
if (canRemove)
t += '<span class="remove fa fa-times-circle" />';
t += '<span class="timestamp" /><div class="comment" /></div>';
const e = $(t);
e.attr('data-commentid', c.Id);
e.find('.author').text(c.Author);
e.find('.timestamp').text(c.TimestampFull).attr('title', c.TimestampFull).livestamp(c.TimestampUnixEpoc);
e.find('.comment').html(c.HtmlComments);
$commentOutput.append(e);
if (!quick) {
e.animate({ backgroundColor: '#ffff99' }, 500, function () {
e.animate({ backgroundColor: '#fafafa' }, 500, function () {
e.css('background-color', '');
});
});
$commentOutput.animate({ scrollTop: $commentOutput[0].scrollHeight }, 250)
}
}
document.DiscoFunctions.onCommentAdded = onCommentAdded;
document.DiscoFunctions.onCommentRemoved = onCommentRemoved;
});
</script>
@if (canAddComments)
{
<script>
$(function () {
const $comments = $('#Comments');
const $commentInput = $comments.find('textarea.commentInput');
const $commentInputButton = $comments.find('button');
$commentInputButton.on('click', postComment);
$commentInput.on('keypress', function (e) {
if (e.which == 13 && !e.shiftKey) {
postComment();
return false;
}
});
async function postComment() {
if ($commentInputButton.prop('disabled')) {
alert('Disconnected from the Disco ICT Server, please refresh this page and try again');
return;
}
const comment = $commentInput.val();
if (comment == '') {
alert('Enter a comment to post');
$commentInput.focus();
return;
}
$commentInput.prop('disabled', true);
const formData = new FormData();
formData.append('__RequestVerificationToken', $comments.find('input[name="__RequestVerificationToken"]').val());
formData.append('comment', comment);
const response = await fetch($comments.attr('data-addurl'), {
method: 'POST',
body: formData
});
if (response.ok) {
$commentInput.val('').prop('disabled', false).focus();
} else {
alert('Unable to add comment: ' + response.statusText);
$commentInput.prop('disabled', false).focus();
}
}
});
</script>
}
@if (canRemoveAnyComments || canRemoveOwnComments)
{
<script>
$(function () {
const $comments = $('#Comments');
const $commentOutput = $comments.find('.commentOutput');
let $dialogRemove = null;
$commentOutput.on('click', 'span.remove', removeComment);
function removeComment(e) {
e.preventDefault();
const commentId = $(this).closest('div').attr('data-commentid');
if (!$dialogRemove) {
$dialogRemove = $('<div class="dialog" title="Remove this Comment?"><p><i class="fa fa-exclamation-triangle fa-lg"></i>&nbsp;Are you sure?</p></div>')
.appendTo(document.body)
.dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
}
$dialogRemove.dialog("enable").dialog('option', 'buttons', {
"Remove": function () {
$dialogRemove.dialog("disable");
$dialogRemove.dialog("option", "buttons", null);
removeCommentAsync(commentId);
},
"Cancel": function () {
$dialogRemove.dialog("close");
}
}).dialog('open');
}
async function removeCommentAsync(commentId) {
const formData = new FormData();
formData.append('__RequestVerificationToken', $comments.find('input[name="__RequestVerificationToken"]').val());
formData.append('id', commentId);
const response = await fetch($comments.attr('data-removeurl'), {
method: 'POST',
body: formData
});
if (!response.ok) {
alert('Unable to remove comment: ' + response.statusText);
}
$dialogRemove.dialog("close");
}
});
</script>
}
@@ -0,0 +1,452 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.Device.DeviceParts
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/DeviceParts/_Comments.cshtml")]
public partial class _Comments : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.ShowModel>
{
public _Comments()
{
}
public override void Execute()
{
#line 2 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Authorization.Require(Claims.Device.ShowComments);
var canAddComments = Authorization.Has(Claims.Device.Actions.AddComments);
var canRemoveAnyComments = Authorization.Has(Claims.Device.Actions.RemoveAnyComments);
var canRemoveOwnComments = Authorization.Has(Claims.Device.Actions.RemoveOwnComments);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"Comments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 387), Tuple.Create("\"", 607)
#line 8 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
, Tuple.Create(Tuple.Create("", 395), Tuple.Create<System.Object, System.Int32>(canAddComments ? "canAddComments" : "cannotAddComments"
#line default
#line hidden
, 395), false)
#line 8 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
, Tuple.Create(Tuple.Create(" ", 453), Tuple.Create<System.Object, System.Int32>(canRemoveAnyComments ? "canRemoveAnyComments" : "cannotRemoveAnyComments"
#line default
#line hidden
, 454), false)
#line 8 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
, Tuple.Create(Tuple.Create(" ", 530), Tuple.Create<System.Object, System.Int32>(canRemoveOwnComments ? "canRemoveOwnComments" : "cannotRemoveOwnComments"
#line default
#line hidden
, 531), false)
);
WriteLiteral(" data-id=\"");
#line 8 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(Model.Device.SerialNumber);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-userid=\"");
#line 8 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(CurrentUser.UserId);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-addurl=\"");
#line 8 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(Url.Action(MVC.API.Device.CommentAdd(Model.Device.SerialNumber)));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-removeurl=\"");
#line 8 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(Url.Action(MVC.API.Device.CommentRemove()));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-geturl=\"");
#line 8 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(Url.Action(MVC.API.Device.Comment()));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 9 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
WriteLiteral("\r\n");
#line 10 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line default
#line hidden
#line 10 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
if (canAddComments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"commentInput\"");
WriteLiteral(">\r\n <textarea");
WriteLiteral(" class=\"commentInput\"");
WriteLiteral(" placeholder=\"add comment...\"");
WriteLiteral(" accesskey=\"l\"");
WriteLiteral("></textarea>\r\n <button");
WriteLiteral(" type=\"button\"");
WriteLiteral(" title=\"Add Comment\"");
WriteLiteral(" disabled><i");
WriteLiteral(" class=\"fa fa-comment\"");
WriteLiteral("></i></button>\r\n </div>\r\n");
#line 16 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
}
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"commentOutput\"");
WriteLiteral(">\r\n");
#line 18 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line default
#line hidden
#line 18 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
foreach (var c in Model.Device.DeviceComments.OrderBy(m => m.Timestamp))
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"comment\"");
WriteLiteral(" data-commentid=\"");
#line 20 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(c.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 21 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(c.TechUser.ToStringFriendly());
#line default
#line hidden
WriteLiteral("</span>");
#line 21 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
if (canRemoveAnyComments || (canRemoveOwnComments && c.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>");
#line 22 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
}
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\"");
WriteLiteral(" data-livestamp=\"");
#line 22 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(c.Timestamp.ToUnixEpoc());
#line default
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1737), Tuple.Create("\"", 1774)
#line 22 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
, Tuple.Create(Tuple.Create("", 1745), Tuple.Create<System.Object, System.Int32>(c.Timestamp.ToFullDateTime()
#line default
#line hidden
, 1745), false)
);
WriteLiteral(">");
#line 22 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(c.Timestamp.ToFullDateTime());
#line default
#line hidden
WriteLiteral("</span>\r\n <div");
WriteLiteral(" class=\"comment\"");
WriteLiteral(">");
#line 23 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(c.Comments.ToHtmlComment());
#line default
#line hidden
WriteLiteral("</div>\r\n </div>\r\n");
#line 25 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n</div>\r\n<script>\r\n if (!document.DiscoFunctions) {\r\n docume" +
"nt.DiscoFunctions = {};\r\n }\r\n\r\n $(function () {\r\n const $comments =" +
" $(\'#Comments\');\r\n const $commentOutput = $comments.find(\'.commentOutput\'" +
");\r\n\r\n window.setTimeout(function () {\r\n $commentOutput[0].scr" +
"ollTop = $commentOutput[0].scrollHeight; // Scroll to Bottom\r\n }, 0);\r\n " +
" $(\'#DeviceDetailTabs\').on(\'tabsactivate\', function (event, ui) {\r\n " +
" if (ui.newPanel && ui.newPanel.is(\'#DeviceDetailTab-CommentsAndJobs\')) {\r\n " +
" $commentOutput[0].scrollTop = $commentOutput[0].scrollHeight; // S" +
"croll to Bottom\r\n }\r\n });\r\n\r\n function onCommentAdded(i" +
"d) {\r\n onCommentAddedAsync(id);\r\n }\r\n async function on" +
"CommentAddedAsync(id) {\r\n const formData = new FormData();\r\n " +
" formData.append(\'__RequestVerificationToken\', $comments.find(\'input[name=\"__R" +
"equestVerificationToken\"]\').val());\r\n formData.append(\'id\', id);\r\n\r\n " +
" const response = await fetch($comments.attr(\'data-geturl\'), {\r\n " +
" method: \'POST\',\r\n body: formData\r\n });\r\n\r\n " +
" if (!response.ok) {\r\n alert(\'Unable to load live commen" +
"t \' + id + \': \' + response.statusText);\r\n } else {\r\n c" +
"onst comment = await response.json();\r\n\r\n if ($comments.hasClass(" +
"\'canRemoveAnyComments\'))\r\n renderComment(comment, false, true" +
");\r\n else if ($comments.hasClass(\'canRemoveOwnComments\'))\r\n " +
" renderComment(comment, false, (comment.AuthorId === $comments.attr" +
"(\'data-userid\')));\r\n else\r\n renderComment(comm" +
"ent, false, false);\r\n }\r\n }\r\n function onCommentRemoved" +
"(id) {\r\n $commentOutput.children(\'div[data-commentid=\"\' + id + \'\"]\')." +
"slideUp(300).delay(300).queue(function () {\r\n const $this = $(thi" +
"s);\r\n $this.find(\'.timestamp\').livestamp(\'destroy\');\r\n " +
" $this.remove();\r\n });\r\n }\r\n function renderComment" +
"(c, quick, canRemove) {\r\n let t = \'<div><span class=\"author\" />\';\r\n " +
" if (canRemove)\r\n t += \'<span class=\"remove fa fa-times-" +
"circle\" />\';\r\n t += \'<span class=\"timestamp\" /><div class=\"comment\" /" +
"></div>\';\r\n\r\n const e = $(t);\r\n e.attr(\'data-commentid\', c" +
".Id);\r\n e.find(\'.author\').text(c.Author);\r\n e.find(\'.times" +
"tamp\').text(c.TimestampFull).attr(\'title\', c.TimestampFull).livestamp(c.Timestam" +
"pUnixEpoc);\r\n e.find(\'.comment\').html(c.HtmlComments);\r\n\r\n " +
" $commentOutput.append(e);\r\n\r\n if (!quick) {\r\n e.anima" +
"te({ backgroundColor: \'#ffff99\' }, 500, function () {\r\n e.ani" +
"mate({ backgroundColor: \'#fafafa\' }, 500, function () {\r\n " +
" e.css(\'background-color\', \'\');\r\n });\r\n });\r\n " +
" $commentOutput.animate({ scrollTop: $commentOutput[0].scrollHeigh" +
"t }, 250)\r\n }\r\n }\r\n\r\n document.DiscoFunctions.onComment" +
"Added = onCommentAdded;\r\n document.DiscoFunctions.onCommentRemoved = onCo" +
"mmentRemoved;\r\n });\r\n</script>\r\n");
#line 107 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
if (canAddComments)
{
#line default
#line hidden
WriteLiteral(" <script>\r\n $(function () {\r\n const $comments = $(\'#Comments" +
"\');\r\n const $commentInput = $comments.find(\'textarea.commentInput\');\r" +
"\n const $commentInputButton = $comments.find(\'button\');\r\n " +
"$commentInputButton.on(\'click\', postComment);\r\n $commentInput.on(\'key" +
"press\', function (e) {\r\n if (e.which == 13 && !e.shiftKey) {\r\n " +
" postComment();\r\n return false;\r\n " +
" }\r\n });\r\n\r\n async function postComment() {\r\n " +
" if ($commentInputButton.prop(\'disabled\')) {\r\n alert(\'Di" +
"sconnected from the Disco ICT Server, please refresh this page and try again\');\r" +
"\n return;\r\n }\r\n\r\n const comment" +
" = $commentInput.val();\r\n\r\n if (comment == \'\') {\r\n " +
" alert(\'Enter a comment to post\');\r\n $commentInput.focus(" +
");\r\n return;\r\n }\r\n\r\n $commentIn" +
"put.prop(\'disabled\', true);\r\n\r\n const formData = new FormData();\r" +
"\n formData.append(\'__RequestVerificationToken\', $comments.find(\'i" +
"nput[name=\"__RequestVerificationToken\"]\').val());\r\n formData.appe" +
"nd(\'comment\', comment);\r\n\r\n const response = await fetch($comment" +
"s.attr(\'data-addurl\'), {\r\n method: \'POST\',\r\n " +
" body: formData\r\n });\r\n\r\n if (response.ok) {\r\n " +
" $commentInput.val(\'\').prop(\'disabled\', false).focus();\r\n " +
" } else {\r\n alert(\'Unable to add comment: \' + respon" +
"se.statusText);\r\n $commentInput.prop(\'disabled\', false).focus" +
"();\r\n }\r\n }\r\n });\r\n </script>\r\n");
#line 156 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
}
#line default
#line hidden
#line 157 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
if (canRemoveAnyComments || canRemoveOwnComments)
{
#line default
#line hidden
WriteLiteral(" <script>\r\n $(function () {\r\n const $comments = $(\'#Comments" +
"\');\r\n const $commentOutput = $comments.find(\'.commentOutput\');\r\n " +
" let $dialogRemove = null;\r\n\r\n $commentOutput.on(\'click\', \'span" +
".remove\', removeComment);\r\n\r\n function removeComment(e) {\r\n " +
" e.preventDefault();\r\n\r\n const commentId = $(this).closest(\'" +
"div\').attr(\'data-commentid\');\r\n\r\n if (!$dialogRemove) {\r\n " +
" $dialogRemove = $(\'<div class=\"dialog\" title=\"Remove this Comment?\">" +
"<p><i class=\"fa fa-exclamation-triangle fa-lg\"></i>&nbsp;Are you sure?</p></div>" +
"\')\r\n .appendTo(document.body)\r\n .d" +
"ialog({\r\n resizable: false,\r\n " +
" height: 140,\r\n modal: true,\r\n " +
" autoOpen: false\r\n });\r\n }\r\n\r\n " +
" $dialogRemove.dialog(\"enable\").dialog(\'option\', \'buttons\', {\r\n " +
" \"Remove\": function () {\r\n $dialogRemove.dial" +
"og(\"disable\");\r\n $dialogRemove.dialog(\"option\", \"buttons\"" +
", null);\r\n\r\n removeCommentAsync(commentId);\r\n " +
" },\r\n \"Cancel\": function () {\r\n " +
" $dialogRemove.dialog(\"close\");\r\n }\r\n }).dialo" +
"g(\'open\');\r\n }\r\n async function removeCommentAsync(comment" +
"Id) {\r\n const formData = new FormData();\r\n formDat" +
"a.append(\'__RequestVerificationToken\', $comments.find(\'input[name=\"__RequestVeri" +
"ficationToken\"]\').val());\r\n formData.append(\'id\', commentId);\r\n\r\n" +
" const response = await fetch($comments.attr(\'data-removeurl\'), {" +
"\r\n method: \'POST\',\r\n body: formData\r\n " +
" });\r\n\r\n if (!response.ok) {\r\n alert" +
"(\'Unable to remove comment: \' + response.statusText);\r\n }\r\n " +
" $dialogRemove.dialog(\"close\");\r\n }\r\n });\r\n </scri" +
"pt>\r\n");
#line 212 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
@@ -0,0 +1,41 @@
@model Disco.Web.Models.Device.ShowModel
@{
var canShowComments = Authorization.Has(Claims.Device.ShowComments);
var canShowJobs = Authorization.Has(Claims.Device.ShowJobs);
var jobCount = (Model.Device.Jobs == null ? 0 : Model.Device.Jobs.Count).ToString();
string label;
if (canShowComments & canShowJobs)
{
label = "Comments and Jobs [" + jobCount + "]";
}
else if (canShowComments)
{
label = "Comments";
}
else if (canShowJobs)
{
label = "Jobs [" + jobCount + "]";
}
else
{
return;
}
}
<div id="DeviceDetailTab-CommentsAndJobs" class="DevicePart @(canShowComments ? "canShowComments" : "cannotShowComments") @(canShowJobs ? "canShowJobs" : "cannotShowJobs")">
@if (canShowComments)
{
<div id="DeviceDetailTab-CommentsContainer">
@Html.Partial(MVC.Device.Views.DeviceParts._Comments, Model)
</div>
}
@if (canShowJobs)
{
<div id="DeviceDetailTab-JobsContainer">
@Html.Partial(MVC.Shared.Views._JobTable, Model.Jobs)
</div>
}
<script>
$('#DeviceDetailTabItems').append('<li><a href="#DeviceDetailTab-CommentsAndJobs">@label</a></li>');
</script>
</div>
@@ -0,0 +1,185 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.Device.DeviceParts
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/DeviceParts/_CommentsAndJobs.cshtml")]
public partial class _CommentsAndJobs : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.ShowModel>
{
public _CommentsAndJobs()
{
}
public override void Execute()
{
#line 2 "..\..\Views\Device\DeviceParts\_CommentsAndJobs.cshtml"
var canShowComments = Authorization.Has(Claims.Device.ShowComments);
var canShowJobs = Authorization.Has(Claims.Device.ShowJobs);
var jobCount = (Model.Device.Jobs == null ? 0 : Model.Device.Jobs.Count).ToString();
string label;
if (canShowComments & canShowJobs)
{
label = "Comments and Jobs [" + jobCount + "]";
}
else if (canShowComments)
{
label = "Comments";
}
else if (canShowJobs)
{
label = "Jobs [" + jobCount + "]";
}
else
{
return;
}
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"DeviceDetailTab-CommentsAndJobs\"");
WriteAttribute("class", Tuple.Create(" class=\"", 652), Tuple.Create("\"", 782)
, Tuple.Create(Tuple.Create("", 660), Tuple.Create("DevicePart", 660), true)
#line 25 "..\..\Views\Device\DeviceParts\_CommentsAndJobs.cshtml"
, Tuple.Create(Tuple.Create(" ", 670), Tuple.Create<System.Object, System.Int32>(canShowComments ? "canShowComments" : "cannotShowComments"
#line default
#line hidden
, 671), false)
#line 25 "..\..\Views\Device\DeviceParts\_CommentsAndJobs.cshtml"
, Tuple.Create(Tuple.Create(" ", 732), Tuple.Create<System.Object, System.Int32>(canShowJobs ? "canShowJobs" : "cannotShowJobs"
#line default
#line hidden
, 733), false)
);
WriteLiteral(">\r\n");
#line 26 "..\..\Views\Device\DeviceParts\_CommentsAndJobs.cshtml"
#line default
#line hidden
#line 26 "..\..\Views\Device\DeviceParts\_CommentsAndJobs.cshtml"
if (canShowComments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"DeviceDetailTab-CommentsContainer\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 29 "..\..\Views\Device\DeviceParts\_CommentsAndJobs.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Comments, Model));
#line default
#line hidden
WriteLiteral("\r\n </div>\r\n");
#line 31 "..\..\Views\Device\DeviceParts\_CommentsAndJobs.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 32 "..\..\Views\Device\DeviceParts\_CommentsAndJobs.cshtml"
if (canShowJobs)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"DeviceDetailTab-JobsContainer\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 35 "..\..\Views\Device\DeviceParts\_CommentsAndJobs.cshtml"
Write(Html.Partial(MVC.Shared.Views._JobTable, Model.Jobs));
#line default
#line hidden
WriteLiteral("\r\n </div>\r\n");
#line 37 "..\..\Views\Device\DeviceParts\_CommentsAndJobs.cshtml"
}
#line default
#line hidden
WriteLiteral(" <script>\r\n $(\'#DeviceDetailTabItems\').append(\'<li><a href=\"#DeviceDeta" +
"ilTab-CommentsAndJobs\">");
#line 39 "..\..\Views\Device\DeviceParts\_CommentsAndJobs.cshtml"
Write(label);
#line default
#line hidden
WriteLiteral("</a></li>\');\r\n </script>\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
@@ -1,12 +0,0 @@
@model Disco.Web.Models.Device.ShowModel
@{
Authorization.Require(Claims.Device.ShowJobs);
}
<div id="DeviceDetailTab-Jobs" class="DevicePart">
<div id="DeviceDetailTab-JobsContainer">
@Html.Partial(MVC.Shared.Views._JobTable, Model.Jobs)
</div>
<script>
$('#DeviceDetailTabItems').append('<li><a href="#DeviceDetailTab-Jobs">Jobs [@(Model.Jobs.Items.Count())]</a></li>');
</script>
</div>
@@ -1,90 +0,0 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.Device.DeviceParts
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/DeviceParts/_Jobs.cshtml")]
public partial class _Jobs : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.ShowModel>
{
public _Jobs()
{
}
public override void Execute()
{
#line 2 "..\..\Views\Device\DeviceParts\_Jobs.cshtml"
Authorization.Require(Claims.Device.ShowJobs);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"DeviceDetailTab-Jobs\"");
WriteLiteral(" class=\"DevicePart\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"DeviceDetailTab-JobsContainer\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 7 "..\..\Views\Device\DeviceParts\_Jobs.cshtml"
Write(Html.Partial(MVC.Shared.Views._JobTable, Model.Jobs));
#line default
#line hidden
WriteLiteral("\r\n </div>\r\n <script>\r\n $(\'#DeviceDetailTabItems\').append(\'<li><a hre" +
"f=\"#DeviceDetailTab-Jobs\">Jobs [");
#line 10 "..\..\Views\Device\DeviceParts\_Jobs.cshtml"
Write(Model.Jobs.Items.Count());
#line default
#line hidden
WriteLiteral("]</a></li>\');\r\n </script>\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
@@ -8,7 +8,6 @@
Html.BundleDeferred("~/Style/Shadowbox");
Html.BundleDeferred("~/ClientScripts/Modules/Shadowbox");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
if (canAddAttachments)
{
@@ -29,17 +28,18 @@
{
foreach (var da in Model.Device.DeviceAttachments.OrderByDescending(a => a.Id))
{
<a href="@Url.Action(MVC.API.Device.AttachmentDownload(da.Id))" data-attachmentid="@da.Id" data-mimetype="@da.MimeType">
<span class="icon" title="@da.Filename">
<img alt="Attachment Thumbnail" src="@(Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id)))" /></span>
<span class="comments" title="@(da.Comments ?? da.Filename)">
@{if (!string.IsNullOrEmpty(da.DocumentTemplateId))
{ @da.DocumentTemplate.Description}
else
{ @(da.Comments ?? da.Filename) }}
</span><span class="author">@da.TechUser.ToString()</span>@if (canRemoveAnyAttachments || (canRemoveOwnAttachments && da.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{<text><span class="remove fa fa-times-circle"></span></text>}<span class="timestamp" title="@da.Timestamp.ToFullDateTime()" data-livestamp="@da.Timestamp.ToUnixEpoc()">@da.Timestamp.ToFullDateTime()</span>
</a>
<a href="@Url.Action(MVC.API.Device.AttachmentDownload(da.Id))" data-attachmentid="@da.Id" data-mimetype="@da.MimeType">
<span class="icon" title="@da.Filename">
<img alt="Attachment Thumbnail" src="@(Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id)))" />
</span>
<span class="comments" title="@(da.Comments ?? da.Filename)">
@{if (!string.IsNullOrEmpty(da.DocumentTemplateId))
{ @da.DocumentTemplate.Description}
else
{ @(da.Comments ?? da.Filename) }}
</span><span class="author">@da.TechUser.ToString()</span>@if (canRemoveAnyAttachments || (canRemoveOwnAttachments && da.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{<text><span class="remove fa fa-times-circle"></span></text>}<span class="timestamp" title="@da.Timestamp.ToFullDateTime()" data-livestamp="@da.Timestamp.ToUnixEpoc()">@da.Timestamp.ToFullDateTime()</span>
</a>
}
}
</div>
@@ -56,63 +56,12 @@
modal: true
});
$(function () {
var $Attachments = $('#Attachments');
var $attachmentOutput = $Attachments.find('.attachmentOutput');
var $attachmentDownloadHost;
const $Attachments = $('#Attachments');
const $attachmentOutput = $Attachments.find('.attachmentOutput');
let $attachmentDownloadHost = null;
let $dialogRemoveAttachment = null;
var $dialogRemoveAttachment = null;
// Connect to Hub
var hub = $.connection.deviceUpdates;
// Map Functions
hub.client.addAttachment = onAddAttachment;
hub.client.removeAttachment = onRemoveAttachment;
$.connection.hub.qs = { DeviceSerialNumber: '@(Model.Device.SerialNumber)' };
$.connection.hub.error(onHubFailed);
$.connection.hub.disconnected(onHubFailed);
$.connection.hub.reconnecting(function () {
$('#AttachmentsContainer').find('span.action.enabled').addClass('disabled');
});
$.connection.hub.reconnected(function () {
$('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled');
});
// Start Connection
$.connection.hub.start(function () {
$('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled');
}).fail(onHubFailed);
function onHubFailed(error) {
// Disable UI
$('#AttachmentsContainer').find('span.action.enabled').addClass('disabled');
// Show Dialog Message
if ($('.disconnected-dialog').length == 0) {
$('<div>')
.addClass('dialog disconnected-dialog')
.html('<h3><span class="fa-stack fa-lg"><i class="fa fa-wifi fa-stack-1x"></i><i class="fa fa-ban fa-stack-2x error"></i></span>Disconnected from the Disco ICT Server</h3><div>This page is not receiving live updates. Please ensure you are connected to the server, then refresh this page to enable features.</div>')
.dialog({
resizable: false,
title: 'Disconnected',
width: 400,
modal: true,
buttons: {
'Refresh Now': function () {
$(this).dialog('option', 'buttons', null);
window.location.reload(true);
},
'Close': function () {
$(this).dialog('destroy');
}
}
});
}
}
function onAddAttachment(id, quick) {
function onAttachmentAdded(id, quick) {
var data = { id: id };
$.ajax({
url: '@Url.Action(MVC.API.Device.Attachment())',
@@ -185,25 +134,12 @@
buildThumbnail();
}
function onRemoveAttachment(id) {
var a = $attachmentOutput.find('a[data-attachmentid=' + id + ']');
a.hide(300).delay(300).queue(function () {
var $this = $(this);
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
Shadowbox.removeCache(this);
$this.find('.timestamp').livestamp('destroy');
$this.remove();
onUpdate();
});
}
function onDownload() {
var $this = $(this);
var url = $this.attr('href');
if ($.connection && $.connection.hub && $.connection.hub.transport &&
$.connection.hub.transport.name == 'foreverFrame') {
$.connection.hub.transport.name == 'foreverFrame') {
// SignalR active with foreverFrame transport - use popup window
window.open(url, '_blank', 'height=150,width=250,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
} else {
@@ -222,12 +158,28 @@
return false;
}
function onAttachmentRemoved(id) {
var a = $attachmentOutput.find('a[data-attachmentid=' + id + ']');
a.hide(300).delay(300).queue(function () {
var $this = $(this);
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
Shadowbox.removeCache(this);
$this.find('.timestamp').livestamp('destroy');
$this.remove();
onUpdate();
});
}
function onUpdate() {
var attachmentCount = $attachmentOutput.children('a').length;
var tabHeading = 'Attachments [' + attachmentCount + ']';
$('#DeviceDetailTab-ResourcesLink').text(tabHeading);
}
document.DiscoFunctions.onAttachmentAdded = onAttachmentAdded;
document.DiscoFunctions.onAttachmentRemoved = onAttachmentRemoved;
@if (canAddAttachments)
{<text>
//#region Add Attachments
@@ -54,7 +54,6 @@ namespace Disco.Web.Views.Device.DeviceParts
Html.BundleDeferred("~/Style/Shadowbox");
Html.BundleDeferred("~/ClientScripts/Modules/Shadowbox");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
if (canAddAttachments)
{
@@ -82,21 +81,46 @@ WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"Attachments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 888), Tuple.Create("\"", 963)
WriteAttribute("class", Tuple.Create(" class=\"", 820), Tuple.Create("\"", 1067)
#line 22 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 896), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 828), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line default
#line hidden
, 828), false)
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 895), Tuple.Create<System.Object, System.Int32>(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments"
#line default
#line hidden
, 896), false)
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 981), Tuple.Create<System.Object, System.Int32>(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments"
#line default
#line hidden
, 982), false)
);
WriteLiteral(" data-userid=\"");
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(CurrentUser.UserId);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-uploadurl=\"");
#line 22 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)));
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)));
#line default
@@ -106,8 +130,8 @@ WriteLiteral("\"");
WriteLiteral(" data-onlineuploadurl=\"");
#line 22 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentOnlineUploadSession(Model.Device.SerialNumber)));
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentOnlineUploadSession(Model.Device.SerialNumber)));
#line default
@@ -117,8 +141,8 @@ WriteLiteral("\"");
WriteLiteral(" data-qrcodeurl=\"");
#line 22 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js"));
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js"));
#line default
@@ -130,7 +154,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 23 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 22 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Html.AntiForgeryToken());
@@ -148,13 +172,13 @@ WriteLiteral(" class=\"attachmentOutput\"");
WriteLiteral(">\r\n");
#line 28 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 27 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line default
#line hidden
#line 28 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 27 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (Model.Device.DeviceAttachments != null)
{
foreach (var da in Model.Device.DeviceAttachments.OrderByDescending(a => a.Id))
@@ -163,23 +187,23 @@ WriteLiteral(">\r\n");
#line default
#line hidden
WriteLiteral(" <a");
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 1770), Tuple.Create("\"", 1830)
WriteAttribute("href", Tuple.Create(" href=\"", 1912), Tuple.Create("\"", 1972)
#line 32 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1777), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentDownload(da.Id))
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1919), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentDownload(da.Id))
#line default
#line hidden
, 1777), false)
, 1919), false)
);
WriteLiteral(" data-attachmentid=\"");
#line 32 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.Id);
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.Id);
#line default
@@ -189,100 +213,101 @@ WriteLiteral("\"");
WriteLiteral(" data-mimetype=\"");
#line 32 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.MimeType);
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.MimeType);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <span");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"icon\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1940), Tuple.Create("\"", 1960)
WriteAttribute("title", Tuple.Create(" title=\"", 2086), Tuple.Create("\"", 2106)
#line 33 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1948), Tuple.Create<System.Object, System.Int32>(da.Filename
#line 32 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2094), Tuple.Create<System.Object, System.Int32>(da.Filename
#line default
#line hidden
, 1948), false)
, 2094), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 2031), Tuple.Create("\"", 2093)
WriteAttribute("src", Tuple.Create(" src=\"", 2181), Tuple.Create("\"", 2243)
#line 34 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2037), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id))
#line 33 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2187), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id))
#line default
#line hidden
, 2037), false)
, 2187), false)
);
WriteLiteral(" /></span>\r\n <span");
WriteLiteral(" />\r\n </span>\r\n " +
" <span");
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2160), Tuple.Create("\"", 2197)
WriteAttribute("title", Tuple.Create(" title=\"", 2352), Tuple.Create("\"", 2389)
#line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2168), Tuple.Create<System.Object, System.Int32>(da.Comments ?? da.Filename
, Tuple.Create(Tuple.Create("", 2360), Tuple.Create<System.Object, System.Int32>(da.Comments ?? da.Filename
#line default
#line hidden
, 2168), false)
, 2360), false)
);
WriteLiteral(">\r\n");
#line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line default
#line hidden
#line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (!string.IsNullOrEmpty(da.DocumentTemplateId))
{
if (!string.IsNullOrEmpty(da.DocumentTemplateId))
{
#line default
#line hidden
#line 37 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.DocumentTemplate.Description);
Write(da.DocumentTemplate.Description);
#line default
#line hidden
#line 37 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
else
{
#line default
#line hidden
#line 39 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.Comments ?? da.Filename);
#line default
#line hidden
#line 39 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
else
{
#line default
#line hidden
#line 39 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.Comments ?? da.Filename);
#line default
#line hidden
#line 39 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n </span><span");
WriteLiteral("\r\n </span><span");
WriteLiteral(" class=\"author\"");
@@ -290,7 +315,7 @@ WriteLiteral(">");
#line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.TechUser.ToString());
Write(da.TechUser.ToString());
#line default
@@ -299,8 +324,8 @@ WriteLiteral("</span>");
#line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && da.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && da.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{
#line default
#line hidden
@@ -312,7 +337,7 @@ WriteLiteral("></span>");
#line 41 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
}
#line default
#line hidden
@@ -320,21 +345,21 @@ WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2888), Tuple.Create("\"", 2926)
WriteAttribute("title", Tuple.Create(" title=\"", 3044), Tuple.Create("\"", 3082)
#line 41 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2896), Tuple.Create<System.Object, System.Int32>(da.Timestamp.ToFullDateTime()
, Tuple.Create(Tuple.Create("", 3052), Tuple.Create<System.Object, System.Int32>(da.Timestamp.ToFullDateTime()
#line default
#line hidden
, 2896), false)
, 3052), false)
);
WriteLiteral(" data-livestamp=\"");
#line 41 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.Timestamp.ToUnixEpoc());
Write(da.Timestamp.ToUnixEpoc());
#line default
@@ -345,12 +370,12 @@ WriteLiteral(">");
#line 41 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.Timestamp.ToFullDateTime());
Write(da.Timestamp.ToFullDateTime());
#line default
#line hidden
WriteLiteral("</span>\r\n </a> \r\n");
WriteLiteral("</span>\r\n </a>\r\n");
#line 43 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
@@ -423,169 +448,51 @@ WriteLiteral(@">
modal: true
});
$(function () {
var $Attachments = $('#Attachments');
var $attachmentOutput = $Attachments.find('.attachmentOutput');
var $attachmentDownloadHost;
const $Attachments = $('#Attachments');
const $attachmentOutput = $Attachments.find('.attachmentOutput');
let $attachmentDownloadHost = null;
let $dialogRemoveAttachment = null;
var $dialogRemoveAttachment = null;
// Connect to Hub
var hub = $.connection.deviceUpdates;
// Map Functions
hub.client.addAttachment = onAddAttachment;
hub.client.removeAttachment = onRemoveAttachment;
$.connection.hub.qs = { DeviceSerialNumber: '");
function onAttachmentAdded(id, quick) {
var data = { id: id };
$.ajax({
url: '");
#line 72 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Model.Device.SerialNumber);
#line default
#line hidden
WriteLiteral("\' };\r\n $.connection.hub.error(onHubFailed);\r\n " +
" $.connection.hub.disconnected(onHubFailed);\r\n\r\n " +
" $.connection.hub.reconnecting(function () {\r\n " +
" $(\'#AttachmentsContainer\').find(\'span.action.enabled\').addClass(\'disa" +
"bled\');\r\n });\r\n $.connecti" +
"on.hub.reconnected(function () {\r\n $(\'#Attachment" +
"sContainer\').find(\'span.action.enabled\').removeClass(\'disabled\');\r\n " +
" });\r\n\r\n // Start Connection\r\n " +
" $.connection.hub.start(function () {\r\n " +
" $(\'#AttachmentsContainer\').find(\'span.action.enabled\').removeClass(\'dis" +
"abled\');\r\n }).fail(onHubFailed);\r\n\r\n " +
" function onHubFailed(error) {\r\n // Dis" +
"able UI\r\n $(\'#AttachmentsContainer\').find(\'span.a" +
"ction.enabled\').addClass(\'disabled\');\r\n\r\n // Show" +
" Dialog Message\r\n if ($(\'.disconnected-dialog\').l" +
"ength == 0) {\r\n $(\'<div>\')\r\n " +
" .addClass(\'dialog disconnected-dialog\')\r\n " +
" .html(\'<h3><span class=\"fa-stack fa-lg\"><i class=\"fa fa-" +
"wifi fa-stack-1x\"></i><i class=\"fa fa-ban fa-stack-2x error\"></i></span>Disconne" +
"cted from the Disco ICT Server</h3><div>This page is not receiving live updates." +
" Please ensure you are connected to the server, then refresh this page to enable" +
" features.</div>\')\r\n .dialog({\r\n " +
" resizable: false,\r\n " +
" title: \'Disconnected\',\r\n " +
" width: 400,\r\n modal: true,\r\n " +
" buttons: {\r\n " +
" \'Refresh Now\': function () {\r\n " +
" $(this).dialog(\'option\', \'buttons\', null);\r\n " +
" window.location.reload(true);\r\n " +
" },\r\n " +
" \'Close\': function () {\r\n " +
" $(this).dialog(\'destroy\');\r\n " +
" }\r\n }\r\n " +
" });\r\n }\r\n " +
"}\r\n\r\n function onAddAttachment(id, quick) {\r\n " +
" var data = { id: id };\r\n " +
"$.ajax({\r\n url: \'");
#line 118 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 67 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.Attachment()));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d.Result == 'OK') {
var a = d.Attachment;
");
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
" data: data,\r\n success: function" +
" (d) {\r\n if (d.Result == \'OK\') {\r\n " +
" var a = d.Attachment;\r\n\r\n " +
" if ($Attachments.hasClass(\'canRemoveAnyAttachments\'))\r" +
"\n buildAttachment(a, true, quick)" +
";\r\n else if ($Attachments.hasClass(\'c" +
"anRemoveOwnAttachments\'))\r\n build" +
"Attachment(a, (a.AuthorId === $Attachments.attr(\'data-userid\')), quick);\r\n " +
" else\r\n " +
" buildAttachment(a, false, quick);\r\n " +
" } else {\r\n alert(\'Unable to ad" +
"d attachment: \' + d.Result);\r\n }\r\n " +
" },\r\n error: func" +
"tion (jqXHR, textStatus, errorThrown) {\r\n " +
" alert(\'Unable to add attachment: \' + textStatus);\r\n " +
" }\r\n });\r\n }\r\n\r" +
"\n function buildAttachment(a, canRemove, quick) {\r\n " +
" var t = \'<a><span class=\"icon\"><img alt=\"Attachmen" +
"t Thumbnail\" /></span><span class=\"comments\"></span><span class=\"author\"></span>" +
"\';\r\n if (canRemove)\r\n " +
" t += \'<span class=\"remove fa fa-times-circle\"></span>\';\r\n " +
" t += \'<span class=\"timestamp\"></span></a>\';\r\n\r\n " +
" var e = $(t);\r\n\r\n e.attr(\'data-at" +
"tachmentid\', a.Id).attr(\'data-mimetype\', a.MimeType).attr(\'href\', \'");
#line 124 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line default
#line hidden
#line 124 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canRemoveAnyAttachments)
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, true, quick);");
WriteLiteral("\r\n");
#line 127 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
else if (canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
#line 130 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(CurrentUser.UserId);
#line default
#line hidden
WriteLiteral("\'), quick);");
WriteLiteral("\r\n");
#line 131 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, false, quick);");
WriteLiteral("\r\n");
#line 135 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(@" } else {
alert('Unable to add attachment: ' + d.Result);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to add attachment: ' + textStatus);
}
});
}
function buildAttachment(a, canRemove, quick) {
var t = '<a><span class=""icon""><img alt=""Attachment Thumbnail"" /></span><span class=""comments""></span><span class=""author""></span>';
if (canRemove)
t += '<span class=""remove fa fa-times-circle""></span>';
t += '<span class=""timestamp""></span></a>';
var e = $(t);
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '");
#line 154 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 98 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentDownload()));
@@ -617,7 +524,7 @@ WriteLiteral(@"/' + a.Id);
img.attr('src', '");
#line 177 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 121 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentThumbnail()));
@@ -633,48 +540,50 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n
" img.removeClass(\'loading\');\r\n });\r\n " +
" window.setTimeout(setThumbnailUrl, 100);\r\n " +
" };\r\n buildThumbnail()" +
";\r\n }\r\n\r\n function onRemov" +
"eAttachment(id) {\r\n var a = $attachmentOutput.fin" +
"d(\'a[data-attachmentid=\' + id + \']\');\r\n\r\n a.hide(" +
"300).delay(300).queue(function () {\r\n var $th" +
"is = $(this);\r\n if ($this.attr(\'data-mimetype" +
"\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
" Shadowbox.removeCache(this);\r\n $this.find(\'" +
".timestamp\').livestamp(\'destroy\');\r\n $this.re" +
"move();\r\n onUpdate();\r\n " +
" });\r\n }\r\n\r\n func" +
"tion onDownload() {\r\n var $this = $(this);\r\n " +
" var url = $this.attr(\'href\');\r\n\r\n " +
" if ($.connection && $.connection.hub && $.connection.hub.transport &" +
"&\r\n $.connection.hub.transpor" +
"t.name == \'foreverFrame\') {\r\n // SignalR acti" +
"ve with foreverFrame transport - use popup window\r\n " +
" window.open(url, \'_blank\', \'height=150,width=250,location=no,menubar=no,r" +
"esizable=no,scrollbars=no,status=no,toolbar=no\');\r\n " +
" } else {\r\n // use iFrame\r\n " +
" if (!$attachmentDownloadHost) {\r\n " +
" $attachmentDownloadHost = $(\'<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 " +
" $attachmentDownloadHost[0].location.href = url;\r\n " +
" }\r\n }\r\n\r\n " +
" return false;\r\n }\r\n\r\n " +
" function onUpdate() {\r\n va" +
"r attachmentCount = $attachmentOutput.children(\'a\').length;\r\n " +
" var tabHeading = \'Attachments [\' + attachmentCount + \']\';\r\n " +
" $(\'#DeviceDetailTab-ResourcesLink\').text(tabHeading);\r\n " +
" }\r\n\r\n");
";\r\n }\r\n\r\n function onDownl" +
"oad() {\r\n var $this = $(this);\r\n " +
" var url = $this.attr(\'href\');\r\n\r\n " +
"if ($.connection && $.connection.hub && $.connection.hub.transport &&\r\n " +
" $.connection.hub.transport.name == \'foreverFrame\') {\r" +
"\n // SignalR active with foreverFrame transpo" +
"rt - use popup window\r\n window.open(url, \'_bl" +
"ank\', \'height=150,width=250,location=no,menubar=no,resizable=no,scrollbars=no,st" +
"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");
#line 236 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 183 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line default
#line hidden
#line 236 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 183 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canAddAttachments)
{
@@ -721,7 +630,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
" //#endregion\r\n ");
#line 283 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 230 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
@@ -730,7 +639,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
WriteLiteral(" ");
#line 284 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 231 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -763,7 +672,7 @@ WriteLiteral(@"
url: '");
#line 309 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 256 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentRemove()));
@@ -791,7 +700,7 @@ WriteLiteral("\',\r\n dataType: \'jso
"endregion\r\n ");
#line 336 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 283 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
@@ -828,7 +737,7 @@ WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n <scr
"etailTab-ResourcesLink\">Attachments [");
#line 357 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 304 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Model.Device.DeviceAttachments == null ? 0 : Model.Device.DeviceAttachments.Count);
+80 -3
View File
@@ -2,8 +2,15 @@
@using Disco.Services.Devices.DeviceFlags;
@{
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), string.Format("Device: {0}", Model.Device.SerialNumber));
var requiresLive = Authorization.HasAny(Claims.Device.ShowComments, Claims.Device.ShowAttachments);
if (requiresLive)
{
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
}
}
<div id="Device_Show">
<div id="Device_Show" data-deviceserialnumber="@Model.Device.SerialNumber">
<div id="Device_Show_Status">
<i class="fa fa-square deviceStatus @(Model.Device.StatusCode())"></i>&nbsp;@Model.Device.Status()
<script type="text/javascript">
@@ -93,9 +100,9 @@
</script>
<div id="DeviceDetailTabs">
<ul id="DeviceDetailTabItems"></ul>
@if (Authorization.Has(Claims.Device.ShowJobs))
@if (Authorization.HasAny(Claims.Device.ShowComments, Claims.Device.ShowJobs))
{
@Html.Partial(MVC.Device.Views.DeviceParts._Jobs, Model)
@Html.Partial(MVC.Device.Views.DeviceParts._CommentsAndJobs, Model)
}
@if (Authorization.Has(Claims.Device.ShowDetails))
{
@@ -118,4 +125,74 @@
@Html.Partial(MVC.Device.Views.DeviceParts._Certificates, Model)
}
</div>
@if (requiresLive)
{
<script>
$(function () {
if (!document.DiscoFunctions)
return;
const deviceSerialNumber = $('#Device_Show').attr('data-deviceserialnumber');
// Connect to Hub
var hub = $.connection.deviceUpdates;
// Map Functions
if (document.DiscoFunctions.onCommentAdded)
hub.client.commentAdded = document.DiscoFunctions.onCommentAdded;
if (document.DiscoFunctions.onCommentRemoved)
hub.client.commentRemoved = document.DiscoFunctions.onCommentRemoved;
if (document.DiscoFunctions.onAttachmentAdded)
hub.client.attachmentAdded = document.DiscoFunctions.onAttachmentAdded;
if (document.DiscoFunctions.onAttachmentRemoved)
hub.client.attachmentRemoved = document.DiscoFunctions.onAttachmentRemoved;
$.connection.hub.qs = { DeviceSerialNumber: deviceSerialNumber };
$.connection.hub.error(onHubFailed);
$.connection.hub.disconnected(onHubFailed);
$.connection.hub.reconnecting(function () {
$('#AttachmentsContainer').find('span.action.enabled').addClass('disabled');
$('#Comments').find('button').prop('disabled', true);
});
$.connection.hub.reconnected(function () {
$('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled');
$('#Comments').find('button').prop('disabled', false);
});
// Start Connection
$.connection.hub.start(function () {
$('#AttachmentsContainer').find('span.action.enabled').removeClass('disabled');
$('#Comments').find('button').prop('disabled', false);
}).fail(onHubFailed);
function onHubFailed(error) {
// Disable UI
$('#AttachmentsContainer').find('span.action.enabled').addClass('disabled');
$('#Comments').find('button').prop('disabled', true);
// Show Dialog Message
if ($('.disconnected-dialog').length == 0) {
$('<div>')
.addClass('dialog disconnected-dialog')
.html('<h3><span class="fa-stack fa-lg"><i class="fa fa-wifi fa-stack-1x"></i><i class="fa fa-ban fa-stack-2x error"></i></span>Disconnected from the Disco ICT Server</h3><div>This page is not receiving live updates. Please ensure you are connected to the server, then refresh this page to enable features.</div>')
.dialog({
resizable: false,
title: 'Disconnected',
width: 400,
modal: true,
buttons: {
'Refresh Now': function () {
$(this).dialog('option', 'buttons', null);
window.location.reload(true);
},
'Close': function () {
$(this).dialog('destroy');
}
}
});
}
}
});
</script>
}
</div>
+144 -56
View File
@@ -54,6 +54,13 @@ namespace Disco.Web.Views.Device
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), string.Format("Device: {0}", Model.Device.SerialNumber));
var requiresLive = Authorization.HasAny(Claims.Device.ShowComments, Claims.Device.ShowAttachments);
if (requiresLive)
{
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
}
#line default
#line hidden
@@ -61,29 +68,40 @@ WriteLiteral("\r\n<div");
WriteLiteral(" id=\"Device_Show\"");
WriteLiteral(" data-deviceserialnumber=\"");
#line 13 "..\..\Views\Device\Show.cshtml"
Write(Model.Device.SerialNumber);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"Device_Show_Status\"");
WriteLiteral(">\r\n <i");
WriteAttribute("class", Tuple.Create(" class=\"", 290), Tuple.Create("\"", 352)
, Tuple.Create(Tuple.Create("", 298), Tuple.Create("fa", 298), true)
, Tuple.Create(Tuple.Create(" ", 300), Tuple.Create("fa-square", 301), true)
, Tuple.Create(Tuple.Create(" ", 310), Tuple.Create("deviceStatus", 311), true)
WriteAttribute("class", Tuple.Create(" class=\"", 561), Tuple.Create("\"", 623)
, Tuple.Create(Tuple.Create("", 569), Tuple.Create("fa", 569), true)
, Tuple.Create(Tuple.Create(" ", 571), Tuple.Create("fa-square", 572), true)
, Tuple.Create(Tuple.Create(" ", 581), Tuple.Create("deviceStatus", 582), true)
#line 8 "..\..\Views\Device\Show.cshtml"
, Tuple.Create(Tuple.Create(" ", 323), Tuple.Create<System.Object, System.Int32>(Model.Device.StatusCode()
#line 15 "..\..\Views\Device\Show.cshtml"
, Tuple.Create(Tuple.Create(" ", 594), Tuple.Create<System.Object, System.Int32>(Model.Device.StatusCode()
#line default
#line hidden
, 324), false)
, 595), false)
);
WriteLiteral("></i>&nbsp;");
#line 8 "..\..\Views\Device\Show.cshtml"
#line 15 "..\..\Views\Device\Show.cshtml"
Write(Model.Device.Status());
@@ -97,13 +115,13 @@ WriteLiteral(">\r\n $(function () {\r\n $(\'#Device_Sh
"(\'#layout_PageHeading\')\r\n });\r\n </script>\r\n </div>\r\n");
#line 15 "..\..\Views\Device\Show.cshtml"
#line 22 "..\..\Views\Device\Show.cshtml"
#line default
#line hidden
#line 15 "..\..\Views\Device\Show.cshtml"
#line 22 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowFlagAssignments))
{
@@ -117,13 +135,13 @@ WriteLiteral(" id=\"Device_Show_Flags\"");
WriteLiteral(">\r\n");
#line 18 "..\..\Views\Device\Show.cshtml"
#line 25 "..\..\Views\Device\Show.cshtml"
#line default
#line hidden
#line 18 "..\..\Views\Device\Show.cshtml"
#line 25 "..\..\Views\Device\Show.cshtml"
foreach (var flag in Model.Device.DeviceFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, DeviceFlagService.GetDeviceFlag(f.DeviceFlagId))))
{
@@ -132,27 +150,27 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <i");
WriteAttribute("class", Tuple.Create(" class=\"", 907), Tuple.Create("\"", 983)
, Tuple.Create(Tuple.Create("", 915), Tuple.Create("flag", 915), true)
, Tuple.Create(Tuple.Create(" ", 919), Tuple.Create("fa", 920), true)
, Tuple.Create(Tuple.Create(" ", 922), Tuple.Create("fa-", 923), true)
WriteAttribute("class", Tuple.Create(" class=\"", 1178), Tuple.Create("\"", 1254)
, Tuple.Create(Tuple.Create("", 1186), Tuple.Create("flag", 1186), true)
, Tuple.Create(Tuple.Create(" ", 1190), Tuple.Create("fa", 1191), true)
, Tuple.Create(Tuple.Create(" ", 1193), Tuple.Create("fa-", 1194), true)
#line 20 "..\..\Views\Device\Show.cshtml"
, Tuple.Create(Tuple.Create("", 926), Tuple.Create<System.Object, System.Int32>(flag.Item2.Icon
#line 27 "..\..\Views\Device\Show.cshtml"
, Tuple.Create(Tuple.Create("", 1197), Tuple.Create<System.Object, System.Int32>(flag.Item2.Icon
#line default
#line hidden
, 926), false)
, Tuple.Create(Tuple.Create(" ", 944), Tuple.Create("fa-fw", 945), true)
, Tuple.Create(Tuple.Create(" ", 950), Tuple.Create("fa-lg", 951), true)
, Tuple.Create(Tuple.Create(" ", 956), Tuple.Create("d-", 957), true)
, 1197), false)
, Tuple.Create(Tuple.Create(" ", 1215), Tuple.Create("fa-fw", 1216), true)
, Tuple.Create(Tuple.Create(" ", 1221), Tuple.Create("fa-lg", 1222), true)
, Tuple.Create(Tuple.Create(" ", 1227), Tuple.Create("d-", 1228), true)
#line 20 "..\..\Views\Device\Show.cshtml"
, Tuple.Create(Tuple.Create("", 959), Tuple.Create<System.Object, System.Int32>(flag.Item2.IconColour
#line 27 "..\..\Views\Device\Show.cshtml"
, Tuple.Create(Tuple.Create("", 1230), Tuple.Create<System.Object, System.Int32>(flag.Item2.IconColour
#line default
#line hidden
, 959), false)
, 1230), false)
);
WriteLiteral(">\r\n <span");
@@ -166,7 +184,7 @@ WriteLiteral(" class=\"name\"");
WriteLiteral(">");
#line 22 "..\..\Views\Device\Show.cshtml"
#line 29 "..\..\Views\Device\Show.cshtml"
Write(flag.Item2.Name);
@@ -175,7 +193,7 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 22 "..\..\Views\Device\Show.cshtml"
#line 29 "..\..\Views\Device\Show.cshtml"
if (flag.Item1.Comments != null)
{
@@ -188,7 +206,7 @@ WriteLiteral(" class=\"comments\"");
WriteLiteral(">");
#line 23 "..\..\Views\Device\Show.cshtml"
#line 30 "..\..\Views\Device\Show.cshtml"
Write(flag.Item1.Comments.ToHtmlComment());
@@ -197,7 +215,7 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 23 "..\..\Views\Device\Show.cshtml"
#line 30 "..\..\Views\Device\Show.cshtml"
}
#line default
@@ -209,7 +227,7 @@ WriteLiteral(" class=\"added\"");
WriteLiteral(">");
#line 23 "..\..\Views\Device\Show.cshtml"
#line 30 "..\..\Views\Device\Show.cshtml"
Write(CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUser));
@@ -218,7 +236,7 @@ WriteLiteral(">");
WriteLiteral("</span>\r\n </span>\r\n </i>\r\n");
#line 26 "..\..\Views\Device\Show.cshtml"
#line 33 "..\..\Views\Device\Show.cshtml"
}
@@ -264,7 +282,7 @@ WriteLiteral(@">
");
#line 59 "..\..\Views\Device\Show.cshtml"
#line 66 "..\..\Views\Device\Show.cshtml"
}
@@ -273,7 +291,7 @@ WriteLiteral(@">
WriteLiteral(" ");
#line 60 "..\..\Views\Device\Show.cshtml"
#line 67 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Subject, Model));
@@ -314,29 +332,29 @@ WriteLiteral(" id=\"DeviceDetailTabItems\"");
WriteLiteral("></ul>\r\n");
#line 96 "..\..\Views\Device\Show.cshtml"
#line 103 "..\..\Views\Device\Show.cshtml"
#line default
#line hidden
#line 96 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowJobs))
#line 103 "..\..\Views\Device\Show.cshtml"
if (Authorization.HasAny(Claims.Device.ShowComments, Claims.Device.ShowJobs))
{
#line default
#line hidden
#line 98 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Jobs, Model));
#line 105 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._CommentsAndJobs, Model));
#line default
#line hidden
#line 98 "..\..\Views\Device\Show.cshtml"
#line 105 "..\..\Views\Device\Show.cshtml"
}
@@ -345,7 +363,7 @@ WriteLiteral("></ul>\r\n");
WriteLiteral(" ");
#line 100 "..\..\Views\Device\Show.cshtml"
#line 107 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowDetails))
{
@@ -353,14 +371,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 102 "..\..\Views\Device\Show.cshtml"
#line 109 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Details, Model));
#line default
#line hidden
#line 102 "..\..\Views\Device\Show.cshtml"
#line 109 "..\..\Views\Device\Show.cshtml"
}
@@ -370,7 +388,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 104 "..\..\Views\Device\Show.cshtml"
#line 111 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowAssignmentHistory))
{
@@ -378,14 +396,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 106 "..\..\Views\Device\Show.cshtml"
#line 113 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._AssignmentHistory, Model));
#line default
#line hidden
#line 106 "..\..\Views\Device\Show.cshtml"
#line 113 "..\..\Views\Device\Show.cshtml"
}
@@ -395,7 +413,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 108 "..\..\Views\Device\Show.cshtml"
#line 115 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowAttachments))
{
@@ -403,14 +421,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 110 "..\..\Views\Device\Show.cshtml"
#line 117 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Resources, Model));
#line default
#line hidden
#line 110 "..\..\Views\Device\Show.cshtml"
#line 117 "..\..\Views\Device\Show.cshtml"
}
@@ -420,7 +438,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 112 "..\..\Views\Device\Show.cshtml"
#line 119 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowFlagAssignments))
{
@@ -428,14 +446,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 114 "..\..\Views\Device\Show.cshtml"
#line 121 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Flags, Model));
#line default
#line hidden
#line 114 "..\..\Views\Device\Show.cshtml"
#line 121 "..\..\Views\Device\Show.cshtml"
}
@@ -445,7 +463,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 116 "..\..\Views\Device\Show.cshtml"
#line 123 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowCertificates))
{
@@ -453,21 +471,91 @@ WriteLiteral(" ");
#line default
#line hidden
#line 118 "..\..\Views\Device\Show.cshtml"
#line 125 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Certificates, Model));
#line default
#line hidden
#line 118 "..\..\Views\Device\Show.cshtml"
#line 125 "..\..\Views\Device\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n</div>\r\n");
WriteLiteral(" </div>\r\n");
#line 128 "..\..\Views\Device\Show.cshtml"
#line default
#line hidden
#line 128 "..\..\Views\Device\Show.cshtml"
if (requiresLive)
{
#line default
#line hidden
WriteLiteral(" <script>\r\n $(function () {\r\n if (!document.Disc" +
"oFunctions)\r\n return;\r\n\r\n const deviceSerialNu" +
"mber = $(\'#Device_Show\').attr(\'data-deviceserialnumber\');\r\n // Co" +
"nnect to Hub\r\n var hub = $.connection.deviceUpdates;\r\n\r\n " +
" // Map Functions\r\n if (document.DiscoFunctions.onCommentAd" +
"ded)\r\n hub.client.commentAdded = document.DiscoFunctions.onCo" +
"mmentAdded;\r\n if (document.DiscoFunctions.onCommentRemoved)\r\n " +
" hub.client.commentRemoved = document.DiscoFunctions.onCommentRem" +
"oved;\r\n if (document.DiscoFunctions.onAttachmentAdded)\r\n " +
" hub.client.attachmentAdded = document.DiscoFunctions.onAttachmentAdde" +
"d;\r\n if (document.DiscoFunctions.onAttachmentRemoved)\r\n " +
" hub.client.attachmentRemoved = document.DiscoFunctions.onAttachmentRem" +
"oved;\r\n\r\n $.connection.hub.qs = { DeviceSerialNumber: deviceSeria" +
"lNumber };\r\n $.connection.hub.error(onHubFailed);\r\n " +
" $.connection.hub.disconnected(onHubFailed);\r\n\r\n $.connection.hu" +
"b.reconnecting(function () {\r\n $(\'#AttachmentsContainer\').fin" +
"d(\'span.action.enabled\').addClass(\'disabled\');\r\n $(\'#Comments" +
"\').find(\'button\').prop(\'disabled\', true);\r\n });\r\n " +
"$.connection.hub.reconnected(function () {\r\n $(\'#AttachmentsC" +
"ontainer\').find(\'span.action.enabled\').removeClass(\'disabled\');\r\n " +
" $(\'#Comments\').find(\'button\').prop(\'disabled\', false);\r\n });" +
"\r\n\r\n // Start Connection\r\n $.connection.hub.start(" +
"function () {\r\n $(\'#AttachmentsContainer\').find(\'span.action." +
"enabled\').removeClass(\'disabled\');\r\n $(\'#Comments\').find(\'but" +
"ton\').prop(\'disabled\', false);\r\n }).fail(onHubFailed);\r\n\r\n " +
" function onHubFailed(error) {\r\n // Disable UI\r\n " +
" $(\'#AttachmentsContainer\').find(\'span.action.enabled\').addClass(\'" +
"disabled\');\r\n $(\'#Comments\').find(\'button\').prop(\'disabled\', " +
"true);\r\n\r\n // Show Dialog Message\r\n if ($(" +
"\'.disconnected-dialog\').length == 0) {\r\n $(\'<div>\')\r\n " +
" .addClass(\'dialog disconnected-dialog\')\r\n " +
" .html(\'<h3><span class=\"fa-stack fa-lg\"><i class=\"fa fa-wifi fa-sta" +
"ck-1x\"></i><i class=\"fa fa-ban fa-stack-2x error\"></i></span>Disconnected from t" +
"he Disco ICT Server</h3><div>This page is not receiving live updates. Please ens" +
"ure you are connected to the server, then refresh this page to enable features.<" +
"/div>\')\r\n .dialog({\r\n " +
"resizable: false,\r\n title: \'Disconnected\',\r\n " +
" width: 400,\r\n modal: t" +
"rue,\r\n buttons: {\r\n " +
" \'Refresh Now\': function () {\r\n $(th" +
"is).dialog(\'option\', \'buttons\', null);\r\n " +
"window.location.reload(true);\r\n },\r\n " +
" \'Close\': function () {\r\n " +
" $(this).dialog(\'destroy\');\r\n }\r\n " +
" }\r\n });\r\n " +
" }\r\n }\r\n });\r\n </script>\r\n");
#line 197 "..\..\Views\Device\Show.cshtml"
}
#line default
#line hidden
WriteLiteral("</div>\r\n");
}
}
+2 -2
View File
@@ -62,11 +62,11 @@
<ul id="jobDetailTabItems">
@if (Authorization.HasAll(Claims.Job.ShowLogs, Claims.Job.ShowAttachments))
{
<li><a id="jobDetailTab-ResourcesLink" href="#jobDetailTab-Resources">Log and Attachments [@(Model.Job.JobAttachments.Count)]</a></li>
<li><a id="jobDetailTab-ResourcesLink" href="#jobDetailTab-Resources">Comments and Attachments [@(Model.Job.JobAttachments.Count)]</a></li>
}
else if (Authorization.Has(Claims.Job.ShowLogs))
{
<li><a id="jobDetailTab-ResourcesLink" href="#jobDetailTab-Resources">Log</a></li>
<li><a id="jobDetailTab-ResourcesLink" href="#jobDetailTab-Resources">Comments</a></li>
}
else if (Authorization.Has(Claims.Job.ShowAttachments))
{
+3 -3
View File
@@ -265,11 +265,11 @@ WriteLiteral(" id=\"jobDetailTab-ResourcesLink\"");
WriteLiteral(" href=\"#jobDetailTab-Resources\"");
WriteLiteral(">Log and Attachments [");
WriteLiteral(">Comments and Attachments [");
#line 65 "..\..\Views\Job\Show.cshtml"
Write(Model.Job.JobAttachments.Count);
Write(Model.Job.JobAttachments.Count);
#line default
@@ -291,7 +291,7 @@ WriteLiteral(" id=\"jobDetailTab-ResourcesLink\"");
WriteLiteral(" href=\"#jobDetailTab-Resources\"");
WriteLiteral(">Log</a></li>\r\n");
WriteLiteral(">Comments</a></li>\r\n");
#line 70 "..\..\Views\Job\Show.cshtml"
@@ -209,4 +209,4 @@
}
});
</script>
}
}
@@ -35,16 +35,16 @@ namespace Disco.Web.Views.User.UserParts
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/User/UserParts/Comments.cshtml")]
public partial class Comments : Disco.Services.Web.WebViewPage<Disco.Web.Models.User.ShowModel>
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/User/UserParts/_Comments.cshtml")]
public partial class _Comments : Disco.Services.Web.WebViewPage<Disco.Web.Models.User.ShowModel>
{
public Comments()
public _Comments()
{
}
public override void Execute()
{
#line 2 "..\..\Views\User\UserParts\Comments.cshtml"
#line 2 "..\..\Views\User\UserParts\_Comments.cshtml"
Authorization.Require(Claims.User.ShowComments);
var canAddComments = Authorization.Has(Claims.User.Actions.AddComments);
@@ -60,21 +60,21 @@ WriteLiteral(" id=\"Comments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 377), Tuple.Create("\"", 597)
#line 8 "..\..\Views\User\UserParts\Comments.cshtml"
#line 8 "..\..\Views\User\UserParts\_Comments.cshtml"
, Tuple.Create(Tuple.Create("", 385), Tuple.Create<System.Object, System.Int32>(canAddComments ? "canAddComments" : "cannotAddComments"
#line default
#line hidden
, 385), false)
#line 8 "..\..\Views\User\UserParts\Comments.cshtml"
#line 8 "..\..\Views\User\UserParts\_Comments.cshtml"
, Tuple.Create(Tuple.Create(" ", 443), Tuple.Create<System.Object, System.Int32>(canRemoveAnyComments ? "canRemoveAnyComments" : "cannotRemoveAnyComments"
#line default
#line hidden
, 444), false)
#line 8 "..\..\Views\User\UserParts\Comments.cshtml"
#line 8 "..\..\Views\User\UserParts\_Comments.cshtml"
, Tuple.Create(Tuple.Create(" ", 520), Tuple.Create<System.Object, System.Int32>(canRemoveOwnComments ? "canRemoveOwnComments" : "cannotRemoveOwnComments"
#line default
@@ -85,7 +85,7 @@ WriteAttribute("class", Tuple.Create(" class=\"", 377), Tuple.Create("\"", 597)
WriteLiteral(" data-id=\"");
#line 8 "..\..\Views\User\UserParts\Comments.cshtml"
#line 8 "..\..\Views\User\UserParts\_Comments.cshtml"
Write(Model.User.UserId);
@@ -96,7 +96,7 @@ WriteLiteral("\"");
WriteLiteral(" data-userid=\"");
#line 8 "..\..\Views\User\UserParts\Comments.cshtml"
#line 8 "..\..\Views\User\UserParts\_Comments.cshtml"
Write(CurrentUser.UserId);
@@ -107,7 +107,7 @@ WriteLiteral("\"");
WriteLiteral(" data-addurl=\"");
#line 8 "..\..\Views\User\UserParts\Comments.cshtml"
#line 8 "..\..\Views\User\UserParts\_Comments.cshtml"
Write(Url.Action(MVC.API.User.CommentAdd(Model.User.UserId)));
@@ -118,7 +118,7 @@ WriteLiteral("\"");
WriteLiteral(" data-removeurl=\"");
#line 8 "..\..\Views\User\UserParts\Comments.cshtml"
#line 8 "..\..\Views\User\UserParts\_Comments.cshtml"
Write(Url.Action(MVC.API.User.CommentRemove()));
@@ -129,7 +129,7 @@ WriteLiteral("\"");
WriteLiteral(" data-geturl=\"");
#line 8 "..\..\Views\User\UserParts\Comments.cshtml"
#line 8 "..\..\Views\User\UserParts\_Comments.cshtml"
Write(Url.Action(MVC.API.User.Comment()));
@@ -142,7 +142,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 9 "..\..\Views\User\UserParts\Comments.cshtml"
#line 9 "..\..\Views\User\UserParts\_Comments.cshtml"
Write(Html.AntiForgeryToken());
@@ -151,13 +151,13 @@ Write(Html.AntiForgeryToken());
WriteLiteral("\r\n");
#line 10 "..\..\Views\User\UserParts\Comments.cshtml"
#line 10 "..\..\Views\User\UserParts\_Comments.cshtml"
#line default
#line hidden
#line 10 "..\..\Views\User\UserParts\Comments.cshtml"
#line 10 "..\..\Views\User\UserParts\_Comments.cshtml"
if (canAddComments)
{
@@ -189,7 +189,7 @@ WriteLiteral(" class=\"fa fa-comment\"");
WriteLiteral("></i></button>\r\n </div>\r\n");
#line 16 "..\..\Views\User\UserParts\Comments.cshtml"
#line 16 "..\..\Views\User\UserParts\_Comments.cshtml"
}
@@ -202,13 +202,13 @@ WriteLiteral(" class=\"commentOutput\"");
WriteLiteral(">\r\n");
#line 18 "..\..\Views\User\UserParts\Comments.cshtml"
#line 18 "..\..\Views\User\UserParts\_Comments.cshtml"
#line default
#line hidden
#line 18 "..\..\Views\User\UserParts\Comments.cshtml"
#line 18 "..\..\Views\User\UserParts\_Comments.cshtml"
foreach (var c in Model.User.UserComments.OrderBy(m => m.Timestamp))
{
@@ -222,7 +222,7 @@ WriteLiteral(" class=\"comment\"");
WriteLiteral(" data-commentid=\"");
#line 20 "..\..\Views\User\UserParts\Comments.cshtml"
#line 20 "..\..\Views\User\UserParts\_Comments.cshtml"
Write(c.Id);
@@ -237,7 +237,7 @@ WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 21 "..\..\Views\User\UserParts\Comments.cshtml"
#line 21 "..\..\Views\User\UserParts\_Comments.cshtml"
Write(c.TechUser.ToStringFriendly());
@@ -246,7 +246,7 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 21 "..\..\Views\User\UserParts\Comments.cshtml"
#line 21 "..\..\Views\User\UserParts\_Comments.cshtml"
if (canRemoveAnyComments || (canRemoveOwnComments && c.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{
@@ -259,7 +259,7 @@ WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>");
#line 22 "..\..\Views\User\UserParts\Comments.cshtml"
#line 22 "..\..\Views\User\UserParts\_Comments.cshtml"
}
#line default
@@ -271,7 +271,7 @@ WriteLiteral(" class=\"timestamp\"");
WriteLiteral(" data-livestamp=\"");
#line 22 "..\..\Views\User\UserParts\Comments.cshtml"
#line 22 "..\..\Views\User\UserParts\_Comments.cshtml"
Write(c.Timestamp.ToUnixEpoc());
@@ -281,7 +281,7 @@ WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1701), Tuple.Create("\"", 1738)
#line 22 "..\..\Views\User\UserParts\Comments.cshtml"
#line 22 "..\..\Views\User\UserParts\_Comments.cshtml"
, Tuple.Create(Tuple.Create("", 1709), Tuple.Create<System.Object, System.Int32>(c.Timestamp.ToFullDateTime()
#line default
@@ -292,7 +292,7 @@ WriteAttribute("title", Tuple.Create(" title=\"", 1701), Tuple.Create("\"", 1738
WriteLiteral(">");
#line 22 "..\..\Views\User\UserParts\Comments.cshtml"
#line 22 "..\..\Views\User\UserParts\_Comments.cshtml"
Write(c.Timestamp.ToFullDateTime());
@@ -305,7 +305,7 @@ WriteLiteral(" class=\"comment\"");
WriteLiteral(">");
#line 23 "..\..\Views\User\UserParts\Comments.cshtml"
#line 23 "..\..\Views\User\UserParts\_Comments.cshtml"
Write(c.Comments.ToHtmlComment());
@@ -314,7 +314,7 @@ WriteLiteral(">");
WriteLiteral("</div>\r\n </div>\r\n");
#line 25 "..\..\Views\User\UserParts\Comments.cshtml"
#line 25 "..\..\Views\User\UserParts\_Comments.cshtml"
}
@@ -364,7 +364,7 @@ WriteLiteral(" </div>\r\n</div>\r\n<script>\r\n if (!document.DiscoFunctio
"tRemoved;\r\n });\r\n</script>\r\n");
#line 107 "..\..\Views\User\UserParts\Comments.cshtml"
#line 107 "..\..\Views\User\UserParts\_Comments.cshtml"
if (canAddComments)
{
@@ -396,14 +396,14 @@ WriteLiteral(" <script>\r\n $(function () {\r\n const $comm
"();\r\n }\r\n }\r\n });\r\n </script>\r\n");
#line 156 "..\..\Views\User\UserParts\Comments.cshtml"
#line 156 "..\..\Views\User\UserParts\_Comments.cshtml"
}
#line default
#line hidden
#line 157 "..\..\Views\User\UserParts\Comments.cshtml"
#line 157 "..\..\Views\User\UserParts\_Comments.cshtml"
if (canRemoveAnyComments || canRemoveOwnComments)
{
@@ -440,8 +440,9 @@ WriteLiteral(" <script>\r\n $(function () {\r\n const $comm
"pt>\r\n");
#line 212 "..\..\Views\User\UserParts\Comments.cshtml"
#line 212 "..\..\Views\User\UserParts\_Comments.cshtml"
}
#line default
#line hidden
@@ -26,7 +26,7 @@
@if (canShowComments)
{
<div id="UserDetailTab-CommentsContainer">
@Html.Partial(MVC.User.Views.UserParts.Comments, Model)
@Html.Partial(MVC.User.Views.UserParts._Comments, Model)
</div>
}
@if (canShowJobs)
@@ -119,7 +119,7 @@ WriteLiteral(" ");
#line 29 "..\..\Views\User\UserParts\_CommentsAndJobs.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts.Comments, Model));
Write(Html.Partial(MVC.User.Views.UserParts._Comments, Model));
#line default
@@ -59,6 +59,7 @@
var $Attachments = $('#Attachments');
var $attachmentOutput = $Attachments.find('.attachmentOutput');
var $dialogRemoveAttachment = null;
let $attachmentDownloadHost = null;
function onAttachmentAdded(id, quick) {
var data = { id: id };
@@ -451,6 +451,7 @@ WriteLiteral(@">
var $Attachments = $('#Attachments');
var $attachmentOutput = $Attachments.find('.attachmentOutput');
var $dialogRemoveAttachment = null;
let $attachmentDownloadHost = null;
function onAttachmentAdded(id, quick) {
var data = { id: id };
@@ -458,7 +459,7 @@ WriteLiteral(@">
url: '");
#line 66 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 67 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.Attachment()));
@@ -491,7 +492,7 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
"chmentid\', a.Id).attr(\'data-mimetype\', a.MimeType).attr(\'href\', \'");
#line 96 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 97 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentDownload()));
@@ -523,7 +524,7 @@ WriteLiteral(@"/' + a.Id);
img.attr('src', '");
#line 119 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 120 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentThumbnail()));
@@ -576,13 +577,13 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n
"DiscoFunctions.onAttachmentRemoved = onAttachmentRemoved;\r\n\r\n");
#line 181 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 182 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 181 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 182 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
@@ -629,7 +630,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
" //#endregion\r\n ");
#line 228 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 229 "..\..\Views\User\UserParts\_Resources.cshtml"
}
@@ -638,7 +639,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
WriteLiteral(" ");
#line 229 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 230 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -672,7 +673,7 @@ WriteLiteral(@"
url: '");
#line 255 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 256 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentRemove()));
@@ -700,7 +701,7 @@ WriteLiteral("\',\r\n dataType: \'jso
"/#endregion\r\n ");
#line 283 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 284 "..\..\Views\User\UserParts\_Resources.cshtml"
}
@@ -724,7 +725,7 @@ WriteLiteral(@"
$('#UserDetailTabItems').append('<li><a href=""#UserDetailTab-Resources"" id=""UserDetailTab-ResourcesLink"">Attachments [");
#line 299 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 300 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Model.User.UserAttachments == null ? 0 : Model.User.UserAttachments.Count);
@@ -733,7 +734,7 @@ WriteLiteral(@"
WriteLiteral("]</a></li>\');\r\n </script>\r\n</div>\r\n");
#line 302 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 303 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -755,7 +756,7 @@ WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n");
#line 309 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 310 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default