Resolves #U4-184 Upgrade package when installing a newer version.

Multiple package versions can be installed, only the latest version is listed under "Installed Packages".
When the installed package is viewed, a list of previously installed versions (of that package) are listed.
This commit is contained in:
leekelleher
2013-06-10 13:55:58 -01:00
parent 5212d17f49
commit e0c68a8e1c
6 changed files with 81 additions and 27 deletions

View File

@@ -627,6 +627,7 @@ To manage your website, simply open the umbraco back office and start adding con
<key alias="packageUpgradeInstructions">Upgrade instructions</key>
<key alias="packageUpgradeText"> There's an upgrade available for this package. You can download it directly from the umbraco package repository.</key>
<key alias="packageVersion">Package version</key>
<key alias="packageVersionHistory">Package version history</key>
<key alias="viewPackageWebsite">View package website</key>
</area>
<area alias="paste">

View File

@@ -56,7 +56,17 @@
</cc2:Pane>
<cc2:Pane ID="pane_versions" runat="server" Text="Package version history" Visible="false">
<cc2:PropertyPanel ID="pp_versions" runat="server">
<asp:Repeater ID="rptr_versions" runat="server">
<HeaderTemplate><ul></HeaderTemplate>
<ItemTemplate><li><a href="installedPackage.aspx?id=<%# ((umbraco.cms.businesslogic.packager.InstalledPackage)Container.DataItem).Data.Id %>"><%# ((umbraco.cms.businesslogic.packager.InstalledPackage)Container.DataItem).Data.Version %></a></li></ItemTemplate>
<FooterTemplate></ul></FooterTemplate>
</asp:Repeater>
</cc2:PropertyPanel>
</cc2:Pane>
<cc2:Pane ID="pane_options" runat="server" Text="Package options">
<table border="0" style="width: 100%;">
<tr><td class="propertyHeader" valign="top">

View File

@@ -1,28 +1,13 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Xml;
using System.Configuration;
using umbraco.BasePages;
using umbraco.BusinessLogic;
using umbraco.businesslogic;
using umbraco.cms.businesslogic;
using umbraco.cms.businesslogic.cache;
using umbraco.cms.businesslogic.contentitem;
using umbraco.cms.businesslogic.datatype;
using umbraco.cms.businesslogic.language;
using umbraco.cms.businesslogic.media;
using umbraco.cms.businesslogic.member;
using umbraco.cms.businesslogic.property;
using umbraco.cms.businesslogic.web;
using umbraco.interfaces;
using umbraco.DataLayer;
using umbraco.BusinessLogic.Utils;
using umbraco.cms.businesslogic.packager;
using umbraco.cms.presentation.Trees;
using umbraco.interfaces;
namespace umbraco
{
@@ -63,18 +48,24 @@ namespace umbraco
switch (m_packageType)
{
case "installed":
foreach (cms.businesslogic.packager.InstalledPackage p in cms.businesslogic.packager.InstalledPackage.GetAllInstalledPackages())
Version v;
// Display the unique packages, ordered by the latest version number. [LK 2013-06-10]
var uniquePackages = InstalledPackage.GetAllInstalledPackages()
.OrderByDescending(x => Version.TryParse(x.Data.Version, out v) ? v : new Version())
.GroupBy(x => x.Data.Name)
.Select(x => x.First())
.OrderBy(x => x.Data.Id);
foreach (var p in uniquePackages)
{
XmlTreeNode xNode = XmlTreeNode.Create(this);
xNode.NodeID = PACKAGE_TREE_PREFIX + p.Data.Id.ToString();
var xNode = XmlTreeNode.Create(this);
xNode.NodeID = string.Concat(PACKAGE_TREE_PREFIX, p.Data.Id);
xNode.Text = p.Data.Name;
xNode.Action = "javascript:openInstalledPackage('" + p.Data.Id.ToString() + "');";
xNode.Action = string.Format("javascript:openInstalledPackage('{0}');", p.Data.Id);
xNode.Icon = "package.gif";
xNode.OpenIcon = "package.gif";
xNode.NodeType = "createdPackageInstance";
xNode.Menu = null;
tree.Add(xNode);
}
break;

View File

@@ -56,7 +56,17 @@
</cc2:Pane>
<cc2:Pane ID="pane_versions" runat="server" Text="Package version history" Visible="false">
<cc2:PropertyPanel ID="pp_versions" runat="server">
<asp:Repeater ID="rptr_versions" runat="server">
<HeaderTemplate><ul></HeaderTemplate>
<ItemTemplate><li><a href="#"><%# ((InstalledPackage)Container.DataItem).Data.Name %></a></li></ItemTemplate>
<FooterTemplate></ul></FooterTemplate>
</asp:Repeater>
</cc2:PropertyPanel>
</cc2:Pane>
<cc2:Pane ID="pane_options" runat="server" Text="Package options">
<table border="0" style="width: 100%;">
<tr><td class="propertyHeader" valign="top">

View File

@@ -335,6 +335,20 @@ namespace umbraco.presentation.developer.packages
bt_uninstall.Visible = false;
pane_uninstall.Visible = false;
}
// List the package version history [LK 2013-067-10]
Version v;
var packageVersionHistory = cms.businesslogic.packager.InstalledPackage.GetAllInstalledPackages()
.Where(x => x.Data.Id != _pack.Data.Id && string.Equals(x.Data.Name, _pack.Data.Name, StringComparison.OrdinalIgnoreCase))
.OrderBy(x => Version.TryParse(x.Data.Version, out v) ? v : new Version());
if (packageVersionHistory != null && packageVersionHistory.Count() > 0)
{
rptr_versions.DataSource = packageVersionHistory;
rptr_versions.DataBind();
pane_versions.Visible = true;
}
}
}
}
@@ -613,6 +627,8 @@ namespace umbraco.presentation.developer.packages
pp_upgradeInstruction.Text = ui.Text("packager", "packageUpgradeInstructions");
bt_gotoUpgrade.Text = ui.Text("packager", "packageUpgradeDownload");
pane_versions.Text = ui.Text("packager", "packageVersionHistory");
pane_noItems.Text = ui.Text("packager", "packageNoItemsHeader");
pane_uninstall.Text = ui.Text("packager", "packageUninstallHeader");

View File

@@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4200
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@@ -175,6 +174,33 @@ namespace umbraco.presentation.developer.packages {
/// </remarks>
protected global::System.Web.UI.WebControls.Literal lt_readme;
/// <summary>
/// pane_versions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Pane pane_versions;
/// <summary>
/// pp_versions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.PropertyPanel pp_versions;
/// <summary>
/// rptr_versions control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Repeater rptr_versions;
/// <summary>
/// pane_options control.
/// </summary>