Update: SignalR 2.0.3 Migration; Noticeboards

Migrate all SignalR 1.x Persistent Connections to SignalR 2.x Hubs.
Abstracts ScheduledTaskStatus with core interface and adds a Mock for
optional status reporting. Noticeboards rewritten (with new theme) to be
more resilient and accurate.
This commit is contained in:
Gary Sharp
2014-06-01 23:27:07 +10:00
parent f6fae26bc7
commit 4cd57f4a90
116 changed files with 9874 additions and 6462 deletions
+127 -89
View File
@@ -8,8 +8,9 @@
Html.BundleDeferred("~/Style/Shadowbox");
Html.BundleDeferred("~/ClientScripts/Modules/Shadowbox");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
if (Authorization.Has(Claims.User.Actions.AddAttachments))
if (canAddAttachments)
{
Html.BundleDeferred("~/ClientScripts/Modules/Silverlight");
}
@@ -31,8 +32,8 @@
{ @ua.DocumentTemplate.Description}
else
{ @ua.Comments }}
</span><span class="author">@ua.TechUser.ToString()</span>@if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ua.TechUserId == CurrentUser.UserId))
{<text><span class="remove fa fa-times-circle"></span></text>}<span class="timestamp" data-livestamp="@(ua.Timestamp.ToUnixEpoc())" title="@ua.Timestamp.ToFullDateTime()">@ua.Timestamp.ToFullDateTime()</span>
</span><span class="author">@ua.TechUser.ToStringFriendly()</span>@if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ua.TechUserId == CurrentUser.UserId))
{<text><span class="remove fa fa-times-circle"></span></text>}<span class="timestamp" data-livestamp="@(ua.Timestamp.ToUnixEpoc())" title="@ua.Timestamp.ToFullDateTime()">@ua.Timestamp.ToFullDateTime()</span>
</a>
}
}
@@ -49,65 +50,29 @@
modal: true
});
$(function () {
$Attachments = $('#Attachments');
$attachmentOutput = $Attachments.find('.attachmentOutput');
var $Attachments = $('#Attachments');
var $attachmentOutput = $Attachments.find('.attachmentOutput');
var $dialogUpload = null;
var $dialogRemoveAttachment = null;
@if (canAddAttachments)
{<text>
//#region Add Attachments
if (!document.DiscoFunctions) {
document.DiscoFunctions = {};
// 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(onHubError);
// Start Connection
$.connection.hub.start().fail(onHubError);
function onHubError(error) {
alert('Live-update Error: ' + error);
}
document.DiscoFunctions.addAttachment = addAttachment;
$('#dialogUpload').dialog({
autoOpen: false,
draggable: false,
modal: true,
resizable: false,
width: 860,
height: 550,
close: function () {
silverlightUploadAttachment.content.Navigator.Navigate('/Hidden');
}
});
var onLoadNavigation = null;
var isLoaded = null;
Silverlight.createObject(
'@(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap)',
$('#silverlightHostUploadAttachment').get(0),
'silverlightUploadAttachment',
{ width: '840px', height: '500px', background: 'white', version: '4.0.60310.0' },
{
onLoad: function () {
if (onLoadNavigation) {
silverlightUploadAttachment.content.Navigator.Navigate(onLoadNavigation);
isLoaded = true;
}
}
},
'UploadUrl=@(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)))'
);
$attachmentInput = $Attachments.find('.attachmentInput');
$attachmentInput.find('.photo').click(function () {
showDialog('/WebCam');
});
$attachmentInput.find('.upload').click(function () {
showDialog('/File');
});
silverlightUploadAttachment = $('#silverlightUploadAttachment').get(0);
function showDialog(navigationPath) {
$('#dialogUpload').dialog('open');
if (isLoaded) {
silverlightUploadAttachment.content.Navigator.Navigate(navigationPath);
} else {
onLoadNavigation = navigationPath;
}
};
function addAttachment(id, quick) {
function onAddAttachment(id, quick) {
var data = { id: id };
$.ajax({
url: '@Url.Action(MVC.API.User.Attachment())',
@@ -155,11 +120,88 @@
if (!quick)
e.hide();
$attachmentOutput.append(e);
onUpdate();
if (!quick)
e.show('slow');
if (a.MimeType.toLowerCase().indexOf('image/') == 0)
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Comments });
}
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 onUpdate() {
var attachmentCount = $attachmentOutput.children('a').length;
var tabHeading = 'Attachments [' + attachmentCount + ']';
$('#UserDetailTab-ResourcesLink').text(tabHeading);
}
@if (canAddAttachments)
{<text>
//#region Add Attachments
if (!document.DiscoFunctions) {
document.DiscoFunctions = {};
}
document.DiscoFunctions.addAttachment = function (Id) { return; /* Silverlight notification, do nothing use SignalR */ };
var $attachmentInput = $Attachments.find('.attachmentInput');
$attachmentInput.find('.photo').click(function () {
showDialog('/WebCam');
});
$attachmentInput.find('.upload').click(function () {
showDialog('/File');
});
var silverlightOnLoadNavigation = null;
var silverlightIsLoaded = null;
function showDialog(navigationPath) {
if (!$dialogUpload) {
$dialogUpload = $('#dialogUpload').dialog({
autoOpen: false,
draggable: false,
modal: true,
resizable: false,
width: 860,
height: 550,
close: function () {
var sl = $('#silverlightUploadAttachment').get(0);
if (sl.content)
sl.content.Navigator.Navigate('/Hidden');
}
});
Silverlight.createObject('@(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap)',
$('#silverlightHostUploadAttachment').get(0),
'silverlightUploadAttachment',
{ width: '840px', height: '500px', background: 'white', version: '4.0.60310.0' },
{
onLoad: function () {
if (silverlightOnLoadNavigation) {
$('#silverlightUploadAttachment').get(0).content.Navigator.Navigate(silverlightOnLoadNavigation);
silverlightIsLoaded = true;
}
}
},
'UploadUrl=@(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)))');
}
$dialogUpload.dialog('open');
if (silverlightIsLoaded) {
$('#silverlightUploadAttachment').get(0).content.Navigator.Navigate(navigationPath);
} else {
silverlightOnLoadNavigation = navigationPath;
}
};
//#endregion
</text>}
@@ -169,18 +211,20 @@
$attachmentOutput.find('span.remove').click(removeAttachment);
$('#dialogRemoveAttachment').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
function removeAttachment() {
$this = $(this).closest('a');
var data = { id: $this.attr('data-attachmentid') };
var $dialogRemoveAttachment = $('#dialogRemoveAttachment');
if (!$dialogRemoveAttachment) {
$dialogRemoveAttachment = $('#dialogRemoveAttachment').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
}
$dialogRemoveAttachment.dialog("enable");
$dialogRemoveAttachment.dialog('option', 'buttons', {
"Remove": function () {
@@ -192,13 +236,7 @@
data: data,
success: function (d) {
if (d == 'OK') {
$this.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();
});
// Do nothing, await SignalR notification
} else {
alert('Unable to remove attachment: ' + d);
}
@@ -233,22 +271,22 @@
</td>
</tr>
</table>
@if (canAddAttachments)
{
<div id="dialogUpload" title="Upload Attachment">
<div id="silverlightHostUploadAttachment">
</div>
</div>
}
@if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
<div id="dialogRemoveAttachment" title="Remove this Attachment?">
<p>
<i class="fa fa-exclamation-triangle fa-lg"></i>&nbsp;Are you sure?
</p>
</div>
}
<script>
$('#UserDetailTabItems').append('<li><a href="#UserDetailTab-Resources" id="UserDetailTab-ResourcesLink">Attachments [@(Model.User.UserAttachments == null ? 0 : Model.User.UserAttachments.Count)]</a></li>');
</script>
</div>
@if (canAddAttachments)
{
<div id="dialogUpload" class="dialog" title="Upload Attachment">
<div id="silverlightHostUploadAttachment">
</div>
</div>
}
@if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
<div id="dialogRemoveAttachment" class="dialog" title="Remove this Attachment?">
<p>
<i class="fa fa-exclamation-triangle fa-lg"></i>&nbsp;Are you sure?
</p>
</div>
}
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34011
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -55,8 +55,9 @@ namespace Disco.Web.Views.User.UserParts
Html.BundleDeferred("~/Style/Shadowbox");
Html.BundleDeferred("~/ClientScripts/Modules/Shadowbox");
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
if (Authorization.Has(Claims.User.Actions.AddAttachments))
if (canAddAttachments)
{
Html.BundleDeferred("~/ClientScripts/Modules/Silverlight");
}
@@ -78,14 +79,14 @@ WriteLiteral(">\r\n <tr>\r\n <td");
WriteLiteral(" id=\"Attachments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 778), Tuple.Create("\"", 853)
WriteAttribute("class", Tuple.Create(" class=\"", 810), Tuple.Create("\"", 885)
#line 20 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 786), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line 21 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 818), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line default
#line hidden
, 786), false)
, 818), false)
);
WriteLiteral(">\r\n <div");
@@ -95,13 +96,13 @@ WriteLiteral(" class=\"attachmentOutput\"");
WriteLiteral(">\r\n");
#line 22 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 23 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 22 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 23 "..\..\Views\User\UserParts\_Resources.cshtml"
if (Model.User.UserAttachments != null)
{
foreach (var ua in Model.User.UserAttachments)
@@ -112,20 +113,20 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 1115), Tuple.Create("\"", 1173)
WriteAttribute("href", Tuple.Create(" href=\"", 1147), Tuple.Create("\"", 1205)
#line 26 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1122), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentDownload(ua.Id))
#line 27 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1154), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentDownload(ua.Id))
#line default
#line hidden
, 1122), false)
, 1154), false)
);
WriteLiteral(" data-attachmentid=\"");
#line 26 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 27 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Id);
@@ -136,7 +137,7 @@ WriteLiteral("\"");
WriteLiteral(" data-mimetype=\"");
#line 26 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 27 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.MimeType);
@@ -148,68 +149,68 @@ WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"icon\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1279), Tuple.Create("\"", 1299)
WriteAttribute("title", Tuple.Create(" title=\"", 1311), Tuple.Create("\"", 1331)
#line 27 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1287), Tuple.Create<System.Object, System.Int32>(ua.Filename
#line 28 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1319), Tuple.Create<System.Object, System.Int32>(ua.Filename
#line default
#line hidden
, 1287), false)
, 1319), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 1366), Tuple.Create("\"", 1426)
WriteAttribute("src", Tuple.Create(" src=\"", 1398), Tuple.Create("\"", 1458)
#line 28 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1372), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentThumbnail(ua.Id))
#line 29 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1404), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.User.AttachmentThumbnail(ua.Id))
#line default
#line hidden
, 1372), false)
, 1404), false)
);
WriteLiteral(" /></span>\r\n <span");
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1489), Tuple.Create("\"", 1509)
WriteAttribute("title", Tuple.Create(" title=\"", 1521), Tuple.Create("\"", 1541)
#line 29 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1497), Tuple.Create<System.Object, System.Int32>(ua.Comments
#line 30 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1529), Tuple.Create<System.Object, System.Int32>(ua.Comments
#line default
#line hidden
, 1497), false)
, 1529), false)
);
WriteLiteral(">\r\n");
#line 30 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 31 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 30 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 31 "..\..\Views\User\UserParts\_Resources.cshtml"
if (!string.IsNullOrEmpty(ua.DocumentTemplateId))
{
#line default
#line hidden
#line 31 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 32 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.DocumentTemplate.Description);
#line default
#line hidden
#line 31 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 32 "..\..\Views\User\UserParts\_Resources.cshtml"
}
else
{
@@ -217,14 +218,14 @@ WriteLiteral(">\r\n");
#line default
#line hidden
#line 33 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 34 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Comments);
#line default
#line hidden
#line 33 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 34 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
@@ -236,8 +237,8 @@ WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 34 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.TechUser.ToString());
#line 35 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.TechUser.ToStringFriendly());
#line default
@@ -245,9 +246,9 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 34 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ua.TechUserId == CurrentUser.UserId))
{
#line 35 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ua.TechUserId == CurrentUser.UserId))
{
#line default
#line hidden
@@ -258,8 +259,8 @@ WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>");
#line 35 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line 36 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
@@ -270,29 +271,29 @@ WriteLiteral(" class=\"timestamp\"");
WriteLiteral(" data-livestamp=\"");
#line 35 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Timestamp.ToUnixEpoc());
#line 36 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Timestamp.ToUnixEpoc());
#line default
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2164), Tuple.Create("\"", 2202)
WriteAttribute("title", Tuple.Create(" title=\"", 2212), Tuple.Create("\"", 2250)
#line 35 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2172), Tuple.Create<System.Object, System.Int32>(ua.Timestamp.ToFullDateTime()
#line 36 "..\..\Views\User\UserParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2220), Tuple.Create<System.Object, System.Int32>(ua.Timestamp.ToFullDateTime()
#line default
#line hidden
, 2172), false)
, 2220), false)
);
WriteLiteral(">");
#line 35 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Timestamp.ToFullDateTime());
#line 36 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(ua.Timestamp.ToFullDateTime());
#line default
@@ -300,7 +301,7 @@ WriteLiteral(">");
WriteLiteral("</span>\r\n </a> \r\n");
#line 37 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 38 "..\..\Views\User\UserParts\_Resources.cshtml"
}
}
@@ -310,13 +311,13 @@ WriteLiteral("</span>\r\n </a> \r\n");
WriteLiteral(" </div>\r\n");
#line 40 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 41 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 40 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 41 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
@@ -342,7 +343,7 @@ WriteLiteral(" title=\"Capture Image\"");
WriteLiteral("></span>\r\n </div>\r\n");
#line 45 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 46 "..\..\Views\User\UserParts\_Resources.cshtml"
}
@@ -358,103 +359,44 @@ WriteLiteral(@">
modal: true
});
$(function () {
$Attachments = $('#Attachments');
$attachmentOutput = $Attachments.find('.attachmentOutput');
var $Attachments = $('#Attachments');
var $attachmentOutput = $Attachments.find('.attachmentOutput');
var $dialogUpload = null;
var $dialogRemoveAttachment = null;
");
// Connect to Hub
var hub = $.connection.userUpdates;
// Map Functions
hub.client.addAttachment = onAddAttachment;
hub.client.removeAttachment = onRemoveAttachment;
$.connection.hub.qs = { UserId: '");
#line 55 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 65 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Model.User.UserId.Replace(@"\", @"\\"));
#line default
#line hidden
#line 55 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral(@"
//#region Add Attachments
if (!document.DiscoFunctions) {
document.DiscoFunctions = {};
WriteLiteral(@"' };
$.connection.hub.error(onHubError);
// Start Connection
$.connection.hub.start().fail(onHubError);
function onHubError(error) {
alert('Live-update Error: ' + error);
}
document.DiscoFunctions.addAttachment = addAttachment;
$('#dialogUpload').dialog({
autoOpen: false,
draggable: false,
modal: true,
resizable: false,
width: 860,
height: 550,
close: function () {
silverlightUploadAttachment.content.Navigator.Navigate('/Hidden');
}
});
var onLoadNavigation = null;
var isLoaded = null;
Silverlight.createObject(
'");
#line 78 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap);
#line default
#line hidden
WriteLiteral(@"',
$('#silverlightHostUploadAttachment').get(0),
'silverlightUploadAttachment',
{ width: '840px', height: '500px', background: 'white', version: '4.0.60310.0' },
{
onLoad: function () {
if (onLoadNavigation) {
silverlightUploadAttachment.content.Navigator.Navigate(onLoadNavigation);
isLoaded = true;
}
}
},
'UploadUrl=");
#line 90 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)));
#line default
#line hidden
WriteLiteral(@"'
);
$attachmentInput = $Attachments.find('.attachmentInput');
$attachmentInput.find('.photo').click(function () {
showDialog('/WebCam');
});
$attachmentInput.find('.upload').click(function () {
showDialog('/File');
});
silverlightUploadAttachment = $('#silverlightUploadAttachment').get(0);
function showDialog(navigationPath) {
$('#dialogUpload').dialog('open');
if (isLoaded) {
silverlightUploadAttachment.content.Navigator.Navigate(navigationPath);
} else {
onLoadNavigation = navigationPath;
}
};
function addAttachment(id, quick) {
function onAddAttachment(id, quick) {
var data = { id: id };
$.ajax({
url: '");
#line 113 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 78 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.Attachment()));
@@ -469,13 +411,13 @@ WriteLiteral(@"',
");
#line 119 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 84 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 119 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 84 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments)
{
@@ -489,7 +431,7 @@ WriteLiteral("buildAttachment(a, true, quick);");
WriteLiteral("\r\n");
#line 122 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 87 "..\..\Views\User\UserParts\_Resources.cshtml"
}
else if (canRemoveOwnAttachments)
{
@@ -502,7 +444,7 @@ WriteLiteral(" ");
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
#line 125 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 90 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(CurrentUser.UserId);
@@ -513,7 +455,7 @@ WriteLiteral("\'), quick);");
WriteLiteral("\r\n");
#line 126 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 91 "..\..\Views\User\UserParts\_Resources.cshtml"
}
else
{
@@ -528,7 +470,7 @@ WriteLiteral("buildAttachment(a, false, quick);");
WriteLiteral("\r\n");
#line 130 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 95 "..\..\Views\User\UserParts\_Resources.cshtml"
}
@@ -544,37 +486,17 @@ WriteLiteral(@" } else {
});
}
function buildAttachment(a, canRemove, quick) {
var t = '<a><span");
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>';
WriteLiteral(" class=\"icon\"");
var e = $(t);
WriteLiteral("><img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteLiteral(" /></span><span");
WriteLiteral(" class=\"comments\"");
WriteLiteral("></span><span");
WriteLiteral(" class=\"author\"");
WriteLiteral("></span>\';\r\n if (canRemove)\r\n " +
" t += \'<span");
WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>\';\r\n t += \'<span");
WriteLiteral(" class=\"timestamp\"");
WriteLiteral("></span></a>\';\r\n\r\n var e = $(t);\r\n\r\n " +
" e.attr(\'data-attachmentid\', a.Id).attr(\'data-mimetype\', a.MimeType).at" +
"tr(\'href\', \'");
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '");
#line 148 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 113 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentDownload()));
@@ -583,32 +505,118 @@ WriteLiteral("></span></a>\';\r\n\r\n var e = $(t);\r
WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', \'");
#line 149 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 114 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentThumbnail()));
#line default
#line hidden
WriteLiteral(@"/' + a.Id);
e.find('.comments').text(a.Comments);
e.find('.author').text(a.Author);
e.find('.timestamp').text(a.TimestampFull).attr('title', a.TimestampFull).livestamp(a.TimestampUnixEpoc);
if (canRemove)
e.find('.remove').click(removeAttachment);
if (!quick)
e.hide();
$attachmentOutput.append(e);
if (!quick)
e.show('slow');
if (a.MimeType.toLowerCase().indexOf('image/') == 0)
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Comments });
}
WriteLiteral("/\' + a.Id);\r\n e.find(\'.comments\').text(a.Comments);\r\n " +
" e.find(\'.author\').text(a.Author);\r\n " +
" e.find(\'.timestamp\').text(a.TimestampFull).attr(\'title\', a.TimestampFu" +
"ll).livestamp(a.TimestampUnixEpoc);\r\n if (canRemove)\r" +
"\n e.find(\'.remove\').click(removeAttachment);\r\n " +
" if (!quick)\r\n e.hide();\r" +
"\n $attachmentOutput.append(e);\r\n " +
" onUpdate();\r\n if (!quick)\r\n " +
" e.show(\'slow\');\r\n if (a.MimeType.toLower" +
"Case().indexOf(\'image/\') == 0)\r\n e.shadowbox({ ga" +
"llery: \'attachments\', player: \'img\', title: a.Comments });\r\n " +
" }\r\n function onRemoveAttachment(id) {\r\n " +
" var 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 f" +
"unction onUpdate() {\r\n var attachmentCount = $attachm" +
"entOutput.children(\'a\').length;\r\n var tabHeading = \'A" +
"ttachments [\' + attachmentCount + \']\';\r\n $(\'#UserDeta" +
"ilTab-ResourcesLink\').text(tabHeading);\r\n }\r\n\r\n");
#line 148 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 148 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral("\r\n //#region Add Attachments\r\n if (" +
"!document.DiscoFunctions) {\r\n document.DiscoFunctions" +
" = {};\r\n }\r\n document.DiscoFunctio" +
"ns.addAttachment = function (Id) { return; /* Silverlight notification, do nothi" +
"ng use SignalR */ };\r\n\r\n var $attachmentInput = $Attachme" +
"nts.find(\'.attachmentInput\');\r\n $attachmentInput.find(\'.p" +
"hoto\').click(function () {\r\n showDialog(\'/WebCam\');\r\n" +
" });\r\n $attachmentInput.find(\'.upl" +
"oad\').click(function () {\r\n showDialog(\'/File\');\r\n " +
" });\r\n\r\n var silverlightOnLoadNavigat" +
"ion = null;\r\n var silverlightIsLoaded = null;\r\n\r\n " +
" function showDialog(navigationPath) {\r\n " +
" if (!$dialogUpload) {\r\n $dialogUpload = $(\'#di" +
"alogUpload\').dialog({\r\n autoOpen: false,\r\n " +
" draggable: false,\r\n " +
" modal: true,\r\n resizable: false,\r\n " +
" width: 860,\r\n " +
" height: 550,\r\n close: function () {\r\n " +
" var sl = $(\'#silverlightUploadAttachment\').get" +
"(0);\r\n if (sl.content)\r\n " +
" sl.content.Navigator.Navigate(\'/Hidden\');\r\n " +
" }\r\n });\r\n\r\n " +
" Silverlight.createObject(\'");
#line 183 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap);
#line default
#line hidden
WriteLiteral(@"',
$('#silverlightHostUploadAttachment').get(0),
'silverlightUploadAttachment',
{ width: '840px', height: '500px', background: 'white', version: '4.0.60310.0' },
{
onLoad: function () {
if (silverlightOnLoadNavigation) {
$('#silverlightUploadAttachment').get(0).content.Navigator.Navigate(silverlightOnLoadNavigation);
silverlightIsLoaded = true;
}
}
},
'UploadUrl=");
#line 195 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)));
#line default
#line hidden
WriteLiteral(@"');
}
$dialogUpload.dialog('open');
if (silverlightIsLoaded) {
$('#silverlightUploadAttachment').get(0).content.Navigator.Navigate(navigationPath);
} else {
silverlightOnLoadNavigation = navigationPath;
}
};
//#endregion
");
#line 165 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 207 "..\..\Views\User\UserParts\_Resources.cshtml"
}
@@ -617,7 +625,7 @@ WriteLiteral(@"/' + a.Id);
WriteLiteral(" ");
#line 166 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 208 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -628,18 +636,20 @@ WriteLiteral(@"
$attachmentOutput.find('span.remove').click(removeAttachment);
$('#dialogRemoveAttachment').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
function removeAttachment() {
$this = $(this).closest('a');
var data = { id: $this.attr('data-attachmentid') };
var $dialogRemoveAttachment = $('#dialogRemoveAttachment');
if (!$dialogRemoveAttachment) {
$dialogRemoveAttachment = $('#dialogRemoveAttachment').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
}
$dialogRemoveAttachment.dialog(""enable"");
$dialogRemoveAttachment.dialog('option', 'buttons', {
""Remove"": function () {
@@ -649,40 +659,44 @@ WriteLiteral(@"
url: '");
#line 190 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 234 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentRemove()));
#line default
#line hidden
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
" data: data,\r\n succe" +
"ss: function (d) {\r\n if (d == \'OK\') {" +
"\r\n $this.hide(300).delay(300).que" +
"ue(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 " +
" });\r\n " +
" } else {\r\n alert(\'Unable t" +
"o remove attachment: \' + d);\r\n }\r\n " +
" $dialogRemoveAttachment.dialog(\"close\")" +
";\r\n },\r\n " +
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
" alert(\'Unable to remove attachment: \' + textStatus);\r\n " +
" $dialogRemoveAttachment.dialog(\"close\")" +
";\r\n }\r\n " +
" });\r\n },\r\n Cance" +
"l: function () {\r\n $dialogRemoveAttachment.di" +
"alog(\"close\");\r\n }\r\n }" +
");\r\n\r\n $dialogRemoveAttachment.dialog(\'open\');\r\n\r\n " +
" return false;\r\n }\r\n\r\n " +
" //#endregion\r\n ");
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d == 'OK') {
// Do nothing, await SignalR notification
} else {
alert('Unable to remove attachment: ' + d);
}
$dialogRemoveAttachment.dialog(""close"");
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to remove attachment: ' + textStatus);
$dialogRemoveAttachment.dialog(""close"");
}
});
},
Cancel: function () {
$dialogRemoveAttachment.dialog(""close"");
}
});
$dialogRemoveAttachment.dialog('open');
return false;
}
//#endregion
");
#line 224 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 262 "..\..\Views\User\UserParts\_Resources.cshtml"
}
@@ -699,75 +713,11 @@ WriteLiteral(@"
</td>
</tr>
</table>
");
<script>
$('#UserDetailTabItems').append('<li><a href=""#UserDetailTab-Resources"" id=""UserDetailTab-ResourcesLink"">Attachments [");
#line 236 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 236 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"dialogUpload\"");
WriteLiteral(" title=\"Upload Attachment\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"silverlightHostUploadAttachment\"");
WriteLiteral(">\r\n </div>\r\n </div>\r\n");
#line 242 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 243 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"dialogRemoveAttachment\"");
WriteLiteral(" title=\"Remove this Attachment?\"");
WriteLiteral(">\r\n <p>\r\n <i");
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n");
#line 250 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(" <script>\r\n $(\'#UserDetailTabItems\').append(\'<li><a href=\"#UserDetailTa" +
"b-Resources\" id=\"UserDetailTab-ResourcesLink\">Attachments [");
#line 252 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 275 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Model.User.UserAttachments == null ? 0 : Model.User.UserAttachments.Count);
@@ -775,6 +725,63 @@ WriteLiteral(" <script>\r\n $(\'#UserDetailTabItems\').append(\'<li><a
#line hidden
WriteLiteral("]</a></li>\');\r\n </script>\r\n</div>\r\n");
#line 278 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"dialogUpload\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Upload Attachment\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"silverlightHostUploadAttachment\"");
WriteLiteral(">\r\n </div>\r\n </div>\r\n");
#line 284 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
#line 285 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"dialogRemoveAttachment\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Remove this Attachment?\"");
WriteLiteral(">\r\n <p>\r\n <i");
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n");
#line 292 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
}
}
}