add comments for users [#145]

This commit is contained in:
Gary Sharp
2025-07-12 19:55:58 +10:00
parent 42e9045d5e
commit 2184c9e22e
35 changed files with 2201 additions and 498 deletions
+80 -3
View File
@@ -4,8 +4,15 @@
Authorization.Require(Claims.User.Show);
ViewBag.Title = Html.ToBreadcrumb("Users", MVC.User.Index(), string.Format("User: {0} ({1})", Model.User.DisplayName, Model.User.FriendlyId()));
var requiresLive = Authorization.HasAny(Claims.User.ShowComments, Claims.User.ShowAttachments);
if (requiresLive)
{
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
}
}
<div id="User_Show">
<div id="User_Show" data-userid="@Model.User.UserId">
@if (Authorization.Has(Claims.User.ShowFlagAssignments))
{
<div id="User_Show_Flags">
@@ -87,9 +94,9 @@
</script>
<div id="UserDetailTabs">
<ul id="UserDetailTabItems"></ul>
@if (Authorization.Has(Claims.User.ShowJobs))
@if (Authorization.HasAny(Claims.User.ShowComments, Claims.User.ShowJobs))
{
@Html.Partial(MVC.User.Views.UserParts._Jobs, Model)
@Html.Partial(MVC.User.Views.UserParts._CommentsAndJobs, Model)
}
@if (Authorization.Has(Claims.User.ShowAssignmentHistory))
{
@@ -108,4 +115,74 @@
@Html.Partial(MVC.User.Views.UserParts._Authorization, Model)
}
</div>
@if (requiresLive)
{
<script>
$(function () {
if (!document.DiscoFunctions)
return;
const userId = $('#User_Show').attr('data-userid');
// Connect to Hub
var hub = $.connection.userUpdates;
// 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 = { UserId: userId };
$.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>
+133 -45
View File
@@ -56,6 +56,13 @@ namespace Disco.Web.Views.User
ViewBag.Title = Html.ToBreadcrumb("Users", MVC.User.Index(), string.Format("User: {0} ({1})", Model.User.DisplayName, Model.User.FriendlyId()));
var requiresLive = Authorization.HasAny(Claims.User.ShowComments, Claims.User.ShowAttachments);
if (requiresLive)
{
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
}
#line default
#line hidden
@@ -63,16 +70,27 @@ WriteLiteral("\r\n<div");
WriteLiteral(" id=\"User_Show\"");
WriteLiteral(" data-userid=\"");
#line 15 "..\..\Views\User\Show.cshtml"
Write(Model.User.UserId);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n");
#line 9 "..\..\Views\User\Show.cshtml"
#line 16 "..\..\Views\User\Show.cshtml"
#line default
#line hidden
#line 9 "..\..\Views\User\Show.cshtml"
#line 16 "..\..\Views\User\Show.cshtml"
if (Authorization.Has(Claims.User.ShowFlagAssignments))
{
@@ -86,13 +104,13 @@ WriteLiteral(" id=\"User_Show_Flags\"");
WriteLiteral(">\r\n");
#line 12 "..\..\Views\User\Show.cshtml"
#line 19 "..\..\Views\User\Show.cshtml"
#line default
#line hidden
#line 12 "..\..\Views\User\Show.cshtml"
#line 19 "..\..\Views\User\Show.cshtml"
foreach (var flag in Model.User.UserFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, UserFlagService.GetUserFlag(f.UserFlagId))))
{
@@ -101,27 +119,27 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <i");
WriteAttribute("class", Tuple.Create(" class=\"", 620), Tuple.Create("\"", 696)
, Tuple.Create(Tuple.Create("", 628), Tuple.Create("flag", 628), true)
, Tuple.Create(Tuple.Create(" ", 632), Tuple.Create("fa", 633), true)
, Tuple.Create(Tuple.Create(" ", 635), Tuple.Create("fa-", 636), true)
WriteAttribute("class", Tuple.Create(" class=\"", 867), Tuple.Create("\"", 943)
, Tuple.Create(Tuple.Create("", 875), Tuple.Create("flag", 875), true)
, Tuple.Create(Tuple.Create(" ", 879), Tuple.Create("fa", 880), true)
, Tuple.Create(Tuple.Create(" ", 882), Tuple.Create("fa-", 883), true)
#line 14 "..\..\Views\User\Show.cshtml"
, Tuple.Create(Tuple.Create("", 639), Tuple.Create<System.Object, System.Int32>(flag.Item2.Icon
#line 21 "..\..\Views\User\Show.cshtml"
, Tuple.Create(Tuple.Create("", 886), Tuple.Create<System.Object, System.Int32>(flag.Item2.Icon
#line default
#line hidden
, 639), false)
, Tuple.Create(Tuple.Create(" ", 657), Tuple.Create("fa-fw", 658), true)
, Tuple.Create(Tuple.Create(" ", 663), Tuple.Create("fa-lg", 664), true)
, Tuple.Create(Tuple.Create(" ", 669), Tuple.Create("d-", 670), true)
, 886), false)
, Tuple.Create(Tuple.Create(" ", 904), Tuple.Create("fa-fw", 905), true)
, Tuple.Create(Tuple.Create(" ", 910), Tuple.Create("fa-lg", 911), true)
, Tuple.Create(Tuple.Create(" ", 916), Tuple.Create("d-", 917), true)
#line 14 "..\..\Views\User\Show.cshtml"
, Tuple.Create(Tuple.Create("", 672), Tuple.Create<System.Object, System.Int32>(flag.Item2.IconColour
#line 21 "..\..\Views\User\Show.cshtml"
, Tuple.Create(Tuple.Create("", 919), Tuple.Create<System.Object, System.Int32>(flag.Item2.IconColour
#line default
#line hidden
, 672), false)
, 919), false)
);
WriteLiteral(">\r\n <span");
@@ -135,7 +153,7 @@ WriteLiteral(" class=\"name\"");
WriteLiteral(">");
#line 16 "..\..\Views\User\Show.cshtml"
#line 23 "..\..\Views\User\Show.cshtml"
Write(flag.Item2.Name);
@@ -144,7 +162,7 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 16 "..\..\Views\User\Show.cshtml"
#line 23 "..\..\Views\User\Show.cshtml"
if (flag.Item1.Comments != null)
{
@@ -157,7 +175,7 @@ WriteLiteral(" class=\"comments\"");
WriteLiteral(">");
#line 17 "..\..\Views\User\Show.cshtml"
#line 24 "..\..\Views\User\Show.cshtml"
Write(flag.Item1.Comments.ToHtmlComment());
@@ -166,7 +184,7 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 17 "..\..\Views\User\Show.cshtml"
#line 24 "..\..\Views\User\Show.cshtml"
}
#line default
@@ -178,7 +196,7 @@ WriteLiteral(" class=\"added\"");
WriteLiteral(">");
#line 17 "..\..\Views\User\Show.cshtml"
#line 24 "..\..\Views\User\Show.cshtml"
Write(CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUser));
@@ -187,7 +205,7 @@ WriteLiteral(">");
WriteLiteral("</span>\r\n </span>\r\n </i>\r\n");
#line 20 "..\..\Views\User\Show.cshtml"
#line 27 "..\..\Views\User\Show.cshtml"
}
@@ -233,7 +251,7 @@ WriteLiteral(@">
");
#line 53 "..\..\Views\User\Show.cshtml"
#line 60 "..\..\Views\User\Show.cshtml"
}
@@ -242,7 +260,7 @@ WriteLiteral(@">
WriteLiteral(" ");
#line 54 "..\..\Views\User\Show.cshtml"
#line 61 "..\..\Views\User\Show.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts._Subject, Model));
@@ -282,29 +300,29 @@ WriteLiteral(" id=\"UserDetailTabItems\"");
WriteLiteral("></ul>\r\n");
#line 90 "..\..\Views\User\Show.cshtml"
#line 97 "..\..\Views\User\Show.cshtml"
#line default
#line hidden
#line 90 "..\..\Views\User\Show.cshtml"
if (Authorization.Has(Claims.User.ShowJobs))
#line 97 "..\..\Views\User\Show.cshtml"
if (Authorization.HasAny(Claims.User.ShowComments, Claims.User.ShowJobs))
{
#line default
#line hidden
#line 92 "..\..\Views\User\Show.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts._Jobs, Model));
#line 99 "..\..\Views\User\Show.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts._CommentsAndJobs, Model));
#line default
#line hidden
#line 92 "..\..\Views\User\Show.cshtml"
#line 99 "..\..\Views\User\Show.cshtml"
}
@@ -313,7 +331,7 @@ WriteLiteral("></ul>\r\n");
WriteLiteral(" ");
#line 94 "..\..\Views\User\Show.cshtml"
#line 101 "..\..\Views\User\Show.cshtml"
if (Authorization.Has(Claims.User.ShowAssignmentHistory))
{
@@ -321,14 +339,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 96 "..\..\Views\User\Show.cshtml"
#line 103 "..\..\Views\User\Show.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts._AssignmentHistory, Model));
#line default
#line hidden
#line 96 "..\..\Views\User\Show.cshtml"
#line 103 "..\..\Views\User\Show.cshtml"
}
@@ -338,7 +356,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 98 "..\..\Views\User\Show.cshtml"
#line 105 "..\..\Views\User\Show.cshtml"
if (Authorization.Has(Claims.User.ShowAttachments))
{
@@ -346,14 +364,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 100 "..\..\Views\User\Show.cshtml"
#line 107 "..\..\Views\User\Show.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts._Resources, Model));
#line default
#line hidden
#line 100 "..\..\Views\User\Show.cshtml"
#line 107 "..\..\Views\User\Show.cshtml"
}
@@ -363,7 +381,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 102 "..\..\Views\User\Show.cshtml"
#line 109 "..\..\Views\User\Show.cshtml"
if (Authorization.Has(Claims.User.ShowFlagAssignments))
{
@@ -371,14 +389,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 104 "..\..\Views\User\Show.cshtml"
#line 111 "..\..\Views\User\Show.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts._Flags, Model));
#line default
#line hidden
#line 104 "..\..\Views\User\Show.cshtml"
#line 111 "..\..\Views\User\Show.cshtml"
}
@@ -388,7 +406,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 106 "..\..\Views\User\Show.cshtml"
#line 113 "..\..\Views\User\Show.cshtml"
if (Authorization.Has(Claims.User.ShowAuthorization))
{
@@ -396,21 +414,91 @@ WriteLiteral(" ");
#line default
#line hidden
#line 108 "..\..\Views\User\Show.cshtml"
#line 115 "..\..\Views\User\Show.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts._Authorization, Model));
#line default
#line hidden
#line 108 "..\..\Views\User\Show.cshtml"
#line 115 "..\..\Views\User\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n</div>\r\n");
WriteLiteral(" </div>\r\n");
#line 118 "..\..\Views\User\Show.cshtml"
#line default
#line hidden
#line 118 "..\..\Views\User\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 userId = $(\'#U" +
"ser_Show\').attr(\'data-userid\');\r\n // Connect to Hub\r\n " +
" var hub = $.connection.userUpdates;\r\n\r\n // Map Functions\r\n " +
" if (document.DiscoFunctions.onCommentAdded)\r\n hu" +
"b.client.commentAdded = document.DiscoFunctions.onCommentAdded;\r\n " +
" if (document.DiscoFunctions.onCommentRemoved)\r\n hub.client.c" +
"ommentRemoved = document.DiscoFunctions.onCommentRemoved;\r\n if (d" +
"ocument.DiscoFunctions.onAttachmentAdded)\r\n hub.client.attach" +
"mentAdded = document.DiscoFunctions.onAttachmentAdded;\r\n if (docu" +
"ment.DiscoFunctions.onAttachmentRemoved)\r\n hub.client.attachm" +
"entRemoved = document.DiscoFunctions.onAttachmentRemoved;\r\n\r\n $.c" +
"onnection.hub.qs = { UserId: userId };\r\n $.connection.hub.error(o" +
"nHubFailed);\r\n $.connection.hub.disconnected(onHubFailed);\r\n\r\n " +
" $.connection.hub.reconnecting(function () {\r\n $(" +
"\'#AttachmentsContainer\').find(\'span.action.enabled\').addClass(\'disabled\');\r\n " +
" $(\'#Comments\').find(\'button\').prop(\'disabled\', true);\r\n " +
" });\r\n $.connection.hub.reconnected(function () {\r\n " +
" $(\'#AttachmentsContainer\').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 $(\'#AttachmentsCo" +
"ntainer\').find(\'span.action.enabled\').removeClass(\'disabled\');\r\n " +
" $(\'#Comments\').find(\'button\').prop(\'disabled\', false);\r\n }).f" +
"ail(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 disconnect" +
"ed-dialog\')\r\n .html(\'<h3><span class=\"fa-stack fa-lg\"" +
"><i class=\"fa fa-wifi fa-stack-1x\"></i><i class=\"fa fa-ban fa-stack-2x error\"></" +
"i></span>Disconnected from the Disco ICT Server</h3><div>This page is not receiv" +
"ing live updates. Please ensure you are connected to the server, then refresh th" +
"is page to enable features.</div>\')\r\n .dialog({\r\n " +
" resizable: false,\r\n t" +
"itle: \'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 " +
" </script>\r\n");
#line 187 "..\..\Views\User\Show.cshtml"
}
#line default
#line hidden
WriteLiteral("</div>\r\n");
}
}
@@ -0,0 +1,212 @@
@model Disco.Web.Models.User.ShowModel
@{
Authorization.Require(Claims.User.ShowComments);
var canAddComments = Authorization.Has(Claims.User.Actions.AddComments);
var canRemoveAnyComments = Authorization.Has(Claims.User.Actions.RemoveAnyComments);
var canRemoveOwnComments = Authorization.Has(Claims.User.Actions.RemoveOwnComments);
}
<div id="Comments" class="@(canAddComments ? "canAddComments" : "cannotAddComments") @(canRemoveAnyComments ? "canRemoveAnyComments" : "cannotRemoveAnyComments") @(canRemoveOwnComments ? "canRemoveOwnComments" : "cannotRemoveOwnComments")" data-id="@Model.User.UserId" data-userid="@CurrentUser.UserId" data-addurl="@Url.Action(MVC.API.User.CommentAdd(Model.User.UserId))" data-removeurl="@Url.Action(MVC.API.User.CommentRemove())" data-geturl="@Url.Action(MVC.API.User.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.User.UserComments.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);
$('#UserDetailTabs').on('tabsactivate', function (event, ui) {
if (ui.newPanel && ui.newPanel.is('#UserDetailTab-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,451 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.User.UserParts
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/User/UserParts/Comments.cshtml")]
public partial class Comments : Disco.Services.Web.WebViewPage<Disco.Web.Models.User.ShowModel>
{
public Comments()
{
}
public override void Execute()
{
#line 2 "..\..\Views\User\UserParts\Comments.cshtml"
Authorization.Require(Claims.User.ShowComments);
var canAddComments = Authorization.Has(Claims.User.Actions.AddComments);
var canRemoveAnyComments = Authorization.Has(Claims.User.Actions.RemoveAnyComments);
var canRemoveOwnComments = Authorization.Has(Claims.User.Actions.RemoveOwnComments);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"Comments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 377), Tuple.Create("\"", 597)
#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"
, 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"
, Tuple.Create(Tuple.Create(" ", 520), Tuple.Create<System.Object, System.Int32>(canRemoveOwnComments ? "canRemoveOwnComments" : "cannotRemoveOwnComments"
#line default
#line hidden
, 521), false)
);
WriteLiteral(" data-id=\"");
#line 8 "..\..\Views\User\UserParts\Comments.cshtml"
Write(Model.User.UserId);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-userid=\"");
#line 8 "..\..\Views\User\UserParts\Comments.cshtml"
Write(CurrentUser.UserId);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-addurl=\"");
#line 8 "..\..\Views\User\UserParts\Comments.cshtml"
Write(Url.Action(MVC.API.User.CommentAdd(Model.User.UserId)));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-removeurl=\"");
#line 8 "..\..\Views\User\UserParts\Comments.cshtml"
Write(Url.Action(MVC.API.User.CommentRemove()));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-geturl=\"");
#line 8 "..\..\Views\User\UserParts\Comments.cshtml"
Write(Url.Action(MVC.API.User.Comment()));
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 9 "..\..\Views\User\UserParts\Comments.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
WriteLiteral("\r\n");
#line 10 "..\..\Views\User\UserParts\Comments.cshtml"
#line default
#line hidden
#line 10 "..\..\Views\User\UserParts\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\User\UserParts\Comments.cshtml"
}
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"commentOutput\"");
WriteLiteral(">\r\n");
#line 18 "..\..\Views\User\UserParts\Comments.cshtml"
#line default
#line hidden
#line 18 "..\..\Views\User\UserParts\Comments.cshtml"
foreach (var c in Model.User.UserComments.OrderBy(m => m.Timestamp))
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"comment\"");
WriteLiteral(" data-commentid=\"");
#line 20 "..\..\Views\User\UserParts\Comments.cshtml"
Write(c.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 21 "..\..\Views\User\UserParts\Comments.cshtml"
Write(c.TechUser.ToStringFriendly());
#line default
#line hidden
WriteLiteral("</span>");
#line 21 "..\..\Views\User\UserParts\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\User\UserParts\Comments.cshtml"
}
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\"");
WriteLiteral(" data-livestamp=\"");
#line 22 "..\..\Views\User\UserParts\Comments.cshtml"
Write(c.Timestamp.ToUnixEpoc());
#line default
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1701), Tuple.Create("\"", 1738)
#line 22 "..\..\Views\User\UserParts\Comments.cshtml"
, Tuple.Create(Tuple.Create("", 1709), Tuple.Create<System.Object, System.Int32>(c.Timestamp.ToFullDateTime()
#line default
#line hidden
, 1709), false)
);
WriteLiteral(">");
#line 22 "..\..\Views\User\UserParts\Comments.cshtml"
Write(c.Timestamp.ToFullDateTime());
#line default
#line hidden
WriteLiteral("</span>\r\n <div");
WriteLiteral(" class=\"comment\"");
WriteLiteral(">");
#line 23 "..\..\Views\User\UserParts\Comments.cshtml"
Write(c.Comments.ToHtmlComment());
#line default
#line hidden
WriteLiteral("</div>\r\n </div>\r\n");
#line 25 "..\..\Views\User\UserParts\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 " +
" $(\'#UserDetailTabs\').on(\'tabsactivate\', function (event, ui) {\r\n " +
" if (ui.newPanel && ui.newPanel.is(\'#UserDetailTab-CommentsAndJobs\')) {\r\n " +
" $commentOutput[0].scrollTop = $commentOutput[0].scrollHeight; // Scrol" +
"l to Bottom\r\n }\r\n });\r\n\r\n function onCommentAdded(id) {" +
"\r\n onCommentAddedAsync(id);\r\n }\r\n async function onComm" +
"entAddedAsync(id) {\r\n const formData = new FormData();\r\n f" +
"ormData.append(\'__RequestVerificationToken\', $comments.find(\'input[name=\"__Reque" +
"stVerificationToken\"]\').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 comment \' " +
"+ id + \': \' + response.statusText);\r\n } else {\r\n const" +
" comment = await response.json();\r\n\r\n if ($comments.hasClass(\'can" +
"RemoveAnyComments\'))\r\n renderComment(comment, false, true);\r\n" +
" else if ($comments.hasClass(\'canRemoveOwnComments\'))\r\n " +
" renderComment(comment, false, (comment.AuthorId === $comments.attr(\'da" +
"ta-userid\')));\r\n else\r\n renderComment(comment," +
" false, false);\r\n }\r\n }\r\n function onCommentRemoved(id)" +
" {\r\n $commentOutput.children(\'div[data-commentid=\"\' + id + \'\"]\').slid" +
"eUp(300).delay(300).queue(function () {\r\n const $this = $(this);\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-circ" +
"le\" />\';\r\n t += \'<span class=\"timestamp\" /><div class=\"comment\" /></d" +
"iv>\';\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(\'.timestamp" +
"\').text(c.TimestampFull).attr(\'title\', c.TimestampFull).livestamp(c.TimestampUni" +
"xEpoc);\r\n e.find(\'.comment\').html(c.HtmlComments);\r\n\r\n $co" +
"mmentOutput.append(e);\r\n\r\n if (!quick) {\r\n e.animate({" +
" backgroundColor: \'#ffff99\' }, 500, function () {\r\n e.animate" +
"({ backgroundColor: \'#fafafa\' }, 500, function () {\r\n e.c" +
"ss(\'background-color\', \'\');\r\n });\r\n });\r\n " +
" $commentOutput.animate({ scrollTop: $commentOutput[0].scrollHeight }," +
" 250)\r\n }\r\n }\r\n\r\n document.DiscoFunctions.onCommentAdde" +
"d = onCommentAdded;\r\n document.DiscoFunctions.onCommentRemoved = onCommen" +
"tRemoved;\r\n });\r\n</script>\r\n");
#line 107 "..\..\Views\User\UserParts\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\User\UserParts\Comments.cshtml"
}
#line default
#line hidden
#line 157 "..\..\Views\User\UserParts\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\User\UserParts\Comments.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
@@ -0,0 +1,41 @@
@model Disco.Web.Models.User.ShowModel
@{
var canShowComments = Authorization.Has(Claims.User.ShowComments);
var canShowJobs = Authorization.Has(Claims.User.ShowJobs);
var jobCount = (Model.User.Jobs == null ? 0 : Model.User.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="UserDetailTab-CommentsAndJobs" class="UserPart @(canShowComments ? "canShowComments" : "cannotShowComments") @(canShowJobs ? "canShowJobs" : "cannotShowJobs")">
@if (canShowComments)
{
<div id="UserDetailTab-CommentsContainer">
@Html.Partial(MVC.User.Views.UserParts.Comments, Model)
</div>
}
@if (canShowJobs)
{
<div id="UserDetailTab-JobsContainer">
@Html.Partial(MVC.Shared.Views._JobTable, Model.Jobs)
</div>
}
<script>
$('#UserDetailTabItems').append('<li><a href="#UserDetailTab-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.User.UserParts
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/User/UserParts/_CommentsAndJobs.cshtml")]
public partial class _CommentsAndJobs : Disco.Services.Web.WebViewPage<Disco.Web.Models.User.ShowModel>
{
public _CommentsAndJobs()
{
}
public override void Execute()
{
#line 2 "..\..\Views\User\UserParts\_CommentsAndJobs.cshtml"
var canShowComments = Authorization.Has(Claims.User.ShowComments);
var canShowJobs = Authorization.Has(Claims.User.ShowJobs);
var jobCount = (Model.User.Jobs == null ? 0 : Model.User.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=\"UserDetailTab-CommentsAndJobs\"");
WriteAttribute("class", Tuple.Create(" class=\"", 640), Tuple.Create("\"", 768)
, Tuple.Create(Tuple.Create("", 648), Tuple.Create("UserPart", 648), true)
#line 25 "..\..\Views\User\UserParts\_CommentsAndJobs.cshtml"
, Tuple.Create(Tuple.Create(" ", 656), Tuple.Create<System.Object, System.Int32>(canShowComments ? "canShowComments" : "cannotShowComments"
#line default
#line hidden
, 657), false)
#line 25 "..\..\Views\User\UserParts\_CommentsAndJobs.cshtml"
, Tuple.Create(Tuple.Create(" ", 718), Tuple.Create<System.Object, System.Int32>(canShowJobs ? "canShowJobs" : "cannotShowJobs"
#line default
#line hidden
, 719), false)
);
WriteLiteral(">\r\n");
#line 26 "..\..\Views\User\UserParts\_CommentsAndJobs.cshtml"
#line default
#line hidden
#line 26 "..\..\Views\User\UserParts\_CommentsAndJobs.cshtml"
if (canShowComments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"UserDetailTab-CommentsContainer\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 29 "..\..\Views\User\UserParts\_CommentsAndJobs.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts.Comments, Model));
#line default
#line hidden
WriteLiteral("\r\n </div>\r\n");
#line 31 "..\..\Views\User\UserParts\_CommentsAndJobs.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 32 "..\..\Views\User\UserParts\_CommentsAndJobs.cshtml"
if (canShowJobs)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"UserDetailTab-JobsContainer\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 35 "..\..\Views\User\UserParts\_CommentsAndJobs.cshtml"
Write(Html.Partial(MVC.Shared.Views._JobTable, Model.Jobs));
#line default
#line hidden
WriteLiteral("\r\n </div>\r\n");
#line 37 "..\..\Views\User\UserParts\_CommentsAndJobs.cshtml"
}
#line default
#line hidden
WriteLiteral(" <script>\r\n $(\'#UserDetailTabItems\').append(\'<li><a href=\"#UserDetailTa" +
"b-CommentsAndJobs\">");
#line 39 "..\..\Views\User\UserParts\_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.User.ShowModel
@{
Authorization.Require(Claims.User.ShowJobs);
}
<div id="UserDetailTab-Jobs" class="UserPart">
<div id="UserDetailTab-JobsContainer">
@Html.Partial(MVC.Shared.Views._JobTable, Model.Jobs)
</div>
<script>
$('#UserDetailTabItems').append('<li><a href="#UserDetailTab-Jobs">Jobs [@(Model.User.Jobs == null ? 0 : Model.User.Jobs.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.User.UserParts
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/User/UserParts/_Jobs.cshtml")]
public partial class _Jobs : Disco.Services.Web.WebViewPage<Disco.Web.Models.User.ShowModel>
{
public _Jobs()
{
}
public override void Execute()
{
#line 2 "..\..\Views\User\UserParts\_Jobs.cshtml"
Authorization.Require(Claims.User.ShowJobs);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"UserDetailTab-Jobs\"");
WriteLiteral(" class=\"UserPart\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"UserDetailTab-JobsContainer\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 7 "..\..\Views\User\UserParts\_Jobs.cshtml"
Write(Html.Partial(MVC.Shared.Views._JobTable, Model.Jobs));
#line default
#line hidden
WriteLiteral("\r\n </div>\r\n <script>\r\n $(\'#UserDetailTabItems\').append(\'<li><a href=" +
"\"#UserDetailTab-Jobs\">Jobs [");
#line 10 "..\..\Views\User\UserParts\_Jobs.cshtml"
Write(Model.User.Jobs == null ? 0 : Model.User.Jobs.Count);
#line default
#line hidden
WriteLiteral("]</a></li>\');\r\n </script>\r\n</div>");
}
}
}
#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)
{
@@ -61,57 +60,7 @@
var $attachmentOutput = $Attachments.find('.attachmentOutput');
var $dialogRemoveAttachment = null;
// Connect to Hub
var hub = $.connection.userUpdates;
// Map Functions
hub.client.addAttachment = onAddAttachment;
hub.client.removeAttachment = onRemoveAttachment;
$.connection.hub.qs = { UserId: '@(Model.User.UserId.Replace(@"\", @"\\"))' };
$.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.User.Attachment())',
@@ -207,7 +156,7 @@
return false;
}
function onRemoveAttachment(id) {
function onAttachmentRemoved(id) {
var a = $attachmentOutput.find('a[data-attachmentid=' + id + ']');
a.hide(300).delay(300).queue(function () {
@@ -226,6 +175,9 @@
$('#UserDetailTab-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.User.UserParts
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=\"", 872), Tuple.Create("\"", 947)
WriteAttribute("class", Tuple.Create(" class=\"", 804), Tuple.Create("\"", 1051)
#line 22 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 880), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 812), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line default
#line hidden
, 812), false)
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 879), Tuple.Create<System.Object, System.Int32>(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments"
#line default
#line hidden
, 880), false)
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create(" ", 965), Tuple.Create<System.Object, System.Int32>(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments"
#line default
#line hidden
, 966), false)
);
WriteLiteral(" data-userid=\"");
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(CurrentUser.UserId);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-uploadurl=\"");
#line 22 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)));
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)));
#line default
@@ -106,8 +130,8 @@ WriteLiteral("\"");
WriteLiteral(" data-onlineuploadurl=\"");
#line 22 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentOnlineUploadSession(Model.User.UserId)));
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentOnlineUploadSession(Model.User.UserId)));
#line default
@@ -117,8 +141,8 @@ WriteLiteral("\"");
WriteLiteral(" data-qrcodeurl=\"");
#line 22 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js"));
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js"));
#line default
@@ -130,7 +154,7 @@ WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 23 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 22 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Html.AntiForgeryToken());
@@ -148,13 +172,13 @@ WriteLiteral(" class=\"attachmentOutput\"");
WriteLiteral(">\r\n");
#line 28 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 27 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 28 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 27 "..\..\Views\User\UserParts\_Resources.cshtml"
if (Model.User.UserAttachments != null)
{
foreach (var ua in Model.User.UserAttachments.OrderByDescending(a => a.Id))
@@ -165,20 +189,20 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 1730), Tuple.Create("\"", 1788)
WriteAttribute("href", Tuple.Create(" href=\"", 1868), Tuple.Create("\"", 1926)
#line 32 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1737), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentDownload(ua.Id))
#line 31 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1875), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentDownload(ua.Id))
#line default
#line hidden
, 1737), false)
, 1875), false)
);
WriteLiteral(" data-attachmentid=\"");
#line 32 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 31 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Id);
@@ -189,7 +213,7 @@ WriteLiteral("\"");
WriteLiteral(" data-mimetype=\"");
#line 32 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 31 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.MimeType);
@@ -201,28 +225,28 @@ WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"icon\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1902), Tuple.Create("\"", 1922)
WriteAttribute("title", Tuple.Create(" title=\"", 2040), Tuple.Create("\"", 2060)
#line 33 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1910), Tuple.Create<System.Object, System.Int32>(ua.Filename
#line 32 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2048), Tuple.Create<System.Object, System.Int32>(ua.Filename
#line default
#line hidden
, 1910), false)
, 2048), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 1997), Tuple.Create("\"", 2057)
WriteAttribute("src", Tuple.Create(" src=\"", 2135), Tuple.Create("\"", 2195)
#line 34 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2003), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentThumbnail(ua.Id))
#line 33 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2141), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentThumbnail(ua.Id))
#line default
#line hidden
, 2003), false)
, 2141), false)
);
WriteLiteral(" />\r\n </span>\r\n " +
@@ -230,40 +254,40 @@ WriteLiteral(" />\r\n </span>\r\n
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2166), Tuple.Create("\"", 2186)
WriteAttribute("title", Tuple.Create(" title=\"", 2304), Tuple.Create("\"", 2324)
#line 36 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2174), Tuple.Create<System.Object, System.Int32>(ua.Comments
#line 35 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2312), Tuple.Create<System.Object, System.Int32>(ua.Comments
#line default
#line hidden
, 2174), false)
, 2312), false)
);
WriteLiteral(">\r\n");
#line 37 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 36 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 37 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 36 "..\..\Views\User\UserParts\_Resources.cshtml"
if (!string.IsNullOrEmpty(ua.DocumentTemplateId))
{
#line default
#line hidden
#line 38 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 37 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.DocumentTemplate.Description);
#line default
#line hidden
#line 38 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 37 "..\..\Views\User\UserParts\_Resources.cshtml"
}
else
{
@@ -271,14 +295,14 @@ WriteLiteral(">\r\n");
#line default
#line hidden
#line 40 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 39 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Comments ?? ua.Filename);
#line default
#line hidden
#line 40 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 39 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
@@ -290,7 +314,7 @@ WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 41 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 40 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.TechUser.ToStringFriendly());
@@ -299,7 +323,7 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 41 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 40 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ua.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{
@@ -312,7 +336,7 @@ WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>");
#line 42 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 41 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
@@ -324,7 +348,7 @@ WriteLiteral(" class=\"timestamp\"");
WriteLiteral(" data-livestamp=\"");
#line 42 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 41 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Timestamp.ToUnixEpoc());
@@ -332,20 +356,20 @@ WriteLiteral(" data-livestamp=\"");
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2895), Tuple.Create("\"", 2933)
WriteAttribute("title", Tuple.Create(" title=\"", 3033), Tuple.Create("\"", 3071)
#line 42 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2903), Tuple.Create<System.Object, System.Int32>(ua.Timestamp.ToFullDateTime()
#line 41 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3041), Tuple.Create<System.Object, System.Int32>(ua.Timestamp.ToFullDateTime()
#line default
#line hidden
, 2903), false)
, 3041), false)
);
WriteLiteral(">");
#line 42 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 41 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Timestamp.ToFullDateTime());
@@ -354,7 +378,7 @@ WriteLiteral(">");
WriteLiteral("</span>\r\n </a>\r\n");
#line 44 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 43 "..\..\Views\User\UserParts\_Resources.cshtml"
}
}
@@ -364,13 +388,13 @@ WriteLiteral("</span>\r\n </a>\r\n");
WriteLiteral(" </div>\r\n");
#line 47 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 46 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 47 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 46 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
@@ -408,7 +432,7 @@ WriteLiteral(" title=\"Upload with Online Services\"");
WriteLiteral("></span>\r\n </div>\r\n");
#line 53 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 52 "..\..\Views\User\UserParts\_Resources.cshtml"
}
@@ -428,162 +452,46 @@ WriteLiteral(@">
var $attachmentOutput = $Attachments.find('.attachmentOutput');
var $dialogRemoveAttachment = null;
// Connect to Hub
var hub = $.connection.userUpdates;
// Map Functions
hub.client.addAttachment = onAddAttachment;
hub.client.removeAttachment = onRemoveAttachment;
$.connection.hub.qs = { UserId: '");
function onAttachmentAdded(id, quick) {
var data = { id: id };
$.ajax({
url: '");
#line 71 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Model.User.UserId.Replace(@"\", @"\\"));
#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 117 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 66 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.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 " +
" function buildAttachment(a, canRemove, quick) {\r\n " +
" var t = \'<a><span class=\"icon\"><img alt=\"Attachment " +
"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-atta" +
"chmentid\', a.Id).attr(\'data-mimetype\', a.MimeType).attr(\'href\', \'");
#line 123 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 123 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments)
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, true, quick);");
WriteLiteral("\r\n");
#line 126 "..\..\Views\User\UserParts\_Resources.cshtml"
}
else if (canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
#line 129 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(CurrentUser.UserId);
#line default
#line hidden
WriteLiteral("\'), quick);");
WriteLiteral("\r\n");
#line 130 "..\..\Views\User\UserParts\_Resources.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, false, quick);");
WriteLiteral("\r\n");
#line 134 "..\..\Views\User\UserParts\_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 152 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 96 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentDownload()));
@@ -615,7 +523,7 @@ WriteLiteral(@"/' + a.Id);
img.attr('src', '");
#line 175 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 119 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentThumbnail()));
@@ -650,29 +558,31 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n
" $attachmentDownloadHost[0].location.href = url;\r\n " +
" }\r\n }\r\n\r\n " +
" return false;\r\n }\r\n\r\n " +
" function onRemoveAttachment(id) {\r\n va" +
"r a = $attachmentOutput.find(\'a[data-attachmentid=\' + id + \']\');\r\n\r\n " +
" a.hide(300).delay(300).queue(function () {\r\n " +
" var $this = $(this);\r\n if" +
" ($this.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
" Shadowbox.removeCache(this);\r\n " +
" $this.find(\'.timestamp\').livestamp(\'destroy\');\r\n " +
" $this.remove();\r\n onUpdate" +
"();\r\n });\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 " +
" $(\'#UserDetailTab-ResourcesLink\').text(tabHeading);\r\n " +
" }\r\n\r\n");
" function onAttachmentRemoved(id) {\r\n v" +
"ar a = $attachmentOutput.find(\'a[data-attachmentid=\' + id + \']\');\r\n\r\n " +
" a.hide(300).delay(300).queue(function () {\r\n " +
" var $this = $(this);\r\n i" +
"f ($this.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
" Shadowbox.removeCache(this);\r\n " +
" $this.find(\'.timestamp\').livestamp(\'destroy\');\r\n " +
" $this.remove();\r\n onUpdat" +
"e();\r\n });\r\n }\r\n\r\n " +
" function onUpdate() {\r\n v" +
"ar attachmentCount = $attachmentOutput.children(\'a\').length;\r\n " +
" var tabHeading = \'Attachments [\' + attachmentCount + \']\';\r\n " +
" $(\'#UserDetailTab-ResourcesLink\').text(tabHeading);\r\n " +
" }\r\n\r\n document.DiscoFunctio" +
"ns.onAttachmentAdded = onAttachmentAdded;\r\n document." +
"DiscoFunctions.onAttachmentRemoved = onAttachmentRemoved;\r\n\r\n");
#line 234 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 181 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 234 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 181 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
@@ -719,7 +629,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
" //#endregion\r\n ");
#line 281 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 228 "..\..\Views\User\UserParts\_Resources.cshtml"
}
@@ -728,7 +638,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
WriteLiteral(" ");
#line 282 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 229 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -762,7 +672,7 @@ WriteLiteral(@"
url: '");
#line 308 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 255 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentRemove()));
@@ -790,7 +700,7 @@ WriteLiteral("\',\r\n dataType: \'jso
"/#endregion\r\n ");
#line 336 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 283 "..\..\Views\User\UserParts\_Resources.cshtml"
}
@@ -814,7 +724,7 @@ WriteLiteral(@"
$('#UserDetailTabItems').append('<li><a href=""#UserDetailTab-Resources"" id=""UserDetailTab-ResourcesLink"">Attachments [");
#line 352 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 299 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Model.User.UserAttachments == null ? 0 : Model.User.UserAttachments.Count);
@@ -823,7 +733,7 @@ WriteLiteral(@"
WriteLiteral("]</a></li>\');\r\n </script>\r\n</div>\r\n");
#line 355 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 302 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -845,7 +755,7 @@ WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n");
#line 362 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 309 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default