public MediaFolderSchema()
        {
            this.Setup(SchemaAlias, "Folder");

            Id         = FixedHiveIds.MediaFolderSchema;
            SchemaType = FixedSchemaTypes.Content;

            RelationProxies.EnlistParent(FixedSchemas.MediaRootSchema, FixedRelationTypes.DefaultRelationType);

            var nameNameType = new NodeNameAttributeType();

            AttributeDefinitions.Add(new AttributeDefinition(NodeNameAttributeDefinition.AliasValue, "Node Name")
            {
                Id             = new HiveId("mf-name".EncodeAsGuid()),
                AttributeType  = nameNameType,
                AttributeGroup = FixedGroupDefinitions.GeneralGroup,
                Ordinal        = 0
            });

            SetXmlConfigProperty("thumb", "folder_media.png");
            SetXmlConfigProperty("icon", "tree-folder");
            //TODO: Need to change this to be a 'key' lookup for localization
            SetXmlConfigProperty("description", "A folder for media");
            //save the allowed children as a list of HiveId's as string
            SetXmlConfigProperty("allowed-children", new[]
            {
                FixedHiveIds.MediaFolderSchema.ToString(),
                FixedHiveIds.MediaImageSchema.ToString()
            });
        }
Example #2
0
        public UserGroupSchema()
        {
            this.Setup(SchemaAlias, "User Group");

            Id         = FixedHiveIds.UserGroupSchema;
            SchemaType = FixedSchemaTypes.UserGroup;
            var userGroupDetails = FixedGroupDefinitions.UserGroupDetails;

            RelationProxies.EnlistParentById(FixedHiveIds.SystemRoot, FixedRelationTypes.PermissionRelationType);

            var inBuiltTextType           = AttributeTypeRegistry.Current.GetAttributeType(StringAttributeType.AliasValue);
            var inBuiltUserGroupUsersType = AttributeTypeRegistry.Current.GetAttributeType(UserGroupUsersAttributeType.AliasValue);

            this.AttributeDefinitions.Add(new AttributeDefinition(NodeNameAttributeDefinition.AliasValue, "Name")
            {
                Id             = new HiveId("ug-name".EncodeAsGuid()),
                AttributeType  = inBuiltTextType,
                AttributeGroup = userGroupDetails,
                Ordinal        = 0,
                Description    = "user group name"
            });

            this.AttributeDefinitions.Add(new AttributeDefinition(UsersAlias, "Users")
            {
                Id             = new HiveId("ug-users".EncodeAsGuid()),
                AttributeType  = inBuiltUserGroupUsersType,
                AttributeGroup = userGroupDetails,
                Ordinal        = 1,
                Description    = "user group members"
            });
        }
Example #3
0
        public MediaImageSchema()
        {
            this.Setup(SchemaAlias, "Image");

            Id         = FixedHiveIds.MediaImageSchema;
            SchemaType = FixedSchemaTypes.Content;

            RelationProxies.EnlistParent(FixedSchemas.MediaRootSchema, FixedRelationTypes.DefaultRelationType);

            var nameNameType   = AttributeTypeRegistry.Current.GetAttributeType(NodeNameAttributeType.AliasValue);
            var fileUploadType = AttributeTypeRegistry.Current.GetAttributeType("uploader");

            AttributeDefinitions.Add(new AttributeDefinition(NodeNameAttributeDefinition.AliasValue, "Node Name")
            {
                Id             = new HiveId("mi-name".EncodeAsGuid()),
                AttributeType  = nameNameType,
                AttributeGroup = FixedGroupDefinitions.GeneralGroup,
                Ordinal        = 0
            });

            AttributeDefinitions.Add(new AttributeDefinition(UploadFileAlias, "Uploaded File")
            {
                Id             = new HiveId("mi-upload".EncodeAsGuid()),
                AttributeType  = fileUploadType,
                AttributeGroup = FixedGroupDefinitions.FileProperties,
                Ordinal        = 0
            });

            SetXmlConfigProperty("thumb", "image1.png");
            SetXmlConfigProperty("icon", "tree-media-photo");
            //TODO: Need to change this to be a 'key' lookup for localization
            SetXmlConfigProperty("description", "An image");
            //save the allowed children as a list of HiveId's as string
            SetXmlConfigProperty("allowed-children", new string[] { });
        }
        public DictionaryItemSchema()
        {
            this.Setup(SchemaAlias, "Dictionary Item Schema");

            Id         = FixedHiveIds.DictionaryItemSchema;
            SchemaType = FixedSchemaTypes.Content;

            RelationProxies.EnlistParent(FixedSchemas.DictionaryRootSchema, FixedRelationTypes.DefaultRelationType);

            var nodeNameType     = new NodeNameAttributeType();
            var translationsType = new DictionaryItemTranslationsAttributeType();

            AttributeDefinitions.Add(new AttributeDefinition(NodeNameAttributeDefinition.AliasValue, "Node Name")
            {
                Id             = new HiveId("di-name".EncodeAsGuid()),
                AttributeType  = nodeNameType,
                AttributeGroup = FixedGroupDefinitions.GeneralGroup,
                Ordinal        = 0
            });

            AttributeDefinitions.Add(new AttributeDefinition(TranslationsAlias, "Translations")
            {
                Id             = new HiveId("di-translations".EncodeAsGuid()),
                AttributeType  = translationsType,
                AttributeGroup = FixedGroupDefinitions.Translations,
                Ordinal        = 0
            });

            SetXmlConfigProperty("thumb", "developer.png");
            SetXmlConfigProperty("icon", "dictionary.gif");
            SetXmlConfigProperty("description", "A dictionary item");

            //save the allowed children as a list of HiveId's as string
            SetXmlConfigProperty("allowed-children", new string[] { FixedHiveIds.DictionaryItemSchema.ToString() });
        }
