00001 using System; 00002 using System.Collections.Generic; 00003 using N2.Definitions; 00004 using N2.Integrity; 00005 using N2.Installation; 00006 00007 namespace N2 00008 { 00015 [AttributeUsage(AttributeTargets.Class, Inherited = false)] 00016 public class PartDefinitionAttribute : AbstractDefinition 00017 { 00018 public AllowedZones AllowedIn { get; set; } 00019 public string[] AllowedZoneNames { get; set; } 00020 00021 public PartDefinitionAttribute(string title) 00022 :this() 00023 { 00024 Title = title; 00025 } 00026 00027 public PartDefinitionAttribute() 00028 { 00029 IsPage = false; 00030 IconUrl = "{ManagementUrl}/Resources/icons/page_white.png"; 00031 AllowedIn = AllowedZones.AllNamed; 00032 } 00033 00034 public override void Refine(ItemDefinition currentDefinition, IList<ItemDefinition> allDefinitions) 00035 { 00036 base.Refine(currentDefinition, allDefinitions); 00037 00038 currentDefinition.AllowedIn = AllowedIn; 00039 if (AllowedZoneNames != null) 00040 foreach (string zoneName in AllowedZoneNames) 00041 currentDefinition.AddAllowedZone(zoneName); 00042 currentDefinition.Installer = InstallerHint.NeverRootOrStartPage; 00043 } 00044 } 00045 }