public static ContentPage GetCurrentPage() { ContentPage pageContents = null; if (IsWebView) { using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) { if (SecurityData.AdvancedEditMode) { if (cmsHelper.cmsAdminContent == null) { pageContents = GetCurrentLivePage(); pageContents.LoadAttributes(); cmsHelper.cmsAdminContent = pageContents; } else { pageContents = cmsHelper.cmsAdminContent; } } else { pageContents = GetCurrentLivePage(); if (pageContents == null && (!SiteData.CurretSiteExists || DatabaseUpdate.AreCMSTablesIncomplete())) { pageContents = ContentPageHelper.GetEmptyHome(); } if (SecurityData.CurrentUserGuid != Guid.Empty) { cmsHelper.cmsAdminContent = null; } } } } else { pageContents = ContentPageHelper.GetSamplerView(); } return(pageContents); }
public static ContentPage GetCurrentPage() { ContentPage pageContents = null; if (IsWebView) { using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) { if (SecurityData.AdvancedEditMode) { if (cmsHelper.cmsAdminContent == null) { pageContents = GetCurrentLivePage(); pageContents.LoadAttributes(); cmsHelper.cmsAdminContent = pageContents; } else { pageContents = cmsHelper.cmsAdminContent; } } else { pageContents = GetCurrentLivePage(); if (SecurityData.CurrentUserGuid != Guid.Empty) { cmsHelper.cmsAdminContent = null; } } } } else { pageContents = ContentPageHelper.GetSamplerView(); } return(pageContents); }
private void SetVals(ContentPage cp, List<Widget> widgets) { CarrotCakeVersion = SiteData.CarrotCakeCMSVersion; ExportDate = DateTime.UtcNow; Guid siteID = cp.SiteID; NewRootContentID = Guid.NewGuid(); cp.LoadAttributes(); ThePage = cp; ThePageWidgets = widgets; if (ThePage == null) { ThePage = new ContentPage(); ThePage.Root_ContentID = Guid.NewGuid(); ThePage.ContentID = ThePage.Root_ContentID; } if (ThePageWidgets == null) { ThePageWidgets = new List<Widget>(); } OriginalRootContentID = ThePage.Root_ContentID; OriginalSiteID = ThePage.SiteID; OriginalParentContentID = Guid.Empty; ParentFileName = ""; if (ThePage.Parent_ContentID != null) { ContentPage parent = new ContentPage(); using (ContentPageHelper cph = new ContentPageHelper()) { parent = cph.FindContentByID(siteID, ThePage.Parent_ContentID.Value); } ParentFileName = parent.FileName; OriginalParentContentID = parent.Root_ContentID; } ThePage.Root_ContentID = NewRootContentID; ThePage.ContentID = NewRootContentID; foreach (var w in ThePageWidgets) { w.Root_ContentID = NewRootContentID; w.Root_WidgetID = Guid.NewGuid(); w.WidgetDataID = Guid.NewGuid(); } Guid userID1 = Guid.Empty; if (!cp.EditUserId.HasValue) { userID1 = cp.CreateUserId; } else { userID1 = cp.EditUserId.Value; } ExtendedUserData u1 = new ExtendedUserData(userID1); this.TheUser = new SiteExportUser(u1); Guid userID2 = Guid.Empty; if (cp.CreditUserId.HasValue) { userID2 = cp.CreditUserId.Value; } ExtendedUserData u2 = new ExtendedUserData(userID2); if (u2 != null) { this.CreditUser = new SiteExportUser(u2); } else { this.CreditUser = null; } }
private void SetVals(ContentPage cp, List <Widget> widgets) { CarrotCakeVersion = SiteData.CarrotCakeCMSVersion; ExportDate = DateTime.UtcNow; Guid siteID = cp.SiteID; NewRootContentID = Guid.NewGuid(); cp.LoadAttributes(); ThePage = cp; ThePageWidgets = widgets; if (ThePage == null) { ThePage = new ContentPage(); ThePage.Root_ContentID = Guid.NewGuid(); ThePage.ContentID = ThePage.Root_ContentID; } if (ThePageWidgets == null) { ThePageWidgets = new List <Widget>(); } OriginalRootContentID = ThePage.Root_ContentID; OriginalSiteID = ThePage.SiteID; OriginalParentContentID = Guid.Empty; ParentFileName = ""; if (ThePage.Parent_ContentID != null) { ContentPage parent = new ContentPage(); using (ContentPageHelper cph = new ContentPageHelper()) { parent = cph.FindContentByID(siteID, ThePage.Parent_ContentID.Value); } ParentFileName = parent.FileName; OriginalParentContentID = parent.Root_ContentID; } ThePage.Root_ContentID = NewRootContentID; ThePage.ContentID = NewRootContentID; foreach (var w in ThePageWidgets) { w.Root_ContentID = NewRootContentID; w.Root_WidgetID = Guid.NewGuid(); w.WidgetDataID = Guid.NewGuid(); } Guid userID1 = Guid.Empty; if (!cp.EditUserId.HasValue) { userID1 = cp.CreateUserId; } else { userID1 = cp.EditUserId.Value; } ExtendedUserData u1 = new ExtendedUserData(userID1); this.TheUser = new SiteExportUser(u1); Guid userID2 = Guid.Empty; if (cp.CreditUserId.HasValue) { userID2 = cp.CreditUserId.Value; } ExtendedUserData u2 = new ExtendedUserData(userID2); if (u2 != null) { this.CreditUser = new SiteExportUser(u2); } else { this.CreditUser = null; } }
//protected void Page_Load(object sender, EventArgs e) { protected void Page_Init(object sender, EventArgs e) { guidContentID = GetGuidIDFromQuery(); EditorPrefs = UserEditState.cmsUserEditState; if (EditorPrefs == null) { EditorPrefs = new UserEditState(); EditorPrefs.Init(); } string sCurrentPage = SiteData.CurrentScriptName; string sScrubbedURL = SiteData.AlternateCurrentScriptName; if (sScrubbedURL.ToLower() != sCurrentPage.ToLower()) { sCurrentPage = sScrubbedURL; } ContentPage pageContents = new ContentPage(); if (guidContentID == Guid.Empty) { pageContents = pageHelper.FindByFilename(SiteData.CurrentSiteID, sCurrentPage); } else { pageContents = pageHelper.FindContentByID(SiteData.CurrentSiteID, guidContentID); } PageType = pageContents.ContentType; EditedPageFileName = pageContents.FileName; btnEditCoreInfo.Attributes["onclick"] = "cmsShowEditPageInfo();"; if (pageContents.ContentType == ContentPageType.PageType.BlogEntry) { btnEditCoreInfo.Attributes["onclick"] = "cmsShowEditPostInfo();"; btnSortChildPages.Visible = false; } if (cmsHelper.cmsAdminContent != null) { EditedPageFileName = cmsHelper.cmsAdminContent.FileName; } if (cmsHelper.ToolboxPlugins.Any()) { GeneralUtilities.BindRepeater(rpTools, cmsHelper.ToolboxPlugins); } else { rpTools.Visible = false; } bLocked = pageHelper.IsPageLocked(pageContents.Root_ContentID, SiteData.CurrentSiteID, SecurityData.CurrentUserGuid); GeneralUtilities.BindList(ddlTemplate, cmsHelper.Templates); try { GeneralUtilities.SelectListValue(ddlTemplate, cmsHelper.cmsAdminContent.TemplateFile.ToLower()); } catch { } if (!bLocked) { foreach (Control c in plcIncludes.Controls) { this.Page.Header.Controls.Add(c); } //jquerybasic jquerybasic2 = new jquerybasic(); //jquerybasic2.SelectedSkin = jquerybasic.jQueryTheme.NotUsed; //Page.Header.Controls.AddAt(0, jquerybasic2); //BasicControlUtils.InsertjQuery(this.Page); BasicControlUtils.InsertjQueryMain(this.Page); BasicControlUtils.InsertjQueryUI(this.Page); guidContentID = pageContents.Root_ContentID; if (cmsHelper.cmsAdminContent == null) { pageContents.LoadAttributes(); cmsHelper.cmsAdminContent = pageContents; } else { pageContents = cmsHelper.cmsAdminContent; } bool bRet = pageHelper.RecordPageLock(pageContents.Root_ContentID, SiteData.CurrentSite.SiteID, SecurityData.CurrentUserGuid); cmsDivEditing.Visible = false; BasicControlUtils.MakeXUACompatibleFirst(this.Page); } else { pnlCMSEditZone.Visible = false; rpTools.Visible = false; btnToolboxSave1.Visible = false; btnToolboxSave2.Visible = false; btnToolboxSave3.Visible = false; btnTemplate.Visible = false; btnEditCoreInfo.Visible = false; cmsDivEditing.Visible = true; if (bLocked && pageContents.Heartbeat_UserId != null) { MembershipUser usr = SecurityData.GetUserByGuid(pageContents.Heartbeat_UserId.Value); EditUserName = usr.UserName; litUser.Text = "Read only mode. User '" + usr.UserName + "' is currently editing the page.<br />" + " Click <b><a href=\"" + pageContents.FileName + "\">here</a></b> to return to the browse view.<br />"; } } }