From b1048588e7ed6e2b22235fc54bdbc249cf58b7ee Mon Sep 17 00:00:00 2001
From: Gary Sharp
Date: Tue, 12 Nov 2013 12:21:35 +1100
Subject: [PATCH] Bug Fix: Upload attachments required refresh
---
.../Device/DeviceParts/_Resources.cshtml | 15 +-
.../DeviceParts/_Resources.generated.cs | 74 +++--
Disco.Web/Views/Job/JobParts/Resources.cshtml | 87 +++---
.../Views/Job/JobParts/Resources.generated.cs | 276 +++++++++---------
.../Views/User/UserParts/_Resources.cshtml | 15 +-
.../User/UserParts/_Resources.generated.cs | 84 +++---
6 files changed, 306 insertions(+), 245 deletions(-)
diff --git a/Disco.Web/Views/Device/DeviceParts/_Resources.cshtml b/Disco.Web/Views/Device/DeviceParts/_Resources.cshtml
index c7378e75..c540a7c2 100644
--- a/Disco.Web/Views/Device/DeviceParts/_Resources.cshtml
+++ b/Disco.Web/Views/Device/DeviceParts/_Resources.cshtml
@@ -120,12 +120,17 @@
if (d.Result == 'OK') {
var a = d.Attachment;
@if (canRemoveAnyAttachments)
- {buildAttachment(a, true);}
+ {
+ buildAttachment(a, true, quick);
+ }
else if (canRemoveOwnAttachments)
- {buildAttachment(a, (a.AuthorId === '@(CurrentUser.Id)'));}
+ {
+ buildAttachment(a, (a.AuthorId === '@(CurrentUser.Id)'), quick);
+ }
else
- {buildAttachment(a, false);}
-
+ {
+ buildAttachment(a, false, quick);
+ }
} else {
alert('Unable to add attachment: ' + d.Result);
}
@@ -136,7 +141,7 @@
});
}
- function buildAttachment(a, canRemove) {
+ function buildAttachment(a, canRemove, quick) {
var t = '
';
if (canRemove)
t += '';
diff --git a/Disco.Web/Views/Device/DeviceParts/_Resources.generated.cs b/Disco.Web/Views/Device/DeviceParts/_Resources.generated.cs
index a5df6296..b6ba663d 100644
--- a/Disco.Web/Views/Device/DeviceParts/_Resources.generated.cs
+++ b/Disco.Web/Views/Device/DeviceParts/_Resources.generated.cs
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
//
// 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
// the code is regenerated.
@@ -464,49 +464,63 @@ WriteLiteral(@"',
#line 122 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canRemoveAnyAttachments)
{
-
- #line default
- #line hidden
-WriteLiteral("buildAttachment(a, true);");
- #line 123 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
- }
+ #line default
+ #line hidden
+WriteLiteral(" ");
+
+WriteLiteral("buildAttachment(a, true, quick);");
+
+WriteLiteral("\r\n");
+
+
+ #line 125 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
+ }
else if (canRemoveOwnAttachments)
{
+
#line default
#line hidden
+WriteLiteral(" ");
+
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
- #line 125 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
- Write(CurrentUser.Id);
+ #line 128 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
+ Write(CurrentUser.Id);
#line default
#line hidden
-WriteLiteral("\'));");
+WriteLiteral("\'), quick);");
+
+WriteLiteral("\r\n");
- #line 125 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
- }
+ #line 129 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
+ }
else
{
-
- #line default
- #line hidden
-WriteLiteral("buildAttachment(a, false);");
-
-
- #line 127 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
- }
#line default
#line hidden
-WriteLiteral(@"
- } else {
+WriteLiteral(" ");
+
+WriteLiteral("buildAttachment(a, false, quick);");
+
+WriteLiteral("\r\n");
+
+
+ #line 133 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
+ }
+
+
+ #line default
+ #line hidden
+WriteLiteral(@" } else {
alert('Unable to add attachment: ' + d.Result);
}
},
@@ -516,7 +530,7 @@ WriteLiteral(@"
});
}
- function buildAttachment(a, canRemove) {
+ function buildAttachment(a, canRemove, quick) {
var t = '\';\r\n\r\n var e = $(t);\r
"tr(\'href\', \'");
- #line 147 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
+ #line 152 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentDownload()));
@@ -556,7 +570,7 @@ WriteLiteral(">\';\r\n\r\n var e = $(t);\r
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()));
@@ -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(" ");
- #line 165 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
+ #line 170 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
@@ -621,7 +635,7 @@ WriteLiteral(@"
url: '");
- #line 188 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
+ #line 193 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentRemove()));
@@ -653,7 +667,7 @@ WriteLiteral("\',\r\n dataType: \'json\',
"egion\r\n ");
- #line 220 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
+ #line 225 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
@@ -697,7 +711,7 @@ WriteLiteral(">\r\n Are you sure?\r\n
\r\n 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);
diff --git a/Disco.Web/Views/Job/JobParts/Resources.cshtml b/Disco.Web/Views/Job/JobParts/Resources.cshtml
index 8dcdad3d..72a8c69f 100644
--- a/Disco.Web/Views/Job/JobParts/Resources.cshtml
+++ b/Disco.Web/Views/Job/JobParts/Resources.cshtml
@@ -30,7 +30,7 @@
{
@jl.TechUser.ToString()@if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId == CurrentUser.Id))
- {}@jl.Timestamp.ToFuzzy()
+ {}@jl.Timestamp.ToFuzzy()
}
@@ -313,21 +313,6 @@
var $dialogUpload;
var onLoadNavigation = null;
var isLoaded = null;
- Silverlight.createObject(
- '@(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap)',
- $('#silverlightHostUploadAttachment').get(0),
- 'silverlightUploadAttachment',
- { width: '840px', height: '500px', background: 'white', version: '4.0.60310.0' },
- {
- onLoad: function () {
- if (onLoadNavigation) {
- silverlightUploadAttachment.content.Navigator.Navigate(onLoadNavigation);
- isLoaded = true;
- }
- }
- },
- 'UploadUrl=@(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)))'
- );
var $attachmentInput = $Attachments.find('.attachmentInput');
$attachmentInput.find('.photo').click(function () {
@@ -340,25 +325,42 @@
var silverlightUploadAttachment = $('#silverlightUploadAttachment').get(0);
function showDialog(navigationPath) {
if (!$dialogUpload) {
- $dialogUpload = $('#dialogUpload').dialog({
- autoOpen: false,
- draggable: false,
- modal: true,
- resizable: false,
- width: 860,
- height: 550,
- close: function () {
- silverlightUploadAttachment.content.Navigator.Navigate('/Hidden');
- }
- });
- }
- $dialogUpload.dialog('open');
- if (isLoaded) {
- silverlightUploadAttachment.content.Navigator.Navigate(navigationPath);
- } else {
- onLoadNavigation = navigationPath;
- }
- };
+ 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').get(0).content.Navigator.Navigate(onLoadNavigation);
+ isLoaded = true;
+ }
+ }
+ },
+ 'UploadUrl=@(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null)))'
+ );
+
+ $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
}
@@ -438,12 +440,17 @@
if (d.Result == 'OK') {
var a = d.Attachment;
@if (canRemoveAnyAttachments)
- {buildAttachment(a, true);}
+ {
+ buildAttachment(a, true, quick);
+ }
else if (canRemoveOwnAttachments)
- {buildAttachment(a, (a.AuthorId === '@(CurrentUser.Id)'));}
+ {
+ buildAttachment(a, (a.AuthorId === '@(CurrentUser.Id)'), quick);
+ }
else
- {buildAttachment(a, false);}
-
+ {
+ buildAttachment(a, false, quick);
+ }
} else {
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) {
var t = '
';
if (canRemove)
diff --git a/Disco.Web/Views/Job/JobParts/Resources.generated.cs b/Disco.Web/Views/Job/JobParts/Resources.generated.cs
index 6fd0bbb4..3d0f4300 100644
--- a/Disco.Web/Views/Job/JobParts/Resources.generated.cs
+++ b/Disco.Web/Views/Job/JobParts/Resources.generated.cs
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
//
// 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
// the code is regenerated.
@@ -172,7 +172,7 @@ WriteLiteral("");
#line 32 "..\..\Views\Job\JobParts\Resources.cshtml"
if (canRemoveAnyLogs || (canRemoveOwnLogs && jl.TechUserId == CurrentUser.Id))
- {
+ {
#line default
#line hidden
@@ -184,7 +184,7 @@ WriteLiteral(">");
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
- }
+ }
#line default
#line hidden
@@ -192,21 +192,21 @@ WriteLiteral("(jl.Timestamp.ToFullDateTime()
+ , Tuple.Create(Tuple.Create("", 1820), Tuple.Create(jl.Timestamp.ToFullDateTime()
#line default
#line hidden
-, 1827), false)
+, 1820), false)
);
WriteLiteral(">");
#line 33 "..\..\Views\Job\JobParts\Resources.cshtml"
- Write(jl.Timestamp.ToFuzzy());
+ Write(jl.Timestamp.ToFuzzy());
#line default
@@ -295,14 +295,14 @@ WriteLiteral(" (canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
+, Tuple.Create(Tuple.Create("", 2490), Tuple.Create(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
#line default
#line hidden
-, 2497), false)
+, 2490), false)
);
WriteLiteral(">\r\n \r\n");
#line hidden
WriteLiteral(" (Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
+, Tuple.Create(Tuple.Create("", 2732), Tuple.Create(Url.Action(MVC.API.Job.AttachmentDownload(ja.Id))
#line default
#line hidden
-, 2739), false)
+, 2732), false)
);
WriteLiteral(" data-attachmentid=\"");
@@ -363,42 +363,42 @@ WriteLiteral(">\r\n (ja.Filename
+, Tuple.Create(Tuple.Create("", 2896), Tuple.Create(ja.Filename
#line default
#line hidden
-, 2903), false)
+, 2896), false)
);
WriteLiteral(">\r\n (Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
+, Tuple.Create(Tuple.Create("", 2981), Tuple.Create(Url.Action(MVC.API.Job.AttachmentThumbnail(ja.Id))
#line default
#line hidden
-, 2988), false)
+, 2981), false)
);
WriteLiteral(" />\r\n |