This commit is contained in:
Shannon Deminick
2012-12-31 02:51:55 +03:00
10 changed files with 49 additions and 19 deletions

View File

@@ -116,7 +116,7 @@ namespace Umbraco.Core.Models
/// <summary>
/// Gets a list of ContentType aliases from the current composition
/// </summary>
/// <returns></returns>
/// <returns>An enumerable list of string aliases</returns>
/// <remarks>Does not contain the alias of the Current ContentType</remarks>
public IEnumerable<string> CompositionAliases()
{
@@ -124,5 +124,17 @@ namespace Umbraco.Core.Models
.Select(x => x.Alias)
.Union(ContentTypeComposition.SelectMany(x => x.CompositionAliases()));
}
/// <summary>
/// Gets a list of ContentType Ids from the current composition
/// </summary>
/// <returns>An enumerable list of integer ids</returns>
/// <remarks>Does not contain the Id of the Current ContentType</remarks>
public IEnumerable<int> CompositionIds()
{
return ContentTypeComposition
.Select(x => x.Id)
.Union(ContentTypeComposition.SelectMany(x => x.CompositionIds()));
}
}
}

View File

@@ -46,7 +46,13 @@ namespace Umbraco.Core.Models
/// <summary>
/// Gets a list of ContentType aliases from the current composition
/// </summary>
/// <returns></returns>
/// <returns>An enumerable list of string aliases</returns>
IEnumerable<string> CompositionAliases();
/// <summary>
/// Gets a list of ContentType Ids from the current composition
/// </summary>
/// <returns>An enumerable list of integer ids</returns>
IEnumerable<int> CompositionIds();
}
}

View File

@@ -446,7 +446,6 @@ namespace Umbraco.Core.Services
/// <param name="userId">Id of the User saving the Content</param>
public void Save(IMedia media, int userId = -1)
{
if (Saving.IsRaisedEventCancelled(new SaveEventArgs<IMedia>(media), this))
return;

View File

@@ -2,7 +2,7 @@
using umbraco.BusinessLogic;
using umbraco.interfaces;
namespace Umbraco.Web.Strategies
namespace Umbraco.Web.Strategies.Migrations
{
/// <summary>
/// This is kind of a hack to ensure that Apps and Trees that might still reside in the db is

View File

@@ -9,7 +9,7 @@ using umbraco.cms.businesslogic.web;
using umbraco.interfaces;
using umbraco.presentation.cache;
namespace Umbraco.Web.Strategies
namespace Umbraco.Web.Strategies.Publishing
{
/// <summary>
/// Represents the UpdateCacheAfterPublish class, which subscribes to the Published event

View File

@@ -7,7 +7,7 @@ using umbraco;
using umbraco.interfaces;
using umbraco.presentation.cache;
namespace Umbraco.Web.Strategies
namespace Umbraco.Web.Strategies.Publishing
{
/// <summary>
/// Represents the UpdateCacheAfterUnPublish class, which subscribes to the UnPublished event

View File

@@ -328,9 +328,9 @@
<Compile Include="RouteCollectionExtensions.cs" />
<Compile Include="Routing\LookupByPageIdQuery.cs" />
<Compile Include="Mvc\SurfaceControllerResolver.cs" />
<Compile Include="Strategies\UpdateCacheAfterPublish.cs" />
<Compile Include="Strategies\UpdateCacheAfterUnPublish.cs" />
<Compile Include="Strategies\EnsureAppsTreesUpdatedOnUpgrade.cs" />
<Compile Include="Strategies\Publishing\UpdateCacheAfterPublish.cs" />
<Compile Include="Strategies\Publishing\UpdateCacheAfterUnPublish.cs" />
<Compile Include="Strategies\Migrations\EnsureAppsTreesUpdatedOnUpgrade.cs" />
<Compile Include="Templates\TemplateRenderer.cs" />
<Compile Include="Templates\TemplateUtilities.cs" />
<Compile Include="Trees\PartialViewMacrosTree.cs" />

View File

@@ -130,7 +130,8 @@ namespace umbraco.controls
// Iterate through the property types and add them to the tab
// zb-00036 #29889 : fix property types getter to get the right set of properties
// ge : had a bit of a corrupt db and got weird NRE errors so rewrote this to catch the error and rethrow with detail
foreach (PropertyType propertyType in tab.GetPropertyTypes(_content.ContentType.Id))
var propertyTypes = tab.GetPropertyTypes(_content.ContentType.Id);
foreach (PropertyType propertyType in propertyTypes)
{
var property = _content.getProperty(propertyType);
if (property != null && tabPage != null)

View File

@@ -582,14 +582,25 @@ namespace umbraco.cms.businesslogic
if (m_masterContentTypes == null)
{
m_masterContentTypes = new List<int>();
using (var dr = SqlHelper.ExecuteReader(@"SELECT parentContentTypeId FROM cmsContentType2ContentType WHERE childContentTypeId = @id", SqlHelper.CreateParameter("@id", Id)))
if (_contentType == null)
{
while (dr.Read())
//TODO Make this recursive, so it looks up Masters of the Master ContentType
using (
var dr =
SqlHelper.ExecuteReader(
@"SELECT parentContentTypeId FROM cmsContentType2ContentType WHERE childContentTypeId = @id",
SqlHelper.CreateParameter("@id", Id)))
{
m_masterContentTypes.Add(dr.GetInt("parentContentTypeId"));
while (dr.Read())
{
m_masterContentTypes.Add(dr.GetInt("parentContentTypeId"));
}
}
}
else
{
m_masterContentTypes = _contentType.CompositionIds().ToList();
}
}
return m_masterContentTypes;

View File

@@ -294,15 +294,16 @@ namespace umbraco.cms.businesslogic.media
public override void Save()
{
SaveEventArgs e = new SaveEventArgs();
foreach (var property in GenericProperties)
{
_media.SetValue(property.PropertyType.Alias, property.Value);
}
FireBeforeSave(e);
if (!e.Cancel)
{
foreach (var property in GenericProperties)
{
_media.SetValue(property.PropertyType.Alias, property.Value);
}
ApplicationContext.Current.Services.MediaService.Save(_media);
base.Save();