Fixing 17531: The homepage is not checked after imported [4661 (68d8f1db090f)]

--HG--
branch : 1.x
This commit is contained in:
Suha Can
2011-03-28 14:19:32 -07:00
parent bfcdbdba57
commit f0d6bdb341

View File

@@ -110,12 +110,23 @@ namespace Orchard.Core.Routable.Drivers {
if (path != null) {
part.Path = path;
}
var promoteToHomePage = context.Attribute(part.PartDefinition.Name, "PromoteToHomePage");
if (promoteToHomePage != null) {
part.PromoteToHomePage = Convert.ToBoolean(promoteToHomePage);
if (part.PromoteToHomePage && _routableHomePageProvider != null) {
_services.WorkContext.CurrentSite.HomePage = _routableHomePageProvider.GetSettingValue(part.ContentItem.Id);
}
}
}
protected override void Exporting(RoutePart part, ExportContentContext context) {
context.Element(part.PartDefinition.Name).SetAttributeValue("Title", part.Title);
context.Element(part.PartDefinition.Name).SetAttributeValue("Slug", part.Slug);
context.Element(part.PartDefinition.Name).SetAttributeValue("Path", part.Path);
if (_services.WorkContext.CurrentSite.HomePage == _routableHomePageProvider.GetSettingValue(part.ContentItem.Id)) {
context.Element(part.PartDefinition.Name).SetAttributeValue("PromoteToHomePage", "true");
}
}
}
}