Ejemplo n.º 1
0
        public int Create()
        {
            try {
                SchemaBuilder.CreateTable("ProxyPartRecord", table => table
                                          .ContentPartRecord()
                                          .Column("ServiceUrl", DbType.String)
                                          );

                var proxy = new ContentTypeDefinition("Proxy", "Proxy");
                ContentDefinitionManager.StoreTypeDefinition(proxy);
                ContentDefinitionManager.AlterTypeDefinition("Proxy", cfg => cfg.Creatable()
                                                             .WithPart("ProxyPart")
                                                             .WithPart("CommonPart")
                                                             .WithPart("TitlePart")
                                                             .WithPart("IdentityPart")
                                                             .WithPart("ContentPermissionsPart", builder => builder
                                                                       .WithSetting("ContentPermissionsPartSettings.View", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Publish", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Edit", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Delete", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.DisplayedRoles", "Administrator,Authenticated")
                                                                       )
                                                             );
            } catch (Exception e) {
                var message = string.Format("Error creating Proxy module. {0}", e.Message);
                Logger.Warning(message);
                Notifier.Warning(T(message));
                return(0);
            }
            return(1);
        }
Ejemplo n.º 2
0
        public int Create()
        {
            try {
                ContentDefinitionManager.StoreTypeDefinition(
                    new ContentTypeDefinition(Common.PipelineConfigurationName, "Pipeline")
                    );

                ContentDefinitionManager.AlterTypeDefinition(Common.PipelineConfigurationName, cfg => cfg
                                                             .Creatable()
                                                             .WithSetting("Description", "Transformalize Pipeline")
                                                             .WithPart(Common.PipelineConfigurationName + "Part")
                                                             .WithPart("CommonPart")
                                                             .WithPart("TitlePart")
                                                             .WithPart("IdentityPart")
                                                             .WithPart("ContentPermissionsPart", builder => builder
                                                                       .WithSetting("ContentPermissionsPartSettings.View", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Publish", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Edit", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Delete", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Preview", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.ViewOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.PublishOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.EditOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.DeleteOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.PreviewOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.DisplayedRoles", "Authenticated,Anonymous")
                                                                       )
                                                             );
                return(1);
            } catch (Exception e) {
                Logger.Error(e.Message);
                _notifier.Error(T(e.Message));
            }
            return(0);
        }
Ejemplo n.º 3
0
        public int Create()
        {
            foreach (var contentTypeName in _contentTypesToUpdate)
            {
                var typeDef = ContentDefinitionManager.GetTypeDefinition(contentTypeName);
                if (typeDef == null)
                {
                    continue;
                }

                var localizationPart = typeDef.Parts.Where(p => p.PartDefinition.Name == LocalizationPartTypeName).FirstOrDefault();
                if (localizationPart == null)
                {
                    ContentDefinitionManager.AlterTypeDefinition(contentTypeName, c => c.WithPart(LocalizationPartTypeName));
                    typeDef = ContentDefinitionManager.GetTypeDefinition(contentTypeName);
                }

                var autoroutePart = typeDef.Parts.Where(p => p.PartDefinition.Name == AutoroutePartTypeName).FirstOrDefault();
                if (autoroutePart == null)
                {
                    continue;
                }

                var autoroutePartSettings = LoadAutorouteSettings(autoroutePart.Settings);

                var routePattern = autoroutePartSettings.Patterns.Where(p => p.Name == LocalizedTitleName).FirstOrDefault();
                if (routePattern == null)
                {
                    var patterns  = autoroutePartSettings.Patterns.ToList();
                    var baseRoute = patterns.FirstOrDefault();
                    routePattern = new RoutePattern
                    {
                        Name    = LocalizedTitleName,
                        Pattern = baseRoute != null?string.Format("{{Content.Culture}}/{0}", baseRoute.Pattern) : "{Content.Culture}/{Content.Slug}",
                                      Description = baseRoute != null?string.Format("en-us/{0}", baseRoute.Description) : "en-us/my-content-item"
                    };
                    patterns.Add(routePattern);
                    autoroutePartSettings.Patterns = patterns;
                }
                var defaultIndex = autoroutePartSettings.Patterns.IndexOf(routePattern);
                autoroutePartSettings.DefaultPatternIndex = defaultIndex.ToString();

                SetAutorouteSettings(autoroutePartSettings, autoroutePart.Settings);

                ContentDefinitionManager.StoreTypeDefinition(typeDef);
            }
            return(4);
        }
Ejemplo n.º 4
0
        public int Create()
        {
            try {
                SchemaBuilder.CreateTable(Common.PipelineConfigurationName + "PartRecord", table => table
                                          .ContentPartRecord()
                                          .Column("Configuration", DbType.String, column => column.Unlimited())
                                          .Column("StartAddress", DbType.String)
                                          .Column("EndAddress", DbType.String)
                                          );

                ContentDefinitionManager.StoreTypeDefinition(
                    new ContentTypeDefinition(Common.PipelineConfigurationName, "Pipeline")
                    );

                ContentDefinitionManager.AlterTypeDefinition(Common.PipelineConfigurationName, cfg => cfg
                                                             .Creatable()
                                                             .WithSetting("Description", "Transformalize Pipeline")
                                                             .WithPart(Common.PipelineConfigurationName + "Part")
                                                             .WithPart("CommonPart")
                                                             .WithPart("TitlePart")
                                                             .WithPart("IdentityPart")
                                                             .WithPart("ContentPermissionsPart", builder => builder
                                                                       .WithSetting("ContentPermissionsPartSettings.View", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Publish", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Edit", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Delete", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Preview", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.ViewOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.PublishOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.EditOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.DeleteOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.PreviewOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.DisplayedRoles", "Authenticated,Anonymous")
                                                                       ).WithPart("AutoroutePart", builder => builder
                                                                                  .WithSetting("AutorouteSettings.AllowCustomPattern", "True")
                                                                                  .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False")
                                                                                  .WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"slugified-title\"}]"))
                                                             );
                return(1);
            } catch (Exception e) {
                Logger.Error(e.Message);
                _notifier.Error(T(e.Message));
            }
            return(0);
        }
Ejemplo n.º 5
0
        public int Create()
        {
            try {
                SchemaBuilder.CreateTable("ConfigurationPartRecord", table => table
                                          .ContentPartRecord()
                                          .Column("Configuration", DbType.String, column => column.Unlimited())
                                          .Column("TryCatch", DbType.Boolean)
                                          .Column("DisplayLog", DbType.Boolean)
                                          );
                SchemaBuilder.CreateTable("FilePartRecord", table => table
                                          .ContentPartRecord()
                                          .Column("FullPath", DbType.String)
                                          .Column("Direction", DbType.String)
                                          );

                ContentDefinitionManager.StoreTypeDefinition(
                    new ContentTypeDefinition("Configuration", "Transformalize")
                    );
                ContentDefinitionManager.StoreTypeDefinition(
                    new ContentTypeDefinition("File", "File")
                    );

                ContentDefinitionManager.AlterTypeDefinition("Configuration", cfg => cfg
                                                             .Creatable()
                                                             .WithPart("ConfigurationPart")
                                                             .WithPart("CommonPart")
                                                             .WithPart("TitlePart")
                                                             .WithPart("IdentityPart")
                                                             .WithPart("ContentPermissionsPart", builder => builder
                                                                       .WithSetting("ContentPermissionsPartSettings.View", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Publish", "Adminstrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Edit", "Adminstrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Delete", "Adminstrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.DisplayedRoles", "Authenticated,Anonymous")
                                                                       )
                                                             );
                ContentDefinitionManager.AlterTypeDefinition("File", cfg => cfg
                                                             .WithPart("FilePart")
                                                             .WithPart("CommonPart")
                                                             );
            } catch (Exception e) {
                Logger.Error("Creating Transformalize Configuration. Error Message: {0}", e.Message);
            }
            return(1);
        }
Ejemplo n.º 6
0
 public int Create()
 {
     try {
         var proxy = new ContentTypeDefinition("Kajero", "Kajero");
         ContentDefinitionManager.StoreTypeDefinition(proxy);
         ContentDefinitionManager.AlterTypeDefinition("Kajero", cfg => cfg.Creatable()
                                                      .WithPart("CommonPart")
                                                      .WithPart("TitlePart")
                                                      .WithPart("ContentPermissionsPart", p => p
                                                                .WithSetting("ContentPermissionsPartSettings.View", "Administrator")
                                                                .WithSetting("ContentPermissionsPartSettings.ViewOwn", "Administrator,Authenticated")
                                                                .WithSetting("ContentPermissionsPartSettings.Publish", "Administrator")
                                                                .WithSetting("ContentPermissionsPartSettings.PublishOwn", "Administrator,Authenticated")
                                                                .WithSetting("ContentPermissionsPartSettings.Edit", "Administrator")
                                                                .WithSetting("ContentPermissionsPartSettings.EditOwn", "Administrator,Authenticated")
                                                                .WithSetting("ContentPermissionsPartSettings.Delete", "Administrator")
                                                                .WithSetting("ContentPermissionsPartSettings.DeleteOwn", "Administrator,Authenticated")
                                                                .WithSetting("ContentPermissionsPartSettings.Preview", "Administrator")
                                                                .WithSetting("ContentPermissionsPartSettings.PreviewOwn", "Administrator,Authenticated")
                                                                .WithSetting("ContentPermissionsPartSettings.DisplayedRoles", "Anonymous,Authenticated")
                                                                )
                                                      .WithPart("AutoroutePart", p => p
                                                                .WithSetting("AutorouteSettings.AllowCustomPattern", "false")
                                                                .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "true")
                                                                .WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Slugified Title', Pattern: 'Kajero/{Content.Slug}', Description: 'Slugified Title'}]")
                                                                .WithSetting("AutorouteSettings.DefaultPatternIndex", "0")
                                                                )
                                                      .WithPart("BodyPart", p => p
                                                                .WithSetting("BodySettings.Flavor", "text")
                                                                )
                                                      );
     } catch (Exception e) {
         var message = string.Format("Error creating Kajero module. {0}", e.Message);
         Logger.Warning(message);
         Notifier.Warning(T(message));
         return(0);
     }
     return(1);
 }
Ejemplo n.º 7
0
        public int Create()
        {
            try {
                SchemaBuilder.CreateTable(Common.PipelineFileName + "PartRecord", table => table
                                          .ContentPartRecord()
                                          .Column("FullPath", DbType.String)
                                          .Column("Direction", DbType.String)
                                          );
                ContentDefinitionManager.StoreTypeDefinition(
                    new ContentTypeDefinition(Common.PipelineFileName, "Pipeline File")
                    );
                ContentDefinitionManager.AlterTypeDefinition(Common.PipelineFileName, cfg => cfg
                                                             .WithSetting("Description", "A file serving as input or output for a Transformalize pipeline.")
                                                             .WithPart(Common.PipelineFileName + "Part")
                                                             .WithPart("TitlePart")
                                                             .WithPart("CommonPart")
                                                             .WithPart("TagsPart")
                                                             .WithPart("ContentPermissionsPart", builder => builder
                                                                       .WithSetting("ContentPermissionsPartSettings.View", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Publish", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Edit", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Delete", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.Preview", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.ViewOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.PublishOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.EditOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.DeleteOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.PreviewOwn", "Administrator")
                                                                       .WithSetting("ContentPermissionsPartSettings.DisplayedRoles", "Authenticated,Anonymous")
                                                                       ));

                return(1);
            } catch (Exception ex) {
                Logger.Error(ex.Message);
                _notifier.Error(T(ex.Message));
            }
            return(0);
        }