#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     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.Plugins
{
    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;
    using Disco.Models.Repository;
    using Disco.Services;
    using Disco.Services.Authorization;
    
    #line 2 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
    using Disco.Services.Plugins;
    
    #line default
    #line hidden
    using Disco.Services.Web;
    using Disco.Web;
    using Disco.Web.Extensions;
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
    [System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Plugins/Install.cshtml")]
    public partial class Install : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.Plugins.InstallModel>
    {
        public Install()
        {
        }
        public override void Execute()
        {
            
            #line 3 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
  
    Authorization.Require(Claims.Config.Plugin.Install);

    var canInstallLocal = Authorization.Has(Claims.Config.Plugin.InstallLocal);

    ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Plugins", MVC.Config.Plugins.Index(), "Install Plugin");

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

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

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

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

WriteLiteral(">The plugin library [<a");

WriteLiteral(" href=\"https://discoict.com.au/\"");

WriteLiteral(">https://discoict.com.au</a>] was last updated ");

            
            #line 11 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                                                                                                  Write(CommonHelpers.FriendlyDate((Model.Library.ManifestDate > DateTime.Now ? DateTime.Now : Model.Library.ManifestDate)));

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

            
            #line 12 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
    
            
            #line default
            #line hidden
            
            #line 12 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
     if (Model.Library.Plugins.Count == 0)
    {

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

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

WriteLiteral(" style=\"width: 450px; padding: 100px 0;\"");

WriteLiteral(">\r\n            <h2>No Plugins are Available</h2>\r\n        </div>\r\n");

            
            #line 17 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
    }
    else
    {
        var pluginGroups = Model.AvailablePlugins;


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

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

WriteLiteral(">\r\n");

            
            #line 23 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
            
            
            #line default
            #line hidden
            
            #line 23 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
             foreach (var pluginGroup in pluginGroups)
            {

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

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

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

            
            #line 26 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                   Write(pluginGroup.Item1);

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

            
            #line 28 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                        
            
            #line default
            #line hidden
            
            #line 28 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                         foreach (var plugin in pluginGroup.Item2)
                        {
                            var installedPlugin = Plugins.PluginInstalled(plugin.Item1.Id) ? Plugins.GetPlugin(plugin.Item1.Id) : null;

            
            #line default
            #line hidden
WriteLiteral("                            <tr>\r\n                                <td>\r\n         " +
"                           <div");

WriteAttribute("class", Tuple.Create(" class=\"", 1495), Tuple.Create("\"", 1575)
, Tuple.Create(Tuple.Create("", 1503), Tuple.Create("pluginItem", 1503), true)
            
            #line 33 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
, Tuple.Create(Tuple.Create("", 1513), Tuple.Create<System.Object, System.Int32>(installedPlugin != null ? " pluginInstalled" : string.Empty
            
            #line default
            #line hidden
, 1513), false)
);

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

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

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

WriteLiteral(" class=\"fa fa-cogs\"");

WriteLiteral("></i>");

            
            #line 35 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                                 Write(plugin.Item1.Name);

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

            
            #line 36 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                            
            
            #line default
            #line hidden
            
            #line 36 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                             if (installedPlugin == null)
                                            {

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

WriteLiteral(" class=\"pluginInstallLink button\"");

WriteAttribute("href", Tuple.Create(" href=\"", 1939), Tuple.Create("\"", 2000)
            
            #line 38 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
           , Tuple.Create(Tuple.Create("", 1946), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Plugin.Install(plugin.Item1.Id))
            
            #line default
            #line hidden
, 1946), false)
);

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

            
            #line 39 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                            }
                                            else
                                            {
                                                if (Version.Parse(plugin.Item2.Version) > installedPlugin.Version)
                                                {

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

WriteLiteral(" class=\"pluginUpdateLink button alert\"");

WriteAttribute("href", Tuple.Create(" href=\"", 2418), Tuple.Create("\"", 2478)
            
            #line 44 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                    , Tuple.Create(Tuple.Create("", 2425), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Plugin.Update(plugin.Item1.Id))
            
            #line default
            #line hidden
, 2425), false)
);

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

            
            #line 45 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                }
                                                else
                                                {

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

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

WriteAttribute("href", Tuple.Create(" href=\"", 2717), Tuple.Create("\"", 2784)
            
            #line 48 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
, Tuple.Create(Tuple.Create("", 2724), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.Plugins.Configure(plugin.Item1.Id))
            
            #line default
            #line hidden
, 2724), false)
);

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

            
            #line 49 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                }
                                            }

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

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

WriteLiteral(">");

            
            #line 52 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                                 Write(new HtmlString(plugin.Item1.Description));

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

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

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

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

WriteLiteral(">");

            
            #line 54 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                              Write(plugin.Item1.Id);

            
            #line default
            #line hidden
WriteLiteral("</span> | <span");

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

WriteLiteral(">v");

            
            #line 54 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                                                                                      Write(plugin.Item2.Version);

            
            #line default
            #line hidden
WriteLiteral("</span> | ");

            
            #line 54 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                                                                                                                      Write(plugin.Item1.Author);

            
            #line default
            #line hidden
WriteLiteral(" | <a");

WriteAttribute("href", Tuple.Create(" href=\"", 3315), Tuple.Create("\"", 3350)
            
            #line 54 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                                                                           , Tuple.Create(Tuple.Create("", 3322), Tuple.Create<System.Object, System.Int32>(plugin.Item1.InformationUrl
            
            #line default
            #line hidden
, 3322), false)
);

WriteLiteral(" title=\"More Information\"");

WriteLiteral(" target=\"_blank\"");

WriteLiteral("><i");

WriteLiteral(" class=\"fa fa-external-link\"");

WriteLiteral("></i></a>\r\n                                        </div>\r\n                      " +
"              </div>\r\n                                </td>\r\n                   " +
"         </tr>\r\n");

            
            #line 59 "..\..\Areas\Config\Views\Plugins\Install.cshtml"

                        }

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

            
            #line 63 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
            }

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

            
            #line 65 "..\..\Areas\Config\Views\Plugins\Install.cshtml"

    }

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

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

