#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.17929
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Disco.Web.Areas.Config.Views.DeviceProfile
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Text;
    using System.Web;
    using System.Web.Helpers;
    using System.Web.Mvc;
    using System.Web.Mvc.Ajax;
    using System.Web.Mvc.Html;
    using System.Web.Routing;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.WebPages;
    using Disco.BI.Extensions;
    using Disco.Models.Repository;
    using Disco.Web;
    using Disco.Web.Extensions;
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
    [System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceProfile/Show.cshtml")]
    public class Show : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.ShowModel>
    {
        public Show()
        {
        }
        public override void Execute()
        {
            
            #line 2 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
  
    ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), Model.DeviceProfile.ToString());
    Html.BundleDeferred("~/Style/jQueryUI/dynatree");
    Html.BundleDeferred("~/ClientScripts/Modules/jQueryUI-DynaTree");

            
            #line default
            #line hidden
WriteLiteral("\r\n<div");

WriteLiteral(" id=\"configurationDeviceProfileShow\"");

WriteLiteral(" class=\"form\"");

WriteLiteral(" style=\"width: 600px\"");

WriteLiteral(">\r\n    <table>\r\n        <tr>\r\n            <th>\r\n                Id:\r\n            " +
"</th>\r\n            <td>\r\n");

WriteLiteral("                ");

            
            #line 14 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.DisplayFor(model => model.DeviceProfile.Id));

            
            #line default
            #line hidden
WriteLiteral("\r\n            </td>\r\n        </tr>\r\n        <tr>\r\n            <th>\r\n             " +
"   Name:\r\n            </th>\r\n            <td>");

            
            #line 21 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.TextBoxFor(model => model.DeviceProfile.Name));

            
            #line default
            #line hidden
WriteLiteral("\r\n");

WriteLiteral("                ");

            
            #line 22 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxSave());

            
            #line default
            #line hidden
WriteLiteral("\r\n");

WriteLiteral("                ");

            
            #line 23 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
WriteLiteral("\r\n                <script");

WriteLiteral(" type=\"text/javascript\"");

WriteLiteral(@">
                    $(function () {
                        var $Name = $('#DeviceProfile_Name');
                        var $NameAjaxSave = $Name.next('.ajaxSave');
                        $Name
                            .watermark('Profile Short Name')
                            .focus(function () { $Name.select() })
                            .keydown(function (e) {
                                $NameAjaxSave.show();
                                if (e.which == 13) {
                                    $(this).blur();
                                }
                            }).blur(function () {
                                $NameAjaxSave.hide();
                            })
                            .change(function () {
                                $NameAjaxSave.hide();
                                var $ajaxLoading = $NameAjaxSave.next('.ajaxLoading').show();
                                var data = { ProfileName: $Name.val() };
                                $.ajax({
                                    url: '");

            
            #line 44 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                     Write(Url.Action(MVC.API.DeviceProfile.UpdateName(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"',
                                    dataType: 'json',
                                    data: data,
                                    success: function (d) {
                                        if (d == 'OK') {
                                            $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                        } else {
                                            $ajaxLoading.hide();
                                            alert('Unable to update name: ' + d);
                                        }
                                    },
                                    error: function (jqXHR, textStatus, errorThrown) {
                                        alert('Unable to update name: ' + textStatus);
                                        $ajaxLoading.hide();
                                    }
                                });
                            });
                    });
                </script>
            </td>
        </tr>
        <tr>
            <th>
                Short Name:
            </th>
            <td>");

            
            #line 69 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.TextBoxFor(model => model.DeviceProfile.ShortName));

            
            #line default
            #line hidden
WriteLiteral("\r\n");

WriteLiteral("                ");

            
            #line 70 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxSave());

            
            #line default
            #line hidden
WriteLiteral("\r\n");

WriteLiteral("                ");

            
            #line 71 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
WriteLiteral("\r\n                <script");

WriteLiteral(" type=\"text/javascript\"");

WriteLiteral(@">
                    $(function () {
                        var $ShortName = $('#DeviceProfile_ShortName');
                        var $ShortNameAjaxSave = $ShortName.next('.ajaxSave');
                        $ShortName
                            .watermark('Profile Short Name')
                            .focus(function () { $ShortName.select() })
                            .keydown(function (e) {
                                $ShortNameAjaxSave.show();
                                if (e.which == 13) {
                                    $(this).blur();
                                }
                            }).blur(function () {
                                $ShortNameAjaxSave.hide();
                            })
                            .change(function () {
                                $ShortNameAjaxSave.hide();
                                var $ajaxLoading = $ShortNameAjaxSave.next('.ajaxLoading').show();
                                var data = { ShortName: $ShortName.val() };
                                $.ajax({
                                    url: '");

            
            #line 92 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                     Write(Url.Action(MVC.API.DeviceProfile.UpdateShortName(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"',
                                    dataType: 'json',
                                    data: data,
                                    success: function (d) {
                                        if (d == 'OK') {
                                            $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                        } else {
                                            $ajaxLoading.hide();
                                            alert('Unable to update short name: ' + d);
                                        }
                                    },
                                    error: function (jqXHR, textStatus, errorThrown) {
                                        alert('Unable to update short name: ' + textStatus);
                                        $ajaxLoading.hide();
                                    }
                                });
                            });
                    });
                </script>
            </td>
        </tr>
        <tr>
            <th>
                Description:
            </th>
            <td>");

            
            #line 117 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.TextBoxFor(model => model.DeviceProfile.Description));

            
            #line default
            #line hidden
WriteLiteral("\r\n");

WriteLiteral("                ");

            
            #line 118 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxSave());

            
            #line default
            #line hidden
WriteLiteral("\r\n");

WriteLiteral("                ");

            
            #line 119 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
WriteLiteral("\r\n                <script");

WriteLiteral(" type=\"text/javascript\"");

WriteLiteral(@">
                    $(function () {
                        var $Description = $('#DeviceProfile_Description');
                        var $DescriptionAjaxSave = $Description.next('.ajaxSave');
                        $Description
                            .watermark('Profile Description')
                            .focus(function () { $Description.select() })
                            .keydown(function (e) {
                                $DescriptionAjaxSave.show();
                                if (e.which == 13) {
                                    $(this).blur();
                                }
                            }).blur(function () {
                                $DescriptionAjaxSave.hide();
                            })
                            .change(function () {
                                $DescriptionAjaxSave.hide();
                                var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
                                var data = { Description: $Description.val() };
                                $.ajax({
                                    url: '");

            
            #line 140 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                     Write(Url.Action(MVC.API.DeviceProfile.UpdateDescription(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"',
                                    dataType: 'json',
                                    data: data,
                                    success: function (d) {
                                        if (d == 'OK') {
                                            $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                        } else {
                                            $ajaxLoading.hide();
                                            alert('Unable to update description: ' + d);
                                        }
                                    },
                                    error: function (jqXHR, textStatus, errorThrown) {
                                        alert('Unable to update description: ' + textStatus);
                                        $ajaxLoading.hide();
                                    }
                                });
                            });
                    });
                </script>
            </td>
        </tr>
        <tr>
            <th>
                Distribution Type:
            </th>
            <td>
");

WriteLiteral("                ");

            
            #line 166 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.DropDownList("DeviceProfile_DistributionType", Model.DeviceProfileDistributionTypes));

            
            #line default
            #line hidden
WriteLiteral("\r\n");

WriteLiteral("                ");

            
            #line 167 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
WriteLiteral("\r\n                <script");

WriteLiteral(" type=\"text/javascript\"");

WriteLiteral(@">
                    $(function () {
                        $('#DeviceProfile_DistributionType').change(function () {
                            var $this = $(this);
                            var $ajaxLoading = $this.next('.ajaxLoading').show();
                            var data = { DistributionType: $this.val() };
                            $.getJSON('");

            
            #line 174 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                  Write(Url.Action(MVC.API.DeviceProfile.UpdateDistributionType(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"', data, function (response, result) {
                                if (result != 'success' || response != 'OK') {
                                    alert('Unable to change Distribution Type:\n' + response);
                                    $ajaxLoading.hide();
                                } else {
                                    $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                }
                            });
                        });
                    });
                </script>
            </td>
        </tr>
        <tr>
            <th>
                Address:
            </th>
            <td>
");

WriteLiteral("                ");

            
            #line 192 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.DropDownListFor(m => m.DeviceProfile.DefaultOrganisationAddress, Model.OrganisationAddresses.ToSelectListItems(Model.DeviceProfile.DefaultOrganisationAddress, true, "None")));

            
            #line default
            #line hidden
WriteLiteral("\r\n");

WriteLiteral("                ");

            
            #line 193 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
WriteLiteral("\r\n                <script");

WriteLiteral(" type=\"text/javascript\"");

WriteLiteral(@">
                    $(function () {
                        $('#DeviceProfile_DefaultOrganisationAddress').change(function () {
                            var $this = $(this);
                            var $ajaxLoading = $this.next('.ajaxLoading').show();
                            var data = { DefaultOrganisationAddress: $this.val() };
                            $.getJSON('");

            
            #line 200 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                  Write(Url.Action(MVC.API.DeviceProfile.UpdateDefaultOrganisationAddress(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"', data, function (response, result) {
                                if (result != 'success' || response != 'OK') {
                                    alert('Unable to change Address:\n' + response);
                                    $ajaxLoading.hide();
                                } else {
                                    $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                }
                            });
                        });
                    });
                </script>
            </td>
        </tr>
        <tr>
            <th>
                Allocate Certificates:
            </th>
            <td>
");

WriteLiteral("                ");

            
            #line 218 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.DropDownListFor(model => model.DeviceProfile.CertificateProviderId, Model.CertificateProviders.ToSelectListItems(null, true, "Not Allocated")));

            
            #line default
            #line hidden
WriteLiteral("\r\n");

WriteLiteral("                ");

            
            #line 219 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
WriteLiteral("\r\n                <script");

WriteLiteral(" type=\"text/javascript\"");

WriteLiteral(@">
                    $(function () {
                        var $field = $('#DeviceProfile_CertificateProviderId');
                        var $ajaxLoading = $field.next('.ajaxLoading');
                        $field
                        .change(function () {
                            $ajaxLoading.show();
                            var data = { CertificateProviderId: $field.val() };
                            $.ajax({
                                url: '");

            
            #line 229 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                 Write(Url.Action(MVC.API.DeviceProfile.UpdateCertificateProviderId(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"',
                                dataType: 'json',
                                data: data,
                                success: function (d) {
                                    if (d == 'OK') {
                                        $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                    } else {
                                        $ajaxLoading.hide();
                                        alert('Unable to update Certificate Provider Id: ' + d);
                                    }
                                },
                                error: function (jqXHR, textStatus, errorThrown) {
                                    alert('Unable to update Certificate Provider Id: ' + textStatus);
                                    $ajaxLoading.hide();
                                }
                            });
                        });
                    });
                </script>
            </td>
        </tr>
        <tr>
            <th>
                Computer Name Template Expression:
            </th>
            <td>");

            
            #line 254 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.TextBoxFor(model => model.DeviceProfile.ComputerNameTemplate));

            
            #line default
            #line hidden
WriteLiteral("\r\n");

WriteLiteral("                ");

            
            #line 255 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxSave());

            
            #line default
            #line hidden
WriteLiteral("\r\n");

WriteLiteral("                ");

            
            #line 256 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
WriteLiteral("\r\n                <a");

WriteLiteral(" id=\"expressionBrowserAnchor\"");

WriteAttribute("href", Tuple.Create(" href=\"", 13404), Tuple.Create("\"", 13473)
            
            #line 257 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
, Tuple.Create(Tuple.Create("", 13411), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.DocumentTemplate.ExpressionBrowser())
            
            #line default
            #line hidden
, 13411), false)
);

WriteLiteral(">\r\n                    &nbsp;</a>\r\n                <script");

WriteLiteral(" type=\"text/javascript\"");

WriteLiteral(@">
                    $(function () {
                        var $ComputerNameTemplate = $('#DeviceProfile_ComputerNameTemplate');
                        var $ajaxSave = $ComputerNameTemplate.next('.ajaxSave');
                        $ComputerNameTemplate
                            .focus(function () { $ComputerNameTemplate.select() })
                            .keydown(function (e) {
                                $ajaxSave.show();
                                if (e.which == 13) {
                                    $(this).blur();
                                }
                            }).blur(function () {
                                $ajaxSave.hide();
                            })
                            .change(function () {
                                $ajaxSave.hide();
                                var $ajaxLoading = $ajaxSave.next('.ajaxLoading').show();
                                var data = { ComputerNameTemplate: $ComputerNameTemplate.val() };
                                $.ajax({
                                    url: '");

            
            #line 278 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                      Write(Url.Action(MVC.API.DeviceProfile.UpdateComputerNameTemplate(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"',
                                    dataType: 'json',
                                    data: data,
                                    success: function (d) {
                                        if (d == 'OK') {
                                            $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                        } else {
                                            $ajaxLoading.hide();
                                            alert('Unable to update computer name template: ' + d);
                                        }
                                    },
                                    error: function (jqXHR, textStatus, errorThrown) {
                                        alert('Unable to update computer name template: ' + textStatus);
                                        $ajaxLoading.hide();
                                    }
                                });
                            });
                    });
                </script>
                <div");

WriteLiteral(" style=\"margin-top: 8px;\"");

WriteLiteral(">\r\n                    <label");

WriteLiteral(" for=\"DeviceProfile_ProvisionADAccount\"");

WriteLiteral(">\r\n                        Provision Active Directory Account:\r\n                 " +
"   </label>\r\n                    <input");

WriteLiteral(" id=\"DeviceProfile_ProvisionADAccount\"");

WriteLiteral(" type=\"checkbox\"");

WriteLiteral(" ");

            
            #line 301 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                             Write(Model.DeviceProfile.ProvisionADAccount ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));

            
            #line default
            #line hidden
WriteLiteral("/>\r\n");

WriteLiteral("                    ");

            
            #line 302 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
               Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
WriteLiteral("\r\n                    <script");

WriteLiteral(" type=\"text/javascript\"");

WriteLiteral(@">
                        $(function () {
                            $('#DeviceProfile_ProvisionADAccount').click(function () {
                                var $this = $(this);
                                var $ajaxLoading = $this.next('.ajaxLoading').show();
                                var data = { ProvisionADAccount: $this.is(':checked') };
                                $.getJSON('");

            
            #line 309 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                      Write(Url.Action(MVC.API.DeviceProfile.UpdateProvisionADAccount(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"', data, function (response, result) {
                                    if (result != 'success' || response != 'OK') {
                                        alert('Unable to change Provision AD Account:\n' + response);
                                        $ajaxLoading.hide();
                                    } else {
                                        $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                    }
                                });
                            });
                        });
                    </script>
                </div>
                <div");

WriteLiteral(" style=\"margin-top: 8px;\"");

WriteLiteral(">\r\n                    <label");

WriteLiteral(" for=\"DeviceProfile_EnforceComputerNameConvention\"");

WriteLiteral(">\r\n                        Enforce Naming Convention:\r\n                    </labe" +
"l>\r\n                    <input");

WriteLiteral(" id=\"DeviceProfile_EnforceComputerNameConvention\"");

WriteLiteral(" type=\"checkbox\"");

WriteLiteral(" ");

            
            #line 325 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                        Write(Model.DeviceProfile.EnforceComputerNameConvention ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));

            
            #line default
            #line hidden
WriteLiteral("/>\r\n");

WriteLiteral("                    ");

            
            #line 326 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
               Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
WriteLiteral("\r\n                    <script");

WriteLiteral(" type=\"text/javascript\"");

WriteLiteral(@">
                        $(function () {
                            $('#DeviceProfile_EnforceComputerNameConvention').click(function () {
                                var $this = $(this);
                                var $ajaxLoading = $this.next('.ajaxLoading').show();
                                var data = { EnforceComputerNameConvention: $this.is(':checked') };
                                $.getJSON('");

            
            #line 333 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                      Write(Url.Action(MVC.API.DeviceProfile.UpdateEnforceComputerNameConvention(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"', data, function (response, result) {
                                    if (result != 'success' || response != 'OK') {
                                        alert('Unable to change Enforce Computer Name Convention:\n' + response);
                                        $ajaxLoading.hide();
                                    } else {
                                        $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                    }
                                });
                            });
                        });
                    </script>
                </div>
            </td>
        </tr>
        <tr>
            <th>
                Default Organisational Unit:
            </th>
            <td>
");

WriteLiteral("                ");

            
            #line 352 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.HiddenFor(model => model.DeviceProfile.OrganisationalUnit));

            
            #line default
            #line hidden
WriteLiteral("\r\n                <div");

WriteLiteral(" id=\"displayOrganisationalUnit\"");

WriteLiteral(">\r\n                </div>\r\n                <a");

WriteLiteral(" id=\"changeOrganisationalUnit\"");

WriteLiteral(" href=\"#\"");

WriteLiteral(">Change</a>");

            
            #line 355 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                               Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
WriteLiteral("\r\n                <div");

WriteLiteral(" id=\"dialogOrganisationalUnit\"");

WriteLiteral(" title=\"Default Organisational Unit\"");

WriteLiteral(">\r\n                    <div");

WriteLiteral(" id=\"treeOrganisationalUnit\"");

WriteLiteral(">\r\n                    </div>\r\n                </div>\r\n                <script");

WriteLiteral(" type=\"text/javascript\"");

WriteLiteral(@">
                    $(function () {
                        var ouValue = $('#DeviceProfile_OrganisationalUnit');
                        var ouDisplay = $('#displayOrganisationalUnit');
                        var ouTree = $('#treeOrganisationalUnit');
                        var ouChangeLink = $('#changeOrganisationalUnit');
                        var ouTreeLoaded = false;
                        var ouFriendlyName = function (ou) {
                            return ou.replace(/ou=/gi, '').split(',').reverse().join(' > ');
                        };
                        var updateDisplayOrganisationalUnit = function () {
                            var value = ouValue.val();
                            if (value) {
                                ouDisplay.text(ouFriendlyName(value));
                            } else {
                                ouDisplay.text('{Default Computers Container}');
                            }
                        };
                        var ouSet = function (ou) {
                            $ajaxLoading = ouChangeLink.next('.ajaxLoading').show();
                            var data = { OrganisationalUnit: ou };
                            $.getJSON('");

            
            #line 381 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                  Write(Url.Action(MVC.API.DeviceProfile.UpdateOrganisationalUnit(Model.DeviceProfile.Id, null)));

            
            #line default
            #line hidden
WriteLiteral("\', data, function (response, result) {\r\n                                if (resul" +
"t != \'success\' || response != \'OK\') {\r\n                                    alert" +
"(\'Unable to change Organisational Unit:\\n\' + response);\r\n                       " +
"             $ajaxLoading.hide();\r\n                                } else {\r\n   " +
"                                 ouValue.val(ou);\r\n                             " +
"       updateDisplayOrganisationalUnit();\r\n                                    $" +
"ajaxLoading.hide().next(\'.ajaxOk\').show().delay(\'fast\').fadeOut(\'slow\');\r\n      " +
"                          }\r\n                            });\r\n                  " +
"      }\r\n                        var ouUpdateTree = function () {\r\n             " +
"               var dynaTree = ouTree.dynatree(\"getTree\");\r\n                     " +
"       var value = ouValue.val();\r\n                            if (value) {\r\n   " +
"                             dynaTree.activateKey(value);\r\n                     " +
"       } else {\r\n                                var activeNode = dynaTree.getAc" +
"tiveNode();\r\n                                if (activeNode)\r\n                  " +
"                  activeNode.deactivate();\r\n                            }\r\n     " +
"                   }\r\n\r\n                        var ouDialog = $(\'#dialogOrganis" +
"ationalUnit\').dialog({\r\n                            autoOpen: false,\r\n          " +
"                  buttons: {\r\n                                \'Use Default Conta" +
"iner\': function () {\r\n                                    ouSet(\'\');\r\n          " +
"                          $(this).dialog(\"close\");\r\n                            " +
"    },\r\n                                \'Save\': function () {\r\n                 " +
"                   var node = ouTree.dynatree(\"getTree\").getActiveNode();\r\n     " +
"                               if (node) {\r\n                                    " +
"    ouSet(node.data.key);\r\n                                        $(this).dialo" +
"g(\"close\");\r\n                                    } else {\r\n                     " +
"                   alert(\'Select an Organisational Unit to Save\')\r\n             " +
"                       }\r\n                                }\r\n                   " +
"         },\r\n                            draggable: false,\r\n                    " +
"        modal: true,\r\n                            resizable: false,\r\n           " +
"                 width: 400,\r\n                            height: 400\r\n         " +
"               });\r\n\r\n                        var ouChange = function () {\r\n    " +
"                        if (!ouTreeLoaded) {\r\n                                $." +
"getJSON(\'");

            
            #line 430 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                       Write(Url.Action(MVC.API.DeviceProfile.OrganisationalUnits()));

            
            #line default
            #line hidden
WriteLiteral("\', null, function (data) {\r\n                                    var dynatreeDataT" +
"ransformer = function (element) {\r\n                                        var c" +
"hild = {\r\n                                            title: element.Name,\r\n    " +
"                                        key: element.Path,\r\n                    " +
"                        isFolder: true\r\n                                        " +
"}\r\n                                        if (element.Children) {\r\n            " +
"                                child.children = [];\r\n                          " +
"                  for (var i = 0; i < element.Children.length; i++) {\r\n         " +
"                                       child.children.push(dynatreeDataTransform" +
"er(element.Children[i]));\r\n                                            }\r\n      " +
"                                  }\r\n                                        ret" +
"urn child;\r\n                                    };\r\n                            " +
"        var dynatreeData = [];\r\n                                    for (var i =" +
" 0; i < data.length; i++) {\r\n                                        dynatreeDat" +
"a.push(dynatreeDataTransformer(data[i]));\r\n                                    }" +
"\r\n\r\n                                    ouTree.dynatree({\r\n                     " +
"                   children: dynatreeData,\r\n                                    " +
"    onActivate: function (node) {\r\n                                            /" +
"/alert(\'node selected: \' + node.data.key);\r\n                                    " +
"    }\r\n                                    });\r\n                                " +
"    ouTreeLoaded = true;\r\n                                    ouUpdateTree();\r\n " +
"                               });\r\n                            } else {\r\n      " +
"                          ouUpdateTree();\r\n                            }\r\n      " +
"                      ouDialog.dialog(\'open\');\r\n                        };\r\n\r\n  " +
"                      ouChangeLink.click(ouChange);\r\n                        upd" +
"ateDisplayOrganisationalUnit();\r\n                    });\r\n                </scri" +
"pt>\r\n                <div");

WriteLiteral(" style=\"margin-top: 8px;\"");

WriteLiteral(">\r\n                    <label");

WriteLiteral(" for=\"DeviceProfile_EnforceOrganisationalUnit\"");

WriteLiteral(">\r\n                        Enforce:\r\n                    </label>\r\n              " +
"      <input");

WriteLiteral(" id=\"DeviceProfile_EnforceOrganisationalUnit\"");

WriteLiteral(" type=\"checkbox\"");

WriteLiteral(" ");

            
            #line 473 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                    Write(Model.DeviceProfile.EnforceOrganisationalUnit ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));

            
            #line default
            #line hidden
WriteLiteral("/>\r\n");

WriteLiteral("                    ");

            
            #line 474 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
               Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
WriteLiteral("\r\n                    <script");

WriteLiteral(" type=\"text/javascript\"");

WriteLiteral(@">
                        $(function () {
                            $('#DeviceProfile_EnforceOrganisationalUnit').click(function () {
                                var $this = $(this);
                                var $ajaxLoading = $this.next('.ajaxLoading').show();
                                var data = { EnforceOrganisationalUnit: $this.is(':checked') };
                                $.getJSON('");

            
            #line 481 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                      Write(Url.Action(MVC.API.DeviceProfile.UpdateEnforceOrganisationalUnit(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"', data, function (response, result) {
                                    if (result != 'success' || response != 'OK') {
                                        alert('Unable to change Enforce Organisation Unit:\n' + response);
                                        $ajaxLoading.hide();
                                    } else {
                                        $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                    }
                                });
                            });
                        });
                    </script>
                </div>
            </td>
        </tr>
    </table>
</div>
<div");

WriteLiteral(" id=\"dialogConfirmDelete\"");

WriteLiteral(" title=\"Delete this Device Profile?\"");

WriteLiteral(">\r\n    <p>\r\n        <span");

WriteLiteral(" class=\"ui-icon ui-icon-alert\"");

WriteLiteral(" style=\"float: left; margin: 0 7px 20px 0;\"");

WriteLiteral("></span>\r\n        This item will be permanently deleted and cannot be recovered. " +
"Are you sure?</p>\r\n</div>\r\n<script");

WriteLiteral(" type=\"text/javascript\"");

WriteLiteral(@">
    $(function () {

        var button = $('#buttonDelete');
        var buttonLink = button.attr('href');
        button.attr('href', '#');
        button.click(function () {
            $(""#dialogConfirmDelete"").dialog('open');
        });

        $(""#dialogConfirmDelete"").dialog({
            resizable: false,
            height: 140,
            modal: true,
            autoOpen: false,
            buttons: {
                ""Delete"": function () {
                    $(this).dialog('disable');
                    window.location.href = buttonLink;
                },
                Cancel: function () {
                    $(this).dialog(""close"");
                }
            }
        });

    });
</script>
<div");

WriteLiteral(" class=\"actionBar\"");

WriteLiteral(">\r\n");

            
            #line 531 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
    
            
            #line default
            #line hidden
            
            #line 531 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
     if (Model.CanDelete)
    { 
        
            
            #line default
            #line hidden
            
            #line 533 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
   Write(Html.ActionLinkButton("Delete", MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true), "buttonDelete"));

            
            #line default
            #line hidden
            
            #line 533 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                                                    
    }

            
            #line default
            #line hidden
WriteLiteral("    ");

            
            #line 535 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
Write(Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceProfile.Id.ToString(), "DeviceProfile")));

            
            #line default
            #line hidden
WriteLiteral("\r\n</div>\r\n");

        }
    }
}
#pragma warning restore 1591
