protected void btn_DesignMode_Click(object sender, CommandEventArgs e) { if (e.CommandArgument != null) { string _pageindexid = e.CommandArgument.ToString(); PageEditorMgr myPageEditorMgr = new PageEditorMgr(); if (myPageEditorMgr.Chk_Page_Lock(_pageindexid)) { // Page is Locked Pages.Page_Lock myPage_Lock = myPageEditorMgr.Get_Page_Lock(_pageindexid); if (myPage_Lock.UserID == Security.Users.UserStatus.Current_UserID(this.Page)) { // For same user will recover his previous work e2Data[] UpdateData = { new e2Data("Page_LockID", myPage_Lock.Page_LockID), new e2Data("LockDate", DateTime.Now.ToString()) }; myPageEditorMgr.Edit_Page_Lock(UpdateData); Response.Redirect(string.Format("PageDesign.aspx?PageIndexID={0}&PageLink=Disable", _pageindexid)); return; } // Page is released over 10min with no actions if (DateTime.Now.Subtract(myPage_Lock.LockDate).TotalMinutes > 10) { //Tools.AlertMessage.Show_Alert(this.Page, string.Format("<h4>The desgin mode is locked at {0} by other user.<br/> now is realease to you.</h4>", myPage_Lock.LockDate.ToString()), "Page is locked!"); // Delete Locks myPageEditorMgr.Release_PageLock(_pageindexid); Load_DesignMode(); return; } Tools.AlertMessage.Show_Alert(this.Page, "<h4>The desgin mode is locked <br/> please try again later.</h4>", "Page is locked!"); } else { Load_DesignMode(); } } }
protected override void OnPreInit(EventArgs e) { //myPage_Loading_Info = new Nexus.Core.Pages.Page_Loading_Info(); // Check _pageindexid string _pageindexid = Request["PageIndexID"]; if (DataEval.IsEmptyQuery(_pageindexid)) { // URLrewrite _pageindexid = "1"; } // Check PageIxist PageEditorMgr myPageEditorMgr = new PageEditorMgr(); Page_Lock myPage_Lock = myPageEditorMgr.Get_Page_Lock(_pageindexid); // Check Properties // Check Security // Load Pages Template Nexus.Core.Pages.Page_PropertyMgr myPropertyMgr = new Nexus.Core.Pages.Page_PropertyMgr(); myPage_Loading_Info = myPropertyMgr.Get_Page_Lock_Loading_Info(_pageindexid); // Get MasterPageID //_master_pageindexid = myPage_Loading_Info.MasterPageIndexID; //this.StyleSheetTheme = myPage_Loading_Info.Theme; this.Theme = myPage_Loading_Info.Theme; this.MasterPageFile = myPage_Loading_Info.MasterPage_URL; this.Title = myPage_Loading_Info.Page_Title; base.OnPreInit(e); }
private void DesignerMode(string _pageindexid) { PageEditorMgr myPageEditorMgr = new PageEditorMgr(); if (myPageEditorMgr.Chk_Page_Lock(_pageindexid)) { // Page is Locked Pages.Page_Lock myPage_Lock = myPageEditorMgr.Get_Page_Lock(_pageindexid); if (myPage_Lock.UserID == Security.Users.UserStatus.Current_UserID(this.Page)) { // It's same user, check if he open same page PageMgr MyPageMgr = new PageMgr(); NexusCore_Page myPage = MyPageMgr.Get_Page_ActiveID(_pageindexid); if (myPage_Lock.PageID == myPage.PageID) { // For same user will recover his previous work e2Data[] UpdateData = { new e2Data("Page_LockID", myPage_Lock.Page_LockID), new e2Data("LockDate", DateTime.Now.ToString()) }; myPageEditorMgr.Edit_Page_Lock(UpdateData); Response.Redirect(string.Format("/App_AdminCP/SiteAdmin/PageDesign.aspx?PageIndexID={0}&PageLink=Disable", _pageindexid)); return; } else { // For same user but create new session page // Delete Locks myPageEditorMgr.Release_PageLock(_pageindexid); Load_DesignMode(_pageindexid); return; } } // Page is released over 10min with no actions if (DateTime.Now.Subtract(myPage_Lock.LockDate).TotalMinutes > 10) { //Tools.AlertMessage.Show_Alert(this.Page, string.Format("<h4>The desgin mode is locked at {0} by other user.<br/> now is realease to you.</h4>", myPage_Lock.LockDate.ToString()), "Page is locked!"); // Delete Locks myPageEditorMgr.Release_PageLock(_pageindexid); Load_DesignMode(_pageindexid); return; } //Tools.AlertMessage.Show_Alert(this.Page, "<h4>The desgin mode is locked <br/> please try again later.</h4>", "Page is locked!"); LockPage_Failed("Page is locked by other user, please try again later."); } else { Load_DesignMode(_pageindexid); } }