Update #74: Friendly disconnected messages

When the live connection to the server is interrupted some ui elements
are disabled. If the connection fails (due to errors or failed
reconnection) a dialog instructs the user to check their connection and
refresh the browser. Relates to Device, Job and User pages (logs and
attachments).
This commit is contained in:
Gary Sharp
2014-08-28 14:59:39 +10:00
parent 41e061df54
commit bbe4cccc91
16 changed files with 883 additions and 598 deletions
+9
View File
@@ -357,6 +357,15 @@
background-color: #ededed;
border: 1px solid #cccccc;
}
#deviceShowResources #Attachments div.attachmentInput span.action.disabled {
color: rgba(51, 51, 51, 0.2);
cursor: default;
}
#deviceShowResources #Attachments div.attachmentInput span.action.disabled:hover {
color: rgba(51, 51, 51, 0.2);
background-color: inherit;
border: 1px solid #ffffff;
}
#Devices_Export .Devices_Export_Type_Target {
margin-top: 10px;
display: none;
+11
View File
@@ -330,6 +330,17 @@
background-color: @SubtleColour;
border: 1px solid @SubtleBorderColour;
}
&.disabled {
color: fade(@HeaderBackgroundColour, 20%);
cursor: default;
&:hover {
color: fade(@HeaderBackgroundColour, 20%);
background-color: inherit;
border: 1px solid @white;
}
}
}
}
}
File diff suppressed because one or more lines are too long
+18
View File
@@ -346,6 +346,15 @@
background-color: #ededed;
border: 1px solid #cccccc;
}
#jobShowResources #Comments div.commentInput span.action.disabled {
color: rgba(51, 51, 51, 0.2);
cursor: default;
}
#jobShowResources #Comments div.commentInput span.action.disabled:hover {
color: rgba(51, 51, 51, 0.2);
background-color: inherit;
border: 1px solid #ffffff;
}
#jobShowResources #AttachmentsContainer {
padding: 0;
}
@@ -446,6 +455,15 @@
background-color: #ededed;
border: 1px solid #cccccc;
}
#jobShowResources #Attachments div.attachmentInput span.action.disabled {
color: rgba(51, 51, 51, 0.2);
cursor: default;
}
#jobShowResources #Attachments div.attachmentInput span.action.disabled:hover {
color: rgba(51, 51, 51, 0.2);
background-color: inherit;
border: 1px solid #ffffff;
}
#Job_Show_Job_Actions_AddQueue_Dialog {
height: 400px;
}
+22
View File
@@ -336,6 +336,17 @@
background-color: @SubtleColour;
border: 1px solid @SubtleBorderColour;
}
&.disabled {
color: fade(@HeaderBackgroundColour, 20%);
cursor: default;
&:hover {
color: fade(@HeaderBackgroundColour, 20%);
background-color: inherit;
border: 1px solid @white;
}
}
}
}
}
@@ -452,6 +463,17 @@
background-color: @SubtleColour;
border: 1px solid @SubtleBorderColour;
}
&.disabled {
color: fade(@HeaderBackgroundColour, 20%);
cursor: default;
&:hover {
color: fade(@HeaderBackgroundColour, 20%);
background-color: inherit;
border: 1px solid @white;
}
}
}
}
}
File diff suppressed because one or more lines are too long
+9
View File
@@ -444,6 +444,15 @@
background-color: #ededed;
border: 1px solid #cccccc;
}
#userShowResources #Attachments div.attachmentInput span.action.disabled {
color: rgba(51, 51, 51, 0.2);
cursor: default;
}
#userShowResources #Attachments div.attachmentInput span.action.disabled:hover {
color: rgba(51, 51, 51, 0.2);
background-color: inherit;
border: 1px solid #ffffff;
}
#User_Show_Details_Actions_CreateJob_Dialog #CreateJob_Assignments {
margin-top: 6px;
background-color: #ffffff;
+11
View File
@@ -463,6 +463,17 @@
background-color: @SubtleColour;
border: 1px solid @SubtleBorderColour;
}
&.disabled {
color: fade(@HeaderBackgroundColour, 20%);
cursor: default;
&:hover {
color: fade(@HeaderBackgroundColour, 20%);
background-color: inherit;
border: 1px solid @white;
}
}
}
}
}
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -2406,7 +2406,7 @@
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
<UserProperties BuildVersion_StartDate="2014/6/1" BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" BuildVersion_StartDate="2014/6/1" />
</VisualStudio>
</ProjectExtensions>
<PropertyGroup>
@@ -46,7 +46,7 @@
{
<div class="Disco-AttachmentUpload-Progress"></div>
<div class="attachmentInput clearfix">
<span class="action upload fa fa-upload" title="Attach File"></span><span class="action photo fa fa-camera" title="Capture Image"></span>
<span class="action upload fa fa-upload disabled" title="Attach File"></span><span class="action photo fa fa-camera disabled" title="Capture Image"></span>
</div>
}
<script type="text/javascript">
@@ -69,13 +69,46 @@
hub.client.removeAttachment = onRemoveAttachment;
$.connection.hub.qs = { DeviceSerialNumber: '@(Model.Device.SerialNumber)' };
$.connection.hub.error(onHubError);
$.connection.hub.error(onHubFailed);
$.connection.hub.disconnected(onHubFailed);
$.connection.hub.reconnecting(function () {
$('#AttachmentsContainer').find('span.action').addClass('disabled');
});
$.connection.hub.reconnected(function () {
$('#AttachmentsContainer').find('span.action').removeClass('disabled');
});
// Start Connection
$.connection.hub.start().fail(onHubError);
$.connection.hub.start(function () {
$('#AttachmentsContainer').find('span.action').removeClass('disabled');
}).fail(onHubFailed);
function onHubError(error) {
alert('Live-update Error: ' + error);
function onHubFailed(error) {
// Disable UI
$('#AttachmentsContainer').find('span.action').addClass('disabled');
// Show Dialog Message
if ($('.disconnected-dialog').length == 0) {
$('<div>')
.addClass('dialog disconnected-dialog')
.html('<h3><span class="fa-stack fa-lg"><i class="fa fa-wifi fa-stack-1x"></i><i class="fa fa-ban fa-stack-2x error"></i></span>Disconnected from the Disco ICT Server</h3><div>Please ensure you are connected to the server, then refresh this page to enable features.</div>')
.dialog({
resizable: false,
title: 'Disconnected',
width: 400,
modal: true,
buttons: {
'Refresh Now': function () {
$(this).dialog('option', 'buttons', null);
window.location.href = window.location.href;
},
'Close': function () {
$(this).dialog('destroy');
}
}
});
}
}
function onAddAttachment(id, quick) {
@@ -209,10 +242,16 @@
var $attachmentInput = $Attachments.find('.attachmentInput');
$attachmentInput.find('.photo').click(function () {
attachmentUploader.uploadImage();
if ($(this).hasClass('disabled'))
alert('Disconnected from the Disco ICT Server, please refresh this page and try again');
else
attachmentUploader.uploadImage();
});
$attachmentInput.find('.upload').click(function () {
attachmentUploader.uploadFiles();
if ($(this).hasClass('disabled'))
alert('Disconnected from the Disco ICT Server, please refresh this page and try again');
else
attachmentUploader.uploadFiles();
});
var resourcesTab;
@@ -345,13 +345,13 @@ WriteLiteral(" class=\"attachmentInput clearfix\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"action upload fa fa-upload\"");
WriteLiteral(" class=\"action upload fa fa-upload disabled\"");
WriteLiteral(" title=\"Attach File\"");
WriteLiteral("></span><span");
WriteLiteral(" class=\"action photo fa fa-camera\"");
WriteLiteral(" class=\"action photo fa fa-camera disabled\"");
WriteLiteral(" title=\"Capture Image\"");
@@ -396,23 +396,45 @@ WriteLiteral(@">
#line default
#line hidden
WriteLiteral(@"' };
$.connection.hub.error(onHubError);
// Start Connection
$.connection.hub.start().fail(onHubError);
function onHubError(error) {
alert('Live-update Error: ' + error);
}
function onAddAttachment(id, quick) {
var data = { id: id };
$.ajax({
url: '");
WriteLiteral("\' };\r\n $.connection.hub.error(onHubFailed);\r\n " +
" $.connection.hub.disconnected(onHubFailed);\r\n\r\n " +
" $.connection.hub.reconnecting(function () {\r\n " +
" $(\'#AttachmentsContainer\').find(\'span.action\').addClass(\'disabled\');\r" +
"\n });\r\n $.connection.hub.r" +
"econnected(function () {\r\n $(\'#AttachmentsContain" +
"er\').find(\'span.action\').removeClass(\'disabled\');\r\n }" +
");\r\n\r\n // Start Connection\r\n " +
" $.connection.hub.start(function () {\r\n $(\'#Att" +
"achmentsContainer\').find(\'span.action\').removeClass(\'disabled\');\r\n " +
" }).fail(onHubFailed);\r\n\r\n function onHu" +
"bFailed(error) {\r\n // Disable UI\r\n " +
" $(\'#AttachmentsContainer\').find(\'span.action\').addClass(\'disabl" +
"ed\');\r\n\r\n // Show Dialog Message\r\n " +
" if ($(\'.disconnected-dialog\').length == 0) {\r\n " +
" $(\'<div>\')\r\n .addClass" +
"(\'dialog disconnected-dialog\')\r\n .html(\'<" +
"h3><span class=\"fa-stack fa-lg\"><i class=\"fa fa-wifi fa-stack-1x\"></i><i class=\"" +
"fa fa-ban fa-stack-2x error\"></i></span>Disconnected from the Disco ICT Server</" +
"h3><div>Please ensure you are connected to the server, then refresh this page to" +
" enable features.</div>\')\r\n .dialog({\r\n " +
" resizable: false,\r\n " +
" title: \'Disconnected\',\r\n " +
" width: 400,\r\n modal: tru" +
"e,\r\n buttons: {\r\n " +
" \'Refresh Now\': function () {\r\n " +
" $(this).dialog(\'option\', \'buttons\', null);\r\n " +
" window.location.href = window.loca" +
"tion.href;\r\n },\r\n " +
" \'Close\': function () {\r\n " +
" $(this).dialog(\'destroy\');\r\n " +
" }\r\n }\r\n " +
" });\r\n }\r\n " +
" }\r\n\r\n function onAddAttachment(" +
"id, quick) {\r\n var data = { id: id };\r\n " +
" $.ajax({\r\n url: \'");
#line 84 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 117 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.Attachment()));
@@ -427,13 +449,13 @@ WriteLiteral(@"',
");
#line 90 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 123 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line default
#line hidden
#line 90 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 123 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canRemoveAnyAttachments)
{
@@ -447,7 +469,7 @@ WriteLiteral("buildAttachment(a, true, quick);");
WriteLiteral("\r\n");
#line 93 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 126 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
else if (canRemoveOwnAttachments)
{
@@ -460,7 +482,7 @@ WriteLiteral(" ");
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
#line 96 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 129 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(CurrentUser.UserId);
@@ -471,7 +493,7 @@ WriteLiteral("\'), quick);");
WriteLiteral("\r\n");
#line 97 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 130 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
else
{
@@ -486,7 +508,7 @@ WriteLiteral("buildAttachment(a, false, quick);");
WriteLiteral("\r\n");
#line 101 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 134 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
@@ -513,7 +535,7 @@ WriteLiteral(@" } else {
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '");
#line 120 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 153 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentDownload()));
@@ -545,7 +567,7 @@ WriteLiteral(@"/' + a.Id);
img.attr('src', '");
#line 143 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 176 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentThumbnail()));
@@ -596,13 +618,13 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n
" }\r\n\r\n");
#line 202 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 235 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line default
#line hidden
#line 202 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 235 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canAddAttachments)
{
@@ -613,7 +635,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
" \'");
#line 206 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 239 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)));
@@ -623,26 +645,32 @@ WriteLiteral("\',\r\n $Attachments.find(\'.Disco-Atta
"rget\'),\r\n $Attachments.find(\'.Disco-AttachmentUpload-" +
"Progress\'));\r\n\r\n var $attachmentInput = $Attachments." +
"find(\'.attachmentInput\');\r\n $attachmentInput.find(\'.p" +
"hoto\').click(function () {\r\n attachmentUploader.u" +
"ploadImage();\r\n });\r\n $att" +
"achmentInput.find(\'.upload\').click(function () {\r\n " +
" attachmentUploader.uploadFiles();\r\n });\r\n\r\n " +
" var resourcesTab;\r\n $(document).o" +
"n(\'dragover\', function () {\r\n if (!resourcesTab) " +
"{\r\n var tabs = $Attachments.closest(\'.ui-tabs" +
"\');\r\n resourcesTab = {\r\n " +
" tabs: tabs,\r\n resource" +
"sIndex: tabs.children(\'ul.ui-tabs-nav\').find(\'a[href=\"#DeviceDetailTab-Resources" +
"\"]\').closest(\'li\').index()\r\n };\r\n " +
" }\r\n var selectedIndex = resou" +
"rcesTab.tabs.tabs(\'option\', \'active\');\r\n if (reso" +
"urcesTab.resourcesIndex !== selectedIndex)\r\n " +
"resourcesTab.tabs.tabs(\'option\', \'active\', resourcesTab.resourcesIndex);\r\n " +
" });\r\n //#endregion\r\n " +
" ");
"hoto\').click(function () {\r\n if ($(this).hasClass" +
"(\'disabled\'))\r\n alert(\'Disconnected from the " +
"Disco ICT Server, please refresh this page and try again\');\r\n " +
" else\r\n attachmentUploader.upload" +
"Image();\r\n });\r\n $attachme" +
"ntInput.find(\'.upload\').click(function () {\r\n if " +
"($(this).hasClass(\'disabled\'))\r\n alert(\'Disco" +
"nnected from the Disco ICT Server, please refresh this page and try again\');\r\n " +
" else\r\n attachme" +
"ntUploader.uploadFiles();\r\n });\r\n\r\n " +
" var resourcesTab;\r\n $(document).on(\'dragove" +
"r\', function () {\r\n if (!resourcesTab) {\r\n " +
" var tabs = $Attachments.closest(\'.ui-tabs\');\r\n " +
" resourcesTab = {\r\n " +
" tabs: tabs,\r\n resourcesIndex: ta" +
"bs.children(\'ul.ui-tabs-nav\').find(\'a[href=\"#DeviceDetailTab-Resources\"]\').close" +
"st(\'li\').index()\r\n };\r\n " +
" }\r\n var selectedIndex = resourcesTab.ta" +
"bs.tabs(\'option\', \'active\');\r\n if (resourcesTab.r" +
"esourcesIndex !== selectedIndex)\r\n resourcesT" +
"ab.tabs.tabs(\'option\', \'active\', resourcesTab.resourcesIndex);\r\n " +
" });\r\n //#endregion\r\n " +
" ");
#line 232 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 271 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
@@ -651,7 +679,7 @@ WriteLiteral("\',\r\n $Attachments.find(\'.Disco-Atta
WriteLiteral(" ");
#line 233 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 272 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -684,7 +712,7 @@ WriteLiteral(@"
url: '");
#line 258 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 297 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentRemove()));
@@ -712,7 +740,7 @@ WriteLiteral("\',\r\n dataType: \'jso
"endregion\r\n ");
#line 285 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 324 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
@@ -749,7 +777,7 @@ WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n <scr
"etailTab-ResourcesLink\">Attachments [");
#line 306 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 345 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Model.Device.DeviceAttachments == null ? 0 : Model.Device.DeviceAttachments.Count);
+82 -28
View File
@@ -44,7 +44,7 @@
{
<div class="commentInput clearfix">
<textarea class="commentInput" placeholder="write comment..." accesskey="l"></textarea>
<span class="action post commentInputPost fa fa-comment" title="Post Comment"></span>
<span class="action post commentInputPost fa fa-comment disabled" title="Post Comment"></span>
</div>
}
</div>
@@ -77,7 +77,7 @@
{
<div class="Disco-AttachmentUpload-Progress"></div>
<div class="attachmentInput clearfix">
<span class="action upload fa fa-upload" title="Attach File"></span><span class="action photo fa fa-camera" title="Capture Image"></span>
<span class="action upload fa fa-upload disabled" title="Attach File"></span><span class="action photo fa fa-camera disabled" title="Capture Image"></span>
</div>
}
</div>
@@ -140,29 +140,39 @@
});
function postComment() {
if ($Comments.find('.commentInputPost').hasClass('disabled')) {
alert('Disconnected from the Disco ICT Server, please refresh this page and try again');
return;
}
var comment = $CommentInput.val();
if (comment != '') {
var data = { comment: comment }
$.ajax({
url: '@Url.Action(MVC.API.Job.CommentPost(Model.Job.Id, null))',
dataType: 'json',
data: data,
success: function (d) {
if (d.Result == 'OK') {
// Should be added via Repository Notifications
// addComment(d.Comment, false);
$CommentInput.val('').attr('disabled', false).focus();
} else {
alert('Unable to post comment: ' + d.Result);
$CommentInput.attr('disabled', false);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to post comment: ' + textStatus);
if (comment == '') {
alert('Enter a comment to post');
$CommentInput.focus();
return;
}
var data = { comment: comment }
$.ajax({
url: '@Url.Action(MVC.API.Job.CommentPost(Model.Job.Id, null))',
dataType: 'json',
data: data,
success: function (d) {
if (d.Result == 'OK') {
// Should be added via Repository Notifications
// addComment(d.Comment, false);
$CommentInput.val('').attr('disabled', false).focus();
} else {
alert('Unable to post comment: ' + d.Result);
$CommentInput.attr('disabled', false);
}
});
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to post comment: ' + textStatus);
$CommentInput.attr('disabled', false);
}
});
}
//#endregion
@@ -314,10 +324,16 @@
var $attachmentInput = $Attachments.find('.attachmentInput');
$attachmentInput.find('.photo').click(function () {
attachmentUploader.uploadImage();
if ($(this).hasClass('disabled'))
alert('Disconnected from the Disco ICT Server, please refresh this page and try again');
else
attachmentUploader.uploadImage();
});
$attachmentInput.find('.upload').click(function () {
attachmentUploader.uploadFiles();
if ($(this).hasClass('disabled'))
alert('Disconnected from the Disco ICT Server, please refresh this page and try again');
else
attachmentUploader.uploadFiles();
});
var resourcesTab;
@@ -556,13 +572,51 @@
</text>}
$.connection.hub.qs = { JobId: jobId };
$.connection.hub.error(onHubError);
$.connection.hub.error(onHubFailed);
$.connection.hub.disconnected(onHubFailed);
$.connection.hub.reconnecting(function () {
$('#CommentsContainer').find('span.action').addClass('disabled');
$('#AttachmentsContainer').find('span.action').addClass('disabled');
});
$.connection.hub.reconnected(function () {
$('#CommentsContainer').find('span.action').removeClass('disabled');
$('#AttachmentsContainer').find('span.action').removeClass('disabled');
});
// Start Connection
$.connection.hub.start().fail(onHubError);
$.connection.hub.start(function () {
$('#CommentsContainer').find('span.action').removeClass('disabled');
$('#AttachmentsContainer').find('span.action').removeClass('disabled');
}).fail(onHubFailed);
function onHubError(error) {
alert('Live-update Error: ' + error);
function onHubFailed(error) {
// Disable UI
$('#CommentsContainer').find('textarea.commentInput').attr('readonly', 'readonly');
$('#CommentsContainer').find('span.action').addClass('disabled');
$('#AttachmentsContainer').find('span.action').addClass('disabled');
// Show Dialog Message
if ($('.disconnected-dialog').length == 0) {
$('<div>')
.addClass('dialog disconnected-dialog')
.html('<h3><span class="fa-stack fa-lg"><i class="fa fa-wifi fa-stack-1x"></i><i class="fa fa-ban fa-stack-2x error"></i></span>Disconnected from the Disco ICT Server</h3><div>Please ensure you are connected to the server, then refresh this page to enable features.</div>')
.dialog({
resizable: false,
title: 'Disconnected',
width: 400,
modal: true,
buttons: {
'Refresh Now': function () {
$(this).dialog('option', 'buttons', null);
window.location.href = window.location.href;
},
'Close': function () {
$(this).dialog('destroy');
}
}
});
}
}
//#endregion
@@ -284,7 +284,7 @@ WriteLiteral(" accesskey=\"l\"");
WriteLiteral("></textarea>\r\n <span");
WriteLiteral(" class=\"action post commentInputPost fa fa-comment\"");
WriteLiteral(" class=\"action post commentInputPost fa fa-comment disabled\"");
WriteLiteral(" title=\"Post Comment\"");
@@ -324,14 +324,14 @@ WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"Attachments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 2939), Tuple.Create("\"", 3014)
WriteAttribute("class", Tuple.Create(" class=\"", 2948), Tuple.Create("\"", 3023)
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2947), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
, Tuple.Create(Tuple.Create("", 2956), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line default
#line hidden
, 2947), false)
, 2956), false)
);
WriteLiteral(">\r\n <div");
@@ -361,14 +361,14 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 3351), Tuple.Create("\"", 3408)
WriteAttribute("href", Tuple.Create(" href=\"", 3360), Tuple.Create("\"", 3417)
#line 63 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3358), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
, Tuple.Create(Tuple.Create("", 3367), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
#line default
#line hidden
, 3358), false)
, 3367), false)
);
WriteLiteral(" data-attachmentid=\"");
@@ -397,42 +397,42 @@ WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"icon\"");
WriteAttribute("title", Tuple.Create(" title=\"", 3518), Tuple.Create("\"", 3538)
WriteAttribute("title", Tuple.Create(" title=\"", 3527), Tuple.Create("\"", 3547)
#line 64 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3526), Tuple.Create<System.Object, System.Int32>(ja.Filename
, Tuple.Create(Tuple.Create("", 3535), Tuple.Create<System.Object, System.Int32>(ja.Filename
#line default
#line hidden
, 3526), false)
, 3535), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 3609), Tuple.Create("\"", 3668)
WriteAttribute("src", Tuple.Create(" src=\"", 3618), Tuple.Create("\"", 3677)
#line 65 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3615), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
, Tuple.Create(Tuple.Create("", 3624), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
#line default
#line hidden
, 3615), false)
, 3624), false)
);
WriteLiteral(" /></span>\r\n <span");
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 3735), Tuple.Create("\"", 3755)
WriteAttribute("title", Tuple.Create(" title=\"", 3744), Tuple.Create("\"", 3764)
#line 66 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3743), Tuple.Create<System.Object, System.Int32>(ja.Comments
, Tuple.Create(Tuple.Create("", 3752), Tuple.Create<System.Object, System.Int32>(ja.Comments
#line default
#line hidden
, 3743), false)
, 3752), false)
);
WriteLiteral(">\r\n");
@@ -527,14 +527,14 @@ WriteLiteral(" data-livestamp=\"");
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 4450), Tuple.Create("\"", 4488)
WriteAttribute("title", Tuple.Create(" title=\"", 4459), Tuple.Create("\"", 4497)
#line 72 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 4458), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime()
, Tuple.Create(Tuple.Create("", 4467), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime()
#line default
#line hidden
, 4458), false)
, 4467), false)
);
WriteLiteral(">");
@@ -583,13 +583,13 @@ WriteLiteral(" class=\"attachmentInput clearfix\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"action upload fa fa-upload\"");
WriteLiteral(" class=\"action upload fa fa-upload disabled\"");
WriteLiteral(" title=\"Attach File\"");
WriteLiteral("></span><span");
WriteLiteral(" class=\"action photo fa fa-camera\"");
WriteLiteral(" class=\"action photo fa fa-camera disabled\"");
WriteLiteral(" title=\"Capture Image\"");
@@ -735,45 +735,55 @@ WriteLiteral(@"
});
function postComment() {
if ($Comments.find('.commentInputPost').hasClass('disabled')) {
alert('Disconnected from the Disco ICT Server, please refresh this page and try again');
return;
}
var comment = $CommentInput.val();
if (comment != '') {
var data = { comment: comment }
$.ajax({
url: '");
if (comment == '') {
alert('Enter a comment to post');
$CommentInput.focus();
return;
}
var data = { comment: comment }
$.ajax({
url: '");
#line 147 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.CommentPost(Model.Job.Id, null)));
#line 158 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.CommentPost(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d.Result == 'OK') {
// Should be added via Repository Notifications
// addComment(d.Comment, false);
$CommentInput.val('').attr('disabled', false).focus();
} else {
alert('Unable to post comment: ' + d.Result);
$CommentInput.attr('disabled', false);
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to post comment: ' + textStatus);
dataType: 'json',
data: data,
success: function (d) {
if (d.Result == 'OK') {
// Should be added via Repository Notifications
// addComment(d.Comment, false);
$CommentInput.val('').attr('disabled', false).focus();
} else {
alert('Unable to post comment: ' + d.Result);
$CommentInput.attr('disabled', false);
}
});
}
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Unable to post comment: ' + textStatus);
$CommentInput.attr('disabled', false);
}
});
}
//#endregion
");
#line 169 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 179 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -782,7 +792,7 @@ WriteLiteral(@"',
WriteLiteral(" ");
#line 170 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 180 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs || canRemoveOwnLogs)
{
@@ -816,7 +826,7 @@ WriteLiteral(@"
url: '");
#line 196 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 206 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.CommentRemove()));
@@ -854,7 +864,7 @@ WriteLiteral(@"',
");
#line 225 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 235 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -864,7 +874,7 @@ WriteLiteral("\r\n function loadLiveComment(key) {\r\n
" url: \'");
#line 229 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 239 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.Comment()));
@@ -875,13 +885,13 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
"d.JobId == jobId) {\r\n");
#line 234 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 244 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 234 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 244 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs)
{
@@ -890,7 +900,7 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
WriteLiteral("addComment(d, false, true);");
#line 235 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 245 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else if (canRemoveOwnLogs)
{
@@ -900,7 +910,7 @@ WriteLiteral("addComment(d, false, true);");
WriteLiteral("addComment(d, false, (d.AuthorId === \'");
#line 237 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 247 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(CurrentUser.UserId);
@@ -909,7 +919,7 @@ WriteLiteral("addComment(d, false, (d.AuthorId === \'");
WriteLiteral("\'));");
#line 237 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 247 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else
{
@@ -919,7 +929,7 @@ WriteLiteral("\'));");
WriteLiteral("addComment(d, false, false);");
#line 239 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 249 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -953,14 +963,14 @@ WriteLiteral("\r\n }\r\n },\r\n
"= liveRemoveComment;\r\n //#endregion\r\n });\r\n </script>\r\n");
#line 287 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 297 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 288 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 298 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments)
{
@@ -981,7 +991,7 @@ WriteLiteral(@" <script>
var jobId = parseInt('");
#line 301 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 311 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id);
@@ -992,13 +1002,13 @@ WriteLiteral("\');\r\n\r\n //#region Attachments\r\n var $
"tput\');\r\n\r\n");
#line 307 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 317 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 307 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 317 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canAddAttachments)
{
@@ -1008,42 +1018,36 @@ WriteLiteral("\r\n //#region Add Attachments\r\n var attac
" document.Disco.AttachmentUploader(\r\n \'");
#line 311 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 321 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral(@"',
$Attachments.find('.Disco-AttachmentUpload-DropTarget'),
$Attachments.find('.Disco-AttachmentUpload-Progress'));
var $attachmentInput = $Attachments.find('.attachmentInput');
$attachmentInput.find('.photo').click(function () {
attachmentUploader.uploadImage();
});
$attachmentInput.find('.upload').click(function () {
attachmentUploader.uploadFiles();
});
var resourcesTab;
$(document).on('dragover', function () {
if (!resourcesTab) {
var tabs = $Attachments.closest('.ui-tabs');
resourcesTab = {
tabs: tabs,
resourcesIndex: tabs.children('ul.ui-tabs-nav').find('a[href=""#jobDetailTab-Resources""]').closest('li').index()
};
}
var selectedIndex = resourcesTab.tabs.tabs('option', 'active');
if (resourcesTab.resourcesIndex !== selectedIndex)
resourcesTab.tabs.tabs('option', 'active', resourcesTab.resourcesIndex);
});
//#endregion
");
WriteLiteral("\',\r\n $Attachments.find(\'.Disco-AttachmentUpload-DropTarget\'),\r\n " +
" $Attachments.find(\'.Disco-AttachmentUpload-Progress\'));\r\n\r\n " +
" var $attachmentInput = $Attachments.find(\'.attachmentInput\');\r\n $" +
"attachmentInput.find(\'.photo\').click(function () {\r\n if ($(this)." +
"hasClass(\'disabled\'))\r\n alert(\'Disconnected from the Disco IC" +
"T Server, please refresh this page and try again\');\r\n else\r\n " +
" attachmentUploader.uploadImage();\r\n });\r\n $" +
"attachmentInput.find(\'.upload\').click(function () {\r\n if ($(this)" +
".hasClass(\'disabled\'))\r\n alert(\'Disconnected from the Disco I" +
"CT Server, please refresh this page and try again\');\r\n else\r\n " +
" attachmentUploader.uploadFiles();\r\n });\r\n\r\n " +
" var resourcesTab;\r\n $(document).on(\'dragover\', function () {\r\n " +
" if (!resourcesTab) {\r\n var tabs = $Attachments.clo" +
"sest(\'.ui-tabs\');\r\n resourcesTab = {\r\n " +
" tabs: tabs,\r\n resourcesIndex: tabs.children(\'ul.ui-tabs-" +
"nav\').find(\'a[href=\"#jobDetailTab-Resources\"]\').closest(\'li\').index()\r\n " +
" };\r\n }\r\n var selectedIndex = resourcesT" +
"ab.tabs.tabs(\'option\', \'active\');\r\n if (resourcesTab.resourcesInd" +
"ex !== selectedIndex)\r\n resourcesTab.tabs.tabs(\'option\', \'act" +
"ive\', resourcesTab.resourcesIndex);\r\n });\r\n //#endregion\r\n" +
" ");
#line 337 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 353 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -1052,13 +1056,13 @@ WriteLiteral(@"',
WriteLiteral("\r\n");
#line 339 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 355 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 339 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 355 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -1093,7 +1097,7 @@ WriteLiteral(@"
url: '");
#line 366 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 382 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentRemove()));
@@ -1129,7 +1133,7 @@ WriteLiteral(@"',
");
#line 393 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 409 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -1139,7 +1143,7 @@ WriteLiteral("\r\n function addAttachment(key, quick) {\r\n
"id: key };\r\n $.ajax({\r\n url: \'");
#line 398 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 414 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.Attachment()));
@@ -1150,13 +1154,13 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
"\'OK\') {\r\n var a = d.Attachment;\r\n");
#line 404 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 420 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default
#line hidden
#line 404 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 420 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments)
{
@@ -1170,7 +1174,7 @@ WriteLiteral("buildAttachment(a, true, quick);");
WriteLiteral("\r\n");
#line 407 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 423 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else if (canRemoveOwnAttachments)
{
@@ -1183,7 +1187,7 @@ WriteLiteral(" ");
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
#line 410 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 426 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(CurrentUser.UserId);
@@ -1194,7 +1198,7 @@ WriteLiteral("\'), quick);");
WriteLiteral("\r\n");
#line 411 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 427 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else
{
@@ -1209,7 +1213,7 @@ WriteLiteral("buildAttachment(a, false, quick);");
WriteLiteral("\r\n");
#line 415 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 431 "..\..\Views\Job\JobParts\Resources.cshtml"
}
@@ -1236,7 +1240,7 @@ WriteLiteral(@" } else {
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '");
#line 434 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 450 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentDownload()));
@@ -1268,7 +1272,7 @@ WriteLiteral(@"/' + a.Id);
img.attr('src', '");
#line 457 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 473 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentThumbnail()));
@@ -1315,14 +1319,14 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n };\
"script>\r\n");
#line 527 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 543 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 528 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 544 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs || canShowAttachments)
{
@@ -1332,7 +1336,7 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n };\
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
#line 532 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 548 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id);
@@ -1342,7 +1346,7 @@ WriteLiteral("\');\r\n\r\n //#region LiveEvents\r\n var hu
"dates;\r\n\r\n // Map Functions\r\n");
#line 538 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 554 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs)
{
@@ -1353,14 +1357,14 @@ WriteLiteral("\r\n hub.client.addLog = document.DiscoFunctions.liveLo
" ");
#line 542 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 558 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
#line 543 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 559 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowAttachments)
{
@@ -1381,30 +1385,48 @@ WriteLiteral(@"
");
#line 556 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 572 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(@"
$.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>
");
WriteLiteral("\r\n $.connection.hub.qs = { JobId: jobId };\r\n $.connection.h" +
"ub.error(onHubFailed);\r\n $.connection.hub.disconnected(onHubFailed);\r" +
"\n\r\n $.connection.hub.reconnecting(function () {\r\n $(\'#" +
"CommentsContainer\').find(\'span.action\').addClass(\'disabled\');\r\n $" +
"(\'#AttachmentsContainer\').find(\'span.action\').addClass(\'disabled\');\r\n " +
" });\r\n $.connection.hub.reconnected(function () {\r\n $(" +
"\'#CommentsContainer\').find(\'span.action\').removeClass(\'disabled\');\r\n " +
" $(\'#AttachmentsContainer\').find(\'span.action\').removeClass(\'disabled\');\r\n " +
" });\r\n\r\n // Start Connection\r\n $.connection.hub.st" +
"art(function () {\r\n $(\'#CommentsContainer\').find(\'span.action\').r" +
"emoveClass(\'disabled\');\r\n $(\'#AttachmentsContainer\').find(\'span.a" +
"ction\').removeClass(\'disabled\');\r\n }).fail(onHubFailed);\r\n\r\n " +
" function onHubFailed(error) {\r\n // Disable UI\r\n " +
" $(\'#CommentsContainer\').find(\'textarea.commentInput\').attr(\'readonly\', \'readonl" +
"y\');\r\n $(\'#CommentsContainer\').find(\'span.action\').addClass(\'disa" +
"bled\');\r\n $(\'#AttachmentsContainer\').find(\'span.action\').addClass" +
"(\'disabled\');\r\n\r\n // Show Dialog Message\r\n if ($(\'" +
".disconnected-dialog\').length == 0) {\r\n $(\'<div>\')\r\n " +
" .addClass(\'dialog disconnected-dialog\')\r\n " +
".html(\'<h3><span class=\"fa-stack fa-lg\"><i class=\"fa fa-wifi fa-stack-1x\"></i><i" +
" class=\"fa fa-ban fa-stack-2x error\"></i></span>Disconnected from the Disco ICT " +
"Server</h3><div>Please ensure you are connected to the server, then refresh this" +
" page to enable features.</div>\')\r\n .dialog({\r\n " +
" resizable: false,\r\n title: \'Disconn" +
"ected\',\r\n width: 400,\r\n mo" +
"dal: true,\r\n buttons: {\r\n " +
" \'Refresh Now\': function () {\r\n $(this).di" +
"alog(\'option\', \'buttons\', null);\r\n window.loc" +
"ation.href = window.location.href;\r\n },\r\n " +
" \'Close\': function () {\r\n " +
" $(this).dialog(\'destroy\');\r\n }\r\n " +
" }\r\n });\r\n }\r\n }\r" +
"\n\r\n //#endregion\r\n });\r\n </script>\r\n");
#line 571 "..\..\Views\Job\JobParts\Resources.cshtml"
#line 625 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
+226 -187
View File
@@ -46,7 +46,7 @@
{
<div class="Disco-AttachmentUpload-Progress"></div>
<div class="attachmentInput clearfix">
<span class="action upload fa fa-upload" title="Attach File"></span><span class="action photo fa fa-camera" title="Capture Image"></span>
<span class="action upload fa fa-upload disabled" title="Attach File"></span><span class="action photo fa fa-camera disabled" title="Capture Image"></span>
</div>
}
<script type="text/javascript">
@@ -67,24 +67,57 @@
hub.client.removeAttachment = onRemoveAttachment;
$.connection.hub.qs = { UserId: '@(Model.User.UserId.Replace(@"\", @"\\"))' };
$.connection.hub.error(onHubError);
$.connection.hub.error(onHubFailed);
$.connection.hub.disconnected(onHubFailed);
// Start Connection
$.connection.hub.start().fail(onHubError);
$.connection.hub.reconnecting(function () {
$('#AttachmentsContainer').find('span.action').addClass('disabled');
});
$.connection.hub.reconnected(function () {
$('#AttachmentsContainer').find('span.action').removeClass('disabled');
});
function onHubError(error) {
alert('Live-update Error: ' + error);
}
// Start Connection
$.connection.hub.start(function () {
$('#AttachmentsContainer').find('span.action').removeClass('disabled');
}).fail(onHubFailed);
function onAddAttachment(id, quick) {
var data = { id: id };
$.ajax({
url: '@Url.Action(MVC.API.User.Attachment())',
dataType: 'json',
data: data,
success: function (d) {
if (d.Result == 'OK') {
var a = d.Attachment;
function onHubFailed(error) {
// Disable UI
$('#AttachmentsContainer').find('span.action').addClass('disabled');
// Show Dialog Message
if ($('.disconnected-dialog').length == 0) {
$('<div>')
.addClass('dialog disconnected-dialog')
.html('<h3><span class="fa-stack fa-lg"><i class="fa fa-wifi fa-stack-1x"></i><i class="fa fa-ban fa-stack-2x error"></i></span>Disconnected from the Disco ICT Server</h3><div>Please ensure you are connected to the server, then refresh this page to enable features.</div>')
.dialog({
resizable: false,
title: 'Disconnected',
width: 400,
modal: true,
buttons: {
'Refresh Now': function () {
$(this).dialog('option', 'buttons', null);
window.location.href = window.location.href;
},
'Close': function () {
$(this).dialog('destroy');
}
}
});
}
}
function onAddAttachment(id, quick) {
var data = { id: id };
$.ajax({
url: '@Url.Action(MVC.API.User.Attachment())',
dataType: 'json',
data: data,
success: function (d) {
if (d.Result == 'OK') {
var a = d.Attachment;
@if (canRemoveAnyAttachments)
{
<text>buildAttachment(a, true, quick);</text>
@@ -97,200 +130,206 @@
{
<text>buildAttachment(a, false, quick);</text>
}
} else {
alert('Unable to add attachment: ' + d.Result);
} 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 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>';
});
}
function buildAttachment(a, canRemove, quick) {
var t = '<a><span class="icon"><img alt="Attachment Thumbnail" /></span><span class="comments"></span><span class="author"></span>';
if (canRemove)
t += '<span class="remove fa fa-times-circle"></span>';
t += '<span class="timestamp"></span></a>';
var e = $(t);
var e = $(t);
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '@(Url.Action(MVC.API.User.AttachmentDownload()))/' + a.Id);
e.find('.comments').text(a.Description);
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);
onUpdate();
if (!quick)
e.show('slow');
if (a.MimeType.toLowerCase().indexOf('image/') == 0)
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description });
else
e.click(onDownload);
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '@(Url.Action(MVC.API.User.AttachmentDownload()))/' + a.Id);
e.find('.comments').text(a.Description);
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);
onUpdate();
if (!quick)
e.show('slow');
if (a.MimeType.toLowerCase().indexOf('image/') == 0)
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description });
else
e.click(onDownload);
// Add Thumbnail
var buildThumbnail = function () {
var retryCount = 0;
var img = e.find('.icon img');
// Add Thumbnail
var buildThumbnail = function () {
var retryCount = 0;
var img = e.find('.icon img');
var setThumbnailUrl = function () {
img.attr('src', '@(Url.Action(MVC.API.User.AttachmentThumbnail()))/' + a.Id + '?v=' + retryCount);
var setThumbnailUrl = function () {
img.attr('src', '@(Url.Action(MVC.API.User.AttachmentThumbnail()))/' + a.Id + '?v=' + retryCount);
};
img.on('error', function () {
img.addClass('loading');
retryCount++;
if (retryCount < 6)
window.setTimeout(setThumbnailUrl, retryCount * 250);
});
img.on('load', function () {
img.removeClass('loading');
});
window.setTimeout(setThumbnailUrl, 100);
};
img.on('error', function () {
img.addClass('loading');
retryCount++;
if (retryCount < 6)
window.setTimeout(setThumbnailUrl, retryCount * 250);
});
img.on('load', function () {
img.removeClass('loading');
});
window.setTimeout(setThumbnailUrl, 100);
};
buildThumbnail();
}
function onDownload() {
var $this = $(this);
var url = $this.attr('href');
if ($.connection && $.connection.hub && $.connection.hub.transport &&
$.connection.hub.transport.name == 'foreverFrame') {
// SignalR active with foreverFrame transport - use popup window
window.open(url, '_blank', 'height=150,width=250,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
} else {
// use iFrame
if (!$attachmentDownloadHost) {
$attachmentDownloadHost = $('<iframe>')
.attr({ 'src': url, 'title': 'Attachment Download Host' })
.addClass('hidden')
.appendTo('body')
.contents();
} else {
$attachmentDownloadHost[0].location.href = url;
}
buildThumbnail();
}
return false;
}
function onRemoveAttachment(id) {
var a = $attachmentOutput.find('a[data-attachmentid=' + id + ']');
a.hide(300).delay(300).queue(function () {
function onDownload() {
var $this = $(this);
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
Shadowbox.removeCache(this);
$this.find('.timestamp').livestamp('destroy');
$this.remove();
onUpdate();
});
}
var url = $this.attr('href');
function onUpdate() {
var attachmentCount = $attachmentOutput.children('a').length;
var tabHeading = 'Attachments [' + attachmentCount + ']';
$('#UserDetailTab-ResourcesLink').text(tabHeading);
}
if ($.connection && $.connection.hub && $.connection.hub.transport &&
$.connection.hub.transport.name == 'foreverFrame') {
// SignalR active with foreverFrame transport - use popup window
window.open(url, '_blank', 'height=150,width=250,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no');
} else {
// use iFrame
if (!$attachmentDownloadHost) {
$attachmentDownloadHost = $('<iframe>')
.attr({ 'src': url, 'title': 'Attachment Download Host' })
.addClass('hidden')
.appendTo('body')
.contents();
} else {
$attachmentDownloadHost[0].location.href = url;
}
}
return false;
}
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
var attachmentUploader = new document.Disco.AttachmentUploader(
'@(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)))',
//#region Add Attachments
var attachmentUploader = new document.Disco.AttachmentUploader(
'@(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)))',
$Attachments.find('.Disco-AttachmentUpload-DropTarget'),
$Attachments.find('.Disco-AttachmentUpload-Progress'));
var $attachmentInput = $Attachments.find('.attachmentInput');
$attachmentInput.find('.photo').click(function () {
attachmentUploader.uploadImage();
});
$attachmentInput.find('.upload').click(function () {
attachmentUploader.uploadFiles();
});
var resourcesTab;
$(document).on('dragover', function () {
if (!resourcesTab) {
var tabs = $Attachments.closest('.ui-tabs');
resourcesTab = {
tabs: tabs,
resourcesIndex: tabs.children('ul.ui-tabs-nav').find('a[href="#UserDetailTab-Resources"]').closest('li').index()
};
}
var selectedIndex = resourcesTab.tabs.tabs('option', 'active');
if (resourcesTab.resourcesIndex !== selectedIndex)
resourcesTab.tabs.tabs('option', 'active', resourcesTab.resourcesIndex);
});
//#endregion
</text>}
@if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{<text>
//#region Remove Attachments
$attachmentOutput.find('span.remove').click(removeAttachment);
function removeAttachment() {
$this = $(this).closest('a');
var data = { id: $this.attr('data-attachmentid') };
if (!$dialogRemoveAttachment) {
$dialogRemoveAttachment = $('#dialogRemoveAttachment').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
}
$dialogRemoveAttachment.dialog("enable");
$dialogRemoveAttachment.dialog('option', 'buttons', {
"Remove": function () {
$dialogRemoveAttachment.dialog("disable");
$dialogRemoveAttachment.dialog("option", "buttons", null);
$.ajax({
url: '@Url.Action(MVC.API.User.AttachmentRemove())',
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");
}
var $attachmentInput = $Attachments.find('.attachmentInput');
$attachmentInput.find('.photo').click(function () {
if ($(this).hasClass('disabled'))
alert('Disconnected from the Disco ICT Server, please refresh this page and try again');
else
attachmentUploader.uploadImage();
});
$attachmentInput.find('.upload').click(function () {
if ($(this).hasClass('disabled'))
alert('Disconnected from the Disco ICT Server, please refresh this page and try again');
else
attachmentUploader.uploadFiles();
});
$dialogRemoveAttachment.dialog('open');
var resourcesTab;
$(document).on('dragover', function () {
if (!resourcesTab) {
var tabs = $Attachments.closest('.ui-tabs');
resourcesTab = {
tabs: tabs,
resourcesIndex: tabs.children('ul.ui-tabs-nav').find('a[href="#UserDetailTab-Resources"]').closest('li').index()
};
}
var selectedIndex = resourcesTab.tabs.tabs('option', 'active');
if (resourcesTab.resourcesIndex !== selectedIndex)
resourcesTab.tabs.tabs('option', 'active', resourcesTab.resourcesIndex);
});
//#endregion
</text>}
@if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{<text>
//#region Remove Attachments
return false;
}
$attachmentOutput.find('span.remove').click(removeAttachment);
//#endregion
function removeAttachment() {
$this = $(this).closest('a');
var data = { id: $this.attr('data-attachmentid') };
if (!$dialogRemoveAttachment) {
$dialogRemoveAttachment = $('#dialogRemoveAttachment').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
}
$dialogRemoveAttachment.dialog("enable");
$dialogRemoveAttachment.dialog('option', 'buttons', {
"Remove": function () {
$dialogRemoveAttachment.dialog("disable");
$dialogRemoveAttachment.dialog("option", "buttons", null);
$.ajax({
url: '@Url.Action(MVC.API.User.AttachmentRemove())',
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
</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() });
else
$this.click(onDownload);
$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() });
else
$this.click(onDownload);
});
});
});
</script>
</div>
</td>
@@ -345,13 +345,13 @@ WriteLiteral(" class=\"attachmentInput clearfix\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"action upload fa fa-upload\"");
WriteLiteral(" class=\"action upload fa fa-upload disabled\"");
WriteLiteral(" title=\"Attach File\"");
WriteLiteral("></span><span");
WriteLiteral(" class=\"action photo fa fa-camera\"");
WriteLiteral(" class=\"action photo fa fa-camera disabled\"");
WriteLiteral(" title=\"Capture Image\"");
@@ -394,44 +394,66 @@ WriteLiteral(@">
#line default
#line hidden
WriteLiteral(@"' };
$.connection.hub.error(onHubError);
// Start Connection
$.connection.hub.start().fail(onHubError);
function onHubError(error) {
alert('Live-update Error: ' + error);
}
function onAddAttachment(id, quick) {
var data = { id: id };
$.ajax({
url: '");
WriteLiteral("\' };\r\n $.connection.hub.error(onHubFailed);\r\n " +
" $.connection.hub.disconnected(onHubFailed);\r\n\r\n " +
" $.connection.hub.reconnecting(function () {\r\n " +
" $(\'#AttachmentsContainer\').find(\'span.action\').addClass(\'disabled\');\r" +
"\n });\r\n $.connection.hub.r" +
"econnected(function () {\r\n $(\'#AttachmentsContain" +
"er\').find(\'span.action\').removeClass(\'disabled\');\r\n }" +
");\r\n\r\n // Start Connection\r\n " +
" $.connection.hub.start(function () {\r\n $(\'#Att" +
"achmentsContainer\').find(\'span.action\').removeClass(\'disabled\');\r\n " +
" }).fail(onHubFailed);\r\n\r\n function onHu" +
"bFailed(error) {\r\n // Disable UI\r\n " +
" $(\'#AttachmentsContainer\').find(\'span.action\').addClass(\'disabl" +
"ed\');\r\n\r\n // Show Dialog Message\r\n " +
" if ($(\'.disconnected-dialog\').length == 0) {\r\n " +
" $(\'<div>\')\r\n .addClass" +
"(\'dialog disconnected-dialog\')\r\n .html(\'<" +
"h3><span class=\"fa-stack fa-lg\"><i class=\"fa fa-wifi fa-stack-1x\"></i><i class=\"" +
"fa fa-ban fa-stack-2x error\"></i></span>Disconnected from the Disco ICT Server</" +
"h3><div>Please ensure you are connected to the server, then refresh this page to" +
" enable features.</div>\')\r\n .dialog({\r\n " +
" resizable: false,\r\n " +
" title: \'Disconnected\',\r\n " +
" width: 400,\r\n modal: tru" +
"e,\r\n buttons: {\r\n " +
" \'Refresh Now\': function () {\r\n " +
" $(this).dialog(\'option\', \'buttons\', null);\r\n " +
" window.location.href = window.loca" +
"tion.href;\r\n },\r\n " +
" \'Close\': function () {\r\n " +
" $(this).dialog(\'destroy\');\r\n " +
" }\r\n }\r\n " +
" });\r\n }\r\n " +
" }\r\n\r\n function onAddAttachment(" +
"id, quick) {\r\n var data = { id: id };\r\n " +
" $.ajax({\r\n url: \'");
#line 82 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.Attachment()));
#line 115 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.Attachment()));
#line default
#line hidden
WriteLiteral(@"',
dataType: 'json',
data: data,
success: function (d) {
if (d.Result == 'OK') {
var a = d.Attachment;
dataType: 'json',
data: data,
success: function (d) {
if (d.Result == 'OK') {
var a = d.Attachment;
");
#line 88 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 121 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 88 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 121 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments)
{
@@ -445,7 +467,7 @@ WriteLiteral("buildAttachment(a, true, quick);");
WriteLiteral("\r\n");
#line 91 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 124 "..\..\Views\User\UserParts\_Resources.cshtml"
}
else if (canRemoveOwnAttachments)
{
@@ -458,7 +480,7 @@ WriteLiteral(" ");
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
#line 94 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 127 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(CurrentUser.UserId);
@@ -469,7 +491,7 @@ WriteLiteral("\'), quick);");
WriteLiteral("\r\n");
#line 95 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 128 "..\..\Views\User\UserParts\_Resources.cshtml"
}
else
{
@@ -484,159 +506,169 @@ WriteLiteral("buildAttachment(a, false, quick);");
WriteLiteral("\r\n");
#line 99 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 132 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(@" } else {
alert('Unable to add attachment: ' + d.Result);
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 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>';
});
}
function buildAttachment(a, canRemove, quick) {
var t = '<a><span class=""icon""><img alt=""Attachment Thumbnail"" /></span><span class=""comments""></span><span class=""author""></span>';
if (canRemove)
t += '<span class=""remove fa fa-times-circle""></span>';
t += '<span class=""timestamp""></span></a>';
var e = $(t);
var e = $(t);
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '");
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '");
#line 117 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentDownload()));
#line 150 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentDownload()));
#line default
#line hidden
WriteLiteral(@"/' + a.Id);
e.find('.comments').text(a.Description);
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);
onUpdate();
if (!quick)
e.show('slow');
if (a.MimeType.toLowerCase().indexOf('image/') == 0)
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description });
else
e.click(onDownload);
e.find('.comments').text(a.Description);
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);
onUpdate();
if (!quick)
e.show('slow');
if (a.MimeType.toLowerCase().indexOf('image/') == 0)
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Description });
else
e.click(onDownload);
// Add Thumbnail
var buildThumbnail = function () {
var retryCount = 0;
var img = e.find('.icon img');
// Add Thumbnail
var buildThumbnail = function () {
var retryCount = 0;
var img = e.find('.icon img');
var setThumbnailUrl = function () {
img.attr('src', '");
var setThumbnailUrl = function () {
img.attr('src', '");
#line 140 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentThumbnail()));
#line 173 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentThumbnail()));
#line default
#line hidden
WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n };\r\n " +
" img.on(\'error\', function () {\r\n " +
" img.addClass(\'loading\');\r\n retryCount" +
"++;\r\n if (retryCount < 6)\r\n " +
" window.setTimeout(setThumbnailUrl, retryCount * 250);\r\n " +
" });\r\n img.on(\'load\'," +
" function () {\r\n img.removeClass(\'loading\');\r" +
"\n });\r\n window.set" +
"Timeout(setThumbnailUrl, 100);\r\n };\r\n " +
" buildThumbnail();\r\n }\r\n\r\n " +
" function onDownload() {\r\n var $this = $(this);\r\n " +
" var url = $this.attr(\'href\');\r\n\r\n " +
" if ($.connection && $.connection.hub && $.connection.hub.transport &&\r\n " +
" $.connection.hub.transport.name =" +
"= \'foreverFrame\') {\r\n // SignalR active with fore" +
"verFrame transport - use popup window\r\n window.op" +
"en(url, \'_blank\', \'height=150,width=250,location=no,menubar=no,resizable=no,scro" +
"llbars=no,status=no,toolbar=no\');\r\n } else {\r\n " +
" // use iFrame\r\n if (!$at" +
"tachmentDownloadHost) {\r\n $attachmentDownload" +
"Host = $(\'<iframe>\')\r\n .attr({ \'src\': url" +
", \'title\': \'Attachment Download Host\' })\r\n " +
" .addClass(\'hidden\')\r\n .appendTo(\'body\')" +
"\r\n .contents();\r\n " +
" } else {\r\n $attachmentDownloadHost[0]" +
".location.href = url;\r\n }\r\n " +
" }\r\n\r\n return false;\r\n }\r" +
"\n\r\n function 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" +
WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n };\r\n " +
" img.on(\'error\', function () {\r\n " +
" img.addClass(\'loading\');\r\n " +
" retryCount++;\r\n if (retryCount < 6)" +
"\r\n window.setTimeout(setThumbnailUrl," +
" retryCount * 250);\r\n });\r\n " +
" img.on(\'load\', function () {\r\n " +
" img.removeClass(\'loading\');\r\n });\r\n " +
" window.setTimeout(setThumbnailUrl, 100);\r\n " +
" };\r\n buildThumbnail()" +
";\r\n }\r\n\r\n function onDownl" +
"oad() {\r\n var $this = $(this);\r\n " +
" var url = $this.attr(\'href\');\r\n\r\n " +
"if ($.connection && $.connection.hub && $.connection.hub.transport &&\r\n " +
" $.connection.hub.transport.name == \'f" +
"oreverFrame\') {\r\n // SignalR active with fore" +
"verFrame transport - use popup window\r\n windo" +
"w.open(url, \'_blank\', \'height=150,width=250,location=no,menubar=no,resizable=no," +
"scrollbars=no,status=no,toolbar=no\');\r\n } else {\r" +
"\n // use iFrame\r\n " +
" if (!$attachmentDownloadHost) {\r\n " +
" $attachmentDownloadHost = $(\'<iframe>\')\r\n " +
" .attr({ \'src\': url, \'title\': \'Attachment Download Host\' })\r\n " +
" .addClass(\'hidden\')\r\n " +
" .appendTo(\'body\')\r\n .c" +
"ontents();\r\n } else {\r\n " +
" $attachmentDownloadHost[0].location.href = url;\r\n " +
" }\r\n }\r\n\r\n " +
" return false;\r\n }\r\n\r\n " +
" function onRemoveAttachment(id) {\r\n va" +
"r a = $attachmentOutput.find(\'a[data-attachmentid=\' + id + \']\');\r\n\r\n " +
" a.hide(300).delay(300).queue(function () {\r\n " +
" var $this = $(this);\r\n if" +
" ($this.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
" Shadowbox.removeCache(this);\r\n " +
" $this.find(\'.timestamp\').livestamp(\'destroy\');\r\n " +
" $this.remove();\r\n onUpdate();\r\n " +
" });\r\n }\r\n\r\n funct" +
"ion onUpdate() {\r\n var attachmentCount = $attachmentO" +
"utput.children(\'a\').length;\r\n var tabHeading = \'Attac" +
"hments [\' + attachmentCount + \']\';\r\n $(\'#UserDetailTa" +
"b-ResourcesLink\').text(tabHeading);\r\n }\r\n\r\n");
" Shadowbox.removeCache(this);\r\n " +
" $this.find(\'.timestamp\').livestamp(\'destroy\');\r\n " +
" $this.remove();\r\n onUpdate" +
"();\r\n });\r\n }\r\n\r\n " +
" function onUpdate() {\r\n va" +
"r attachmentCount = $attachmentOutput.children(\'a\').length;\r\n " +
" var tabHeading = \'Attachments [\' + attachmentCount + \']\';\r\n " +
" $(\'#UserDetailTab-ResourcesLink\').text(tabHeading);\r\n " +
" }\r\n\r\n");
#line 199 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 232 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default
#line hidden
#line 199 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 232 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments)
{
#line default
#line hidden
WriteLiteral("\r\n //#region Add Attachments\r\n var " +
"attachmentUploader = new document.Disco.AttachmentUploader(\r\n " +
" \'");
WriteLiteral("\r\n //#region Add Attachments\r\n " +
" var attachmentUploader = new document.Disco.AttachmentUploader(\r\n " +
" \'");
#line 203 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)));
#line 236 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentUpload(Model.User.UserId, null)));
#line default
#line hidden
WriteLiteral("\',\r\n $Attachments.find(\'.Disco-AttachmentUpload-DropTa" +
"rget\'),\r\n $Attachments.find(\'.Disco-AttachmentUpload-" +
"Progress\'));\r\n\r\n var $attachmentInput = $Attachments.find" +
"(\'.attachmentInput\');\r\n $attachmentInput.find(\'.photo\').c" +
"lick(function () {\r\n attachmentUploader.uploadImage()" +
";\r\n });\r\n $attachmentInput.find(\'." +
"upload\').click(function () {\r\n attachmentUploader.upl" +
"oadFiles();\r\n });\r\n\r\n var resource" +
"sTab;\r\n $(document).on(\'dragover\', function () {\r\n " +
" if (!resourcesTab) {\r\n var t" +
"abs = $Attachments.closest(\'.ui-tabs\');\r\n resourc" +
"esTab = {\r\n tabs: tabs,\r\n " +
" resourcesIndex: tabs.children(\'ul.ui-tabs-nav\').find(\'a[href=\"#U" +
"serDetailTab-Resources\"]\').closest(\'li\').index()\r\n " +
" };\r\n }\r\n var selectedInd" +
"ex = resourcesTab.tabs.tabs(\'option\', \'active\');\r\n if" +
" (resourcesTab.resourcesIndex !== selectedIndex)\r\n " +
" resourcesTab.tabs.tabs(\'option\', \'active\', resourcesTab.resourcesIndex);\r\n " +
" });\r\n //#endregion\r\n " +
" ");
"Progress\'));\r\n\r\n var $attachmentInput = $Attachments." +
"find(\'.attachmentInput\');\r\n $attachmentInput.find(\'.p" +
"hoto\').click(function () {\r\n if ($(this).hasClass" +
"(\'disabled\'))\r\n alert(\'Disconnected from the " +
"Disco ICT Server, please refresh this page and try again\');\r\n " +
" else\r\n attachmentUploader.upload" +
"Image();\r\n });\r\n $attachme" +
"ntInput.find(\'.upload\').click(function () {\r\n if " +
"($(this).hasClass(\'disabled\'))\r\n alert(\'Disco" +
"nnected from the Disco ICT Server, please refresh this page and try again\');\r\n " +
" else\r\n attachme" +
"ntUploader.uploadFiles();\r\n });\r\n\r\n " +
" var resourcesTab;\r\n $(document).on(\'dragove" +
"r\', function () {\r\n if (!resourcesTab) {\r\n " +
" var tabs = $Attachments.closest(\'.ui-tabs\');\r\n " +
" resourcesTab = {\r\n " +
" tabs: tabs,\r\n resourcesIndex: ta" +
"bs.children(\'ul.ui-tabs-nav\').find(\'a[href=\"#UserDetailTab-Resources\"]\').closest" +
"(\'li\').index()\r\n };\r\n " +
" }\r\n var selectedIndex = resourcesTab.tabs" +
".tabs(\'option\', \'active\');\r\n if (resourcesTab.res" +
"ourcesIndex !== selectedIndex)\r\n resourcesTab" +
".tabs.tabs(\'option\', \'active\', resourcesTab.resourcesIndex);\r\n " +
" });\r\n //#endregion\r\n " +
" ");
#line 229 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line 268 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default
@@ -644,92 +676,83 @@ WriteLiteral("\',\r\n $Attachments.find(\'.Disco-Atta
WriteLiteral(" ");
#line 230 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 269 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral(@"
//#region Remove Attachments
//#region Remove Attachments
$attachmentOutput.find('span.remove').click(removeAttachment);
$attachmentOutput.find('span.remove').click(removeAttachment);
function removeAttachment() {
$this = $(this).closest('a');
function removeAttachment() {
$this = $(this).closest('a');
var data = { id: $this.attr('data-attachmentid') };
var data = { id: $this.attr('data-attachmentid') };
if (!$dialogRemoveAttachment) {
$dialogRemoveAttachment = $('#dialogRemoveAttachment').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
}
if (!$dialogRemoveAttachment) {
$dialogRemoveAttachment = $('#dialogRemoveAttachment').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false
});
}
$dialogRemoveAttachment.dialog(""enable"");
$dialogRemoveAttachment.dialog('option', 'buttons', {
""Remove"": function () {
$dialogRemoveAttachment.dialog(""disable"");
$dialogRemoveAttachment.dialog(""option"", ""buttons"", null);
$.ajax({
url: '");
$dialogRemoveAttachment.dialog(""enable"");
$dialogRemoveAttachment.dialog('option', 'buttons', {
""Remove"": function () {
$dialogRemoveAttachment.dialog(""disable"");
$dialogRemoveAttachment.dialog(""option"", ""buttons"", null);
$.ajax({
url: '");
#line 256 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentRemove()));
#line 295 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentRemove()));
#line default
#line hidden
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
");
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
" data: data,\r\n " +
" success: function (d) {\r\n " +
"if (d == \'OK\') {\r\n // Do noth" +
"ing, await SignalR notification\r\n " +
" } else {\r\n alert(\'Unable to " +
"remove attachment: \' + d);\r\n }\r\n " +
" $dialogRemoveAttachment.dialog(\"c" +
"lose\");\r\n },\r\n " +
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
" alert(\'Unable to remove attachment: \' +" +
" textStatus);\r\n $dialogRemoveAtta" +
"chment.dialog(\"close\");\r\n }\r\n " +
" });\r\n },\r\n " +
" Cancel: 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\r\n /" +
"/#endregion\r\n ");
#line 284 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 323 "..\..\Views\User\UserParts\_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() });
else
$this.click(onDownload);
$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() });
else
$this.click(onDownload);
});
});
});
</script>
</div>
</td>
@@ -739,7 +762,7 @@ WriteLiteral(@"
$('#UserDetailTabItems').append('<li><a href=""#UserDetailTab-Resources"" id=""UserDetailTab-ResourcesLink"">Attachments [");
#line 300 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 339 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Model.User.UserAttachments == null ? 0 : Model.User.UserAttachments.Count);
@@ -748,7 +771,7 @@ WriteLiteral(@"
WriteLiteral("]</a></li>\');\r\n </script>\r\n</div>\r\n");
#line 303 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 342 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -770,7 +793,7 @@ WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n");
#line 310 "..\..\Views\User\UserParts\_Resources.cshtml"
#line 349 "..\..\Views\User\UserParts\_Resources.cshtml"
}
#line default