WriteLiteral(" title=\"Install this Plugin?\"");

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

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

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

WriteLiteral("></h2>\r\n    <h4");

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

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

WriteLiteral(" class=\"info-box\"");

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

WriteLiteral(" class=\"fa-p\"");

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

WriteLiteral(" class=\"fa fa-exclamation-triangle\"");

WriteLiteral("></i><strong>Warning:</strong> All plugins run with the same level of network pri" +
"vileges as the Disco ICT Web App.<br />\r\n            <strong>Only Install plugin" +
"s from a trusted source.</strong>\r\n        </p>\r\n    </div>\r\n");

            
            #line 78 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
    
            
            #line default
            #line hidden
            
            #line 78 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
     using (Html.BeginForm(MVC.API.Plugin.Install(), FormMethod.Post))
    {
        
            
            #line default
            #line hidden
            
            #line 80 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
   Write(Html.AntiForgeryToken());

            
            #line default
            #line hidden
            
            #line 80 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                
    }

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

            
            #line 83 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
 if (canInstallLocal)
{

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

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

WriteLiteral(" title=\"Install Plugin Package\"");

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

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

WriteLiteral(" style=\"padding-bottom: 10px;\"");

WriteLiteral(">\r\n");

            
            #line 87 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
            
            
            #line default
            #line hidden
            
            #line 87 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
             using (Html.BeginForm(MVC.API.Plugin.InstallLocal(), FormMethod.Post, new { enctype = "multipart/form-data" }))
            {
                
            
            #line default
            #line hidden
            
            #line 89 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
           Write(Html.AntiForgeryToken());

            
            #line default
            #line hidden
            
            #line 89 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                        

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

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

WriteLiteral(">Plugin Package: </label>\r\n");

WriteLiteral("                <input");

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

WriteLiteral(" name=\"Plugin\"");

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

WriteLiteral(" accept=\".discoPlugin\"");

WriteLiteral(" />\r\n");

            
            #line 92 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
            }

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

WriteLiteral(" class=\"info-box error\"");

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

WriteLiteral(" class=\"fa-p\"");

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

WriteLiteral(" class=\"fa fa-exclamation-triangle\"");

WriteLiteral("></i><strong>Warning:</strong> All plugins run with the same level of network pri" +
"vileges as the Disco ICT Web App.<br />\r\n                <strong>Only install pl" +
"ugins from a trusted source.</strong>\r\n            </p>\r\n        </div>\r\n    </d" +
"iv>\r\n");

            
            #line 101 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
}

            
            #line default
            #line hidden
