public Menu_Nodes(DataRow myDR) { // //TODO: 在此处添加构造函数逻辑 // if (myDR != null) { _pageindexid = myDR["PageIndexID"].ToString(); _page_categoryid = myDR["Page_CategoryID"].ToString(); _menu_title = myDR["Menu_Title"].ToString(); _page_name = myDR["Page_Name"].ToString(); _page_type = (Page_Type)StringEnum.Parse(typeof(Page_Type), myDR["Page_Type"].ToString(), true); _sortorder = myDR["SortOrder"].ToString(); _childrencount = Convert.ToInt32(myDR["ChildrenCount"]); switch (_page_type) { case Page_Type.Normal_Page: _iconurl = "/App_Control_Style/NexusCore/Menu_TreeView/Icons/pages.png"; break; case Page_Type.Category: _iconurl = "/App_Control_Style/NexusCore/Menu_TreeView/Icons/category.gif"; break; case Page_Type.Internal_Page_Pointer: _iconurl = "/App_Control_Style/NexusCore/Menu_TreeView/Icons/intlink.gif"; break; case Page_Type.External_Link: _iconurl = "/App_Control_Style/NexusCore/Menu_TreeView/Icons/extlink.gif"; break; default: _iconurl = "/App_Control_Style/NexusCore/Menu_TreeView/Icons/pages.png"; break; } PageEditorMgr myPageEditorMgr = new PageEditorMgr(); if (myPageEditorMgr.Chk_Page_Lock(_pageindexid)) { _iconurl = "/App_Control_Style/NexusCore/Menu_TreeView/Icons/page_lock.gif"; } else { string _homepageid = Phrases.PhraseMgr.Get_Phrase_Value("NexusCore_HomepageID"); if (_pageindexid == _homepageid) { _iconurl = "/App_Control_Style/NexusCore/Menu_TreeView/Icons/home.gif"; } if (_page_categoryid == "2") { _iconurl = "/App_Control_Style/NexusCore/Menu_TreeView/Icons/inactive_pages.gif"; } } } }
private void Load_DesignMode() { // Set PageLock Pages.PageEditorMgr myPageEditorMgr = new PageEditorMgr(); myPageEditorMgr.Set_PageLock(this.Page, _pageindexid); // Lock done now start to Design Mode Response.Redirect(string.Format("PageDesign.aspx?PageIndexID={0}&PageLink=Disable", _pageindexid)); }
protected void RadDockLayout_DesignMode_SaveDockLayout(object sender, DockLayoutEventArgs e) { List <DockState> _CurrentDockStates = ((RadDockLayout)this.Page.Master.FindControl("RadDockLayout_DesignMode")).GetRegisteredDocksState(); CurrentDockStates = ((RadDockLayout)this.Page.Master.FindControl("RadDockLayout_DesignMode")).GetRegisteredDocksState(); PageEditorMgr myPageEditorMgr = new PageEditorMgr(); myPageEditorMgr.Edit_DesignMode_Control_Position(this.Page, myPage_Loading_Info, CurrentDockStates); }
protected void btn_Cancel_Command(object sender, CommandEventArgs e) { if (e.CommandArgument != null) { string _pageindexid = e.CommandArgument.ToString(); // Release PageLock PageEditorMgr myPageEditorMgr = new PageEditorMgr(); myPageEditorMgr.Release_PageLock(_pageindexid); Session.Remove("CurrentDockStatesDesignMode"); Response.Redirect(string.Format("Pages.aspx?PageIndexID={0}", _pageindexid)); } }
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 void btn_SwitchTemplate_Click(object sender, EventArgs e) { // Save Template PageEditorMgr myPageEditorMgr = new PageEditorMgr(); // Page Index e2Data[] UpdateData = { new e2Data("Page_LockID", myPage_Loading_Info.Page_LockID), new e2Data("IsTemplate_Inherited", rbtn_IsTemplate_Inherited.SelectedValue), new e2Data("MasterPageIndexID", RadComboBox_Template.SelectedValue) }; myPageEditorMgr.Edit_Page_Lock_Template(UpdateData); iframe_PageEditor_Design.Attributes["src"] = string.Format("Pages/Design.aspx?PageIndexID={0}&PageLink=Disable", myPage_Loading_Info.PageIndexID); }
private void ReCreateDocks(RadDockLayout myDockLayout) { PageEditorMgr myPageEditorMgr = new PageEditorMgr(); // Recreate the docks in order to ensure their proper operation for (int i = 0; i < CurrentDockStates.Count; i++) { if (CurrentDockStates[i].Closed == false) { RadDock myDock = myPageEditorMgr.Load_PageControls_FromState(this.Page, myPage_Loading_Info, CurrentDockStates[i]); LinkButton Linkbtn_Delete = (LinkButton)myDock.TitlebarContainer.FindControl("Linkbtn_Delete"); Linkbtn_Delete.Command += new CommandEventHandler(Linkbtn_Delete_Command); myDockLayout.Controls.Add(myDock); CreateSaveStateTrigger(myDock); } } }
protected void Linkbtn_Delete_Command(object sender, CommandEventArgs e) { //Nexus.Core.Tools.AlertMessage.Show_Alert(this.Page, "This is Delete_Button Command"); // Remove Page Control from Database PageEditorMgr myPageEditorMgr = new PageEditorMgr(); RadDockLayout myDockLayout = (RadDockLayout)this.Page.Master.FindControl("RadDockLayout_DesignMode"); RadDock myDock = (RadDock)myDockLayout.FindControl(e.CommandArgument.ToString()); myPageEditorMgr.Remove_DesignMode_Control(myDock.Tag); // Remove from DockLayout myDock.Closed = true; string _finishupdate_script = string.Format("refreshControl({0});", myDock.Tag); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "myScript", _finishupdate_script, true); }
private void DataFill_Template() { PageEditorMgr myPageEditorMgr = new PageEditorMgr(); Page_Lock_Template myPage_Lock_Template = myPageEditorMgr.Get_Page_Lock_Template(myPage_Loading_Info.Page_LockID); // Template if (myPage_Lock_Template.IsTemplate_Inherited) { rbtn_IsTemplate_Inherited.SelectedValue = "1"; Panel_Template.Enabled = false; } else { rbtn_IsTemplate_Inherited.SelectedValue = "0"; Panel_Template.Enabled = true; } // Look for Template RadComboBox_Template.SelectedValue = myPage_Lock_Template.MasterPageIndexID; }
protected void RadTreeView_Toolbox_NodeDrop(object sender, Telerik.Web.UI.RadTreeNodeDragDropEventArgs e) { RadTreeNode sourceNode = e.SourceDragNode; if (e.HtmlElementID != null) { PlaceHolder myPlaceHolder = (PlaceHolder)Page.Master.FindControl("PlaceHolder_DesignMode"); HtmlInputText _currentPlaceholderPosition = (HtmlInputText)myPlaceHolder.FindControl("currentPlaceholderPosition"); HtmlInputText _currentZoneTB = (HtmlInputText)myPlaceHolder.FindControl("currentZoneTB"); int dockCurrentPos = int.Parse(_currentPlaceholderPosition.Value); PageEditorMgr myPageEditorMgr = new PageEditorMgr(); RadDockLayout myDockLayout = (RadDockLayout)this.Page.Master.FindControl("RadDockLayout_DesignMode"); RadDock myDock = myPageEditorMgr.Add_DesignMode_NewControl(this.Page, myPage_Loading_Info, sourceNode, _currentZoneTB.Value, dockCurrentPos); myDockLayout.Controls.Add(myDock); //UpdatePanel myUpdatePanel = (UpdatePanel)myDockLayout.FindControl("UpdatePanel_Docks"); //myUpdatePanel.ContentTemplateContainer.Controls.Add(myDock); ScriptManager.RegisterStartupScript( myDock, this.GetType(), "AddDock", string.Format(@"function _addDock() {{ Sys.Application.remove_load(_addDock); $find('{1}').dock($find('{0}'),{2}); $find('{0}').doPostBack('DockPositionChanged'); }}; Sys.Application.add_load(_addDock);", myDock.ClientID, _currentZoneTB.Value, dockCurrentPos), true); CreateSaveStateTrigger(myDock); } }
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 Page_Init() { #region Page Properties // Load Page Properties HtmlMeta myKeyword = new HtmlMeta(); myKeyword.Name = "Keyword"; myKeyword.Content = myPage_Loading_Info.Page_Keyword; Header.Controls.Add(myKeyword); HtmlMeta myDescription = new HtmlMeta(); myDescription.Name = "Description"; myDescription.Content = myPage_Loading_Info.Page_Description; Header.Controls.Add(myDescription); // Add CSS for Editor string[] CssFiles = { "~/App_Themes/NexusCore/Editor.css", "~/App_Themes/NexusCore/TreeView.Black.css" }; foreach (string CssFile in CssFiles) { HtmlLink cssEditor_Link = new HtmlLink(); cssEditor_Link.Href = CssFile; cssEditor_Link.Attributes.Add("type", "text/css"); cssEditor_Link.Attributes.Add("rel", "stylesheet"); Header.Controls.Add(cssEditor_Link); } // Add Script File for Editor string[] Scripts = { "/App_AdminCP/SiteAdmin/Pages/TreeViewDock.js" }; foreach (string myScript in Scripts) { string MapPath = Request.ApplicationPath; if (MapPath.EndsWith("/")) { MapPath = MapPath.Remove(MapPath.Length - 1) + myScript; } else { MapPath = MapPath + myScript; } HtmlGenericControl scriptTag = new HtmlGenericControl("script"); scriptTag.Attributes.Add("type", "text/javascript"); scriptTag.Attributes.Add("src", MapPath); Header.Controls.Add(scriptTag); } #endregion // Add Script Manager //ScriptManager myScriptMgr = new ScriptManager(); RadScriptManager myScriptMgr = new RadScriptManager(); myScriptMgr.ID = "ScriptManager_Editor"; HtmlForm myForm = (HtmlForm)Page.Master.FindControl("Form_NexusCore"); myForm.Controls.AddAt(0, myScriptMgr); // Add PlaceHolder PlaceHolder myPlaceHolder = new PlaceHolder(); myPlaceHolder.ID = "PlaceHolder_DesignMode"; #region Add Control Manager Windows // Create CodeBlock RadScriptBlock myCodeBlock = new RadScriptBlock(); // Create Script Tag HtmlGenericControl myCodeBlock_ScriptTag = new HtmlGenericControl("Script"); myCodeBlock_ScriptTag.Attributes.Add("type", "text/javascript"); myCodeBlock_ScriptTag.InnerHtml = Nexus.Core.Phrases.PhraseMgr.Get_Phrase_Value("NexusCore_PageEditor_PoPWindow"); myCodeBlock.Controls.Add(myCodeBlock_ScriptTag); // Create Window Manager RadWindowManager myWindowManager = new RadWindowManager(); myWindowManager.ID = "RadWindowManager_ControlManager"; // Create RadWindow RadWindow myRadWindow = new RadWindow(); myRadWindow.ID = "RadWindow_ControlManager"; myRadWindow.Title = "User Control Manager"; myRadWindow.ReloadOnShow = true; myRadWindow.ShowContentDuringLoad = false; myRadWindow.Modal = true; myRadWindow.Animation = WindowAnimation.Fade; myRadWindow.AutoSize = true; myRadWindow.Behaviors = WindowBehaviors.Close; myRadWindow.InitialBehaviors = WindowBehaviors.Resize; //myRadWindow.DestroyOnClose = true; myRadWindow.KeepInScreenBounds = true; myRadWindow.VisibleStatusbar = false; myWindowManager.Windows.Add(myRadWindow); // Create AjaxManager RadAjaxManager myRadAjaxManager = new RadAjaxManager(); myRadAjaxManager.ID = "RadAjaxManager_ControlManger"; myRadAjaxManager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager_AjaxRequest); // Add to Place Holder myPlaceHolder.Controls.Add(myCodeBlock); myPlaceHolder.Controls.Add(myWindowManager); myPlaceHolder.Controls.Add(myRadAjaxManager); #endregion #region Add TreeView Toolbox // Div and apply with class style HtmlGenericControl myToolboxDiv = new HtmlGenericControl("Div"); myToolboxDiv.Attributes.Add("Class", "nexusCore_Editor_ToolPanel"); //myToolboxDiv.ID = "NexusCore_Editor_Toolbox"; // TreeView Toolbox Div Panel HtmlGenericControl myToolbox_TopDiv = new HtmlGenericControl("Div"); myToolbox_TopDiv.Attributes.Add("Class", "sidebartop"); HtmlGenericControl myToolbox_BotDiv = new HtmlGenericControl("Div"); myToolbox_BotDiv.Attributes.Add("Class", "sidebarbot"); #region Sidebar Top // Tree Hidden Input used to exchange data with server: Place holder position and currentZone HtmlInputText _currentPlaceholderPosition = new HtmlInputText(); _currentPlaceholderPosition.ID = "currentPlaceholderPosition"; _currentPlaceholderPosition.Attributes.Add("style", "display: none"); HtmlInputText _currentZoneTB = new HtmlInputText(); _currentZoneTB.ID = "currentZoneTB"; _currentZoneTB.Attributes.Add("style", "display: none"); myToolbox_TopDiv.Controls.Add(_currentPlaceholderPosition); myToolbox_TopDiv.Controls.Add(_currentZoneTB); // Add TreeView Dock Script HtmlGenericControl myDock_ScriptTag = new HtmlGenericControl("Script"); myDock_ScriptTag.Attributes.Add("type", "text/javascript"); myDock_ScriptTag.InnerHtml = Nexus.Core.Phrases.PhraseMgr.Get_Phrase_Value("NexusCore_PageEditor_Dock"); myToolbox_TopDiv.Controls.Add(myDock_ScriptTag); // Tree Toolbox RadTreeView RadTreeView_Toolbox = new RadTreeView(); RadTreeView_Toolbox.Skin = "Black"; RadTreeView_Toolbox.EnableEmbeddedSkins = false; RadTreeView_Toolbox.ID = "RadTreeView_Toolbox"; RadTreeView_Toolbox.EnableDragAndDrop = true; RadTreeView_Toolbox.ShowLineImages = false; RadTreeView_Toolbox.OnClientNodeDropping = "onClientNodeDropping"; RadTreeView_Toolbox.OnClientNodeDropped = "onNodeDropped"; RadTreeView_Toolbox.OnClientNodeDragging = "onNodeDragging"; // Tree Toolbox event RadTreeView_Toolbox.NodeDrop += new RadTreeViewDragDropEventHandler(RadTreeView_Toolbox_NodeDrop); Nexus.Core.ToolBoxes.ToolBoxMgr myToolBoxMgr = new Nexus.Core.ToolBoxes.ToolBoxMgr(); myToolBoxMgr.Load_Toolbox_Group(RadTreeView_Toolbox); myToolbox_TopDiv.Controls.Add(RadTreeView_Toolbox); #endregion myToolboxDiv.Controls.Add(myToolbox_TopDiv); myToolboxDiv.Controls.Add(myToolbox_BotDiv); myPlaceHolder.Controls.Add(myToolboxDiv); #endregion #region Toolbox button // Add Toolbox button HtmlGenericControl Toolbox_btnLink = new HtmlGenericControl("A"); Toolbox_btnLink.Attributes.Add("href", ""); Toolbox_btnLink.Attributes.Add("onclick", "initSlideLeftPanel();return false"); HtmlGenericControl myToolbox_btnDiv = new HtmlGenericControl("Div"); myToolbox_btnDiv.Attributes.Add("class", "nexusCore_toolsTab"); Toolbox_btnLink.Controls.Add(myToolbox_btnDiv); myPlaceHolder.Controls.Add(Toolbox_btnLink); #endregion #region Add Warp Controls and Dock Layout // Remove inline Controls HtmlGenericControl myContentDiv = (HtmlGenericControl)Page.Master.FindControl("pageWrapContainer"); Page.Master.Controls.Remove(myContentDiv); // Create Page Content Div HtmlGenericControl myEditor_Div = new HtmlGenericControl("Div"); myEditor_Div.Attributes.Add("class", "nexusCore_Editor_MainPanel"); // Create DockLayOut RadDockLayout myDockLayout = new RadDockLayout(); myDockLayout.ID = "RadDockLayout_DesignMode"; myDockLayout.StoreLayoutInViewState = true; // DockLayOut Event myDockLayout.LoadDockLayout += new DockLayoutEventHandler(RadDockLayout_DesignMode_LoadDockLayout); myDockLayout.SaveDockLayout += new DockLayoutEventHandler(RadDockLayout_DesignMode_SaveDockLayout); // Create Hidden Update_Panel UpdatePanel myUpdatePanel_Docks = new UpdatePanel(); myUpdatePanel_Docks.ID = "UpdatePanel_Docks"; // Create Wrap Update_Panel //UpdatePanel myUpdatePanel_DockLayout = new UpdatePanel(); //myUpdatePanel_DockLayout.ID = "UpdatePanel_DockLayout"; // Create myRadAjaxManager Postback Trigger PostBackTrigger RadAjaxTrigger = new PostBackTrigger(); RadAjaxTrigger.ControlID = myRadAjaxManager.ID; myUpdatePanel_Docks.Triggers.Add(RadAjaxTrigger); // Create Tree Toolbox Trigger //AsyncPostBackTrigger nodeDropTrigger = new AsyncPostBackTrigger(); PostBackTrigger nodeDropTrigger = new PostBackTrigger(); nodeDropTrigger.ControlID = RadTreeView_Toolbox.ID; //nodeDropTrigger.EventName = "NodeDrop"; myUpdatePanel_Docks.Triggers.Add(nodeDropTrigger); // Add inLine Controls back myDockLayout.Controls.Add(myContentDiv); myDockLayout.Controls.Add(myUpdatePanel_Docks); //myUpdatePanel_DockLayout.ContentTemplateContainer.Controls.Add(myDockLayout); myEditor_Div.Controls.Add(myDockLayout); myPlaceHolder.Controls.Add(myEditor_Div); myForm.Controls.Add(myPlaceHolder); #endregion // Load MasterPage Control Nexus.Core.Templates.MasterPageMgr myMasterPageMgr = new Nexus.Core.Templates.MasterPageMgr(); myMasterPageMgr.Load_MasterPageControls_WebView(this.Page, myPage_Loading_Info.MasterPageIndexID); // Load Page Control PageEditorMgr myPageEditorMgr = new PageEditorMgr(); myPageEditorMgr.Load_PageDocks_Design(this.Page, myPage_Loading_Info); // Recreate the docks in order to ensure their proper operation for (int i = 0; i < CurrentDockStates.Count; i++) { if (CurrentDockStates[i].Closed == false) { RadDock myDock = myPageEditorMgr.Load_PageControls_FromState(this.Page, myPage_Loading_Info, CurrentDockStates[i]); LinkButton Linkbtn_Delete = (LinkButton)myDock.TitlebarContainer.FindControl("Linkbtn_Delete"); Linkbtn_Delete.Command += new CommandEventHandler(Linkbtn_Delete_Command); Linkbtn_Delete.OnClientClick = string.Format("return confirm('Are you sure you want to delete {0} ?');", myDock.Title); string _pageindexid = Request["PageIndexID"]; myDockLayout.Controls.Add(myDock); CreateSaveStateTrigger(myDock); } } }
private void Page_Init() { #region Add Control Manager Windows // Create CodeBlock RadScriptBlock myCodeBlock = new RadScriptBlock(); // Create Script Tag HtmlGenericControl myCodeBlock_ScriptTag = new HtmlGenericControl("Script"); myCodeBlock_ScriptTag.Attributes.Add("type", "text/javascript"); myCodeBlock_ScriptTag.InnerHtml = Nexus.Core.Phrases.PhraseMgr.Get_Phrase_Value("NexusCore_PageEditor_PoPWindow"); myCodeBlock.Controls.Add(myCodeBlock_ScriptTag); // Create Window Manager RadWindowManager myWindowManager = new RadWindowManager(); myWindowManager.ID = "RadWindowManager_ControlManager"; // Create RadWindow RadWindow myRadWindow = new RadWindow(); myRadWindow.ID = "RadWindow_ControlManager"; myRadWindow.Title = "Module Control Manager"; myRadWindow.ReloadOnShow = true; myRadWindow.ShowContentDuringLoad = false; myRadWindow.Modal = true; myRadWindow.Animation = WindowAnimation.Fade; myRadWindow.AutoSize = true; myRadWindow.Behaviors = WindowBehaviors.Maximize | WindowBehaviors.Close; myRadWindow.InitialBehaviors = WindowBehaviors.Resize; //myRadWindow.DestroyOnClose = true; myRadWindow.KeepInScreenBounds = true; myRadWindow.VisibleStatusbar = false; myWindowManager.Windows.Add(myRadWindow); // Create AjaxManager RadAjaxManager myRadAjaxManager = new RadAjaxManager(); myRadAjaxManager.ID = "ctl00_RadAjaxManager_ControlManger"; myRadAjaxManager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager_AjaxRequest); // Add to Place Holder PlaceHolder_Editor.Controls.Add(myCodeBlock); PlaceHolder_Editor.Controls.Add(myWindowManager); PlaceHolder_Editor.Controls.Add(myRadAjaxManager); #endregion #region Add Page Update refresh panel // Create Hidden Update_Panel UpdatePanel myUpdatePanel = new UpdatePanel(); myUpdatePanel.ID = "UpdatePanel_Refresh"; // Create myRadAjaxManager Postback Trigger PostBackTrigger RadAjaxTrigger = new PostBackTrigger(); RadAjaxTrigger.ControlID = myRadAjaxManager.ID; myUpdatePanel.Triggers.Add(RadAjaxTrigger); // Add inLine Controls back PlaceHolder_Editor.Controls.Add(myUpdatePanel); #endregion _page_controlid = Request.QueryString["Page_ControlID"]; _editmode = Request.QueryString["EditMode"]; // Check EditMode if (_editmode == "PageAdvancedMode" || _editmode == "PageDesignMode" || _editmode == "TemplateAdvancedMode" || _editmode == "TemplateDesignMode") { // Do nothing } else { // Display errors return; } if (_page_controlid != null) { ControlCPMgr myControlCPMgr = new ControlCPMgr(); // Load Component Information Nexus.Core.Modules.ModuleMgr myModuleMgr = new Nexus.Core.Modules.ModuleMgr(); switch (_editmode) { case "PageAdvancedMode": // Load Advance Mode UI myControlCPMgr.Load_ControlEditor_PageAdvancedMode(this.Page, _page_controlid); // Load Component Info PageMgr myPageMgr = new PageMgr(); Page_Control myPage_Control = myPageMgr.Get_Page_Control(_page_controlid); myComponenet = myModuleMgr.Get_Component(myPage_Control.ComponentID); break; case "PageDesignMode": // Load Design Mode UI myControlCPMgr.Load_ControlEditor_PageDesignMode(this.Page, _page_controlid); // Load Component Info PageEditorMgr myPageEditorMgr = new PageEditorMgr(); Page_Lock_Control myPage_Lock_Control = myPageEditorMgr.Get_Page_Lock_Control(_page_controlid); myComponenet = myModuleMgr.Get_Component(myPage_Lock_Control.ComponentID); break; case "TemplateAdvancedMode": // Load Advance Mode UI myControlCPMgr.Load_ControlEditor_TemplateAdvancedMode(this.Page, _page_controlid); // Load Component Info MasterPageMgr myMasterPageMgr = new MasterPageMgr(); MasterPage_Control myMasterPage_Control = myMasterPageMgr.Get_MasterPage_Control(_page_controlid); myComponenet = myModuleMgr.Get_Component(myMasterPage_Control.ComponentID); break; case "TemplateDesignMode": // Load Design Mode UI myControlCPMgr.Load_ControlEditor_TemplateDesignMode(this.Page, _page_controlid); // Load Component Info MasterPageEditorMgr myMasterPageEditorMgr = new MasterPageEditorMgr(); MasterPage_Lock_Control myMasterPage_Lock_Control = myMasterPageEditorMgr.Get_MasterPage_Lock_Control(_page_controlid); myComponenet = myModuleMgr.Get_Component(myMasterPage_Lock_Control.ComponentID); break; } } else { // Display errors } }
private void Page_Init() { _page_controlid = Request.QueryString["Page_ControlID"]; _editmode = Request.QueryString["EditMode"]; // Check EditMode if (_editmode == "PageAdvancedMode" || _editmode == "PageDesignMode" || _editmode == "TemplateAdvancedMode" || _editmode == "TemplateDesignMode") { // Do nothing } else { // Display errors return; } if (_page_controlid != null) { ControlCPMgr myControlCPMgr = new ControlCPMgr(); // Load Component Information Nexus.Core.Modules.ModuleMgr myModuleMgr = new Nexus.Core.Modules.ModuleMgr(); switch (_editmode) { case "PageAdvancedMode": // Load Advance Mode UI myControlCPMgr.Load_ControlEditor_PageAdvancedMode(this.Page, _page_controlid); // Load Component Info PageMgr myPageMgr = new PageMgr(); Page_Control myPage_Control = myPageMgr.Get_Page_Control(_page_controlid); myComponenet = myModuleMgr.Get_Component(myPage_Control.ComponentID); break; case "PageDesignMode": // Load Design Mode UI myControlCPMgr.Load_ControlEditor_PageDesignMode(this.Page, _page_controlid); // Load Component Info PageEditorMgr myPageEditorMgr = new PageEditorMgr(); Page_Lock_Control myPage_Lock_Control = myPageEditorMgr.Get_Page_Lock_Control(_page_controlid); myComponenet = myModuleMgr.Get_Component(myPage_Lock_Control.ComponentID); break; case "TemplateAdvancedMode": // Load Advance Mode UI myControlCPMgr.Load_ControlEditor_TemplateAdvancedMode(this.Page, _page_controlid); // Load Component Info MasterPageMgr myMasterPageMgr = new MasterPageMgr(); MasterPage_Control myMasterPage_Control = myMasterPageMgr.Get_MasterPage_Control(_page_controlid); myComponenet = myModuleMgr.Get_Component(myMasterPage_Control.ComponentID); break; case "TemplateDesignMode": // Load Design Mode UI myControlCPMgr.Load_ControlEditor_TemplateDesignMode(this.Page, _page_controlid); // Load Component Info MasterPageEditorMgr myMasterPageEditorMgr = new MasterPageEditorMgr(); MasterPage_Lock_Control myMasterPage_Lock_Control = myMasterPageEditorMgr.Get_MasterPage_Lock_Control(_page_controlid); myComponenet = myModuleMgr.Get_Component(myMasterPage_Lock_Control.ComponentID); break; } } else { // Display errors } }
public void Load_ControlEditor_PageDesignMode(System.Web.UI.Page myPage, string Page_ControlID) { PageEditorMgr myPageEditor = new PageEditorMgr(); Page_Lock_Control myPage_Control = myPageEditor.Get_Page_Lock_Control(Page_ControlID); Modules.ModuleMgr myModuleMgr = new Modules.ModuleMgr(); Modules.Component myComponent = myModuleMgr.Get_Component(myPage_Control.ComponentID); Modules.Component_Control myControl = myModuleMgr.Get_Control(myPage_Control.ComponentID, Modules.Control_Type.Editor); if (myControl.Assembly_Name != null) { Assembly assembly = Assembly.Load(new AssemblyName(myControl.Assembly_Name)); Type _control_type = assembly.GetType(myControl.Class_Name); Control _control = myPage.LoadControl(_control_type, null); List <Page_Lock_Control_Property> Control_Properties = myPageEditor.Get_Page_Lock_Control_Properties(myPage_Control.Page_ControlID); // Load Exist Control foreach (Page_Lock_Control_Property Control_Property in Control_Properties) { try { PropertyInfo _Control_Property = _control_type.GetProperty(Control_Property.Property_Name); switch (_Control_Property.PropertyType.FullName) { case "System.String": _Control_Property.SetValue(_control, Control_Property.Property_Value, null); break; case "System.Int32": _Control_Property.SetValue(_control, Convert.ToInt32(Control_Property.Property_Value), null); break; case "System.Boolean": _Control_Property.SetValue(_control, Convert.ToBoolean(Control_Property.Property_Value), null); break; default: _Control_Property.SetValue(_control, Control_Property.Property_Value, null); break; } } catch { // do nothing } } // Place PageControlID and EditMode PropertyInfo Page_ControlID_Property = _control_type.GetProperty("Page_ControlID"); Page_ControlID_Property.SetValue(_control, Page_ControlID, null); PropertyInfo EditMode_Property = _control_type.GetProperty("EditMode"); EditMode_Property.SetValue(_control, "PageDesignMode", null); // Create Events Failed //EventInfo _Control_Event = _control_type.GetEvent("FinishUpdate"); //_Control_Event. // Create Editor PlaceHolder myPlaceHolder = (PlaceHolder)myPage.FindControl("PlaceHolder_Editor"); myPlaceHolder.Controls.Add(_control); } else { throw new Exception(string.Format("Invalid PageControl Editor.Design Mode ComponentID: {0}", myPage_Control.ComponentID)); } }
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); } }