Ejemplo n.º 1
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        m_refMsg = m_refContentApi.EkMsgRef;
        AppImgPath = m_refContentApi.AppImgPath;
        ltr_Title.Text = m_refMsg.GetMessage("lbl cms business rulesets");

        RegisterResources();
        try
        {
            Utilities.ValidateUserLogin();
            if (m_refContentApi.RequestInformationRef.IsMembershipUser == 1 || m_refContentApi.RequestInformationRef.UserId == 0)
            {
                Response.Redirect((string)("../reterror.aspx?info=" + m_refMsg.GetMessage("msg login cms user")), false);
                return;
            }

            if (!string.IsNullOrEmpty(Request.QueryString["action"]))
            {
                m_sPageAction = (string)(Request.QueryString["action"].ToLower());
            }
            else
            {
                m_sPageAction = "";
            }
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                m_iRuleID = Convert.ToInt64(Request.QueryString["id"]);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["rulesetid"]))
            {
                m_iID = Convert.ToInt64(Request.QueryString["rulesetid"].ToString());
            }

            m_rulesUI = new Ektron.Cms.RulesEngine.UI(m_refContentApi.RequestInformationRef);
            m_acontem = m_rulesUI.GetAllConditionTemplates();
            m_aacttem = m_rulesUI.GetAllActionTemplates();
            m_tpacondition = m_rulesUI.GetAllConditionTemplateParams();
            m_tpaaction = m_rulesUI.GetAllActionTemplateParams();

            OutputJS();
            ShowHidden();

            if (m_sPageAction == "edit")
            {
                m_aruleparam = m_rulesUI.GetRuleParams(m_iRuleID);
                m_rulesengineRule = new Ektron.Cms.RulesEngine.Rule(m_refContentApi.RequestInformationRef);
                m_rulesengineRule.load(m_iRuleID);
                ruleNameText.Value = m_rulesengineRule.RuleName;
                cmswizard ucWizard;
                ucWizard = (cmswizard)(LoadControl("../controls/wizard/wizard.ascx"));
                ucWizard.AllowSelect = true;
                ucWizard.ID = "ProgressSteps";
                pnlwizard.Controls.Add(ucWizard);
                BuildTemplateJS("edit");
                ShowRuleToolBar();
            }
            else if (m_sPageAction == "view")
            {
                m_aruleparam = m_rulesUI.GetRuleParams(m_iRuleID);
                m_rulesengineRule = new Ektron.Cms.RulesEngine.Rule(m_refContentApi.RequestInformationRef);
                m_rulesengineRule.load(m_iRuleID);
                ruleNameText.Value = m_rulesengineRule.RuleName;
                BuildTemplateJS("view");
                ShowRuleToolBar();
            }
            else if (m_sPageAction == "add")
            {
                BuildTemplateJS("add");
                cmswizard ucWizard;
                ucWizard = (cmswizard)(LoadControl("../controls/wizard/wizard.ascx"));
                ucWizard.AllowSelect = false; // do not allow skip for add
                ucWizard.ID = "ProgressSteps";
                pnlwizard.Controls.Add(ucWizard);
                ShowRuleToolBar();
            }
            else if (m_sPageAction == "process")
            {
                BuildTemplateJS("add");
                ProcessHandler();
            }
        }
        catch (Exception ex)
        {
            //Response.Write(ex.Message & ex.StackTrace)
            Utilities.ShowError(ex.Message);
        }
    }