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); } } }
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); } } }