SavePageEdit() публичный Метод

public SavePageEdit ( ) : void
Результат void
Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            pageContents = new ContentPage(SiteID, ContentPageType.PageType.ContentEntry);

            DateTime dtSite = CMSConfigHelper.CalcNearestFiveMinTime(SiteData.CurrentSite.Now);

            int iOrder = pageHelper.GetMaxNavOrder(SiteID) + 1;
            Guid? parentContentID = ParentPagePicker.SelectedPage;

            pageContents.Parent_ContentID = parentContentID;

            pageContents.TitleBar = txtTitle.Text;
            pageContents.NavMenuText = txtNav.Text;
            pageContents.PageHead = txtHead.Text;
            pageContents.FileName = txtFileName.Text;

            pageContents.MetaDescription = txtDescription.Text;
            pageContents.MetaKeyword = txtKey.Text;

            pageContents.Heartbeat_UserId = SecurityData.CurrentUserGuid;
            pageContents.EditHeartbeat = dtSite.AddMinutes(5);

            pageContents.EditUserId = SecurityData.CurrentUserGuid;
            pageContents.IsLatestVersion = true;
            pageContents.EditDate = SiteData.CurrentSite.Now;
            pageContents.NavOrder = iOrder;
            pageContents.PageActive = false;
            pageContents.ShowInSiteMap = true;
            pageContents.ShowInSiteNav = true;
            pageContents.ContentType = ContentPageType.PageType.ContentEntry;

            pageContents.GoLiveDate = dtSite;
            pageContents.RetireDate = dtSite.AddYears(200);

            pageContents.SavePageEdit();

            pnlAdd.Visible = false;
            pnlSaved.Visible = true;

            litPageName.Text = pageContents.FileName;
            lnkNew.NavigateUrl = pageContents.FileName;

            if (pageContents.FileName.ToLowerInvariant().EndsWith(SiteData.DefaultDirectoryFilename)) {
                VirtualDirectory.RegisterRoutes(true);
            }

            Master.ShowSave();
        }
		private void CreateEmptyHome() {
			DateTime dtSite = CMSConfigHelper.CalcNearestFiveMinTime(SiteData.CurrentSite.Now);

			ContentPage pageContents = new ContentPage {
				SiteID = SiteID,
				Root_ContentID = Guid.NewGuid(),
				ContentID = Guid.NewGuid(),
				EditDate = SiteData.CurrentSite.Now,
				CreateUserId = SecurityData.CurrentUserGuid,
				CreateDate = SiteData.CurrentSite.Now,
				GoLiveDate = dtSite.AddMinutes(-5),
				RetireDate = dtSite.AddYears(200),
				TitleBar = "Home",
				NavMenuText = "Home",
				PageHead = "Home",
				FileName = "/home",
				PageText = SiteData.StarterHomePageSample,
				LeftPageText = String.Empty,
				RightPageText = String.Empty,
				NavOrder = 0,
				IsLatestVersion = true,
				PageActive = true,
				ShowInSiteNav = true,
				ShowInSiteMap = true,
				BlockIndex = false,
				EditUserId = SecurityData.CurrentUserGuid,
				ContentType = ContentPageType.PageType.ContentEntry,
				TemplateFile = SiteData.DefaultTemplateFilename
			};

			pageContents.SavePageEdit();
		}
Пример #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            SiteData site = siteHelper.GetCurrentSite();
            string sDatePatternOld = "yy-MM-dd";
            string sTimezoneOld = "ZZZ";

            if (site == null) {
                site = new SiteData();
                site.SiteID = SiteID;
            }

            if (site != null) {
                sDatePatternOld = site.Blog_DatePattern;
                sTimezoneOld = site.TimeZoneIdentifier;

                site.SiteName = txtSiteName.Text;
                site.SiteTagline = txtTagline.Text;
                site.SiteTitlebarPattern = txtTitleBar.Text;
                site.MainURL = txtURL.Text;
                site.MetaKeyword = txtKey.Text;
                site.MetaDescription = txtDescription.Text;
                site.BlockIndex = chkHide.Checked;
                site.SendTrackbacks = chkSendTrackback.Checked;
                site.AcceptTrackbacks = chkAcceptTrackbacks.Checked;

                site.TimeZoneIdentifier = ddlTimeZone.SelectedValue;

                site.Blog_FolderPath = txtFolderPath.Text;
                site.Blog_CategoryPath = txtCategoryPath.Text;
                site.Blog_DatePath = txtDatePath.Text;
                site.Blog_TagPath = txtTagPath.Text;
                site.Blog_EditorPath = txtEditorPath.Text;
                site.Blog_DatePattern = ddlDatePattern.SelectedValue;
                site.Blog_Root_ContentID = ParentPagePicker.SelectedPage;
            }

            site.Save();

            if (sDatePatternOld != ddlDatePattern.SelectedValue || sTimezoneOld != ddlTimeZone.SelectedValue) {
                using (ContentPageHelper cph = new ContentPageHelper()) {
                    cph.BulkBlogFileNameUpdateFromDate(SiteID);
                }
            }

            if (!bNewSite) {
                Response.Redirect(SiteData.CurrentScriptName);
            } else {
                DateTime dtSite = CalcNearestFiveMinTime(SiteData.CurrentSite.Now);

                if (chkHomepage.Checked) {
                    ContentPage pageContents = new ContentPage {
                        SiteID = SiteID,
                        Root_ContentID = Guid.NewGuid(),
                        ContentID = Guid.NewGuid(),
                        EditDate = SiteData.CurrentSite.Now,
                        CreateUserId = SecurityData.CurrentUserGuid,
                        CreateDate = SiteData.CurrentSite.Now,
                        GoLiveDate = dtSite.AddMinutes(-5),
                        RetireDate = dtSite.AddYears(200),
                        TitleBar = "Home",
                        NavMenuText = "Home",
                        PageHead = "Home",
                        FileName = "/home.aspx",
                        PageText = SiteData.StarterHomePageSample,
                        LeftPageText = String.Empty,
                        RightPageText = String.Empty,
                        NavOrder = 0,
                        IsLatestVersion = true,
                        PageActive = true,
                        ShowInSiteNav = true,
                        ShowInSiteMap = true,
                        BlockIndex = false,
                        EditUserId = SecurityData.CurrentUserGuid,
                        ContentType = ContentPageType.PageType.ContentEntry,
                        TemplateFile = SiteData.DefaultTemplateFilename
                    };

                    pageContents.SavePageEdit();
                }

                Response.Redirect(SiteFilename.DashboardURL);
            }
        }