security: use more antiforgery tokens

This commit is contained in:
Gary Sharp
2025-07-25 12:32:44 +10:00
parent fd43d85778
commit 7deead494b
222 changed files with 12919 additions and 11728 deletions
@@ -6,16 +6,20 @@
<div id="DeviceDetailTab-Certificates" class="DevicePart">
<div class="genericData certificateTable">
@if (Model.Certificates.Count() > 0)
{
{
<table class="genericData certificateTable">
<tr>
<th>Name
<th>
Name
</th>
<th>Enabled
<th>
Enabled
</th>
<th>Allocated
<th>
Allocated
</th>
<th>Expires
<th>
Expires
</th>
</tr>
@foreach (var item in Model.Certificates)
@@ -24,7 +28,7 @@
<td>
@if (hasDownloadCert)
{
@Html.ActionLink(item.Name, MVC.API.DeviceCertificate.Download(item.Id))
<a href="#" class="certificateDownload" data-id="@item.Id">@item.Name</a>
}
else
{
@@ -43,9 +47,28 @@
</tr>
}
</table>
if (hasDownloadCert)
{
using (Html.BeginForm(MVC.API.DeviceCertificate.Download()))
{
@Html.AntiForgeryToken()
<input type="hidden" name="id" />
}
<script>
$(function () {
$('#DeviceDetailTab-Certificates').on('click', '.certificateDownload', function (e) {
e.preventDefault();
const form = $('#DeviceDetailTab-Certificates').find('form');
form.find('input[name="id"]').val($(this).attr('data-id'));
form.trigger('submit');
return false;
})
})
</script>
}
}
else
{
{
<span class="smallMessage">No Certificates Allocated</span>
}
</div>
@@ -73,7 +73,7 @@ WriteLiteral(">\r\n");
#line 8 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
if (Model.Certificates.Count() > 0)
{
{
#line default
@@ -84,25 +84,29 @@ WriteLiteral(" class=\"genericData certificateTable\"");
WriteLiteral(@">
<tr>
<th>Name
<th>
Name
</th>
<th>Enabled
<th>
Enabled
</th>
<th>Allocated
<th>
Allocated
</th>
<th>Expires
<th>
Expires
</th>
</tr>
");
#line 21 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 25 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line default
#line hidden
#line 21 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 25 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
foreach (var item in Model.Certificates)
{
@@ -112,29 +116,49 @@ WriteLiteral(@">
WriteLiteral(" <tr>\r\n <td>\r\n");
#line 25 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 29 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line default
#line hidden
#line 25 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 29 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
if (hasDownloadCert)
{
#line default
#line hidden
#line 27 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
Write(Html.ActionLink(item.Name, MVC.API.DeviceCertificate.Download(item.Id)));
#line default
#line hidden
WriteLiteral(" <a");
WriteLiteral(" href=\"#\"");
WriteLiteral(" class=\"certificateDownload\"");
WriteLiteral(" data-id=\"");
#line 27 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 31 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
Write(item.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">");
#line 31 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
Write(item.Name);
#line default
#line hidden
WriteLiteral("</a>\r\n");
#line 32 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
}
else
{
@@ -143,14 +167,14 @@ WriteLiteral(" <tr>\r\n <td>\r\n");
#line default
#line hidden
#line 31 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 35 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
Write(item.Name);
#line default
#line hidden
#line 31 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 35 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
}
@@ -162,7 +186,7 @@ WriteLiteral(" </td>\r\n <td>\r\n"
WriteLiteral(" ");
#line 35 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 39 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
Write(item.Enabled);
@@ -173,7 +197,7 @@ WriteLiteral("\r\n </td>\r\n <td>\
WriteLiteral(" ");
#line 38 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 42 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
Write(CommonHelpers.FriendlyDate(item.AllocatedDate));
@@ -184,7 +208,7 @@ WriteLiteral("\r\n </td>\r\n <td>\
WriteLiteral(" ");
#line 41 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 45 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
Write(CommonHelpers.FriendlyDate(item.ExpirationDate));
@@ -193,7 +217,7 @@ WriteLiteral(" ");
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
#line 44 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 48 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
}
@@ -202,10 +226,63 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n
WriteLiteral(" </table>\r\n");
#line 46 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 50 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
if (hasDownloadCert)
{
using (Html.BeginForm(MVC.API.DeviceCertificate.Download()))
{
#line default
#line hidden
#line 54 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
#line 54 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line default
#line hidden
WriteLiteral(" <input");
WriteLiteral(" type=\"hidden\"");
WriteLiteral(" name=\"id\"");
WriteLiteral(" />\r\n");
#line 56 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
}
#line default
#line hidden
WriteLiteral(@" <script>
$(function () {
$('#DeviceDetailTab-Certificates').on('click', '.certificateDownload', function (e) {
e.preventDefault();
const form = $('#DeviceDetailTab-Certificates').find('form');
form.find('input[name=""id""]').val($(this).attr('data-id'));
form.trigger('submit');
return false;
})
})
</script>
");
#line 68 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
}
}
else
{
{
#line default
@@ -217,7 +294,7 @@ WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">No Certificates Allocated</span>\r\n");
#line 50 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 73 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
}
@@ -227,7 +304,7 @@ WriteLiteral(" </div>\r\n <script>\r\n $(\'#DeviceDetailTabItems\')
"\"#DeviceDetailTab-Certificates\">Certificates [");
#line 53 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
#line 76 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
Write(Model.Certificates.Count);
@@ -6,7 +6,6 @@
var canRemoveOwnComments = Authorization.Has(Claims.Device.Actions.RemoveOwnComments);
}
<div id="Comments" class="@(canAddComments ? "canAddComments" : "cannotAddComments") @(canRemoveAnyComments ? "canRemoveAnyComments" : "cannotRemoveAnyComments") @(canRemoveOwnComments ? "canRemoveOwnComments" : "cannotRemoveOwnComments")" data-id="@Model.Device.SerialNumber" data-userid="@CurrentUser.UserId" data-addurl="@Url.Action(MVC.API.Device.CommentAdd(Model.Device.SerialNumber))" data-removeurl="@Url.Action(MVC.API.Device.CommentRemove())" data-geturl="@Url.Action(MVC.API.Device.Comment())">
@Html.AntiForgeryToken()
@if (canAddComments)
{
<div class="commentInput">
@@ -48,7 +47,7 @@
}
async function onCommentAddedAsync(id) {
const formData = new FormData();
formData.append('__RequestVerificationToken', $comments.find('input[name="__RequestVerificationToken"]').val());
formData.append('__RequestVerificationToken', document.body.dataset.antiforgery);
formData.append('id', id);
const response = await fetch($comments.attr('data-geturl'), {
@@ -136,7 +135,7 @@
$commentInput.prop('disabled', true);
const formData = new FormData();
formData.append('__RequestVerificationToken', $comments.find('input[name="__RequestVerificationToken"]').val());
formData.append('__RequestVerificationToken', document.body.dataset.antiforgery);
formData.append('comment', comment);
const response = await fetch($comments.attr('data-addurl'), {
@@ -194,7 +193,7 @@
}
async function removeCommentAsync(commentId) {
const formData = new FormData();
formData.append('__RequestVerificationToken', $comments.find('input[name="__RequestVerificationToken"]').val());
formData.append('__RequestVerificationToken', document.body.dataset.antiforgery);
formData.append('id', commentId);
const response = await fetch($comments.attr('data-removeurl'), {
@@ -139,25 +139,14 @@ WriteLiteral("\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 9 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
WriteLiteral("\r\n");
#line 10 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line default
#line hidden
#line 10 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 9 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
if (canAddComments)
{
@@ -189,7 +178,7 @@ WriteLiteral(" class=\"fa fa-comment\"");
WriteLiteral("></i></button>\r\n </div>\r\n");
#line 16 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 15 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
}
@@ -202,13 +191,13 @@ WriteLiteral(" class=\"commentOutput\"");
WriteLiteral(">\r\n");
#line 18 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 17 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line default
#line hidden
#line 18 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 17 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
foreach (var c in Model.Device.DeviceComments.OrderBy(m => m.Timestamp))
{
@@ -222,7 +211,7 @@ WriteLiteral(" class=\"comment\"");
WriteLiteral(" data-commentid=\"");
#line 20 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 19 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(c.Id);
@@ -237,7 +226,7 @@ WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 21 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 20 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(c.TechUser.ToStringFriendly());
@@ -246,7 +235,7 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 21 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 20 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
if (canRemoveAnyComments || (canRemoveOwnComments && c.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{
@@ -259,7 +248,7 @@ WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>");
#line 22 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 21 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
}
#line default
@@ -271,7 +260,7 @@ WriteLiteral(" class=\"timestamp\"");
WriteLiteral(" data-livestamp=\"");
#line 22 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 21 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(c.Timestamp.ToUnixEpoc());
@@ -279,20 +268,20 @@ WriteLiteral(" data-livestamp=\"");
#line hidden
WriteLiteral("\"");
WriteAttribute("title", Tuple.Create(" title=\"", 1737), Tuple.Create("\"", 1774)
WriteAttribute("title", Tuple.Create(" title=\"", 1707), Tuple.Create("\"", 1744)
#line 22 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
, Tuple.Create(Tuple.Create("", 1745), Tuple.Create<System.Object, System.Int32>(c.Timestamp.ToFullDateTime()
#line 21 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
, Tuple.Create(Tuple.Create("", 1715), Tuple.Create<System.Object, System.Int32>(c.Timestamp.ToFullDateTime()
#line default
#line hidden
, 1745), false)
, 1715), false)
);
WriteLiteral(">");
#line 22 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 21 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(c.Timestamp.ToFullDateTime());
@@ -305,7 +294,7 @@ WriteLiteral(" class=\"comment\"");
WriteLiteral(">");
#line 23 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 22 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
Write(c.Comments.ToHtmlComment());
@@ -314,7 +303,7 @@ WriteLiteral(">");
WriteLiteral("</div>\r\n </div>\r\n");
#line 25 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 24 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
}
@@ -331,40 +320,40 @@ WriteLiteral(" </div>\r\n</div>\r\n<script>\r\n if (!document.DiscoFunctio
"croll to Bottom\r\n }\r\n });\r\n\r\n function onCommentAdded(i" +
"d) {\r\n onCommentAddedAsync(id);\r\n }\r\n async function on" +
"CommentAddedAsync(id) {\r\n const formData = new FormData();\r\n " +
" formData.append(\'__RequestVerificationToken\', $comments.find(\'input[name=\"__R" +
"equestVerificationToken\"]\').val());\r\n formData.append(\'id\', id);\r\n\r\n " +
" const response = await fetch($comments.attr(\'data-geturl\'), {\r\n " +
" method: \'POST\',\r\n body: formData\r\n });\r\n\r\n " +
" if (!response.ok) {\r\n alert(\'Unable to load live commen" +
"t \' + id + \': \' + response.statusText);\r\n } else {\r\n c" +
"onst comment = await response.json();\r\n\r\n if ($comments.hasClass(" +
"\'canRemoveAnyComments\'))\r\n renderComment(comment, false, true" +
");\r\n else if ($comments.hasClass(\'canRemoveOwnComments\'))\r\n " +
" renderComment(comment, false, (comment.AuthorId === $comments.attr" +
"(\'data-userid\')));\r\n else\r\n renderComment(comm" +
"ent, false, false);\r\n }\r\n }\r\n function onCommentRemoved" +
"(id) {\r\n $commentOutput.children(\'div[data-commentid=\"\' + id + \'\"]\')." +
"slideUp(300).delay(300).queue(function () {\r\n const $this = $(thi" +
"s);\r\n $this.find(\'.timestamp\').livestamp(\'destroy\');\r\n " +
" $this.remove();\r\n });\r\n }\r\n function renderComment" +
"(c, quick, canRemove) {\r\n let t = \'<div><span class=\"author\" />\';\r\n " +
" if (canRemove)\r\n t += \'<span class=\"remove fa fa-times-" +
"circle\" />\';\r\n t += \'<span class=\"timestamp\" /><div class=\"comment\" /" +
"></div>\';\r\n\r\n const e = $(t);\r\n e.attr(\'data-commentid\', c" +
".Id);\r\n e.find(\'.author\').text(c.Author);\r\n e.find(\'.times" +
"tamp\').text(c.TimestampFull).attr(\'title\', c.TimestampFull).livestamp(c.Timestam" +
"pUnixEpoc);\r\n e.find(\'.comment\').html(c.HtmlComments);\r\n\r\n " +
" $commentOutput.append(e);\r\n\r\n if (!quick) {\r\n e.anima" +
"te({ backgroundColor: \'#ffff99\' }, 500, function () {\r\n e.ani" +
"mate({ backgroundColor: \'#fafafa\' }, 500, function () {\r\n " +
" e.css(\'background-color\', \'\');\r\n });\r\n });\r\n " +
" $commentOutput.animate({ scrollTop: $commentOutput[0].scrollHeigh" +
"t }, 250)\r\n }\r\n }\r\n\r\n document.DiscoFunctions.onComment" +
"Added = onCommentAdded;\r\n document.DiscoFunctions.onCommentRemoved = onCo" +
"mmentRemoved;\r\n });\r\n</script>\r\n");
" formData.append(\'__RequestVerificationToken\', document.body.dataset.antiforge" +
"ry);\r\n formData.append(\'id\', id);\r\n\r\n const response = awa" +
"it fetch($comments.attr(\'data-geturl\'), {\r\n method: \'POST\',\r\n " +
" body: formData\r\n });\r\n\r\n if (!response.ok) {\r\n" +
" alert(\'Unable to load live comment \' + id + \': \' + response.stat" +
"usText);\r\n } else {\r\n const comment = await response.j" +
"son();\r\n\r\n if ($comments.hasClass(\'canRemoveAnyComments\'))\r\n " +
" renderComment(comment, false, true);\r\n else if ($c" +
"omments.hasClass(\'canRemoveOwnComments\'))\r\n renderComment(com" +
"ment, false, (comment.AuthorId === $comments.attr(\'data-userid\')));\r\n " +
" else\r\n renderComment(comment, false, false);\r\n " +
" }\r\n }\r\n function onCommentRemoved(id) {\r\n $commentOut" +
"put.children(\'div[data-commentid=\"\' + id + \'\"]\').slideUp(300).delay(300).queue(f" +
"unction () {\r\n const $this = $(this);\r\n $this.find" +
"(\'.timestamp\').livestamp(\'destroy\');\r\n $this.remove();\r\n " +
" });\r\n }\r\n function renderComment(c, quick, canRemove) {\r\n " +
" let t = \'<div><span class=\"author\" />\';\r\n if (canRemove)\r\n " +
" t += \'<span class=\"remove fa fa-times-circle\" />\';\r\n t += " +
"\'<span class=\"timestamp\" /><div class=\"comment\" /></div>\';\r\n\r\n const " +
"e = $(t);\r\n e.attr(\'data-commentid\', c.Id);\r\n e.find(\'.aut" +
"hor\').text(c.Author);\r\n e.find(\'.timestamp\').text(c.TimestampFull).at" +
"tr(\'title\', c.TimestampFull).livestamp(c.TimestampUnixEpoc);\r\n e.find" +
"(\'.comment\').html(c.HtmlComments);\r\n\r\n $commentOutput.append(e);\r\n\r\n " +
" if (!quick) {\r\n e.animate({ backgroundColor: \'#ffff99\'" +
" }, 500, function () {\r\n e.animate({ backgroundColor: \'#fafaf" +
"a\' }, 500, function () {\r\n e.css(\'background-color\', \'\');" +
"\r\n });\r\n });\r\n $commentOutput.a" +
"nimate({ scrollTop: $commentOutput[0].scrollHeight }, 250)\r\n }\r\n " +
" }\r\n\r\n document.DiscoFunctions.onCommentAdded = onCommentAdded;\r\n " +
" document.DiscoFunctions.onCommentRemoved = onCommentRemoved;\r\n });\r\n</scrip" +
"t>\r\n");
#line 107 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 106 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
if (canAddComments)
{
@@ -385,25 +374,25 @@ WriteLiteral(" <script>\r\n $(function () {\r\n const $comm
" alert(\'Enter a comment to post\');\r\n $commentInput.focus(" +
");\r\n return;\r\n }\r\n\r\n $commentIn" +
"put.prop(\'disabled\', true);\r\n\r\n const formData = new FormData();\r" +
"\n formData.append(\'__RequestVerificationToken\', $comments.find(\'i" +
"nput[name=\"__RequestVerificationToken\"]\').val());\r\n formData.appe" +
"nd(\'comment\', comment);\r\n\r\n const response = await fetch($comment" +
"s.attr(\'data-addurl\'), {\r\n method: \'POST\',\r\n " +
" body: formData\r\n });\r\n\r\n if (response.ok) {\r\n " +
" $commentInput.val(\'\').prop(\'disabled\', false).focus();\r\n " +
" } else {\r\n alert(\'Unable to add comment: \' + respon" +
"se.statusText);\r\n $commentInput.prop(\'disabled\', false).focus" +
"();\r\n }\r\n }\r\n });\r\n </script>\r\n");
"\n formData.append(\'__RequestVerificationToken\', document.body.dat" +
"aset.antiforgery);\r\n formData.append(\'comment\', comment);\r\n\r\n " +
" const response = await fetch($comments.attr(\'data-addurl\'), {\r\n " +
" method: \'POST\',\r\n body: formData\r\n " +
" });\r\n\r\n if (response.ok) {\r\n $commentInput" +
".val(\'\').prop(\'disabled\', false).focus();\r\n } else {\r\n " +
" alert(\'Unable to add comment: \' + response.statusText);\r\n " +
" $commentInput.prop(\'disabled\', false).focus();\r\n }\r\n " +
" }\r\n });\r\n </script>\r\n");
#line 156 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 155 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
}
#line default
#line hidden
#line 157 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 156 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
if (canRemoveAnyComments || canRemoveOwnComments)
{
@@ -430,17 +419,16 @@ WriteLiteral(" <script>\r\n $(function () {\r\n const $comm
" $dialogRemove.dialog(\"close\");\r\n }\r\n }).dialo" +
"g(\'open\');\r\n }\r\n async function removeCommentAsync(comment" +
"Id) {\r\n const formData = new FormData();\r\n formDat" +
"a.append(\'__RequestVerificationToken\', $comments.find(\'input[name=\"__RequestVeri" +
"ficationToken\"]\').val());\r\n formData.append(\'id\', commentId);\r\n\r\n" +
" const response = await fetch($comments.attr(\'data-removeurl\'), {" +
"\r\n method: \'POST\',\r\n body: formData\r\n " +
" });\r\n\r\n if (!response.ok) {\r\n alert" +
"(\'Unable to remove comment: \' + response.statusText);\r\n }\r\n " +
" $dialogRemove.dialog(\"close\");\r\n }\r\n });\r\n </scri" +
"pt>\r\n");
"a.append(\'__RequestVerificationToken\', document.body.dataset.antiforgery);\r\n " +
" formData.append(\'id\', commentId);\r\n\r\n const response " +
"= await fetch($comments.attr(\'data-removeurl\'), {\r\n method: \'" +
"POST\',\r\n body: formData\r\n });\r\n\r\n " +
" if (!response.ok) {\r\n alert(\'Unable to remove comment: \' +" +
" response.statusText);\r\n }\r\n $dialogRemove.dialog(" +
"\"close\");\r\n }\r\n });\r\n </script>\r\n");
#line 212 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
#line 211 "..\..\Views\Device\DeviceParts\_Comments.cshtml"
}
@@ -18,8 +18,7 @@
<table id="deviceShowResources">
<tr>
<td id="AttachmentsContainer">
<div id="Attachments" class="@(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments") @(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments") @(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments")" data-userid="@CurrentUser.UserId" data-uploadurl="@(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)))" data-onlineuploadurl="@(Url.Action(MVC.API.Device.AttachmentOnlineUploadSession(Model.Device.SerialNumber)))" data-qrcodeurl="@Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js")">
@Html.AntiForgeryToken()
<div id="Attachments" class="@(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments") @(canRemoveAnyAttachments ? "canRemoveAnyAttachments" : "cannotRemoveAnyAttachments") @(canRemoveOwnAttachments ? "canRemoveOwnAttachments" : "cannotRemoveOwnAttachments")" data-userid="@CurrentUser.UserId" data-uploadurl="@(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)))" data-onlineuploadurl="@(Url.Action(MVC.API.Device.AttachmentOnlineUploadSession(Model.Device.SerialNumber)))" data-qrcodeurl="@Url.Content("~/ClientSource/Scripts/Modules/qrcode.min.js")" data-removeurl="@Url.Action(MVC.API.Device.AttachmentRemove())">
<div class="Disco-AttachmentUpload-DropTarget">
<h2>Drop Attachments Here</h2>
</div>
@@ -236,8 +235,6 @@
function removeAttachment() {
$this = $(this).closest('a');
var data = { id: $this.attr('data-attachmentid') };
if (!$dialogRemoveAttachment) {
$dialogRemoveAttachment = $('#dialogRemoveAttachment').dialog({
resizable: false,
@@ -247,35 +244,36 @@
});
}
$dialogRemoveAttachment.dialog("enable");
async function removeAttachmentAsync(id) {
const body = new FormData();
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
body.append('id', id);
try {
const response = await fetch($Attachments.attr('data-removeurl'), {
body: body,
method: 'POST'
});
if (!response.ok) {
alert('Unable to remove attachment: ' + response.statusText);
}
$dialogRemoveAttachment.dialog("close");
} catch (e) {
alert('Unable to remove attachment: ' + e);
$dialogRemoveAttachment.dialog("close");
}
}
const attachmentId = $this.attr('data-attachmentid');
$dialogRemoveAttachment.dialog('option', 'buttons', {
"Remove": function () {
$dialogRemoveAttachment.dialog("disable");
$dialogRemoveAttachment.dialog("option", "buttons", null);
$.ajax({
url: '@Url.Action(MVC.API.Device.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");
}
});
removeAttachmentAsync(attachmentId);
},
Cancel: function () {
$dialogRemoveAttachment.dialog("close");
}
});
$dialogRemoveAttachment.dialog('open');
}).dialog('open');
return false;
}
@@ -149,18 +149,18 @@ WriteLiteral(" data-qrcodeurl=\"");
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
WriteLiteral(" data-removeurl=\"");
#line 22 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Html.AntiForgeryToken());
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentRemove()));
#line default
#line hidden
WriteLiteral("\r\n <div");
WriteLiteral("\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" class=\"Disco-AttachmentUpload-DropTarget\"");
@@ -172,13 +172,13 @@ WriteLiteral(" class=\"attachmentOutput\"");
WriteLiteral(">\r\n");
#line 27 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 26 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line default
#line hidden
#line 27 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 26 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (Model.Device.DeviceAttachments != null)
{
foreach (var da in Model.Device.DeviceAttachments.OrderByDescending(a => a.Id))
@@ -189,20 +189,20 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <a");
WriteAttribute("href", Tuple.Create(" href=\"", 1912), Tuple.Create("\"", 1972)
WriteAttribute("href", Tuple.Create(" href=\"", 1930), Tuple.Create("\"", 1990)
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1919), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentDownload(da.Id))
#line 30 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 1937), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentDownload(da.Id))
#line default
#line hidden
, 1919), false)
, 1937), false)
);
WriteLiteral(" data-attachmentid=\"");
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 30 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.Id);
@@ -213,7 +213,7 @@ WriteLiteral("\"");
WriteLiteral(" data-mimetype=\"");
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 30 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.MimeType);
@@ -225,28 +225,28 @@ WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"icon\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2086), Tuple.Create("\"", 2106)
WriteAttribute("title", Tuple.Create(" title=\"", 2104), Tuple.Create("\"", 2124)
#line 32 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2094), Tuple.Create<System.Object, System.Int32>(da.Filename
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2112), Tuple.Create<System.Object, System.Int32>(da.Filename
#line default
#line hidden
, 2094), false)
, 2112), false)
);
WriteLiteral(">\r\n <img");
WriteLiteral(" alt=\"Attachment Thumbnail\"");
WriteAttribute("src", Tuple.Create(" src=\"", 2181), Tuple.Create("\"", 2243)
WriteAttribute("src", Tuple.Create(" src=\"", 2199), Tuple.Create("\"", 2261)
#line 33 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2187), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id))
#line 32 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2205), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id))
#line default
#line hidden
, 2187), false)
, 2205), false)
);
WriteLiteral(" />\r\n </span>\r\n " +
@@ -254,40 +254,40 @@ WriteLiteral(" />\r\n </span>\r\n
WriteLiteral(" class=\"comments\"");
WriteAttribute("title", Tuple.Create(" title=\"", 2352), Tuple.Create("\"", 2389)
WriteAttribute("title", Tuple.Create(" title=\"", 2370), Tuple.Create("\"", 2407)
#line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2360), Tuple.Create<System.Object, System.Int32>(da.Comments ?? da.Filename
#line 34 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 2378), Tuple.Create<System.Object, System.Int32>(da.Comments ?? da.Filename
#line default
#line hidden
, 2360), false)
, 2378), false)
);
WriteLiteral(">\r\n");
#line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line default
#line hidden
#line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (!string.IsNullOrEmpty(da.DocumentTemplateId))
{
#line default
#line hidden
#line 37 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.DocumentTemplate.Description);
#line default
#line hidden
#line 37 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 36 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
else
{
@@ -295,14 +295,14 @@ WriteLiteral(">\r\n");
#line default
#line hidden
#line 39 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 38 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.Comments ?? da.Filename);
#line default
#line hidden
#line 39 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 38 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
#line default
@@ -314,7 +314,7 @@ WriteLiteral(" class=\"author\"");
WriteLiteral(">");
#line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 39 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.TechUser.ToString());
@@ -323,7 +323,7 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 39 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && da.TechUserId.Equals(CurrentUser.UserId, StringComparison.OrdinalIgnoreCase)))
{
@@ -336,7 +336,7 @@ WriteLiteral(" class=\"remove fa fa-times-circle\"");
WriteLiteral("></span>");
#line 41 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
#line default
@@ -345,20 +345,20 @@ WriteLiteral("<span");
WriteLiteral(" class=\"timestamp\"");
WriteAttribute("title", Tuple.Create(" title=\"", 3044), Tuple.Create("\"", 3082)
WriteAttribute("title", Tuple.Create(" title=\"", 3062), Tuple.Create("\"", 3100)
#line 41 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3052), Tuple.Create<System.Object, System.Int32>(da.Timestamp.ToFullDateTime()
#line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
, Tuple.Create(Tuple.Create("", 3070), Tuple.Create<System.Object, System.Int32>(da.Timestamp.ToFullDateTime()
#line default
#line hidden
, 3052), false)
, 3070), false)
);
WriteLiteral(" data-livestamp=\"");
#line 41 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.Timestamp.ToUnixEpoc());
@@ -369,7 +369,7 @@ WriteLiteral("\"");
WriteLiteral(">");
#line 41 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(da.Timestamp.ToFullDateTime());
@@ -378,7 +378,7 @@ WriteLiteral(">");
WriteLiteral("</span>\r\n </a>\r\n");
#line 43 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 42 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
}
@@ -388,13 +388,13 @@ WriteLiteral("</span>\r\n </a>\r\n");
WriteLiteral(" </div>\r\n");
#line 46 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 45 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line default
#line hidden
#line 46 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 45 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canAddAttachments)
{
@@ -432,7 +432,7 @@ WriteLiteral(" title=\"Upload with Online Services\"");
WriteLiteral("></span>\r\n </div>\r\n");
#line 52 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 51 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
@@ -459,7 +459,7 @@ WriteLiteral(@">
url: '");
#line 67 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 66 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.Attachment()));
@@ -492,7 +492,7 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n
"tachmentid\', a.Id).attr(\'data-mimetype\', a.MimeType).attr(\'href\', \'");
#line 98 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 97 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentDownload()));
@@ -524,7 +524,7 @@ WriteLiteral(@"/' + a.Id);
img.attr('src', '");
#line 121 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 120 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentThumbnail()));
@@ -577,13 +577,13 @@ WriteLiteral("/\' + a.Id + \'?v=\' + retryCount);\r\n
".onAttachmentRemoved = onAttachmentRemoved;\r\n\r\n");
#line 183 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 182 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line default
#line hidden
#line 183 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 182 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canAddAttachments)
{
@@ -630,7 +630,7 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
" //#endregion\r\n ");
#line 230 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 229 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
@@ -639,68 +639,50 @@ WriteLiteral("\r\n //#region Add Attachments\r\n
WriteLiteral(" ");
#line 231 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 230 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
{
#line default
#line hidden
WriteLiteral(@"
//#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: '");
WriteLiteral("\r\n //#region Remove Attachments\r\n " +
" $attachmentOutput.find(\'span.remove\').click(removeAttachment);\r\n\r\n " +
" function removeAttachment() {\r\n " +
" $this = $(this).closest(\'a\');\r\n\r\n if (!$dialo" +
"gRemoveAttachment) {\r\n $dialogRemoveAttachmen" +
"t = $(\'#dialogRemoveAttachment\').dialog({\r\n " +
" resizable: false,\r\n height: 140,\r\n " +
" modal: true,\r\n " +
" autoOpen: false\r\n });\r\n " +
" }\r\n\r\n async function removeAt" +
"tachmentAsync(id) {\r\n const body = new FormDa" +
"ta();\r\n body.append(\'__RequestVerificationTok" +
"en\', document.body.dataset.antiforgery);\r\n bo" +
"dy.append(\'id\', id);\r\n\r\n try {\r\n " +
" const response = await fetch($Attachments.attr(\'data-" +
"removeurl\'), {\r\n body: body,\r\n " +
" method: \'POST\'\r\n " +
" });\r\n if (!response.ok) {\r\n " +
" alert(\'Unable to remove attachment: \'" +
" + response.statusText);\r\n }\r\n " +
" $dialogRemoveAttachment.dialog(\"close\");\r\n " +
" } catch (e) {\r\n " +
" alert(\'Unable to remove attachment: \' + e);\r\n " +
" $dialogRemoveAttachment.dialog(\"close\");\r\n " +
" }\r\n }\r\n\r\n con" +
"st attachmentId = $this.attr(\'data-attachmentid\');\r\n " +
" $dialogRemoveAttachment.dialog(\'option\', \'buttons\', {\r\n " +
" \"Remove\": function () {\r\n " +
"$dialogRemoveAttachment.dialog(\"option\", \"buttons\", null);\r\n " +
" removeAttachmentAsync(attachmentId);\r\n " +
" },\r\n Cancel: function () {\r\n " +
" $dialogRemoveAttachment.dialog(\"close\");\r\n " +
" }\r\n }).dialog(" +
"\'open\');\r\n\r\n return false;\r\n " +
" }\r\n //#endregion\r\n ");
#line 256 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Url.Action(MVC.API.Device.AttachmentRemove()));
#line default
#line hidden
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
" data: data,\r\n " +
" 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 //#" +
"endregion\r\n ");
#line 283 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 281 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
}
@@ -737,7 +719,7 @@ WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n </div>\r\n <scr
"etailTab-ResourcesLink\">Attachments [");
#line 304 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
#line 302 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
Write(Model.Device.DeviceAttachments == null ? 0 : Model.Device.DeviceAttachments.Count);
+170 -167
View File
@@ -148,34 +148,43 @@
}
}
}
<span id="Device_Show_Details_Status_LastSeen" class="@lastSeenClass">@CommonHelpers.FriendlyDate(Model.Device.LastNetworkLogonDate)</span>
<span id="Device_Show_Details_Status_LastSeen" class="@lastSeenClass" data-updateurl="@(Url.Action(MVC.API.Device.LastNetworkLogonDate(Model.Device.SerialNumber)))">@CommonHelpers.FriendlyDate(Model.Device.LastNetworkLogonDate)</span>
</td>
@if (!string.IsNullOrEmpty(Model.Device.ComputerName))
{
<script type="text/javascript">
$(function () {
var updated = false;
var span = $('#Device_Show_Details_Status_LastSeen');
var spanProgress = null;
const span = $('#Device_Show_Details_Status_LastSeen');
let updated = false;
let spanProgress = null;
$.getJSON('@(Url.Action(MVC.API.Device.LastNetworkLogonDate(Model.Device.SerialNumber)))', function (response, result) {
async function updateLastNetworkLogonDate() {
const body = new FormData();
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
const response = await fetch(span.attr('data-updateurl'), {
method: 'POST',
body: body
});
updated = true;
if (spanProgress)
spanProgress.remove();
if (result != 'success') {
alert('Unable to retrieve latest network logon date:\n' + response);
if (!response.ok) {
alert('Unable to retrieve latest network logon date:\n' + response.statusText);
$('<span>').addClass('smallMessage').text('[may not be current]').appendTo(span);
} else {
const result = await response.json();
var spanClasses = '',
diff = moment().valueOf() - response.UnixEpoc;
diff = moment().valueOf() - result.UnixEpoc;
if (diff > 2592000000) // 30 Days
spanClasses = 'error';
else if (diff > 604800000) // 7 Days
spanClasses = 'alert';
span.removeClass('alert error').addClass(spanClasses).attr('title', response.Formatted).text(response.Formatted).livestamp(response.UnixEpoc);
span.removeClass('alert error').addClass(spanClasses).attr('title', result.Formatted).text(result.Formatted).livestamp(result.UnixEpoc);
}
});
}
updateLastNetworkLogonDate();
window.setTimeout(function () {
if (!updated) {
spanProgress = $('<i>').addClass('ajaxLoading showInitially').attr('title', 'Loading...').appendTo(span);
@@ -223,11 +232,11 @@
{
if (!string.IsNullOrWhiteSpace(assignedUser.PhoneNumber))
{
<div id="Device_Show_User_PhoneNumber" title="Phone Number"><a href="tel:@assignedUser.PhoneNumber" data-clipboard>@assignedUser.PhoneNumber</a></div>
<div id="Device_Show_User_PhoneNumber" title="Phone Number"><a href="tel:@assignedUser.PhoneNumber" data-clipboard>@assignedUser.PhoneNumber</a></div>
}
if (!string.IsNullOrWhiteSpace(assignedUser.EmailAddress))
{
<div id="Device_Show_User_EmailAddress" title="Email Address"><a href="mailto:@(Model.Device.AssignedUser.EmailAddress)" data-clipboard="@assignedUser.DisplayName &lt;@assignedUser.EmailAddress&gt;">@assignedUser.EmailAddress</a></div>
<div id="Device_Show_User_EmailAddress" title="Email Address"><a href="mailto:@(Model.Device.AssignedUser.EmailAddress)" data-clipboard="@assignedUser.DisplayName &lt;@assignedUser.EmailAddress&gt;">@assignedUser.EmailAddress</a></div>
}
}
@if (Authorization.Has(Claims.User.ShowFlagAssignments))
@@ -550,26 +559,29 @@
}
@if (Model.Device.CanUpdateDeviceBatch())
{
@Html.ActionLinkSmallButton("Update Batch", MVC.API.Device.UpdateDeviceBatchId(Model.Device.SerialNumber, null, true), "Device_Show_Policies_Batch_Actions_Update_Button")
<button id="Device_Show_Policies_Batch_Actions_Update_Button" class="button small">Update Batch</button>
<div id="Device_Show_Policies_Batch_Actions_Update_Dialog" class="dialog" title="Assign to Device Batch">
<div>
<ul class="none">
@foreach (var db in Model.DeviceBatches.OrderBy(i => i.Name))
{
var isDecommissioned = Model.DecommissionedDeviceBatchIds.Contains(db.Id);
<li class="@(isDecommissioned ? "hidden" : null)">
<label title="Purchased: @(db.PurchaseDate.ToLongDateString())">
<input type="radio" data-devicebatchid="@db.Id" name="DeviceBatch" />
@db.Name
</label>
</li>
if (isDecommissioned)
@using (Html.BeginForm(MVC.API.Device.UpdateDeviceBatchId(Model.Device.SerialNumber, null, true)))
{
@Html.AntiForgeryToken()
<ul class="none">
@foreach (var db in Model.DeviceBatches.OrderBy(i => i.Name))
{
<li class="hidden decommissioned-padding"></li>
var isDecommissioned = Model.DecommissionedDeviceBatchIds.Contains(db.Id);
<li class="@(isDecommissioned ? "hidden" : null)">
<label title="Purchased: @(db.PurchaseDate.ToLongDateString())">
<input type="radio" data-devicebatchid="@db.Id" name="DeviceBatchId" value="@db.Id" />
@db.Name
</label>
</li>
if (isDecommissioned)
{
<li class="hidden decommissioned-padding"></li>
}
}
}
</ul>
</ul>
}
@if (Model.DecommissionedDeviceBatchIds.Count > 0)
{
<a class="button small show-decommissioned" href="#">Show Decommissioned</a>
@@ -598,10 +610,9 @@
var deviceBatchId = dialogInputs.filter(':checked').attr('data-devicebatchid');
if (deviceBatchId) {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
window.location.href = button.attr('href') + '&DeviceBatchId=' + deviceBatchId;
$(this)
.dialog("option", "buttons", null)
.find('form').trigger('submit');
} else {
alert('A device batch must be selected');
}
@@ -677,6 +688,7 @@
<br />
@using (Html.BeginForm(MVC.API.Device.UpdateAssignedUserId(Model.Device.SerialNumber, redirect: true)))
{
@Html.AntiForgeryToken()
<input id="Device_Show_User_Actions_Assign_UserId" name="AssignedUserId" type="text" />
}
</div>
@@ -863,8 +875,12 @@
}
@if (Model.Device.CanUpdateTrustEnrol())
{
@Html.ActionLinkSmallButton("Trust Enrol", MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, true.ToString(), true), "Device_Show_Device_Actions_TrustEnrol_Button")
<button id="Device_Show_Device_Actions_TrustEnrol_Button" type="button" class="button small">Trust Enrol</button>
<div id="Device_Show_Device_Actions_TrustEnrol_Dialog" class="dialog" title="Trust this Device?">
@using (Html.BeginForm(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, true.ToString(), true)))
{
@Html.AntiForgeryToken()
}
<p>
Devices flagged as 'trusted' are allowed a single-use device enrolment without providing authentication (for example: Active Directory Computer Account).
</p>
@@ -882,12 +898,9 @@
</div>
<script type="text/javascript">
$(function () {
var button = $('#Device_Show_Device_Actions_TrustEnrol_Button');
var buttonDialog;
button.click(function () {
let buttonDialog;
$('#Device_Show_Device_Actions_TrustEnrol_Button').click(function () {
if (!buttonDialog) {
var buttonLink = button.attr('href');
button.attr('href', '#');
buttonDialog = $('#Device_Show_Device_Actions_TrustEnrol_Dialog').dialog({
resizable: false,
width: 400,
@@ -895,10 +908,9 @@
autoOpen: false,
buttons: {
"Trust": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
window.location.href = buttonLink;
$(this)
.dialog("option", "buttons", null)
.find('form').trigger('submit');
},
Cancel: function () {
$(this).dialog("close");
@@ -906,18 +918,19 @@
}
});
}
buttonDialog.dialog('open');
return false;
});
});
</script>
}
@if (Model.Device.CanUpdateUntrustEnrol())
{
@Html.ActionLinkSmallButton("Untrust Enrol", MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, false.ToString(), true), "Device_Show_Device_Actions_UntrustEnrol_Button")
<div id="Device_Show_Device_Actions_UntrustEnrol_Dialog" title="Untrust this Device?">
<button id="Device_Show_Device_Actions_UntrustEnrol_Button" type="button" class="button small">Untrust Enrol</button>
<div id="Device_Show_Device_Actions_UntrustEnrol_Dialog" class="dialog" title="Untrust this Device?">
@using (Html.BeginForm(MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, false.ToString(), true)))
{
@Html.AntiForgeryToken()
}
<div class="info-box">
<p class="fa-p" style="margin-bottom: 1em;">
<i class="fa fa-info-circle"></i>This action will require the device to enrol with authentication (for example: domain joined).
@@ -929,137 +942,130 @@
</div>
<script type="text/javascript">
$(function () {
var button = $('#Device_Show_Device_Actions_UntrustEnrol_Button');
var buttonDialog = $('#Device_Show_Device_Actions_UntrustEnrol_Dialog');
var buttonLink = button.attr('href');
button.attr('href', '#');
button.click(function () {
buttonDialog.dialog('open');
return false;
});
buttonDialog.dialog({
resizable: false,
width: 400,
modal: true,
autoOpen: false,
buttons: {
"Untrust": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
window.location.href = buttonLink;
},
Cancel: function () {
$(this).dialog("close");
}
let buttonDialog = null;
$('#Device_Show_Device_Actions_UntrustEnrol_Button').on('click', function () {
if (!buttonDialog) {
buttonDialog = $('#Device_Show_Device_Actions_UntrustEnrol_Dialog').dialog({
resizable: false,
width: 400,
modal: true,
autoOpen: false,
buttons: {
"Untrust": function () {
$(this)
.dialog("option", "buttons", null)
.find('form').trigger('submit');
},
Cancel: function () {
$(this).dialog("close");
}
}
});
}
buttonDialog.dialog('open');
});
});
</script>
}
@if (Model.Device.CanDecommission())
{
@Html.ActionLinkSmallButton("Decommission", MVC.API.Device.Decommission(), "Device_Show_Device_Actions_Decommission_Button")
<button id="Device_Show_Device_Actions_Decommission_Button" type="button" class="button small">Decommission</button>
<div id="Device_Show_Device_Actions_Decommission_Dialog" class="dialog" title="Device Decommissioning">
<div class="clearfix" style="margin-bottom: 10px;">
<i class="fa fa-question-circle fa-lg information"></i>&nbsp;Why is this device to be decommissioned?
</div>
<div>
<ul class="none">
@foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast<DecommissionReasons>().OrderBy(r => r.ToString()))
{
<li>
<input type="radio" id="Device_Show_Device_Actions_Decommission_Reason_@((int)decommissionReason)"
name="Device_Show_Device_Actions_Decommission_Reason" value="@((int)decommissionReason)" @((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty) />
<label for="Device_Show_Device_Actions_Decommission_Reason_@((int)decommissionReason)">@(decommissionReason.ReasonMessage())</label>
</li>
}
</ul>
</div>
@using (Html.BeginForm(MVC.API.Device.Decommission(Model.Device.SerialNumber, null, true)))
{
@Html.AntiForgeryToken()
<div class="clearfix" style="margin-bottom: 10px;">
<i class="fa fa-question-circle fa-lg information"></i>&nbsp;Why is this device to be decommissioned?
</div>
<div>
<ul class="none">
@foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast<DecommissionReasons>().OrderBy(r => r.ToString()))
{
<li>
<input type="radio" id="Device_Show_Device_Actions_Decommission_Reason_@((int)decommissionReason)"
name="Reason" value="@((int)decommissionReason)" @((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty) />
<label for="Device_Show_Device_Actions_Decommission_Reason_@((int)decommissionReason)">@(decommissionReason.ReasonMessage())</label>
</li>
}
</ul>
</div>
}
</div>
<script type="text/javascript">
$(function () {
var button = $('#Device_Show_Device_Actions_Decommission_Button');
var buttonDialog = null;
var deviceSerialNumber = '@(Model.Device.SerialNumber)';
button.click(function () {
$('#Device_Show_Device_Actions_Decommission_Button').on('click', function () {
if (!buttonDialog) {
buttonDialog = $('#Device_Show_Device_Actions_Decommission_Dialog')
.dialog({
resizable: false,
modal: true,
autoOpen: false,
buttons: {
"Decommission": function () {
var reasonId = buttonDialog.find('input:checked').val();
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
var url = button.attr('href') + '/' + deviceSerialNumber + '?Reason=' + reasonId + '&redirect=True';
window.location.href = url;
},
Cancel: function () {
$(this).dialog("close");
}
}
});
.dialog({
resizable: false,
modal: true,
autoOpen: false,
buttons: {
"Decommission": function () {
$(this)
.dialog("option", "buttons", null)
.find('form').trigger('submit');
},
Cancel: function () {
$(this).dialog("close");
}
}
});
}
buttonDialog.dialog('open');
return false;
});
});
</script>
}
@if (Model.Device.CanRecommission())
{
@Html.ActionLinkSmallButton("Recommission", MVC.API.Device.Recommission(Model.Device.SerialNumber, true), "Device_Show_Device_Actions_Recommission_Button")
<div id="Device_Show_Device_Actions_Recommission_Dialog" title="Recommission this Device?">
<button id="Device_Show_Device_Actions_Recommission_Button" type="button" class="button small">Recommission</button>
<div id="Device_Show_Device_Actions_Recommission_Dialog" class="dialog" title="Recommission this Device?">
@using (Html.BeginForm(MVC.API.Device.Recommission(Model.Device.SerialNumber, true)))
{
@Html.AntiForgeryToken()
}
<p>
<i class="fa fa-exclamation-triangle fa-lg"></i>&nbsp;Are you sure?
</p>
</div>
<script type="text/javascript">
$(function () {
var button = $('#Device_Show_Device_Actions_Recommission_Button');
var buttonDialog = $('#Device_Show_Device_Actions_Recommission_Dialog');
var buttonLink = button.attr('href');
button.attr('href', '#');
button.click(function () {
buttonDialog.dialog('open');
return false;
});
buttonDialog.dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false,
buttons: {
"Recommission": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
window.location.href = buttonLink;
},
Cancel: function () {
$(this).dialog("close");
}
let buttonDialog = null;
$('#Device_Show_Device_Actions_Recommission_Button').on('click', function () {
if (!buttonDialog) {
buttonDialog = $('#Device_Show_Device_Actions_Recommission_Dialog').dialog({
resizable: false,
height: 140,
modal: true,
autoOpen: false,
buttons: {
"Recommission": function () {
$(this)
.dialog("option", "buttons", null)
.find('form').trigger('submit');
},
Cancel: function () {
$(this).dialog("close");
}
}
});
}
buttonDialog.dialog('open');
});
});
</script>
}
@if (Model.Device.CanDelete())
{
@Html.ActionLinkSmallButton("Delete Device", MVC.API.Device.Delete(Model.Device.SerialNumber, true), "Device_Show_Device_Actions_Delete_Button")
<div id="Device_Show_Device_Actions_Delete_Dialog" title="Delete this Device?">
<button id="Device_Show_Device_Actions_Delete_Button" type="button" class="button small">Delete Device</button>
<div id="Device_Show_Device_Actions_Delete_Dialog" class="dialog" title="Delete this Device?">
@using (Html.BeginForm(MVC.API.Device.Delete(Model.Device.SerialNumber, true)))
{
@Html.AntiForgeryToken()
}
<p>
<i class="fa fa-exclamation-triangle fa-lg"></i>&nbsp;
This item will be permanently deleted and cannot be recovered.<br />
@@ -1069,30 +1075,27 @@
</div>
<script type="text/javascript">
$(function () {
var button = $('#Device_Show_Device_Actions_Delete_Button');
var buttonDialog = $('#Device_Show_Device_Actions_Delete_Dialog');
var buttonLink = button.attr('href');
button.attr('href', '#');
button.click(function () {
buttonDialog.dialog('open');
return false;
});
buttonDialog.dialog({
resizable: false,
height: 200,
modal: true,
autoOpen: false,
buttons: {
"Delete": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
window.location.href = buttonLink;
},
Cancel: function () {
$(this).dialog("close");
}
let buttonDialog = null;
$('#Device_Show_Device_Actions_Delete_Button').on('click', function () {
if (!buttonDialog) {
buttonDialog = $('#Device_Show_Device_Actions_Delete_Dialog').dialog({
resizable: false,
height: 200,
modal: true,
autoOpen: false,
buttons: {
"Delete": function () {
$(this)
.dialog("option", "buttons", null)
.find('form').trigger('submit');
},
Cancel: function () {
$(this).dialog("close");
}
}
});
}
buttonDialog.dialog('open');
});
});
</script>
File diff suppressed because it is too large Load Diff
+6 -5
View File
@@ -8,6 +8,7 @@
<div id="Devices_Import">
@using (Html.BeginForm(MVC.API.Device.ImportBegin(), FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
<div id="importDialog" class="form" style="width: 450px">
<h2>Import Devices</h2>
<table>
@@ -101,7 +102,7 @@
}
</td>
</tr>
</tr>
}
</tbody>
</table>
@@ -186,9 +187,9 @@
modal: true,
autoOpen: false
},
$DeviceModelsDialog = null,
$DeviceProfilesDialog = null,
$DeviceBatchesDialog = null;
$DeviceModelsDialog = null,
$DeviceProfilesDialog = null,
$DeviceBatchesDialog = null;
$('#Devices_Import_Documentation_DeviceModels_Button').click(function (e) {
e.preventDefault();
@@ -235,4 +236,4 @@
});
});
</script>
}
}
+74 -59
View File
@@ -75,6 +75,20 @@ WriteLiteral(">\r\n");
#line 9 "..\..\Views\Device\Import.cshtml"
using (Html.BeginForm(MVC.API.Device.ImportBegin(), FormMethod.Post, new { enctype = "multipart/form-data" }))
{
#line default
#line hidden
#line 11 "..\..\Views\Device\Import.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
#line 11 "..\..\Views\Device\Import.cshtml"
#line default
@@ -93,7 +107,7 @@ WriteLiteral(">\r\n <h2>Import Devices</h2>\r\n <table>\r\
WriteLiteral(" ");
#line 16 "..\..\Views\Device\Import.cshtml"
#line 17 "..\..\Views\Device\Import.cshtml"
Write(Html.LabelFor(m => m.ImportFile));
@@ -119,7 +133,7 @@ WriteLiteral(" /><br />\r\n");
WriteLiteral(" ");
#line 20 "..\..\Views\Device\Import.cshtml"
#line 21 "..\..\Views\Device\Import.cshtml"
Write(Html.ValidationMessageFor(m => m.ImportFile));
@@ -130,7 +144,7 @@ WriteLiteral("\r\n <div>\r\n");
WriteLiteral(" ");
#line 22 "..\..\Views\Device\Import.cshtml"
#line 23 "..\..\Views\Device\Import.cshtml"
Write(Html.CheckBoxFor(m => m.HasHeader));
@@ -141,7 +155,7 @@ WriteLiteral("\r\n");
WriteLiteral(" ");
#line 23 "..\..\Views\Device\Import.cshtml"
#line 24 "..\..\Views\Device\Import.cshtml"
Write(Html.LabelFor(m => m.HasHeader));
@@ -202,7 +216,7 @@ WriteLiteral(@" <script>
");
#line 56 "..\..\Views\Device\Import.cshtml"
#line 57 "..\..\Views\Device\Import.cshtml"
}
@@ -250,13 +264,13 @@ WriteLiteral(">Field Name</th>\r\n <th>Description</th>\r\n
"\r\n </thead>\r\n <tbody>\r\n");
#line 80 "..\..\Views\Device\Import.cshtml"
#line 81 "..\..\Views\Device\Import.cshtml"
#line default
#line hidden
#line 80 "..\..\Views\Device\Import.cshtml"
#line 81 "..\..\Views\Device\Import.cshtml"
foreach (var field in Model.HeaderTypes)
{
@@ -266,7 +280,7 @@ WriteLiteral(">Field Name</th>\r\n <th>Description</th>\r\n
WriteLiteral(" <tr>\r\n <th>");
#line 83 "..\..\Views\Device\Import.cshtml"
#line 84 "..\..\Views\Device\Import.cshtml"
Write(field.Item2);
@@ -277,7 +291,7 @@ WriteLiteral("</th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 85 "..\..\Views\Device\Import.cshtml"
#line 86 "..\..\Views\Device\Import.cshtml"
Write(field.Item3);
@@ -286,13 +300,13 @@ WriteLiteral(" ");
WriteLiteral("\r\n");
#line 86 "..\..\Views\Device\Import.cshtml"
#line 87 "..\..\Views\Device\Import.cshtml"
#line default
#line hidden
#line 86 "..\..\Views\Device\Import.cshtml"
#line 87 "..\..\Views\Device\Import.cshtml"
if (field.Item1 == DeviceImportFieldTypes.DeviceSerialNumber.ToString())
{
@@ -302,7 +316,7 @@ WriteLiteral("\r\n");
WriteLiteral(" <strong>Required</strong>\r\n");
#line 89 "..\..\Views\Device\Import.cshtml"
#line 90 "..\..\Views\Device\Import.cshtml"
}
else if (field.Item1 == DeviceImportFieldTypes.ModelId.ToString())
{
@@ -319,7 +333,7 @@ WriteLiteral(" id=\"Devices_Import_Documentation_DeviceModels_Button\"");
WriteLiteral(">Show IDs</a>)</span>\r\n");
#line 93 "..\..\Views\Device\Import.cshtml"
#line 94 "..\..\Views\Device\Import.cshtml"
}
else if (field.Item1 == DeviceImportFieldTypes.ProfileId.ToString())
{
@@ -336,7 +350,7 @@ WriteLiteral(" id=\"Devices_Import_Documentation_DeviceProfiles_Button\"");
WriteLiteral(">Show IDs</a>)</span>\r\n");
#line 97 "..\..\Views\Device\Import.cshtml"
#line 98 "..\..\Views\Device\Import.cshtml"
}
else if (field.Item1 == DeviceImportFieldTypes.BatchId.ToString())
{
@@ -353,16 +367,16 @@ WriteLiteral(" id=\"Devices_Import_Documentation_DeviceBatches_Button\"");
WriteLiteral(">Show IDs</a>)</span>\r\n");
#line 101 "..\..\Views\Device\Import.cshtml"
#line 102 "..\..\Views\Device\Import.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr> \r\n");
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
#line 105 "..\..\Views\Device\Import.cshtml"
#line 106 "..\..\Views\Device\Import.cshtml"
}
@@ -393,13 +407,13 @@ WriteLiteral(@">
");
#line 121 "..\..\Views\Device\Import.cshtml"
#line 122 "..\..\Views\Device\Import.cshtml"
#line default
#line hidden
#line 121 "..\..\Views\Device\Import.cshtml"
#line 122 "..\..\Views\Device\Import.cshtml"
foreach (var dm in Model.DeviceModels)
{
@@ -409,7 +423,7 @@ WriteLiteral(@">
WriteLiteral(" <tr>\r\n <td>");
#line 124 "..\..\Views\Device\Import.cshtml"
#line 125 "..\..\Views\Device\Import.cshtml"
Write(Html.ActionLink(dm.Id.ToString(), MVC.Config.DeviceModel.Index(dm.Id)));
@@ -418,7 +432,7 @@ WriteLiteral(" <tr>\r\n <td>")
WriteLiteral("</td>\r\n <td>");
#line 125 "..\..\Views\Device\Import.cshtml"
#line 126 "..\..\Views\Device\Import.cshtml"
Write(dm.ToString());
@@ -427,7 +441,7 @@ WriteLiteral("</td>\r\n <td>");
WriteLiteral("</td>\r\n <td>");
#line 126 "..\..\Views\Device\Import.cshtml"
#line 127 "..\..\Views\Device\Import.cshtml"
Write(dm.Manufacturer);
@@ -436,7 +450,7 @@ WriteLiteral("</td>\r\n <td>");
WriteLiteral("</td>\r\n <td>");
#line 127 "..\..\Views\Device\Import.cshtml"
#line 128 "..\..\Views\Device\Import.cshtml"
Write(dm.Model);
@@ -445,7 +459,7 @@ WriteLiteral("</td>\r\n <td>");
WriteLiteral("</td>\r\n </tr>\r\n");
#line 129 "..\..\Views\Device\Import.cshtml"
#line 130 "..\..\Views\Device\Import.cshtml"
}
@@ -476,13 +490,13 @@ WriteLiteral(@">
");
#line 145 "..\..\Views\Device\Import.cshtml"
#line 146 "..\..\Views\Device\Import.cshtml"
#line default
#line hidden
#line 145 "..\..\Views\Device\Import.cshtml"
#line 146 "..\..\Views\Device\Import.cshtml"
foreach (var dp in Model.DeviceProfiles)
{
@@ -492,7 +506,7 @@ WriteLiteral(@">
WriteLiteral(" <tr>\r\n <td>");
#line 148 "..\..\Views\Device\Import.cshtml"
#line 149 "..\..\Views\Device\Import.cshtml"
Write(Html.ActionLink(dp.Id.ToString(), MVC.Config.DeviceProfile.Index(dp.Id)));
@@ -501,7 +515,7 @@ WriteLiteral(" <tr>\r\n <td>")
WriteLiteral("</td>\r\n <td>");
#line 149 "..\..\Views\Device\Import.cshtml"
#line 150 "..\..\Views\Device\Import.cshtml"
Write(dp.Name);
@@ -510,7 +524,7 @@ WriteLiteral("</td>\r\n <td>");
WriteLiteral("</td>\r\n <td>");
#line 150 "..\..\Views\Device\Import.cshtml"
#line 151 "..\..\Views\Device\Import.cshtml"
Write(dp.ShortName);
@@ -519,7 +533,7 @@ WriteLiteral("</td>\r\n <td>");
WriteLiteral("</td>\r\n <td>");
#line 151 "..\..\Views\Device\Import.cshtml"
#line 152 "..\..\Views\Device\Import.cshtml"
Write(dp.Description);
@@ -528,7 +542,7 @@ WriteLiteral("</td>\r\n <td>");
WriteLiteral("</td>\r\n </tr>\r\n");
#line 153 "..\..\Views\Device\Import.cshtml"
#line 154 "..\..\Views\Device\Import.cshtml"
}
@@ -558,13 +572,13 @@ WriteLiteral(@">
");
#line 168 "..\..\Views\Device\Import.cshtml"
#line 169 "..\..\Views\Device\Import.cshtml"
#line default
#line hidden
#line 168 "..\..\Views\Device\Import.cshtml"
#line 169 "..\..\Views\Device\Import.cshtml"
foreach (var db in Model.DeviceBatches)
{
@@ -574,7 +588,7 @@ WriteLiteral(@">
WriteLiteral(" <tr>\r\n <td>");
#line 171 "..\..\Views\Device\Import.cshtml"
#line 172 "..\..\Views\Device\Import.cshtml"
Write(Html.ActionLink(db.Id.ToString(), MVC.Config.DeviceBatch.Index(db.Id)));
@@ -583,7 +597,7 @@ WriteLiteral(" <tr>\r\n <td>")
WriteLiteral("</td>\r\n <td>");
#line 172 "..\..\Views\Device\Import.cshtml"
#line 173 "..\..\Views\Device\Import.cshtml"
Write(db.Name);
@@ -592,7 +606,7 @@ WriteLiteral("</td>\r\n <td>");
WriteLiteral("</td>\r\n <td>");
#line 173 "..\..\Views\Device\Import.cshtml"
#line 174 "..\..\Views\Device\Import.cshtml"
Write(CommonHelpers.FriendlyDate(db.PurchaseDate));
@@ -601,7 +615,7 @@ WriteLiteral("</td>\r\n <td>");
WriteLiteral("</td>\r\n </tr>\r\n");
#line 175 "..\..\Views\Device\Import.cshtml"
#line 176 "..\..\Views\Device\Import.cshtml"
}
@@ -611,27 +625,27 @@ WriteLiteral(" </tbody>\r\n </table>\r\n </div>
">\r\n $(function () {\r\n var dialogOptions = {\r\n " +
" width: 700,\r\n height: 600,\r\n re" +
"sizable: false,\r\n modal: true,\r\n autoOpen:" +
" false\r\n },\r\n $DeviceModelsDialog = null,\r\n " +
" $DeviceProfilesDialog = null,\r\n $DeviceBatchesDialog = n" +
"ull;\r\n\r\n $(\'#Devices_Import_Documentation_DeviceModels_Button\').c" +
" false\r\n },\r\n $DeviceModelsDialog = null,\r\n " +
" $DeviceProfilesDialog = null,\r\n $DeviceBatch" +
"esDialog = null;\r\n\r\n $(\'#Devices_Import_Documentation_DeviceModel" +
"s_Button\').click(function (e) {\r\n e.preventDefault();\r\n " +
" if (!$DeviceModelsDialog)\r\n $DeviceModelsDi" +
"alog = $(\'#Devices_Import_Documentation_DeviceModels_Dialog\').dialog(dialogOptio" +
"ns);\r\n $DeviceModelsDialog.dialog(\'open\');\r\n }" +
");\r\n\r\n $(\'#Devices_Import_Documentation_DeviceProfiles_Button\').c" +
"lick(function (e) {\r\n e.preventDefault();\r\n " +
" if (!$DeviceModelsDialog)\r\n $DeviceModelsDialog = $(\'#D" +
"evices_Import_Documentation_DeviceModels_Dialog\').dialog(dialogOptions);\r\n " +
" $DeviceModelsDialog.dialog(\'open\');\r\n });\r\n\r\n " +
" $(\'#Devices_Import_Documentation_DeviceProfiles_Button\').click(functio" +
"n (e) {\r\n e.preventDefault();\r\n if (!$Devi" +
"ceProfilesDialog)\r\n $DeviceProfilesDialog = $(\'#Devices_I" +
"mport_Documentation_DeviceProfiles_Dialog\').dialog(dialogOptions);\r\n " +
" $DeviceProfilesDialog.dialog(\'open\');\r\n });\r\n " +
" $(\'#Devices_Import_Documentation_DeviceBatches_Button\').click(function (e) {" +
"\r\n e.preventDefault();\r\n if (!$DeviceBatch" +
"esDialog)\r\n $DeviceBatchesDialog = $(\'#Devices_Import_Doc" +
"umentation_DeviceBatches_Dialog\').dialog(dialogOptions);\r\n $D" +
"eviceBatchesDialog.dialog(\'open\');\r\n });\r\n });\r\n " +
" </script>\r\n </div>\r\n</div>\r\n");
" if (!$DeviceProfilesDialog)\r\n $DeviceProfilesDialog = $" +
"(\'#Devices_Import_Documentation_DeviceProfiles_Dialog\').dialog(dialogOptions);\r\n" +
" $DeviceProfilesDialog.dialog(\'open\');\r\n });\r\n" +
" $(\'#Devices_Import_Documentation_DeviceBatches_Button\').click(fu" +
"nction (e) {\r\n e.preventDefault();\r\n if (!" +
"$DeviceBatchesDialog)\r\n $DeviceBatchesDialog = $(\'#Device" +
"s_Import_Documentation_DeviceBatches_Dialog\').dialog(dialogOptions);\r\n " +
" $DeviceBatchesDialog.dialog(\'open\');\r\n });\r\n " +
" });\r\n </script>\r\n </div>\r\n</div>\r\n");
#line 216 "..\..\Views\Device\Import.cshtml"
#line 217 "..\..\Views\Device\Import.cshtml"
if (Model.CompletedImportSessionContext != null)
{
@@ -653,7 +667,7 @@ WriteLiteral(" class=\"fa fa-lg fa-check\"");
WriteLiteral("></i>Successfully imported/updated ");
#line 219 "..\..\Views\Device\Import.cshtml"
#line 220 "..\..\Views\Device\Import.cshtml"
Write(Model.CompletedImportSessionContext.AffectedRecords);
@@ -662,7 +676,7 @@ WriteLiteral("></i>Successfully imported/updated ");
WriteLiteral(" device");
#line 219 "..\..\Views\Device\Import.cshtml"
#line 220 "..\..\Views\Device\Import.cshtml"
Write(Model.CompletedImportSessionContext.AffectedRecords != 1 ? "s" : null);
@@ -671,7 +685,7 @@ WriteLiteral(" device");
WriteLiteral(".</h3>\r\n <div><code>");
#line 220 "..\..\Views\Device\Import.cshtml"
#line 221 "..\..\Views\Device\Import.cshtml"
Write(Model.CompletedImportSessionContext.Filename);
@@ -698,8 +712,9 @@ WriteLiteral(@" <script>
");
#line 238 "..\..\Views\Device\Import.cshtml"
#line 239 "..\..\Views\Device\Import.cshtml"
}
#line default
#line hidden
@@ -63,6 +63,7 @@
<div class="actionBar">
@using (Html.BeginForm(MVC.API.Device.ImportParse(Model.Context.SessionId, null)))
{
@Html.AntiForgeryToken()
<a id="Devices_Import_Headers_Submit" href="#" class="button">Parse Device Import</a>
}
</div>
@@ -403,6 +403,20 @@ WriteLiteral(">\r\n");
#line 64 "..\..\Views\Device\ImportHeaders.cshtml"
using (Html.BeginForm(MVC.API.Device.ImportParse(Model.Context.SessionId, null)))
{
#line default
#line hidden
#line 66 "..\..\Views\Device\ImportHeaders.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
#line 66 "..\..\Views\Device\ImportHeaders.cshtml"
#line default
@@ -418,7 +432,7 @@ WriteLiteral(" class=\"button\"");
WriteLiteral(">Parse Device Import</a>\r\n");
#line 67 "..\..\Views\Device\ImportHeaders.cshtml"
#line 68 "..\..\Views\Device\ImportHeaders.cshtml"
}
@@ -442,13 +456,13 @@ WriteLiteral("></i>Parsing device import...</h4>\r\n</div>\r\n<script>\r\n $(
" var headerTypes = {\r\n");
#line 76 "..\..\Views\Device\ImportHeaders.cshtml"
#line 77 "..\..\Views\Device\ImportHeaders.cshtml"
#line default
#line hidden
#line 76 "..\..\Views\Device\ImportHeaders.cshtml"
#line 77 "..\..\Views\Device\ImportHeaders.cshtml"
foreach (var h in Model.HeaderTypes)
{
@@ -460,7 +474,7 @@ WriteLiteral(" ");
WriteLiteral("\'");
#line 78 "..\..\Views\Device\ImportHeaders.cshtml"
#line 79 "..\..\Views\Device\ImportHeaders.cshtml"
Write(h.Item1);
@@ -469,7 +483,7 @@ WriteLiteral("\'");
WriteLiteral("\': \'");
#line 78 "..\..\Views\Device\ImportHeaders.cshtml"
#line 79 "..\..\Views\Device\ImportHeaders.cshtml"
Write(h.Item2);
@@ -480,7 +494,7 @@ WriteLiteral("\',");
WriteLiteral("\r\n");
#line 79 "..\..\Views\Device\ImportHeaders.cshtml"
#line 80 "..\..\Views\Device\ImportHeaders.cshtml"
}
+101 -97
View File
@@ -27,112 +27,116 @@
<li class="actionDetached">
<input id="Devices_Import_Review_Navigation_Error" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_Error">Show Errors (@(Model.StatisticErrorRecords))</label>
</li>
}@if (Model.StatisticNewRecords > 0)
}@if (Model.StatisticNewRecords > 0)
{
<li class="actionAdded">
<input id="Devices_Import_Review_Navigation_New" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_New">Show New Devices (@(Model.StatisticNewRecords))</label>
</li>
}@if (Model.StatisticModifiedRecords > 0)
{
<li class="actionModified">
<input id="Devices_Import_Review_Navigation_Modified" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_Modified">Show Modified Devices (@(Model.StatisticModifiedRecords))</label>
</li>
}@if (Model.StatisticUnmodifiedRecords > 0)
{
<li class="actionUnchanged">
<input id="Devices_Import_Review_Navigation_Unchanged" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_Unchanged">Show Unchanged Devices (@(Model.StatisticUnmodifiedRecords))</label>
</li>
}
</ul>
<script>
$(function () {
$navigationContainer = $('#Devices_Import_Review_Navigation');
$tableBody = $('#Devices_Import_Review_TableContainer').find('tbody');
$navigationContainer.on('change', 'input', function () {
$tableBody.find('tr').show();
$navigationContainer.find('input').each(function () {
var $this = $(this);
var action = $this.closest('li').attr('class');
var records = $tableBody.find('tr.' + action);
if ($this.is(':checked')) {
records.show();
} else {
records.hide();
}
});
});
});
</script>
</div>
<div id="Devices_Import_Review_TableContainer">
<table class="tableData">
<thead>
<tr>
<th>Action</th>
<th>Row</th>
@foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
{
<th>@(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2)</th>
}
</tr>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
@foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
{
<th>@header.Name</th>
}
</tr>
</thead>
<tbody>
@foreach (var recordEntry in Model.Context.Records.Select((r, i) => Tuple.Create(r, i)))
}@if (Model.StatisticModifiedRecords > 0)
{
var record = recordEntry.Item1;
<tr class="action@(record.RecordAction)">
<td class="action"><i class="fa fa-fw"></i></td>
<td>@(recordEntry.Item2 + 1)</td>
@foreach (var field in record.Fields)
<li class="actionModified">
<input id="Devices_Import_Review_Navigation_Modified" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_Modified">Show Modified Devices (@(Model.StatisticModifiedRecords))</label>
</li>
}@if (Model.StatisticUnmodifiedRecords > 0)
{
<li class="actionUnchanged">
<input id="Devices_Import_Review_Navigation_Unchanged" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_Unchanged">Show Unchanged Devices (@(Model.StatisticUnmodifiedRecords))</label>
</li>
}
</ul>
<script>
$(function () {
$navigationContainer = $('#Devices_Import_Review_Navigation');
$tableBody = $('#Devices_Import_Review_TableContainer').find('tbody');
$navigationContainer.on('change', 'input', function () {
$tableBody.find('tr').show();
$navigationContainer.find('input').each(function () {
var $this = $(this);
var action = $this.closest('li').attr('class');
var records = $tableBody.find('tr.' + action);
if ($this.is(':checked')) {
records.show();
} else {
records.hide();
}
});
});
});
</script>
</div>
<div id="Devices_Import_Review_TableContainer">
<table class="tableData">
<thead>
<tr>
<th>Action</th>
<th>Row</th>
@foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
{
var friendlyValue = field.FriendlyValue;
<td class="header@(field.FieldType) action@(field.FieldAction.HasValue ? field.FieldAction.ToString() : "Error")" data-previousvalue="@(field.FieldAction.HasValue && field.FieldAction.Value == System.Data.EntityState.Modified ? field.FriendlyPreviousValue : null)">
@if (!field.FieldAction.HasValue)
{
<span class="errorMessage"><strong>Error:</strong> @field.ErrorMessage</span>
<i class="fa fa-exclamation-triangle fa-fw"></i>
}
@if (string.IsNullOrEmpty(friendlyValue))
{<span class="smallMessage">&lt;None&gt;</span>}
else if (field.FieldType == DeviceImportFieldTypes.DeviceSerialNumber && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Added)
{
@Html.ActionLink(friendlyValue, MVC.Device.Show((string)field.RawParsedValue), new { target = "_blank" })}
else if (field.FieldType == DeviceImportFieldTypes.AssignedUserId && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Unchanged)
{
@Html.ActionLink(friendlyValue, MVC.User.Show((string)field.RawParsedValue), new { target = "_blank" })}
else
{@friendlyValue}
</td>
<th>@(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2)</th>
}
</tr>
<tr>
<th>&nbsp;</th>
<th>&nbsp;</th>
@foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
{
<th>@header.Name</th>
}
</tr>
</thead>
<tbody>
@foreach (var recordEntry in Model.Context.Records.Select((r, i) => Tuple.Create(r, i)))
{
var record = recordEntry.Item1;
<tr class="action@(record.RecordAction)">
<td class="action"><i class="fa fa-fw"></i></td>
<td>@(recordEntry.Item2 + 1)</td>
@foreach (var field in record.Fields)
{
var friendlyValue = field.FriendlyValue;
<td class="header@(field.FieldType) action@(field.FieldAction.HasValue ? field.FieldAction.ToString() : "Error")" data-previousvalue="@(field.FieldAction.HasValue && field.FieldAction.Value == System.Data.EntityState.Modified ? field.FriendlyPreviousValue : null)">
@if (!field.FieldAction.HasValue)
{
<span class="errorMessage"><strong>Error:</strong> @field.ErrorMessage</span>
<i class="fa fa-exclamation-triangle fa-fw"></i>
}
@if (string.IsNullOrEmpty(friendlyValue))
{<span class="smallMessage">&lt;None&gt;</span>}
else if (field.FieldType == DeviceImportFieldTypes.DeviceSerialNumber && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Added)
{
@Html.ActionLink(friendlyValue, MVC.Device.Show((string)field.RawParsedValue), new { target = "_blank" })}
else if (field.FieldType == DeviceImportFieldTypes.AssignedUserId && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Unchanged)
{
@Html.ActionLink(friendlyValue, MVC.User.Show((string)field.RawParsedValue), new { target = "_blank" })}
else
{@friendlyValue}
</td>
}
</tr>
}
</tbody>
</table>
</div>
<div class="actionBar">
@if (Model.Context.AllowBacktracking)
{
<a id="Devices_Import_Review_ChangeHeaders" href="@Url.Action(MVC.Device.ImportHeaders(Model.Context.SessionId))" class="button"><i class="fa fa-caret-left"></i>Change Import Columns</a>
}
@if (Model.StatisticImportRecords == 0)
{
<button id="Devices_Import_Review_Apply" class="button disabled" disabled><i class="fa fa-wrench"></i>Apply Device Import</button>
}
else
{
using (Html.BeginForm(MVC.API.Device.ImportApply(Model.Context.SessionId)))
{
@Html.AntiForgeryToken();
<button id="Devices_Import_Review_Apply" type="submit" class="button"><i class="fa fa-wrench"></i>Apply Device Import</button>
}
</tbody>
</table>
</div>
<div class="actionBar">
@if (Model.Context.AllowBacktracking)
{
<a id="Devices_Import_Review_ChangeHeaders" href="@Url.Action(MVC.Device.ImportHeaders(Model.Context.SessionId))" class="button"><i class="fa fa-caret-left"></i>Change Import Columns</a>
}
@if (Model.StatisticImportRecords == 0)
{
<a id="Devices_Import_Review_Apply" href="#" class="button disabled" disabled><i class="fa fa-wrench"></i>Apply Device Import</a>
}
else
{
<a id="Devices_Import_Review_Apply" href="@Url.Action(MVC.API.Device.ImportApply(Model.Context.SessionId))" class="button"><i class="fa fa-wrench"></i>Apply Device Import</a>
}
</div>
}
</div>
</div>
<script>
$(function () {
+176 -169
View File
@@ -216,13 +216,13 @@ WriteLiteral(")</label>\r\n </li>\r\n");
#line 30 "..\..\Views\Device\ImportReview.cshtml"
}
}
#line default
#line hidden
#line 30 "..\..\Views\Device\ImportReview.cshtml"
if (Model.StatisticNewRecords > 0)
if (Model.StatisticNewRecords > 0)
{
@@ -255,23 +255,23 @@ WriteLiteral(")</label>\r\n </li>\r\n");
#line 35 "..\..\Views\Device\ImportReview.cshtml"
}
}
#line default
#line hidden
#line 35 "..\..\Views\Device\ImportReview.cshtml"
if (Model.StatisticModifiedRecords > 0)
{
if (Model.StatisticModifiedRecords > 0)
{
#line default
#line hidden
WriteLiteral(" <li");
WriteLiteral(" <li");
WriteLiteral(" class=\"actionModified\"");
WriteLiteral(">\r\n <input");
WriteLiteral(">\r\n <input");
WriteLiteral(" id=\"Devices_Import_Review_Navigation_Modified\"");
@@ -285,32 +285,32 @@ WriteLiteral(">Show Modified Devices (");
#line 38 "..\..\Views\Device\ImportReview.cshtml"
Write(Model.StatisticModifiedRecords);
Write(Model.StatisticModifiedRecords);
#line default
#line hidden
WriteLiteral(")</label>\r\n </li>\r\n");
WriteLiteral(")</label>\r\n </li>\r\n");
#line 40 "..\..\Views\Device\ImportReview.cshtml"
}
}
#line default
#line hidden
#line 40 "..\..\Views\Device\ImportReview.cshtml"
if (Model.StatisticUnmodifiedRecords > 0)
{
if (Model.StatisticUnmodifiedRecords > 0)
{
#line default
#line hidden
WriteLiteral(" <li");
WriteLiteral(" <li");
WriteLiteral(" class=\"actionUnchanged\"");
WriteLiteral(">\r\n <input");
WriteLiteral(">\r\n <input");
WriteLiteral(" id=\"Devices_Import_Review_Navigation_Unchanged\"");
@@ -324,73 +324,73 @@ WriteLiteral(">Show Unchanged Devices (");
#line 43 "..\..\Views\Device\ImportReview.cshtml"
Write(Model.StatisticUnmodifiedRecords);
Write(Model.StatisticUnmodifiedRecords);
#line default
#line hidden
WriteLiteral(")</label>\r\n </li>\r\n");
WriteLiteral(")</label>\r\n </li>\r\n");
#line 45 "..\..\Views\Device\ImportReview.cshtml"
}
}
#line default
#line hidden
WriteLiteral(@"</ul>
<script>
$(function () {
$navigationContainer = $('#Devices_Import_Review_Navigation');
$tableBody = $('#Devices_Import_Review_TableContainer').find('tbody');
WriteLiteral(@" </ul>
<script>
$(function () {
$navigationContainer = $('#Devices_Import_Review_Navigation');
$tableBody = $('#Devices_Import_Review_TableContainer').find('tbody');
$navigationContainer.on('change', 'input', function () {
$tableBody.find('tr').show();
$navigationContainer.on('change', 'input', function () {
$tableBody.find('tr').show();
$navigationContainer.find('input').each(function () {
var $this = $(this);
var action = $this.closest('li').attr('class');
var records = $tableBody.find('tr.' + action);
if ($this.is(':checked')) {
records.show();
} else {
records.hide();
}
$navigationContainer.find('input').each(function () {
var $this = $(this);
var action = $this.closest('li').attr('class');
var records = $tableBody.find('tr.' + action);
if ($this.is(':checked')) {
records.show();
} else {
records.hide();
}
});
});
});
});
});
</script>
</div>
<div");
</script>
</div>
<div");
WriteLiteral(" id=\"Devices_Import_Review_TableContainer\"");
WriteLiteral(">\r\n <table");
WriteLiteral(">\r\n <table");
WriteLiteral(" class=\"tableData\"");
WriteLiteral(">\r\n <thead>\r\n <tr>\r\n <th>Action</th>\r\n " +
" <th>Row</th>\r\n");
WriteLiteral(">\r\n <thead>\r\n <tr>\r\n <th>Action</th>" +
"\r\n <th>Row</th>\r\n");
#line 75 "..\..\Views\Device\ImportReview.cshtml"
#line default
#line hidden
#line 75 "..\..\Views\Device\ImportReview.cshtml"
foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
{
foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
{
#line default
#line hidden
WriteLiteral(" <th>");
WriteLiteral(" <th>");
#line 77 "..\..\Views\Device\ImportReview.cshtml"
Write(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2);
Write(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2);
#line default
@@ -399,33 +399,33 @@ WriteLiteral("</th>\r\n");
#line 78 "..\..\Views\Device\ImportReview.cshtml"
}
}
#line default
#line hidden
WriteLiteral(" </tr>\r\n <tr>\r\n <th>&nbsp;</th>\r\n " +
" <th>&nbsp;</th>\r\n");
WriteLiteral(" </tr>\r\n <tr>\r\n <th>&nbsp;</th>\r" +
"\n <th>&nbsp;</th>\r\n");
#line 83 "..\..\Views\Device\ImportReview.cshtml"
#line default
#line hidden
#line 83 "..\..\Views\Device\ImportReview.cshtml"
foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
{
foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
{
#line default
#line hidden
WriteLiteral(" <th>");
WriteLiteral(" <th>");
#line 85 "..\..\Views\Device\ImportReview.cshtml"
Write(header.Name);
Write(header.Name);
#line default
@@ -434,42 +434,42 @@ WriteLiteral("</th>\r\n");
#line 86 "..\..\Views\Device\ImportReview.cshtml"
}
}
#line default
#line hidden
WriteLiteral(" </tr>\r\n </thead>\r\n <tbody>\r\n");
WriteLiteral(" </tr>\r\n </thead>\r\n <tbody>\r\n");
#line 90 "..\..\Views\Device\ImportReview.cshtml"
#line default
#line hidden
#line 90 "..\..\Views\Device\ImportReview.cshtml"
foreach (var recordEntry in Model.Context.Records.Select((r, i) => Tuple.Create(r, i)))
{
var record = recordEntry.Item1;
foreach (var recordEntry in Model.Context.Records.Select((r, i) => Tuple.Create(r, i)))
{
var record = recordEntry.Item1;
#line default
#line hidden
WriteLiteral(" <tr");
WriteLiteral(" <tr");
WriteAttribute("class", Tuple.Create(" class=\"", 4017), Tuple.Create("\"", 4053)
, Tuple.Create(Tuple.Create("", 4025), Tuple.Create("action", 4025), true)
WriteAttribute("class", Tuple.Create(" class=\"", 4425), Tuple.Create("\"", 4461)
, Tuple.Create(Tuple.Create("", 4433), Tuple.Create("action", 4433), true)
#line 93 "..\..\Views\Device\ImportReview.cshtml"
, Tuple.Create(Tuple.Create("", 4031), Tuple.Create<System.Object, System.Int32>(record.RecordAction
, Tuple.Create(Tuple.Create("", 4439), Tuple.Create<System.Object, System.Int32>(record.RecordAction
#line default
#line hidden
, 4031), false)
, 4439), false)
);
WriteLiteral(">\r\n <td");
WriteLiteral(">\r\n <td");
WriteLiteral(" class=\"action\"");
@@ -477,11 +477,11 @@ WriteLiteral("><i");
WriteLiteral(" class=\"fa fa-fw\"");
WriteLiteral("></i></td>\r\n <td>");
WriteLiteral("></i></td>\r\n <td>");
#line 95 "..\..\Views\Device\ImportReview.cshtml"
Write(recordEntry.Item2 + 1);
Write(recordEntry.Item2 + 1);
#line default
@@ -490,45 +490,45 @@ WriteLiteral("</td>\r\n");
#line 96 "..\..\Views\Device\ImportReview.cshtml"
#line default
#line hidden
#line 96 "..\..\Views\Device\ImportReview.cshtml"
foreach (var field in record.Fields)
{
var friendlyValue = field.FriendlyValue;
foreach (var field in record.Fields)
{
var friendlyValue = field.FriendlyValue;
#line default
#line hidden
WriteLiteral(" <td");
WriteLiteral(" <td");
WriteAttribute("class", Tuple.Create(" class=\"", 4357), Tuple.Create("\"", 4466)
, Tuple.Create(Tuple.Create("", 4365), Tuple.Create("header", 4365), true)
WriteAttribute("class", Tuple.Create(" class=\"", 4789), Tuple.Create("\"", 4898)
, Tuple.Create(Tuple.Create("", 4797), Tuple.Create("header", 4797), true)
#line 99 "..\..\Views\Device\ImportReview.cshtml"
, Tuple.Create(Tuple.Create("", 4371), Tuple.Create<System.Object, System.Int32>(field.FieldType
, Tuple.Create(Tuple.Create("", 4803), Tuple.Create<System.Object, System.Int32>(field.FieldType
#line default
#line hidden
, 4371), false)
, Tuple.Create(Tuple.Create(" ", 4389), Tuple.Create("action", 4390), true)
, 4803), false)
, Tuple.Create(Tuple.Create(" ", 4821), Tuple.Create("action", 4822), true)
#line 99 "..\..\Views\Device\ImportReview.cshtml"
, Tuple.Create(Tuple.Create("", 4396), Tuple.Create<System.Object, System.Int32>(field.FieldAction.HasValue ? field.FieldAction.ToString() : "Error"
, Tuple.Create(Tuple.Create("", 4828), Tuple.Create<System.Object, System.Int32>(field.FieldAction.HasValue ? field.FieldAction.ToString() : "Error"
#line default
#line hidden
, 4396), false)
, 4828), false)
);
WriteLiteral(" data-previousvalue=\"");
#line 99 "..\..\Views\Device\ImportReview.cshtml"
Write(field.FieldAction.HasValue && field.FieldAction.Value == System.Data.EntityState.Modified ? field.FriendlyPreviousValue : null);
Write(field.FieldAction.HasValue && field.FieldAction.Value == System.Data.EntityState.Modified ? field.FriendlyPreviousValue : null);
#line default
@@ -539,19 +539,19 @@ WriteLiteral(">\r\n");
#line 100 "..\..\Views\Device\ImportReview.cshtml"
#line default
#line hidden
#line 100 "..\..\Views\Device\ImportReview.cshtml"
if (!field.FieldAction.HasValue)
{
if (!field.FieldAction.HasValue)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" <span");
WriteLiteral(" class=\"errorMessage\"");
@@ -559,14 +559,14 @@ WriteLiteral("><strong>Error:</strong> ");
#line 102 "..\..\Views\Device\ImportReview.cshtml"
Write(field.ErrorMessage);
Write(field.ErrorMessage);
#line default
#line hidden
WriteLiteral("</span>\r\n");
WriteLiteral(" <i");
WriteLiteral(" <i");
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-fw\"");
@@ -574,17 +574,17 @@ WriteLiteral("></i>\r\n");
#line 104 "..\..\Views\Device\ImportReview.cshtml"
}
}
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral(" ");
#line 105 "..\..\Views\Device\ImportReview.cshtml"
if (string.IsNullOrEmpty(friendlyValue))
{
if (string.IsNullOrEmpty(friendlyValue))
{
#line default
#line hidden
@@ -596,77 +596,77 @@ WriteLiteral(">&lt;None&gt;</span>");
#line 106 "..\..\Views\Device\ImportReview.cshtml"
}
else if (field.FieldType == DeviceImportFieldTypes.DeviceSerialNumber && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Added)
{
}
else if (field.FieldType == DeviceImportFieldTypes.DeviceSerialNumber && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Added)
{
#line default
#line hidden
#line 109 "..\..\Views\Device\ImportReview.cshtml"
Write(Html.ActionLink(friendlyValue, MVC.Device.Show((string)field.RawParsedValue), new { target = "_blank" }));
Write(Html.ActionLink(friendlyValue, MVC.Device.Show((string)field.RawParsedValue), new { target = "_blank" }));
#line default
#line hidden
#line 109 "..\..\Views\Device\ImportReview.cshtml"
}
else if (field.FieldType == DeviceImportFieldTypes.AssignedUserId && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Unchanged)
{
}
else if (field.FieldType == DeviceImportFieldTypes.AssignedUserId && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Unchanged)
{
#line default
#line hidden
#line 112 "..\..\Views\Device\ImportReview.cshtml"
Write(Html.ActionLink(friendlyValue, MVC.User.Show((string)field.RawParsedValue), new { target = "_blank" }));
Write(Html.ActionLink(friendlyValue, MVC.User.Show((string)field.RawParsedValue), new { target = "_blank" }));
#line default
#line hidden
#line 112 "..\..\Views\Device\ImportReview.cshtml"
}
else
{
}
else
{
#line default
#line hidden
#line 114 "..\..\Views\Device\ImportReview.cshtml"
Write(friendlyValue);
Write(friendlyValue);
#line default
#line hidden
#line 114 "..\..\Views\Device\ImportReview.cshtml"
}
}
#line default
#line hidden
WriteLiteral(" </td>\r\n");
WriteLiteral(" </td>\r\n");
#line 116 "..\..\Views\Device\ImportReview.cshtml"
}
}
#line default
#line hidden
WriteLiteral(" </tr>\r\n");
WriteLiteral(" </tr>\r\n");
#line 118 "..\..\Views\Device\ImportReview.cshtml"
}
}
#line default
#line hidden
WriteLiteral(" </tbody>\r\n </table>\r\n</div>\r\n<div");
WriteLiteral(" </tbody>\r\n </table>\r\n </div>\r\n <div");
WriteLiteral(" class=\"actionBar\"");
@@ -674,30 +674,30 @@ WriteLiteral(">\r\n");
#line 123 "..\..\Views\Device\ImportReview.cshtml"
#line default
#line hidden
#line 123 "..\..\Views\Device\ImportReview.cshtml"
if (Model.Context.AllowBacktracking)
{
if (Model.Context.AllowBacktracking)
{
#line default
#line hidden
WriteLiteral(" <a");
WriteLiteral(" <a");
WriteLiteral(" id=\"Devices_Import_Review_ChangeHeaders\"");
WriteAttribute("href", Tuple.Create(" href=\"", 6122), Tuple.Create("\"", 6191)
WriteAttribute("href", Tuple.Create(" href=\"", 6658), Tuple.Create("\"", 6727)
#line 125 "..\..\Views\Device\ImportReview.cshtml"
, Tuple.Create(Tuple.Create("", 6129), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Device.ImportHeaders(Model.Context.SessionId))
, Tuple.Create(Tuple.Create("", 6665), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Device.ImportHeaders(Model.Context.SessionId))
#line default
#line hidden
, 6129), false)
, 6665), false)
);
WriteLiteral(" class=\"button\"");
@@ -710,57 +710,63 @@ WriteLiteral("></i>Change Import Columns</a>\r\n");
#line 126 "..\..\Views\Device\ImportReview.cshtml"
}
}
#line default
#line hidden
WriteLiteral(" ");
WriteLiteral(" ");
#line 127 "..\..\Views\Device\ImportReview.cshtml"
if (Model.StatisticImportRecords == 0)
{
if (Model.StatisticImportRecords == 0)
{
#line default
#line hidden
WriteLiteral(" <a");
WriteLiteral(" <button");
WriteLiteral(" id=\"Devices_Import_Review_Apply\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(" class=\"button disabled\"");
WriteLiteral(" disabled><i");
WriteLiteral(" class=\"fa fa-wrench\"");
WriteLiteral("></i>Apply Device Import</a>\r\n");
WriteLiteral("></i>Apply Device Import</button>\r\n");
#line 130 "..\..\Views\Device\ImportReview.cshtml"
}
else
{
}
else
{
using (Html.BeginForm(MVC.API.Device.ImportApply(Model.Context.SessionId)))
{
#line default
#line hidden
#line 135 "..\..\Views\Device\ImportReview.cshtml"
Write(Html.AntiForgeryToken());
#line default
#line hidden
WriteLiteral(" <a");
#line 135 "..\..\Views\Device\ImportReview.cshtml"
;
#line default
#line hidden
WriteLiteral(" <button");
WriteLiteral(" id=\"Devices_Import_Review_Apply\"");
WriteAttribute("href", Tuple.Create(" href=\"", 6532), Tuple.Create("\"", 6603)
#line 133 "..\..\Views\Device\ImportReview.cshtml"
, Tuple.Create(Tuple.Create("", 6539), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ImportApply(Model.Context.SessionId))
#line default
#line hidden
, 6539), false)
);
WriteLiteral(" type=\"submit\"");
WriteLiteral(" class=\"button\"");
@@ -768,42 +774,43 @@ WriteLiteral("><i");
WriteLiteral(" class=\"fa fa-wrench\"");
WriteLiteral("></i>Apply Device Import</a>\r\n");
WriteLiteral("></i>Apply Device Import</button>\r\n");
#line 134 "..\..\Views\Device\ImportReview.cshtml"
}
#line 137 "..\..\Views\Device\ImportReview.cshtml"
}
}
#line default
#line hidden
WriteLiteral("</div>\r\n</div>\r\n<script>\r\n $(function () {\r\n $Devices_Import_Review_Tab" +
"leContainer = $(\'#Devices_Import_Review_TableContainer\');\r\n\r\n $Devices_Im" +
"port_Review_TableContainer.find(\'tbody\').tooltip({\r\n items: \'td.actio" +
"n, td.actionError, td.actionModified\',\r\n content: function () {\r\n " +
" var $this = $(this);\r\n\r\n if ($this.hasClass(\'action\')" +
") {\r\n var record = $(this).closest(\'tr\');\r\n\r\n " +
" if (record.hasClass(\'actionDetached\')) {\r\n return \'<s" +
"trong>Error Parsing Record</strong><div>Review the record fields for details abo" +
"ut any errors.</div><div class=\"smallMessage\">This record will be skipped.</div>" +
"\';\r\n } else if (record.hasClass(\'actionUnchanged\')) {\r\n " +
" return \'<strong>No Changes</strong><div>No changes were found " +
"while parsing this record.</div><div class=\"smallMessage\">This record will be sk" +
"ipped.</div>\';\r\n } else if (record.hasClass(\'actionModified\')" +
") {\r\n return \'<strong>Pending Changes</strong><div>This r" +
"ecord contains changes which will be applied.</div>\';\r\n } els" +
"e if (record.hasClass(\'actionAdded\')) {\r\n return \'<strong" +
">New Record</strong><div>This record will be imported.</div>\';\r\n " +
" }\r\n } else if ($this.hasClass(\'actionError\')) {\r\n " +
" return $(this).find(\'span.errorMessage\').html();\r\n } else" +
" if ($this.hasClass(\'actionModified\')) {\r\n var v = $(this).at" +
"tr(\'data-previousvalue\');\r\n if (v) {\r\n " +
" return \'<strong>Previous Value:</strong><br />\' + v;\r\n } els" +
"e {\r\n return \'<strong>Previous Value:</strong><br /><em>&" +
"lt;None&gt;</em>\';\r\n }\r\n }\r\n },\r\n " +
" position: {\r\n my: \"left top\",\r\n at: \"lef" +
"t bottom\",\r\n collision: \"flipfit flip\"\r\n }\r\n })" +
";\r\n\r\n });\r\n</script>\r\n");
WriteLiteral(" </div>\r\n</div>\r\n<script>\r\n $(function () {\r\n $Devices_Import_Review" +
"_TableContainer = $(\'#Devices_Import_Review_TableContainer\');\r\n\r\n $Device" +
"s_Import_Review_TableContainer.find(\'tbody\').tooltip({\r\n items: \'td.a" +
"ction, td.actionError, td.actionModified\',\r\n content: function () {\r\n" +
" var $this = $(this);\r\n\r\n if ($this.hasClass(\'acti" +
"on\')) {\r\n var record = $(this).closest(\'tr\');\r\n\r\n " +
" if (record.hasClass(\'actionDetached\')) {\r\n return" +
" \'<strong>Error Parsing Record</strong><div>Review the record fields for details" +
" about any errors.</div><div class=\"smallMessage\">This record will be skipped.</" +
"div>\';\r\n } else if (record.hasClass(\'actionUnchanged\')) {\r\n " +
" return \'<strong>No Changes</strong><div>No changes were fo" +
"und while parsing this record.</div><div class=\"smallMessage\">This record will b" +
"e skipped.</div>\';\r\n } else if (record.hasClass(\'actionModifi" +
"ed\')) {\r\n return \'<strong>Pending Changes</strong><div>Th" +
"is record contains changes which will be applied.</div>\';\r\n }" +
" else if (record.hasClass(\'actionAdded\')) {\r\n return \'<st" +
"rong>New Record</strong><div>This record will be imported.</div>\';\r\n " +
" }\r\n } else if ($this.hasClass(\'actionError\')) {\r\n " +
" return $(this).find(\'span.errorMessage\').html();\r\n } " +
"else if ($this.hasClass(\'actionModified\')) {\r\n var v = $(this" +
").attr(\'data-previousvalue\');\r\n if (v) {\r\n " +
" return \'<strong>Previous Value:</strong><br />\' + v;\r\n }" +
" else {\r\n return \'<strong>Previous Value:</strong><br /><" +
"em>&lt;None&gt;</em>\';\r\n }\r\n }\r\n }," +
"\r\n position: {\r\n my: \"left top\",\r\n at: " +
"\"left bottom\",\r\n collision: \"flipfit flip\"\r\n }\r\n " +
" });\r\n\r\n });\r\n</script>\r\n");
}
}