mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Aligning package update page to gallery. Moving the update feature to the packaging module as a feature.
--HG-- branch : dev
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
using System.Linq;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.PackageManager.Services;
|
||||
using Orchard.Security;
|
||||
using Orchard.UI.Navigation;
|
||||
|
||||
namespace Orchard.PackageManager {
|
||||
public class AdminMenu : INavigationProvider {
|
||||
private readonly IBackgroundPackageUpdateStatus _backgroundPackageUpdateStatus;
|
||||
|
||||
public AdminMenu(IBackgroundPackageUpdateStatus backgroundPackageUpdateStatus) {
|
||||
_backgroundPackageUpdateStatus = backgroundPackageUpdateStatus;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
public string MenuName { get { return "admin"; } }
|
||||
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
int modulesUpdateCount = GetUpdateCount(DefaultExtensionTypes.Module);
|
||||
LocalizedString modulesCaption = (modulesUpdateCount == 0 ? T("Updates") : T("Updates ({0})", modulesUpdateCount));
|
||||
|
||||
int themesUpdateCount = GetUpdateCount(DefaultExtensionTypes.Module);
|
||||
LocalizedString themesCaption = (themesUpdateCount == 0 ? T("Updates") : T("Updates ({0})", themesUpdateCount));
|
||||
|
||||
builder.Add(T("Modules"), "20", menu => menu
|
||||
.Add(modulesCaption, "30.0", item => item.Action("ModulesUpdates", "Admin", new { area = "Orchard.PackageManager" })
|
||||
.Permission(StandardPermissions.SiteOwner).LocalNav()));
|
||||
|
||||
builder.Add(T("Themes"), "25", menu => menu
|
||||
.Add(themesCaption, "30.0", item => item.Action("ThemesUpdates", "Admin", new { area = "Orchard.PackageManager" })
|
||||
.Permission(StandardPermissions.SiteOwner).LocalNav()));
|
||||
}
|
||||
|
||||
private int GetUpdateCount(string extensionType) {
|
||||
try {
|
||||
// Admin menu should never block, so simply return the result from the background task
|
||||
return _backgroundPackageUpdateStatus.Value == null ?
|
||||
0 :
|
||||
_backgroundPackageUpdateStatus.Value.Entries.Where(updatePackageEntry =>
|
||||
updatePackageEntry.NewVersionToInstall != null &&
|
||||
updatePackageEntry.ExtensionsDescriptor.ExtensionType.Equals(extensionType)).Count();
|
||||
} catch {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
Name: Orchard.PackageManager
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.0.20
|
||||
OrchardVersion: 1.0.20
|
||||
Description: Description for the module
|
||||
Features:
|
||||
Orchard.PackageManager:
|
||||
Name: Package Manager
|
||||
Description: Allow package updates.
|
||||
Category: Packaging
|
||||
Dependencies: Gallery
|
@@ -1,135 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{E66935C0-830B-466E-A571-4AEED7057CBD}</ProjectGuid>
|
||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Orchard.PackageManager</RootNamespace>
|
||||
<AssemblyName>Orchard.PackageManager</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<MvcBuildViews>false</MvcBuildViews>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation />
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Views\Web.config" />
|
||||
<Content Include="Properties\AssemblyInfo.cs" />
|
||||
<Content Include="Module.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
|
||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||
<Name>Orchard.Framework</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Packaging\Orchard.Packaging.csproj">
|
||||
<Project>{DFD137A2-DDB5-4D22-BE0D-FA9AD4C8B059}</Project>
|
||||
<Name>Orchard.Packaging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Events\ExtensionDisplayEventHandler.cs" />
|
||||
<Compile Include="Events\IExtensionDisplayEventHandler.cs" />
|
||||
<Compile Include="Services\BackgroundPackageUpdateStatus.cs" />
|
||||
<Compile Include="Services\BackgroundPackageUpdateTask.cs" />
|
||||
<Compile Include="Services\FolderUpdater.cs" />
|
||||
<Compile Include="Services\PackageUpdateManager.cs" />
|
||||
<Compile Include="ViewModels\PackageList.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Admin\ModulesUpdate.cshtml" />
|
||||
<Content Include="Views\Admin\ThemesUpdate.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target> -->
|
||||
<Target Name="AfterBuild" DependsOnTargets="AfterBuildCompiler">
|
||||
<PropertyGroup>
|
||||
<AreasManifestDir>$(ProjectDir)\..\Manifests</AreasManifestDir>
|
||||
</PropertyGroup>
|
||||
<!-- If this is an area child project, uncomment the following line:
|
||||
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Child" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
|
||||
-->
|
||||
<!-- If this is an area parent project, uncomment the following lines:
|
||||
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Parent" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
|
||||
<CopyAreaManifests ManifestPath="$(AreasManifestDir)" CrossCopy="false" RenameViews="true" />
|
||||
-->
|
||||
</Target>
|
||||
<Target Name="AfterBuildCompiler" Condition="'$(MvcBuildViews)'=='true'">
|
||||
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
|
||||
</Target>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>False</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>45979</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>
|
||||
</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>True</UseCustomServer>
|
||||
<CustomServerUrl>http://orchard.codeplex.com</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
@@ -1,34 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Orchard.PackageManager")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("Orchard")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("5c928dc2-aa81-4452-99b4-e4c76600c84b")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@@ -1,8 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.PackageManager.Services;
|
||||
|
||||
namespace Orchard.PackageManager.ViewModels {
|
||||
public class PackageList {
|
||||
public IEnumerable<UpdatePackageEntry> Entries { get; set; }
|
||||
}
|
||||
}
|
@@ -1,77 +0,0 @@
|
||||
@using Orchard.Modules.Extensions
|
||||
@using Orchard.Mvc.Html;
|
||||
@using Orchard.PackageManager.ViewModels;
|
||||
@using Orchard.Packaging.Services;
|
||||
@using Orchard.Packaging.Models;
|
||||
@using Orchard.Environment.Extensions.Models;
|
||||
@using Orchard.Utility.Extensions;
|
||||
@model PackageList
|
||||
|
||||
@{ Layout.Title = T("Modules").ToString(); }
|
||||
|
||||
@functions {
|
||||
public string InstallAction(PackagingEntry package) {
|
||||
return Url.Action("Install", "Admin", new {
|
||||
area = "Orchard.PackageManager",
|
||||
packageId = package.PackageId,
|
||||
version = package.Version,
|
||||
sourceId = package.Source.Id,
|
||||
returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString()
|
||||
});
|
||||
}
|
||||
public string UninstallAction(PackagingEntry package) {
|
||||
return Url.Action("Uninstall", "Admin", new {
|
||||
area = "Orchard.PackageManager",
|
||||
packageId = package.PackageId,
|
||||
returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@if (Model.Entries.Count() <= 0) {
|
||||
<p>No package updates available.</p>
|
||||
} else {
|
||||
<ul class="contentItems">
|
||||
@foreach (var module in Model.Entries) {
|
||||
<li>
|
||||
<div class="summary">
|
||||
<div class="properties">
|
||||
<h2>@module.ExtensionsDescriptor.Name - @module.ExtensionsDescriptor.Version
|
||||
@if (module.NewVersionToInstall != null) {
|
||||
<span> |
|
||||
<span style="background-color:#ffa0a0">@Html.Link(T("Install Latest").Text, InstallAction(module.NewVersionToInstall))</span>
|
||||
</span>
|
||||
} else {
|
||||
<span> |
|
||||
<span style="background-color:#a0ffa0; font-size:small">Up-to-date</span>
|
||||
</span>
|
||||
}
|
||||
<span> |
|
||||
<span style="font-size:small">@Html.Link(T("Uninstall").Text, UninstallAction(module.PackageVersions.First()))</span>
|
||||
</span>
|
||||
</h2>
|
||||
<ul class="pageStatus" style="color:#666; margin:.6em 0 0 0;">
|
||||
@foreach (var version in module.PackageVersions.OrderByDescending(e => new Version(e.Version))) {
|
||||
<li style="float:none">
|
||||
@T("Gallery Version {0} - Last Updated UTC: {1}", version.Version, version.LastUpdated.ToUniversalTime())
|
||||
@if (!string.IsNullOrWhiteSpace(version.GalleryDetailsUrl)) {
|
||||
<text> (</text><a href="@version.GalleryDetailsUrl" target="_blank">@T("details")</a><text>)</text>
|
||||
}
|
||||
|
||||
|
|
||||
@if (new Version(version.Version) == new Version(module.ExtensionsDescriptor.Version)) {
|
||||
@Html.Link(T("Install again").Text, InstallAction(version))
|
||||
} else if (new Version(version.Version) > new Version(module.ExtensionsDescriptor.Version)) {
|
||||
@Html.Link(T("Upgrade").Text, InstallAction(version))
|
||||
} else {
|
||||
@Html.Link(T("Downgrade (not recommended)").Text, InstallAction(version))
|
||||
}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
@@ -1,77 +0,0 @@
|
||||
@using Orchard.Modules.Extensions
|
||||
@using Orchard.Mvc.Html;
|
||||
@using Orchard.PackageManager.ViewModels;
|
||||
@using Orchard.Packaging.Services;
|
||||
@using Orchard.Packaging.Models;
|
||||
@using Orchard.Environment.Extensions.Models;
|
||||
@using Orchard.Utility.Extensions;
|
||||
@model PackageList
|
||||
|
||||
@{ Layout.Title = T("Themes").ToString(); }
|
||||
|
||||
@functions {
|
||||
public string InstallAction(PackagingEntry package) {
|
||||
return Url.Action("Install", "Admin", new {
|
||||
area = "Orchard.PackageManager",
|
||||
packageId = package.PackageId,
|
||||
version = package.Version,
|
||||
sourceId = package.Source.Id,
|
||||
returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString()
|
||||
});
|
||||
}
|
||||
public string UninstallAction(PackagingEntry package) {
|
||||
return Url.Action("Uninstall", "Admin", new {
|
||||
area = "Orchard.PackageManager",
|
||||
packageId = package.PackageId,
|
||||
returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@if (Model.Entries.Count() <= 0) {
|
||||
<p>No package updates available.</p>
|
||||
} else {
|
||||
<ul class="contentItems">
|
||||
@foreach (var module in Model.Entries) {
|
||||
<li>
|
||||
<div class="summary">
|
||||
<div class="properties">
|
||||
<h2>@module.ExtensionsDescriptor.Name - @module.ExtensionsDescriptor.Version
|
||||
@if (module.NewVersionToInstall != null) {
|
||||
<span> |
|
||||
<span style="background-color:#ffa0a0">@Html.Link(T("Install Latest").Text, InstallAction(module.NewVersionToInstall))</span>
|
||||
</span>
|
||||
} else {
|
||||
<span> |
|
||||
<span style="background-color:#a0ffa0; font-size:small">Up-to-date</span>
|
||||
</span>
|
||||
}
|
||||
<span> |
|
||||
<span style="font-size:small">@Html.Link(T("Uninstall").Text, UninstallAction(module.PackageVersions.First()))</span>
|
||||
</span>
|
||||
</h2>
|
||||
<ul class="pageStatus" style="color:#666; margin:.6em 0 0 0;">
|
||||
@foreach (var version in module.PackageVersions.OrderByDescending(e => new Version(e.Version))) {
|
||||
<li style="float:none">
|
||||
@T("Gallery Version {0} - Last Updated UTC: {1}", version.Version, version.LastUpdated.ToUniversalTime())
|
||||
@if (!string.IsNullOrWhiteSpace(version.GalleryDetailsUrl)) {
|
||||
<text> (</text><a href="@version.GalleryDetailsUrl" target="_blank">@T("details")</a><text>)</text>
|
||||
}
|
||||
|
||||
|
|
||||
@if (new Version(version.Version) == new Version(module.ExtensionsDescriptor.Version)) {
|
||||
@Html.Link(T("Install again").Text, InstallAction(version))
|
||||
} else if (new Version(version.Version) > new Version(module.ExtensionsDescriptor.Version)) {
|
||||
@Html.Link(T("Upgrade").Text, InstallAction(version))
|
||||
} else {
|
||||
@Html.Link(T("Downgrade (not recommended)").Text, InstallAction(version))
|
||||
}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="webpages:Enabled" value="false" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<httpHandlers>
|
||||
</httpHandlers>
|
||||
|
||||
<!--
|
||||
Enabling request validation in view pages would cause validation to occur
|
||||
after the input has already been processed by the controller. By default
|
||||
MVC performs request validation before a controller processes the input.
|
||||
To change this behavior apply the ValidateInputAttribute to a
|
||||
controller or action.
|
||||
-->
|
||||
<pages
|
||||
validateRequest="false"
|
||||
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
|
||||
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
|
||||
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<controls>
|
||||
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" namespace="System.Web.Mvc" tagPrefix="mvc" />
|
||||
</controls>
|
||||
</pages>
|
||||
</system.web>
|
||||
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
<handlers>
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="2.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<remove name="host" />
|
||||
<remove name="pages" />
|
||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<system.web.webPages.razor>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc" />
|
||||
<add namespace="System.Web.Mvc.Ajax" />
|
||||
<add namespace="System.Web.Mvc.Html" />
|
||||
<add namespace="System.Web.Routing" />
|
||||
<add namespace="System.Linq"/>
|
||||
<add namespace="System.Collections.Generic"/>
|
||||
<add namespace="Orchard.Mvc.Html"/>
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.web.webPages.razor>
|
||||
|
||||
<system.web>
|
||||
<compilation targetFramework="4.0">
|
||||
<assemblies>
|
||||
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
</assemblies>
|
||||
</compilation>
|
||||
</system.web>
|
||||
|
||||
</configuration>
|
@@ -1,5 +1,8 @@
|
||||
using Orchard.Environment.Extensions;
|
||||
using System.Linq;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Packaging.Services;
|
||||
using Orchard.UI.Navigation;
|
||||
using Orchard.Security;
|
||||
|
||||
@@ -9,6 +12,14 @@ namespace Orchard.Packaging {
|
||||
public Localizer T { get; set; }
|
||||
public string MenuName { get { return "admin"; } }
|
||||
|
||||
private readonly IBackgroundPackageUpdateStatus _backgroundPackageUpdateStatus;
|
||||
|
||||
public AdminMenu(IBackgroundPackageUpdateStatus backgroundPackageUpdateStatus) {
|
||||
_backgroundPackageUpdateStatus = backgroundPackageUpdateStatus;
|
||||
}
|
||||
|
||||
public AdminMenu() {}
|
||||
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
builder.Add(T("Themes"), "25", menu => menu
|
||||
.Add(T("Available"), "1", item => item.Action("Themes", "Gallery", new { area = "Orchard.Packaging" })
|
||||
@@ -21,6 +32,37 @@ namespace Orchard.Packaging {
|
||||
builder.Add(T("Configuration"), "50", menu => menu
|
||||
.Add(T("Feeds"), "25", item => item.Action("Sources", "Gallery", new { area = "Orchard.Packaging" })
|
||||
.Permission(StandardPermissions.SiteOwner)));
|
||||
|
||||
if (_backgroundPackageUpdateStatus != null) {
|
||||
// Only available if feature is enabled
|
||||
|
||||
int modulesUpdateCount = GetUpdateCount(DefaultExtensionTypes.Module);
|
||||
LocalizedString modulesCaption = (modulesUpdateCount == 0 ? T("Updates") : T("Updates ({0})", modulesUpdateCount));
|
||||
|
||||
int themesUpdateCount = GetUpdateCount(DefaultExtensionTypes.Theme);
|
||||
LocalizedString themesCaption = (themesUpdateCount == 0 ? T("Updates") : T("Updates ({0})", themesUpdateCount));
|
||||
|
||||
builder.Add(T("Modules"), "20", menu => menu
|
||||
.Add(modulesCaption, "30.0", item => item.Action("ModulesUpdates", "GalleryUpdates", new { area = "Orchard.Packaging" })
|
||||
.Permission(StandardPermissions.SiteOwner).LocalNav()));
|
||||
|
||||
builder.Add(T("Themes"), "25", menu => menu
|
||||
.Add(themesCaption, "30.0", item => item.Action("ThemesUpdates", "GalleryUpdates", new { area = "Orchard.Packaging" })
|
||||
.Permission(StandardPermissions.SiteOwner).LocalNav()));
|
||||
}
|
||||
}
|
||||
|
||||
private int GetUpdateCount(string extensionType) {
|
||||
try {
|
||||
// Admin menu should never block, so simply return the result from the background task
|
||||
return _backgroundPackageUpdateStatus.Value == null ?
|
||||
0 :
|
||||
_backgroundPackageUpdateStatus.Value.Entries.Where(updatePackageEntry =>
|
||||
updatePackageEntry.NewVersionToInstall != null &&
|
||||
updatePackageEntry.ExtensionsDescriptor.ExtensionType.Equals(extensionType)).Count();
|
||||
} catch {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,19 +2,26 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
using Orchard.PackageManager.Services;
|
||||
using Orchard.PackageManager.ViewModels;
|
||||
using Orchard.Packaging.Models;
|
||||
using Orchard.Packaging.Services;
|
||||
using Orchard.Packaging.ViewModels;
|
||||
using Orchard.Reports;
|
||||
using Orchard.Reports.Services;
|
||||
using Orchard.Security;
|
||||
using Orchard.Themes;
|
||||
using Orchard.UI.Admin;
|
||||
using Orchard.UI.Navigation;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.PackageManager.Controllers {
|
||||
public class AdminController : Controller {
|
||||
namespace Orchard.Packaging.Controllers {
|
||||
[OrchardFeature("Gallery.Updates")]
|
||||
[Themed, Admin]
|
||||
public class GalleryUpdatesController : Controller {
|
||||
private readonly IPackagingSourceManager _packagingSourceManager;
|
||||
private readonly INotifier _notifier;
|
||||
private readonly IPackageUpdateService _packageUpdateService;
|
||||
@@ -22,13 +29,14 @@ namespace Orchard.PackageManager.Controllers {
|
||||
private readonly IReportsCoordinator _reportsCoordinator;
|
||||
private readonly IReportsManager _reportsManager;
|
||||
|
||||
public AdminController(IOrchardServices services,
|
||||
public GalleryUpdatesController(IOrchardServices services,
|
||||
IPackagingSourceManager packagingSourceManager,
|
||||
INotifier notifier,
|
||||
IPackageUpdateService packageUpdateService,
|
||||
IBackgroundPackageUpdateStatus backgroundPackageUpdateStatus,
|
||||
IReportsCoordinator reportsCoordinator,
|
||||
IReportsManager reportsManager) {
|
||||
IReportsManager reportsManager,
|
||||
IShapeFactory shapeFactory) {
|
||||
|
||||
_packagingSourceManager = packagingSourceManager;
|
||||
_notifier = notifier;
|
||||
@@ -37,6 +45,7 @@ namespace Orchard.PackageManager.Controllers {
|
||||
_reportsCoordinator = reportsCoordinator;
|
||||
_reportsManager = reportsManager;
|
||||
Services = services;
|
||||
Shape = shapeFactory;
|
||||
|
||||
T = NullLocalizer.Instance;
|
||||
Logger = NullLogger.Instance;
|
||||
@@ -45,25 +54,28 @@ namespace Orchard.PackageManager.Controllers {
|
||||
public IOrchardServices Services { get; private set; }
|
||||
public Localizer T { get; set; }
|
||||
public ILogger Logger { get; set; }
|
||||
public dynamic Shape { get; set; }
|
||||
|
||||
public ActionResult ThemesUpdates(int? reportId) {
|
||||
return PackageUpdate("ThemesUpdate", DefaultExtensionTypes.Theme, reportId);
|
||||
public ActionResult ThemesUpdates(int? reportId, PagerParameters pagerParameters) {
|
||||
return PackageUpdate("ThemesUpdates", DefaultExtensionTypes.Theme, reportId, pagerParameters);
|
||||
}
|
||||
|
||||
public ActionResult ModulesUpdates(int? reportId) {
|
||||
return PackageUpdate("ModulesUpdate", DefaultExtensionTypes.Module, reportId);
|
||||
public ActionResult ModulesUpdates(int? reportId, PagerParameters pagerParameters) {
|
||||
return PackageUpdate("ModulesUpdates", DefaultExtensionTypes.Module, reportId, pagerParameters);
|
||||
}
|
||||
|
||||
private ActionResult PackageUpdate(string view, string extensionType, int? reportId) {
|
||||
private ActionResult PackageUpdate(string view, string extensionType, int? reportId, PagerParameters pagerParameters) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to install packages")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
Pager pager = new Pager(Services.WorkContext.CurrentSite, pagerParameters);
|
||||
|
||||
if (reportId != null)
|
||||
CreateNotificationsFromReport(reportId.Value);
|
||||
|
||||
if (!_packagingSourceManager.GetSources().Any()) {
|
||||
Services.Notifier.Error(T("No Gallery feed configured"));
|
||||
return View(view, new PackageList { Entries = new List<UpdatePackageEntry>() });
|
||||
return View(view, new PackagingListViewModel { Entries = new List<UpdatePackageEntry>() });
|
||||
}
|
||||
|
||||
// Get status from background task state or directly
|
||||
@@ -77,24 +89,23 @@ namespace Orchard.PackageManager.Controllers {
|
||||
}
|
||||
}
|
||||
|
||||
return View(view, new PackageList {
|
||||
Entries = _backgroundPackageUpdateStatus.Value.Entries
|
||||
.Where(updatePackageEntry => updatePackageEntry.ExtensionsDescriptor.ExtensionType.Equals(extensionType))
|
||||
IEnumerable<UpdatePackageEntry> updatedPackages = _backgroundPackageUpdateStatus.Value.Entries
|
||||
.Where(updatePackageEntry =>
|
||||
updatePackageEntry.ExtensionsDescriptor.ExtensionType.Equals(extensionType) &&
|
||||
updatePackageEntry.NewVersionToInstall != null);
|
||||
|
||||
int totalItemCount = updatedPackages.Count();
|
||||
|
||||
if (pager.PageSize != 0) {
|
||||
updatedPackages = updatedPackages.Skip((pager.Page - 1) * pager.PageSize).Take(pager.PageSize);
|
||||
}
|
||||
|
||||
return View(view, new PackagingListViewModel {
|
||||
Entries = updatedPackages,
|
||||
Pager = Shape.Pager(pager).TotalItemCount(totalItemCount)
|
||||
});
|
||||
}
|
||||
|
||||
public ActionResult RefreshThemes() {
|
||||
_packageUpdateService.TriggerRefresh();
|
||||
_backgroundPackageUpdateStatus.Value = null;
|
||||
return RedirectToAction("ThemesUpdates");
|
||||
}
|
||||
|
||||
public ActionResult RefreshModules() {
|
||||
_packageUpdateService.TriggerRefresh();
|
||||
_backgroundPackageUpdateStatus.Value = null;
|
||||
return RedirectToAction("ModulesUpdates");
|
||||
}
|
||||
|
||||
public ActionResult Install(string packageId, string version, int sourceId, string returnUrl) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to install packages")))
|
||||
return new HttpUnauthorizedResult();
|
||||
@@ -128,26 +139,6 @@ namespace Orchard.PackageManager.Controllers {
|
||||
return RedirectToAction(returnUrl, new { reportId });
|
||||
}
|
||||
|
||||
public ActionResult Uninstall(string packageId, string returnUrl) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to install packages")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
try {
|
||||
_packageUpdateService.Uninstall(packageId);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
Logger.Error(exception, "Error un-installing package {0}", packageId);
|
||||
_notifier.Error(T("Error un-installing package."));
|
||||
for (Exception scan = exception; scan != null; scan = scan.InnerException) {
|
||||
_notifier.Error(T("{0}", scan.Message));
|
||||
}
|
||||
}
|
||||
|
||||
int reportId = CreateReport(T("Package Uninstall"), T("Un-installation of package {0}", packageId));
|
||||
|
||||
return RedirectToAction(returnUrl, new { reportId });
|
||||
}
|
||||
|
||||
private void CreateNotificationsFromReport(int reportId) {
|
||||
// If we have notification in TempData, we don't need to display the
|
||||
// report as notifications (i.e. the AppDomain hasn't been restarted)
|
@@ -1,11 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.PackageManager.Services;
|
||||
using Orchard.PackageManager.Events;
|
||||
using Orchard.Packaging.Models;
|
||||
using Orchard.Packaging.Services;
|
||||
|
||||
namespace Orchard.PackageManager.Events {
|
||||
namespace Orchard.Packaging.Events {
|
||||
[OrchardFeature("Gallery.Updates")]
|
||||
public class ExtensionDisplayEventHandler : IExtensionDisplayEventHandler {
|
||||
private readonly IBackgroundPackageUpdateStatus _backgroundPackageUpdateStatus;
|
||||
private readonly IPackagingSourceManager _packagingSourceManager;
|
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
|
||||
namespace Orchard.Packaging.Models {
|
||||
public class PackagesStatusResult {
|
||||
public IEnumerable<UpdatePackageEntry> Entries { get; set; }
|
||||
public IEnumerable<Exception> Errors { get; set; }
|
||||
}
|
||||
|
||||
public class UpdatePackageEntry {
|
||||
public ExtensionDescriptor ExtensionsDescriptor { get; set; }
|
||||
public IList<PackagingEntry> PackageVersions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Return version to install if out-of-date, null otherwise.
|
||||
/// </summary>
|
||||
public PackagingEntry NewVersionToInstall {
|
||||
get {
|
||||
PackagingEntry updateToVersion = null;
|
||||
var latestUpdate = this.PackageVersions.OrderBy(v => new Version(v.Version)).Last();
|
||||
if (new Version(latestUpdate.Version) > new Version(this.ExtensionsDescriptor.Version)) {
|
||||
updateToVersion = latestUpdate;
|
||||
}
|
||||
return updateToVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -20,3 +20,8 @@ Features:
|
||||
Description: Module gallery management.
|
||||
Category: Packaging
|
||||
Dependencies: Orchard.Packaging
|
||||
Gallery.Updates
|
||||
Name: Gallery Updates
|
||||
Description: Manages updates for packages.
|
||||
Category: Packaging
|
||||
Dependencies: Gallery
|
||||
|
@@ -60,11 +60,15 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Commands\PackagingCommands.cs" />
|
||||
<Compile Include="Controllers\GalleryUpdatesController.cs" />
|
||||
<Compile Include="Controllers\PackagingServicesController.cs" />
|
||||
<Compile Include="Controllers\GalleryController.cs" />
|
||||
<Compile Include="DefaultPackagingUpdater.cs" />
|
||||
<Compile Include="Events\ExtensionDisplayEventHandler.cs" />
|
||||
<Compile Include="Events\IExtensionDisplayEventHandler.cs" />
|
||||
<Compile Include="Migrations.cs" />
|
||||
<Compile Include="Models\PackagingSource.cs" />
|
||||
<Compile Include="Models\UpdatePackageEntry.cs" />
|
||||
<Compile Include="Permissions.cs" />
|
||||
<Compile Include="ResourceManifest.cs" />
|
||||
<Compile Include="Service References\GalleryServer\Reference.cs">
|
||||
@@ -72,8 +76,11 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Reference.datasvcmap</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Services\BackgroundPackageUpdateStatus.cs" />
|
||||
<Compile Include="Services\BackgroundPackageUpdateTask.cs" />
|
||||
<Compile Include="Services\ExtensionReferenceRepository.cs" />
|
||||
<Compile Include="Services\FileBaseProjectSystem.cs" />
|
||||
<Compile Include="Services\FolderUpdater.cs" />
|
||||
<Compile Include="Services\IPackageBuilder.cs" />
|
||||
<Compile Include="Services\IPackageInstaller.cs" />
|
||||
<Compile Include="Services\IPackageManager.cs" />
|
||||
@@ -84,11 +91,13 @@
|
||||
<Compile Include="Services\PackageInstaller.cs" />
|
||||
<Compile Include="Services\PackageManager.cs" />
|
||||
<Compile Include="Models\PackagingEntry.cs" />
|
||||
<Compile Include="Services\PackageUpdateManager.cs" />
|
||||
<Compile Include="Services\PackagingSourceManager.cs" />
|
||||
<Compile Include="ViewModels\PackagingAddSourceViewModel.cs" />
|
||||
<Compile Include="ViewModels\PackagingHarvestViewModel.cs" />
|
||||
<Compile Include="ViewModels\PackagingExtensionsViewModel.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewModels\PackagingListViewModel.cs" />
|
||||
<Compile Include="ViewModels\PackagingSourcesViewModel.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -145,6 +154,12 @@
|
||||
<ItemGroup>
|
||||
<Content Include="web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\GalleryUpdates\ThemesUpdates.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\GalleryUpdates\ModulesUpdates.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@@ -1,8 +1,12 @@
|
||||
namespace Orchard.PackageManager.Services {
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Packaging.Models;
|
||||
|
||||
namespace Orchard.Packaging.Services {
|
||||
public interface IBackgroundPackageUpdateStatus : ISingletonDependency {
|
||||
PackagesStatusResult Value { get; set; }
|
||||
}
|
||||
|
||||
[OrchardFeature("Gallery.Updates")]
|
||||
public class BackgroundPackageUpdateStatus : IBackgroundPackageUpdateStatus {
|
||||
public PackagesStatusResult Value { get; set; }
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
using Orchard.Packaging.Services;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Tasks;
|
||||
|
||||
namespace Orchard.PackageManager.Services {
|
||||
namespace Orchard.Packaging.Services {
|
||||
/// <summary>
|
||||
/// Background task responsible for fetching feeds from the Gallery into the
|
||||
/// BackgroundPackageUpdateStatus singleton dependency.
|
||||
@@ -11,6 +11,7 @@ namespace Orchard.PackageManager.Services {
|
||||
/// only if the user asks for an explicit refresh or after the first background
|
||||
/// task sweep.
|
||||
/// </summary>
|
||||
[OrchardFeature("Gallery.Updates")]
|
||||
public class BackgroundPackageUpdateTask : IBackgroundTask {
|
||||
private readonly IPackageUpdateService _packageUpdateService;
|
||||
private readonly IPackagingSourceManager _packagingSourceManager;
|
@@ -2,16 +2,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.PackageManager.Services {
|
||||
namespace Orchard.Packaging.Services {
|
||||
public interface IFolderUpdater : IDependency {
|
||||
void Backup(DirectoryInfo existingFolder, DirectoryInfo backupfolder);
|
||||
void Update(DirectoryInfo destinationFolder, DirectoryInfo newFolder);
|
||||
}
|
||||
|
||||
[OrchardFeature("Gallery.Updates")]
|
||||
public class FolderUpdater : IFolderUpdater {
|
||||
private readonly INotifier _notifier;
|
||||
|
@@ -9,35 +9,10 @@ using Orchard.FileSystems.VirtualPath;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Packaging.Models;
|
||||
using Orchard.Packaging.Services;
|
||||
using Orchard.Services;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.PackageManager.Services {
|
||||
public class PackagesStatusResult {
|
||||
public IEnumerable<UpdatePackageEntry> Entries { get; set; }
|
||||
public IEnumerable<Exception> Errors { get; set; }
|
||||
}
|
||||
|
||||
public class UpdatePackageEntry {
|
||||
public ExtensionDescriptor ExtensionsDescriptor { get; set; }
|
||||
public IList<PackagingEntry> PackageVersions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Return version to install if out-of-date, null otherwise.
|
||||
/// </summary>
|
||||
public PackagingEntry NewVersionToInstall {
|
||||
get {
|
||||
PackagingEntry updateToVersion = null;
|
||||
var latestUpdate = this.PackageVersions.OrderBy(v => new Version(v.Version)).Last();
|
||||
if (new Version(latestUpdate.Version) > new Version(this.ExtensionsDescriptor.Version)) {
|
||||
updateToVersion = latestUpdate;
|
||||
}
|
||||
return updateToVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Orchard.Packaging.Services {
|
||||
public interface IPackageUpdateService : IDependency {
|
||||
PackagesStatusResult GetPackagesStatus(IEnumerable<PackagingSource> sources);
|
||||
void TriggerRefresh();
|
||||
@@ -45,6 +20,7 @@ namespace Orchard.PackageManager.Services {
|
||||
void Uninstall(string packageId);
|
||||
}
|
||||
|
||||
[OrchardFeature("Gallery.Updates")]
|
||||
public class PackageUpdateService : IPackageUpdateService {
|
||||
private readonly IPackagingSourceManager _packagingSourceManager;
|
||||
private readonly IExtensionManager _extensionManager;
|
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Packaging.Models;
|
||||
|
||||
namespace Orchard.Packaging.ViewModels {
|
||||
public class PackagingListViewModel {
|
||||
public IEnumerable<UpdatePackageEntry> Entries { get; set; }
|
||||
public dynamic Pager { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,92 @@
|
||||
@using Orchard.Modules.Extensions
|
||||
@using Orchard.Mvc.Html;
|
||||
@using Orchard.Packaging.ViewModels;
|
||||
@using Orchard.Packaging.Services;
|
||||
@using Orchard.Packaging.Models;
|
||||
@using Orchard.Environment.Extensions.Models;
|
||||
@using Orchard.Utility.Extensions;
|
||||
@model PackagingListViewModel
|
||||
|
||||
@{
|
||||
Style.Require("PackagingAdmin");
|
||||
|
||||
Layout.Title = T("Modules").ToString();
|
||||
}
|
||||
|
||||
@functions {
|
||||
public string InstallAction(PackagingEntry package) {
|
||||
return Url.Action("Install", "GalleryUpdates", new {
|
||||
area = "Orchard.Packaging",
|
||||
packageId = package.PackageId,
|
||||
version = package.Version,
|
||||
sourceId = package.Source.Id,
|
||||
returnUrl = "ModulesUpdates"
|
||||
});
|
||||
}
|
||||
public string UninstallAction(PackagingEntry package) {
|
||||
return Url.Action("Uninstall", "GalleryUpdates", new {
|
||||
area = "Orchard.Packaging",
|
||||
packageId = package.PackageId,
|
||||
returnUrl = "ModulesUpdates"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@if (Model.Entries.Count() <= 0) {
|
||||
<p>No package updates available.</p>
|
||||
} else {
|
||||
<ul class="contentItems">
|
||||
@foreach (var module in Model.Entries) {
|
||||
<li>
|
||||
@{
|
||||
string iconUrl = @module.NewVersionToInstall.IconUrl;
|
||||
if (string.IsNullOrWhiteSpace(iconUrl)) {
|
||||
iconUrl = Href("../../Content/Images/ModuleDefaultIcon.png");
|
||||
}
|
||||
}
|
||||
|
||||
<div class="iconThumbnail">
|
||||
<div class="extensionDetails column">
|
||||
<div class="extensionName">
|
||||
@if (!string.IsNullOrWhiteSpace(module.NewVersionToInstall.GalleryDetailsUrl)) {
|
||||
<a href="@module.NewVersionToInstall.GalleryDetailsUrl">
|
||||
<h2>@module.NewVersionToInstall.Title<span> - @T("Version: {0}", module.NewVersionToInstall.Version)</span></h2>
|
||||
</a>
|
||||
} else {
|
||||
<h2>@module.NewVersionToInstall.Title<span> - @T("Version: {0}", module.NewVersionToInstall.Version)</span></h2>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="related">
|
||||
@Html.Link(T("Install Latest").Text, InstallAction(module.NewVersionToInstall))@T(" | ")
|
||||
<a href="@module.NewVersionToInstall.PackageStreamUri">@T("Download")</a>
|
||||
</div>
|
||||
|
||||
<div class="properties">
|
||||
<p>@(module.NewVersionToInstall.Description == null ? T("(No description").Text : module.NewVersionToInstall.Description)</p>
|
||||
<ul class="pageStatus">
|
||||
<li>@T("Last Updated: {0}", module.NewVersionToInstall.LastUpdated)</li>
|
||||
<li> | @T("Author: {0}", !string.IsNullOrEmpty(module.NewVersionToInstall.Authors) ? module.NewVersionToInstall.Authors : T("Unknown").ToString())</li>
|
||||
<li> | @T("Downloads: {0}", module.NewVersionToInstall.DownloadCount)</li>
|
||||
<li> | @T("Website: ")
|
||||
@if (!string.IsNullOrEmpty(module.NewVersionToInstall.ProjectUrl)) { <a href="@module.NewVersionToInstall.ProjectUrl">@module.NewVersionToInstall.ProjectUrl</a> } else { @T("Unknown").ToString() }
|
||||
</li>
|
||||
<li><div> | @T("Rating: ")
|
||||
<div class="ratings" style="width:@(15 * 5)px" title="@T("Ratings: {0} ({1})", module.NewVersionToInstall.Rating, module.NewVersionToInstall.RatingsCount)">
|
||||
<div class="score" style="width:@(15 * (module.NewVersionToInstall.Rating))px"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="extensionThumbnail column">
|
||||
<img src="@iconUrl" class="thumbnail" alt="module" />
|
||||
</div>
|
||||
</div>
|
||||
</li>}
|
||||
</ul>
|
||||
|
||||
@Display(Model.Pager)
|
||||
}
|
@@ -0,0 +1,97 @@
|
||||
@using Orchard.Modules.Extensions
|
||||
@using Orchard.Mvc.Html;
|
||||
@using Orchard.Packaging.ViewModels;
|
||||
@using Orchard.Packaging.Services;
|
||||
@using Orchard.Packaging.Models;
|
||||
@using Orchard.Environment.Extensions.Models;
|
||||
@using Orchard.Utility.Extensions;
|
||||
@model PackagingListViewModel
|
||||
|
||||
@{
|
||||
Style.Require("PackagingAdmin");
|
||||
|
||||
Layout.Title = T("Themes").ToString();
|
||||
}
|
||||
|
||||
@functions {
|
||||
public string InstallAction(PackagingEntry package) {
|
||||
return Url.Action("Install", "GalleryUpdates", new {
|
||||
area = "Orchard.Packaging",
|
||||
packageId = package.PackageId,
|
||||
version = package.Version,
|
||||
sourceId = package.Source.Id,
|
||||
returnUrl = "ThemesUpdates"
|
||||
});
|
||||
}
|
||||
public string UninstallAction(PackagingEntry package) {
|
||||
return Url.Action("Uninstall", "GalleryUpdates", new {
|
||||
area = "Orchard.Packaging",
|
||||
packageId = package.PackageId,
|
||||
returnUrl = "ThemesUpdates"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@if (Model.Entries.Count() <= 0) {
|
||||
<p>No package updates available.</p>
|
||||
} else {
|
||||
<ul class="contentItems theme">
|
||||
@foreach (var theme in Model.Entries) {
|
||||
<li>
|
||||
@{
|
||||
string extensionClass = "iconThumbnail";
|
||||
string iconUrl = @theme.NewVersionToInstall.IconUrl;
|
||||
if (!string.IsNullOrWhiteSpace(@theme.NewVersionToInstall.FirstScreenshot)) {
|
||||
iconUrl = @theme.NewVersionToInstall.FirstScreenshot;
|
||||
extensionClass = "screenshotThumbnail";
|
||||
} else if (string.IsNullOrWhiteSpace(iconUrl)) {
|
||||
iconUrl = Href("../../Content/Images/imagePlaceholder.png");
|
||||
extensionClass = "screenshotThumbnail";
|
||||
}
|
||||
}
|
||||
|
||||
<div class="@extensionClass">
|
||||
<div class="extensionDetails column">
|
||||
<div class="extensionName">
|
||||
@if (!string.IsNullOrWhiteSpace(theme.NewVersionToInstall.GalleryDetailsUrl)) {
|
||||
<a href="@theme.NewVersionToInstall.GalleryDetailsUrl">
|
||||
<h2>@theme.NewVersionToInstall.Title<span> - @T("Version: {0}", theme.NewVersionToInstall.Version)</span></h2>
|
||||
</a>
|
||||
} else {
|
||||
<h2>@theme.NewVersionToInstall.Title<span> - @T("Version: {0}", theme.NewVersionToInstall.Version)</span></h2>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="related">
|
||||
@Html.Link(T("Install Latest").Text, InstallAction(theme.NewVersionToInstall))@T(" | ")
|
||||
<a href="@theme.NewVersionToInstall.PackageStreamUri">@T("Download")</a>
|
||||
</div>
|
||||
|
||||
<div class="properties">
|
||||
<p>@(theme.NewVersionToInstall.Description == null ? T("(No description").Text : theme.NewVersionToInstall.Description)</p>
|
||||
<ul class="pageStatus">
|
||||
<li>@T("Last Updated: {0}", theme.NewVersionToInstall.LastUpdated)</li>
|
||||
<li> | @T("Author: {0}", !string.IsNullOrEmpty(theme.NewVersionToInstall.Authors) ? theme.NewVersionToInstall.Authors : T("Unknown").ToString())</li>
|
||||
<li> | @T("Downloads: {0}", theme.NewVersionToInstall.DownloadCount)</li>
|
||||
<li> | @T("Website: ")
|
||||
@if (!string.IsNullOrEmpty(theme.NewVersionToInstall.ProjectUrl)) { <a href="@theme.NewVersionToInstall.ProjectUrl">@theme.NewVersionToInstall.ProjectUrl</a> } else { @T("Unknown").ToString() }
|
||||
</li>
|
||||
<li><div> | @T("Rating: ")
|
||||
<div class="ratings" style="width:@(15 * 5)px" title="@T("Ratings: {0} ({1})", theme.NewVersionToInstall.Rating, theme.NewVersionToInstall.RatingsCount)">
|
||||
<div class="score" style="width:@(15 * (theme.NewVersionToInstall.Rating))px"> </div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="extensionThumbnail column">
|
||||
<img src="@iconUrl" class="thumbnail" alt="theme" />
|
||||
</div>
|
||||
</div>
|
||||
</li>}
|
||||
</ul>
|
||||
|
||||
@Display(Model.Pager)
|
||||
}
|
@@ -108,8 +108,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.DesignerTools", "Or
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.MediaPicker", "Orchard.Web\Modules\Orchard.MediaPicker\Orchard.MediaPicker.csproj", "{43D0EC0B-1955-4566-8D31-7B9102DA1703}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.PackageManager", "Orchard.Web\Modules\Orchard.PackageManager\Orchard.PackageManager.csproj", "{E66935C0-830B-466E-A571-4AEED7057CBD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
CodeCoverage|Any CPU = CodeCoverage|Any CPU
|
||||
@@ -573,16 +571,6 @@ Global
|
||||
{43D0EC0B-1955-4566-8D31-7B9102DA1703}.FxCop|Any CPU.Build.0 = Release|Any CPU
|
||||
{43D0EC0B-1955-4566-8D31-7B9102DA1703}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{43D0EC0B-1955-4566-8D31-7B9102DA1703}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E66935C0-830B-466E-A571-4AEED7057CBD}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E66935C0-830B-466E-A571-4AEED7057CBD}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU
|
||||
{E66935C0-830B-466E-A571-4AEED7057CBD}.Coverage|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E66935C0-830B-466E-A571-4AEED7057CBD}.Coverage|Any CPU.Build.0 = Release|Any CPU
|
||||
{E66935C0-830B-466E-A571-4AEED7057CBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E66935C0-830B-466E-A571-4AEED7057CBD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E66935C0-830B-466E-A571-4AEED7057CBD}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E66935C0-830B-466E-A571-4AEED7057CBD}.FxCop|Any CPU.Build.0 = Release|Any CPU
|
||||
{E66935C0-830B-466E-A571-4AEED7057CBD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E66935C0-830B-466E-A571-4AEED7057CBD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -620,7 +608,6 @@ Global
|
||||
{99002B65-86F7-415E-BF4A-381AA8AB9CCC} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{4A4595EF-6C37-4F99-96ED-4AE0B9E438D3} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{43D0EC0B-1955-4566-8D31-7B9102DA1703} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{E66935C0-830B-466E-A571-4AEED7057CBD} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{ABC826D4-2FA1-4F2F-87DE-E6095F653810} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||
{F112851D-B023-4746-B6B1-8D2E5AD8F7AA} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||
{6CB3EB30-F725-45C0-9742-42599BA8E8D2} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
|
||||
|
Reference in New Issue
Block a user