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:
@@ -8,8 +8,9 @@
|
||||
|
||||
Html.BundleDeferred("~/Style/Shadowbox");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Shadowbox");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
|
||||
if (Authorization.Has(Claims.Device.Actions.AddAttachments))
|
||||
if (canAddAttachments)
|
||||
{
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Silverlight");
|
||||
}
|
||||
@@ -49,68 +50,30 @@
|
||||
modal: true
|
||||
});
|
||||
$(function () {
|
||||
$Attachments = $('#Attachments');
|
||||
$attachmentOutput = $Attachments.find('.attachmentOutput');
|
||||
var $Attachments = $('#Attachments');
|
||||
var $attachmentOutput = $Attachments.find('.attachmentOutput');
|
||||
|
||||
@if (canAddAttachments)
|
||||
{<text>
|
||||
//#region Add Attachments
|
||||
if (!document.DiscoFunctions) {
|
||||
document.DiscoFunctions = {};
|
||||
var $dialogUpload = null;
|
||||
var $dialogRemoveAttachment = null;
|
||||
|
||||
// Connect to Hub
|
||||
var hub = $.connection.deviceUpdates;
|
||||
|
||||
// Map Functions
|
||||
hub.client.addAttachment = onAddAttachment;
|
||||
hub.client.removeAttachment = onRemoveAttachment;
|
||||
|
||||
$.connection.hub.qs = { DeviceSerialNumber: '@(Model.Device.SerialNumber)' };
|
||||
$.connection.hub.error(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.Device.AttachmentUpload(Model.Device.SerialNumber, 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.Device.Attachment())',
|
||||
@@ -135,10 +98,10 @@
|
||||
alert('Unable to add attachment: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add attachment: ' + textStatus);
|
||||
}
|
||||
});
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add attachment: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function buildAttachment(a, canRemove, quick) {
|
||||
@@ -159,12 +122,90 @@
|
||||
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 + ']';
|
||||
$('#DeviceDetailTab-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.Device.AttachmentUpload(Model.Device.SerialNumber, null)))');
|
||||
}
|
||||
|
||||
$dialogUpload.dialog('open');
|
||||
if (silverlightIsLoaded) {
|
||||
$('#silverlightUploadAttachment').get(0).content.Navigator.Navigate(navigationPath);
|
||||
} else {
|
||||
silverlightOnLoadNavigation = navigationPath;
|
||||
}
|
||||
};
|
||||
|
||||
//#endregion
|
||||
</text>}
|
||||
@if (canRemoveAnyAttachments || canRemoveOwnAttachments)
|
||||
@@ -172,18 +213,20 @@
|
||||
//#region Remove Attachments
|
||||
$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 () {
|
||||
@@ -195,13 +238,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);
|
||||
}
|
||||
@@ -213,7 +250,7 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
"Cancel": function () {
|
||||
Cancel: function () {
|
||||
$dialogRemoveAttachment.dialog("close");
|
||||
}
|
||||
});
|
||||
@@ -225,12 +262,12 @@
|
||||
//#endregion
|
||||
</text>}
|
||||
|
||||
$attachmentOutput.children('a').each(function () {
|
||||
$this = $(this);
|
||||
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
|
||||
$this.shadowbox({ gallery: 'attachments', player: 'img', title: $this.find('.comments').text() });
|
||||
$attachmentOutput.children('a').each(function () {
|
||||
$this = $(this);
|
||||
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
|
||||
$this.shadowbox({ gallery: 'attachments', player: 'img', title: $this.find('.comments').text() });
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -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.Device.DeviceParts
|
||||
|
||||
Html.BundleDeferred("~/Style/Shadowbox");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Shadowbox");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
|
||||
if (Authorization.Has(Claims.Device.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=\"", 796), Tuple.Create("\"", 871)
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 826), Tuple.Create("\"", 901)
|
||||
|
||||
#line 20 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 804), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
|
||||
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 834), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 804), false)
|
||||
, 834), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
@@ -95,13 +96,13 @@ WriteLiteral(" class=\"attachmentOutput\"");
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 22 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 23 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 22 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 23 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
if (Model.Device.DeviceAttachments != null)
|
||||
{
|
||||
foreach (var da in Model.Device.DeviceAttachments)
|
||||
@@ -112,20 +113,20 @@ WriteLiteral(">\r\n");
|
||||
#line hidden
|
||||
WriteLiteral(" <a");
|
||||
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 1141), Tuple.Create("\"", 1201)
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 1171), Tuple.Create("\"", 1231)
|
||||
|
||||
#line 26 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1148), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentDownload(da.Id))
|
||||
#line 27 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1178), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentDownload(da.Id))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 1148), false)
|
||||
, 1178), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" data-attachmentid=\"");
|
||||
|
||||
|
||||
#line 26 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 27 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.Id);
|
||||
|
||||
|
||||
@@ -136,7 +137,7 @@ WriteLiteral("\"");
|
||||
WriteLiteral(" data-mimetype=\"");
|
||||
|
||||
|
||||
#line 26 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 27 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.MimeType);
|
||||
|
||||
|
||||
@@ -148,68 +149,68 @@ WriteLiteral(">\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"icon\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 1307), Tuple.Create("\"", 1327)
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 1337), Tuple.Create("\"", 1357)
|
||||
|
||||
#line 27 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1315), Tuple.Create<System.Object, System.Int32>(da.Filename
|
||||
#line 28 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1345), Tuple.Create<System.Object, System.Int32>(da.Filename
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 1315), false)
|
||||
, 1345), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <img");
|
||||
|
||||
WriteLiteral(" alt=\"Attachment Thumbnail\"");
|
||||
|
||||
WriteAttribute("src", Tuple.Create(" src=\"", 1394), Tuple.Create("\"", 1456)
|
||||
WriteAttribute("src", Tuple.Create(" src=\"", 1424), Tuple.Create("\"", 1486)
|
||||
|
||||
#line 28 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1400), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id))
|
||||
#line 29 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1430), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 1400), false)
|
||||
, 1430), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" /></span>\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"comments\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 1519), Tuple.Create("\"", 1539)
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 1549), Tuple.Create("\"", 1569)
|
||||
|
||||
#line 29 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1527), Tuple.Create<System.Object, System.Int32>(da.Comments
|
||||
#line 30 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1557), Tuple.Create<System.Object, System.Int32>(da.Comments
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 1527), false)
|
||||
, 1557), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 30 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 30 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
if (!string.IsNullOrEmpty(da.DocumentTemplateId))
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 32 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.DocumentTemplate.Description);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 32 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -217,14 +218,14 @@ WriteLiteral(">\r\n");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 33 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 34 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.Comments);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 33 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 34 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
@@ -236,7 +237,7 @@ WriteLiteral(" class=\"author\"");
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 34 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.TechUser.ToString());
|
||||
|
||||
|
||||
@@ -245,7 +246,7 @@ WriteLiteral(">");
|
||||
WriteLiteral("</span>");
|
||||
|
||||
|
||||
#line 34 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && da.TechUserId == CurrentUser.UserId))
|
||||
{
|
||||
|
||||
@@ -258,7 +259,7 @@ WriteLiteral(" class=\"remove fa fa-times-circle\"");
|
||||
WriteLiteral("></span>");
|
||||
|
||||
|
||||
#line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
@@ -267,20 +268,20 @@ WriteLiteral("<span");
|
||||
|
||||
WriteLiteral(" class=\"timestamp\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 2148), Tuple.Create("\"", 2186)
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 2178), Tuple.Create("\"", 2216)
|
||||
|
||||
#line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 2156), Tuple.Create<System.Object, System.Int32>(da.Timestamp.ToFullDateTime()
|
||||
#line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 2186), Tuple.Create<System.Object, System.Int32>(da.Timestamp.ToFullDateTime()
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 2156), false)
|
||||
, 2186), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" data-livestamp=\"");
|
||||
|
||||
|
||||
#line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.Timestamp.ToUnixEpoc());
|
||||
|
||||
|
||||
@@ -291,7 +292,7 @@ WriteLiteral("\"");
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.Timestamp.ToFullDateTime());
|
||||
|
||||
|
||||
@@ -300,7 +301,7 @@ WriteLiteral(">");
|
||||
WriteLiteral("</span>\r\n </a> \r\n");
|
||||
|
||||
|
||||
#line 37 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 38 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,13 +311,13 @@ WriteLiteral("</span>\r\n </a> \r\n");
|
||||
WriteLiteral(" </div>\r\n");
|
||||
|
||||
|
||||
#line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 41 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 41 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
if (canAddAttachments)
|
||||
{
|
||||
|
||||
@@ -342,7 +343,7 @@ WriteLiteral(" title=\"Capture Image\"");
|
||||
WriteLiteral("></span>\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 45 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 46 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -358,106 +359,45 @@ 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.deviceUpdates;
|
||||
|
||||
// Map Functions
|
||||
hub.client.addAttachment = onAddAttachment;
|
||||
hub.client.removeAttachment = onRemoveAttachment;
|
||||
|
||||
$.connection.hub.qs = { DeviceSerialNumber: '");
|
||||
|
||||
|
||||
#line 55 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
|
||||
#line 66 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Model.Device.SerialNumber);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 55 "..\..\Views\Device\DeviceParts\_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 80 "..\..\Views\Device\DeviceParts\_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 92 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, 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 116 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 79 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.Attachment()));
|
||||
|
||||
|
||||
@@ -472,13 +412,13 @@ WriteLiteral(@"',
|
||||
");
|
||||
|
||||
|
||||
#line 122 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 85 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 122 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 85 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
if (canRemoveAnyAttachments)
|
||||
{
|
||||
|
||||
@@ -492,7 +432,7 @@ WriteLiteral("buildAttachment(a, true, quick);");
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 125 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 88 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
else if (canRemoveOwnAttachments)
|
||||
{
|
||||
@@ -505,7 +445,7 @@ WriteLiteral(" ");
|
||||
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
|
||||
|
||||
|
||||
#line 128 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 91 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(CurrentUser.UserId);
|
||||
|
||||
|
||||
@@ -516,7 +456,7 @@ WriteLiteral("\'), quick);");
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 129 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 92 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -531,7 +471,7 @@ WriteLiteral("buildAttachment(a, false, quick);");
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 133 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 96 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -541,44 +481,24 @@ WriteLiteral(@" } else {
|
||||
alert('Unable to add attachment: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add attachment: ' + textStatus);
|
||||
}
|
||||
});
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add attachment: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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 152 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 115 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.AttachmentDownload()));
|
||||
|
||||
|
||||
@@ -587,32 +507,118 @@ WriteLiteral("></span></a>\';\r\n\r\n var e = $(t);\r
|
||||
WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', \'");
|
||||
|
||||
|
||||
#line 153 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 116 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.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\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 " +
|
||||
" function onUpdate() {\r\n var attachmentCount = $attac" +
|
||||
"hmentOutput.children(\'a\').length;\r\n var tabHeading = " +
|
||||
"\'Attachments [\' + attachmentCount + \']\';\r\n $(\'#Device" +
|
||||
"DetailTab-ResourcesLink\').text(tabHeading);\r\n }\r\n\r\n");
|
||||
|
||||
|
||||
#line 151 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 151 "..\..\Views\Device\DeviceParts\_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 186 "..\..\Views\Device\DeviceParts\_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 198 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"');
|
||||
}
|
||||
|
||||
$dialogUpload.dialog('open');
|
||||
if (silverlightIsLoaded) {
|
||||
$('#silverlightUploadAttachment').get(0).content.Navigator.Navigate(navigationPath);
|
||||
} else {
|
||||
silverlightOnLoadNavigation = navigationPath;
|
||||
}
|
||||
};
|
||||
|
||||
//#endregion
|
||||
");
|
||||
|
||||
|
||||
#line 169 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 210 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -621,7 +627,7 @@ WriteLiteral(@"/' + a.Id);
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 170 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 211 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
|
||||
{
|
||||
|
||||
@@ -631,18 +637,20 @@ WriteLiteral(@"
|
||||
//#region Remove Attachments
|
||||
$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 () {
|
||||
@@ -652,52 +660,55 @@ WriteLiteral(@"
|
||||
url: '");
|
||||
|
||||
|
||||
#line 193 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 236 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.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 \"Canc" +
|
||||
"el\": function () {\r\n $dialogRemoveAttachment." +
|
||||
"dialog(\"close\");\r\n }\r\n " +
|
||||
" });\r\n\r\n $dialogRemoveAttachment.dialog(\'open\');\r\n\r\n " +
|
||||
" return false;\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 226 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 263 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"
|
||||
$attachmentOutput.children('a').each(function () {
|
||||
$this = $(this);
|
||||
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
|
||||
$this.shadowbox({ gallery: 'attachments', player: 'img', title: $this.find('.comments').text() });
|
||||
$attachmentOutput.children('a').each(function () {
|
||||
$this = $(this);
|
||||
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
|
||||
$this.shadowbox({ gallery: 'attachments', player: 'img', title: $this.find('.comments').text() });
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -731,7 +742,7 @@ WriteLiteral("></i> Are you sure?\r\n </p>\r\n </div>\r\n <scr
|
||||
"etailTab-ResourcesLink\">Attachments [");
|
||||
|
||||
|
||||
#line 248 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 285 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Model.Device.DeviceAttachments == null ? 0 : Model.Device.DeviceAttachments.Count);
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
@foreach (var jl in Model.Job.JobLogs.OrderBy(m => m.Timestamp))
|
||||
{
|
||||
<div data-logid="@jl.Id">
|
||||
<span class="author">@jl.TechUser.ToString()</span>@if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId == CurrentUser.UserId))
|
||||
<span class="author">@jl.TechUser.ToStringFriendly()</span>@if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId == CurrentUser.UserId))
|
||||
{<text><span class="remove fa fa-times-circle"></span></text>}<span class="timestamp" data-livestamp="@(jl.Timestamp.ToUnixEpoc())" title="@jl.Timestamp.ToFullDateTime()">@jl.Timestamp.ToFullDateTime()</span>
|
||||
<span class="comment">@jl.Comments.ToMultilineJobRefString()</span>
|
||||
</div>
|
||||
@@ -58,7 +58,7 @@
|
||||
{ @ja.DocumentTemplate.Description}
|
||||
else
|
||||
{ @ja.Comments }}
|
||||
</span><span class="author">@ja.TechUser.ToString()</span>@if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ja.TechUserId == CurrentUser.UserId))
|
||||
</span><span class="author">@ja.TechUser.ToStringFriendly()</span>@if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ja.TechUserId == CurrentUser.UserId))
|
||||
{<text><span class="remove fa fa-times-circle"></span></text>}<span class="timestamp" data-livestamp="@(ja.Timestamp.ToUnixEpoc())" title="@ja.Timestamp.ToFullDateTime()">@ja.Timestamp.ToFullDateTime()</span>
|
||||
</a>
|
||||
}
|
||||
@@ -75,7 +75,7 @@
|
||||
</table>
|
||||
@if (canShowLogs && (canRemoveAnyLogs || canRemoveOwnLogs))
|
||||
{
|
||||
<div id="dialogRemoveLog" class="hiddenDialog" title="Remove this Comment?">
|
||||
<div id="dialogRemoveLog" class="dialog" title="Remove this Comment?">
|
||||
<p>
|
||||
<i class="fa fa-exclamation-triangle fa-lg"></i> Are you sure?
|
||||
</p>
|
||||
@@ -83,14 +83,14 @@
|
||||
}
|
||||
@if (canShowAttachments && canAddAttachments)
|
||||
{
|
||||
<div id="dialogUpload" class="hiddenDialog" title="Upload Attachment">
|
||||
<div id="dialogUpload" class="dialog" title="Upload Attachment">
|
||||
<div id="silverlightHostUploadAttachment">
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@if (canShowAttachments && (canRemoveAnyAttachments || canRemoveOwnAttachments))
|
||||
{
|
||||
<div id="dialogRemoveAttachment" class="hiddenDialog" title="Remove this Attachment?">
|
||||
<div id="dialogRemoveAttachment" class="dialog" title="Remove this Attachment?">
|
||||
<p>
|
||||
<i class="fa fa-exclamation-triangle fa-lg"></i> Are you sure?
|
||||
</p>
|
||||
@@ -220,11 +220,10 @@
|
||||
</text>}
|
||||
|
||||
function loadLiveComment(key) {
|
||||
if (key.JobId == jobId) {
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.Job.Comment())',
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.Job.Comment())',
|
||||
dataType: 'json',
|
||||
data: { id: key.Id },
|
||||
data: { id: key },
|
||||
success: function (d) {
|
||||
if (d && d.JobId == jobId) {
|
||||
@if (canRemoveAnyLogs)
|
||||
@@ -241,7 +240,6 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function liveRemoveComment(key) {
|
||||
$CommentOutput.children('div[data-logid="' + key + '"]').slideUp(300).delay(300).queue(function () {
|
||||
var $this = $(this);
|
||||
@@ -430,17 +428,14 @@
|
||||
</text>}
|
||||
|
||||
function addAttachment(key, quick) {
|
||||
|
||||
if (key.JobId == jobId) {
|
||||
var data = { id: key.Id };
|
||||
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.Job.Attachment())',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d.Result == 'OK') {
|
||||
var a = d.Attachment;
|
||||
var data = { id: key };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.Job.Attachment())',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d.Result == 'OK') {
|
||||
var a = d.Attachment;
|
||||
@if (canRemoveAnyAttachments)
|
||||
{
|
||||
<text>buildAttachment(a, true, quick);</text>
|
||||
@@ -457,12 +452,11 @@
|
||||
alert('Unable to add attachment: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add attachment: ' + textStatus);
|
||||
}
|
||||
});
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add attachment: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function buildAttachment(a, canRemove, quick) {
|
||||
if (parseInt(a.ParentId) == jobId) {
|
||||
var t = '<a><span class="icon"><img alt="Attachment Thumbnail" /></span><span class="comments"></span><span class="author"></span>';
|
||||
@@ -482,6 +476,7 @@
|
||||
if (!quick)
|
||||
e.hide();
|
||||
$attachmentOutput.append(e);
|
||||
document.DiscoFunctions.liveAfterUpdate();
|
||||
if (!quick)
|
||||
e.show('slow');
|
||||
if (a.MimeType.toLowerCase().indexOf('image/') == 0)
|
||||
@@ -490,20 +485,17 @@
|
||||
}
|
||||
|
||||
function removeAttachment(key) {
|
||||
if (key.JobId == jobId) {
|
||||
var $element = $attachmentOutput.find('a[data-attachmentid="' + key.Id + '"]');
|
||||
if ($element.length > 0) {
|
||||
$element.hide(300).delay(300).queue(function () {
|
||||
if ($element.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
|
||||
Shadowbox.removeCache(this);
|
||||
$element.remove();
|
||||
});
|
||||
}
|
||||
var $element = $attachmentOutput.find('a[data-attachmentid="' + key + '"]');
|
||||
if ($element.length > 0) {
|
||||
$element.hide(300).delay(300).queue(function () {
|
||||
if ($element.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
|
||||
Shadowbox.removeCache(this);
|
||||
$element.remove();
|
||||
document.DiscoFunctions.liveAfterUpdate();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$attachmentOutput.children('a').each(function () {
|
||||
$this = $(this);
|
||||
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
|
||||
@@ -520,117 +512,47 @@
|
||||
|
||||
</script>
|
||||
}
|
||||
@if (canShowLogs && canShowAttachments)
|
||||
@if (canShowLogs || canShowAttachments)
|
||||
{
|
||||
<script>
|
||||
$(function () {
|
||||
var jobId = parseInt('@(Model.Job.Id)');
|
||||
|
||||
//#region LiveEvents
|
||||
function liveMessageRecieved(d) {
|
||||
if (d) {
|
||||
window.setTimeout(function () {
|
||||
switch (d.EntityTypeName) {
|
||||
case 'JobAttachment':
|
||||
switch (d.EventType) {
|
||||
case 0: // Added
|
||||
document.DiscoFunctions.liveAddAttachment(d.EntityKey, false);
|
||||
break;
|
||||
case 1: // Removed
|
||||
document.DiscoFunctions.liveRemoveAttachment(d.EntityKey);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'JobLog':
|
||||
switch (d.EventType) {
|
||||
case 0: // Added
|
||||
document.DiscoFunctions.liveLoadComment(d.EntityKey);
|
||||
break;
|
||||
case 1: // Removed
|
||||
if (d.EntityKey.JobId == jobId) {
|
||||
document.DiscoFunctions.liveRemoveComment(d.EntityKey.Id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
var liveMessagesConnection = $.connection('@(Url.Content("~/API/Repository/Notifications"))', { addToGroups: 'JobLog,JobAttachment' })
|
||||
liveMessagesConnection.received(liveMessageRecieved);
|
||||
liveMessagesConnection.error(function (e) {
|
||||
if (e)
|
||||
alert('Error: ' + JSON.stringify(e));
|
||||
});
|
||||
liveMessagesConnection.start();
|
||||
//#endregion
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else if (canShowLogs)
|
||||
{
|
||||
<script>
|
||||
$(function () {
|
||||
var jobId = parseInt('@(Model.Job.Id)');
|
||||
var hub = $.connection.jobUpdates;
|
||||
|
||||
//#region LiveEvents
|
||||
function liveMessageRecieved(d) {
|
||||
if (d) {
|
||||
window.setTimeout(function () {
|
||||
switch (d.EventType) {
|
||||
case 0: // Added
|
||||
document.DiscoFunctions.liveLoadComment(d.EntityKey);
|
||||
break;
|
||||
case 1: // Removed
|
||||
if (d.EntityKey.JobId == jobId) {
|
||||
document.DiscoFunctions.liveRemoveComment(d.EntityKey.Id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
var liveMessagesConnection = $.connection('@(Url.Content("~/API/Repository/Notifications"))', { addToGroups: 'JobLog' })
|
||||
liveMessagesConnection.received(liveMessageRecieved);
|
||||
liveMessagesConnection.error(function (e) {
|
||||
if (e)
|
||||
alert('Error: ' + JSON.stringify(e));
|
||||
});
|
||||
liveMessagesConnection.start();
|
||||
//#endregion
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else if (canShowAttachments)
|
||||
{
|
||||
<script>
|
||||
$(function () {
|
||||
var jobId = parseInt('@(Model.Job.Id)');
|
||||
// Map Functions
|
||||
@if (canShowLogs)
|
||||
{<text>
|
||||
hub.client.addLog = document.DiscoFunctions.liveLoadComment;
|
||||
hub.client.removeLog = document.DiscoFunctions.liveRemoveComment;
|
||||
</text>}
|
||||
@if (canShowAttachments)
|
||||
{<text>
|
||||
hub.client.addAttachment = document.DiscoFunctions.liveAddAttachment;
|
||||
hub.client.removeAttachment = document.DiscoFunctions.liveRemoveAttachment;
|
||||
|
||||
//#region LiveEvents
|
||||
function liveMessageRecieved(d) {
|
||||
if (d) {
|
||||
window.setTimeout(function () {
|
||||
switch (d.EventType) {
|
||||
case 0: // Added
|
||||
document.DiscoFunctions.liveAddAttachment(d.EntityKey, false);
|
||||
break;
|
||||
case 1: // Removed
|
||||
document.DiscoFunctions.liveRemoveAttachment(d.EntityKey);
|
||||
break;
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
document.DiscoFunctions.liveAfterUpdate = function () {
|
||||
var tabLink = $('#jobDetailTab-ResourcesLink');
|
||||
var attachmentCount = $('#Attachments').find('.attachmentOutput').children('a').length;
|
||||
|
||||
var tabHeading = tabLink.text();
|
||||
tabHeading = tabHeading.substr(0, tabHeading.indexOf('[') + 1) + attachmentCount + ']';
|
||||
tabLink.text(tabHeading);
|
||||
}
|
||||
var liveMessagesConnection = $.connection('@(Url.Content("~/API/Repository/Notifications"))', { addToGroups: 'JobAttachment' })
|
||||
liveMessagesConnection.received(liveMessageRecieved);
|
||||
liveMessagesConnection.error(function (e) {
|
||||
if (e)
|
||||
alert('Error: ' + JSON.stringify(e));
|
||||
});
|
||||
liveMessagesConnection.start();
|
||||
</text>}
|
||||
|
||||
$.connection.hub.qs = { JobId: jobId };
|
||||
$.connection.hub.error(onHubError);
|
||||
|
||||
// Start Connection
|
||||
$.connection.hub.start().fail(onHubError);
|
||||
|
||||
function onHubError(error) {
|
||||
alert('Live-update Error: ' + error);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
});
|
||||
</script>
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
@@ -164,7 +164,7 @@ WriteLiteral(">");
|
||||
|
||||
|
||||
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(jl.TechUser.ToString());
|
||||
Write(jl.TechUser.ToStringFriendly());
|
||||
|
||||
|
||||
#line default
|
||||
@@ -173,7 +173,7 @@ WriteLiteral("</span>");
|
||||
|
||||
|
||||
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId == CurrentUser.UserId))
|
||||
if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId == CurrentUser.UserId))
|
||||
{
|
||||
|
||||
#line default
|
||||
@@ -205,14 +205,14 @@ WriteLiteral(" data-livestamp=\"");
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 1881), Tuple.Create("\"", 1919)
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 1889), Tuple.Create("\"", 1927)
|
||||
|
||||
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1889), Tuple.Create<System.Object, System.Int32>(jl.Timestamp.ToFullDateTime()
|
||||
, Tuple.Create(Tuple.Create("", 1897), Tuple.Create<System.Object, System.Int32>(jl.Timestamp.ToFullDateTime()
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 1889), false)
|
||||
, 1897), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">");
|
||||
@@ -312,14 +312,14 @@ WriteLiteral(" <td");
|
||||
|
||||
WriteLiteral(" id=\"Attachments\"");
|
||||
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 2624), Tuple.Create("\"", 2699)
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 2632), Tuple.Create("\"", 2707)
|
||||
|
||||
#line 49 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 2632), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
|
||||
, Tuple.Create(Tuple.Create("", 2640), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 2632), false)
|
||||
, 2640), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
@@ -344,14 +344,14 @@ WriteLiteral(">\r\n");
|
||||
#line hidden
|
||||
WriteLiteral(" <a");
|
||||
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 2867), Tuple.Create("\"", 2924)
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 2875), Tuple.Create("\"", 2932)
|
||||
|
||||
#line 53 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 2874), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
|
||||
, Tuple.Create(Tuple.Create("", 2882), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 2874), false)
|
||||
, 2882), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" data-attachmentid=\"");
|
||||
@@ -380,42 +380,42 @@ WriteLiteral(">\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"icon\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 3030), Tuple.Create("\"", 3050)
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 3038), Tuple.Create("\"", 3058)
|
||||
|
||||
#line 54 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 3038), Tuple.Create<System.Object, System.Int32>(ja.Filename
|
||||
, Tuple.Create(Tuple.Create("", 3046), Tuple.Create<System.Object, System.Int32>(ja.Filename
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 3038), false)
|
||||
, 3046), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <img");
|
||||
|
||||
WriteLiteral(" alt=\"Attachment Thumbnail\"");
|
||||
|
||||
WriteAttribute("src", Tuple.Create(" src=\"", 3117), Tuple.Create("\"", 3176)
|
||||
WriteAttribute("src", Tuple.Create(" src=\"", 3125), Tuple.Create("\"", 3184)
|
||||
|
||||
#line 55 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 3123), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
|
||||
, Tuple.Create(Tuple.Create("", 3131), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 3123), false)
|
||||
, 3131), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" /></span>\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"comments\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 3239), Tuple.Create("\"", 3259)
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 3247), Tuple.Create("\"", 3267)
|
||||
|
||||
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 3247), Tuple.Create<System.Object, System.Int32>(ja.Comments
|
||||
, Tuple.Create(Tuple.Create("", 3255), Tuple.Create<System.Object, System.Int32>(ja.Comments
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 3247), false)
|
||||
, 3255), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
@@ -469,7 +469,7 @@ WriteLiteral(">");
|
||||
|
||||
|
||||
#line 61 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(ja.TechUser.ToString());
|
||||
Write(ja.TechUser.ToStringFriendly());
|
||||
|
||||
|
||||
#line default
|
||||
@@ -478,7 +478,7 @@ WriteLiteral("</span>");
|
||||
|
||||
|
||||
#line 61 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ja.TechUserId == CurrentUser.UserId))
|
||||
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && ja.TechUserId == CurrentUser.UserId))
|
||||
{
|
||||
|
||||
#line default
|
||||
@@ -510,14 +510,14 @@ WriteLiteral(" data-livestamp=\"");
|
||||
#line hidden
|
||||
WriteLiteral("\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 3914), Tuple.Create("\"", 3952)
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 3930), Tuple.Create("\"", 3968)
|
||||
|
||||
#line 62 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 3922), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime()
|
||||
, Tuple.Create(Tuple.Create("", 3938), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime()
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 3922), false)
|
||||
, 3938), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">");
|
||||
@@ -602,7 +602,7 @@ WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" id=\"dialogRemoveLog\"");
|
||||
|
||||
WriteLiteral(" class=\"hiddenDialog\"");
|
||||
WriteLiteral(" class=\"dialog\"");
|
||||
|
||||
WriteLiteral(" title=\"Remove this Comment?\"");
|
||||
|
||||
@@ -631,7 +631,7 @@ WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" id=\"dialogUpload\"");
|
||||
|
||||
WriteLiteral(" class=\"hiddenDialog\"");
|
||||
WriteLiteral(" class=\"dialog\"");
|
||||
|
||||
WriteLiteral(" title=\"Upload Attachment\"");
|
||||
|
||||
@@ -660,7 +660,7 @@ WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" id=\"dialogRemoveAttachment\"");
|
||||
|
||||
WriteLiteral(" class=\"hiddenDialog\"");
|
||||
WriteLiteral(" class=\"dialog\"");
|
||||
|
||||
WriteLiteral(" title=\"Remove this Attachment?\"");
|
||||
|
||||
@@ -866,28 +866,28 @@ WriteLiteral(@"',
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n function loadLiveComment(key) {\r\n if (key.JobId == j" +
|
||||
"obId) {\r\n $.ajax({\r\n url: \'");
|
||||
WriteLiteral("\r\n function loadLiveComment(key) {\r\n $.ajax({\r\n " +
|
||||
" url: \'");
|
||||
|
||||
|
||||
#line 225 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Job.Comment()));
|
||||
#line 224 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Job.Comment()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n data: { id" +
|
||||
": key.Id },\r\n success: function (d) {\r\n " +
|
||||
" if (d && d.JobId == jobId) {\r\n");
|
||||
": key },\r\n success: function (d) {\r\n " +
|
||||
" if (d && d.JobId == jobId) {\r\n");
|
||||
|
||||
|
||||
#line 230 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 229 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 230 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 229 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
if (canRemoveAnyLogs)
|
||||
{
|
||||
|
||||
@@ -896,7 +896,7 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
|
||||
WriteLiteral("addComment(d, false, true);");
|
||||
|
||||
|
||||
#line 231 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 230 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
else if (canRemoveOwnLogs)
|
||||
{
|
||||
@@ -906,7 +906,7 @@ WriteLiteral("addComment(d, false, true);");
|
||||
WriteLiteral("addComment(d, false, (d.AuthorId === \'");
|
||||
|
||||
|
||||
#line 233 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 232 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(CurrentUser.UserId);
|
||||
|
||||
|
||||
@@ -915,7 +915,7 @@ WriteLiteral("addComment(d, false, (d.AuthorId === \'");
|
||||
WriteLiteral("\'));");
|
||||
|
||||
|
||||
#line 233 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 232 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -925,7 +925,7 @@ WriteLiteral("\'));");
|
||||
WriteLiteral("addComment(d, false, false);");
|
||||
|
||||
|
||||
#line 235 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 234 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -934,26 +934,25 @@ WriteLiteral("addComment(d, false, false);");
|
||||
WriteLiteral("\r\n }\r\n },\r\n " +
|
||||
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
|
||||
" alert(\'Unable to load live comment \' + id + \': \' + textStatus);\r\n " +
|
||||
" }\r\n });\r\n }\r\n }\r\n " +
|
||||
" function liveRemoveComment(key) {\r\n $CommentOutput.childre" +
|
||||
"n(\'div[data-logid=\"\' + key + \'\"]\').slideUp(300).delay(300).queue(function () {\r\n" +
|
||||
" var $this = $(this);\r\n $this.find(\'.times" +
|
||||
"tamp\').livestamp(\'destroy\');\r\n $this.remove();\r\n " +
|
||||
" });\r\n }\r\n function addComment(c, quick, canRemove) {\r\n " +
|
||||
" var t = \'<div><span class=\"author\" />\';\r\n if (canR" +
|
||||
"emove)\r\n t += \'<span class=\"remove fa fa-times-circle\" />\';\r\n" +
|
||||
" t += \'<span class=\"timestamp\" /><span class=\"comment\" /></div>\';" +
|
||||
"\r\n\r\n var e = $(t);\r\n e.attr(\'data-logid\', c.Id);\r\n" +
|
||||
" e.find(\'.author\').text(c.Author);\r\n e.find(\'.time" +
|
||||
"stamp\').text(c.TimestampFull).attr(\'title\', c.TimestampFull).livestamp(c.Timesta" +
|
||||
"mpUnixEpoc);\r\n if (canRemove)\r\n e.find(\'.remov" +
|
||||
"e\').click(removePost);\r\n var eComment = e.find(\'.comment\').text(c" +
|
||||
".Comments);\r\n var commentHtml = eComment.text().replace(/\\r\\n|\\r|" +
|
||||
"\\n/g, \'<br />\');\r\n commentHtml = commentHtml.replace(/\\#(\\d+)/g, " +
|
||||
"\'<a href=\"");
|
||||
" }\r\n });\r\n }\r\n function" +
|
||||
" liveRemoveComment(key) {\r\n $CommentOutput.children(\'div[data-log" +
|
||||
"id=\"\' + key + \'\"]\').slideUp(300).delay(300).queue(function () {\r\n " +
|
||||
" var $this = $(this);\r\n $this.find(\'.timestamp\').livestam" +
|
||||
"p(\'destroy\');\r\n $this.remove();\r\n });\r\n " +
|
||||
" }\r\n function addComment(c, quick, canRemove) {\r\n " +
|
||||
"var t = \'<div><span class=\"author\" />\';\r\n if (canRemove)\r\n " +
|
||||
" t += \'<span class=\"remove fa fa-times-circle\" />\';\r\n " +
|
||||
" t += \'<span class=\"timestamp\" /><span class=\"comment\" /></div>\';\r\n\r\n " +
|
||||
" var e = $(t);\r\n e.attr(\'data-logid\', c.Id);\r\n " +
|
||||
" e.find(\'.author\').text(c.Author);\r\n e.find(\'.timestamp\').text(c." +
|
||||
"TimestampFull).attr(\'title\', c.TimestampFull).livestamp(c.TimestampUnixEpoc);\r\n " +
|
||||
" if (canRemove)\r\n e.find(\'.remove\').click(remov" +
|
||||
"ePost);\r\n var eComment = e.find(\'.comment\').text(c.Comments);\r\n " +
|
||||
" var commentHtml = eComment.text().replace(/\\r\\n|\\r|\\n/g, \'<br />\')" +
|
||||
";\r\n commentHtml = commentHtml.replace(/\\#(\\d+)/g, \'<a href=\"");
|
||||
|
||||
|
||||
#line 266 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 264 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Url.Action(MVC.Job.Show(null)));
|
||||
|
||||
|
||||
@@ -983,14 +982,14 @@ WriteLiteral(@"?id=$1"">#$1</a>');
|
||||
");
|
||||
|
||||
|
||||
#line 287 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 285 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 288 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 286 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
if (canShowAttachments)
|
||||
{
|
||||
|
||||
@@ -1011,7 +1010,7 @@ WriteLiteral(@" <script>
|
||||
var jobId = parseInt('");
|
||||
|
||||
|
||||
#line 301 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 299 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Model.Job.Id);
|
||||
|
||||
|
||||
@@ -1022,13 +1021,13 @@ WriteLiteral("\');\r\n\r\n //#region Attachments\r\n var $
|
||||
"tput\');\r\n\r\n");
|
||||
|
||||
|
||||
#line 307 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 305 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 307 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 305 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
if (canAddAttachments)
|
||||
{
|
||||
|
||||
@@ -1059,7 +1058,7 @@ WriteLiteral(@"
|
||||
'");
|
||||
|
||||
|
||||
#line 330 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 328 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap);
|
||||
|
||||
|
||||
@@ -1080,7 +1079,7 @@ WriteLiteral(@"',
|
||||
'UploadUrl=");
|
||||
|
||||
|
||||
#line 342 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 340 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)));
|
||||
|
||||
|
||||
@@ -1115,7 +1114,7 @@ WriteLiteral(@"');
|
||||
");
|
||||
|
||||
|
||||
#line 368 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 366 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -1124,13 +1123,13 @@ WriteLiteral(@"');
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 370 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 368 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 370 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 368 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
|
||||
{
|
||||
|
||||
@@ -1165,7 +1164,7 @@ WriteLiteral(@"
|
||||
url: '");
|
||||
|
||||
|
||||
#line 397 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 395 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Job.AttachmentRemove()));
|
||||
|
||||
|
||||
@@ -1193,36 +1192,34 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
|
||||
" }\r\n\r\n //#endregion\r\n\r\n ");
|
||||
|
||||
|
||||
#line 430 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 428 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n function addAttachment(key, quick) {\r\n\r\n if (key.Job" +
|
||||
"Id == jobId) {\r\n var data = { id: key.Id };\r\n\r\n " +
|
||||
" $.ajax({\r\n url: \'");
|
||||
WriteLiteral("\r\n function addAttachment(key, quick) {\r\n var data = { " +
|
||||
"id: key };\r\n $.ajax({\r\n url: \'");
|
||||
|
||||
|
||||
#line 438 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Job.Attachment()));
|
||||
#line 433 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Job.Attachment()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
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" +
|
||||
"");
|
||||
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");
|
||||
|
||||
|
||||
#line 444 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 439 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 444 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 439 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
if (canRemoveAnyAttachments)
|
||||
{
|
||||
|
||||
@@ -1236,7 +1233,7 @@ WriteLiteral("buildAttachment(a, true, quick);");
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 447 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 442 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
else if (canRemoveOwnAttachments)
|
||||
{
|
||||
@@ -1249,7 +1246,7 @@ WriteLiteral(" ");
|
||||
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
|
||||
|
||||
|
||||
#line 450 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 445 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(CurrentUser.UserId);
|
||||
|
||||
|
||||
@@ -1260,7 +1257,7 @@ WriteLiteral("\'), quick);");
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 451 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 446 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1275,7 +1272,7 @@ WriteLiteral("buildAttachment(a, false, quick);");
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 455 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 450 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -1285,12 +1282,11 @@ WriteLiteral(@" } else {
|
||||
alert('Unable to add attachment: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add attachment: ' + textStatus);
|
||||
}
|
||||
});
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add attachment: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function buildAttachment(a, canRemove, quick) {
|
||||
if (parseInt(a.ParentId) == jobId) {
|
||||
var t = '<a><span class=""icon""><img alt=""Attachment Thumbnail"" /></span><span class=""comments""></span><span class=""author""></span>';
|
||||
@@ -1303,7 +1299,7 @@ WriteLiteral(@" } else {
|
||||
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '");
|
||||
|
||||
|
||||
#line 475 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 469 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Job.AttachmentDownload()));
|
||||
|
||||
|
||||
@@ -1312,7 +1308,7 @@ WriteLiteral(@" } else {
|
||||
WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', \'");
|
||||
|
||||
|
||||
#line 476 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 470 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Job.AttachmentThumbnail()));
|
||||
|
||||
|
||||
@@ -1324,36 +1320,36 @@ WriteLiteral("/\' + a.Id);\r\n e.find(\'.comments\').text(a.C
|
||||
"pUnixEpoc);\r\n if (canRemove)\r\n e.find(" +
|
||||
"\'.remove\').click(removeLocalAttachment);\r\n if (!quick)\r\n " +
|
||||
" e.hide();\r\n $attachmentOutput.append(e);\r\n" +
|
||||
" if (!quick)\r\n e.show(\'slow\');\r\n " +
|
||||
" if (a.MimeType.toLowerCase().indexOf(\'image/\') == 0)\r\n " +
|
||||
" e.shadowbox({ gallery: \'attachments\', player: \'img\', title: a.Commen" +
|
||||
"ts });\r\n }\r\n }\r\n\r\n function removeAttachmen" +
|
||||
"t(key) {\r\n if (key.JobId == jobId) {\r\n var $el" +
|
||||
"ement = $attachmentOutput.find(\'a[data-attachmentid=\"\' + key.Id + \'\"]\');\r\n " +
|
||||
" if ($element.length > 0) {\r\n $element.hide(" +
|
||||
"300).delay(300).queue(function () {\r\n if ($element.at" +
|
||||
"tr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
|
||||
" Shadowbox.removeCache(this);\r\n $element.re" +
|
||||
"move();\r\n });\r\n }\r\n }\r\n" +
|
||||
" }\r\n\r\n\r\n\r\n $attachmentOutput.children(\'a\').each(function (" +
|
||||
") {\r\n $this = $(this);\r\n if ($this.attr(\'data-mime" +
|
||||
"type\').toLowerCase().indexOf(\'image/\') == 0)\r\n $this.shadowbo" +
|
||||
"x({ gallery: \'attachments\', player: \'img\', title: $this.find(\'.comments\').text()" +
|
||||
" });\r\n });\r\n\r\n // Add Globally Available Functions\r\n " +
|
||||
" document.DiscoFunctions.liveAddAttachment = addAttachment;\r\n do" +
|
||||
"cument.DiscoFunctions.liveRemoveAttachment = removeAttachment;\r\n\r\n //" +
|
||||
"#endregion\r\n });\r\n\r\n\r\n </script>\r\n");
|
||||
" document.DiscoFunctions.liveAfterUpdate();\r\n " +
|
||||
" if (!quick)\r\n e.show(\'slow\');\r\n if" +
|
||||
" (a.MimeType.toLowerCase().indexOf(\'image/\') == 0)\r\n e.sh" +
|
||||
"adowbox({ gallery: \'attachments\', player: \'img\', title: a.Comments });\r\n " +
|
||||
" }\r\n }\r\n\r\n function removeAttachment(key) {\r\n " +
|
||||
" var $element = $attachmentOutput.find(\'a[data-attachmentid=\"\' + key + " +
|
||||
"\'\"]\');\r\n if ($element.length > 0) {\r\n $element" +
|
||||
".hide(300).delay(300).queue(function () {\r\n if ($element." +
|
||||
"attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
|
||||
" Shadowbox.removeCache(this);\r\n $element.remove()" +
|
||||
";\r\n document.DiscoFunctions.liveAfterUpdate();\r\n " +
|
||||
" });\r\n }\r\n }\r\n\r\n $attachmentOutpu" +
|
||||
"t.children(\'a\').each(function () {\r\n $this = $(this);\r\n " +
|
||||
" if ($this.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
|
||||
" $this.shadowbox({ gallery: \'attachments\', player: \'img\', title:" +
|
||||
" $this.find(\'.comments\').text() });\r\n });\r\n\r\n // Add Globa" +
|
||||
"lly Available Functions\r\n document.DiscoFunctions.liveAddAttachment =" +
|
||||
" addAttachment;\r\n document.DiscoFunctions.liveRemoveAttachment = remo" +
|
||||
"veAttachment;\r\n\r\n //#endregion\r\n });\r\n\r\n\r\n </script>\r\n");
|
||||
|
||||
|
||||
#line 522 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 514 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 523 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
if (canShowLogs && canShowAttachments)
|
||||
#line 515 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
if (canShowLogs || canShowAttachments)
|
||||
{
|
||||
|
||||
|
||||
@@ -1362,171 +1358,80 @@ WriteLiteral("/\' + a.Id);\r\n e.find(\'.comments\').text(a.C
|
||||
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
|
||||
|
||||
|
||||
#line 527 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 519 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Model.Job.Id);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\');\r\n\r\n //#region LiveEvents\r\n function liveMessageRecieved" +
|
||||
"(d) {\r\n if (d) {\r\n window.setTimeout(function " +
|
||||
"() {\r\n switch (d.EntityTypeName) {\r\n " +
|
||||
" case \'JobAttachment\':\r\n switch (d.EventTyp" +
|
||||
"e) {\r\n case 0: // Added\r\n " +
|
||||
" document.DiscoFunctions.liveAddAttachment(d.EntityKey, false" +
|
||||
");\r\n break;\r\n " +
|
||||
" case 1: // Removed\r\n document.Dis" +
|
||||
"coFunctions.liveRemoveAttachment(d.EntityKey);\r\n " +
|
||||
" break;\r\n }\r\n " +
|
||||
" break;\r\n case \'JobLog\':\r\n " +
|
||||
" switch (d.EventType) {\r\n case 0: // Ad" +
|
||||
"ded\r\n document.DiscoFunctions.liveLoadCom" +
|
||||
"ment(d.EntityKey);\r\n break;\r\n " +
|
||||
" case 1: // Removed\r\n " +
|
||||
" if (d.EntityKey.JobId == jobId) {\r\n " +
|
||||
" document.DiscoFunctions.liveRemoveComment(d.EntityKey.Id);\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" }\r\n }, 100);\r\n }\r\n }\r\n" +
|
||||
" var liveMessagesConnection = $.connection(\'");
|
||||
WriteLiteral("\');\r\n\r\n //#region LiveEvents\r\n var hub = $.connection.jobUp" +
|
||||
"dates;\r\n\r\n // Map Functions\r\n");
|
||||
|
||||
|
||||
#line 560 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Url.Content("~/API/Repository/Notifications"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"', { addToGroups: 'JobLog,JobAttachment' })
|
||||
liveMessagesConnection.received(liveMessageRecieved);
|
||||
liveMessagesConnection.error(function (e) {
|
||||
if (e)
|
||||
alert('Error: ' + JSON.stringify(e));
|
||||
});
|
||||
liveMessagesConnection.start();
|
||||
//#endregion
|
||||
});
|
||||
</script>
|
||||
");
|
||||
|
||||
|
||||
#line 570 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
else if (canShowLogs)
|
||||
#line 525 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
if (canShowLogs)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n hub.client.addLog = document.DiscoFunctions.liveLoadComment;\r\n " +
|
||||
" hub.client.removeLog = document.DiscoFunctions.liveRemoveComment;\r\n " +
|
||||
" ");
|
||||
|
||||
|
||||
#line 529 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
|
||||
|
||||
|
||||
#line 575 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Model.Job.Id);
|
||||
|
||||
#line 530 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
if (canShowAttachments)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"');
|
||||
WriteLiteral(@"
|
||||
hub.client.addAttachment = document.DiscoFunctions.liveAddAttachment;
|
||||
hub.client.removeAttachment = document.DiscoFunctions.liveRemoveAttachment;
|
||||
|
||||
//#region LiveEvents
|
||||
function liveMessageRecieved(d) {
|
||||
if (d) {
|
||||
window.setTimeout(function () {
|
||||
switch (d.EventType) {
|
||||
case 0: // Added
|
||||
document.DiscoFunctions.liveLoadComment(d.EntityKey);
|
||||
break;
|
||||
case 1: // Removed
|
||||
if (d.EntityKey.JobId == jobId) {
|
||||
document.DiscoFunctions.liveRemoveComment(d.EntityKey.Id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
document.DiscoFunctions.liveAfterUpdate = function () {
|
||||
var tabLink = $('#jobDetailTab-ResourcesLink');
|
||||
var attachmentCount = $('#Attachments').find('.attachmentOutput').children('a').length;
|
||||
|
||||
var tabHeading = tabLink.text();
|
||||
tabHeading = tabHeading.substr(0, tabHeading.indexOf('[') + 1) + attachmentCount + ']';
|
||||
tabLink.text(tabHeading);
|
||||
}
|
||||
var liveMessagesConnection = $.connection('");
|
||||
|
||||
|
||||
#line 594 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Url.Content("~/API/Repository/Notifications"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"', { addToGroups: 'JobLog' })
|
||||
liveMessagesConnection.received(liveMessageRecieved);
|
||||
liveMessagesConnection.error(function (e) {
|
||||
if (e)
|
||||
alert('Error: ' + JSON.stringify(e));
|
||||
});
|
||||
liveMessagesConnection.start();
|
||||
//#endregion
|
||||
});
|
||||
</script>
|
||||
");
|
||||
|
||||
|
||||
#line 604 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
else if (canShowAttachments)
|
||||
{
|
||||
#line 543 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
|
||||
WriteLiteral(@"
|
||||
$.connection.hub.qs = { JobId: jobId };
|
||||
$.connection.hub.error(onHubError);
|
||||
|
||||
|
||||
#line 609 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Model.Job.Id);
|
||||
// Start Connection
|
||||
$.connection.hub.start().fail(onHubError);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"');
|
||||
|
||||
//#region LiveEvents
|
||||
function liveMessageRecieved(d) {
|
||||
if (d) {
|
||||
window.setTimeout(function () {
|
||||
switch (d.EventType) {
|
||||
case 0: // Added
|
||||
document.DiscoFunctions.liveAddAttachment(d.EntityKey, false);
|
||||
break;
|
||||
case 1: // Removed
|
||||
document.DiscoFunctions.liveRemoveAttachment(d.EntityKey);
|
||||
break;
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
function onHubError(error) {
|
||||
alert('Live-update Error: ' + error);
|
||||
}
|
||||
var liveMessagesConnection = $.connection('");
|
||||
|
||||
|
||||
#line 626 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
Write(Url.Content("~/API/Repository/Notifications"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"', { addToGroups: 'JobAttachment' })
|
||||
liveMessagesConnection.received(liveMessageRecieved);
|
||||
liveMessagesConnection.error(function (e) {
|
||||
if (e)
|
||||
alert('Error: ' + JSON.stringify(e));
|
||||
});
|
||||
liveMessagesConnection.start();
|
||||
//#endregion
|
||||
});
|
||||
</script>
|
||||
");
|
||||
|
||||
|
||||
#line 636 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
#line 558 "..\..\Views\Job\JobParts\Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
@@ -67,19 +67,19 @@
|
||||
<ul id="jobDetailTabItems">
|
||||
@if (Authorization.HasAll(Claims.Job.ShowLogs, Claims.Job.ShowAttachments))
|
||||
{
|
||||
<li><a href="#jobDetailTab-Resources">Log and Attachments [@(Model.Job.JobAttachments.Count)]</a></li>
|
||||
<li><a id="jobDetailTab-ResourcesLink" href="#jobDetailTab-Resources">Log and Attachments [@(Model.Job.JobAttachments.Count)]</a></li>
|
||||
}
|
||||
else if (Authorization.Has(Claims.Job.ShowLogs))
|
||||
{
|
||||
<li><a href="#jobDetailTab-Resources">Log</a></li>
|
||||
<li><a id="jobDetailTab-ResourcesLink" href="#jobDetailTab-Resources">Log</a></li>
|
||||
}
|
||||
else if (Authorization.Has(Claims.Job.ShowLogs))
|
||||
else if (Authorization.Has(Claims.Job.ShowAttachments))
|
||||
{
|
||||
<li><a href="#jobDetailTab-Resources">Attachments [@(Model.Job.JobAttachments.Count)]</a></li>
|
||||
<li><a id="jobDetailTab-ResourcesLink" href="#jobDetailTab-Resources">Attachments [@(Model.Job.JobAttachments.Count)]</a></li>
|
||||
}
|
||||
@if (Authorization.Has(Claims.Job.ShowJobsQueues))
|
||||
{
|
||||
<li><a href="#jobDetailTab-Queues">Queues [@(Model.Job.JobQueues.Count(jq => !jq.RemovedDate.HasValue))]</a></li>
|
||||
<li><a id="jobDetailTab-QueuesLink" href="#jobDetailTab-Queues">Queues [@(Model.Job.JobQueues.Count(jq => !jq.RemovedDate.HasValue))]</a></li>
|
||||
}
|
||||
</ul>
|
||||
@if (Authorization.HasAny(Claims.Job.ShowLogs, Claims.Job.ShowAttachments))
|
||||
|
||||
@@ -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.
|
||||
@@ -267,13 +267,15 @@ WriteLiteral(">\r\n");
|
||||
#line hidden
|
||||
WriteLiteral(" <li><a");
|
||||
|
||||
WriteLiteral(" id=\"jobDetailTab-ResourcesLink\"");
|
||||
|
||||
WriteLiteral(" href=\"#jobDetailTab-Resources\"");
|
||||
|
||||
WriteLiteral(">Log and Attachments [");
|
||||
|
||||
|
||||
#line 70 "..\..\Views\Job\Show.cshtml"
|
||||
Write(Model.Job.JobAttachments.Count);
|
||||
Write(Model.Job.JobAttachments.Count);
|
||||
|
||||
|
||||
#line default
|
||||
@@ -291,6 +293,8 @@ WriteLiteral("]</a></li>\r\n");
|
||||
#line hidden
|
||||
WriteLiteral(" <li><a");
|
||||
|
||||
WriteLiteral(" id=\"jobDetailTab-ResourcesLink\"");
|
||||
|
||||
WriteLiteral(" href=\"#jobDetailTab-Resources\"");
|
||||
|
||||
WriteLiteral(">Log</a></li>\r\n");
|
||||
@@ -298,7 +302,7 @@ WriteLiteral(">Log</a></li>\r\n");
|
||||
|
||||
#line 75 "..\..\Views\Job\Show.cshtml"
|
||||
}
|
||||
else if (Authorization.Has(Claims.Job.ShowLogs))
|
||||
else if (Authorization.Has(Claims.Job.ShowAttachments))
|
||||
{
|
||||
|
||||
|
||||
@@ -306,13 +310,15 @@ WriteLiteral(">Log</a></li>\r\n");
|
||||
#line hidden
|
||||
WriteLiteral(" <li><a");
|
||||
|
||||
WriteLiteral(" id=\"jobDetailTab-ResourcesLink\"");
|
||||
|
||||
WriteLiteral(" href=\"#jobDetailTab-Resources\"");
|
||||
|
||||
WriteLiteral(">Attachments [");
|
||||
|
||||
|
||||
#line 78 "..\..\Views\Job\Show.cshtml"
|
||||
Write(Model.Job.JobAttachments.Count);
|
||||
Write(Model.Job.JobAttachments.Count);
|
||||
|
||||
|
||||
#line default
|
||||
@@ -338,13 +344,15 @@ WriteLiteral(" ");
|
||||
#line hidden
|
||||
WriteLiteral(" <li><a");
|
||||
|
||||
WriteLiteral(" id=\"jobDetailTab-QueuesLink\"");
|
||||
|
||||
WriteLiteral(" href=\"#jobDetailTab-Queues\"");
|
||||
|
||||
WriteLiteral(">Queues [");
|
||||
|
||||
|
||||
#line 82 "..\..\Views\Job\Show.cshtml"
|
||||
Write(Model.Job.JobQueues.Count(jq => !jq.RemovedDate.HasValue));
|
||||
Write(Model.Job.JobQueues.Count(jq => !jq.RemovedDate.HasValue));
|
||||
|
||||
|
||||
#line default
|
||||
|
||||
@@ -3,258 +3,6 @@
|
||||
ViewBag.Title = "Disco Post-Update Configuration";
|
||||
Layout = MVC.Shared.Views._PublicLayout;
|
||||
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
Html.BundleDeferred("~/Style/Config");
|
||||
}
|
||||
<div style="min-height: 300px;">
|
||||
<div id="scheduledTaskStatus" class="form" style="width: 520px;" data-bind="visible: Initialized">
|
||||
<h2 data-bind="text: TaskName"> </h2>
|
||||
<table>
|
||||
<tr data-bind="visible: IsRunning">
|
||||
<th class="process" data-bind="text: CurrentProcess">
|
||||
</th>
|
||||
</tr>
|
||||
<tr data-bind="visible: IsRunning">
|
||||
<td class="description" data-bind="text: CurrentDescription">
|
||||
</td>
|
||||
</tr>
|
||||
<tr data-bind="visible: IsRunning">
|
||||
<td class="progress">
|
||||
<div data-bind="progressValue: Progress">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr data-bind="visible: FinishedTimestamp">
|
||||
<td class="finishedTimestamp">
|
||||
<h3>Finished: <span data-bind="text: FinishedTimestampFormatted"></span>
|
||||
</h3>
|
||||
</td>
|
||||
</tr>
|
||||
<tr data-bind="visible: FinishedTimestamp() && !TaskExceptionMessage()">
|
||||
<td class="finishedMessage" data-bind="css: { finishedRedirect: FinishedUrl }">
|
||||
<span data-bind="text: FinishedMessage"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr data-bind="visible: TaskExceptionMessage">
|
||||
<td class="exception">Last Error:
|
||||
<div class="code" data-bind="text: TaskExceptionMessage">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr data-bind="visible: NextScheduledTimestamp">
|
||||
<td class="nextScheduledTimestamp">Next Scheduled: <span data-bind="text: NextScheduledTimestampFormatted"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
ko.bindingHandlers.progressValue = {
|
||||
init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
var $element = $(element);
|
||||
if (!$element.is('.ui-progressbar'))
|
||||
$element.progressbar();
|
||||
},
|
||||
update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
|
||||
var v = ko.utils.unwrapObservable(valueAccessor());
|
||||
var vInt = parseInt(v);
|
||||
if (vInt >= 0) {
|
||||
$(element).progressbar('option', 'value', vInt);
|
||||
}
|
||||
}
|
||||
};
|
||||
//* http://webcloud.se/log/JavaScript-and-ISO-8601/
|
||||
Date.prototype.setISO8601 = function (string) {
|
||||
var regexp = "([0-9]{4})(-([0-9]{2})(-([0-9]{2})" +
|
||||
"(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?" +
|
||||
"(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?";
|
||||
var d = string.match(new RegExp(regexp));
|
||||
|
||||
var offset = 0;
|
||||
var date = new Date(d[1], 0, 1);
|
||||
|
||||
if (d[3]) { date.setMonth(d[3] - 1); }
|
||||
if (d[5]) { date.setDate(d[5]); }
|
||||
if (d[7]) { date.setHours(d[7]); }
|
||||
if (d[8]) { date.setMinutes(d[8]); }
|
||||
if (d[10]) { date.setSeconds(d[10]); }
|
||||
if (d[12]) { date.setMilliseconds(Number("0." + d[12]) * 1000); }
|
||||
if (d[14]) {
|
||||
offset = (Number(d[16]) * 60) + Number(d[17]);
|
||||
offset *= ((d[15] == '-') ? 1 : -1);
|
||||
}
|
||||
|
||||
offset -= date.getTimezoneOffset();
|
||||
time = (Number(date) + (offset * 60 * 1000));
|
||||
this.setTime(Number(time));
|
||||
return this;
|
||||
}
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var sessionId = '@(Model.SessionId)';
|
||||
var sessionStatusUrl = '@(Url.Action(MVC.API.Logging.ScheduledTaskStatus(Model.SessionId)))';
|
||||
|
||||
// Clear Menu
|
||||
$('#menu').empty();
|
||||
|
||||
var view = $('#scheduledTaskStatus');
|
||||
var vm = null;
|
||||
|
||||
var liveConnection = null;
|
||||
|
||||
var statusViewModel = function (sessionId) {
|
||||
var self = this;
|
||||
|
||||
self.Initialized = ko.observable(false);
|
||||
|
||||
self.TimestampParse = function (timestamp) {
|
||||
if (timestamp) {
|
||||
if (timestamp.indexOf("\/Date(") == 0)
|
||||
return new Date(parseInt(timestamp.substr(6)));
|
||||
else
|
||||
return (new Date()).setISO8601(timestamp);
|
||||
}
|
||||
return new Date();
|
||||
}
|
||||
self.TimestampFormat = function (timestamp) {
|
||||
var addZero = function (v) { v = v + ''; if (v.length == 1) v = '0' + v; return v; }
|
||||
return timestamp.getFullYear() + '/' + addZero((1 + timestamp.getMonth())) + '/' + addZero(timestamp.getDate()) + ' ' + addZero(timestamp.getHours()) + ':' + addZero(timestamp.getMinutes()) + ':' + addZero(timestamp.getSeconds());
|
||||
}
|
||||
|
||||
self.SessionId = sessionId;
|
||||
self.TaskName = ko.observable(null);
|
||||
self.StatusVersion = -1;
|
||||
|
||||
self.Progress = ko.observable(0);
|
||||
self.CurrentProcess = ko.observable(null);
|
||||
self.CurrentDescription = ko.observable(null);
|
||||
|
||||
self.IsRunning = ko.observable(null);
|
||||
|
||||
self.TaskExceptionMessage = ko.observable(null);
|
||||
|
||||
self.FinishedTimestamp = ko.observable(null);
|
||||
self.NextScheduledTimestamp = ko.observable(null)
|
||||
|
||||
self.NextScheduledTimestampFormatted = ko.computed(function () {
|
||||
return self.TimestampFormat(self.TimestampParse(self.NextScheduledTimestamp()));
|
||||
});
|
||||
self.FinishedTimestampFormatted = ko.computed(function () {
|
||||
return self.TimestampFormat(self.TimestampParse(self.FinishedTimestamp()));
|
||||
});
|
||||
|
||||
self.FinishedUrl = ko.observable(null);
|
||||
self.FinishedMessage = ko.observable(null);
|
||||
|
||||
self.Finished = function () {
|
||||
if (self.FinishedTimestamp()) {
|
||||
if (self.FinishedUrl() && !self.TaskExceptionMessage()) {
|
||||
if (self.FinishedMessage())
|
||||
window.setTimeout(function () { window.location.href = self.FinishedUrl(); }, 3000);
|
||||
else
|
||||
window.location.href = self.FinishedUrl();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.Initialize = function (taskStatus) {
|
||||
self.TaskName(taskStatus.TaskName);
|
||||
self.FinishedUrl(taskStatus.FinishedUrl);
|
||||
|
||||
self.Progress(taskStatus.Progress);
|
||||
self.CurrentProcess(taskStatus.CurrentProcess);
|
||||
self.CurrentDescription(taskStatus.CurrentDescription);
|
||||
|
||||
self.IsRunning(taskStatus.IsRunning);
|
||||
|
||||
self.TaskExceptionMessage(taskStatus.TaskExceptionMessage);
|
||||
|
||||
self.FinishedTimestamp(taskStatus.FinishedTimestamp);
|
||||
self.NextScheduledTimestamp(taskStatus.NextScheduledTimestamp);
|
||||
|
||||
self.FinishedMessage(taskStatus.FinishedMessage);
|
||||
|
||||
self.Initialized(true);
|
||||
|
||||
self.Finished();
|
||||
}
|
||||
self.Update = function (taskStatus) {
|
||||
if (!self.Initialized())
|
||||
return self.Initialize(taskStatus);
|
||||
|
||||
if (taskStatus.StatusVersion < self.StatusVersion)
|
||||
return; // Have Newer Status Update
|
||||
self.StatusVersion = taskStatus.StatusVersion;
|
||||
|
||||
if (taskStatus.ChangedProperties) {
|
||||
for (var changedPropertyIndex = 0; changedPropertyIndex < taskStatus.ChangedProperties.length; changedPropertyIndex++) {
|
||||
switch (taskStatus.ChangedProperties[changedPropertyIndex]) {
|
||||
case 'Progress':
|
||||
self.Progress(taskStatus.Progress);
|
||||
break;
|
||||
case 'CurrentProcess':
|
||||
self.CurrentProcess(taskStatus.CurrentProcess);
|
||||
break;
|
||||
case 'CurrentDescription':
|
||||
self.CurrentDescription(taskStatus.CurrentDescription);
|
||||
break;
|
||||
case 'IsRunning':
|
||||
self.IsRunning(taskStatus.IsRunning);
|
||||
break;
|
||||
case 'TaskException':
|
||||
self.TaskExceptionMessage(taskStatus.TaskExceptionMessage);
|
||||
break;
|
||||
case 'NextScheduledTimestamp':
|
||||
self.NextScheduledTimestamp(taskStatus.NextScheduledTimestamp);
|
||||
break;
|
||||
case 'FinishedUrl':
|
||||
self.FinishedUrl(taskStatus.FinishedUrl);
|
||||
break;
|
||||
case 'FinishedMessage':
|
||||
self.FinishedMessage(taskStatus.FinishedMessage);
|
||||
break;
|
||||
case 'FinishedTimestamp':
|
||||
self.FinishedTimestamp(taskStatus.FinishedTimestamp);
|
||||
window.setTimeout(self.Finished, 1);
|
||||
break;
|
||||
default:
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
vm = new statusViewModel(sessionId);
|
||||
ko.applyBindings(vm, view[0]);
|
||||
|
||||
// Start Live Connection
|
||||
updateWithLive();
|
||||
|
||||
function updateWithAjax(onSuccess) {
|
||||
$.ajax({
|
||||
url: sessionStatusUrl,
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
traditional: true,
|
||||
success: update_Received,
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to load Session: ' + errorThrown);
|
||||
}
|
||||
});
|
||||
}
|
||||
function updateWithLive() {
|
||||
liveConnection = $.connection('@(Url.Content("~/API/Logging/TaskStatusNotifications"))', {addToGroups: sessionId});
|
||||
liveConnection.received(update_Received);
|
||||
liveConnection.start(function () {
|
||||
updateWithAjax();
|
||||
});
|
||||
}
|
||||
function update_Received(taskStatus) {
|
||||
vm.Update(taskStatus);
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
@Html.PartialCompiled(typeof(Disco.Web.Areas.Config.Views.Shared.TaskStatus), Model.SessionId)
|
||||
@@ -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.
|
||||
@@ -50,270 +50,20 @@ namespace Disco.Web.Views.Update
|
||||
ViewBag.Title = "Disco Post-Update Configuration";
|
||||
Layout = MVC.Shared.Views._PublicLayout;
|
||||
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
Html.BundleDeferred("~/Style/Config");
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<div");
|
||||
|
||||
WriteLiteral(" style=\"min-height: 300px;\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"scheduledTaskStatus\"");
|
||||
|
||||
WriteLiteral(" class=\"form\"");
|
||||
|
||||
WriteLiteral(" style=\"width: 520px;\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: Initialized\"");
|
||||
|
||||
WriteLiteral(">\r\n <h2");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: TaskName\"");
|
||||
|
||||
WriteLiteral("> </h2>\r\n <table>\r\n <tr");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: IsRunning\"");
|
||||
|
||||
WriteLiteral(">\r\n <th");
|
||||
|
||||
WriteLiteral(" class=\"process\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: CurrentProcess\"");
|
||||
|
||||
WriteLiteral("> \r\n </th>\r\n </tr>\r\n <tr");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: IsRunning\"");
|
||||
|
||||
WriteLiteral(">\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"description\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: CurrentDescription\"");
|
||||
|
||||
WriteLiteral("> \r\n </td>\r\n </tr>\r\n <tr");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: IsRunning\"");
|
||||
|
||||
WriteLiteral(">\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"progress\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" data-bind=\"progressValue: Progress\"");
|
||||
|
||||
WriteLiteral(">\r\n </div>\r\n </td>\r\n </tr>\r\n " +
|
||||
" <tr");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: FinishedTimestamp\"");
|
||||
|
||||
WriteLiteral(">\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"finishedTimestamp\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>Finished: <span");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: FinishedTimestampFormatted\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </h3>\r\n </td>\r\n </tr>\r\n " +
|
||||
" <tr");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: FinishedTimestamp() && !TaskExceptionMessage()\"");
|
||||
|
||||
WriteLiteral(">\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"finishedMessage\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"css: { finishedRedirect: FinishedUrl }\"");
|
||||
|
||||
WriteLiteral(">\r\n <span");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: FinishedMessage\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n <tr");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: TaskExceptionMessage\"");
|
||||
|
||||
WriteLiteral(">\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"exception\"");
|
||||
|
||||
WriteLiteral(">Last Error:\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"code\"");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: TaskExceptionMessage\"");
|
||||
|
||||
WriteLiteral(">\r\n </div>\r\n </td>\r\n </tr>\r\n " +
|
||||
" <tr");
|
||||
|
||||
WriteLiteral(" data-bind=\"visible: NextScheduledTimestamp\"");
|
||||
|
||||
WriteLiteral(">\r\n <td");
|
||||
|
||||
WriteLiteral(" class=\"nextScheduledTimestamp\"");
|
||||
|
||||
WriteLiteral(">Next Scheduled: <span");
|
||||
|
||||
WriteLiteral(" data-bind=\"text: NextScheduledTimestampFormatted\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r" +
|
||||
"\n</div>\r\n<script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(">\r\n ko.bindingHandlers.progressValue = {\r\n init: function (element, val" +
|
||||
"ueAccessor, allBindingsAccessor, viewModel) {\r\n var $element = $(elem" +
|
||||
"ent);\r\n if (!$element.is(\'.ui-progressbar\'))\r\n $elemen" +
|
||||
"t.progressbar();\r\n },\r\n update: function (element, valueAccessor, " +
|
||||
"allBindingsAccessor, viewModel) {\r\n var v = ko.utils.unwrapObservable" +
|
||||
"(valueAccessor());\r\n var vInt = parseInt(v);\r\n if (vInt >=" +
|
||||
" 0) {\r\n $(element).progressbar(\'option\', \'value\', vInt);\r\n " +
|
||||
" }\r\n }\r\n };\r\n //* http://webcloud.se/log/JavaScript-and-ISO-860" +
|
||||
"1/\r\n Date.prototype.setISO8601 = function (string) {\r\n var regexp = \"(" +
|
||||
"[0-9]{4})(-([0-9]{2})(-([0-9]{2})\" +\r\n \"(T([0-9]{2}):([0-9]{2})(:([0-9]{2" +
|
||||
"})(\\.([0-9]+))?)?\" +\r\n \"(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?\";\r\n " +
|
||||
" var d = string.match(new RegExp(regexp));\r\n\r\n var offset = 0;\r\n " +
|
||||
" var date = new Date(d[1], 0, 1);\r\n\r\n if (d[3]) { date.setMonth(d[3] - 1)" +
|
||||
"; }\r\n if (d[5]) { date.setDate(d[5]); }\r\n if (d[7]) { date.setHour" +
|
||||
"s(d[7]); }\r\n if (d[8]) { date.setMinutes(d[8]); }\r\n if (d[10]) { d" +
|
||||
"ate.setSeconds(d[10]); }\r\n if (d[12]) { date.setMilliseconds(Number(\"0.\" " +
|
||||
"+ d[12]) * 1000); }\r\n if (d[14]) {\r\n offset = (Number(d[16]) *" +
|
||||
" 60) + Number(d[17]);\r\n offset *= ((d[15] == \'-\') ? 1 : -1);\r\n " +
|
||||
" }\r\n\r\n offset -= date.getTimezoneOffset();\r\n time = (Number(date) " +
|
||||
"+ (offset * 60 * 1000));\r\n this.setTime(Number(time));\r\n return th" +
|
||||
"is;\r\n }\r\n</script>\r\n<script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(">\r\n $(function () {\r\n var sessionId = \'");
|
||||
WriteLiteral("\r\n");
|
||||
|
||||
|
||||
#line 96 "..\..\Views\Update\Index.cshtml"
|
||||
Write(Model.SessionId);
|
||||
#line 8 "..\..\Views\Update\Index.cshtml"
|
||||
Write(Html.PartialCompiled(typeof(Disco.Web.Areas.Config.Views.Shared.TaskStatus), Model.SessionId));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\';\r\n var sessionStatusUrl = \'");
|
||||
|
||||
|
||||
#line 97 "..\..\Views\Update\Index.cshtml"
|
||||
Write(Url.Action(MVC.API.Logging.ScheduledTaskStatus(Model.SessionId)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\';\r\n\r\n // Clear Menu\r\n $(\'#menu\').empty();\r\n\r\n var view = $(" +
|
||||
"\'#scheduledTaskStatus\');\r\n var vm = null;\r\n\r\n var liveConnection =" +
|
||||
" null;\r\n\r\n var statusViewModel = function (sessionId) {\r\n var " +
|
||||
"self = this;\r\n\r\n self.Initialized = ko.observable(false);\r\n\r\n " +
|
||||
" self.TimestampParse = function (timestamp) {\r\n if (timestamp)" +
|
||||
" {\r\n if (timestamp.indexOf(\"\\/Date(\") == 0)\r\n " +
|
||||
" return new Date(parseInt(timestamp.substr(6)));\r\n els" +
|
||||
"e\r\n return (new Date()).setISO8601(timestamp);\r\n " +
|
||||
" }\r\n return new Date();\r\n }\r\n self.Ti" +
|
||||
"mestampFormat = function (timestamp) {\r\n var addZero = function (" +
|
||||
"v) { v = v + \'\'; if (v.length == 1) v = \'0\' + v; return v; }\r\n re" +
|
||||
"turn timestamp.getFullYear() + \'/\' + addZero((1 + timestamp.getMonth())) + \'/\' +" +
|
||||
" addZero(timestamp.getDate()) + \' \' + addZero(timestamp.getHours()) + \':\' + addZ" +
|
||||
"ero(timestamp.getMinutes()) + \':\' + addZero(timestamp.getSeconds());\r\n " +
|
||||
" }\r\n\r\n self.SessionId = sessionId;\r\n self.TaskName = ko.o" +
|
||||
"bservable(null);\r\n self.StatusVersion = -1;\r\n\r\n self.Progr" +
|
||||
"ess = ko.observable(0);\r\n self.CurrentProcess = ko.observable(null);\r" +
|
||||
"\n self.CurrentDescription = ko.observable(null);\r\n\r\n self." +
|
||||
"IsRunning = ko.observable(null);\r\n\r\n self.TaskExceptionMessage = ko.o" +
|
||||
"bservable(null);\r\n\r\n self.FinishedTimestamp = ko.observable(null);\r\n " +
|
||||
" self.NextScheduledTimestamp = ko.observable(null)\r\n\r\n self" +
|
||||
".NextScheduledTimestampFormatted = ko.computed(function () {\r\n re" +
|
||||
"turn self.TimestampFormat(self.TimestampParse(self.NextScheduledTimestamp()));\r\n" +
|
||||
" });\r\n self.FinishedTimestampFormatted = ko.computed(funct" +
|
||||
"ion () {\r\n return self.TimestampFormat(self.TimestampParse(self.F" +
|
||||
"inishedTimestamp()));\r\n });\r\n\r\n self.FinishedUrl = ko.obse" +
|
||||
"rvable(null);\r\n self.FinishedMessage = ko.observable(null);\r\n\r\n " +
|
||||
" self.Finished = function () {\r\n if (self.FinishedTimestamp(" +
|
||||
")) {\r\n if (self.FinishedUrl() && !self.TaskExceptionMessage()" +
|
||||
") {\r\n if (self.FinishedMessage())\r\n " +
|
||||
" window.setTimeout(function () { window.location.href = self.FinishedUrl();" +
|
||||
" }, 3000);\r\n else\r\n window.loc" +
|
||||
"ation.href = self.FinishedUrl();\r\n }\r\n }\r\n " +
|
||||
" }\r\n\r\n self.Initialize = function (taskStatus) {\r\n " +
|
||||
" self.TaskName(taskStatus.TaskName);\r\n self.FinishedUrl(taskSt" +
|
||||
"atus.FinishedUrl);\r\n\r\n self.Progress(taskStatus.Progress);\r\n " +
|
||||
" self.CurrentProcess(taskStatus.CurrentProcess);\r\n self" +
|
||||
".CurrentDescription(taskStatus.CurrentDescription);\r\n\r\n self.IsRu" +
|
||||
"nning(taskStatus.IsRunning);\r\n\r\n self.TaskExceptionMessage(taskSt" +
|
||||
"atus.TaskExceptionMessage);\r\n\r\n self.FinishedTimestamp(taskStatus" +
|
||||
".FinishedTimestamp);\r\n self.NextScheduledTimestamp(taskStatus.Nex" +
|
||||
"tScheduledTimestamp);\r\n\r\n self.FinishedMessage(taskStatus.Finishe" +
|
||||
"dMessage);\r\n\r\n self.Initialized(true);\r\n\r\n self.Fi" +
|
||||
"nished();\r\n }\r\n self.Update = function (taskStatus) {\r\n " +
|
||||
" if (!self.Initialized())\r\n return self.Initializ" +
|
||||
"e(taskStatus);\r\n\r\n if (taskStatus.StatusVersion < self.StatusVers" +
|
||||
"ion)\r\n return; // Have Newer Status Update\r\n s" +
|
||||
"elf.StatusVersion = taskStatus.StatusVersion;\r\n\r\n if (taskStatus." +
|
||||
"ChangedProperties) {\r\n for (var changedPropertyIndex = 0; cha" +
|
||||
"ngedPropertyIndex < taskStatus.ChangedProperties.length; changedPropertyIndex++)" +
|
||||
" {\r\n switch (taskStatus.ChangedProperties[changedProperty" +
|
||||
"Index]) {\r\n case \'Progress\':\r\n " +
|
||||
" self.Progress(taskStatus.Progress);\r\n br" +
|
||||
"eak;\r\n case \'CurrentProcess\':\r\n " +
|
||||
" self.CurrentProcess(taskStatus.CurrentProcess);\r\n " +
|
||||
" break;\r\n case \'CurrentDescription\':\r\n " +
|
||||
" self.CurrentDescription(taskStatus.CurrentDescription" +
|
||||
");\r\n break;\r\n case \'Is" +
|
||||
"Running\':\r\n self.IsRunning(taskStatus.IsRunning);" +
|
||||
"\r\n break;\r\n case \'Task" +
|
||||
"Exception\':\r\n self.TaskExceptionMessage(taskStatu" +
|
||||
"s.TaskExceptionMessage);\r\n break;\r\n " +
|
||||
" case \'NextScheduledTimestamp\':\r\n se" +
|
||||
"lf.NextScheduledTimestamp(taskStatus.NextScheduledTimestamp);\r\n " +
|
||||
" break;\r\n case \'FinishedUrl\':\r\n " +
|
||||
" self.FinishedUrl(taskStatus.FinishedUrl);\r\n " +
|
||||
" break;\r\n case \'FinishedMessage\':\r\n" +
|
||||
" self.FinishedMessage(taskStatus.FinishedMessage)" +
|
||||
";\r\n break;\r\n case \'Fin" +
|
||||
"ishedTimestamp\':\r\n self.FinishedTimestamp(taskSta" +
|
||||
"tus.FinishedTimestamp);\r\n window.setTimeout(self." +
|
||||
"Finished, 1);\r\n break;\r\n " +
|
||||
" default:\r\n // Ignore\r\n " +
|
||||
"}\r\n }\r\n }\r\n }\r\n }\r\n\r\n " +
|
||||
" vm = new statusViewModel(sessionId);\r\n ko.applyBindings(vm, view[0]);\r\n\r" +
|
||||
"\n // Start Live Connection\r\n updateWithLive();\r\n\r\n function" +
|
||||
" updateWithAjax(onSuccess) {\r\n $.ajax({\r\n url: session" +
|
||||
"StatusUrl,\r\n dataType: \'json\',\r\n type: \'POST\',\r\n " +
|
||||
" traditional: true,\r\n success: update_Received,\r\n " +
|
||||
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
|
||||
" alert(\'Unable to load Session: \' + errorThrown);\r\n }\r\n " +
|
||||
" });\r\n }\r\n function updateWithLive() {\r\n liveConne" +
|
||||
"ction = $.connection(\'");
|
||||
|
||||
|
||||
#line 249 "..\..\Views\Update\Index.cshtml"
|
||||
Write(Url.Content("~/API/Logging/TaskStatusNotifications"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"', {addToGroups: sessionId});
|
||||
liveConnection.received(update_Received);
|
||||
liveConnection.start(function () {
|
||||
updateWithAjax();
|
||||
});
|
||||
}
|
||||
function update_Received(taskStatus) {
|
||||
vm.Update(taskStatus);
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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> 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> 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> 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> Are you sure?\r\n </p>\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 292 "..\..\Views\User\UserParts\_Resources.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user