コード例 #1
0
ファイル: ruleset.aspx.cs プロジェクト: jaytem/minGit
    protected override void Page_Load(object sender, System.EventArgs e)
    {
        base.Page_Load(sender, e);
        try
        {
            if (m_refCommon.RequestInformationRef.IsMembershipUser == 1 || m_refCommon.RequestInformationRef.UserId == 0)
            {
                Response.Redirect("../login.aspx?fromLnkPg=1", false);
                return;
            }
            else
            {
                Page.Title = "CMS Business Rulesets";
                msSelectRule.Text = m_refMsg.GetMessage("lbl select rule");
                msRuleToRemove.Text = m_refMsg.GetMessage("lbl select rule to remove");
                noRulesInSet.Text = m_refMsg.GetMessage("lbl no rules in bussiness ruleset");
                ShowHidden();

                m_rulesUI = new Ektron.Cms.RulesEngine.UI(m_refContentApi.RequestInformationRef);
                m_aRuleset = m_rulesUI.GetAllRulesets();

                if (m_sPageAction == "edit")
                {
                    if (!(Page.IsPostBack))
                    {
                        traddruleset.Visible = true;
                        trgrid.Visible = false;
                        GoGet();
                        AddEditRulesetToolBar();
                        RulesJS();
                        AddEditJS("edit");
                    }
                    else
                    {
                        RulesetSaveHandler();
                        Response.Redirect((string)("ruleset.aspx?action=View&id=" + m_iID.ToString()), false);
                    }
                    traddedit.Visible = true;
                    trgrid.Visible = false;
                }
                else if (m_sPageAction == "view")
                {
                    if (!(Page.IsPostBack))
                    {
                        GoGet();
                        ViewRulesetToolBar();
                        RulesJS();
                        AddEditJS("add");
                    }
                    traddedit.Visible = true;
                    trgrid.Visible = false;
                }
                else if (m_sPageAction == "add")
                {
                    SetAction("");
                    if (!(Page.IsPostBack))
                    {
                        AddRulesetToolBar();
                        traddruleset.Visible = true;
                        trgrid.Visible = false;
                        AddJS();
                        if (!string.IsNullOrEmpty(Request.QueryString["identifier"]))
                        {
                            txtIdentifier.Value = EkFunctions.HtmlEncode(Request.QueryString["identifier"]);
                        }
                        else
                        {
                            tridentifier.Visible = false;
                        }
                    }
                    else
                    {
                        m_iID = RulesetAddHandler();
                        Response.Redirect((string)("ruleset.aspx?action=View&id=" + m_iID.ToString()), false);
                    }
                }
                else if (m_sPageAction == "select")
                {
                    SetAction("");
                    if (!(Page.IsPostBack))
                    {
                        traddedit.Visible = true;
                        SelectRulesToolBar();
                        GetSelectableRules();
                        RulesJS();
                        AddEditJS("select");
                    }
                    else
                    {
                        RulesetSelectHandler();
                        Response.Redirect((string)("ruleset.aspx?action=View&id=" + m_iID.ToString()), false);
                    }
                }
                else if (m_sPageAction == "remove")
                {
                    RulesetDeleteHandler();
                    Response.Redirect("ruleset.aspx", false);
                }
                else
                {
                    traddedit.Visible = false;
                    ShowRulesetToolBar();
                    PopulateViewRuleSetGrid(m_aRuleset);
                }
            }
        }
        catch (Exception ex)
        {
            Utilities.ShowError(ex.Message);
        }

        Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronWorkareaCss);
        Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronWorkareaIeCss, Ektron.Cms.API.Css.BrowserTarget.LessThanEqualToIE7);
        Ektron.Cms.API.Css.RegisterCss(this, Ektron.Cms.API.Css.ManagedStyleSheet.EktronFixedPositionToolbarCss);
    }