Bug Fix: Upload attachments required refresh

This commit is contained in:
Gary Sharp
2013-11-12 12:21:35 +11:00
parent 9ac487e7e0
commit b1048588e7
6 changed files with 306 additions and 245 deletions
@@ -120,12 +120,17 @@
if (d.Result == 'OK') { if (d.Result == 'OK') {
var a = d.Attachment; var a = d.Attachment;
@if (canRemoveAnyAttachments) @if (canRemoveAnyAttachments)
{<text>buildAttachment(a, true);</text>} {
<text>buildAttachment(a, true, quick);</text>
}
else if (canRemoveOwnAttachments) else if (canRemoveOwnAttachments)
{<text>buildAttachment(a, (a.AuthorId === '@(CurrentUser.Id)'));</text>} {
<text>buildAttachment(a, (a.AuthorId === '@(CurrentUser.Id)'), quick);</text>
}
else else
{<text>buildAttachment(a, false);</text>} {
<text>buildAttachment(a, false, quick);</text>
}
} else { } else {
alert('Unable to add attachment: ' + d.Result); alert('Unable to add attachment: ' + d.Result);
} }
@@ -136,7 +141,7 @@
}); });
} }
function buildAttachment(a, canRemove) { function buildAttachment(a, canRemove, quick) {
var t = '<a><span class="icon"><img alt="Attachment Thumbnail" /></span><span class="comments"></span><span class="author"></span>'; var t = '<a><span class="icon"><img alt="Attachment Thumbnail" /></span><span class="comments"></span><span class="author"></span>';
if (canRemove) if (canRemove)
t += '<span class="remove"></span>'; t += '<span class="remove"></span>';
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.18051 // Runtime Version:4.0.30319.34003
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@@ -465,48 +465,62 @@ WriteLiteral(@"',
if (canRemoveAnyAttachments) if (canRemoveAnyAttachments)
{ {
#line default #line default
#line hidden #line hidden
WriteLiteral("buildAttachment(a, true);"); WriteLiteral(" ");
WriteLiteral("buildAttachment(a, true, quick);");
WriteLiteral("\r\n");
#line 123 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 125 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
} }
else if (canRemoveOwnAttachments) else if (canRemoveOwnAttachments)
{ {
#line default #line default
#line hidden #line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, (a.AuthorId === \'"); WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
#line 125 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 128 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(CurrentUser.Id); Write(CurrentUser.Id);
#line default #line default
#line hidden #line hidden
WriteLiteral("\'));"); WriteLiteral("\'), quick);");
WriteLiteral("\r\n");
#line 125 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 129 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
} }
else else
{ {
#line default #line default
#line hidden #line hidden
WriteLiteral("buildAttachment(a, false);"); WriteLiteral(" ");
WriteLiteral("buildAttachment(a, false, quick);");
WriteLiteral("\r\n");
#line 127 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 133 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
} }
#line default #line default
#line hidden #line hidden
WriteLiteral(@" WriteLiteral(@" } else {
} else {
alert('Unable to add attachment: ' + d.Result); alert('Unable to add attachment: ' + d.Result);
} }
}, },
@@ -516,7 +530,7 @@ WriteLiteral(@"
}); });
} }
function buildAttachment(a, canRemove) { function buildAttachment(a, canRemove, quick) {
var t = '<a><span"); var t = '<a><span");
WriteLiteral(" class=\"icon\""); WriteLiteral(" class=\"icon\"");
@@ -547,7 +561,7 @@ WriteLiteral("></span></a>\';\r\n\r\n var e = $(t);\r
"tr(\'href\', \'"); "tr(\'href\', \'");
#line 147 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 152 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentDownload())); Write(Url.Action(MVC.API.Device.AttachmentDownload()));
@@ -556,7 +570,7 @@ WriteLiteral("></span></a>\';\r\n\r\n var e = $(t);\r
WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', \'"); WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', \'");
#line 148 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 153 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentThumbnail())); Write(Url.Action(MVC.API.Device.AttachmentThumbnail()));
@@ -581,7 +595,7 @@ WriteLiteral(@"/' + a.Id);
"); ");
#line 164 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 169 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
} }
@@ -590,7 +604,7 @@ WriteLiteral(@"/' + a.Id);
WriteLiteral(" "); WriteLiteral(" ");
#line 165 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 170 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments) if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{ {
@@ -621,7 +635,7 @@ WriteLiteral(@"
url: '"); url: '");
#line 188 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 193 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentRemove())); Write(Url.Action(MVC.API.Device.AttachmentRemove()));
@@ -653,7 +667,7 @@ WriteLiteral("\',\r\n dataType: \'json\',
"egion\r\n "); "egion\r\n ");
#line 220 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 225 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
} }
@@ -697,7 +711,7 @@ WriteLiteral("></span>\r\n Are you sure?\r\n </p>\r\n </div
"id=\"DeviceDetailTab-ResourcesLink\">Attachments ["); "id=\"DeviceDetailTab-ResourcesLink\">Attachments [");
#line 243 "..\..\Views\Device\DeviceParts\_Resources.cshtml" #line 248 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Model.Device.DeviceAttachments == null ? 0 : Model.Device.DeviceAttachments.Count); Write(Model.Device.DeviceAttachments == null ? 0 : Model.Device.DeviceAttachments.Count);
+47 -40
View File
@@ -30,7 +30,7 @@
{ {
<div data-logid="@jl.Id"> <div data-logid="@jl.Id">
<span class="author">@jl.TechUser.ToString()</span>@if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId == CurrentUser.Id)) <span class="author">@jl.TechUser.ToString()</span>@if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId == CurrentUser.Id))
{<text><span class="remove"></span></text>}<span class="timestamp" title="@jl.Timestamp.ToFullDateTime()">@jl.Timestamp.ToFuzzy()</span> {<text><span class="remove"></span></text>}<span class="timestamp" title="@jl.Timestamp.ToFullDateTime()">@jl.Timestamp.ToFuzzy()</span>
<span class="comment">@jl.Comments.ToMultilineJobRefString()</span> <span class="comment">@jl.Comments.ToMultilineJobRefString()</span>
</div> </div>
} }
@@ -313,21 +313,6 @@
var $dialogUpload; var $dialogUpload;
var onLoadNavigation = null; var onLoadNavigation = null;
var isLoaded = 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.Job.AttachmentUpload(Model.Job.Id, null)))'
);
var $attachmentInput = $Attachments.find('.attachmentInput'); var $attachmentInput = $Attachments.find('.attachmentInput');
$attachmentInput.find('.photo').click(function () { $attachmentInput.find('.photo').click(function () {
@@ -340,25 +325,42 @@
var silverlightUploadAttachment = $('#silverlightUploadAttachment').get(0); var silverlightUploadAttachment = $('#silverlightUploadAttachment').get(0);
function showDialog(navigationPath) { function showDialog(navigationPath) {
if (!$dialogUpload) { if (!$dialogUpload) {
$dialogUpload = $('#dialogUpload').dialog({ Silverlight.createObject(
autoOpen: false, '@(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap)',
draggable: false, $('#silverlightHostUploadAttachment').get(0),
modal: true, 'silverlightUploadAttachment',
resizable: false, { width: '840px', height: '500px', background: 'white', version: '4.0.60310.0' },
width: 860, {
height: 550, onLoad: function () {
close: function () { if (onLoadNavigation) {
silverlightUploadAttachment.content.Navigator.Navigate('/Hidden'); $('#silverlightUploadAttachment').get(0).content.Navigator.Navigate(onLoadNavigation);
} isLoaded = true;
}); }
} }
$dialogUpload.dialog('open'); },
if (isLoaded) { 'UploadUrl=@(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)))'
silverlightUploadAttachment.content.Navigator.Navigate(navigationPath); );
} else {
onLoadNavigation = navigationPath; $dialogUpload = $('#dialogUpload').dialog({
} autoOpen: false,
}; draggable: false,
modal: true,
resizable: false,
width: 860,
height: 550,
close: function () {
if (silverlightUploadAttachment && silverlightUploadAttachment.content)
silverlightUploadAttachment.content.Navigator.Navigate('/Hidden');
}
});
}
$dialogUpload.dialog('open');
if (isLoaded) {
silverlightUploadAttachment.content.Navigator.Navigate(navigationPath);
} else {
onLoadNavigation = navigationPath;
}
};
//#endregion //#endregion
</text>} </text>}
@@ -438,12 +440,17 @@
if (d.Result == 'OK') { if (d.Result == 'OK') {
var a = d.Attachment; var a = d.Attachment;
@if (canRemoveAnyAttachments) @if (canRemoveAnyAttachments)
{<text>buildAttachment(a, true);</text>} {
<text>buildAttachment(a, true, quick);</text>
}
else if (canRemoveOwnAttachments) else if (canRemoveOwnAttachments)
{<text>buildAttachment(a, (a.AuthorId === '@(CurrentUser.Id)'));</text>} {
<text>buildAttachment(a, (a.AuthorId === '@(CurrentUser.Id)'), quick);</text>
}
else else
{<text>buildAttachment(a, false);</text>} {
<text>buildAttachment(a, false, quick);</text>
}
} else { } else {
alert('Unable to add attachment: ' + d.Result); alert('Unable to add attachment: ' + d.Result);
} }
@@ -454,7 +461,7 @@
}); });
} }
} }
function buildAttachment(a, canRemove) { function buildAttachment(a, canRemove, quick) {
if (parseInt(a.ParentId) == jobId) { if (parseInt(a.ParentId) == jobId) {
var t = '<a><span class="icon"><img alt="Attachment Thumbnail" /></span><span class="comments"></span><span class="author"></span>'; var t = '<a><span class="icon"><img alt="Attachment Thumbnail" /></span><span class="comments"></span><span class="author"></span>';
if (canRemove) if (canRemove)
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.18051 // Runtime Version:4.0.30319.34003
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@@ -172,7 +172,7 @@ WriteLiteral("</span>");
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml" #line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId == CurrentUser.Id)) if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId == CurrentUser.Id))
{ {
#line default #line default
#line hidden #line hidden
@@ -184,7 +184,7 @@ WriteLiteral("></span>");
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml" #line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
#line default #line default
#line hidden #line hidden
@@ -192,21 +192,21 @@ WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\""); WriteLiteral(" class=\"timestamp\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1819), Tuple.Create("\"", 1857) WriteAttribute("title", Tuple.Create(" title=\"", 1812), Tuple.Create("\"", 1850)
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml" #line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1827), Tuple.Create<System.Object, System.Int32>(jl.Timestamp.ToFullDateTime() , Tuple.Create(Tuple.Create("", 1820), Tuple.Create<System.Object, System.Int32>(jl.Timestamp.ToFullDateTime()
#line default #line default
#line hidden #line hidden
, 1827), false) , 1820), false)
); );
WriteLiteral(">"); WriteLiteral(">");
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml" #line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(jl.Timestamp.ToFuzzy()); Write(jl.Timestamp.ToFuzzy());
#line default #line default
@@ -295,14 +295,14 @@ WriteLiteral(" <td");
WriteLiteral(" id=\"Attachments\""); WriteLiteral(" id=\"Attachments\"");
WriteAttribute("class", Tuple.Create(" class=\"", 2489), Tuple.Create("\"", 2564) WriteAttribute("class", Tuple.Create(" class=\"", 2482), Tuple.Create("\"", 2557)
#line 49 "..\..\Views\Job\JobParts\Resources.cshtml" #line 49 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2497), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments" , Tuple.Create(Tuple.Create("", 2490), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line default #line default
#line hidden #line hidden
, 2497), false) , 2490), false)
); );
WriteLiteral(">\r\n <div"); WriteLiteral(">\r\n <div");
@@ -327,14 +327,14 @@ WriteLiteral(">\r\n");
#line hidden #line hidden
WriteLiteral(" <a"); WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 2732), Tuple.Create("\"", 2789) WriteAttribute("href", Tuple.Create(" href=\"", 2725), Tuple.Create("\"", 2782)
#line 53 "..\..\Views\Job\JobParts\Resources.cshtml" #line 53 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2739), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id)) , Tuple.Create(Tuple.Create("", 2732), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
#line default #line default
#line hidden #line hidden
, 2739), false) , 2732), false)
); );
WriteLiteral(" data-attachmentid=\""); WriteLiteral(" data-attachmentid=\"");
@@ -363,42 +363,42 @@ WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"icon\""); WriteLiteral(" class=\"icon\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2895), Tuple.Create("\"", 2915) WriteAttribute("title", Tuple.Create(" title=\"", 2888), Tuple.Create("\"", 2908)
#line 54 "..\..\Views\Job\JobParts\Resources.cshtml" #line 54 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2903), Tuple.Create<System.Object, System.Int32>(ja.Filename , Tuple.Create(Tuple.Create("", 2896), Tuple.Create<System.Object, System.Int32>(ja.Filename
#line default #line default
#line hidden #line hidden
, 2903), false) , 2896), false)
); );
WriteLiteral(">\r\n <img"); WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\""); WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 2982), Tuple.Create("\"", 3041) WriteAttribute("src", Tuple.Create(" src=\"", 2975), Tuple.Create("\"", 3034)
#line 55 "..\..\Views\Job\JobParts\Resources.cshtml" #line 55 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2988), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id)) , Tuple.Create(Tuple.Create("", 2981), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
#line default #line default
#line hidden #line hidden
, 2988), false) , 2981), false)
); );
WriteLiteral(" /></span>\r\n <span"); WriteLiteral(" /></span>\r\n <span");
WriteLiteral(" class=\"comments\""); WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 3104), Tuple.Create("\"", 3124) WriteAttribute("title", Tuple.Create(" title=\"", 3097), Tuple.Create("\"", 3117)
#line 56 "..\..\Views\Job\JobParts\Resources.cshtml" #line 56 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3112), Tuple.Create<System.Object, System.Int32>(ja.Comments , Tuple.Create(Tuple.Create("", 3105), Tuple.Create<System.Object, System.Int32>(ja.Comments
#line default #line default
#line hidden #line hidden
, 3112), false) , 3105), false)
); );
WriteLiteral(">\r\n"); WriteLiteral(">\r\n");
@@ -482,14 +482,14 @@ WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\""); WriteLiteral(" class=\"timestamp\"");
WriteAttribute("title", Tuple.Create(" title=\"", 3710), Tuple.Create("\"", 3748) WriteAttribute("title", Tuple.Create(" title=\"", 3703), Tuple.Create("\"", 3741)
#line 62 "..\..\Views\Job\JobParts\Resources.cshtml" #line 62 "..\..\Views\Job\JobParts\Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3718), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime() , Tuple.Create(Tuple.Create("", 3711), Tuple.Create<System.Object, System.Int32>(ja.Timestamp.ToFullDateTime()
#line default #line default
#line hidden #line hidden
, 3718), false) , 3711), false)
); );
WriteLiteral(">"); WriteLiteral(">");
@@ -1023,39 +1023,6 @@ WriteLiteral(@"
var $dialogUpload; var $dialogUpload;
var onLoadNavigation = null; var onLoadNavigation = null;
var isLoaded = null; var isLoaded = null;
Silverlight.createObject(
'");
#line 317 "..\..\Views\Job\JobParts\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 329 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral(@"'
);
var $attachmentInput = $Attachments.find('.attachmentInput'); var $attachmentInput = $Attachments.find('.attachmentInput');
$attachmentInput.find('.photo').click(function () { $attachmentInput.find('.photo').click(function () {
@@ -1068,31 +1035,66 @@ WriteLiteral(@"'
var silverlightUploadAttachment = $('#silverlightUploadAttachment').get(0); var silverlightUploadAttachment = $('#silverlightUploadAttachment').get(0);
function showDialog(navigationPath) { function showDialog(navigationPath) {
if (!$dialogUpload) { if (!$dialogUpload) {
$dialogUpload = $('#dialogUpload').dialog({ Silverlight.createObject(
autoOpen: false, '");
draggable: false,
modal: true,
resizable: false, #line 329 "..\..\Views\Job\JobParts\Resources.cshtml"
width: 860, Write(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap);
height: 550,
close: function () {
silverlightUploadAttachment.content.Navigator.Navigate('/Hidden'); #line default
} #line hidden
}); WriteLiteral(@"',
} $('#silverlightHostUploadAttachment').get(0),
$dialogUpload.dialog('open'); 'silverlightUploadAttachment',
if (isLoaded) { { width: '840px', height: '500px', background: 'white', version: '4.0.60310.0' },
silverlightUploadAttachment.content.Navigator.Navigate(navigationPath); {
} else { onLoad: function () {
onLoadNavigation = navigationPath; if (onLoadNavigation) {
} $('#silverlightUploadAttachment').get(0).content.Navigator.Navigate(onLoadNavigation);
}; isLoaded = true;
}
}
},
'UploadUrl=");
#line 341 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)));
#line default
#line hidden
WriteLiteral(@"'
);
$dialogUpload = $('#dialogUpload').dialog({
autoOpen: false,
draggable: false,
modal: true,
resizable: false,
width: 860,
height: 550,
close: function () {
if (silverlightUploadAttachment && silverlightUploadAttachment.content)
silverlightUploadAttachment.content.Navigator.Navigate('/Hidden');
}
});
}
$dialogUpload.dialog('open');
if (isLoaded) {
silverlightUploadAttachment.content.Navigator.Navigate(navigationPath);
} else {
onLoadNavigation = navigationPath;
}
};
//#endregion //#endregion
"); ");
#line 364 "..\..\Views\Job\JobParts\Resources.cshtml" #line 366 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
@@ -1101,13 +1103,13 @@ WriteLiteral(@"'
WriteLiteral("\r\n"); WriteLiteral("\r\n");
#line 366 "..\..\Views\Job\JobParts\Resources.cshtml" #line 368 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default #line default
#line hidden #line hidden
#line 366 "..\..\Views\Job\JobParts\Resources.cshtml" #line 368 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments) if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{ {
@@ -1142,7 +1144,7 @@ WriteLiteral(@"
url: '"); url: '");
#line 393 "..\..\Views\Job\JobParts\Resources.cshtml" #line 395 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentRemove())); Write(Url.Action(MVC.API.Job.AttachmentRemove()));
@@ -1170,7 +1172,7 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
" }\r\n\r\n //#endregion\r\n\r\n "); " }\r\n\r\n //#endregion\r\n\r\n ");
#line 426 "..\..\Views\Job\JobParts\Resources.cshtml" #line 428 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
@@ -1181,7 +1183,7 @@ WriteLiteral("\r\n function addAttachment(key, quick) {\r\n\r\n
" $.ajax({\r\n url: \'"); " $.ajax({\r\n url: \'");
#line 434 "..\..\Views\Job\JobParts\Resources.cshtml" #line 436 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.Attachment())); Write(Url.Action(MVC.API.Job.Attachment()));
@@ -1193,58 +1195,72 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
""); "");
#line 440 "..\..\Views\Job\JobParts\Resources.cshtml" #line 442 "..\..\Views\Job\JobParts\Resources.cshtml"
#line default #line default
#line hidden #line hidden
#line 440 "..\..\Views\Job\JobParts\Resources.cshtml" #line 442 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyAttachments) if (canRemoveAnyAttachments)
{ {
#line default
#line hidden
WriteLiteral("buildAttachment(a, true);");
#line 441 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else if (canRemoveOwnAttachments)
{
#line default #line default
#line hidden #line hidden
WriteLiteral("buildAttachment(a, (a.AuthorId === \'"); WriteLiteral(" ");
WriteLiteral("buildAttachment(a, true, quick);");
#line 443 "..\..\Views\Job\JobParts\Resources.cshtml" WriteLiteral("\r\n");
Write(CurrentUser.Id);
#line default
#line hidden
WriteLiteral("\'));");
#line 443 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral("buildAttachment(a, false);");
#line 445 "..\..\Views\Job\JobParts\Resources.cshtml" #line 445 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
else if (canRemoveOwnAttachments)
{
#line default #line default
#line hidden #line hidden
WriteLiteral(@" WriteLiteral(" ");
} else {
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
#line 448 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(CurrentUser.Id);
#line default
#line hidden
WriteLiteral("\'), quick);");
WriteLiteral("\r\n");
#line 449 "..\..\Views\Job\JobParts\Resources.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, false, quick);");
WriteLiteral("\r\n");
#line 453 "..\..\Views\Job\JobParts\Resources.cshtml"
}
#line default
#line hidden
WriteLiteral(@" } else {
alert('Unable to add attachment: ' + d.Result); alert('Unable to add attachment: ' + d.Result);
} }
}, },
@@ -1254,7 +1270,7 @@ WriteLiteral(@"
}); });
} }
} }
function buildAttachment(a, canRemove) { function buildAttachment(a, canRemove, quick) {
if (parseInt(a.ParentId) == jobId) { if (parseInt(a.ParentId) == jobId) {
var t = '<a><span class=""icon""><img alt=""Attachment Thumbnail"" /></span><span class=""comments""></span><span class=""author""></span>'; var t = '<a><span class=""icon""><img alt=""Attachment Thumbnail"" /></span><span class=""comments""></span><span class=""author""></span>';
if (canRemove) if (canRemove)
@@ -1266,7 +1282,7 @@ WriteLiteral(@"
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 466 "..\..\Views\Job\JobParts\Resources.cshtml" #line 473 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentDownload())); Write(Url.Action(MVC.API.Job.AttachmentDownload()));
@@ -1275,7 +1291,7 @@ WriteLiteral(@"
WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', \'"); WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', \'");
#line 467 "..\..\Views\Job\JobParts\Resources.cshtml" #line 474 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Action(MVC.API.Job.AttachmentThumbnail())); Write(Url.Action(MVC.API.Job.AttachmentThumbnail()));
@@ -1308,14 +1324,14 @@ WriteLiteral("/\' + a.Id);\r\n e.find(\'.comments\').text(a.C
" </script>\r\n"); " </script>\r\n");
#line 513 "..\..\Views\Job\JobParts\Resources.cshtml" #line 520 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
#line default #line default
#line hidden #line hidden
#line 514 "..\..\Views\Job\JobParts\Resources.cshtml" #line 521 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canShowLogs && canShowAttachments) if (canShowLogs && canShowAttachments)
{ {
@@ -1325,7 +1341,7 @@ WriteLiteral("/\' + a.Id);\r\n e.find(\'.comments\').text(a.C
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'"); WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
#line 518 "..\..\Views\Job\JobParts\Resources.cshtml" #line 525 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id); Write(Model.Job.Id);
@@ -1354,7 +1370,7 @@ WriteLiteral("\');\r\n\r\n //#region LiveEvents\r\n functi
" var liveMessagesConnection = $.connection(\'"); " var liveMessagesConnection = $.connection(\'");
#line 551 "..\..\Views\Job\JobParts\Resources.cshtml" #line 558 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Content("~/API/Repository/Notifications")); Write(Url.Content("~/API/Repository/Notifications"));
@@ -1373,7 +1389,7 @@ WriteLiteral(@"', { addToGroups: 'JobLog,JobAttachment' })
"); ");
#line 561 "..\..\Views\Job\JobParts\Resources.cshtml" #line 568 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
else if (canShowLogs) else if (canShowLogs)
{ {
@@ -1384,7 +1400,7 @@ else if (canShowLogs)
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'"); WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
#line 566 "..\..\Views\Job\JobParts\Resources.cshtml" #line 573 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id); Write(Model.Job.Id);
@@ -1412,7 +1428,7 @@ WriteLiteral(@"');
var liveMessagesConnection = $.connection('"); var liveMessagesConnection = $.connection('");
#line 585 "..\..\Views\Job\JobParts\Resources.cshtml" #line 592 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Content("~/API/Repository/Notifications")); Write(Url.Content("~/API/Repository/Notifications"));
@@ -1431,7 +1447,7 @@ WriteLiteral(@"', { addToGroups: 'JobLog' })
"); ");
#line 595 "..\..\Views\Job\JobParts\Resources.cshtml" #line 602 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
else if (canShowAttachments) else if (canShowAttachments)
{ {
@@ -1442,7 +1458,7 @@ else if (canShowAttachments)
WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'"); WriteLiteral(" <script>\r\n $(function () {\r\n var jobId = parseInt(\'");
#line 600 "..\..\Views\Job\JobParts\Resources.cshtml" #line 607 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Model.Job.Id); Write(Model.Job.Id);
@@ -1468,7 +1484,7 @@ WriteLiteral(@"');
var liveMessagesConnection = $.connection('"); var liveMessagesConnection = $.connection('");
#line 617 "..\..\Views\Job\JobParts\Resources.cshtml" #line 624 "..\..\Views\Job\JobParts\Resources.cshtml"
Write(Url.Content("~/API/Repository/Notifications")); Write(Url.Content("~/API/Repository/Notifications"));
@@ -1487,7 +1503,7 @@ WriteLiteral(@"', { addToGroups: 'JobAttachment' })
"); ");
#line 627 "..\..\Views\Job\JobParts\Resources.cshtml" #line 634 "..\..\Views\Job\JobParts\Resources.cshtml"
} }
#line default #line default
@@ -117,12 +117,17 @@
if (d.Result == 'OK') { if (d.Result == 'OK') {
var a = d.Attachment; var a = d.Attachment;
@if (canRemoveAnyAttachments) @if (canRemoveAnyAttachments)
{<text>buildAttachment(a, true);</text>} {
<text>buildAttachment(a, true, quick);</text>
}
else if (canRemoveOwnAttachments) else if (canRemoveOwnAttachments)
{<text>buildAttachment(a, (a.AuthorId === '@(CurrentUser.Id)'));</text>} {
<text>buildAttachment(a, (a.AuthorId === '@(CurrentUser.Id)'), quick);</text>
}
else else
{<text>buildAttachment(a, false);</text>} {
<text>buildAttachment(a, false, quick);</text>
}
} else { } else {
alert('Unable to add attachment: ' + d.Result); alert('Unable to add attachment: ' + d.Result);
} }
@@ -132,7 +137,7 @@
} }
}); });
} }
function buildAttachment(a, canRemove) { function buildAttachment(a, canRemove, quick) {
var t = '<a><span class="icon"><img alt="Attachment Thumbnail" /></span><span class="comments"></span><span class="author"></span>'; var t = '<a><span class="icon"><img alt="Attachment Thumbnail" /></span><span class="comments"></span><span class="author"></span>';
if (canRemove) if (canRemove)
t += '<span class="remove"></span>'; t += '<span class="remove"></span>';
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.18051 // Runtime Version:4.0.30319.34003
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@@ -462,48 +462,62 @@ WriteLiteral(@"',
if (canRemoveAnyAttachments) if (canRemoveAnyAttachments)
{ {
#line default #line default
#line hidden #line hidden
WriteLiteral("buildAttachment(a, true);"); WriteLiteral(" ");
WriteLiteral("buildAttachment(a, true, quick);");
WriteLiteral("\r\n");
#line 120 "..\..\Views\User\UserParts\_Resources.cshtml" #line 122 "..\..\Views\User\UserParts\_Resources.cshtml"
} }
else if (canRemoveOwnAttachments) else if (canRemoveOwnAttachments)
{ {
#line default #line default
#line hidden #line hidden
WriteLiteral(" ");
WriteLiteral("buildAttachment(a, (a.AuthorId === \'"); WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
#line 122 "..\..\Views\User\UserParts\_Resources.cshtml" #line 125 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(CurrentUser.Id); Write(CurrentUser.Id);
#line default #line default
#line hidden #line hidden
WriteLiteral("\'));"); WriteLiteral("\'), quick);");
WriteLiteral("\r\n");
#line 122 "..\..\Views\User\UserParts\_Resources.cshtml" #line 126 "..\..\Views\User\UserParts\_Resources.cshtml"
} }
else else
{ {
#line default #line default
#line hidden #line hidden
WriteLiteral("buildAttachment(a, false);"); WriteLiteral(" ");
WriteLiteral("buildAttachment(a, false, quick);");
WriteLiteral("\r\n");
#line 124 "..\..\Views\User\UserParts\_Resources.cshtml" #line 130 "..\..\Views\User\UserParts\_Resources.cshtml"
} }
#line default #line default
#line hidden #line hidden
WriteLiteral(@" WriteLiteral(@" } else {
} else {
alert('Unable to add attachment: ' + d.Result); alert('Unable to add attachment: ' + d.Result);
} }
}, },
@@ -512,7 +526,7 @@ WriteLiteral(@"
} }
}); });
} }
function buildAttachment(a, canRemove) { function buildAttachment(a, canRemove, quick) {
var t = '<a><span"); var t = '<a><span");
WriteLiteral(" class=\"icon\""); WriteLiteral(" class=\"icon\"");
@@ -543,7 +557,7 @@ WriteLiteral("></span></a>\';\r\n\r\n var e = $(t);\r
"tr(\'href\', \'"); "tr(\'href\', \'");
#line 143 "..\..\Views\User\UserParts\_Resources.cshtml" #line 148 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentDownload())); Write(Url.Action(MVC.API.User.AttachmentDownload()));
@@ -552,7 +566,7 @@ WriteLiteral("></span></a>\';\r\n\r\n var e = $(t);\r
WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', \'"); WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', \'");
#line 144 "..\..\Views\User\UserParts\_Resources.cshtml" #line 149 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentThumbnail())); Write(Url.Action(MVC.API.User.AttachmentThumbnail()));
@@ -577,7 +591,7 @@ WriteLiteral(@"/' + a.Id);
"); ");
#line 160 "..\..\Views\User\UserParts\_Resources.cshtml" #line 165 "..\..\Views\User\UserParts\_Resources.cshtml"
} }
@@ -586,7 +600,7 @@ WriteLiteral(@"/' + a.Id);
WriteLiteral(" "); WriteLiteral(" ");
#line 161 "..\..\Views\User\UserParts\_Resources.cshtml" #line 166 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments) if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{ {
@@ -618,7 +632,7 @@ WriteLiteral(@"
url: '"); url: '");
#line 185 "..\..\Views\User\UserParts\_Resources.cshtml" #line 190 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Url.Action(MVC.API.User.AttachmentRemove())); Write(Url.Action(MVC.API.User.AttachmentRemove()));
@@ -650,7 +664,7 @@ WriteLiteral("\',\r\n dataType: \'json\',
"egion\r\n "); "egion\r\n ");
#line 218 "..\..\Views\User\UserParts\_Resources.cshtml" #line 223 "..\..\Views\User\UserParts\_Resources.cshtml"
} }
@@ -670,13 +684,13 @@ WriteLiteral(@"
"); ");
#line 230 "..\..\Views\User\UserParts\_Resources.cshtml" #line 235 "..\..\Views\User\UserParts\_Resources.cshtml"
#line default #line default
#line hidden #line hidden
#line 230 "..\..\Views\User\UserParts\_Resources.cshtml" #line 235 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canAddAttachments) if (canAddAttachments)
{ {
@@ -696,7 +710,7 @@ WriteLiteral(" id=\"silverlightHostUploadAttachment\"");
WriteLiteral(">\r\n </div>\r\n </div>\r\n"); WriteLiteral(">\r\n </div>\r\n </div>\r\n");
#line 236 "..\..\Views\User\UserParts\_Resources.cshtml" #line 241 "..\..\Views\User\UserParts\_Resources.cshtml"
} }
@@ -705,7 +719,7 @@ WriteLiteral(">\r\n </div>\r\n </div>\r\n");
WriteLiteral(" "); WriteLiteral(" ");
#line 237 "..\..\Views\User\UserParts\_Resources.cshtml" #line 242 "..\..\Views\User\UserParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments) if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{ {
@@ -727,7 +741,7 @@ WriteLiteral(" style=\"float: left; margin: 0 7px 20px 0;\"");
WriteLiteral("></span>\r\n Are you sure?\r\n </p>\r\n </div>\r\n"); WriteLiteral("></span>\r\n Are you sure?\r\n </p>\r\n </div>\r\n");
#line 245 "..\..\Views\User\UserParts\_Resources.cshtml" #line 250 "..\..\Views\User\UserParts\_Resources.cshtml"
} }
@@ -737,7 +751,7 @@ WriteLiteral(" <script>\r\n $(\'#UserDetailTabItems\').append(\'<li><a
"b-Resources\" id=\"UserDetailTab-ResourcesLink\">Attachments ["); "b-Resources\" id=\"UserDetailTab-ResourcesLink\">Attachments [");
#line 247 "..\..\Views\User\UserParts\_Resources.cshtml" #line 252 "..\..\Views\User\UserParts\_Resources.cshtml"
Write(Model.User.UserAttachments == null ? 0 : Model.User.UserAttachments.Count); Write(Model.User.UserAttachments == null ? 0 : Model.User.UserAttachments.Count);