예제 #1
0
    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
        }
    }
예제 #2
0
    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
        }
    }
예제 #3
0
        public void Load_ControlEditor_PageAdvancedMode(System.Web.UI.Page myPage, string Page_ControlID)
        {
            PageMgr      myPageMgr      = new PageMgr();
            Page_Control myPage_Control = myPageMgr.Get_Page_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_Control_Property> Control_Properties = myPageMgr.Get_Page_Control_Properties(myPage_Control.Page_ControlID);

                // Load Exist Control
                foreach (Page_Control_Property Control_Property in Control_Properties)
                {
                    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;
                    }
                }

                // 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, "PageAdvancedMode", 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));
            }
        }