WriteLiteral("<script>\r\n    $(function () {\r\n        var $selectedPlugin;\r\n        var $selecte" +
"dPluginUrl;\r\n\r\n        $(\'#pluginLibraryHeading\').appendTo(\'#layout_PageHeading\'" +
");\r\n\r\n        // Install\r\n        var $dialogInstall = $(\'#dialogInstallPlugin\')" +
".dialog({\r\n            resizable: false,\r\n            modal: true,\r\n            " +
"width: 350,\r\n            autoOpen: false,\r\n            buttons: {\r\n             " +
"   \"Install\": function () {\r\n                    if ($selectedPlugin == null || " +
"!$selectedPluginUrl) {\r\n                        $(this).dialog(\"close\");\r\n      " +
"                  return;\r\n                    }\r\n                    $(this).di" +
"alog(\"disable\");\r\n                    $(this)\r\n                        .find(\'fo" +
"rm\')\r\n                        .attr(\'action\', $selectedPluginUrl)\r\n             " +
"           .submit();\r\n                },\r\n                Cancel: function () {" +
"\r\n                    $selectedPlugin = null;\r\n                    $(this).dialo" +
"g(\"close\");\r\n                }\r\n            }\r\n        });\r\n        $(\'#pluginLi" +
"braryGroups\').find(\'a.pluginInstallLink\').click(function () {\r\n            $this" +
" = $(this);\r\n\r\n            $selectedPlugin = $this.closest(\'.pluginItem\');\r\n    " +
"        $selectedPluginUrl = $this.attr(\'href\');\r\n\r\n            $(\'#dialogInstal" +
"lPluginName\').text($selectedPlugin.find(\'.pluginName\').text());\r\n            $(\'" +
"#dialogInstallPluginDetails\').text($selectedPlugin.find(\'.pluginId\').text() + \' " +
"| \' + $selectedPlugin.find(\'.pluginVersion\').text());\r\n\r\n            $dialogInst" +
"all.dialog(\'option\', \'title\', \'Install this Plugin?\');\r\n            $dialogInsta" +
"ll.dialog(\'open\');\r\n\r\n            return false;\r\n        });\r\n        $(\'#plugin" +
"LibraryGroups\').find(\'a.pluginUpdateLink\').click(function () {\r\n            $thi" +
"s = $(this);\r\n\r\n            $selectedPlugin = $this.closest(\'.pluginItem\');\r\n   " +
"         $selectedPluginUrl = $this.attr(\'href\');\r\n\r\n            $(\'#dialogInsta" +
"llPluginName\').text($selectedPlugin.find(\'.pluginName\').text());\r\n            $(" +
"\'#dialogInstallPluginDetails\').text($selectedPlugin.find(\'.pluginId\').text() + \'" +
" | \' + $selectedPlugin.find(\'.pluginVersion\').text());\r\n\r\n            $dialogIns" +
"tall.dialog(\'option\', \'title\', \'Update this Plugin?\');\r\n            $dialogInsta" +
"ll.dialog(\'open\');\r\n\r\n            return false;\r\n        });\r\n\r\n");

            
            #line 162 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
        
            
            #line default
            #line hidden
            
            #line 162 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
         if (canInstallLocal)
        {
            
            #line default
            #line hidden
WriteLiteral(@"
        // Upload
        var $dialogUpload = $('#dialogUploadPlugin').dialog({
            resizable: false,
            modal: true,
            width: 350,
            autoOpen: false,
            buttons: {
                ""Upload & Install"": function () {
                    var pluginFile = $('#pluginFile');
                    if (pluginFile.val()) {
                        pluginFile.closest('form').submit();
                        $(this).dialog('disable');
                    } else {
                        alert('Choose a Plugin Package to Upload');
                    }
                },
                Cancel: function () {
                    $(this).dialog(""close"");
                }
            }
        });
        $('#buttonUpload').click(function () {
            $dialogUpload.dialog('open');
            return false;
        });
        ");

            
            #line 189 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
               }

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

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

WriteLiteral(">\r\n");

WriteLiteral("    ");

            
            #line 193 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
Write(Html.ActionLinkButton("Update Plugin Library", MVC.API.Plugin.UpdateLibraryManifest()));

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

            
            #line 194 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
    
            
            #line default
            #line hidden
            
            #line 194 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
     if (canInstallLocal)
    {
        
            
            #line default
            #line hidden
            
            #line 196 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
   Write(Html.ActionLinkButton("Install Plugin Package", MVC.API.Plugin.InstallLocal(), "buttonUpload"));

            
            #line default
            #line hidden
            
            #line 196 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                                                                       
    }

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

        }
    }
}
#pragma warning restore 1591