Example #5
0
        public CompositeEntitySchema(EntitySchema schema, IEnumerable <EntitySchema> ancestorSchemas, bool copyRelationProxiesFromSchema = false)
            : base(schema.Alias, schema.Name)
        {
            //TODO: Need to move this into a mapper, but not currently one available at the right level
            Id         = schema.Id;
            SchemaType = SchemaType;
            AttributeGroups.AddRange(schema.AttributeGroups);
            AttributeDefinitions.AddRange(schema.AttributeDefinitions);
            UtcCreated       = schema.UtcCreated;
            UtcModified      = schema.UtcModified;
            UtcStatusChanged = schema.UtcStatusChanged;

            var inheritedDefsDict = new Dictionary <string, InheritedAttributeDefinition>();
            var inheritedDefs     = ancestorSchemas
                                    .SelectMany(entitySchema => entitySchema.AttributeDefinitions.Select(definition => new InheritedAttributeDefinition(definition, entitySchema))).ToArray();

            foreach (var def in inheritedDefs)
            {
                if (!inheritedDefsDict.ContainsKey(def.Alias))
                {
                    inheritedDefsDict.Add(def.Alias, def);
                }
            }

            InheritedAttributeDefinitions = new EntityCollection <InheritedAttributeDefinition>(inheritedDefsDict.Values);

            // Need to only show the inherited groups that are exposed by the filtered inherited attribute definitions, but also include empty
            // groups so that they have a chance to have some definitions added
            var allLinkedGroups = ancestorSchemas.SelectMany(x => x.AttributeDefinitions.Select(y => new InheritedAttributeGroup(y.AttributeGroup, x)));
            var allKnownGroups  = ancestorSchemas.SelectMany(x => x.AttributeGroups.Select(y => new InheritedAttributeGroup(y, x)));
            var unlinkedGroups  = allKnownGroups.Except(allLinkedGroups);

            var inheritedGroups =
                InheritedAttributeDefinitions.Select(x => new InheritedAttributeGroup(x.AttributeGroup, x.Schema)).Union
                    (unlinkedGroups);

            InheritedAttributeGroups = new EntityCollection <InheritedAttributeGroup>(inheritedGroups);

            RelationProxies.LazyLoadDelegate = schema.RelationProxies.LazyLoadDelegate;
            XmlConfiguration = schema.XmlConfiguration;

            if (copyRelationProxiesFromSchema)
            {
                foreach (var proxies in schema.RelationProxies.GetManualParentProxies())
                {
                    RelationProxies.EnlistParent(proxies.Item.Source, proxies.Item.Type, proxies.Item.Ordinal, proxies.Item.MetaData.ToArray());
                }
                foreach (var proxies in schema.RelationProxies.GetManualChildProxies())
                {
                    RelationProxies.EnlistParent(proxies.Item.Source, proxies.Item.Type, proxies.Item.Ordinal, proxies.Item.MetaData.ToArray());
                }
            }
        }