Permissions & Authorization for Users #24
Initial Release; Includes Database and MVC refactoring
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
@model Disco.Web.Models.Device.ShowModel
|
||||
@{
|
||||
Authorization.Require(Claims.Device.ShowAssignmentHistory);
|
||||
}
|
||||
<div id="DeviceDetailTab-AssignmentHistory" class="DevicePart">
|
||||
@if (Model.Device.DeviceUserAssignments.Count > 0)
|
||||
{
|
||||
@@ -15,7 +18,14 @@
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.ActionLink(dua.AssignedUser.ToString(), MVC.User.Show(dua.AssignedUserId))
|
||||
@if (Authorization.Has(Claims.User.Show))
|
||||
{
|
||||
@Html.ActionLink(dua.AssignedUser.ToString(), MVC.User.Show(dua.AssignedUserId))
|
||||
}
|
||||
else
|
||||
{
|
||||
@dua.AssignedUser.ToString()
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@CommonHelpers.FriendlyDate(dua.AssignedDate)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18033
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -28,19 +28,29 @@ namespace Disco.Web.Views.Device.DeviceParts
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/DeviceParts/_AssignmentHistory.cshtml")]
|
||||
public partial class AssignmentHistory : System.Web.Mvc.WebViewPage<Disco.Web.Models.Device.ShowModel>
|
||||
public partial class AssignmentHistory : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.ShowModel>
|
||||
{
|
||||
public AssignmentHistory()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
WriteLiteral("<div");
|
||||
|
||||
#line 2 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
|
||||
Authorization.Require(Claims.Device.ShowAssignmentHistory);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<div");
|
||||
|
||||
WriteLiteral(" id=\"DeviceDetailTab-AssignmentHistory\"");
|
||||
|
||||
@@ -49,13 +59,13 @@ WriteLiteral(" class=\"DevicePart\"");
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 3 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
#line 6 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 3 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
#line 6 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
if (Model.Device.DeviceUserAssignments.Count > 0)
|
||||
{
|
||||
|
||||
@@ -71,13 +81,13 @@ WriteLiteral(">\r\n <tr>\r\n <th>User\r\n
|
||||
" </th>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 14 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
#line 17 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 14 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
#line 17 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
foreach (var dua in Model.Device.DeviceUserAssignments.OrderByDescending(m => m.AssignedDate))
|
||||
{
|
||||
|
||||
@@ -86,21 +96,58 @@ WriteLiteral(">\r\n <tr>\r\n <th>User\r\n
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 18 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
Write(Html.ActionLink(dua.AssignedUser.ToString(), MVC.User.Show(dua.AssignedUserId)));
|
||||
#line 21 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 21 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
if (Authorization.Has(Claims.User.Show))
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 23 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
Write(Html.ActionLink(dua.AssignedUser.ToString(), MVC.User.Show(dua.AssignedUserId)));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
|
||||
#line 23 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 27 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
Write(dua.AssignedUser.ToString());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 27 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </td>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 21 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
#line 31 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
Write(CommonHelpers.FriendlyDate(dua.AssignedDate));
|
||||
|
||||
|
||||
@@ -111,7 +158,7 @@ WriteLiteral("\r\n </td>\r\n <td>\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 24 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
#line 34 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
Write(CommonHelpers.FriendlyDate(dua.UnassignedDate, "Current"));
|
||||
|
||||
|
||||
@@ -120,7 +167,7 @@ WriteLiteral(" ");
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 27 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
#line 37 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +176,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||
WriteLiteral(" </table>\r\n");
|
||||
|
||||
|
||||
#line 29 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
#line 39 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -144,7 +191,7 @@ WriteLiteral(" class=\"smallMessage\"");
|
||||
WriteLiteral(">No Assignment History Available</span>\r\n");
|
||||
|
||||
|
||||
#line 33 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
#line 43 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +201,7 @@ WriteLiteral(" <script>\r\n $(\'#DeviceDetailTabItems\').append(\'<li>
|
||||
"ilTab-AssignmentHistory\">Assignment History [");
|
||||
|
||||
|
||||
#line 35 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
#line 45 "..\..\Views\Device\DeviceParts\_AssignmentHistory.cshtml"
|
||||
Write(Model.Device.DeviceUserAssignments.Count);
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
@model Disco.Web.Models.Device.ShowModel
|
||||
@{
|
||||
Authorization.Require(Claims.Device.ShowCertificates);
|
||||
var hasDownloadCert = Authorization.Has(Claims.Config.DeviceCertificate.DownloadCertificates);
|
||||
}
|
||||
<div id="DeviceDetailTab-Certificates" class="DevicePart">
|
||||
<div class="genericData certificateTable">
|
||||
@if (Model.Certificates.Count() > 0)
|
||||
@@ -18,7 +22,14 @@
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.ActionLink(item.Name, MVC.API.DeviceCertificate.Download(item.Id))
|
||||
@if (hasDownloadCert)
|
||||
{
|
||||
@Html.ActionLink(item.Name, MVC.API.DeviceCertificate.Download(item.Id))
|
||||
}
|
||||
else
|
||||
{
|
||||
@item.Name
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@item.Enabled
|
||||
@@ -41,4 +52,4 @@
|
||||
<script>
|
||||
$('#DeviceDetailTabItems').append('<li><a href="#DeviceDetailTab-Certificates">Certificates [@(Model.Certificates.Count)]</a></li>');
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18033
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -28,19 +28,30 @@ namespace Disco.Web.Views.Device.DeviceParts
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/DeviceParts/_Certificates.cshtml")]
|
||||
public partial class Certificates : System.Web.Mvc.WebViewPage<Disco.Web.Models.Device.ShowModel>
|
||||
public partial class Certificates : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.ShowModel>
|
||||
{
|
||||
public Certificates()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
WriteLiteral("<div");
|
||||
|
||||
#line 2 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
|
||||
Authorization.Require(Claims.Device.ShowCertificates);
|
||||
var hasDownloadCert = Authorization.Has(Claims.Config.DeviceCertificate.DownloadCertificates);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<div");
|
||||
|
||||
WriteLiteral(" id=\"DeviceDetailTab-Certificates\"");
|
||||
|
||||
@@ -53,13 +64,13 @@ WriteLiteral(" class=\"genericData certificateTable\"");
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 4 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
#line 8 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 4 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
#line 8 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
if (Model.Certificates.Count() > 0)
|
||||
{
|
||||
|
||||
@@ -84,13 +95,13 @@ WriteLiteral(@">
|
||||
");
|
||||
|
||||
|
||||
#line 17 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
#line 21 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 17 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
#line 21 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
foreach (var item in Model.Certificates)
|
||||
{
|
||||
|
||||
@@ -99,21 +110,58 @@ WriteLiteral(@">
|
||||
#line hidden
|
||||
WriteLiteral(" <tr>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 21 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
Write(Html.ActionLink(item.Name, MVC.API.DeviceCertificate.Download(item.Id)));
|
||||
#line 25 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 25 "..\..\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("\r\n </td>\r\n <td>\r\n");
|
||||
|
||||
#line 27 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 31 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
Write(item.Name);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 31 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </td>\r\n <td>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 24 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
#line 35 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
Write(item.Enabled);
|
||||
|
||||
|
||||
@@ -124,7 +172,7 @@ WriteLiteral("\r\n </td>\r\n <td>\
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 27 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
#line 38 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
Write(CommonHelpers.FriendlyDate(item.AllocatedDate));
|
||||
|
||||
|
||||
@@ -135,7 +183,7 @@ WriteLiteral("\r\n </td>\r\n <td>\
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 30 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
#line 41 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
Write(CommonHelpers.FriendlyDate(item.ExpirationDate));
|
||||
|
||||
|
||||
@@ -144,7 +192,7 @@ WriteLiteral(" ");
|
||||
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 33 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
#line 44 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -153,7 +201,7 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n
|
||||
WriteLiteral(" </table>\r\n");
|
||||
|
||||
|
||||
#line 35 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
#line 46 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -168,7 +216,7 @@ WriteLiteral(" class=\"smallMessage\"");
|
||||
WriteLiteral(">No Certificates Allocated</span>\r\n");
|
||||
|
||||
|
||||
#line 39 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
#line 50 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -178,13 +226,13 @@ WriteLiteral(" </div>\r\n <script>\r\n $(\'#DeviceDetailTabItems\')
|
||||
"\"#DeviceDetailTab-Certificates\">Certificates [");
|
||||
|
||||
|
||||
#line 42 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
#line 53 "..\..\Views\Device\DeviceParts\_Certificates.cshtml"
|
||||
Write(Model.Certificates.Count);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("]</a></li>\');\r\n </script>\r\n</div>");
|
||||
WriteLiteral("]</a></li>\');\r\n </script>\r\n</div>\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
@model Disco.Web.Models.Device.ShowModel
|
||||
@{
|
||||
Authorization.Require(Claims.Device.ShowDetails);
|
||||
}
|
||||
<div id="DeviceDetailTab-Details" class="DevicePart">
|
||||
<div id="DeviceDetailTab-DetailsContainer">
|
||||
<table class="tableData">
|
||||
|
||||
@@ -28,19 +28,29 @@ namespace Disco.Web.Views.Device.DeviceParts
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/DeviceParts/_Details.cshtml")]
|
||||
public partial class Details : System.Web.Mvc.WebViewPage<Disco.Web.Models.Device.ShowModel>
|
||||
public partial class Details : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.ShowModel>
|
||||
{
|
||||
public Details()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
WriteLiteral("<div");
|
||||
|
||||
#line 2 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
|
||||
Authorization.Require(Claims.Device.ShowDetails);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<div");
|
||||
|
||||
WriteLiteral(" id=\"DeviceDetailTab-Details\"");
|
||||
|
||||
@@ -58,7 +68,7 @@ WriteLiteral(">\r\n <tbody>\r\n <tr>\r\n
|
||||
"ress</th>\r\n <td>");
|
||||
|
||||
|
||||
#line 8 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
#line 11 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
Write(Model.Device.DeviceDetails.LanMacAddress() ?? "Unknown");
|
||||
|
||||
|
||||
@@ -68,7 +78,7 @@ WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n
|
||||
"MAC Address</th>\r\n <td>");
|
||||
|
||||
|
||||
#line 12 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
#line 15 "..\..\Views\Device\DeviceParts\_Details.cshtml"
|
||||
Write(Model.Device.DeviceDetails.WLanMacAddress() ?? "Unknown");
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
@model Disco.Web.Models.Device.ShowModel
|
||||
@{
|
||||
Authorization.Require(Claims.Device.ShowJobs);
|
||||
}
|
||||
<div id="DeviceDetailTab-Jobs" class="DevicePart">
|
||||
<div id="DeviceDetailTab-JobsContainer">
|
||||
@Html.Partial(MVC.Shared.Views._JobTable, Model.Jobs)
|
||||
</div>
|
||||
<script>
|
||||
$('#DeviceDetailTabItems').append('<li><a href="#DeviceDetailTab-Jobs">Jobs [@(Model.Device.Jobs == null ? 0 : Model.Device.Jobs.Count)]</a></li>');
|
||||
$('#DeviceDetailTabItems').append('<li><a href="#DeviceDetailTab-Jobs">Jobs [@(Model.Jobs.Items.Count)]</a></li>');
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18033
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -28,19 +28,29 @@ namespace Disco.Web.Views.Device.DeviceParts
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/DeviceParts/_Jobs.cshtml")]
|
||||
public partial class Jobs : System.Web.Mvc.WebViewPage<Disco.Web.Models.Device.ShowModel>
|
||||
public partial class Jobs : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.ShowModel>
|
||||
{
|
||||
public Jobs()
|
||||
{
|
||||
}
|
||||
public override void Execute()
|
||||
{
|
||||
WriteLiteral("<div");
|
||||
|
||||
#line 2 "..\..\Views\Device\DeviceParts\_Jobs.cshtml"
|
||||
|
||||
Authorization.Require(Claims.Device.ShowJobs);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n<div");
|
||||
|
||||
WriteLiteral(" id=\"DeviceDetailTab-Jobs\"");
|
||||
|
||||
@@ -55,7 +65,7 @@ WriteLiteral(">\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 4 "..\..\Views\Device\DeviceParts\_Jobs.cshtml"
|
||||
#line 7 "..\..\Views\Device\DeviceParts\_Jobs.cshtml"
|
||||
Write(Html.Partial(MVC.Shared.Views._JobTable, Model.Jobs));
|
||||
|
||||
|
||||
@@ -65,8 +75,8 @@ WriteLiteral("\r\n </div>\r\n <script>\r\n $(\'#DeviceDetailTabItem
|
||||
"f=\"#DeviceDetailTab-Jobs\">Jobs [");
|
||||
|
||||
|
||||
#line 7 "..\..\Views\Device\DeviceParts\_Jobs.cshtml"
|
||||
Write(Model.Device.Jobs == null ? 0 : Model.Device.Jobs.Count);
|
||||
#line 10 "..\..\Views\Device\DeviceParts\_Jobs.cshtml"
|
||||
Write(Model.Jobs.Items.Count);
|
||||
|
||||
|
||||
#line default
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
@model Disco.Web.Models.Device.ShowModel
|
||||
@{
|
||||
Authorization.Require(Claims.Device.ShowAttachments);
|
||||
|
||||
var canAddAttachments = Authorization.Has(Claims.Device.Actions.AddAttachments);
|
||||
var canRemoveAnyAttachments = Authorization.Has(Claims.Device.Actions.RemoveAnyAttachments);
|
||||
var canRemoveOwnAttachments = Authorization.Has(Claims.Device.Actions.RemoveOwnAttachments);
|
||||
|
||||
Html.BundleDeferred("~/Style/Shadowbox");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Shadowbox");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Silverlight");
|
||||
|
||||
if (Authorization.Has(Claims.Device.Actions.AddAttachments))
|
||||
{
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Silverlight");
|
||||
}
|
||||
}
|
||||
<div id="DeviceDetailTab-Resources" class="DevicePart">
|
||||
<table id="deviceShowResources">
|
||||
<tr>
|
||||
<td id="Attachments">
|
||||
<td id="Attachments" class="@(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments")">
|
||||
<div class="attachmentOutput">
|
||||
@if (Model.Device.DeviceAttachments != null)
|
||||
{
|
||||
@@ -21,30 +31,35 @@
|
||||
{ @da.DocumentTemplate.Description}
|
||||
else
|
||||
{ @da.Comments }}
|
||||
</span><span class="author">@da.TechUser.ToString()</span><span class="remove"></span><span class="timestamp" title="@da.Timestamp.ToFullDateTime()">@da.Timestamp.ToFuzzy()</span>
|
||||
</span><span class="author">@da.TechUser.ToString()</span>@if (canRemoveAnyAttachments || (canRemoveOwnAttachments && da.TechUserId == CurrentUser.Id))
|
||||
{<text><span class="remove"></span></text>}<span class="timestamp" title="@da.Timestamp.ToFullDateTime()">@da.Timestamp.ToFuzzy()</span>
|
||||
</a>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<div class="attachmentInput clearfix">
|
||||
<span class="action upload"></span><span class="action photo"></span>
|
||||
</div>
|
||||
@if (canAddAttachments)
|
||||
{
|
||||
<div class="attachmentInput clearfix">
|
||||
<span class="action upload"></span><span class="action photo"></span>
|
||||
</div>
|
||||
}
|
||||
<script type="text/javascript">
|
||||
Shadowbox.init({
|
||||
skipSetup: true,
|
||||
modal: true
|
||||
});
|
||||
$(function () {
|
||||
$Attachments = $('#Attachments');
|
||||
$attachmentOutput = $Attachments.find('.attachmentOutput');
|
||||
|
||||
@if (canAddAttachments)
|
||||
{<text>
|
||||
//#region Add Attachments
|
||||
if (!document.DiscoFunctions) {
|
||||
document.DiscoFunctions = {};
|
||||
}
|
||||
document.DiscoFunctions.addAttachment = addAttachment;
|
||||
|
||||
$Attachments = $('#Attachments');
|
||||
$attachmentOutput = $Attachments.find('.attachmentOutput');
|
||||
|
||||
$attachmentOutput.find('span.remove').click(removeAttachment);
|
||||
|
||||
$('#dialogUpload').dialog({
|
||||
autoOpen: false,
|
||||
draggable: false,
|
||||
@@ -57,6 +72,101 @@
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
var onLoadNavigation = null;
|
||||
var isLoaded = null;
|
||||
Silverlight.createObject(
|
||||
'@(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap)',
|
||||
$('#silverlightHostUploadAttachment').get(0),
|
||||
'silverlightUploadAttachment',
|
||||
{ width: '840px', height: '500px', background: 'white', version: '4.0.60310.0' },
|
||||
{
|
||||
onLoad: function () {
|
||||
if (onLoadNavigation) {
|
||||
silverlightUploadAttachment.content.Navigator.Navigate(onLoadNavigation);
|
||||
isLoaded = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
'UploadUrl=@(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)))'
|
||||
);
|
||||
|
||||
$attachmentInput = $Attachments.find('.attachmentInput');
|
||||
$attachmentInput.find('.photo').click(function () {
|
||||
showDialog('/WebCam');
|
||||
});
|
||||
$attachmentInput.find('.upload').click(function () {
|
||||
showDialog('/File');
|
||||
});
|
||||
|
||||
silverlightUploadAttachment = $('#silverlightUploadAttachment').get(0);
|
||||
function showDialog(navigationPath) {
|
||||
$('#dialogUpload').dialog('open');
|
||||
if (isLoaded) {
|
||||
silverlightUploadAttachment.content.Navigator.Navigate(navigationPath);
|
||||
} else {
|
||||
onLoadNavigation = navigationPath;
|
||||
}
|
||||
};
|
||||
|
||||
function addAttachment(id, quick) {
|
||||
var data = { id: id };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.Device.Attachment())',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d.Result == 'OK') {
|
||||
var a = d.Attachment;
|
||||
@if (canRemoveAnyAttachments)
|
||||
{<text>buildAttachment(a, true);</text>}
|
||||
else if (canRemoveOwnAttachments)
|
||||
{<text>buildAttachment(a, (a.AuthorId === '@(CurrentUser.Id)'));</text>}
|
||||
else
|
||||
{<text>buildAttachment(a, false);</text>}
|
||||
|
||||
} else {
|
||||
alert('Unable to add attachment: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add attachment: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function buildAttachment(a, canRemove) {
|
||||
var t = '<a><span class="icon"><img alt="Attachment Thumbnail" /></span><span class="comments"></span><span class="author"></span>';
|
||||
if (canRemove)
|
||||
t += '<span class="remove"></span>';
|
||||
t += '<span class="timestamp"></span></a>';
|
||||
|
||||
var e = $(t);
|
||||
|
||||
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '@(Url.Action(MVC.API.Device.AttachmentDownload()))/' + a.Id);
|
||||
e.find('.icon img').attr('src', '@(Url.Action(MVC.API.Device.AttachmentThumbnail()))/' + a.Id);
|
||||
e.find('.comments').text(a.Comments);
|
||||
e.find('.author').text(a.Author);
|
||||
e.find('.timestamp').text(a.TimestampFuzzy).attr('title', a.TimestampFull);
|
||||
if (canRemove)
|
||||
e.find('.remove').click(removeAttachment);
|
||||
if (!quick)
|
||||
e.hide();
|
||||
$attachmentOutput.append(e);
|
||||
if (!quick)
|
||||
e.show('slow');
|
||||
if (a.MimeType.toLowerCase().indexOf('image/') == 0)
|
||||
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Comments });
|
||||
}
|
||||
|
||||
//#endregion
|
||||
</text>}
|
||||
@if (canRemoveAnyAttachments || canRemoveOwnAttachments)
|
||||
{<text>
|
||||
//#region Remove Attachments
|
||||
$attachmentOutput.find('span.remove').click(removeAttachment);
|
||||
|
||||
$('#dialogRemoveAttachment').dialog({
|
||||
resizable: false,
|
||||
height: 140,
|
||||
@@ -64,117 +174,50 @@
|
||||
autoOpen: false
|
||||
});
|
||||
|
||||
var onLoadNavigation = null;
|
||||
var isLoaded = null;
|
||||
Silverlight.createObject(
|
||||
'@(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap)',
|
||||
$('#silverlightHostUploadAttachment').get(0),
|
||||
'silverlightUploadAttachment',
|
||||
{ width: '840px', height: '500px', background: 'white', version: '4.0.60310.0' },
|
||||
{
|
||||
onLoad: function () {
|
||||
if (onLoadNavigation) {
|
||||
silverlightUploadAttachment.content.Navigator.Navigate(onLoadNavigation);
|
||||
isLoaded = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
'UploadUrl=@(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)))'
|
||||
);
|
||||
function removeAttachment() {
|
||||
$this = $(this).closest('a');
|
||||
|
||||
$attachmentInput = $Attachments.find('.attachmentInput');
|
||||
$attachmentInput.find('.photo').click(function () {
|
||||
showDialog('/WebCam');
|
||||
});
|
||||
$attachmentInput.find('.upload').click(function () {
|
||||
showDialog('/File');
|
||||
});
|
||||
|
||||
silverlightUploadAttachment = $('#silverlightUploadAttachment').get(0);
|
||||
function showDialog(navigationPath) {
|
||||
$('#dialogUpload').dialog('open');
|
||||
if (isLoaded) {
|
||||
silverlightUploadAttachment.content.Navigator.Navigate(navigationPath);
|
||||
} else {
|
||||
onLoadNavigation = navigationPath;
|
||||
}
|
||||
};
|
||||
function addAttachment(id, quick) {
|
||||
var data = { id: id };
|
||||
$.ajax({
|
||||
url: '@Url.Action(MVC.API.Device.Attachment())',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d.Result == 'OK') {
|
||||
var a = d.Attachment;
|
||||
|
||||
var e = $('<a><span class="icon"><img alt="Attachment Thumbnail" /></span><span class="comments"></span><span class="author"></span><span class="remove"></span><span class="timestamp"></span></a>');
|
||||
|
||||
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '@(Url.Action(MVC.API.Device.AttachmentDownload()))/' + a.Id);
|
||||
e.find('.icon img').attr('src', '@(Url.Action(MVC.API.Device.AttachmentThumbnail()))/' + a.Id);
|
||||
e.find('.comments').text(a.Comments);
|
||||
e.find('.author').text(a.Author);
|
||||
e.find('.timestamp').text(a.TimestampFuzzy).attr('title', a.TimestampFull);
|
||||
e.find('.remove').click(removeAttachment);
|
||||
if (!quick)
|
||||
e.hide();
|
||||
$attachmentOutput.append(e);
|
||||
if (!quick)
|
||||
e.show('slow');
|
||||
if (a.MimeType.toLowerCase().indexOf('image/') == 0)
|
||||
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Comments });
|
||||
} else {
|
||||
alert('Unable to add attachment: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add attachment: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
function removeAttachment() {
|
||||
$this = $(this).closest('a');
|
||||
|
||||
var data = { id: $this.attr('data-attachmentid') };
|
||||
var $dialogRemoveAttachment = $('#dialogRemoveAttachment');
|
||||
$dialogRemoveAttachment.dialog("enable");
|
||||
$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') {
|
||||
$this.hide(300).delay(300).queue(function () {
|
||||
var $this = $(this);
|
||||
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
|
||||
Shadowbox.removeCache(this);
|
||||
$this.remove();
|
||||
});
|
||||
} else {
|
||||
alert('Unable to remove attachment: ' + d);
|
||||
var data = { id: $this.attr('data-attachmentid') };
|
||||
var $dialogRemoveAttachment = $('#dialogRemoveAttachment');
|
||||
$dialogRemoveAttachment.dialog("enable");
|
||||
$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') {
|
||||
$this.hide(300).delay(300).queue(function () {
|
||||
var $this = $(this);
|
||||
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
|
||||
Shadowbox.removeCache(this);
|
||||
$this.remove();
|
||||
});
|
||||
} else {
|
||||
alert('Unable to remove attachment: ' + d);
|
||||
}
|
||||
$dialogRemoveAttachment.dialog("close");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to remove attachment: ' + textStatus);
|
||||
$dialogRemoveAttachment.dialog("close");
|
||||
}
|
||||
$dialogRemoveAttachment.dialog("close");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to remove attachment: ' + textStatus);
|
||||
$dialogRemoveAttachment.dialog("close");
|
||||
}
|
||||
});
|
||||
},
|
||||
"Cancel": function () {
|
||||
$dialogRemoveAttachment.dialog("close");
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
"Cancel": function () {
|
||||
$dialogRemoveAttachment.dialog("close");
|
||||
}
|
||||
});
|
||||
|
||||
$dialogRemoveAttachment.dialog('open');
|
||||
$dialogRemoveAttachment.dialog('open');
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//#endregion
|
||||
</text>}
|
||||
|
||||
$attachmentOutput.children('a').each(function () {
|
||||
$this = $(this);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18033
|
||||
// Runtime Version:4.0.30319.18051
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -28,12 +28,14 @@ namespace Disco.Web.Views.Device.DeviceParts
|
||||
using System.Web.WebPages;
|
||||
using Disco.BI.Extensions;
|
||||
using Disco.Models.Repository;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Web;
|
||||
using Disco.Web;
|
||||
using Disco.Web.Extensions;
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
||||
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/DeviceParts/_Resources.cshtml")]
|
||||
public partial class Resources : System.Web.Mvc.WebViewPage<Disco.Web.Models.Device.ShowModel>
|
||||
public partial class Resources : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.ShowModel>
|
||||
{
|
||||
public Resources()
|
||||
{
|
||||
@@ -43,9 +45,19 @@ namespace Disco.Web.Views.Device.DeviceParts
|
||||
|
||||
#line 2 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
|
||||
Authorization.Require(Claims.Device.ShowAttachments);
|
||||
|
||||
var canAddAttachments = Authorization.Has(Claims.Device.Actions.AddAttachments);
|
||||
var canRemoveAnyAttachments = Authorization.Has(Claims.Device.Actions.RemoveAnyAttachments);
|
||||
var canRemoveOwnAttachments = Authorization.Has(Claims.Device.Actions.RemoveOwnAttachments);
|
||||
|
||||
Html.BundleDeferred("~/Style/Shadowbox");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Shadowbox");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Silverlight");
|
||||
|
||||
if (Authorization.Has(Claims.Device.Actions.AddAttachments))
|
||||
{
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Silverlight");
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
@@ -64,6 +76,16 @@ WriteLiteral(">\r\n <tr>\r\n <td");
|
||||
|
||||
WriteLiteral(" id=\"Attachments\"");
|
||||
|
||||
WriteAttribute("class", Tuple.Create(" class=\"", 796), Tuple.Create("\"", 871)
|
||||
|
||||
#line 20 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 804), Tuple.Create<System.Object, System.Int32>(canAddAttachments ? "canAddAttachments" : "cannotAddAttachments"
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 804), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"attachmentOutput\"");
|
||||
@@ -71,13 +93,13 @@ WriteLiteral(" class=\"attachmentOutput\"");
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 12 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 22 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 12 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 22 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
if (Model.Device.DeviceAttachments != null)
|
||||
{
|
||||
foreach (var da in Model.Device.DeviceAttachments)
|
||||
@@ -88,20 +110,20 @@ WriteLiteral(">\r\n");
|
||||
#line hidden
|
||||
WriteLiteral(" <a");
|
||||
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 634), Tuple.Create("\"", 694)
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 1141), Tuple.Create("\"", 1201)
|
||||
|
||||
#line 16 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 641), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentDownload(da.Id))
|
||||
#line 26 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1148), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentDownload(da.Id))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 641), false)
|
||||
, 1148), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" data-attachmentid=\"");
|
||||
|
||||
|
||||
#line 16 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 26 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.Id);
|
||||
|
||||
|
||||
@@ -112,7 +134,7 @@ WriteLiteral("\"");
|
||||
WriteLiteral(" data-mimetype=\"");
|
||||
|
||||
|
||||
#line 16 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 26 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.MimeType);
|
||||
|
||||
|
||||
@@ -124,68 +146,68 @@ WriteLiteral(">\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"icon\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 800), Tuple.Create("\"", 820)
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 1307), Tuple.Create("\"", 1327)
|
||||
|
||||
#line 17 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 808), Tuple.Create<System.Object, System.Int32>(da.Filename
|
||||
#line 27 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1315), Tuple.Create<System.Object, System.Int32>(da.Filename
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 808), false)
|
||||
, 1315), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n <img");
|
||||
|
||||
WriteLiteral(" alt=\"Attachment Thumbnail\"");
|
||||
|
||||
WriteAttribute("src", Tuple.Create(" src=\"", 887), Tuple.Create("\"", 949)
|
||||
WriteAttribute("src", Tuple.Create(" src=\"", 1394), Tuple.Create("\"", 1456)
|
||||
|
||||
#line 18 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 893), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id))
|
||||
#line 28 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1400), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.AttachmentThumbnail(da.Id))
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 893), false)
|
||||
, 1400), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" /></span>\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"comments\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 1012), Tuple.Create("\"", 1032)
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 1519), Tuple.Create("\"", 1539)
|
||||
|
||||
#line 19 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1020), Tuple.Create<System.Object, System.Int32>(da.Comments
|
||||
#line 29 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1527), Tuple.Create<System.Object, System.Int32>(da.Comments
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 1020), false)
|
||||
, 1527), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">\r\n");
|
||||
|
||||
|
||||
#line 20 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 30 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 20 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 30 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
if (!string.IsNullOrEmpty(da.DocumentTemplateId))
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.DocumentTemplate.Description);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 21 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 31 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -193,14 +215,14 @@ WriteLiteral(">\r\n");
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 23 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 33 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.Comments);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 23 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 33 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
@@ -212,35 +234,52 @@ WriteLiteral(" class=\"author\"");
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 24 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 34 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.TechUser.ToString());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</span><span");
|
||||
WriteLiteral("</span>");
|
||||
|
||||
WriteLiteral(" class=\"remove\"");
|
||||
|
||||
WriteLiteral("></span><span");
|
||||
|
||||
WriteLiteral(" class=\"timestamp\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 1422), Tuple.Create("\"", 1460)
|
||||
|
||||
#line 24 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 1430), Tuple.Create<System.Object, System.Int32>(da.Timestamp.ToFullDateTime()
|
||||
#line 34 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
if (canRemoveAnyAttachments || (canRemoveOwnAttachments && da.TechUserId == CurrentUser.Id))
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 1430), false)
|
||||
WriteLiteral("<span");
|
||||
|
||||
WriteLiteral(" class=\"remove\"");
|
||||
|
||||
WriteLiteral("></span>");
|
||||
|
||||
|
||||
#line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("<span");
|
||||
|
||||
WriteLiteral(" class=\"timestamp\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 2125), Tuple.Create("\"", 2163)
|
||||
|
||||
#line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 2133), Tuple.Create<System.Object, System.Int32>(da.Timestamp.ToFullDateTime()
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 2133), false)
|
||||
);
|
||||
|
||||
WriteLiteral(">");
|
||||
|
||||
|
||||
#line 24 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.Timestamp.ToFuzzy());
|
||||
#line 35 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(da.Timestamp.ToFuzzy());
|
||||
|
||||
|
||||
#line default
|
||||
@@ -248,18 +287,34 @@ WriteLiteral(">");
|
||||
WriteLiteral("</span>\r\n </a> \r\n");
|
||||
|
||||
|
||||
#line 26 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 37 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" </div>\r\n <div");
|
||||
WriteLiteral(" </div>\r\n");
|
||||
|
||||
|
||||
#line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 40 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
if (canAddAttachments)
|
||||
{
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <div");
|
||||
|
||||
WriteLiteral(" class=\"attachmentInput clearfix\"");
|
||||
|
||||
WriteLiteral(">\r\n <span");
|
||||
WriteLiteral(">\r\n <span");
|
||||
|
||||
WriteLiteral(" class=\"action upload\"");
|
||||
|
||||
@@ -267,56 +322,93 @@ WriteLiteral("></span><span");
|
||||
|
||||
WriteLiteral(" class=\"action photo\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </div>\r\n <script");
|
||||
WriteLiteral("></span>\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 45 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
|
||||
WriteLiteral(">\r\n Shadowbox.init({\r\n skipSetup: true," +
|
||||
"\r\n modal: true\r\n });\r\n " +
|
||||
" $(function () {\r\n if (!document.DiscoFunctions) {\r\n " +
|
||||
" document.DiscoFunctions = {};\r\n " +
|
||||
" }\r\n document.DiscoFunctions.addAttachment = addAttachmen" +
|
||||
"t;\r\n\r\n $Attachments = $(\'#Attachments\');\r\n " +
|
||||
" $attachmentOutput = $Attachments.find(\'.attachmentOutput\');\r\n\r\n " +
|
||||
" $attachmentOutput.find(\'span.remove\').click(removeAttachment);\r\n" +
|
||||
"\r\n $(\'#dialogUpload\').dialog({\r\n " +
|
||||
" autoOpen: false,\r\n draggable: false,\r\n " +
|
||||
" modal: true,\r\n resizable: false,\r\n " +
|
||||
" width: 860,\r\n height: 550,\r\n" +
|
||||
" close: function () {\r\n " +
|
||||
" silverlightUploadAttachment.content.Navigator.Navigate(\'/Hidden\');\r\n " +
|
||||
" }\r\n });\r\n\r\n $(\'#" +
|
||||
"dialogRemoveAttachment\').dialog({\r\n resizable: false," +
|
||||
"\r\n height: 140,\r\n modal: t" +
|
||||
"rue,\r\n autoOpen: false\r\n });\r\n" +
|
||||
"\r\n var onLoadNavigation = null;\r\n " +
|
||||
"var isLoaded = null;\r\n Silverlight.createObject(\r\n " +
|
||||
" \'");
|
||||
WriteLiteral(@">
|
||||
Shadowbox.init({
|
||||
skipSetup: true,
|
||||
modal: true
|
||||
});
|
||||
$(function () {
|
||||
$Attachments = $('#Attachments');
|
||||
$attachmentOutput = $Attachments.find('.attachmentOutput');
|
||||
|
||||
");
|
||||
|
||||
|
||||
#line 70 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 55 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 55 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
if (canAddAttachments)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"
|
||||
//#region Add Attachments
|
||||
if (!document.DiscoFunctions) {
|
||||
document.DiscoFunctions = {};
|
||||
}
|
||||
document.DiscoFunctions.addAttachment = addAttachment;
|
||||
|
||||
$('#dialogUpload').dialog({
|
||||
autoOpen: false,
|
||||
draggable: false,
|
||||
modal: true,
|
||||
resizable: false,
|
||||
width: 860,
|
||||
height: 550,
|
||||
close: function () {
|
||||
silverlightUploadAttachment.content.Navigator.Navigate('/Hidden');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
var onLoadNavigation = null;
|
||||
var isLoaded = null;
|
||||
Silverlight.createObject(
|
||||
'");
|
||||
|
||||
|
||||
#line 80 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
$('#silverlightHostUploadAttachment').get(0),
|
||||
'silverlightUploadAttachment',
|
||||
{ width: '840px', height: '500px', background: 'white', version: '4.0.60310.0' },
|
||||
{
|
||||
onLoad: function () {
|
||||
if (onLoadNavigation) {
|
||||
silverlightUploadAttachment.content.Navigator.Navigate(onLoadNavigation);
|
||||
isLoaded = true;
|
||||
$('#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=");
|
||||
},
|
||||
'UploadUrl=");
|
||||
|
||||
|
||||
#line 82 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)));
|
||||
#line 92 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.AttachmentUpload(Model.Device.SerialNumber, null)));
|
||||
|
||||
|
||||
#line default
|
||||
@@ -324,124 +416,261 @@ WriteLiteral(@"',
|
||||
WriteLiteral(@"'
|
||||
);
|
||||
|
||||
$attachmentInput = $Attachments.find('.attachmentInput');
|
||||
$attachmentInput.find('.photo').click(function () {
|
||||
showDialog('/WebCam');
|
||||
});
|
||||
$attachmentInput.find('.upload').click(function () {
|
||||
showDialog('/File');
|
||||
});
|
||||
$attachmentInput = $Attachments.find('.attachmentInput');
|
||||
$attachmentInput.find('.photo').click(function () {
|
||||
showDialog('/WebCam');
|
||||
});
|
||||
$attachmentInput.find('.upload').click(function () {
|
||||
showDialog('/File');
|
||||
});
|
||||
|
||||
silverlightUploadAttachment = $('#silverlightUploadAttachment').get(0);
|
||||
function showDialog(navigationPath) {
|
||||
$('#dialogUpload').dialog('open');
|
||||
if (isLoaded) {
|
||||
silverlightUploadAttachment.content.Navigator.Navigate(navigationPath);
|
||||
} else {
|
||||
onLoadNavigation = navigationPath;
|
||||
}
|
||||
};
|
||||
function addAttachment(id, quick) {
|
||||
var data = { id: id };
|
||||
$.ajax({
|
||||
url: '");
|
||||
silverlightUploadAttachment = $('#silverlightUploadAttachment').get(0);
|
||||
function showDialog(navigationPath) {
|
||||
$('#dialogUpload').dialog('open');
|
||||
if (isLoaded) {
|
||||
silverlightUploadAttachment.content.Navigator.Navigate(navigationPath);
|
||||
} else {
|
||||
onLoadNavigation = navigationPath;
|
||||
}
|
||||
};
|
||||
|
||||
function addAttachment(id, quick) {
|
||||
var data = { id: id };
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 105 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.Attachment()));
|
||||
#line 116 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.Attachment()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d.Result == 'OK') {
|
||||
var a = d.Attachment;
|
||||
|
||||
var e = $('<a><span class=""icon""><img alt=""Attachment Thumbnail"" /></span><span class=""comments""></span><span class=""author""></span><span class=""remove""></span><span class=""timestamp""></span></a>');
|
||||
|
||||
e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '");
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d.Result == 'OK') {
|
||||
var a = d.Attachment;
|
||||
");
|
||||
|
||||
|
||||
#line 114 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.AttachmentDownload()));
|
||||
#line 122 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
|
||||
#line 122 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
if (canRemoveAnyAttachments)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("buildAttachment(a, true);");
|
||||
|
||||
|
||||
#line 123 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
else if (canRemoveOwnAttachments)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("buildAttachment(a, (a.AuthorId === \'");
|
||||
|
||||
|
||||
#line 125 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(CurrentUser.Id);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', " +
|
||||
"\'");
|
||||
WriteLiteral("\'));");
|
||||
|
||||
|
||||
#line 115 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.AttachmentThumbnail()));
|
||||
#line 125 "..\..\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("/\' + a.Id);\r\n e.find(\'.comments\').text(a.Comme" +
|
||||
"nts);\r\n e.find(\'.author\').text(a.Author);\r\n " +
|
||||
" e.find(\'.timestamp\').text(a.TimestampFuzzy).at" +
|
||||
"tr(\'title\', a.TimestampFull);\r\n e.find(\'.remo" +
|
||||
"ve\').click(removeAttachment);\r\n if (!quick)\r\n" +
|
||||
" e.hide();\r\n " +
|
||||
" $attachmentOutput.append(e);\r\n if (!qu" +
|
||||
"ick)\r\n e.show(\'slow\');\r\n " +
|
||||
" if (a.MimeType.toLowerCase().indexOf(\'image/\') == 0)\r\n " +
|
||||
" e.shadowbox({ gallery: \'attachments\', player: \'" +
|
||||
"img\', title: a.Comments });\r\n } else {\r\n " +
|
||||
" alert(\'Unable to add attachment: \' + d.Result);\r\n " +
|
||||
" }\r\n },\r\n " +
|
||||
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
|
||||
" alert(\'Unable to add attachment: \' + textStatus);\r\n " +
|
||||
" }\r\n });\r\n }\r\n " +
|
||||
" function removeAttachment() {\r\n $this = $(this)." +
|
||||
"closest(\'a\');\r\n\r\n var data = { id: $this.attr(\'data-attac" +
|
||||
"hmentid\') };\r\n var $dialogRemoveAttachment = $(\'#dialogRe" +
|
||||
"moveAttachment\');\r\n $dialogRemoveAttachment.dialog(\"enabl" +
|
||||
"e\");\r\n $dialogRemoveAttachment.dialog(\'option\', \'buttons\'" +
|
||||
", {\r\n \"Remove\": function () {\r\n " +
|
||||
" $dialogRemoveAttachment.dialog(\"disable\");\r\n " +
|
||||
" $dialogRemoveAttachment.dialog(\"option\", \"buttons\", null);\r\n " +
|
||||
" $.ajax({\r\n url: \'");
|
||||
WriteLiteral(@"
|
||||
} else {
|
||||
alert('Unable to add attachment: ' + d.Result);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
alert('Unable to add attachment: ' + textStatus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function buildAttachment(a, canRemove) {
|
||||
var t = '<a><span");
|
||||
|
||||
WriteLiteral(" class=\"icon\"");
|
||||
|
||||
WriteLiteral("><img");
|
||||
|
||||
WriteLiteral(" alt=\"Attachment Thumbnail\"");
|
||||
|
||||
WriteLiteral(" /></span><span");
|
||||
|
||||
WriteLiteral(" class=\"comments\"");
|
||||
|
||||
WriteLiteral("></span><span");
|
||||
|
||||
WriteLiteral(" class=\"author\"");
|
||||
|
||||
WriteLiteral("></span>\';\r\n if (canRemove)\r\n " +
|
||||
" t += \'<span");
|
||||
|
||||
WriteLiteral(" class=\"remove\"");
|
||||
|
||||
WriteLiteral("></span>\';\r\n t += \'<span");
|
||||
|
||||
WriteLiteral(" class=\"timestamp\"");
|
||||
|
||||
WriteLiteral("></span></a>\';\r\n\r\n var e = $(t);\r\n\r\n " +
|
||||
" e.attr(\'data-attachmentid\', a.Id).attr(\'data-mimetype\', a.MimeType).at" +
|
||||
"tr(\'href\', \'");
|
||||
|
||||
|
||||
#line 147 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.AttachmentRemove()));
|
||||
Write(Url.Action(MVC.API.Device.AttachmentDownload()));
|
||||
|
||||
|
||||
#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 " +
|
||||
" $this.hide(300).delay(300).queue(function () {\r\n " +
|
||||
" var $this = $(this);\r\n " +
|
||||
" if ($this.attr(\'data-mimetype\').toLowerCase(" +
|
||||
").indexOf(\'image/\') == 0)\r\n S" +
|
||||
"hadowbox.removeCache(this);\r\n $th" +
|
||||
"is.remove();\r\n });\r\n " +
|
||||
" } else {\r\n ale" +
|
||||
"rt(\'Unable to remove attachment: \' + d);\r\n " +
|
||||
" }\r\n $dialogRemoveAttachment.dialog(\"clo" +
|
||||
"se\");\r\n },\r\n " +
|
||||
" error: function (jqXHR, textStatus, errorThrown) {\r\n " +
|
||||
" alert(\'Unable to remove attachment: \' + textStatus);\r\n " +
|
||||
" $dialogRemoveAttachment.dialog(\"close\");\r\n " +
|
||||
" }\r\n });\r\n " +
|
||||
" },\r\n \"Cancel\": function () {\r\n " +
|
||||
" $dialogRemoveAttachment.dialog(\"close\");\r\n " +
|
||||
" }\r\n });\r\n\r\n $dialogR" +
|
||||
"emoveAttachment.dialog(\'open\');\r\n\r\n return false;\r\n " +
|
||||
" }\r\n\r\n $attachmentOutput.children(\'a\').each(func" +
|
||||
"tion () {\r\n $this = $(this);\r\n if " +
|
||||
"($this.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
|
||||
" $this.shadowbox({ gallery: \'attachments\', player: \'img\', title: " +
|
||||
"$this.find(\'.comments\').text() });\r\n });\r\n });" +
|
||||
"\r\n </script>\r\n </td>\r\n </tr>\r\n </table>\r\n " +
|
||||
" <div");
|
||||
WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', \'");
|
||||
|
||||
|
||||
#line 148 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.AttachmentThumbnail()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"/' + a.Id);
|
||||
e.find('.comments').text(a.Comments);
|
||||
e.find('.author').text(a.Author);
|
||||
e.find('.timestamp').text(a.TimestampFuzzy).attr('title', a.TimestampFull);
|
||||
if (canRemove)
|
||||
e.find('.remove').click(removeAttachment);
|
||||
if (!quick)
|
||||
e.hide();
|
||||
$attachmentOutput.append(e);
|
||||
if (!quick)
|
||||
e.show('slow');
|
||||
if (a.MimeType.toLowerCase().indexOf('image/') == 0)
|
||||
e.shadowbox({ gallery: 'attachments', player: 'img', title: a.Comments });
|
||||
}
|
||||
|
||||
//#endregion
|
||||
");
|
||||
|
||||
|
||||
#line 164 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 165 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
if (canRemoveAnyAttachments || canRemoveOwnAttachments)
|
||||
{
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"
|
||||
//#region Remove Attachments
|
||||
$attachmentOutput.find('span.remove').click(removeAttachment);
|
||||
|
||||
$('#dialogRemoveAttachment').dialog({
|
||||
resizable: false,
|
||||
height: 140,
|
||||
modal: true,
|
||||
autoOpen: false
|
||||
});
|
||||
|
||||
function removeAttachment() {
|
||||
$this = $(this).closest('a');
|
||||
|
||||
var data = { id: $this.attr('data-attachmentid') };
|
||||
var $dialogRemoveAttachment = $('#dialogRemoveAttachment');
|
||||
$dialogRemoveAttachment.dialog(""enable"");
|
||||
$dialogRemoveAttachment.dialog('option', 'buttons', {
|
||||
""Remove"": function () {
|
||||
$dialogRemoveAttachment.dialog(""disable"");
|
||||
$dialogRemoveAttachment.dialog(""option"", ""buttons"", null);
|
||||
$.ajax({
|
||||
url: '");
|
||||
|
||||
|
||||
#line 188 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Url.Action(MVC.API.Device.AttachmentRemove()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\',\r\n dataType: \'json\',\r\n " +
|
||||
" data: data,\r\n succe" +
|
||||
"ss: function (d) {\r\n if (d == \'OK\') {" +
|
||||
"\r\n $this.hide(300).delay(300).que" +
|
||||
"ue(function () {\r\n var $this " +
|
||||
"= $(this);\r\n if ($this.attr(\'" +
|
||||
"data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " +
|
||||
" Shadowbox.removeCache(this);\r\n " +
|
||||
" $this.remove();\r\n " +
|
||||
" });\r\n } else {\r\n " +
|
||||
" alert(\'Unable to remove attachment:" +
|
||||
" \' + d);\r\n }\r\n " +
|
||||
" $dialogRemoveAttachment.dialog(\"close\");\r\n " +
|
||||
" },\r\n error: functi" +
|
||||
"on (jqXHR, textStatus, errorThrown) {\r\n " +
|
||||
" alert(\'Unable to remove attachment: \' + textStatus);\r\n " +
|
||||
" $dialogRemoveAttachment.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 //#endr" +
|
||||
"egion\r\n ");
|
||||
|
||||
|
||||
#line 220 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
}
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"
|
||||
$attachmentOutput.children('a').each(function () {
|
||||
$this = $(this);
|
||||
if ($this.attr('data-mimetype').toLowerCase().indexOf('image/') == 0)
|
||||
$this.shadowbox({ gallery: 'attachments', player: 'img', title: $this.find('.comments').text() });
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div");
|
||||
|
||||
WriteLiteral(" id=\"dialogUpload\"");
|
||||
|
||||
@@ -468,7 +697,7 @@ WriteLiteral("></span>\r\n Are you sure?\r\n </p>\r\n </div
|
||||
"id=\"DeviceDetailTab-ResourcesLink\">Attachments [");
|
||||
|
||||
|
||||
#line 200 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
#line 243 "..\..\Views\Device\DeviceParts\_Resources.cshtml"
|
||||
Write(Model.Device.DeviceAttachments == null ? 0 : Model.Device.DeviceAttachments.Count);
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@model Disco.Web.Models.Device.ShowModel
|
||||
@{
|
||||
Authorization.Require(Claims.Device.Show);
|
||||
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
|
||||
}
|
||||
<table id="Device_Show_Subjects">
|
||||
@@ -23,19 +25,42 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Asset:</td>
|
||||
<td>@Html.TextBoxFor(m => m.Device.AssetNumber, new { @class = "small discreet" }) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader()</td>
|
||||
<td>
|
||||
@if (Authorization.Has(Claims.Device.Properties.AssetNumber))
|
||||
{
|
||||
@Html.TextBoxFor(m => m.Device.AssetNumber, new { @class = "small discreet" }) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader()
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="small discreet">@Model.Device.AssetNumber</span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Location:</td>
|
||||
<td>@Html.TextBoxFor(m => m.Device.Location, new { @class = "small discreet" }) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader()</td>
|
||||
<td>
|
||||
@if (Authorization.Has(Claims.Device.Properties.Location))
|
||||
{
|
||||
@Html.TextBoxFor(m => m.Device.Location, new { @class = "small discreet" }) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader()
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="small discreet">@Model.Device.Location</span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script>
|
||||
$(function () {
|
||||
document.DiscoFunctions.PropertyChangeHelper($('#Device_AssetNumber'), 'Unknown', '@Url.Action(MVC.API.Device.UpdateAssetNumber(Model.Device.SerialNumber, null))', 'AssetNumber');
|
||||
document.DiscoFunctions.PropertyChangeHelper($('#Device_Location'), 'Unknown', '@Url.Action(MVC.API.Device.UpdateLocation(Model.Device.SerialNumber, null))', 'Location');
|
||||
});
|
||||
</script>
|
||||
@if (Authorization.HasAny(Claims.Device.Properties.AssetNumber, Claims.Device.Properties.Location))
|
||||
{
|
||||
<script>
|
||||
$(function () {
|
||||
@if (Authorization.Has(Claims.Device.Properties.AssetNumber))
|
||||
{<text>document.DiscoFunctions.PropertyChangeHelper($('#Device_AssetNumber'), 'Unknown', '@Url.Action(MVC.API.Device.UpdateAssetNumber(Model.Device.SerialNumber, null))', 'AssetNumber');</text>}
|
||||
@if (Authorization.Has(Claims.Device.Properties.Location))
|
||||
{<text>document.DiscoFunctions.PropertyChangeHelper($('#Device_Location'), 'Unknown', '@Url.Action(MVC.API.Device.UpdateLocation(Model.Device.SerialNumber, null))', 'Location');</text>}
|
||||
});
|
||||
</script>
|
||||
}
|
||||
</div>
|
||||
<div id="Device_Show_Details_Dates" class="status">
|
||||
<table class="none verticalHeadings">
|
||||
@@ -146,7 +171,7 @@
|
||||
{
|
||||
<div id="Device_Show_User">
|
||||
<div id="Device_Show_User_DisplayName" title="Display Name">@Html.ActionLink(assignedUser.DisplayName, MVC.User.Show(assignedUser.Id))</div>
|
||||
<div id="Device_Show_User_Id" title="Id">@assignedUser.Id <span id="Device_Show_User_Type" title="Type">[@(assignedUser.Type)]</span></div>
|
||||
<div id="Device_Show_User_Id" title="Id">@assignedUser.Id</div>
|
||||
@if (!string.IsNullOrWhiteSpace(assignedUser.PhoneNumber))
|
||||
{
|
||||
<div id="Device_Show_User_PhoneNumber" title="Phone Number">@assignedUser.PhoneNumber</div>
|
||||
@@ -165,11 +190,13 @@
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="Device_Show_GenerateDocument_Container" class="status">
|
||||
@Html.DropDownList("Device_Show_GenerateDocument", Model.DocumentTemplatesSelectListItems)
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var generatePdfUrl = '@Url.Action(MVC.API.Device.GeneratePdf(Model.Device.SerialNumber.ToString(), null))?DocumentTemplateId=';
|
||||
@if (Authorization.Has(Claims.Device.Actions.GenerateDocuments))
|
||||
{
|
||||
<div id="Device_Show_GenerateDocument_Container" class="status">
|
||||
@Html.DropDownList("Device_Show_GenerateDocument", Model.DocumentTemplatesSelectListItems)
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
var generatePdfUrl = '@Url.Action(MVC.API.Device.GeneratePdf(Model.Device.SerialNumber.ToString(), null))?DocumentTemplateId=';
|
||||
var $documentTemplates = $('#Device_Show_GenerateDocument');
|
||||
$documentTemplates.change(function () {
|
||||
var v = $documentTemplates.val();
|
||||
@@ -179,8 +206,9 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</td>
|
||||
<td id="Device_Show_Policies" rowspan="2">
|
||||
@@ -602,7 +630,7 @@
|
||||
{
|
||||
<li>
|
||||
<input type="radio" id="Device_Show_Device_Actions_Decommission_Reason_@((int)decommissionReason)"
|
||||
name="Device_Show_Device_Actions_Decommission_Reason" value="@((int)decommissionReason)" @((decommissionReason== Device.DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty)/>
|
||||
name="Device_Show_Device_Actions_Decommission_Reason" value="@((int)decommissionReason)" @((decommissionReason == Device.DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty)/>
|
||||
<label for="Device_Show_Device_Actions_Decommission_Reason_@((int)decommissionReason)">@(decommissionReason.ReasonMessage())</label>
|
||||
</li>
|
||||
}
|
||||
@@ -627,7 +655,7 @@
|
||||
"Decommission": function () {
|
||||
|
||||
var reasonId = buttonDialog.find('input:checked').val();
|
||||
|
||||
|
||||
var $this = $(this);
|
||||
$this.dialog("disable");
|
||||
$this.dialog("option", "buttons", null);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user