public int UpdateFrom1() { ContentDefinitionManager.AlterPartDefinition("AutoroutePart", part => part .WithDescription("Adds advanced url configuration options to your content type to completely customize the url pattern for a content item.")); return(2); }
public int UpdateFrom5() { ContentDefinitionManager.AlterPartDefinition("CustomPinPart", builder => builder .Attachable(true)); return(6); }
public int UpdateFrom2() { ContentDefinitionManager.AlterTypeDefinition("List", cfg => cfg.WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "2"))); return(3); }
public int UpdateFrom1() { ContentDefinitionManager.AlterTypeDefinition("Contact Page", cfg => cfg.WithPart("CommonPart")); return(2); }
public int UpdateFrom6() { ContentDefinitionManager.AlterTypeDefinition(Common.PipelineConfigurationName, cfg => cfg.WithSetting("Listable", "True")); return(7); }
public int UpdateFrom4() { ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectProjectionContentType, cfg => cfg.Listable(true).Creatable(true)); return(5); }
public int Create() { SchemaBuilder.CreateTable("MediaPartRecord", t => t .ContentPartRecord() .Column <string>("MimeType") .Column <string>("Caption", c => c.Unlimited()) .Column <string>("AlternateText", c => c.Unlimited()) .Column <string>("FolderPath", c => c.WithLength(2048)) .Column <string>("FileName", c => c.WithLength(2048)) ); SchemaBuilder.AlterTable("MediaPartRecord", t => t .CreateIndex("IDX_MediaPartRecord_FolderPath", "FolderPath") ); ContentDefinitionManager.AlterPartDefinition("MediaPart", part => part .Attachable() .WithDescription("Turns a content type into a Media. Note: you need to set the stereotype to \"Media\" as well.") ); ContentDefinitionManager.AlterPartDefinition("ImagePart", part => part .Attachable() .WithDescription("Provides common metadata for an Image Media.") ); ContentDefinitionManager.AlterPartDefinition("VectorImagePart", part => part .Attachable() .WithDescription("Provides common metadata for a Vector Image Media.") ); ContentDefinitionManager.AlterPartDefinition("VideoPart", part => part .Attachable() .WithDescription("Provides common metadata for a Video Media.") ); ContentDefinitionManager.AlterPartDefinition("AudioPart", part => part .Attachable() .WithDescription("Provides common metadata for an Audio Media.") ); ContentDefinitionManager.AlterPartDefinition("DocumentPart", part => part .Attachable() .WithDescription("Provides common metadata for a Document Media.") ); ContentDefinitionManager.AlterPartDefinition("OEmbedPart", part => part .Attachable() .WithDescription("Provides common metadata for an OEmbed Media.") ); ContentDefinitionManager.AlterTypeDefinition("Image", td => td .DisplayedAs("Image") .WithSetting("MediaFileNameEditorSettings.ShowFileNameEditor", "True") .AsImage() .WithIdentity() ); ContentDefinitionManager.AlterTypeDefinition("VectorImage", td => td .DisplayedAs("Vector Image") .WithSetting("MediaFileNameEditorSettings.ShowFileNameEditor", "True") .AsVectorImage() .WithIdentity() ); ContentDefinitionManager.AlterTypeDefinition("Video", td => td .DisplayedAs("Video") .WithSetting("MediaFileNameEditorSettings.ShowFileNameEditor", "True") .AsVideo() .WithIdentity() ); ContentDefinitionManager.AlterTypeDefinition("Audio", td => td .DisplayedAs("Audio") .WithSetting("MediaFileNameEditorSettings.ShowFileNameEditor", "True") .AsAudio() .WithIdentity() ); ContentDefinitionManager.AlterTypeDefinition("Document", td => td .DisplayedAs("Document") .WithSetting("MediaFileNameEditorSettings.ShowFileNameEditor", "True") .AsDocument() .WithIdentity() ); ContentDefinitionManager.AlterTypeDefinition("OEmbed", td => td .DisplayedAs("External Media") .WithSetting("Stereotype", "Media") .WithIdentity() .WithPart("CommonPart") .WithPart("MediaPart") .WithPart("OEmbedPart") .WithPart("TitlePart") ); return(7); }
public int UpdateFrom3() { ContentDefinitionManager.AlterPartDefinition("WidgetPart", builder => builder.Attachable()); return(4); }
public int UpdateFrom4() { ContentDefinitionManager.AlterPartDefinition("WidgetPart", part => part .WithDescription("Turns a content type into a Widget. Note: you need to set the stereotype to \"Widget\" as well.")); return(5); }
public int Create() { // BingLocation SchemaBuilder.CreateTable("BingLocationRecord", table => table .ContentPartRecord() .Column("Latitude", DbType.Single, column => column.NotNull()) .Column("Longitude", DbType.Single, column => column.NotNull()) .Column("IsEnabled", DbType.Boolean, column => column.WithDefault(true)) .Column("Width", DbType.Int32, column => column.Nullable().WithDefault(400)) .Column("Height", DbType.Int32, column => column.NotNull().WithDefault(400)) .Column("Zoom", DbType.Int32, column => column.NotNull()) .Column("MapType", DbType.String) .Column("MapIcon", DbType.String) .Column("BingMapList_Id", DbType.Int32) ); ContentDefinitionManager.AlterPartDefinition(typeof(BingLocationPart).Name, cfg => cfg.Attachable()); // BingMapList SchemaBuilder.CreateTable("BingMapListRecord", table => table .ContentPartRecord() .Column("CenterLatitude", DbType.Single, column => column.NotNull()) .Column("CenterLongitude", DbType.Single, column => column.NotNull()) .Column("Width", DbType.Int32, column => column.Nullable().WithDefault(400)) .Column("Height", DbType.Int32, column => column.NotNull().WithDefault(400)) .Column("Zoom", DbType.Int32, column => column.NotNull()) .Column("MapType", DbType.String) ); ContentDefinitionManager.AlterPartDefinition(typeof(BingMapListPart).Name, cfg => cfg.Attachable()); // Content items // Content item: Bing Place ContentDefinitionManager.AlterTypeDefinition("BingPlace", cfg => cfg .WithPart("BingLocationPart") .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("AutoroutePart", builder => builder .WithSetting("AutorouteSettings.AllowCustomPattern", "true") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "false") .WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Title', Pattern: '{Content.Slug}', Description: 'my-place'}]") .WithSetting("AutorouteSettings.DefaultPatternIndex", "0")) .WithPart("BodyPart") .WithPart("CommentsPart") .WithPart("TagsPart") .Creatable() ); // Content item: Bing Area ContentDefinitionManager.AlterTypeDefinition("BingArea", cfg => cfg .WithPart("BingMapListPart") .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("AutoroutePart", builder => builder .WithSetting("AutorouteSettings.AllowCustomPattern", "true") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "false") .WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Title', Pattern: '{Content.Slug}', Description: 'my-area'}]") .WithSetting("AutorouteSettings.DefaultPatternIndex", "0")) .WithPart("BodyPart") .Creatable() ); // Widgets /* * // Widget: Bing Place Widget * ContentDefinitionManager.AlterTypeDefinition("BingLocationWidget", cfg => cfg * .WithPart("BingLocationPart") * .WithPart("WidgetPart") * .WithPart("CommonPart") * .WithSetting("Stereotype", "Widget") * ); * * // Widget: Bing Area Widget * ContentDefinitionManager.AlterTypeDefinition("BingMapListWidget", cfg => cfg * .WithPart("BingMapListPart") * .WithPart("WidgetPart") * .WithPart("CommonPart") * .WithSetting("Stereotype", "Widget") * ); */ return(2); }
public int UpdateFrom1() { ContentDefinitionManager.AlterTypeDefinition("HtmlWidget", cfg => cfg.WithIdentity()); return(2); }
public int Create() { SchemaBuilder.CreateTable("ActionSubmitPartRecord", table => table .ContentPartRecord() .Column <int>("TeamPartRecord_Id") .Column <int>("ObjectivePartRecord_Id") .Column <int>("ObjectiveResultPartRecord_Id") .Column <string>("Status", c => c.WithDefault("Pending"))); SchemaBuilder.CreateTable("PhotoSubmitPartRecord", table => table .ContentPartRecord() .Column <string>("PhotoUrl")); SchemaBuilder.CreateTable("VideoSubmitPartRecord", table => table .ContentPartRecord() .Column <string>("VideoUrl")); SchemaBuilder.CreateTable("QuestionObjectivePartRecord", table => table .Column <bool>("AutoValidate", column => column.WithDefault(true)) .ContentPartRecord()); SchemaBuilder.CreateTable("QuestionAnswerRecord", table => table .Column <int>("Id", column => column.PrimaryKey().Identity()) .Column <int>("QuestionObjectivePartRecord_Id") .Column <string>("Answer")); SchemaBuilder.CreateTable("QuestionSubmitPartRecord", table => table .ContentPartRecord() .Column <string>("Answer")); ContentDefinitionManager.AlterTypeDefinition("PhotoObjective", builder => builder .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("BodyPart") .WithPart("AutoroutePart", partBuilder => partBuilder .WithSetting("AutorouteSettings.AllowCustomPattern", "true") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "false") .WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Game-Title and Objective-Title', Pattern: '{Content.Container.Path}/{Content.Slug}', Description: 'Games/Lego/Ringen-Verzamelen'}]") .WithSetting("AutorouteSettings.DefaultPatternIndex", "0")) .WithPart("ObjectivePart") .WithPart("ActionObjectivePart") .Draftable()); ContentDefinitionManager.AlterTypeDefinition("PhotoSubmit", builder => builder .WithPart("CommonPart") .WithPart("ActionSubmitPart") .WithPart("PhotoSubmitPart")); ContentDefinitionManager.AlterTypeDefinition("VideoObjective", builder => builder .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("BodyPart") .WithPart("AutoroutePart", partBuilder => partBuilder .WithSetting("AutorouteSettings.AllowCustomPattern", "true") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "false") .WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Game-Title and Objective-Title', Pattern: '{Content.Container.Path}/{Content.Slug}', Description: 'Games/Lego/Ringen-Verzamelen'}]") .WithSetting("AutorouteSettings.DefaultPatternIndex", "0")) .WithPart("ObjectivePart") .WithPart("ActionObjectivePart") .Draftable()); ContentDefinitionManager.AlterTypeDefinition("VideoSubmit", builder => builder .WithPart("CommonPart") .WithPart("ActionSubmitPart") .WithPart("VideoSubmitPart")); ContentDefinitionManager.AlterTypeDefinition("QuestionObjective", builder => builder .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("BodyPart") .WithPart("AutoroutePart", partBuilder => partBuilder .WithSetting("AutorouteSettings.AllowCustomPattern", "true") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "false") .WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Game-Title and Objective-Title', Pattern: '{Content.Container.Path}/{Content.Slug}', Description: 'Games/Lego/Ringen-Verzamelen'}]") .WithSetting("AutorouteSettings.DefaultPatternIndex", "0")) .WithPart("ObjectivePart") .WithPart("ActionObjectivePart") .WithPart("QuestionObjectivePart") .Draftable()); ContentDefinitionManager.AlterTypeDefinition("QuestionSubmit", builder => builder .WithPart("CommonPart") .WithPart("ActionSubmitPart") .WithPart("QuestionSubmitPart")); return(5); }
public int Create() { ContentDefinitionManager.AlterPartDefinition(typeof(CulturePickerPart).Name, cfg => cfg .Attachable()); return(1); }
public int Create() { ContentDefinitionManager.AlterPartDefinition("MenuPart", builder => builder.Attachable()); ContentDefinitionManager.AlterPartDefinition("NavigationPart", builder => builder.Attachable()); ContentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg.WithPart("NavigationPart")); SchemaBuilder.CreateTable("MenuItemPartRecord", table => table .ContentPartRecord() .Column <string>("Url", column => column.WithLength(1024)) ); SchemaBuilder.CreateTable("MenuPartRecord", table => table .ContentPartRecord() .Column <string>("MenuText") .Column <string>("MenuPosition") .Column <int>("MenuId") ); ContentDefinitionManager.AlterTypeDefinition("MenuItem", cfg => cfg .WithPart("MenuPart") .WithPart("IdentityPart") .WithPart("CommonPart") .DisplayedAs("Custom Link") .WithSetting("Description", "Represents a simple custom link with a text and an url.") .WithSetting("Stereotype", "MenuItem") // because we declare a new stereotype, the Shape MenuItem_Edit is needed ); ContentDefinitionManager.AlterTypeDefinition("Menu", cfg => cfg .WithPart("CommonPart", p => p.WithSetting("OwnerEditorSettings.ShowOwnerEditor", "false")) .WithPart("TitlePart") ); SchemaBuilder.CreateTable("MenuWidgetPartRecord", table => table .ContentPartRecord() .Column <int>("StartLevel") .Column <int>("Levels") .Column <bool>("Breadcrumb") .Column <bool>("AddHomePage") .Column <bool>("AddCurrentPage") .Column <int>("Menu_id") ); ContentDefinitionManager.AlterTypeDefinition("MenuWidget", cfg => cfg .WithPart("CommonPart") .WithPart("IdentityPart") .WithPart("WidgetPart") .WithPart("MenuWidgetPart") .WithSetting("Stereotype", "Widget") ); SchemaBuilder.CreateTable("AdminMenuPartRecord", table => table .ContentPartRecord() .Column <string>("AdminMenuText") .Column <string>("AdminMenuPosition") .Column <bool>("OnAdminMenu") ); ContentDefinitionManager.AlterTypeDefinition("HtmlMenuItem", cfg => cfg .WithPart("MenuPart") .WithPart("BodyPart") .WithPart("CommonPart") .WithPart("IdentityPart") .DisplayedAs("Html Menu Item") .WithSetting("Description", "Renders some custom HTML in the menu.") .WithSetting("BodyPartSettings.FlavorDefault", "html") .WithSetting("Stereotype", "MenuItem") ); ContentDefinitionManager.AlterPartDefinition("AdminMenuPart", builder => builder.Attachable()); SchemaBuilder.CreateTable("ContentMenuItemPartRecord", table => table .ContentPartRecord() .Column <int>("ContentMenuItemRecord_id") ); ContentDefinitionManager.AlterTypeDefinition("ContentMenuItem", cfg => cfg .WithPart("MenuPart") .WithPart("CommonPart") .WithPart("IdentityPart") .WithPart("ContentMenuItemPart") .DisplayedAs("Content Menu Item") .WithSetting("Description", "Adds a Content Item to the menu.") .WithSetting("Stereotype", "MenuItem") ); return(3); }
public int Create() { // Create AttachToFolder table SchemaBuilder.CreateTable("AttachToFolderPartRecord", table => table .ContentPartRecord() .Column <int>("Folder_Id", c => c.Nullable())); ContentDefinitionManager.AlterPartDefinition("AttachToFolderPart", builder => builder.Attachable()); // Create Folder table SchemaBuilder.CreateTable("FolderPartRecord", table => table .ContentPartRecord() .Column <int>("Parent_Id", c => c.Nullable()) .Column <int>("Project_Id", c => c.Nullable()) .Column <string>("Title", c => c.Nullable().WithLength(100))); ContentDefinitionManager.AlterPartDefinition("FolderPart", builder => builder.Attachable()); ContentDefinitionManager.AlterPartDefinition("FollowerPart", builder => builder.Attachable()); ContentDefinitionManager.AlterPartDefinition("FolderListPart", builder => builder.Attachable()); ContentDefinitionManager.AlterPartDefinition("ProjectTitleAndMenuPart", builder => builder.Attachable()); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.FolderContentType, cfg => cfg .WithPart("CommonPart") .WithPart("FolderPart") .WithPart("IdentityPart") .WithPart("FolderListPart") .WithPart("AttachToProjectPart", c => c.WithSetting("AttachToProjectPartSettings.HiddenInEditMode", "true") .WithSetting("AttachToProjectPartSettings.HiddenInDisplayModel", "true")) .WithPart("ContentItemPermissionPart") .WithPart("ProjectItemPermissionsPart") .DisplayedAs("Folder") .Creatable(false)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectTicketsSummaryGroupByStatusContentType, cfg => cfg .WithPart("CommonPart") .WithPart("DataReportViewerPart") .WithPart("ContainablePart") .DisplayedAs(ContentTypes.ProjectTicketsSummaryGroupByStatusContentType) .Creatable(false)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectTicketsContentType, cfg => cfg .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("AttachToProjectPart") .WithPart("ProjectTitleAndMenuPart") .WithPart("ProjectionWithDynamicSortPart") .DisplayedAs(ContentTypes.ProjectTicketsContentType) .Creatable(false)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.DiscussionsSummaryContentType, cfg => cfg .WithPart("CommonPart") .WithPart("ProjectionWithDynamicSortPart") .WithPart("ContainablePart") .DisplayedAs(ContentTypes.DiscussionsSummaryContentType) .Creatable(false)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.TicketssSummaryContentType, cfg => cfg .WithPart("CommonPart") .WithPart("ProjectionWithDynamicSortPart") .WithPart("ContainablePart") .WithPart("TitlePart") .DisplayedAs(ContentTypes.TicketssSummaryContentType) .Creatable(false)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.EmptyContentType, cfg => cfg .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("AutoroutePart", builder => builder .WithSetting("AutorouteSettings.AllowCustomPattern", "True") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False") .WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-page\"}]")) .DisplayedAs(ContentTypes.EmptyContentType) .Creatable(false)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectLastActivityStreamContentType, cfg => cfg .WithPart("CommonPart") .WithPart("ActivityStreamPart", c => c.WithSetting("ActivityStreamPartSettings.PageSize", "5")) .WithPart("ContainablePart") .DisplayedAs(ContentTypes.ProjectTicketsSummaryGroupByStatusContentType) .Creatable(false)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.WikiItemType, cfg => cfg .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("BodyPart") .WithPart("FollowerPart") .WithPart("ProjectItemPermissionsPart") .WithPart("CRMCommentsPart") .WithPart("FolderListPart") .WithPart("IdentityPart") .WithPart("AttachToProjectPart", c => c.WithSetting("AttachToProjectPartSettings.HiddenInEditMode", "true")) .WithPart("AttachToFolderPart") .WithPart("ContentItemPermissionPart") .WithPart("FileUploadPart", c => c.WithSetting("FileUploadPartSettings.DisplayFileUploadInDisplayMode", "true") .WithSetting("FileUploadPartSettings.HideFileUploadInEditModel", "true") .WithSetting("FileUploadPartSettings.FileTypes", "zip,rar,jpg,jpeg,png,gif,doc,docx,xls,xlsx,ppt,pptx,pdf,txt,rtf,xps")) .WithSetting("TypeIndexing.Indexes", TicketController.SearchIndexName) .DisplayedAs("Wiki Item") .Creatable(false)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectDetailContentType, cfg => cfg .WithPart("CommonPart") .WithPart("AttachToProjectPart", c => c.WithSetting("AttachToProjectPartSettings.HiddenInEditMode", "true") .WithSetting("AttachToProjectPartSettings.HiddenInDisplayModel", "true")) .WithPart("ContainerPart") .DisplayedAs("Project Detail") .Creatable(false)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectActivityStreamType, cfg => cfg .WithPart("CommonPart") .WithPart("AttachToProjectPart", c => c.WithSetting("AttachToProjectPartSettings.HiddenInEditMode", "true") .WithSetting("AttachToProjectPartSettings.HiddenInDisplayModel", "true")) .WithPart("ActivityStreamPart") .WithPart("ProjectTitleAndMenuPart") .DisplayedAs("Project ActivityStream") .Creatable(false)); ContentDefinitionManager.AlterTypeDefinition("Ticket", cfg => cfg.WithPart("AttachToProjectPart")); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectListContentType, cfg => cfg .WithPart("CommonPart") .WithPart("ProjectListPart") .WithPart("MenuPart") .DisplayedAs("Project List") .Creatable(true)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectWikiContentType, cfg => cfg .WithPart("CommonPart") .WithPart("AttachToProjectPart") .WithPart("ProjectTitleAndMenuPart") .WithPart("FolderListPart") .WithPart("ActivityStreamPart") .DisplayedAs("Project Wiki") .Creatable(false)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.RootWikiContentType, cfg => cfg .WithPart("CommonPart") .WithPart("AttachToProjectPart") .WithPart("ProjectTitleAndMenuPart") .WithPart("RootFolderItemsPart") .WithPart("FolderListPart") .DisplayedAs("Root Wiki") .Creatable(false)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectContentType, cfg => cfg .WithPart("CommonPart") .WithPart("ProjectPart") .WithPart("ContentItemPermissionPart") .DisplayedAs("Project")); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.DiscussionContentType, cfg => cfg .WithPart("CommonPart", c => c.WithSetting("OwnerEditorSettings.ShowOwnerEditor", "false")) .WithPart("TitlePart") .WithPart("IdentityPart") .WithPart("BodyPart") .WithPart("FollowerPart") .WithPart("AttachToProjectPart", c => c.WithSetting("AttachToProjectPartSettings.HiddenInEditMode", "true") .WithSetting("AttachToProjectPartSettings.HiddenInDisplayModel", "true") .WithSetting("AttachToProjectPartSettings.IgnoreInActivityStream", "true")) .WithPart("ProjectTitleAndMenuPart") .WithPart("ContentItemPermissionPart") .WithPart("ProjectItemPermissionsPart") .WithPart("CRMCommentsPart") .WithPart("FileUploadPart", c => c.WithSetting("FileUploadPartSettings.DisplayFileUploadInDisplayMode", "true") .WithSetting("FileUploadPartSettings.FileTypes", "zip,rar,jpg,jpeg,png,gif,doc,docx,xls,xlsx,ppt,pptx,pdf,txt,rtf,xps") .WithSetting("FileUploadPartSettings.HideFileUploadInEditModel", "true")) .WithSetting("TypeIndexing.Indexes", TicketController.SearchIndexName) .DisplayedAs("Discussion")); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectDiscussionsContentType, cfg => cfg .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("ProjectTitleAndMenuPart") .WithPart("AttachToProjectPart") .WithPart("ProjectionWithDynamicSortPart") .DisplayedAs(ContentTypes.ProjectDiscussionsContentType) .Creatable(false)); // Add file field to user ContentDefinitionManager.AlterPartDefinition("User", cfg => cfg.WithField(FieldNames.UserThumbnailImageField, c => c.OfType("FileField") .WithDisplayName("Thumbnail Image") .WithSetting("FileFieldSettings.ExtenstionsAllowed", ".jpg, .jpeg, .bmp, .png, .tif") .WithSetting("FileFieldSettings.MaxFileSize", "1024")) .WithField(FieldNames.UserTelField, c => c.WithDisplayName("Tel").OfType("InputField")) .WithField(FieldNames.UserTags, c => c.WithDisplayName("Tags").OfType("InputField").WithSetting("InputFieldSettings.Hint", "Comma Seperated Tags")) .WithField(FieldNames.UserSkypeIdField, c => c.WithDisplayName("Skype Id").OfType("InputField")) .WithField(FieldNames.UserMobileField, c => c.WithDisplayName("Mobile:").OfType("InputField")) ); // FolderPartRecord index SchemaBuilder.AlterTable("FolderPartRecord", table => table.CreateIndex( "FolderPartRecord_MainIndex", new string[] { "Project_Id", "Parent_Id" })); // AttachToFolderPartRecord index SchemaBuilder.AlterTable("AttachToFolderPartRecord", table => table.CreateIndex( "AttachToFolderPartRecord_MainIndex", new string[] { "Folder_Id" })); var orchardProjectionModuleBuilder = new SchemaBuilder(this.dataMigrationInterpreter, "Orchard_Projections_"); this.projectSetup.Value.Setup(); this.UpdateFrom1(); this.CreateMilestoneAndProjectMenuTypes(); return(6); }
public void Uninstall() { ContentDefinitionManager.DeleteTypeDefinition("CustomForm"); }
public int UpdateFrom1() { ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectDashboardProjectionPortletContentType, cfg => cfg .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("ProjectionWithDynamicSortPart") .WithPart("ContainablePart") .DisplayedAs("Project-Dashboard Projection Protlet")); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectDashboardProjectionPortletTemplateContentType, cfg => cfg .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("ProjectionWithDynamicSortPart") .WithPart("ContainablePart") .DisplayedAs("Project-Dashboard Projection Protlet Template") .Creatable(true) .Listable(true)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectDashboardReportViewerPortletContentType, cfg => cfg .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("DataReportViewerPart") .WithPart("ContainablePart") .DisplayedAs("Project-Dashboard Summary Portlet") .Creatable(false)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectDashboardReportViewerPortletTemplateContentType, cfg => cfg .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("DataReportViewerPart") .WithPart("ContainablePart") .DisplayedAs("Project-Dashboard Summary Portlet Template") .Creatable(true) .Listable(true)); ContentDefinitionManager.AlterPartDefinition("ProjectDashboardEditorPart", builder => builder.Attachable()); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectContentType, cfg => cfg .WithPart("ProjectDashboardEditorPart")); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectLastActivityStreamContentType, cfg => cfg .WithPart("TitlePart")); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectLastActivityStreamTemplateContentType, cfg => cfg .WithPart("TitlePart") .WithPart("CommonPart") .WithPart("ActivityStreamPart", c => c.WithSetting("ActivityStreamPartSettings.PageSize", "5")) .WithPart("ContainablePart") .DisplayedAs(ContentTypes.ProjectLastActivityStreamTemplateContentType) .Creatable(false)); this.projectSetup.Value.Setup2(); return(3); }
public int Create() { SchemaBuilder.CreateTable("ProductRecord", table => table .ContentPartRecord() .Column <decimal>("UnitPrice") .Column <string>("Sku", column => column.WithLength(50)) .Column <int>("InStock") .Column <int>("NumberSold") .Column <bool>("CanReorder") .Column <int>("ReorderLevel") .Column <bool>("IsShippable", column => column.WithDefault(true)) ); ContentDefinitionManager.AlterPartDefinition("ProductPart", part => part .Attachable()); ContentDefinitionManager.AlterTypeDefinition("ShoppingCartWidget", type => type .WithPart("ShoppingCartWidgetPart") .WithPart("WidgetPart") .WithSetting("Stereotype", "Widget") .WithPart("CommonPart") ); SchemaBuilder.CreateTable("CustomerRecord", table => table .ContentPartRecord() .Column <string>("FirstName", c => c.WithLength(50)) .Column <string>("LastName", c => c.WithLength(50)) .Column <string>("Title", c => c.WithLength(10)) .Column <DateTime>("CreatedUtc") .Column <bool>("SubscribeToMailingList") .Column <bool>("AgreeTermsAndConditions") .Column <bool>("WelcomeEmailPending") .Column <bool>("ReceivePost") ); SchemaBuilder.CreateTable("AddressRecord", table => table .ContentPartRecord() .Column <int>("CustomerId") .Column <string>("Type", c => c.WithLength(50)) .Column <string>("Name") .Column <string>("Address") .Column <string>("City") .Column <string>("State") .Column <string>("Postcode") .Column <string>("CountryCode", c => c.WithLength(2)) ); ContentDefinitionManager.AlterPartDefinition("CustomerPart", part => part .Attachable(false) ); ContentDefinitionManager.AlterTypeDefinition("Customer", type => type .WithPart("CustomerPart") .WithPart("UserPart") .WithPart("UserRolesPart") ); ContentDefinitionManager.AlterPartDefinition("AddressPart", part => part .Attachable(false) ); ContentDefinitionManager.AlterTypeDefinition("Address", type => type .WithPart("CommonPart") .WithPart("AddressPart") ); SchemaBuilder.CreateTable("OrderRecord", t => t .ContentPartRecord() .Column <int>("CustomerId", c => c.NotNull()) .Column <DateTime>("CreatedAt", c => c.NotNull()) .Column <decimal>("SubTotal", c => c.NotNull()) .Column <decimal>("GST", c => c.NotNull()) .Column <string>("Status", c => c.WithLength(50).NotNull()) .Column <string>("PaymentServiceProviderResponse", c => c.WithLength(null)) .Column <string>("PaymentReference", c => c.WithLength(50)) .Column <DateTime>("PaidAt", c => c.Nullable()) .Column <DateTime>("CompletedAt", c => c.Nullable()) .Column <DateTime>("CancelledAt", c => c.Nullable()) .Column <decimal>("Total", c => c.Nullable()) .Column <string>("Number", c => c.Nullable()) ); SchemaBuilder.CreateTable("OrderDetailRecord", t => t .ContentPartRecord() .Column <int>("OrderRecord_Id", c => c.NotNull()) .Column <int>("ProductPartRecord_Id", c => c.NotNull()) .Column <int>("Quantity", c => c.NotNull()) .Column <decimal>("UnitPrice", c => c.NotNull()) .Column <decimal>("GSTRate", c => c.NotNull()) .Column <Decimal>("UnitGST", c => c.Nullable()) .Column <Decimal>("GST", c => c.Nullable()) .Column <Decimal>("SubTotal", c => c.Nullable()) .Column <Decimal>("Total", c => c.Nullable()) .Column <string>("Sku") .Column <string>("Description") ); SchemaBuilder.CreateTable("WebShopSettingsRecord", table => table .ContentPartRecord() .Column <string>("AdministratorEmailAddress") .Column <string>("ContinueShoppingUrl") .Column <bool>("ShowSubscribeToMailingList") .Column <bool>("ShowTermsAndConditions") .Column <bool>("SendWelcomeEmail") .Column <string>("TermsAndConditionsUrl") .Column <string>("PrivacyUrl") .Column <string>("WelcomeSubject") .Column <string>("WelcomeBodyTemplate", c => c.Unlimited()) .Column <string>("UnsubscribeEmail") .Column <bool>("UseMailChimp") .Column <string>("MailChimpApiKey") .Column <string>("MailChimpListName") .Column <string>("MailChimpGroupName") .Column <string>("MailChimpGroupValue") .Column <int>("ShippingProductRecord_id", column => column.Nullable()) ); SchemaBuilder.CreateTable("TransactionRecord", table => table .Column("Id", DbType.Int32, column => column.PrimaryKey().Identity()) .Column("OrderRecord_Id", DbType.Int32) .Column("Method", DbType.String) .Column("Token", DbType.String) .Column("Ack", DbType.String) .Column("PayerId", DbType.String) .Column("RequestTransactionId", DbType.String) .Column("RequestSecureMerchantAccountId", DbType.String) .Column("RequestAck", DbType.String) .Column("DateTime", DbType.DateTime) .Column("Timestamp", DbType.DateTime) .Column("ErrorCodes", DbType.String) .Column("ShortMessages", DbType.String) .Column("LongMessages", DbType.String) .Column("CorrelationId", DbType.String) ); SchemaBuilder.CreateTable("ShippingProductRecord", table => table .ContentPartRecord() .Column <string>("Title", c => c.WithLength((100))) .Column <string>("Description") ); ContentDefinitionManager.AlterPartDefinition("ShippingProductPart", part => part.Attachable()); ContentDefinitionManager.AlterTypeDefinition("ShippingProduct", type => type .WithPart("CommonPart") .WithPart("ProductPart") .WithPart("ShippingProductPart") .Creatable() ); return(1); }
private void CreateMilestoneAndProjectMenuTypes() { // MilestonePartRecord SchemaBuilder.CreateTable("MilestonePartRecord", table => table .ContentPartRecord() .Column <DateTime>("StartTime", c => c.Nullable()) .Column <DateTime>("EndTime", c => c.Nullable()) .Column <bool>("IsCurrent", c => c.Nullable()) .Column <bool>("IsClosed", c => c.Nullable()) .Column <bool>("IsBacklog", c => c.Nullable())); // AttachToMilestonePartRecord SchemaBuilder.CreateTable("AttachToMilestonePartRecord", table => table .ContentPartRecord() .Column <int>("MilestoneId", c => c.Nullable()) .Column <int>("Size", c => c.Nullable()) .Column <int>("OrderId", c => c.Nullable())); // AttachToMilestonePartRecord index SchemaBuilder.AlterTable("AttachToMilestonePartRecord", table => table.CreateIndex( "AttachToMilestonePartRecord_MainIndex", new string[] { "MilestoneId", "OrderId" })); // MilestonePart ContentDefinitionManager.AlterPartDefinition("MilestonePart", builder => builder.Attachable()); // AttachToMilestonePart ContentDefinitionManager.AlterPartDefinition("AttachToMilestonePart", builder => builder.Attachable()); // Attach Milestone to Ticket ContentDefinitionManager.AlterTypeDefinition(ContentTypes.TicketContentType, cfg => cfg.WithPart("AttachToMilestonePart")); // Milestone ContentDefinitionManager.AlterTypeDefinition(ContentTypes.MilestoneContentType, cfg => cfg .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("IdentityPart") .WithPart("ProjectTitleAndMenuPart") .WithPart("MilestonePart") .WithPart("ContentItemPermissionPart") .WithPart("ProjectItemPermissionsPart") .WithPart("AttachToProjectPart", c => c.WithSetting("AttachToProjectPartSettings.HiddenInEditMode", "true") .WithSetting("AttachToProjectPartSettings.HiddenInDisplayModel", "true")) .DisplayedAs("Milestone")); // Project Menu ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectMenuContentType, cfg => cfg .WithPart("CommonPart") .WithPart("IdentityPart") .WithPart("AttachToProjectPart") .WithPart("MenuWidgetPart")); // Specify the type of the items so that in the view we build a url for creation new items ContentDefinitionManager.AlterPartDefinition(ContentTypes.ProjectProjectionContentType, cfg => cfg.WithField( FieldNames.ProjectProjectionItemTypeFieldName, c => c.WithDisplayName("Item Type").OfType("InputField")) .WithField( FieldNames.ProjectProjectionItemTypeDisplayFieldName, c => c.WithDisplayName("Item Type Display Name").OfType("InputField"))); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectProjectionContentType, cfg => cfg .WithPart("CommonPart") .WithPart("TitlePart") .WithPart(ContentTypes.ProjectProjectionContentType) .WithPart("ProjectTitleAndMenuPart") .WithPart("AttachToProjectPart") .WithPart("ProjectionWithDynamicSortPart") .DisplayedAs(ContentTypes.ProjectProjectionContentType) .Creatable(true).Listable(true)); ContentDefinitionManager.AlterTypeDefinition(ContentTypes.ProjectActivityStreamType, cfg => cfg.WithPart("TitlePart")); }
public void Uninstall() { ContentDefinitionManager.DeleteTypeDefinition("BlogPostMenuItem"); ContentDefinitionManager.DeletePartDefinition("BlogPostMenuItemPart"); SchemaBuilder.DropTable("BlogPostMenuItemPartRecord"); }
public int Create() { ContentDefinitionManager.AlterTypeDefinition("ImageEditor", t => t.WithPart("ImageEditorPart")); return(1); }
public int UpdateFrom4() { ContentDefinitionManager.AlterTypeDefinition("User", cfg => cfg.DisplayedAs("用户")); return(5); }
public int UpdateFrom5() { ContentDefinitionManager.AlterTypeDefinition(Common.PipelineConfigurationName, cfg => cfg.WithPart("TagsPart")); return(6); }
public int UpdateFrom5() { ContentDefinitionManager.AlterTypeDefinition("CustomTemplate", type => type.Listable()); return(6); }
public int Create() { // Properties index SchemaBuilder.CreateTable("StringFieldIndexRecord", table => table .Column <int>("Id", c => c.PrimaryKey().Identity()) .Column <string>("PropertyName") .Column <string>("Value", c => c.WithLength(4000)) .Column <int>("FieldIndexPartRecord_Id") ); SchemaBuilder.CreateTable("IntegerFieldIndexRecord", table => table .Column <int>("Id", c => c.PrimaryKey().Identity()) .Column <string>("PropertyName") .Column <long>("Value") .Column <int>("FieldIndexPartRecord_Id") ); SchemaBuilder.CreateTable("DoubleFieldIndexRecord", table => table .Column <int>("Id", c => c.PrimaryKey().Identity()) .Column <string>("PropertyName") .Column <double>("Value") .Column <int>("FieldIndexPartRecord_Id") ); SchemaBuilder.CreateTable("DecimalFieldIndexRecord", table => table .Column <int>("Id", c => c.PrimaryKey().Identity()) .Column <string>("PropertyName") .Column <decimal>("Value") .Column <int>("FieldIndexPartRecord_Id") ); SchemaBuilder.CreateTable("FieldIndexPartRecord", table => table.ContentPartRecord()); // Query ContentDefinitionManager.AlterTypeDefinition("Query", cfg => cfg .WithPart("QueryPart") .WithPart("TitlePart") .WithPart("IdentityPart") ); SchemaBuilder.CreateTable("QueryPartRecord", table => table .ContentPartRecord() ); SchemaBuilder.CreateTable("FilterGroupRecord", table => table .Column <int>("Id", c => c.PrimaryKey().Identity()) .Column <int>("QueryPartRecord_id") ); SchemaBuilder.CreateTable("FilterRecord", table => table .Column <int>("Id", c => c.PrimaryKey().Identity()) .Column <string>("Category", c => c.WithLength(64)) .Column <string>("Type", c => c.WithLength(64)) .Column <string>("Description", c => c.WithLength(255)) .Column <string>("State", c => c.Unlimited()) .Column <int>("Position") .Column <int>("FilterGroupRecord_id") ); SchemaBuilder.CreateTable("SortCriterionRecord", table => table .Column <int>("Id", c => c.PrimaryKey().Identity()) .Column <string>("Category", c => c.WithLength(64)) .Column <string>("Type", c => c.WithLength(64)) .Column <string>("Description", c => c.WithLength(255)) .Column <string>("State", c => c.Unlimited()) .Column <int>("Position") .Column <int>("QueryPartRecord_id") ); SchemaBuilder.CreateTable("LayoutRecord", table => table .Column <int>("Id", c => c.PrimaryKey().Identity()) .Column <string>("Category", c => c.WithLength(64)) .Column <string>("Type", c => c.WithLength(64)) .Column <string>("Description", c => c.WithLength(255)) .Column <string>("State", c => c.Unlimited()) .Column <string>("DisplayType", c => c.WithLength(64)) .Column <int>("Display") .Column <int>("QueryPartRecord_id") .Column <int>("GroupProperty_id") ); SchemaBuilder.CreateTable("PropertyRecord", table => table .Column <int>("Id", c => c.PrimaryKey().Identity()) .Column <string>("Category", c => c.WithLength(64)) .Column <string>("Type", c => c.WithLength(64)) .Column <string>("Description", c => c.WithLength(255)) .Column <string>("State", c => c.Unlimited()) .Column <int>("Position") .Column <int>("LayoutRecord_id") .Column <bool>("ExcludeFromDisplay") .Column <bool>("CreateLabel") .Column <string>("Label", c => c.WithLength(255)) .Column <bool>("LinkToContent") .Column <bool>("CustomizePropertyHtml") .Column <string>("CustomPropertyTag", c => c.WithLength(64)) .Column <string>("CustomPropertyCss", c => c.WithLength(64)) .Column <bool>("CustomizeLabelHtml") .Column <string>("CustomLabelTag", c => c.WithLength(64)) .Column <string>("CustomLabelCss", c => c.WithLength(64)) .Column <bool>("CustomizeWrapperHtml") .Column <string>("CustomWrapperTag", c => c.WithLength(64)) .Column <string>("CustomWrapperCss", c => c.WithLength(64)) .Column <string>("NoResultText", c => c.Unlimited()) .Column <bool>("ZeroIsEmpty") .Column <bool>("HideEmpty") .Column <bool>("RewriteOutput") .Column <string>("RewriteText", c => c.Unlimited()) .Column <bool>("StripHtmlTags") .Column <bool>("TrimLength") .Column <bool>("AddEllipsis") .Column <int>("MaxLength") .Column <bool>("TrimOnWordBoundary") .Column <bool>("PreserveLines") .Column <bool>("TrimWhiteSpace") ); SchemaBuilder.CreateTable("ProjectionPartRecord", table => table .ContentPartRecord() .Column <int>("Items") .Column <int>("ItemsPerPage") .Column <int>("Skip") .Column <string>("PagerSuffix", c => c.WithLength(255)) .Column <int>("MaxItems") .Column <bool>("DisplayPager") .Column <int>("QueryPartRecord_id") .Column <int>("LayoutRecord_Id") ); SchemaBuilder.CreateTable("MemberBindingRecord", table => table .Column <int>("Id", c => c.PrimaryKey().Identity()) .Column <string>("Type", c => c.WithLength(255)) .Column <string>("Member", c => c.WithLength(64)) .Column <string>("Description", c => c.WithLength(500)) .Column <string>("DisplayName", c => c.WithLength(64)) ); ContentDefinitionManager.AlterTypeDefinition("ProjectionWidget", cfg => cfg .WithPart("WidgetPart") .WithPart("CommonPart") .WithPart("IdentityPart") .WithPart("ProjectionPart") .WithSetting("Stereotype", "Widget") ); ContentDefinitionManager.AlterTypeDefinition("ProjectionPage", cfg => cfg .WithPart("CommonPart") .WithPart("TitlePart") .WithPart("AutoroutePart", builder => builder .WithSetting("AutorouteSettings.AllowCustomPattern", "true") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "false") .WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Title', Pattern: '{Content.Slug}', Description: 'my-projections'}]") .WithSetting("AutorouteSettings.DefaultPatternIndex", "0")) .WithPart("MenuPart") .WithPart("ProjectionPart") .WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "5")) .Creatable() .DisplayedAs("Projection") ); // Default Model Bindings - CommonPartRecord _memberBindingRepository.Create(new MemberBindingRecord { Type = typeof(CommonPartRecord).FullName, Member = "CreatedUtc", DisplayName = T("Creation date").Text, Description = T("When the content item was created").Text }); _memberBindingRepository.Create(new MemberBindingRecord { Type = typeof(CommonPartRecord).FullName, Member = "ModifiedUtc", DisplayName = T("Modification date").Text, Description = T("When the content item was modified").Text }); _memberBindingRepository.Create(new MemberBindingRecord { Type = typeof(CommonPartRecord).FullName, Member = "PublishedUtc", DisplayName = T("Publication date").Text, Description = T("When the content item was published").Text }); // Default Model Bindings - TitlePartRecord _memberBindingRepository.Create(new MemberBindingRecord { Type = typeof(TitlePartRecord).FullName, Member = "Title", DisplayName = T("Title Part Title").Text, Description = T("The title assigned using the Title part").Text }); // Default Model Bindings - BodyPartRecord _memberBindingRepository.Create(new MemberBindingRecord { Type = typeof(BodyPartRecord).FullName, Member = "Text", DisplayName = T("Body Part Text").Text, Description = T("The text from the Body part").Text }); return(1); }
public int UpdateFrom7() { ContentDefinitionManager.AlterTypeDefinition("Template", type => type.Listable(false)); return(8); }
public int UpdateFrom1() { ContentDefinitionManager.AlterTypeDefinition("User", cfg => cfg.Creatable(false)); return(2); }
public int Create() { SchemaBuilder.CreateTable(nameof(PersonListPartRecord), table => table // Since PersonListPartRecord is a ContentPartRecord we have to use this method here. For // ContentPartVersionRecord we would simply use ContentPartVersionRecord() .ContentPartRecord() .Column <string>(nameof(PersonListPartRecord.Sex)) .Column <int>(nameof(PersonListPartRecord.MaxCount)) ); /* * We make PersonListPart attachable. This means from the admin UI you'll be able to attach this part to * any conent type. This step is not necessary to attach the part to types from migrations like we do it * from here. * Default is not attachable. */ ContentDefinitionManager.AlterPartDefinition(nameof(PersonListPart), builder => builder.Attachable()); /* * We create a new content type. Note that there's only an alter method: this will create the type if it * doesn't exist or modify it if it does. Make sure you understand what content types are: * http://docs.orchardproject.net/Documentation/Content-types * The content type's name is arbitrary, but choose a meaningful one. * Notice that we attach parts by specifying their name. For our own parts we use nameof(): this is * not mandatory but serves great if we change the part's name during development. (The same goes for record * name BTW.) */ ContentDefinitionManager.AlterTypeDefinition("PersonList", cfg => cfg // Setting display name for the type. BTW the default is the technical name separated on capital // letters, so the same here. .DisplayedAs("Person List") .WithPart(nameof(TitlePart)) // So the list can have a title; TitlePart is a core part // AutoroutePart so the list can have a friendly URL. That's why this feature depends on Orchard.Autoroute. .WithPart("AutoroutePart", builder => builder // These are TypePart settings: settings for a part on a specific type. I.e. AutoroutePart have // the following settings for PersonList. Take a look at AutoroutePart settings on the type // editor UI of PersonList to see what these mean. .WithSetting("AutorouteSettings.AllowCustomPattern", "true") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "false") // Specifying a custom URL-pattern for PersonList items .WithSetting("AutorouteSettings.PatternDefinitions", "[{Name:'Title', Pattern: 'person-lists/{Content.Slug}', Description: 'my-list'}]") .WithSetting("AutorouteSettings.DefaultPatternIndex", "0")) .WithPart(nameof(PersonListPart)) // CommonPart includes e.g. creation date and owner. Take a look at it (search with Ctrl+comma). Also // without it we can't list content types of this type on the admin UI (because the dates stored in // it are needed for ordering). .WithPart(nameof(CommonPart)) // This means users will be able to create such items from the admin UI. Default is the opposite. .Creatable() ); /* * With the same part we also create a widget. That's why this feature also depends on Orchard.Widgets! * Note that widgets should * - Have CommonPart attached * - Have WidgetPart attached * - Have the stereotype "Widget" */ ContentDefinitionManager.AlterTypeDefinition("PersonListWidget", cfg => cfg .WithPart(nameof(PersonListPart)) .WithPart("WidgetPart") .WithPart(nameof(CommonPart)) .WithSetting("Stereotype", "Widget") ); return(1); // Please don't read UpdateFrom1() yet. // You read it, didn't you? Stop spoiling. // NEXT STATION: Handlers/PersonListPartHandler }
public int Create() { ContentDefinitionManager.AlterPartDefinition("MenuPart", builder => builder .Attachable() .WithDescription("Provides an easy way to create a ContentMenuItem from the content editor.")); SchemaBuilder.CreateTable("MenuPartRecord", table => table .ContentPartRecord() .Column <string>("MenuText") .Column <string>("MenuPosition") .Column <int>("MenuId") ); ContentDefinitionManager.AlterTypeDefinition("MenuItem", cfg => cfg .WithPart("MenuPart") .WithIdentity() .WithPart("CommonPart") .DisplayedAs("Custom Link") .WithSetting("Description", "Represents a simple custom link with a text and an url.") .WithSetting("Stereotype", "MenuItem") // because we declare a new stereotype, the Shape MenuItem_Edit is needed ); ContentDefinitionManager.AlterTypeDefinition("Menu", cfg => cfg .WithPart("CommonPart", p => p.WithSetting("OwnerEditorSettings.ShowOwnerEditor", "false")) .WithPart("TitlePart") ); ContentDefinitionManager.AlterTypeDefinition("MenuWidget", cfg => cfg .WithPart("CommonPart") .WithIdentity() .WithPart("WidgetPart") .WithPart("MenuWidgetPart") .WithSetting("Stereotype", "Widget") ); SchemaBuilder.CreateTable("AdminMenuPartRecord", table => table .ContentPartRecord() .Column <string>("AdminMenuText") .Column <string>("AdminMenuPosition") .Column <bool>("OnAdminMenu") ); ContentDefinitionManager.AlterTypeDefinition("HtmlMenuItem", cfg => cfg .WithPart("MenuPart") .WithPart("BodyPart") .WithPart("CommonPart") .WithIdentity() .DisplayedAs("Html Menu Item") .WithSetting("Description", "Renders some custom HTML in the menu.") .WithSetting("BodyPartSettings.FlavorDefault", "html") .WithSetting("Stereotype", "MenuItem") ); ContentDefinitionManager.AlterPartDefinition("AdminMenuPart", builder => builder .Attachable() .WithDescription("Adds a menu item to the Admin menu that links to this content item.")); ContentDefinitionManager.AlterTypeDefinition("ShapeMenuItem", cfg => cfg .WithPart("ShapeMenuItemPart") .WithPart("MenuPart") .WithPart("CommonPart") .DisplayedAs("Shape Link") .WithSetting("Description", "Injects menu items from a Shape") .WithSetting("Stereotype", "MenuItem") ); return(4); }
public int Create() { SchemaBuilder.CreateTable("Submission", table => table .Column <int>("Id", c => c.PrimaryKey().Identity()) .Column <string>("FormName", c => c.WithLength(128)) .Column <string>("FormData", c => c.Unlimited()) .Column <DateTime>("CreatedUtc")); ContentDefinitionManager.AlterTypeDefinition("Form", type => type .WithPart("CommonPart", p => p .WithSetting("OwnerEditorSettings.ShowOwnerEditor", "false") .WithSetting("DateEditorSettings.ShowDateEditor", "false")) .WithPart("TitlePart") .WithPart("MenuPart") .WithPart("AutoroutePart", builder => builder .WithSetting("AutorouteSettings.AllowCustomPattern", "True") .WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", "False") .WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-form\"}]") .WithSetting("AutorouteSettings.DefaultPatternIndex", "0")) .WithPart("LayoutPart", p => p .WithSetting("LayoutTypePartSettings.DefaultLayoutData", "{" + " \"elements\":[" + " {" + " \"typeName\":\"Orchard.Layouts.Elements.Canvas\"," + " \"elements\":[" + " {" + " \"typeName\":\"Orchard.DynamicForms.Elements.Form\"," + " \"data\":\"TypeName=Orchard.DynamicForms.Elements.Form&FormName=Untitled&FormAction=&FormMethod=POST&EnableClientValidation=true&StoreSubmission=true&FormBindingContentType=&Publication=Draft&Notification=&RedirectUrl=\"," + " \"elements\":[" + " {" + " \"typeName\":\"Orchard.DynamicForms.Elements.Button\"," + " \"data\":\"TypeName=Orchard.DynamicForms.Elements.Button&InputName=&FormBindingContentType=&Text=Submit\"" + " }]" + " }]" + " }]" + "}")) .DisplayedAs("Form") .Listable() .Creatable() .Draftable()); ContentDefinitionManager.AlterTypeDefinition("FormWidget", type => type .WithPart("CommonPart", p => p .WithSetting("OwnerEditorSettings.ShowOwnerEditor", "false") .WithSetting("DateEditorSettings.ShowDateEditor", "false")) .WithPart("WidgetPart") .WithPart("LayoutPart", p => p .WithSetting("LayoutTypePartSettings.DefaultLayoutData", "{" + "\"elements\": [{" + "\"typeName\": \"Orchard.DynamicForms.Elements.Form\"," + "\"elements\": [{" + "\"typeName\": \"Orchard.DynamicForms.Elements.Button\"," + "\"state\": \"ButtonText=Submit\"" + "}]" + "}]" + "}")) .WithSetting("Stereotype", "Widget") .DisplayedAs("Form Widget")); return(1); }