protected void Page_Load(object sender, System.EventArgs e) { JTree.DataBind(); // Put user code to initialize the page here if (!IsPostBack) { //Document Type copy Hack... string app = helper.Request("app"); if (app == "settings") { pane_form.Visible = false; pane_form_notice.Visible = false; pane_settings.Visible = true; ok.Text = ui.Text("general", "ok", this.getUser()); ok.Attributes.Add("style", "width: 60px"); cms.businesslogic.web.DocumentType dt = new umbraco.cms.businesslogic.web.DocumentType(int.Parse(helper.Request("id"))); //Load master types... masterType.Attributes.Add("style", "width: 350px;"); masterType.Items.Add(new ListItem(ui.Text("none") + "...", "0")); foreach (cms.businesslogic.web.DocumentType docT in cms.businesslogic.web.DocumentType.GetAllAsList()) { masterType.Items.Add(new ListItem(docT.Text, docT.Id.ToString())); } masterType.SelectedValue = dt.MasterContentType.ToString(); //hack to close window if not a doctype... if (dt == null) { Response.Write("<script type=\"text/javascript\">javascript:parent.window.close()</script>"); } else { rename.Text = dt.Text + " (copy)"; pane_settings.Text = "Make a copy of the document type '" + dt.Text + "' and save it under a new name"; } } else { pane_form.Visible = true; pane_form_notice.Visible = true; pane_settings.Visible = false; // Caption and properies on BUTTON ok.Text = ui.Text("general", "ok", this.getUser()); ok.Attributes.Add("style", "width: 60px"); ok.Attributes.Add("disabled", "true"); string currentPath = ""; CMSNode d = new CMSNode(int.Parse(helper.Request("id"))); foreach (string s in d.Path.Split(',')) { if (int.Parse(s) > 0) { currentPath += "/" + new CMSNode(int.Parse(s)).Text; } } // bool validAction = true; // only validate permissions in content if (app == "content" && d.HasChildren) { validAction = ValidAction(helper.Request("mode") == "cut" ? 'M' : 'O'); } if (helper.Request("mode") == "cut") { pane_form.Text = ui.Text("moveOrCopy", "moveTo", d.Text, base.getUser()); pp_relate.Visible = false; } else { pane_form.Text = ui.Text("moveOrCopy", "copyTo", d.Text, base.getUser()); pp_relate.Visible = true; } if (!validAction) { ScriptManager.RegisterStartupScript(this, this.GetType(), "notvalid", "notValid();", true); } } } }
//PPH Handle doctype copies.. private void HandleDocumentTypeCopy() { cms.businesslogic.web.DocumentType eDt = new umbraco.cms.businesslogic.web.DocumentType(int.Parse(helper.Request("id"))); //Documentype exists.. create new doc type... if (eDt != null) { string Alias = rename.Text; cms.businesslogic.web.DocumentType dt = cms.businesslogic.web.DocumentType.MakeNew(base.getUser(), Alias.Replace("'", "''")); dt.IconUrl = eDt.IconUrl; dt.Thumbnail = eDt.Thumbnail; dt.Description = eDt.Description; dt.allowedTemplates = eDt.allowedTemplates; dt.DefaultTemplate = eDt.DefaultTemplate; dt.AllowedChildContentTypeIDs = eDt.AllowedChildContentTypeIDs; dt.MasterContentType = int.Parse(masterType.SelectedValue); Hashtable oldNewTabIds = new Hashtable(); foreach (cms.businesslogic.web.DocumentType.TabI tab in eDt.getVirtualTabs.ToList()) { if (tab.ContentType == eDt.Id) { int tId = dt.AddVirtualTab(tab.Caption); oldNewTabIds.Add(tab.Id, tId); } } foreach (cms.businesslogic.propertytype.PropertyType pt in eDt.PropertyTypes) { if (pt.ContentTypeId == eDt.Id) { cms.businesslogic.propertytype.PropertyType nPt = umbraco.cms.businesslogic.propertytype.PropertyType.MakeNew(pt.DataTypeDefinition, dt, pt.Name, pt.Alias); nPt.ValidationRegExp = pt.ValidationRegExp; nPt.SortOrder = pt.SortOrder; nPt.Mandatory = pt.Mandatory; nPt.Description = pt.Description; if (pt.TabId > 0 && oldNewTabIds[pt.TabId] != null) { int newTabId = (int)oldNewTabIds[pt.TabId]; nPt.TabId = newTabId; } } } string returnUrl = SystemDirectories.Umbraco + "/settings/EditNodeTypeNew.aspx?id=" + dt.Id.ToString(); dt.Save(); pane_settings.Visible = false; panel_buttons.Visible = false; feedback.Text = "Document type copied"; feedback.type = umbraco.uicontrols.Feedback.feedbacktype.success; ClientTools.ChangeContentFrameUrl(returnUrl); } }
protected void Page_Load(object sender, System.EventArgs e) { JTree.DataBind(); // Put user code to initialize the page here if (!IsPostBack) { pp_relate.Text = ui.Text("moveOrCopy", "relateToOriginal"); //Document Type copy Hack... string app = helper.Request("app"); if (app == "settings") { pane_form.Visible = false; pane_form_notice.Visible = false; pane_settings.Visible = true; ok.Text = ui.Text("general", "ok", this.getUser()); ok.Attributes.Add("style", "width: 60px"); cms.businesslogic.web.DocumentType dt = new umbraco.cms.businesslogic.web.DocumentType(int.Parse(helper.Request("id"))); //Load master types... masterType.Attributes.Add("style", "width: 350px;"); masterType.Items.Add(new ListItem(ui.Text("none") + "...", "0")); foreach (cms.businesslogic.web.DocumentType docT in cms.businesslogic.web.DocumentType.GetAllAsList()) { masterType.Items.Add(new ListItem(docT.Text, docT.Id.ToString())); } masterType.SelectedValue = dt.MasterContentType.ToString(); //hack to close window if not a doctype... if (dt == null) { Response.Write("<script type=\"text/javascript\">javascript:parent.window.close()</script>"); } else { rename.Text = dt.Text + " (copy)"; pane_settings.Text = "Make a copy of the document type '" + dt.Text + "' and save it under a new name"; } } else { pane_form.Visible = true; pane_form_notice.Visible = true; pane_settings.Visible = false; // Caption and properies on BUTTON ok.Text = ui.Text("general", "ok", this.getUser()); ok.Attributes.Add("style", "width: 60px"); ok.Attributes.Add("disabled", "true"); string currentPath = ""; CMSNode d = new CMSNode(int.Parse(helper.Request("id"))); foreach (string s in d.Path.Split(',')) { if (int.Parse(s) > 0) currentPath += "/" + new CMSNode(int.Parse(s)).Text; } // bool validAction = true; // only validate permissions in content if (app == "content" && d.HasChildren) { validAction = ValidAction(helper.Request("mode") == "cut" ? 'M' : 'O'); } if (helper.Request("mode") == "cut") { pane_form.Text = ui.Text("moveOrCopy", "moveTo", d.Text, base.getUser()); pp_relate.Visible = false; } else { pane_form.Text = ui.Text("moveOrCopy", "copyTo", d.Text, base.getUser()); pp_relate.Visible = true; } if (!validAction) { ScriptManager.RegisterStartupScript(this, this.GetType(), "notvalid", "notValid();", true); } } } }
public bool InstallDemoShopContent() { var umbracoVersion = IO.Container.Resolve<IUmbracoVersion>(); var contentService = ApplicationContext.Current.Services.ContentService; var contentTypeService = ApplicationContext.Current.Services.ContentTypeService; var fileService = ApplicationContext.Current.Services.FileService; var stringDataTypeDef = umbracoVersion.GetDataTypeDefinition("Umbraco.Textbox", new Guid("0cc0eba1-9960-42c9-bf9b-60e150b429ae")); var richTextDataTypeDef = umbracoVersion.GetDataTypeDefinition("Umbraco.TinyMCEv3", new Guid("ca90c950-0aff-4e72-b976-a30b1ac57dad")); var storePickerDataTypeDef = umbracoVersion.GetDataTypeDefinition("uWebshop.StorePicker", new Guid("1e8cdc0b-436e-46f5-bfec-57be45745771")); var trueFalseDataTypeDef = umbracoVersion.GetDataTypeDefinition("Umbraco.TrueFalse", new Guid("92897bc6-a5f3-4ffe-ae27-f2e7e33dda49")); var homepageTemplate = fileService.GetTemplate("uwbsHomepage"); var basketTemplate = fileService.GetTemplate("uwbsBasket"); var chekoutCustomerTemplate = fileService.GetTemplate("uwbsCheckoutCustomer"); var chekoutOverviewTemplate = fileService.GetTemplate("uwbsCheckoutOverview"); var profileLoginCreateTemplate = fileService.GetTemplate("uwbsProfileLoginCreate"); var profileOrdersTemplate = fileService.GetTemplate("uwbsProfileOrders"); var profilePasswordForgottenTemplate = fileService.GetTemplate("uwbsProfilePasswordForgotten"); var profileProfileWishlistTemplate = fileService.GetTemplate("uwbsProfileWishlist"); var textpageTemplate = fileService.GetTemplate("uwbsTextpage"); var contentTypeList = new List<IContentType>(); #region icons var uwbsDemoMasterIcon = string.Format("icon-uwebshop-{0}", IconClass.uwebshoplogo); if (UmbracoVersion.Current.Major < 7) { uwbsDemoMasterIcon = "bank.png"; } var uwbsDemoHomePageIcon = "icon-home"; if (UmbracoVersion.Current.Major < 7) { uwbsDemoHomePageIcon = "bank.png"; } var uwbsDemoTextPageIcon = "icon-document"; if (UmbracoVersion.Current.Major < 7) { uwbsDemoTextPageIcon = ".sprTreeDoc"; } var uwbsDemoBasketPageIcon = string.Format("icon-uwebshop-{0}", IconClass.shoppingcart); if (UmbracoVersion.Current.Major < 7) { uwbsDemoBasketPageIcon = "wallet.png"; } var uwbsDemoCheckoutCustomerPageIcon = "icon-users"; if (UmbracoVersion.Current.Major < 7) { uwbsDemoCheckoutCustomerPageIcon = ".sprTreeUser"; } var uwbsDemoCheckoutPageIcon = string.Format("icon-uwebshop-{0}", IconClass.shoppingcart); if (UmbracoVersion.Current.Major < 7) { uwbsDemoCheckoutPageIcon = "credit-card.png"; } var uwbsDemoProfilePageIcon = string.Format("icon-uwebshop-{0}", IconClass.shoppingcart); if (UmbracoVersion.Current.Major < 7) { uwbsDemoProfilePageIcon = ".sprTreeUser"; } var uwbsDemoProfileOrdersIcon = string.Format("icon-uwebshop-{0}", IconClass.dollar); if (UmbracoVersion.Current.Major < 7) { uwbsDemoProfileOrdersIcon = "clipboard-invoice.png"; } var uwbsDemoProfileForgottenIcon = "icon-bell"; if (UmbracoVersion.Current.Major < 7) { uwbsDemoProfileForgottenIcon = ".sprTreeUser"; } var uwbsDemoProfileWishlistIcon = string.Format("icon-uwebshop-{0}", IconClass.clipboard); if (UmbracoVersion.Current.Major < 7) { uwbsDemoProfileWishlistIcon = "clipboard-invoice.png"; } #endregion // create master var uwbsDemoMaster = contentTypeService.GetContentType("uwbsDemoMaster") ?? new ContentType(-1) { Alias = "uwbsDemoMaster", Name = "uWebshop Demosite Master", Description = "#DemositeMasterDescription", Thumbnail = "Folder.png", Icon = uwbsDemoMasterIcon, SortOrder = 1, AllowedContentTypes = new List<ContentTypeSort>(), AllowedTemplates = new List<ITemplate>(), PropertyGroups = new PropertyGroupCollection(new List<PropertyGroup>()), }; contentTypeList.Add(uwbsDemoMaster); if (uwbsDemoMaster.PropertyTypes.All(p => p.Alias != "bodyText")) { GetOrAddPropertyGroup(uwbsDemoMaster, "Content").PropertyTypes.Add(new PropertyType(richTextDataTypeDef) { Alias = "bodyText", Name = "#BodyText", Description = "#BodyTextDescription", }); } if (uwbsDemoMaster.PropertyTypes.All(p => p.Alias != "umbracoNaviHide")) { GetOrAddPropertyGroup(uwbsDemoMaster, "Content").PropertyTypes.Add(new PropertyType(trueFalseDataTypeDef) { Alias = "umbracoNaviHide", Name = "#NaviHide", Description = "#NaviHideDescription", }); } var uwbsDemoHomePage = contentTypeService.GetContentType("uwbsDemoHome") ?? new ContentType(-1) { Alias = "uwbsDemoHome", Name = "uWebshop Demosite Home", Description = "#DemositeHomeDescription", Thumbnail = "Folder.png", Icon = uwbsDemoHomePageIcon, SortOrder = 1, AllowedContentTypes = new List<ContentTypeSort>(), AllowedTemplates = new List<ITemplate>() { homepageTemplate }, PropertyGroups = new PropertyGroupCollection(new List<PropertyGroup>()), }; contentTypeList.Add(uwbsDemoHomePage); if (uwbsDemoHomePage.PropertyTypes.All(p => p.Alias != "siteName")) { GetOrAddPropertyGroup(uwbsDemoHomePage, "Site").PropertyTypes.Add(new PropertyType(stringDataTypeDef) { Alias = "siteName", Name = "#SiteName", Description = "#SiteNameDescription", }); } if (uwbsDemoHomePage.PropertyTypes.All(p => p.Alias != "siteDescription")) { GetOrAddPropertyGroup(uwbsDemoHomePage, "Site").PropertyTypes.Add(new PropertyType(stringDataTypeDef) { Alias = "siteDescription", Name = "#SiteDescription", Description = "#SiteDescriptionDescription", }); } if (uwbsDemoHomePage.PropertyTypes.All(p => p.Alias != "uwbsStorePicker")) { GetOrAddPropertyGroup(uwbsDemoHomePage, "Site").PropertyTypes.Add(new PropertyType(storePickerDataTypeDef) { Alias = "uwbsStorePicker", Name = "#StorePicker", Description = "#StorePickerDescription", }); } var uwbsTextPage = contentTypeService.GetContentType("uwbsTextpage") ?? new ContentType(-1) { Alias = "uwbsTextpage", Name = "uWebshop Demosite Textpage", Description = "#DemositeTextpageDescription", Thumbnail = "Folder.png", Icon = uwbsDemoTextPageIcon, SortOrder = 1, AllowedContentTypes = new List<ContentTypeSort>(), AllowedTemplates = new List<ITemplate>(){ textpageTemplate }, PropertyGroups = new PropertyGroupCollection(new List<PropertyGroup>()), }; contentTypeList.Add(uwbsTextPage); var uwbsBasketPage = contentTypeService.GetContentType("uwbsBasket") ?? new ContentType(-1) { Alias = "uwbsBasket", Name = "uWebshop Demosite Basket", Description = "#DemositeBasketPageDescription", Thumbnail = "Folder.png", Icon = uwbsDemoBasketPageIcon, SortOrder = 1, AllowedContentTypes = new List<ContentTypeSort>(), AllowedTemplates = new List<ITemplate>() { basketTemplate }, PropertyGroups = new PropertyGroupCollection(new List<PropertyGroup>()), }; contentTypeList.Add(uwbsBasketPage); var uwbsCheckoutPage = contentTypeService.GetContentType("uwbsCheckout") ?? new ContentType(-1) { Alias = "uwbsCheckout", Name = "uWebshop Demosite Checkout", Description = "#DemositeCheckoutPageDescription", Thumbnail = "Folder.png", Icon = uwbsDemoCheckoutPageIcon, SortOrder = 1, AllowedContentTypes = new List<ContentTypeSort>(), AllowedTemplates = new List<ITemplate>() { chekoutOverviewTemplate }, PropertyGroups = new PropertyGroupCollection(new List<PropertyGroup>()), }; contentTypeList.Add(uwbsCheckoutPage); var uwbsCustomerCheckoutPage = contentTypeService.GetContentType("uwbsCustomerCheckout") ?? new ContentType(-1) { Alias = "uwbsCustomerCheckout", Name = "uWebshop Demosite Customer Checkout", Description = "#DemositeCustomerCheckoutPageDescription", Thumbnail = "Folder.png", Icon = uwbsDemoCheckoutCustomerPageIcon, SortOrder = 1, AllowedContentTypes = new List<ContentTypeSort>(), AllowedTemplates = new List<ITemplate>() { chekoutCustomerTemplate }, PropertyGroups = new PropertyGroupCollection(new List<PropertyGroup>()), }; contentTypeList.Add(uwbsCustomerCheckoutPage); var uwbsProfile = contentTypeService.GetContentType("uwbsProfile") ?? new ContentType(-1) { Alias = "uwbsProfile", Name = "uWebshop Demosite Profile", Description = "#DemositeProfilePageDescription", Thumbnail = "Folder.png", Icon = uwbsDemoProfilePageIcon, SortOrder = 1, AllowedContentTypes = new List<ContentTypeSort>(), AllowedTemplates = new List<ITemplate>() { profileLoginCreateTemplate }, PropertyGroups = new PropertyGroupCollection(new List<PropertyGroup>()), }; contentTypeList.Add(uwbsProfile); var uwbsProfileOrders = contentTypeService.GetContentType("uwbsProfileOrders") ?? new ContentType(-1) { Alias = "uwbsProfileOrders", Name = "uWebshop Demosite Profile Orders", Description = "#DemositeProfileOrdersPageDescription", Thumbnail = "Folder.png", Icon = uwbsDemoProfileOrdersIcon, SortOrder = 1, AllowedContentTypes = new List<ContentTypeSort>(), AllowedTemplates = new List<ITemplate>() { profileOrdersTemplate }, PropertyGroups = new PropertyGroupCollection(new List<PropertyGroup>()), }; contentTypeList.Add(uwbsProfileOrders); var uwbsProfilePasswordForgotten = contentTypeService.GetContentType("uwbsProfilePasswordForgotten") ?? new ContentType(-1) { Alias = "uwbsProfilePasswordForgotten", Name = "uWebshop Demosite Password Forgotten", Description = "#DemositePasswordForgottenPageDescription", Thumbnail = "Folder.png", Icon = uwbsDemoProfileForgottenIcon, SortOrder = 1, AllowedContentTypes = new List<ContentTypeSort>(), AllowedTemplates = new List<ITemplate>() { profilePasswordForgottenTemplate }, PropertyGroups = new PropertyGroupCollection(new List<PropertyGroup>()), }; contentTypeList.Add(uwbsProfilePasswordForgotten); var uwbsProfileWishlist = contentTypeService.GetContentType("uwbsProfileWishlist") ?? new ContentType(-1) { Alias = "uwbsProfileWishlist", Name = "uWebshop Demosite Profile Wishlist", Description = "#DemositeOrdersWishlistPageDescription", Thumbnail = "Folder.png", Icon = uwbsDemoProfileWishlistIcon, SortOrder = 1, AllowedContentTypes = new List<ContentTypeSort>(), AllowedTemplates = new List<ITemplate>() { profileProfileWishlistTemplate }, PropertyGroups = new PropertyGroupCollection(new List<PropertyGroup>()), }; contentTypeList.Add(uwbsProfileWishlist); contentTypeService.Save(contentTypeList); uwbsDemoHomePage.SetLazyParentId(new Lazy<int>(() => uwbsDemoMaster.Id)); uwbsTextPage.SetLazyParentId(new Lazy<int>(() => uwbsDemoMaster.Id)); uwbsBasketPage.SetLazyParentId(new Lazy<int>(() => uwbsTextPage.Id)); uwbsCheckoutPage.SetLazyParentId(new Lazy<int>(() => uwbsTextPage.Id)); uwbsCustomerCheckoutPage.SetLazyParentId(new Lazy<int>(() => uwbsTextPage.Id)); uwbsProfile.SetLazyParentId(new Lazy<int>(() => uwbsTextPage.Id)); uwbsProfileOrders.SetLazyParentId(new Lazy<int>(() => uwbsTextPage.Id)); uwbsProfilePasswordForgotten.SetLazyParentId(new Lazy<int>(() => uwbsTextPage.Id)); uwbsProfileWishlist.SetLazyParentId(new Lazy<int>(() => uwbsTextPage.Id)); contentTypeService.Save(contentTypeList); uwbsDemoHomePage.AddContentType(uwbsDemoMaster); uwbsTextPage.AddContentType(uwbsDemoMaster); uwbsBasketPage.AddContentType(uwbsDemoMaster); uwbsCheckoutPage.AddContentType(uwbsDemoMaster); uwbsCustomerCheckoutPage.AddContentType(uwbsDemoMaster); uwbsProfile.AddContentType(uwbsDemoMaster); uwbsProfileOrders.AddContentType(uwbsDemoMaster); uwbsProfilePasswordForgotten.AddContentType(uwbsDemoMaster); uwbsProfileWishlist.AddContentType(uwbsDemoMaster); contentTypeService.Save(contentTypeList); uwbsDemoHomePage.AllowedContentTypes = new List<ContentTypeSort> { new ContentTypeSort { Alias = uwbsBasketPage.Alias, Id = new Lazy<int>(() => uwbsBasketPage.Id) }, new ContentTypeSort { Alias = uwbsCheckoutPage.Alias, Id = new Lazy<int>(() => uwbsCheckoutPage.Id) }, new ContentTypeSort { Alias = uwbsProfile.Alias, Id = new Lazy<int>(() => uwbsProfile.Id) }, new ContentTypeSort { Alias = uwbsTextPage.Alias, Id = new Lazy<int>(() => uwbsTextPage.Id) }, }; uwbsTextPage.AllowedContentTypes = new List<ContentTypeSort> { new ContentTypeSort { Alias = uwbsBasketPage.Alias, Id = new Lazy<int>(() => uwbsBasketPage.Id) }, new ContentTypeSort { Alias = uwbsCheckoutPage.Alias, Id = new Lazy<int>(() => uwbsCheckoutPage.Id) }, new ContentTypeSort { Alias = uwbsProfile.Alias, Id = new Lazy<int>(() => uwbsProfile.Id) }, new ContentTypeSort { Alias = uwbsTextPage.Alias, Id = new Lazy<int>(() => uwbsTextPage.Id) }, }; uwbsBasketPage.AllowedContentTypes = new List<ContentTypeSort> { new ContentTypeSort { Alias = uwbsCustomerCheckoutPage.Alias, Id = new Lazy<int>(() => uwbsCustomerCheckoutPage.Id) }, new ContentTypeSort { Alias = uwbsTextPage.Alias, Id = new Lazy<int>(() => uwbsTextPage.Id) }, }; uwbsCustomerCheckoutPage.AllowedContentTypes = new List<ContentTypeSort> { new ContentTypeSort { Alias = uwbsCheckoutPage.Alias, Id = new Lazy<int>(() => uwbsCheckoutPage.Id) }, new ContentTypeSort { Alias = uwbsTextPage.Alias, Id = new Lazy<int>(() => uwbsTextPage.Id) }, }; uwbsCheckoutPage.AllowedContentTypes = new List<ContentTypeSort> { new ContentTypeSort { Alias = uwbsTextPage.Alias, Id = new Lazy<int>(() => uwbsTextPage.Id) }, }; uwbsProfile.AllowedContentTypes = new List<ContentTypeSort> { new ContentTypeSort { Alias = uwbsProfilePasswordForgotten.Alias, Id = new Lazy<int>(() => uwbsProfilePasswordForgotten.Id) }, new ContentTypeSort { Alias = uwbsProfileOrders.Alias, Id = new Lazy<int>(() => uwbsProfileOrders.Id) }, new ContentTypeSort { Alias = uwbsProfileWishlist.Alias, Id = new Lazy<int>(() => uwbsProfileWishlist.Id) }, new ContentTypeSort { Alias = uwbsTextPage.Alias, Id = new Lazy<int>(() => uwbsTextPage.Id) }, }; uwbsProfileOrders.AllowedContentTypes = new List<ContentTypeSort> { new ContentTypeSort { Alias = uwbsTextPage.Alias, Id = new Lazy<int>(() => uwbsTextPage.Id) }, }; uwbsProfileWishlist.AllowedContentTypes = new List<ContentTypeSort> { new ContentTypeSort { Alias = uwbsTextPage.Alias, Id = new Lazy<int>(() => uwbsTextPage.Id) }, }; uwbsProfilePasswordForgotten.AllowedContentTypes = new List<ContentTypeSort> { new ContentTypeSort { Alias = uwbsTextPage.Alias, Id = new Lazy<int>(() => uwbsTextPage.Id) }, }; contentTypeService.Save(contentTypeList); #region bah vies oude API stuff umbraco.cms.businesslogic.web.DocumentType ctuwbsDemoHomePage = new umbraco.cms.businesslogic.web.DocumentType(uwbsDemoHomePage.Id); ctuwbsDemoHomePage.MasterContentType = uwbsDemoMaster.Id; ctuwbsDemoHomePage.Save(); #endregion var contentList = new List<IContent>(); var homePage = ContentInstaller.GetOrCreateContent(uwbsDemoHomePage, "Home", contentTypeService, contentService, null, contentList); if (homePage.PropertyTypes.Any(x => x.Alias == "siteName")) { homePage.SetValue("siteName", "uWebshop Demoshop"); } if (homePage.PropertyTypes.Any(x => x.Alias == "siteDescription")) { homePage.SetValue("siteDescription", "uWebshop Demo Starterstore"); } if (homePage.PropertyTypes.Any(x => x.Alias == "bodyText")) { homePage.SetValue("bodyText", @"<p>The uWebshop Demoshop you ready-to-start uWebshop store that introduces you to a set of well-defined conventions for building an uWebshop based webshop!</p> <p>uWebshop can be easily integrated with any existing website or starterkit already available for Umbraco. In a few easy steps explained during installation you will have a fully working webshop without having to learn anything new or make big changes to your current site!</p> <p>If you see some errors try to publish the uWebshop Node and all children.</p>"); } var basketPage = ContentInstaller.GetOrCreateContent(uwbsBasketPage, "Basket", contentTypeService, contentService, homePage, contentList); var customerDetailsPage = ContentInstaller.GetOrCreateContent(uwbsCustomerCheckoutPage, "Customer Details", contentTypeService, contentService, basketPage, contentList); var checkoutPage = ContentInstaller.GetOrCreateContent(uwbsCheckoutPage, "Checkout", contentTypeService, contentService, customerDetailsPage, contentList); var successPage = ContentInstaller.GetOrCreateContent(uwbsTextPage, "Success", contentTypeService, contentService, checkoutPage, contentList); if (successPage.PropertyTypes.Any(x => x.Alias == "bodyText")) { successPage.SetValue("bodyText", "<p>Successfully placed the order!</p>"); } var errorPage = ContentInstaller.GetOrCreateContent(uwbsTextPage, "Failed", contentTypeService, contentService, checkoutPage, contentList); if (errorPage.PropertyTypes.Any(x => x.Alias == "bodyText")) { errorPage.SetValue("bodyText", "<p>Failed to confirm the order :(</p>"); } var profilePage = ContentInstaller.GetOrCreateContent(uwbsProfile, "Profile", contentTypeService, contentService, homePage, contentList); var passwordForgottenPage = ContentInstaller.GetOrCreateContent(uwbsProfilePasswordForgotten, "Password Forgotten", contentTypeService, contentService, profilePage, contentList); if (passwordForgottenPage.PropertyTypes.Any(x => x.Alias == "bodyText")) { passwordForgottenPage.SetValue("bodyText", "<p>If you forgot your password you can request a new one to be send to the e-mailaddres in your account, using the form below.</p>"); } var wishlistsPage = ContentInstaller.GetOrCreateContent(uwbsProfileWishlist, "Wishlists", contentTypeService, contentService, profilePage, contentList); var ordersPage = ContentInstaller.GetOrCreateContent(uwbsProfileOrders, "Orders", contentTypeService, contentService, profilePage, contentList); var logoutPage = ContentInstaller.GetOrCreateContent(uwbsTextPage, "Logout", contentTypeService, contentService, profilePage, contentList); if (logoutPage.PropertyTypes.Any(x => x.Alias == "bodyText")) { logoutPage.SetValue("bodyText", "<p>You are now logged-out.</p>"); } contentService.Save(contentList); contentService.PublishWithChildren(homePage); return true; }
//PPH Handle doctype copies.. private void HandleDocumentTypeCopy() { cms.businesslogic.web.DocumentType eDt = new umbraco.cms.businesslogic.web.DocumentType(int.Parse(helper.Request("id"))); //Documentype exists.. create new doc type... if (eDt != null) { string Alias = rename.Text; cms.businesslogic.web.DocumentType dt = cms.businesslogic.web.DocumentType.MakeNew(base.getUser(), Alias.Replace("'", "''")); dt.IconUrl = eDt.IconUrl; dt.Thumbnail = eDt.Thumbnail; dt.Description = eDt.Description; dt.allowedTemplates = eDt.allowedTemplates; dt.DefaultTemplate = eDt.DefaultTemplate; dt.AllowedChildContentTypeIDs = eDt.AllowedChildContentTypeIDs; dt.MasterContentType = int.Parse(masterType.SelectedValue); Hashtable oldNewTabIds = new Hashtable(); foreach (cms.businesslogic.web.DocumentType.TabI tab in eDt.getVirtualTabs.ToList()) { if (tab.ContentType == eDt.Id) { int tId = dt.AddVirtualTab(tab.Caption); oldNewTabIds.Add(tab.Id, tId); } } foreach (cms.businesslogic.propertytype.PropertyType pt in eDt.PropertyTypes) { if (pt.ContentTypeId == eDt.Id) { cms.businesslogic.propertytype.PropertyType nPt = umbraco.cms.businesslogic.propertytype.PropertyType.MakeNew(pt.DataTypeDefinition, dt, pt.Name, pt.Alias); nPt.ValidationRegExp = pt.ValidationRegExp; nPt.SortOrder = pt.SortOrder; nPt.Mandatory = pt.Mandatory; nPt.Description = pt.Description; if (pt.TabId > 0 && oldNewTabIds[pt.TabId] != null) { int newTabId = (int)oldNewTabIds[pt.TabId]; nPt.TabId = newTabId; } } } string returnUrl = SystemDirectories.Umbraco + "/settings/editNodeTypeNew.aspx?id=" + dt.Id.ToString(); dt.Save(); pane_settings.Visible = false; panel_buttons.Visible = false; feedback.Text = "Document type copied"; feedback.type = umbraco.uicontrols.Feedback.feedbacktype.success; ClientTools.ChangeContentFrameUrl(returnUrl); } }