#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.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.BI.Extensions;
    using Disco.Models.Repository;
    
    #line 2 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
    using Disco.Services.Plugins;
    
    #line default
    #line hidden
    using Disco.Web;
    using Disco.Web.Extensions;
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
    [System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/Plugins/Install.cshtml")]
    public class Install : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.Plugins.InstallModel>
    {
        public Install()
        {
        }
        public override void Execute()
        {
            
            #line 3 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
  
    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=\"pluginCatalog\"");

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

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

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

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

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

            
            #line 7 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                                                                                                  Write(CommonHelpers.FriendlyDate(Model.Catalogue.ResponseTimestamp));

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

            
            #line 9 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
    
            
            #line default
            #line hidden
            
            #line 9 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
     if (Model.Catalogue.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 14 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
    }
    else
    {
        var plugins = Model.Catalogue.Plugins;
        int itemsPerColumn = plugins.Count / 3;
        var itemNextId = 0;

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

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

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

            
            #line 22 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                
            
            #line default
            #line hidden
            
            #line 22 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                 for (int i = 0; i < 3; i++)
                {

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

            
            #line 25 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                        
            
            #line default
            #line hidden
            
            #line 25 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                          
                    int itemsForThisColumn = itemsPerColumn + (plugins.Count % 3 > i ? 1 : 0);
                    for (int i2 = 0; i2 < itemsForThisColumn && itemNextId < plugins.Count; i2++)
                    {
                        var plugin = plugins[itemNextId];
                        itemNextId++;
                        var installedPlugin = Plugins.PluginInstalled(plugin.Id) ? Plugins.GetPlugin(plugin.Id) : null;

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

WriteAttribute("class", Tuple.Create(" class=\"", 1449), Tuple.Create("\"", 1542)
, Tuple.Create(Tuple.Create("", 1457), Tuple.Create("pageMenuArea", 1457), true)
, Tuple.Create(Tuple.Create(" ", 1469), Tuple.Create("pluginItem", 1470), true)
            
            #line 32 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
, Tuple.Create(Tuple.Create("", 1480), Tuple.Create<System.Object, System.Int32>(installedPlugin != null ? " pluginInstalled" : string.Empty
            
            #line default
            #line hidden
, 1480), false)
);

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

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

WriteLiteral(">");

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

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

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

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

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

WriteAttribute("href", Tuple.Create(" href=\"", 1754), Tuple.Create("\"", 1809)
            
            #line 35 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
, Tuple.Create(Tuple.Create("", 1761), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Plugin.Install(plugin.Id))
            
            #line default
            #line hidden
, 1761), false)
);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

WriteLiteral(">");

            
            #line 44 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                         Write(new HtmlString(plugin.Blurb));

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

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

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

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

WriteLiteral(">");

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

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

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

WriteLiteral(">v");

            
            #line 46 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                                                                        Write(plugin.LatestVersion);

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

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

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

WriteAttribute("href", Tuple.Create(" href=\"", 2716), Tuple.Create("\"", 2734)
            
            #line 46 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                                                                                       , Tuple.Create(Tuple.Create("", 2723), Tuple.Create<System.Object, System.Int32>(plugin.Url
            
            #line default
            #line hidden
, 2723), false)
);

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

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

            
            #line 49 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
                    }
                        
            
            #line default
            #line hidden
WriteLiteral("\r\n                    </td>\r\n");

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

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

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

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

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

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

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

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

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

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

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

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

WriteLiteral(" class=\"ui-state-highlight ui-corner-all\"");

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

WriteLiteral(" style=\"margin-right: 0.3em; margin-bottom: 2em; float: left;\"");

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

WriteLiteral("></span>Warning: All plugins run with the same level of network privileges as the" +
" Disco Web App.<br />\r\n        <strong>Only Install plugins from a trusted sourc" +
"e.</strong>\r\n    </div>\r\n</div>\r\n<div");

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

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

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

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

WriteLiteral(">\r\n");

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

            
            #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(" />\r\n");

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

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

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

WriteLiteral(" class=\"ui-state-error ui-corner-all\"");

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

WriteLiteral(" style=\"margin-right: 0.3em; margin-bottom: 2em; float: left;\"");

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

WriteLiteral("></span>Warning: All plugins run with the same level of network privileges as the" +
" Disco Web App.<br />\r\n        <strong>Only install plugins from a trusted sourc" +
"e.</strong>\r\n    </div>\r\n</div>\r\n<script>\r\n    $(function () {\r\n        var $sel" +
"ectedPlugin;\r\n        var $selectedPluginUrl;\r\n\r\n        // Install\r\n        var" +
" $dialogInstall = $(\'#dialogInstallPlugin\').dialog({\r\n            resizable: fal" +
"se,\r\n            modal: true,\r\n            width: 350,\r\n            autoOpen: fa" +
"lse,\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).dialog(\"disable\");\r\n\r\n                 " +
"   window.location.href = $selectedPluginUrl;\r\n                },\r\n             " +
"   Cancel: function () {\r\n                    $selectedPlugin = null;\r\n         " +
"           $(this).dialog(\"close\");\r\n                }\r\n            }\r\n        }" +
");\r\n        $(\'#pageMenu\').find(\'a.pluginInstallLink\').click(function () {\r\n    " +
"        $this = $(this);\r\n\r\n            $selectedPlugin = $this.closest(\'.plugin" +
"Item\');\r\n            $selectedPluginUrl = $this.attr(\'href\');\r\n\r\n            $(\'" +
"#dialogInstallPluginName\').text($selectedPlugin.find(\'.pluginName\').text());\r\n  " +
"          $(\'#dialogInstallPluginDetails\').text($selectedPlugin.find(\'.pluginId\'" +
").text() + \' | \' + $selectedPlugin.find(\'.pluginVersion\').text());\r\n\r\n          " +
"  $dialogInstall.dialog(\'option\', \'title\', \'Install this Plugin?\');\r\n           " +
" $dialogInstall.dialog(\'open\');\r\n\r\n            return false;\r\n        });\r\n     " +
"   $(\'#pageMenu\').find(\'a.pluginUpdateLink\').click(function () {\r\n            $t" +
"his = $(this);\r\n\r\n            $selectedPlugin = $this.closest(\'.pluginItem\');\r\n " +
"           $selectedPluginUrl = $this.attr(\'href\');\r\n\r\n            $(\'#dialogIns" +
"tallPluginName\').text($selectedPlugin.find(\'.pluginName\').text());\r\n            " +
"$(\'#dialogInstallPluginDetails\').text($selectedPlugin.find(\'.pluginId\').text() +" +
" \' | \' + $selectedPlugin.find(\'.pluginVersion\').text());\r\n\r\n            $dialogI" +
"nstall.dialog(\'option\', \'title\', \'Update this Plugin?\');\r\n            $dialogIns" +
"tall.dialog(\'open\');\r\n\r\n            return false;\r\n        });\r\n\r\n        // Upl" +
"oad\r\n        var $dialogUpload = $(\'#dialogUploadPlugin\').dialog({\r\n            " +
"resizable: false,\r\n            modal: true,\r\n            width: 350,\r\n          " +
"  autoOpen: false,\r\n            buttons: {\r\n                \"Upload & Install\": " +
"function () {\r\n                    var pluginFile = $(\'#pluginFile\');\r\n         " +
"           if (pluginFile.val()) {\r\n                        pluginFile.closest(\'" +
"form\').submit();\r\n                        $(this).dialog(\'disable\');\r\n          " +
"          } else {\r\n                        alert(\'Choose a Plugin Package to Up" +
"load\');\r\n                    }\r\n                },\r\n                Cancel: func" +
"tion () {\r\n                    $(this).dialog(\"close\");\r\n                }\r\n    " +
"        }\r\n        });\r\n        $(\'#buttonUpload\').click(function () {\r\n        " +
"    $dialogUpload.dialog(\'open\');\r\n            return false;\r\n        });\r\n    }" +
");\r\n</script>\r\n<div");

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

WriteLiteral(">\r\n");

WriteLiteral("    ");

            
            #line 163 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
Write(Html.ActionLinkButton("Update Catalogue", MVC.API.Plugin.UpdateLibraryCatalogue()));

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

WriteLiteral("    ");

            
            #line 164 "..\..\Areas\Config\Views\Plugins\Install.cshtml"
Write(Html.ActionLinkButton("Install Plugin Package", MVC.API.Plugin.InstallLocal(), "buttonUpload"));

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

        }
    }
}
#pragma warning restore 1591
